diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dae76878a3..a6bd32c1cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,15 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - name: Install Dependencies run: sudo apt-get install gettext + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Validate run: VERSION=${{ github.event.repository.default_branch }} JOBS=4 MODE=html make all diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index ed99a444c7..2c7442c1a8 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -14,11 +14,14 @@ jobs: - name: Install Dependencies run: sudo apt-get install gettext + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Build run: JOBS=4 MODE=html make all - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.7.1 + uses: JamesIves/github-pages-deploy-action@v4.7.3 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages diff --git a/.github/workflows/py313-sync-cpython.yml b/.github/workflows/py313-sync-cpython.yml index 9305dbc4b2..f3362c52c5 100644 --- a/.github/workflows/py313-sync-cpython.yml +++ b/.github/workflows/py313-sync-cpython.yml @@ -30,8 +30,11 @@ jobs: - name: Install Dependencies run: sudo apt-get install gettext + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Sync with CPython - run: make clone && make merge && make rm_cpython + run: make clone merge rm_cpython wrap - uses: tibdex/github-app-token@v2 id: generate-token diff --git a/.github/workflows/summarize_progress.yml b/.github/workflows/summarize_progress.yml index 3ffccb41a9..c13a205ad5 100644 --- a/.github/workflows/summarize_progress.yml +++ b/.github/workflows/summarize_progress.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - name: Install poetry - uses: abatilo/actions-poetry@v3 + uses: abatilo/actions-poetry@v4 - name: Execute Check Process run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cf6db96a6..33a264ab44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,6 @@ repos: - repo: https://git.afpy.org/AFPy/powrap # there's no release tag in repo, use the latest commit hash id instead - rev: a34a9fed116d24562fbe4bb8d456ade85f056c36 + rev: v1.0.2 hooks: - id: powrap \ No newline at end of file diff --git a/Makefile b/Makefile index f255eb901d..c0da35f4af 100644 --- a/Makefile +++ b/Makefile @@ -89,21 +89,21 @@ prepare_cpython: ## Prepare CPython clone at `../cpython/`. $(VENV)/bin/activate: - python3 -m venv $(VENV) + uv venv $(VENV) $(VENV)/bin/sphinx-build: $(VENV)/bin/activate - . $(VENV)/bin/activate; python3 -m pip install sphinx python-docs-theme + . $(VENV)/bin/activate; uv pip install sphinx python-docs-theme $(VENV)/bin/sphinx-lint: $(VENV)/bin/activate - . $(VENV)/bin/activate; python3 -m pip install sphinx-lint + . $(VENV)/bin/activate; uv pip install sphinx-lint $(VENV)/bin/blurb: $(VENV)/bin/activate - . $(VENV)/bin/activate; python3 -m pip install blurb + . $(VENV)/bin/activate; uv pip install blurb .PHONY: upgrade_venv upgrade_venv: $(VENV)/bin/activate ## Upgrade the venv that compiles the doc - @. $(VENV)/bin/activate; python3 -m pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint + @. $(VENV)/bin/activate; uv pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint .PHONY: progress @@ -156,6 +156,10 @@ rm_cpython: ## Remove cloned cpython repo lint: $(VENV)/bin/sphinx-lint ## Run sphinx-lint $(VENV)/bin/sphinx-lint --enable default-role +.PHONY: wrap +wrap: ## Run powrap on modified po files + uvx powrap --modified + # This allows us to accept extra arguments (by doing nothing when we get a job that doesn't match, rather than throwing an error) %: @: diff --git a/README.rst b/README.rst index c239b4a89a..4a5fcd7f1e 100644 --- a/README.rst +++ b/README.rst @@ -84,6 +84,7 @@ the PSF for inclusion in the documentation. - `安裝好 git `_\ (Windows 上請參考 https://gitforwindows.org/) - 一個 ``.po`` 檔的編輯器。推薦使用 `Poedit `_,若熟悉 po 檔用一般文字編輯器亦可。 +- 參考 `uv Installation `_ 安裝 uv,以便在本機端預覽翻譯成果。 - macOS 的使用者還需要先利用 `homebrew `_ 安裝 gettext,屆時 Sphinx 會使用到。 .. code-block:: bash @@ -232,7 +233,7 @@ the PSF for inclusion in the documentation. 其中最簡單的貢獻方式就是更新 *fuzzy entries*,讓曾經翻譯的內容保持與最新版本的文件 同步。請參考\ `尋找有翻譯過但需校閱的 fuzzy entries`_ 段落。 -此外,當前的目標為完成 **Tutorial** 的翻譯,因此在 ``tutorial/`` 底下的所有 +此外,目前的目標為完成 **Tutorial** 的翻譯,因此在 ``tutorial/`` 底下的所有 po 檔皆為首要的翻譯對象。你也可以幫忙校對已經翻譯過的內容。 diff --git a/about.po b/about.po index 34c5041570..a95b16de88 100644 --- a/about.po +++ b/about.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -14,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:15+0000\n" "PO-Revision-Date: 2022-05-12 00:11+0800\n" "Last-Translator: hsiao yi \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,18 +26,19 @@ msgstr "" "X-Generator: Poedit 3.0.1\n" #: ../../about.rst:3 -msgid "About these documents" -msgstr "關於這些說明文件" +msgid "About this documentation" +msgstr "關於這份說明文件" #: ../../about.rst:6 msgid "" -"These documents are generated from `reStructuredText`_ sources by `Sphinx`_, " -"a document processor specifically written for the Python documentation." +"Python's documentation is generated from `reStructuredText`_ sources using " +"`Sphinx`_, a documentation generator originally created for Python and now " +"maintained as an independent project." msgstr "" -"這些說明文件是透過 `Sphinx`_ (一個專為 Python 說明文件所撰寫的文件處理器)將" -"使用 `reStructuredText`_ 撰寫的原始檔轉換而成。" +"Python 說明文件是透過使用 `Sphinx`_\\ (一個原為 Python 而生的文件產生器、目" +"前是以獨立專案形式來維護)將使用 `reStructuredText`_ 撰寫的原始檔轉換而成。" -#: ../../about.rst:15 +#: ../../about.rst:16 msgid "" "Development of the documentation and its toolchain is an entirely volunteer " "effort, just like Python itself. If you want to contribute, please take a " @@ -49,26 +49,26 @@ msgstr "" "報臭蟲,請見 :ref:`reporting-bugs` 頁面,內含相關資訊。我們永遠歡迎新的自願者" "加入!" -#: ../../about.rst:20 +#: ../../about.rst:21 msgid "Many thanks go to:" msgstr "致謝:" -#: ../../about.rst:22 +#: ../../about.rst:23 msgid "" "Fred L. Drake, Jr., the creator of the original Python documentation toolset " -"and writer of much of the content;" +"and author of much of the content;" msgstr "" "Fred L. Drake, Jr.,原始 Python 文件工具集的創造者以及一大部份內容的作者;" -#: ../../about.rst:24 +#: ../../about.rst:25 msgid "" "the `Docutils `_ project for creating " "reStructuredText and the Docutils suite;" msgstr "" -"創造 reStructuredText 和 Docutils 工具組的 `Docutils `_ 專案;" +"創造 reStructuredText 和 Docutils 工具組的 `Docutils `_ 專案;" -#: ../../about.rst:26 +#: ../../about.rst:27 msgid "" "Fredrik Lundh for his Alternative Python Reference project from which Sphinx " "got many good ideas." @@ -76,11 +76,11 @@ msgstr "" "Fredrik Lundh 先生,Sphinx 從他的 Alternative Python Reference 計劃中獲得許多" "的好主意。" -#: ../../about.rst:31 -msgid "Contributors to the Python Documentation" +#: ../../about.rst:32 +msgid "Contributors to the Python documentation" msgstr "Python 文件的貢獻者們" -#: ../../about.rst:33 +#: ../../about.rst:34 msgid "" "Many people have contributed to the Python language, the Python standard " "library, and the Python documentation. See :source:`Misc/ACKS` in the " @@ -89,7 +89,7 @@ msgstr "" "許多人都曾為 Python 這門語言、Python 標準函式庫和 Python 說明文件貢獻過。" "Python 所發佈的原始碼中含有部份貢獻者的清單,請見 :source:`Misc/ACKS` 。" -#: ../../about.rst:37 +#: ../../about.rst:38 msgid "" "It is only with the input and contributions of the Python community that " "Python has such wonderful documentation -- Thank You!" diff --git a/c-api/allocation.po b/c-api/allocation.po index 2d4ce8e20a..28435d6916 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-06 00:13+0000\n" +"POT-Creation-Date: 2025-03-18 00:14+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -56,7 +56,14 @@ msgstr "" "化;呼叫者會擁有那個對於物件的唯一參照(物件的參照計數為一)。記憶體分配大小" "由 type 物件的 :c:member:`~PyTypeObject.tp_basicsize` 欄位來指定。" -#: ../../c-api/allocation.rst:41 +#: ../../c-api/allocation.rst:38 +msgid "" +"Note that this function is unsuitable if *typeobj* has :c:macro:" +"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_New` " +"instead." +msgstr "" + +#: ../../c-api/allocation.rst:45 msgid "" "Allocate a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " @@ -75,7 +82,14 @@ msgstr "" "於實現如 tuple 這種能夠在建立期間決定自己大小的物件是很實用的。將欄位的陣列嵌" "入到相同的記憶體分配中可以減少記憶體分配的次數,這提高了記憶體管理的效率。" -#: ../../c-api/allocation.rst:55 +#: ../../c-api/allocation.rst:56 +msgid "" +"Note that this function is unsuitable if *typeobj* has :c:macro:" +"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_NewVar` " +"instead." +msgstr "" + +#: ../../c-api/allocation.rst:63 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_New` or :c:" "macro:`PyObject_NewVar`. This is normally called from the :c:member:" @@ -88,7 +102,7 @@ msgstr "" "handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配的" "記憶體已不再是一個有效的 Python 物件。" -#: ../../c-api/allocation.rst:64 +#: ../../c-api/allocation.rst:72 msgid "" "Object which is visible in Python as ``None``. This should only be accessed " "using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " @@ -97,10 +111,10 @@ msgstr "" "這個物件像是 Python 中的 ``None``。它只應該透過 :c:macro:`Py_None` 巨集來存" "取,該巨集的拿到指向該物件的指標。" -#: ../../c-api/allocation.rst:71 +#: ../../c-api/allocation.rst:79 msgid ":c:func:`PyModule_Create`" msgstr ":c:func:`PyModule_Create`" -#: ../../c-api/allocation.rst:72 +#: ../../c-api/allocation.rst:80 msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" diff --git a/c-api/arg.po b/c-api/arg.po index 6e8339452f..921b3bae7f 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-06 05:40+0000\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,7 +24,7 @@ msgstr "剖析引數與建置數值" #: ../../c-api/arg.rst:8 msgid "" -"These functions are useful when creating your own extensions functions and " +"These functions are useful when creating your own extension functions and " "methods. Additional information and examples are available in :ref:" "`extending-index`." msgstr "" @@ -41,7 +40,7 @@ msgstr "" #: ../../c-api/arg.rst:19 msgid "Parsing arguments" -msgstr "" +msgstr "剖析引數" #: ../../c-api/arg.rst:21 msgid "" @@ -152,7 +151,7 @@ msgstr "" #: ../../c-api/arg.rst:100 msgid "``s*`` (:class:`str` or :term:`bytes-like object`) [Py_buffer]" -msgstr "``s*``\\ (:class:`str` 或 :term:`bytes-like object`)[Py_buffer]" +msgstr "``s*`` (:class:`str` 或 :term:`bytes-like object`) [Py_buffer]" #: ../../c-api/arg.rst:101 msgid "" @@ -167,6 +166,8 @@ msgid "" "``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" "c:type:`Py_ssize_t`]" msgstr "" +"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char \\*, :c:" +"type:`Py_ssize_t`]" #: ../../c-api/arg.rst:107 msgid "" @@ -177,9 +178,9 @@ msgid "" "encoding." msgstr "" -#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:581 +#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:593 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" -msgstr "``z``\\ (:class:`str` 或 ``None``)[const char \\*]" +msgstr "``z`` (:class:`str` 或 ``None``) [const char \\*]" #: ../../c-api/arg.rst:114 msgid "" @@ -191,7 +192,7 @@ msgstr "" msgid "" "``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]" msgstr "" -"``z*``\\ (:class:`str`、:term:`bytes-like object` 或 ``None``)[Py_buffer]" +"``z*`` (:class:`str`、:term:`bytes-like object` 或 ``None``) [Py_buffer]" #: ../../c-api/arg.rst:118 msgid "" @@ -204,6 +205,8 @@ msgid "" "``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) " "[const char \\*, :c:type:`Py_ssize_t`]" msgstr "" +"``z#`` (:class:`str`、唯讀的 :term:`bytes-like object` 或 ``None``) [const " +"char \\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:122 msgid "" @@ -213,7 +216,7 @@ msgstr "" #: ../../c-api/arg.rst:125 msgid "``y`` (read-only :term:`bytes-like object`) [const char \\*]" -msgstr "``y``\\ (唯讀 :term:`bytes-like object`)[const char \\*]" +msgstr "``y`` (唯讀的 :term:`bytes-like object`) [const char \\*]" #: ../../c-api/arg.rst:126 msgid "" @@ -244,6 +247,8 @@ msgid "" "``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" "`Py_ssize_t`]" msgstr "" +"``y#`` (唯讀的 :term:`bytes-like object`) [const char \\*, :c:type:" +"`Py_ssize_t`]" #: ../../c-api/arg.rst:142 msgid "" @@ -287,7 +292,7 @@ msgstr "" #: ../../c-api/arg.rst:160 msgid "``w*`` (read-write :term:`bytes-like object`) [Py_buffer]" -msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" +msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" #: ../../c-api/arg.rst:161 msgid "" @@ -331,6 +336,8 @@ msgid "" "``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " "\\*encoding, char \\*\\*buffer]" msgstr "" +"``et`` (:class:`str`、:class:`bytes` 或 :class:`bytearray`) [const char " +"\\*encoding, char \\*\\*buffer]" #: ../../c-api/arg.rst:184 msgid "" @@ -344,6 +351,8 @@ msgid "" "``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" "`Py_ssize_t` \\*buffer_length]" msgstr "" +"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" +"`Py_ssize_t` \\*buffer_length]" #: ../../c-api/arg.rst:189 msgid "" @@ -367,7 +376,7 @@ msgstr "" #: ../../c-api/arg.rst:203 msgid "There are two modes of operation:" -msgstr "" +msgstr "有兩個操作模式:" #: ../../c-api/arg.rst:205 msgid "" @@ -417,38 +426,59 @@ msgid "Numbers" msgstr "數字" #: ../../c-api/arg.rst:232 +msgid "" +"These formats allow representing Python numbers or single characters as C " +"numbers. Formats that require :class:`int`, :class:`float` or :class:" +"`complex` can also use the corresponding special methods :meth:`~object." +"__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " +"convert the Python object to the required type." +msgstr "" + +#: ../../c-api/arg.rst:238 +msgid "" +"For signed integer formats, :exc:`OverflowError` is raised if the value is " +"out of range for the C type. For unsigned integer formats, no range checking " +"is done --- the most significant bits are silently truncated when the " +"receiving field is too small to receive the value." +msgstr "" + +#: ../../c-api/arg.rst:244 msgid "``b`` (:class:`int`) [unsigned char]" msgstr "``b`` (:class:`int`) [unsigned char]" -#: ../../c-api/arg.rst:233 +#: ../../c-api/arg.rst:245 msgid "" -"Convert a nonnegative Python integer to an unsigned tiny int, stored in a C :" -"c:expr:`unsigned char`." +"Convert a nonnegative Python integer to an unsigned tiny integer, stored in " +"a C :c:expr:`unsigned char`." msgstr "" +"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C 的 :c:" +"expr:`unsigned`" -#: ../../c-api/arg.rst:236 ../../c-api/arg.rst:615 +#: ../../c-api/arg.rst:248 ../../c-api/arg.rst:627 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "``B`` (:class:`int`) [unsigned char]" -#: ../../c-api/arg.rst:237 +#: ../../c-api/arg.rst:249 msgid "" -"Convert a Python integer to a tiny int without overflow checking, stored in " -"a C :c:expr:`unsigned char`." +"Convert a Python integer to a tiny integer without overflow checking, stored " +"in a C :c:expr:`unsigned char`." msgstr "" +"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C 的 :c:" +"expr:`unsigned char`。" -#: ../../c-api/arg.rst:240 ../../c-api/arg.rst:609 +#: ../../c-api/arg.rst:252 ../../c-api/arg.rst:621 msgid "``h`` (:class:`int`) [short int]" msgstr "``h`` (:class:`int`) [short int]" -#: ../../c-api/arg.rst:241 +#: ../../c-api/arg.rst:253 msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`short int`。" -#: ../../c-api/arg.rst:243 ../../c-api/arg.rst:618 +#: ../../c-api/arg.rst:255 ../../c-api/arg.rst:630 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "``H`` (:class:`int`) [unsigned short int]" -#: ../../c-api/arg.rst:244 +#: ../../c-api/arg.rst:256 msgid "" "Convert a Python integer to a C :c:expr:`unsigned short int`, without " "overflow checking." @@ -456,57 +486,57 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned short int`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:247 ../../c-api/arg.rst:603 +#: ../../c-api/arg.rst:259 ../../c-api/arg.rst:615 msgid "``i`` (:class:`int`) [int]" msgstr "``i`` (:class:`int`) [int]" -#: ../../c-api/arg.rst:248 +#: ../../c-api/arg.rst:260 msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`int`。" -#: ../../c-api/arg.rst:250 ../../c-api/arg.rst:621 +#: ../../c-api/arg.rst:262 ../../c-api/arg.rst:633 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "``I`` (:class:`int`) [unsigned int]" -#: ../../c-api/arg.rst:251 +#: ../../c-api/arg.rst:263 msgid "" "Convert a Python integer to a C :c:expr:`unsigned int`, without overflow " "checking." msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned int`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:254 ../../c-api/arg.rst:612 +#: ../../c-api/arg.rst:266 ../../c-api/arg.rst:624 msgid "``l`` (:class:`int`) [long int]" msgstr "``l`` (:class:`int`) [long int]" -#: ../../c-api/arg.rst:255 +#: ../../c-api/arg.rst:267 msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long int`。" -#: ../../c-api/arg.rst:257 ../../c-api/arg.rst:624 +#: ../../c-api/arg.rst:269 ../../c-api/arg.rst:636 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "``k`` (:class:`int`) [unsigned long]" -#: ../../c-api/arg.rst:258 +#: ../../c-api/arg.rst:270 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long` without overflow " "checking." msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:261 ../../c-api/arg.rst:627 +#: ../../c-api/arg.rst:273 ../../c-api/arg.rst:639 msgid "``L`` (:class:`int`) [long long]" msgstr "``L`` (:class:`int`) [long long]" -#: ../../c-api/arg.rst:262 +#: ../../c-api/arg.rst:274 msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long long`。" -#: ../../c-api/arg.rst:264 ../../c-api/arg.rst:630 +#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:644 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "``K`` (:class:`int`) [unsigned long long]" -#: ../../c-api/arg.rst:265 +#: ../../c-api/arg.rst:277 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long long` without " "overflow checking." @@ -514,71 +544,71 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long long`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:268 ../../c-api/arg.rst:633 +#: ../../c-api/arg.rst:280 ../../c-api/arg.rst:647 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:269 +#: ../../c-api/arg.rst:281 msgid "Convert a Python integer to a C :c:type:`Py_ssize_t`." msgstr "將一個 Python 整數轉換成 C 的 :c:type:`Py_ssize_t`。" -#: ../../c-api/arg.rst:271 +#: ../../c-api/arg.rst:283 msgid "``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]" -msgstr "``c``\\ (:class:`bytes` 或長度為 1 的 :class:`bytearray`)[char]" +msgstr "``c`` (:class:`bytes` 或長度為 1 的 :class:`bytearray`) [char]" -#: ../../c-api/arg.rst:272 +#: ../../c-api/arg.rst:284 msgid "" "Convert a Python byte, represented as a :class:`bytes` or :class:`bytearray` " "object of length 1, to a C :c:expr:`char`." msgstr "" -#: ../../c-api/arg.rst:275 +#: ../../c-api/arg.rst:287 msgid "Allow :class:`bytearray` objects." msgstr "允許 :class:`bytearray` 物件。" -#: ../../c-api/arg.rst:278 ../../c-api/arg.rst:640 +#: ../../c-api/arg.rst:290 ../../c-api/arg.rst:654 msgid "``C`` (:class:`str` of length 1) [int]" -msgstr "``C``\\ (長度為 1 的 :class:`str`)[int]" +msgstr "``C`` (長度為 1 的 :class:`str`) [int]" -#: ../../c-api/arg.rst:279 +#: ../../c-api/arg.rst:291 msgid "" "Convert a Python character, represented as a :class:`str` object of length " "1, to a C :c:expr:`int`." msgstr "" -#: ../../c-api/arg.rst:282 ../../c-api/arg.rst:647 +#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:661 msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" -#: ../../c-api/arg.rst:283 +#: ../../c-api/arg.rst:295 msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`float`。" -#: ../../c-api/arg.rst:285 ../../c-api/arg.rst:644 +#: ../../c-api/arg.rst:297 ../../c-api/arg.rst:658 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" -#: ../../c-api/arg.rst:286 +#: ../../c-api/arg.rst:298 msgid "Convert a Python floating-point number to a C :c:expr:`double`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`double`。" -#: ../../c-api/arg.rst:288 +#: ../../c-api/arg.rst:300 msgid "``D`` (:class:`complex`) [Py_complex]" msgstr "``D`` (:class:`complex`) [Py_complex]" -#: ../../c-api/arg.rst:289 +#: ../../c-api/arg.rst:301 msgid "Convert a Python complex number to a C :c:type:`Py_complex` structure." msgstr "將一個 Python 複數轉換成 C 的 :c:type:`Py_complex` 結構。" -#: ../../c-api/arg.rst:292 +#: ../../c-api/arg.rst:304 msgid "Other objects" msgstr "其他物件" -#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:653 +#: ../../c-api/arg.rst:306 ../../c-api/arg.rst:667 msgid "``O`` (object) [PyObject \\*]" -msgstr "``O``\\ (物件)[PyObject \\*]" +msgstr "``O`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:295 +#: ../../c-api/arg.rst:307 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " "program thus receives the actual object that was passed. A new :term:" @@ -586,11 +616,11 @@ msgid "" "not increased). The pointer stored is not ``NULL``." msgstr "" -#: ../../c-api/arg.rst:301 +#: ../../c-api/arg.rst:313 msgid "``O!`` (object) [*typeobject*, PyObject \\*]" -msgstr "``O!``\\ (物件)[*typeobject*, PyObject \\*]" +msgstr "``O!`` (object) [*typeobject*, PyObject \\*]" -#: ../../c-api/arg.rst:302 +#: ../../c-api/arg.rst:314 msgid "" "Store a Python object in a C object pointer. This is similar to ``O``, but " "takes two C arguments: the first is the address of a Python type object, the " @@ -599,11 +629,11 @@ msgid "" "required type, :exc:`TypeError` is raised." msgstr "" -#: ../../c-api/arg.rst:310 ../../c-api/arg.rst:671 -msgid "``O&`` (object) [*converter*, *anything*]" -msgstr "``O&``\\ (物件)[*converter*, *anything*]" +#: ../../c-api/arg.rst:322 +msgid "``O&`` (object) [*converter*, *address*]" +msgstr "``O&`` (object) [*converter*, *address*]" -#: ../../c-api/arg.rst:311 +#: ../../c-api/arg.rst:323 msgid "" "Convert a Python object to a C variable through a *converter* function. " "This takes two arguments: the first is a function, the second is the address " @@ -611,11 +641,11 @@ msgid "" "*converter* function in turn is called as follows::" msgstr "" -#: ../../c-api/arg.rst:316 +#: ../../c-api/arg.rst:328 msgid "status = converter(object, address);" msgstr "status = converter(object, address);" -#: ../../c-api/arg.rst:318 +#: ../../c-api/arg.rst:330 msgid "" "where *object* is the Python object to be converted and *address* is the :c:" "expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " @@ -625,24 +655,30 @@ msgid "" "unmodified." msgstr "" -#: ../../c-api/arg.rst:324 +#: ../../c-api/arg.rst:339 msgid "" -"If the *converter* returns ``Py_CLEANUP_SUPPORTED``, it may get called a " -"second time if the argument parsing eventually fails, giving the converter a " -"chance to release any memory that it had already allocated. In this second " -"call, the *object* parameter will be ``NULL``; *address* will have the same " -"value as in the original call." +"If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get " +"called a second time if the argument parsing eventually fails, giving the " +"converter a chance to release any memory that it had already allocated. In " +"this second call, the *object* parameter will be ``NULL``; *address* will " +"have the same value as in the original call." msgstr "" -#: ../../c-api/arg.rst:330 -msgid "``Py_CLEANUP_SUPPORTED`` was added." -msgstr "加入 ``Py_CLEANUP_SUPPORTED``。" +#: ../../c-api/arg.rst:345 +msgid "" +"Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:" +"`PyUnicode_FSDecoder`." +msgstr "" + +#: ../../c-api/arg.rst:348 +msgid ":c:macro:`!Py_CLEANUP_SUPPORTED` was added." +msgstr "新增 :c:macro:`!Py_CLEANUP_SUPPORTED`。" -#: ../../c-api/arg.rst:333 +#: ../../c-api/arg.rst:351 msgid "``p`` (:class:`bool`) [int]" msgstr "``p`` (:class:`bool`) [int]" -#: ../../c-api/arg.rst:334 +#: ../../c-api/arg.rst:352 msgid "" "Tests the value passed in for truth (a boolean **p**\\ redicate) and " "converts the result to its equivalent C true/false integer value. Sets the " @@ -651,37 +687,28 @@ msgid "" "how Python tests values for truth." msgstr "" -#: ../../c-api/arg.rst:342 ../../c-api/arg.rst:677 +#: ../../c-api/arg.rst:360 ../../c-api/arg.rst:691 msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" -#: ../../c-api/arg.rst:343 +#: ../../c-api/arg.rst:361 msgid "" "The object must be a Python sequence whose length is the number of format " "units in *items*. The C arguments must correspond to the individual format " "units in *items*. Format units for sequences may be nested." msgstr "" -#: ../../c-api/arg.rst:347 -msgid "" -"It is possible to pass \"long\" integers (integers whose value exceeds the " -"platform's :c:macro:`LONG_MAX`) however no proper range checking is done --- " -"the most significant bits are silently truncated when the receiving field is " -"too small to receive the value (actually, the semantics are inherited from " -"downcasts in C --- your mileage may vary)." -msgstr "" - -#: ../../c-api/arg.rst:353 +#: ../../c-api/arg.rst:365 msgid "" "A few other characters have a meaning in a format string. These may not " "occur inside nested parentheses. They are:" msgstr "" -#: ../../c-api/arg.rst:356 +#: ../../c-api/arg.rst:368 msgid "``|``" msgstr "``|``" -#: ../../c-api/arg.rst:357 +#: ../../c-api/arg.rst:369 msgid "" "Indicates that the remaining arguments in the Python argument list are " "optional. The C variables corresponding to optional arguments should be " @@ -690,11 +717,11 @@ msgid "" "corresponding C variable(s)." msgstr "" -#: ../../c-api/arg.rst:363 +#: ../../c-api/arg.rst:375 msgid "``$``" msgstr "``$``" -#: ../../c-api/arg.rst:364 +#: ../../c-api/arg.rst:376 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` only: Indicates that the remaining " "arguments in the Python argument list are keyword-only. Currently, all " @@ -702,36 +729,36 @@ msgid "" "be specified before ``$`` in the format string." msgstr "" -#: ../../c-api/arg.rst:372 +#: ../../c-api/arg.rst:384 msgid "``:``" msgstr "``:``" -#: ../../c-api/arg.rst:373 +#: ../../c-api/arg.rst:385 msgid "" "The list of format units ends here; the string after the colon is used as " "the function name in error messages (the \"associated value\" of the " "exception that :c:func:`PyArg_ParseTuple` raises)." msgstr "" -#: ../../c-api/arg.rst:377 +#: ../../c-api/arg.rst:389 msgid "``;``" msgstr "``;``" -#: ../../c-api/arg.rst:378 +#: ../../c-api/arg.rst:390 msgid "" "The list of format units ends here; the string after the semicolon is used " "as the error message *instead* of the default error message. ``:`` and ``;" "`` mutually exclude each other." msgstr "" -#: ../../c-api/arg.rst:382 +#: ../../c-api/arg.rst:394 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not release them (i.e. do not decrement their " "reference count)!" msgstr "" -#: ../../c-api/arg.rst:386 +#: ../../c-api/arg.rst:398 msgid "" "Additional arguments passed to these functions must be addresses of " "variables whose type is determined by the format string; these are used to " @@ -741,7 +768,7 @@ msgid "" "unit in that case." msgstr "" -#: ../../c-api/arg.rst:392 +#: ../../c-api/arg.rst:404 msgid "" "For the conversion to succeed, the *arg* object must match the format and " "the format must be exhausted. On success, the ``PyArg_Parse*`` functions " @@ -751,24 +778,24 @@ msgid "" "the following format units are left untouched." msgstr "" -#: ../../c-api/arg.rst:401 +#: ../../c-api/arg.rst:413 msgid "API Functions" msgstr "API 函式" -#: ../../c-api/arg.rst:405 +#: ../../c-api/arg.rst:417 msgid "" "Parse the parameters of a function that takes only positional parameters " "into local variables. Returns true on success; on failure, it returns false " "and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:412 +#: ../../c-api/arg.rst:424 msgid "" "Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list " "rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:418 +#: ../../c-api/arg.rst:430 msgid "" "Parse the parameters of a function that takes both positional and keyword " "parameters into local variables. The *keywords* argument is a ``NULL``-" @@ -778,51 +805,51 @@ msgid "" "failure, it returns false and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:429 +#: ../../c-api/arg.rst:441 msgid "" "The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" "expr:`const char * const *` in C++. This can be overridden with the :c:macro:" "`PY_CXX_CONST` macro." msgstr "" -#: ../../c-api/arg.rst:433 +#: ../../c-api/arg.rst:445 msgid "" "Added support for :ref:`positional-only parameters `." -msgstr "" +msgstr "新增對\\ :ref:`僅限位置參數 `\\ 的支援。" -#: ../../c-api/arg.rst:437 +#: ../../c-api/arg.rst:449 msgid "" "The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" "expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " "support for non-ASCII keyword parameter names." msgstr "" -#: ../../c-api/arg.rst:446 +#: ../../c-api/arg.rst:458 msgid "" "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " "va_list rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:452 +#: ../../c-api/arg.rst:464 msgid "" "Ensure that the keys in the keywords argument dictionary are strings. This " "is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " "the latter already does this check." msgstr "" -#: ../../c-api/arg.rst:461 +#: ../../c-api/arg.rst:473 msgid "" "Parse the parameter of a function that takes a single positional parameter " "into a local variable. Returns true on success; on failure, it returns " "false and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:465 +#: ../../c-api/arg.rst:477 msgid "Example::" msgstr "舉例來說: ::" -#: ../../c-api/arg.rst:467 +#: ../../c-api/arg.rst:479 msgid "" "// Function using METH_O calling convention\n" "static PyObject*\n" @@ -836,7 +863,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/arg.rst:481 +#: ../../c-api/arg.rst:493 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -854,13 +881,13 @@ msgid "" "if there was a failure." msgstr "" -#: ../../c-api/arg.rst:496 +#: ../../c-api/arg.rst:508 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`!_weakref` helper module for weak references::" msgstr "" -#: ../../c-api/arg.rst:499 +#: ../../c-api/arg.rst:511 msgid "" "static PyObject *\n" "weakref_ref(PyObject *self, PyObject *args)\n" @@ -888,17 +915,17 @@ msgstr "" " return result;\n" "}" -#: ../../c-api/arg.rst:512 +#: ../../c-api/arg.rst:524 msgid "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -#: ../../c-api/arg.rst:515 +#: ../../c-api/arg.rst:527 msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" msgstr "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" -#: ../../c-api/arg.rst:519 +#: ../../c-api/arg.rst:531 msgid "" "The value to be inserted, if any, before :c:expr:`char * const *` in the " "*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " @@ -907,11 +934,11 @@ msgid "" "to the desired value before including :file:`Python.h`." msgstr "" -#: ../../c-api/arg.rst:533 +#: ../../c-api/arg.rst:545 msgid "Building values" -msgstr "" +msgstr "建置數值" -#: ../../c-api/arg.rst:537 +#: ../../c-api/arg.rst:549 msgid "" "Create a new value based on a format string similar to those accepted by the " "``PyArg_Parse*`` family of functions and a sequence of values. Returns the " @@ -919,7 +946,7 @@ msgid "" "``NULL`` is returned." msgstr "" -#: ../../c-api/arg.rst:542 +#: ../../c-api/arg.rst:554 msgid "" ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " "only if its format string contains two or more format units. If the format " @@ -928,7 +955,7 @@ msgid "" "it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -#: ../../c-api/arg.rst:548 +#: ../../c-api/arg.rst:560 msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " @@ -939,7 +966,7 @@ msgid "" "`Py_BuildValue` returns." msgstr "" -#: ../../c-api/arg.rst:556 +#: ../../c-api/arg.rst:568 msgid "" "In the following description, the quoted form is the format unit; the entry " "in (round) parentheses is the Python object type that the format unit will " @@ -947,155 +974,155 @@ msgid "" "be passed." msgstr "" -#: ../../c-api/arg.rst:560 +#: ../../c-api/arg.rst:572 msgid "" "The characters space, tab, colon and comma are ignored in format strings " "(but not within format units such as ``s#``). This can be used to make long " "format strings a tad more readable." msgstr "" -#: ../../c-api/arg.rst:564 +#: ../../c-api/arg.rst:576 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" -msgstr "``s``\\ (:class:`str` 或 ``None``)[const char \\*]" +msgstr "``s`` (:class:`str` 或 ``None``) [const char \\*]" -#: ../../c-api/arg.rst:565 +#: ../../c-api/arg.rst:577 msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -#: ../../c-api/arg.rst:568 +#: ../../c-api/arg.rst:580 msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -"``s#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:569 +#: ../../c-api/arg.rst:581 msgid "" "Convert a C string and its length to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:573 +#: ../../c-api/arg.rst:585 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "``y`` (:class:`bytes`) [const char \\*]" -#: ../../c-api/arg.rst:574 +#: ../../c-api/arg.rst:586 msgid "" "This converts a C string to a Python :class:`bytes` object. If the C string " "pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:577 +#: ../../c-api/arg.rst:589 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:578 +#: ../../c-api/arg.rst:590 msgid "" "This converts a C string and its lengths to a Python object. If the C " "string pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:582 ../../c-api/arg.rst:598 +#: ../../c-api/arg.rst:594 ../../c-api/arg.rst:610 msgid "Same as ``s``." msgstr "和 ``s`` 相同。" -#: ../../c-api/arg.rst:584 +#: ../../c-api/arg.rst:596 msgid "" "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -"``z#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" +"``z#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:585 ../../c-api/arg.rst:601 +#: ../../c-api/arg.rst:597 ../../c-api/arg.rst:613 msgid "Same as ``s#``." msgstr "和 ``s#`` 相同。" -#: ../../c-api/arg.rst:587 +#: ../../c-api/arg.rst:599 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "``u`` (:class:`str`) [const wchar_t \\*]" -#: ../../c-api/arg.rst:588 +#: ../../c-api/arg.rst:600 msgid "" "Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or " "UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " "``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:592 +#: ../../c-api/arg.rst:604 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:593 +#: ../../c-api/arg.rst:605 msgid "" "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " "Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:597 +#: ../../c-api/arg.rst:609 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" -msgstr "``U``\\ (:class:`str` 或 ``None``)[const char \\*]" +msgstr "``U`` (:class:`str` 或 ``None``) [const char \\*]" -#: ../../c-api/arg.rst:600 +#: ../../c-api/arg.rst:612 msgid "" "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -"``U#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" +"``U#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:604 +#: ../../c-api/arg.rst:616 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:606 +#: ../../c-api/arg.rst:618 msgid "``b`` (:class:`int`) [char]" msgstr "``b`` (:class:`int`) [char]" -#: ../../c-api/arg.rst:607 +#: ../../c-api/arg.rst:619 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:610 +#: ../../c-api/arg.rst:622 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:613 +#: ../../c-api/arg.rst:625 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:616 +#: ../../c-api/arg.rst:628 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:619 +#: ../../c-api/arg.rst:631 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:622 +#: ../../c-api/arg.rst:634 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:625 +#: ../../c-api/arg.rst:637 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:628 +#: ../../c-api/arg.rst:640 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:631 +#: ../../c-api/arg.rst:645 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:634 +#: ../../c-api/arg.rst:648 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" -#: ../../c-api/arg.rst:636 +#: ../../c-api/arg.rst:650 msgid "``c`` (:class:`bytes` of length 1) [char]" -msgstr "``c``\\ (長度為 1 的 :class:`bytes`)[char]" +msgstr "``c`` (長度為 1 的 :class:`bytes`) [char]" -#: ../../c-api/arg.rst:637 +#: ../../c-api/arg.rst:651 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." @@ -1103,7 +1130,7 @@ msgstr "" "將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`bytes`。" -#: ../../c-api/arg.rst:641 +#: ../../c-api/arg.rst:655 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." @@ -1111,23 +1138,23 @@ msgstr "" "將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`str`。" -#: ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:659 msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`double` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:648 +#: ../../c-api/arg.rst:662 msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`float` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:650 +#: ../../c-api/arg.rst:664 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "``D`` (:class:`complex`) [Py_complex \\*]" -#: ../../c-api/arg.rst:651 +#: ../../c-api/arg.rst:665 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "將一個 C 的 :c:type:`Py_complex` 結構轉換成 Python 複數。" -#: ../../c-api/arg.rst:654 +#: ../../c-api/arg.rst:668 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " @@ -1137,26 +1164,30 @@ msgid "" "no exception has been raised yet, :exc:`SystemError` is set." msgstr "" -#: ../../c-api/arg.rst:663 +#: ../../c-api/arg.rst:677 msgid "``S`` (object) [PyObject \\*]" -msgstr "``S``\\ (物件)[PyObject \\*]" +msgstr "``S`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:664 +#: ../../c-api/arg.rst:678 msgid "Same as ``O``." msgstr "和 ``O`` 相同。" -#: ../../c-api/arg.rst:666 +#: ../../c-api/arg.rst:680 msgid "``N`` (object) [PyObject \\*]" -msgstr "``N``\\ (物件)[PyObject \\*]" +msgstr "``N`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:667 +#: ../../c-api/arg.rst:681 msgid "" "Same as ``O``, except it doesn't create a new :term:`strong reference`. " "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" -#: ../../c-api/arg.rst:672 +#: ../../c-api/arg.rst:685 +msgid "``O&`` (object) [*converter*, *anything*]" +msgstr "``O&`` (object) [*converter*, *anything*]" + +#: ../../c-api/arg.rst:686 msgid "" "Convert *anything* to a Python object through a *converter* function. The " "function is called with *anything* (which should be compatible with :c:expr:" @@ -1164,40 +1195,40 @@ msgid "" "``NULL`` if an error occurred." msgstr "" -#: ../../c-api/arg.rst:678 +#: ../../c-api/arg.rst:692 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:680 +#: ../../c-api/arg.rst:694 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:681 +#: ../../c-api/arg.rst:695 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:683 +#: ../../c-api/arg.rst:697 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:684 +#: ../../c-api/arg.rst:698 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: ../../c-api/arg.rst:688 +#: ../../c-api/arg.rst:702 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: ../../c-api/arg.rst:693 +#: ../../c-api/arg.rst:707 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/c-api/buffer.po b/c-api/buffer.po index d183ac606f..5248994757 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-05-02 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,24 +41,26 @@ msgstr "" #: ../../c-api/buffer.rst:29 msgid "" -"Python provides such a facility at the C level in the form of the :ref:" -"`buffer protocol `. This protocol has two sides:" +"Python provides such a facility at the C and Python level in the form of " +"the :ref:`buffer protocol `. This protocol has two sides:" msgstr "" #: ../../c-api/buffer.rst:34 msgid "" "on the producer side, a type can export a \"buffer interface\" which allows " "objects of that type to expose information about their underlying buffer. " -"This interface is described in the section :ref:`buffer-structs`;" +"This interface is described in the section :ref:`buffer-structs`; for Python " +"see :ref:`python-buffer-protocol`." msgstr "" -#: ../../c-api/buffer.rst:38 +#: ../../c-api/buffer.rst:39 msgid "" "on the consumer side, several means are available to obtain a pointer to the " -"raw underlying data of an object (for example a method parameter)." +"raw underlying data of an object (for example a method parameter). For " +"Python see :class:`memoryview`." msgstr "" -#: ../../c-api/buffer.rst:41 +#: ../../c-api/buffer.rst:43 msgid "" "Simple objects such as :class:`bytes` and :class:`bytearray` expose their " "underlying buffer in byte-oriented form. Other forms are possible; for " @@ -66,7 +68,7 @@ msgid "" "values." msgstr "" -#: ../../c-api/buffer.rst:45 +#: ../../c-api/buffer.rst:47 msgid "" "An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase." "write` method of file objects: any object that can export a series of bytes " @@ -78,23 +80,23 @@ msgid "" "buffers." msgstr "" -#: ../../c-api/buffer.rst:53 +#: ../../c-api/buffer.rst:55 msgid "" "There are two ways for a consumer of the buffer interface to acquire a " "buffer over a target object:" msgstr "" -#: ../../c-api/buffer.rst:56 +#: ../../c-api/buffer.rst:58 msgid "call :c:func:`PyObject_GetBuffer` with the right parameters;" msgstr "" -#: ../../c-api/buffer.rst:58 +#: ../../c-api/buffer.rst:60 msgid "" "call :c:func:`PyArg_ParseTuple` (or one of its siblings) with one of the " "``y*``, ``w*`` or ``s*`` :ref:`format codes `." msgstr "" -#: ../../c-api/buffer.rst:61 +#: ../../c-api/buffer.rst:63 msgid "" "In both cases, :c:func:`PyBuffer_Release` must be called when the buffer " "isn't needed anymore. Failure to do so could lead to various issues such as " @@ -102,10 +104,16 @@ msgid "" msgstr "" #: ../../c-api/buffer.rst:69 +msgid "" +"The buffer protocol is now accessible in Python, see :ref:`python-buffer-" +"protocol` and :class:`memoryview`." +msgstr "" + +#: ../../c-api/buffer.rst:75 msgid "Buffer structure" msgstr "" -#: ../../c-api/buffer.rst:71 +#: ../../c-api/buffer.rst:77 msgid "" "Buffer structures (or simply \"buffers\") are useful as a way to expose the " "binary data from another object to the Python programmer. They can also be " @@ -117,7 +125,7 @@ msgid "" "in its native, in-memory format." msgstr "" -#: ../../c-api/buffer.rst:80 +#: ../../c-api/buffer.rst:86 msgid "" "Contrary to most data types exposed by the Python interpreter, buffers are " "not :c:type:`PyObject` pointers but rather simple C structures. This allows " @@ -126,14 +134,14 @@ msgid "" "created." msgstr "" -#: ../../c-api/buffer.rst:86 +#: ../../c-api/buffer.rst:92 msgid "" "For short instructions how to write an exporting object, see :ref:`Buffer " "Object Structures `. For obtaining a buffer, see :c:func:" "`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:94 +#: ../../c-api/buffer.rst:100 msgid "" "A pointer to the start of the logical structure described by the buffer " "fields. This can be any location within the underlying physical memory block " @@ -141,13 +149,13 @@ msgid "" "the value may point to the end of the memory block." msgstr "" -#: ../../c-api/buffer.rst:99 +#: ../../c-api/buffer.rst:105 msgid "" "For :term:`contiguous` arrays, the value points to the beginning of the " "memory block." msgstr "" -#: ../../c-api/buffer.rst:104 +#: ../../c-api/buffer.rst:110 msgid "" "A new reference to the exporting object. The reference is owned by the " "consumer and automatically released (i.e. reference count decremented) and " @@ -155,14 +163,14 @@ msgid "" "of the return value of any standard C-API function." msgstr "" -#: ../../c-api/buffer.rst:111 +#: ../../c-api/buffer.rst:117 msgid "" "As a special case, for *temporary* buffers that are wrapped by :c:func:" "`PyMemoryView_FromBuffer` or :c:func:`PyBuffer_FillInfo` this field is " "``NULL``. In general, exporting objects MUST NOT use this scheme." msgstr "" -#: ../../c-api/buffer.rst:118 +#: ../../c-api/buffer.rst:124 msgid "" "``product(shape) * itemsize``. For contiguous arrays, this is the length of " "the underlying memory block. For non-contiguous arrays, it is the length " @@ -170,7 +178,7 @@ msgid "" "representation." msgstr "" -#: ../../c-api/buffer.rst:123 +#: ../../c-api/buffer.rst:129 msgid "" "Accessing ``((char *)buf)[0] up to ((char *)buf)[len-1]`` is only valid if " "the buffer has been obtained by a request that guarantees contiguity. In " @@ -178,19 +186,19 @@ msgid "" "`PyBUF_WRITABLE`." msgstr "" -#: ../../c-api/buffer.rst:129 +#: ../../c-api/buffer.rst:135 msgid "" "An indicator of whether the buffer is read-only. This field is controlled by " "the :c:macro:`PyBUF_WRITABLE` flag." msgstr "" -#: ../../c-api/buffer.rst:134 +#: ../../c-api/buffer.rst:140 msgid "" "Item size in bytes of a single element. Same as the value of :func:`struct." "calcsize` called on non-``NULL`` :c:member:`~Py_buffer.format` values." msgstr "" -#: ../../c-api/buffer.rst:137 +#: ../../c-api/buffer.rst:143 msgid "" "Important exception: If a consumer requests a buffer without the :c:macro:" "`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will be set to " @@ -198,32 +206,32 @@ msgid "" "original format." msgstr "" -#: ../../c-api/buffer.rst:142 +#: ../../c-api/buffer.rst:148 msgid "" "If :c:member:`~Py_buffer.shape` is present, the equality ``product(shape) * " "itemsize == len`` still holds and the consumer can use :c:member:`~Py_buffer." "itemsize` to navigate the buffer." msgstr "" -#: ../../c-api/buffer.rst:146 +#: ../../c-api/buffer.rst:152 msgid "" "If :c:member:`~Py_buffer.shape` is ``NULL`` as a result of a :c:macro:" "`PyBUF_SIMPLE` or a :c:macro:`PyBUF_WRITABLE` request, the consumer must " "disregard :c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``." msgstr "" -#: ../../c-api/buffer.rst:152 +#: ../../c-api/buffer.rst:158 msgid "" "A *NULL* terminated string in :mod:`struct` module style syntax describing " "the contents of a single item. If this is ``NULL``, ``\"B\"`` (unsigned " "bytes) is assumed." msgstr "" -#: ../../c-api/buffer.rst:156 +#: ../../c-api/buffer.rst:162 msgid "This field is controlled by the :c:macro:`PyBUF_FORMAT` flag." msgstr "" -#: ../../c-api/buffer.rst:160 +#: ../../c-api/buffer.rst:166 msgid "" "The number of dimensions the memory represents as an n-dimensional array. If " "it is ``0``, :c:member:`~Py_buffer.buf` points to a single item representing " @@ -232,7 +240,7 @@ msgid "" "number of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`." msgstr "" -#: ../../c-api/buffer.rst:168 +#: ../../c-api/buffer.rst:174 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "indicating the shape of the memory as an n-dimensional array. Note that " @@ -240,34 +248,34 @@ msgid "" "`~Py_buffer.len`." msgstr "" -#: ../../c-api/buffer.rst:173 +#: ../../c-api/buffer.rst:179 msgid "" "Shape values are restricted to ``shape[n] >= 0``. The case ``shape[n] == 0`` " "requires special attention. See `complex arrays`_ for further information." msgstr "" -#: ../../c-api/buffer.rst:177 +#: ../../c-api/buffer.rst:183 msgid "The shape array is read-only for the consumer." msgstr "" -#: ../../c-api/buffer.rst:181 +#: ../../c-api/buffer.rst:187 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "giving the number of bytes to skip to get to a new element in each dimension." msgstr "" -#: ../../c-api/buffer.rst:185 +#: ../../c-api/buffer.rst:191 msgid "" "Stride values can be any integer. For regular arrays, strides are usually " "positive, but a consumer MUST be able to handle the case ``strides[n] <= " "0``. See `complex arrays`_ for further information." msgstr "" -#: ../../c-api/buffer.rst:189 +#: ../../c-api/buffer.rst:195 msgid "The strides array is read-only for the consumer." msgstr "" -#: ../../c-api/buffer.rst:193 +#: ../../c-api/buffer.rst:199 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim`. If " "``suboffsets[n] >= 0``, the values stored along the nth dimension are " @@ -276,24 +284,24 @@ msgid "" "that no de-referencing should occur (striding in a contiguous memory block)." msgstr "" -#: ../../c-api/buffer.rst:200 +#: ../../c-api/buffer.rst:206 msgid "" "If all suboffsets are negative (i.e. no de-referencing is needed), then this " "field must be ``NULL`` (the default value)." msgstr "" -#: ../../c-api/buffer.rst:203 +#: ../../c-api/buffer.rst:209 msgid "" "This type of array representation is used by the Python Imaging Library " "(PIL). See `complex arrays`_ for further information how to access elements " "of such an array." msgstr "" -#: ../../c-api/buffer.rst:207 +#: ../../c-api/buffer.rst:213 msgid "The suboffsets array is read-only for the consumer." msgstr "" -#: ../../c-api/buffer.rst:211 +#: ../../c-api/buffer.rst:217 msgid "" "This is for use internally by the exporting object. For example, this might " "be re-cast as an integer by the exporter and used to store flags about " @@ -301,22 +309,22 @@ msgid "" "the buffer is released. The consumer MUST NOT alter this value." msgstr "" -#: ../../c-api/buffer.rst:218 +#: ../../c-api/buffer.rst:224 msgid "Constants:" msgstr "常數:" -#: ../../c-api/buffer.rst:222 +#: ../../c-api/buffer.rst:228 msgid "" "The maximum number of dimensions the memory represents. Exporters MUST " "respect this limit, consumers of multi-dimensional buffers SHOULD be able to " "handle up to :c:macro:`!PyBUF_MAX_NDIM` dimensions. Currently set to 64." msgstr "" -#: ../../c-api/buffer.rst:231 +#: ../../c-api/buffer.rst:237 msgid "Buffer request types" msgstr "" -#: ../../c-api/buffer.rst:233 +#: ../../c-api/buffer.rst:239 msgid "" "Buffers are usually obtained by sending a buffer request to an exporting " "object via :c:func:`PyObject_GetBuffer`. Since the complexity of the logical " @@ -324,16 +332,16 @@ msgid "" "argument to specify the exact buffer type it can handle." msgstr "" -#: ../../c-api/buffer.rst:238 +#: ../../c-api/buffer.rst:244 msgid "" "All :c:type:`Py_buffer` fields are unambiguously defined by the request type." msgstr "" -#: ../../c-api/buffer.rst:242 +#: ../../c-api/buffer.rst:248 msgid "request-independent fields" msgstr "" -#: ../../c-api/buffer.rst:243 +#: ../../c-api/buffer.rst:249 msgid "" "The following fields are not influenced by *flags* and must always be filled " "in with the correct values: :c:member:`~Py_buffer.obj`, :c:member:" @@ -341,11 +349,11 @@ msgid "" "itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" -#: ../../c-api/buffer.rst:248 +#: ../../c-api/buffer.rst:254 msgid "readonly, format" msgstr "" -#: ../../c-api/buffer.rst:252 +#: ../../c-api/buffer.rst:258 msgid "" "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " "MUST provide a writable buffer or else report failure. Otherwise, the " @@ -354,13 +362,13 @@ msgid "" "PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" -#: ../../c-api/buffer.rst:260 +#: ../../c-api/buffer.rst:266 msgid "" "Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST be " "filled in correctly. Otherwise, this field MUST be ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:264 +#: ../../c-api/buffer.rst:270 msgid "" ":c:macro:`PyBUF_WRITABLE` can be \\|'d to any of the flags in the next " "section. Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:" @@ -368,159 +376,159 @@ msgid "" "writable buffer." msgstr "" -#: ../../c-api/buffer.rst:268 +#: ../../c-api/buffer.rst:274 msgid "" ":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" "`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " "bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" -#: ../../c-api/buffer.rst:274 +#: ../../c-api/buffer.rst:280 msgid "shape, strides, suboffsets" msgstr "" -#: ../../c-api/buffer.rst:276 +#: ../../c-api/buffer.rst:282 msgid "" "The flags that control the logical structure of the memory are listed in " "decreasing order of complexity. Note that each flag contains all bits of the " "flags below it." msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "Request" msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "shape" msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "strides" msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "suboffsets" msgstr "" -#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:287 -#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:309 -#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:334 -#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:338 -#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 -#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 -#: ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:293 +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:317 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:354 msgid "yes" msgstr "" -#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:334 -#: ../../c-api/buffer.rst:336 +#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:342 msgid "if needed" msgstr "" -#: ../../c-api/buffer.rst:287 ../../c-api/buffer.rst:289 -#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:309 -#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:338 -#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 -#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 -#: ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:293 ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:297 ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:317 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:354 msgid "NULL" msgstr "NULL" -#: ../../c-api/buffer.rst:298 +#: ../../c-api/buffer.rst:304 msgid "contiguity requests" msgstr "" -#: ../../c-api/buffer.rst:300 +#: ../../c-api/buffer.rst:306 msgid "" "C or Fortran :term:`contiguity ` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -#: ../../c-api/buffer.rst:307 ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:313 ../../c-api/buffer.rst:338 msgid "contig" msgstr "" -#: ../../c-api/buffer.rst:309 ../../c-api/buffer.rst:315 -#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:352 ../../c-api/buffer.rst:354 msgid "C" msgstr "C" -#: ../../c-api/buffer.rst:311 +#: ../../c-api/buffer.rst:317 msgid "F" msgstr "F" -#: ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:319 msgid "C or F" msgstr "C 或 F" -#: ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:321 msgid ":c:macro:`PyBUF_ND`" msgstr ":c:macro:`PyBUF_ND`" -#: ../../c-api/buffer.rst:320 +#: ../../c-api/buffer.rst:326 msgid "compound requests" msgstr "" -#: ../../c-api/buffer.rst:322 +#: ../../c-api/buffer.rst:328 msgid "" "All possible requests are fully defined by some combination of the flags in " "the previous section. For convenience, the buffer protocol provides " "frequently used combinations as single flags." msgstr "" -#: ../../c-api/buffer.rst:326 +#: ../../c-api/buffer.rst:332 msgid "" "In the following table *U* stands for undefined contiguity. The consumer " "would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:338 msgid "readonly" msgstr "" -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:338 msgid "format" msgstr "" -#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:336 -#: ../../c-api/buffer.rst:338 ../../c-api/buffer.rst:340 -#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:350 msgid "U" msgstr "U" -#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:338 -#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:352 msgid "0" msgstr "0" -#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:340 -#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:354 msgid "1 or 0" msgstr "1 或 0" -#: ../../c-api/buffer.rst:353 +#: ../../c-api/buffer.rst:359 msgid "Complex arrays" msgstr "" -#: ../../c-api/buffer.rst:356 +#: ../../c-api/buffer.rst:362 msgid "NumPy-style: shape and strides" msgstr "" -#: ../../c-api/buffer.rst:358 +#: ../../c-api/buffer.rst:364 msgid "" "The logical structure of NumPy-style arrays is defined by :c:member:" "`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." "shape` and :c:member:`~Py_buffer.strides`." msgstr "" -#: ../../c-api/buffer.rst:361 +#: ../../c-api/buffer.rst:367 msgid "" "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." "buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " @@ -528,14 +536,14 @@ msgid "" "strides` are ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:365 +#: ../../c-api/buffer.rst:371 msgid "" "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " "standard n-dimensional C-array. Otherwise, the consumer must access an n-" "dimensional array as follows:" msgstr "" -#: ../../c-api/buffer.rst:369 +#: ../../c-api/buffer.rst:375 msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " "strides[n-1];\n" @@ -545,14 +553,14 @@ msgstr "" "strides[n-1];\n" "item = *((typeof(item) *)ptr);" -#: ../../c-api/buffer.rst:375 +#: ../../c-api/buffer.rst:381 msgid "" "As noted above, :c:member:`~Py_buffer.buf` can point to any location within " "the actual memory block. An exporter can check the validity of a buffer with " "this function:" msgstr "" -#: ../../c-api/buffer.rst:379 +#: ../../c-api/buffer.rst:385 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -581,11 +589,11 @@ msgid "" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" -#: ../../c-api/buffer.rst:409 +#: ../../c-api/buffer.rst:415 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -#: ../../c-api/buffer.rst:411 +#: ../../c-api/buffer.rst:417 msgid "" "In addition to the regular items, PIL-style arrays can contain pointers that " "must be followed in order to get to the next element in a dimension. For " @@ -596,14 +604,14 @@ msgid "" "x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -#: ../../c-api/buffer.rst:420 +#: ../../c-api/buffer.rst:426 msgid "" "Here is a function that returns a pointer to the element in an N-D array " "pointed to by an N-dimensional index when there are both non-``NULL`` " "strides and suboffsets::" msgstr "" -#: ../../c-api/buffer.rst:424 +#: ../../c-api/buffer.rst:430 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -631,25 +639,25 @@ msgstr "" " return (void*)pointer;\n" "}" -#: ../../c-api/buffer.rst:439 +#: ../../c-api/buffer.rst:445 msgid "Buffer-related functions" msgstr "" -#: ../../c-api/buffer.rst:443 +#: ../../c-api/buffer.rst:449 msgid "" "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " "``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " "will succeed. This function always succeeds." msgstr "" -#: ../../c-api/buffer.rst:450 +#: ../../c-api/buffer.rst:456 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " "the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" "`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/buffer.rst:455 +#: ../../c-api/buffer.rst:461 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " @@ -657,7 +665,7 @@ msgid "" "instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -#: ../../c-api/buffer.rst:460 +#: ../../c-api/buffer.rst:466 msgid "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " "to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" @@ -665,7 +673,7 @@ msgid "" "`PyBuffer_Release` must be called exactly once." msgstr "" -#: ../../c-api/buffer.rst:468 +#: ../../c-api/buffer.rst:474 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" @@ -673,19 +681,19 @@ msgid "" "used, otherwise reference leaks may occur." msgstr "" -#: ../../c-api/buffer.rst:473 +#: ../../c-api/buffer.rst:479 msgid "" "It is an error to call this function on a buffer that was not obtained via :" "c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:479 +#: ../../c-api/buffer.rst:485 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" -#: ../../c-api/buffer.rst:487 +#: ../../c-api/buffer.rst:493 msgid "" "Return ``1`` if the memory defined by the *view* is C-style (*order* is " "``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " @@ -693,69 +701,69 @@ msgid "" "succeeds." msgstr "" -#: ../../c-api/buffer.rst:494 +#: ../../c-api/buffer.rst:500 msgid "" "Get the memory area pointed to by the *indices* inside the given *view*. " "*indices* must point to an array of ``view->ndim`` indices." msgstr "" -#: ../../c-api/buffer.rst:500 +#: ../../c-api/buffer.rst:506 msgid "" "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " "``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " "success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:507 +#: ../../c-api/buffer.rst:513 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:511 +#: ../../c-api/buffer.rst:517 msgid "This function fails if *len* != *src->len*." msgstr "" -#: ../../c-api/buffer.rst:516 +#: ../../c-api/buffer.rst:522 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" -#: ../../c-api/buffer.rst:519 +#: ../../c-api/buffer.rst:525 msgid "``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:523 +#: ../../c-api/buffer.rst:529 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: ../../c-api/buffer.rst:530 +#: ../../c-api/buffer.rst:536 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: ../../c-api/buffer.rst:534 +#: ../../c-api/buffer.rst:540 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: ../../c-api/buffer.rst:538 +#: ../../c-api/buffer.rst:544 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" -#: ../../c-api/buffer.rst:542 +#: ../../c-api/buffer.rst:548 msgid "" "If this function is used as part of a :ref:`getbufferproc `, " "*exporter* MUST be set to the exporting object and *flags* must be passed " @@ -782,14 +790,14 @@ msgstr "buffer object(緩衝物件)" msgid "PyBufferProcs (C type)" msgstr "PyBufferProcs(C 型別)" -#: ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:301 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:301 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:301 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" diff --git a/c-api/cell.po b/c-api/cell.po index 26beccfb9a..1b56cd0661 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -89,7 +89,7 @@ msgid "" "reference to any current content of the cell. *value* may be ``NULL``. " "*cell* must be non-``NULL``." msgstr "" -"將 cell 物件 *cell* 的內容設為 *value*。這將釋放任何對 cell 物件當前內容的參" +"將 cell 物件 *cell* 的內容設為 *value*。這將釋放任何對 cell 物件目前內容的參" "照。*value* 可以為 ``NULL``。*cell* 必須不為 ``NULL``。" #: ../../c-api/cell.rst:58 diff --git a/c-api/codec.po b/c-api/codec.po index 3cd05b00bc..6fd7c61a7f 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -24,7 +24,7 @@ msgstr "編解碼器註冊表和支援函式" #: ../../c-api/codec.rst:8 msgid "Register a new codec search function." -msgstr "註冊一個新的編解碼器搜索函式。" +msgstr "註冊一個新的編解碼器搜尋函式。" #: ../../c-api/codec.rst:10 msgid "" @@ -32,7 +32,7 @@ msgid "" "done, to make sure that it is always first in the list of search functions." msgstr "" "作為副作用 (side effect),這會嘗試載入 :mod:`!encodings`\\ (如果尚未完成)," -"以確保它始終位於搜索函式列表中的第一個。" +"以確保它始終位於搜尋函式列表中的第一個。" #: ../../c-api/codec.rst:15 msgid "" @@ -40,7 +40,7 @@ msgid "" "search function is not registered, do nothing. Return 0 on success. Raise an " "exception and return -1 on error." msgstr "" -"取消註冊編解碼器搜索函式並清除註冊表 (registry) 的快取。如果搜索函式並未被註" +"取消註冊編解碼器搜尋函式並清除註冊表 (registry) 的快取。如果搜尋函式並未被註" "冊,則不執行任何操作。成功回傳 0,發生錯誤時會引發例外並回傳 -1。" #: ../../c-api/codec.rst:23 diff --git a/c-api/complex.po b/c-api/complex.po index a6448fac77..a22103f9b4 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -81,14 +81,14 @@ msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數之和 #: ../../c-api/complex.rst:49 msgid "" -"Return the difference between two complex numbers, using the C :c:type:" -"`Py_complex` representation." +"Return the difference between two complex numbers, using the " +"C :c:type:`Py_complex` representation." msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數間的差。" #: ../../c-api/complex.rst:55 msgid "" -"Return the negation of the complex number *num*, using the C :c:type:" -"`Py_complex` representation." +"Return the negation of the complex number *num*, using the " +"C :c:type:`Py_complex` representation." msgstr "" "以 C 的 :c:type:`Py_complex` 表示形式來回傳複數 *num* 的相反數 (negation)。" @@ -106,16 +106,16 @@ msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數的商 #: ../../c-api/complex.rst:70 msgid "" -"If *divisor* is null, this method returns zero and sets :c:data:`errno` to :" -"c:macro:`!EDOM`." +"If *divisor* is null, this method returns zero and sets :c:data:`errno` " +"to :c:macro:`!EDOM`." msgstr "" -"如果 *divisor* 為 null,則此方法會回傳零並將 :c:data:`errno` 設定為 :c:macro:" -"`!EDOM`。" +"如果 *divisor* 為 null,則此方法會回傳零並將 :c:data:`errno` 設定" +"為 :c:macro:`!EDOM`。" #: ../../c-api/complex.rst:76 msgid "" -"Return the exponentiation of *num* by *exp*, using the C :c:type:" -"`Py_complex` representation." +"Return the exponentiation of *num* by *exp*, using the " +"C :c:type:`Py_complex` representation." msgstr "" "以 C 的 :c:type:`Py_complex` 表示形式來回傳 *num* 的 *exp* 次方的結果。" @@ -141,13 +141,13 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python complex number " "type. It is the same object as :class:`complex` in the Python layer." msgstr "" -"這個 :c:type:`PyTypeObject` 的實例代表 Python 複數型別。它與 Python 層中的 :" -"class:`complex` 是同一個物件。" +"這個 :c:type:`PyTypeObject` 的實例代表 Python 複數型別。它與 Python 層中" +"的 :class:`complex` 是同一個物件。" #: ../../c-api/complex.rst:100 msgid "" -"Return true if its argument is a :c:type:`PyComplexObject` or a subtype of :" -"c:type:`PyComplexObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyComplexObject` or a subtype " +"of :c:type:`PyComplexObject`. This function always succeeds." msgstr "" "如果其引數是一個 :c:type:`PyComplexObject` 或者是 :c:type:`PyComplexObject` " "的子型別,則會回傳 true。這個函式不會失敗。" @@ -181,25 +181,24 @@ msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "以 C 的 :c:expr:`double` 形式回傳 *op* 的實部。" #: ../../c-api/complex.rst:126 -#, fuzzy msgid "" -"If *op* is not a Python complex number object but has a :meth:`~object." -"__complex__` method, this method will first be called to convert *op* to a " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to call :c:func:`PyFloat_AsDouble` and returns its result." +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to call :c:func:`PyFloat_AsDouble` and " +"returns its result." msgstr "" "如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" -"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" -"定義,則它將繼續回退為 :meth:`~object.__index__`。" +"未定義,那麼它會回退到呼叫 :func:`PyFloat_AsDouble` 並回傳其結果。" #: ../../c-api/complex.rst:132 ../../c-api/complex.rst:148 msgid "" "Upon failure, this method returns ``-1.0`` with an exception set, so one " "should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" -"失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼叫 :c:func:" -"`PyErr_Occurred` 來檢查錯誤。" +"失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼" +"叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" #: ../../c-api/complex.rst:135 ../../c-api/complex.rst:151 msgid "Use :meth:`~object.__complex__` if available." @@ -210,18 +209,16 @@ msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "將 *op* 的虛部作為 C 的 :c:expr:`double` 回傳。" #: ../../c-api/complex.rst:142 -#, fuzzy msgid "" -"If *op* is not a Python complex number object but has a :meth:`~object." -"__complex__` method, this method will first be called to convert *op* to a " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on " -"success." +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to call :c:func:`PyFloat_AsDouble` and " +"returns ``0.0`` on success." msgstr "" "如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" -"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" -"定義,則它將繼續回退為 :meth:`~object.__index__`。" +"未定義,那麼它會回退到呼叫 :func:`PyFloat_AsDouble` 並於成功時回傳 ``0.0``。" #: ../../c-api/complex.rst:156 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." @@ -229,11 +226,11 @@ msgstr "回傳複數 *op* 的 :c:type:`Py_complex` 值。" #: ../../c-api/complex.rst:158 msgid "" -"If *op* is not a Python complex number object but has a :meth:`~object." -"__complex__` method, this method will first be called to convert *op* to a " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " -"defined then it falls back to :meth:`~object.__index__`." +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to :meth:`~object.__float__`. If :meth:`!" +"__float__` is not defined then it falls back to :meth:`~object.__index__`." msgstr "" "如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" @@ -242,9 +239,9 @@ msgstr "" #: ../../c-api/complex.rst:164 msgid "" -"Upon failure, this method returns :c:type:`Py_complex` with :c:member:" -"`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should " -"call :c:func:`PyErr_Occurred` to check for errors." +"Upon failure, this method returns :c:type:`Py_complex` " +"with :c:member:`~Py_complex.real` set to ``-1.0`` and with an exception set, " +"so one should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" "失敗時,此方法回傳 :c:type:`Py_complex` 並將 :c:member:`~Py_complex.real` 設" "為 ``-1.0``,並設定例外,因此應該呼叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" diff --git a/c-api/datetime.po b/c-api/datetime.po index aca575f97c..60f4918fdc 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -38,7 +38,7 @@ msgid "" msgstr "" ":mod:`datetime` 模組提供各種日期和時間物件。在使用任何這些函式之前,必須將標" "頭檔 :file:`datetime.h` 引入於原始碼中(請注意,:file:`Python.h` 並無引入該標" -"頭檔),且巨集 :c:macro:`!PyDateTime_IMPORT` 必須被調用,而這通常作為模組初始" +"頭檔),且巨集 :c:macro:`!PyDateTime_IMPORT` 必須被叫用,而這通常作為模組初始" "化函式的一部分。該巨集將指向 C 結構的指標放入靜態變數 :c:data:`!" "PyDateTimeAPI` 中,該變數會被以下巨集使用。" diff --git a/c-api/dict.po b/c-api/dict.po index 5a9c30db1f..b11b75f775 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +34,8 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python dictionary " "type. This is the same object as :class:`dict` in the Python layer." msgstr "" -":c:type:`PyTypeObject` 實例代表一個 Python 字典型態。此與 Python 層中的 :" -"class:`dict` 為同一個物件。" +":c:type:`PyTypeObject` 實例代表一個 Python 字典型態。此與 Python 層中" +"的 :class:`dict` 為同一個物件。" #: ../../c-api/dict.rst:24 msgid "" @@ -77,9 +77,9 @@ msgstr "" #: ../../c-api/dict.rst:60 msgid "" -"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :" -"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:69 @@ -88,32 +88,32 @@ msgstr "" #: ../../c-api/dict.rst:74 msgid "" -"Insert *val* into the dictionary *p* with a key of *key*. *key* must be :" -"term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` " -"on success or ``-1`` on failure. This function *does not* steal a reference " -"to *val*." +"Insert *val* into the dictionary *p* with a key of *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return " +"``0`` on success or ``-1`` on failure. This function *does not* steal a " +"reference to *val*." msgstr "" #: ../../c-api/dict.rst:82 msgid "" -"This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:89 msgid "" -"Remove the entry in dictionary *p* with key *key*. *key* must be :term:" -"`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the " -"dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on " -"failure." +"Remove the entry in dictionary *p* with key *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is " +"not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or " +"``-1`` on failure." msgstr "" #: ../../c-api/dict.rst:97 msgid "" -"This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:104 @@ -134,11 +134,11 @@ msgstr "" #: ../../c-api/dict.rst:110 ../../c-api/dict.rst:207 msgid "On error, raise an exception and return ``-1``." -msgstr "" +msgstr "錯誤發生時,引發一個例外並回傳 ``-1``。" #: ../../c-api/dict.rst:114 msgid "See also the :c:func:`PyObject_GetItem` function." -msgstr "" +msgstr "另見 :c:func:`PyObject_GetItem` 函式。" #: ../../c-api/dict.rst:119 msgid "" @@ -149,9 +149,9 @@ msgstr "" #: ../../c-api/dict.rst:125 msgid "" -"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" -"`~object.__eq__` methods are silently ignored. Prefer the :c:func:" -"`PyDict_GetItemWithError` function instead." +"Exceptions that occur while this calls :meth:`~object.__hash__` " +"and :meth:`~object.__eq__` methods are silently ignored. Prefer " +"the :c:func:`PyDict_GetItemWithError` function instead." msgstr "" #: ../../c-api/dict.rst:129 @@ -169,24 +169,25 @@ msgstr "" #: ../../c-api/dict.rst:144 msgid "" -"This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:150 msgid "" -"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" -"`~object.__eq__` methods or while creating the temporary :class:`str` object " -"are silently ignored. Prefer using the :c:func:`PyDict_GetItemWithError` " -"function with your own :c:func:`PyUnicode_FromString` *key* instead." +"Exceptions that occur while this calls :meth:`~object.__hash__` " +"and :meth:`~object.__eq__` methods or while creating the " +"temporary :class:`str` object are silently ignored. Prefer using " +"the :c:func:`PyDict_GetItemWithError` function with your " +"own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" #: ../../c-api/dict.rst:159 msgid "" -"Similar than :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:168 @@ -239,7 +240,7 @@ msgstr "" #: ../../c-api/dict.rst:209 msgid "" -"This is similar to :meth:`dict.pop`, but without the default value and not " +"Similar to :meth:`dict.pop`, but without the default value and not " "raising :exc:`KeyError` if the key missing." msgstr "" @@ -252,37 +253,37 @@ msgstr "" #: ../../c-api/dict.rst:226 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." -msgstr "" +msgstr "回傳一個包含字典中所有項目的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:231 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." -msgstr "" +msgstr "回傳一個包含字典中所有鍵的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:236 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." -msgstr "" +msgstr "回傳一個包含字典 *p* 中所有值的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:244 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." -msgstr "" +msgstr "回傳字典中項目的數量。此與於字典呼叫 ``len(p)`` 等效。" #: ../../c-api/dict.rst:250 msgid "" -"Iterate over all key-value pairs in the dictionary *p*. The :c:type:" -"`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " -"first call to this function to start the iteration; the function returns " -"true for each pair in the dictionary, and false once all pairs have been " -"reported. The parameters *pkey* and *pvalue* should either point to :c:expr:" -"`PyObject*` variables that will be filled in with each key and value, " -"respectively, or may be ``NULL``. Any references returned through them are " -"borrowed. *ppos* should not be altered during iteration. Its value " -"represents offsets within the internal dictionary structure, and since the " -"structure is sparse, the offsets are not consecutive." +"Iterate over all key-value pairs in the dictionary *p*. " +"The :c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` " +"prior to the first call to this function to start the iteration; the " +"function returns true for each pair in the dictionary, and false once all " +"pairs have been reported. The parameters *pkey* and *pvalue* should either " +"point to :c:expr:`PyObject*` variables that will be filled in with each key " +"and value, respectively, or may be ``NULL``. Any references returned " +"through them are borrowed. *ppos* should not be altered during iteration. " +"Its value represents offsets within the internal dictionary structure, and " +"since the structure is sparse, the offsets are not consecutive." msgstr "" #: ../../c-api/dict.rst:261 @@ -348,8 +349,9 @@ msgstr "" #: ../../c-api/dict.rst:293 msgid "" "The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can use :c:macro:" -"`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" +"threading>` build without external synchronization. You can " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while " +"iterating over it::" msgstr "" #: ../../c-api/dict.rst:298 @@ -360,6 +362,11 @@ msgid "" "}\n" "Py_END_CRITICAL_SECTION();" msgstr "" +"Py_BEGIN_CRITICAL_SECTION(self->dict);\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" #: ../../c-api/dict.rst:307 msgid "" @@ -373,10 +380,10 @@ msgstr "" #: ../../c-api/dict.rst:317 msgid "" -"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." -"update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " -"to the iterating over a sequence of key value pairs if the second argument " -"has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " +"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to " +"``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall " +"back to the iterating over a sequence of key value pairs if the second " +"argument has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " "exception was raised." msgstr "" @@ -411,15 +418,15 @@ msgstr "" #: ../../c-api/dict.rst:349 msgid "" -"Clear watcher identified by *watcher_id* previously returned from :c:func:" -"`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the " -"given *watcher_id* was never registered.)" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error " +"(e.g. if the given *watcher_id* was never registered.)" msgstr "" #: ../../c-api/dict.rst:357 msgid "" -"Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" -"func:`PyDict_AddWatcher` will be called when *dict* is modified or " +"Mark dictionary *dict* as watched. The callback granted *watcher_id* " +"by :c:func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" @@ -485,8 +492,8 @@ msgstr "" #: ../../c-api/dict.rst:409 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " -"will be printed as an unraisable exception using :c:func:" -"`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" #: ../../c-api/dict.rst:413 diff --git a/c-api/file.po b/c-api/file.po index ccf0d607eb..cb40f45c72 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -38,7 +38,7 @@ msgid "" msgstr "" "這些 API 是用於內建檔案物件的 Python 2 C API 的最小模擬 (minimal emulation)," "它過去依賴於 C 標準函式庫對於緩衝 I/O (:c:expr:`FILE*`) 的支援。在 Python 3 " -"中,檔案和串流使用新的 :mod:`io` 模組,它在操作系統的低階無緩衝 I/O 上定義了" +"中,檔案和串流使用新的 :mod:`io` 模組,它在作業系統的低階無緩衝 I/O 上定義了" "多個層級。下面描述的函式是這些新 API 的便捷 C 包裝器,主要用於直譯器中的內部" "錯誤報告;建議第三方程式碼改為存取 :mod:`io` API。" @@ -55,7 +55,7 @@ msgstr "" "從已打開檔案 *fd* 的檔案描述器建立一個 Python 檔案物件。引數 *name*、" "*encoding*、*errors* 和 *newline* 可以為 ``NULL`` 以使用預設值; *buffering* " "可以是 *-1* 以使用預設值。 *name* 被忽略並保留以實作向後相容性。失敗時回傳 " -"``NULL``。有關引數的更全面描述,請參閱 :func:`io.open` 函式文檔。" +"``NULL``。有關引數的更全面描述,請參閱 :func:`io.open` 函式文件。" #: ../../c-api/file.rst:31 msgid "" @@ -63,7 +63,7 @@ msgid "" "level file descriptors can produce various issues (such as unexpected " "ordering of data)." msgstr "" -"由於 Python 串流有自己的緩衝層,將它們與操作系統層級檔案描述器混合使用會產生" +"由於 Python 串流有自己的緩衝層,將它們與作業系統層級檔案描述器混合使用會產生" "各種問題(例如資料的排序不符合預期)。" #: ../../c-api/file.rst:35 diff --git a/c-api/frame.po b/c-api/frame.po index 1616a3cc27..da34208fb5 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-12 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -154,34 +154,61 @@ msgid "" msgstr "" #: ../../c-api/frame.rst:134 -msgid "As part of :pep:`667`, return a proxy object for optimized scopes." +msgid "" +"As part of :pep:`667`, return an instance of :c:var:" +"`PyFrameLocalsProxy_Type`." msgstr "" #: ../../c-api/frame.rst:140 msgid "Return the line number that *frame* is currently executing." msgstr "" -#: ../../c-api/frame.rst:145 +#: ../../c-api/frame.rst:144 +msgid "Frame Locals Proxies" +msgstr "" + +#: ../../c-api/frame.rst:148 +msgid "" +"The :attr:`~frame.f_locals` attribute on a :ref:`frame object ` is an instance of a \"frame-locals proxy\". The proxy object " +"exposes a write-through view of the underlying locals dictionary for the " +"frame. This ensures that the variables exposed by ``f_locals`` are always up " +"to date with the live local variables in the frame itself." +msgstr "" + +#: ../../c-api/frame.rst:154 +msgid "See :pep:`667` for more information." +msgstr "" + +#: ../../c-api/frame.rst:158 +msgid "The type of frame :func:`locals` proxy objects." +msgstr "" + +#: ../../c-api/frame.rst:162 +msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." +msgstr "" + +#: ../../c-api/frame.rst:165 msgid "Internal Frames" msgstr "" -#: ../../c-api/frame.rst:147 +#: ../../c-api/frame.rst:167 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:151 +#: ../../c-api/frame.rst:171 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:157 +#: ../../c-api/frame.rst:177 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:164 +#: ../../c-api/frame.rst:184 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:171 +#: ../../c-api/frame.rst:191 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/function.po b/c-api/function.po index c9e9a6c79f..299c34cd6c 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-13 00:03+0000\n" +"POT-Creation-Date: 2025-02-17 00:15+0000\n" "PO-Revision-Date: 2022-11-12 15:45+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,17 +37,17 @@ msgstr "用於函式的 C 結構。" #: ../../c-api/function.rst:22 msgid "" "This is an instance of :c:type:`PyTypeObject` and represents the Python " -"function type. It is exposed to Python programmers as ``types." -"FunctionType``." +"function type. It is exposed to Python programmers as " +"``types.FunctionType``." msgstr "" "這是個 :c:type:`PyTypeObject` 的實例,且代表了 Python 函式型別,Python 程式設" "計者可透過 ``types.FunctionType`` 使用它。" #: ../../c-api/function.rst:28 msgid "" -"Return true if *o* is a function object (has type :c:data:" -"`PyFunction_Type`). The parameter must not be ``NULL``. This function " -"always succeeds." +"Return true if *o* is a function object (has " +"type :c:data:`PyFunction_Type`). The parameter must not be ``NULL``. This " +"function always succeeds." msgstr "" "如果 *o* 是個函式物件(擁有 :c:data:`PyFunction_Type` 的型別)則回傳 true。參" "數必須不為 ``NULL``。此函式必能成功執行。" @@ -63,28 +63,30 @@ msgstr "" #: ../../c-api/function.rst:37 msgid "" -"The function's docstring and name are retrieved from the code object. :attr:" -"`~function.__module__` is retrieved from *globals*. The argument defaults, " -"annotations and closure are set to ``NULL``. :attr:`~function.__qualname__` " -"is set to the same value as the code object's :attr:`~codeobject." -"co_qualname` field." +"The function's docstring and name are retrieved from the code " +"object. :attr:`~function.__module__` is retrieved from *globals*. The " +"argument defaults, annotations and closure are set to " +"``NULL``. :attr:`~function.__qualname__` is set to the same value as the " +"code object's :attr:`~codeobject.co_qualname` field." msgstr "" -"函式的文件字串 (docstring) 和名稱是從程式碼物件所取得,:attr:`~function." -"__module__` 是自 *globals* 所取得。引數預設值、標註 (annotation) 和閉包 " -"(closure) 被設為 ``NULL``,:attr:`~function.__qualname__` 被設為和程式碼物" +"函式的文件字串 (docstring) 和名稱是從程式碼物件所取" +"得,:attr:`~function.__module__` 是自 *globals* 所取得。引數預設值、標註 " +"(annotation) 和閉包 (closure) 被設為 " +"``NULL``,:attr:`~function.__qualname__` 被設為和程式碼物" "件 :attr:`~codeobject.co_qualname` 欄位相同的值。" #: ../../c-api/function.rst:46 msgid "" -"As :c:func:`PyFunction_New`, but also allows setting the function object's :" -"attr:`~function.__qualname__` attribute. *qualname* should be a unicode " -"object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute is set " -"to the same value as the code object's :attr:`~codeobject.co_qualname` field." +"As :c:func:`PyFunction_New`, but also allows setting the function " +"object's :attr:`~function.__qualname__` attribute. *qualname* should be a " +"unicode object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute " +"is set to the same value as the code " +"object's :attr:`~codeobject.co_qualname` field." msgstr "" -"和 :c:func:`PyFunction_New` 相似,但也允許函式物件 :attr:`~function." -"__qualname__` 屬性的設定,*qualname* 應為一個 unicode 物件或是 ``NULL``;如" -"為 ``NULL``,:attr:`!__qualname__` 屬性會被設為與程式碼物件 :attr:" -"`~codeobject.co_qualname` 欄位相同的值。" +"和 :c:func:`PyFunction_New` 相似,但也允許函式物" +"件 :attr:`~function.__qualname__` 屬性的設定,*qualname* 應為一個 unicode 物" +"件或是 ``NULL``;如為 ``NULL``,:attr:`!__qualname__` 屬性會被設為與程式碼物" +"件 :attr:`~codeobject.co_qualname` 欄位相同的值。" #: ../../c-api/function.rst:57 msgid "Return the code object associated with the function object *op*." @@ -100,8 +102,9 @@ msgid "" "attribute of the :ref:`function object ` *op*. It can be " "*NULL*." msgstr "" -"回傳一個\\ :ref:`函式物件 ` *op* 之 :attr:`~function." -"__module__` 屬性的 :term:`borrowed reference`,它可以是 *NULL*。" +"回傳一個\\ :ref:`函式物件 ` *op* " +"之 :attr:`~function.__module__` 屬性的 :term:`borrowed reference`,它可以是 " +"*NULL*。" #: ../../c-api/function.rst:71 msgid "" @@ -180,39 +183,55 @@ msgstr "" #: ../../c-api/function.rst:138 msgid "" -"Clear watcher identified by *watcher_id* previously returned from :c:func:" -"`PyFunction_AddWatcher` for the current interpreter. Return ``0`` on " -"success, or ``-1`` and set an exception on error (e.g. if the given " -"*watcher_id* was never registered.)" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyFunction_AddWatcher` for the current interpreter. Return " +"``0`` on success, or ``-1`` and set an exception on error (e.g. if the " +"given *watcher_id* was never registered.)" msgstr "" #: ../../c-api/function.rst:148 -msgid "" -"Enumeration of possible function watcher events: - " -"``PyFunction_EVENT_CREATE`` - ``PyFunction_EVENT_DESTROY`` - " -"``PyFunction_EVENT_MODIFY_CODE`` - ``PyFunction_EVENT_MODIFY_DEFAULTS`` - " -"``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +msgid "Enumeration of possible function watcher events:" msgstr "" -#: ../../c-api/function.rst:160 +#: ../../c-api/function.rst:150 +msgid "``PyFunction_EVENT_CREATE``" +msgstr "``PyFunction_EVENT_CREATE``" + +#: ../../c-api/function.rst:151 +msgid "``PyFunction_EVENT_DESTROY``" +msgstr "``PyFunction_EVENT_DESTROY``" + +#: ../../c-api/function.rst:152 +msgid "``PyFunction_EVENT_MODIFY_CODE``" +msgstr "``PyFunction_EVENT_MODIFY_CODE``" + +#: ../../c-api/function.rst:153 +msgid "``PyFunction_EVENT_MODIFY_DEFAULTS``" +msgstr "``PyFunction_EVENT_MODIFY_DEFAULTS``" + +#: ../../c-api/function.rst:154 +msgid "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +msgstr "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" + +#: ../../c-api/function.rst:161 msgid "Type of a function watcher callback function." msgstr "" -#: ../../c-api/function.rst:162 +#: ../../c-api/function.rst:163 msgid "" "If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` " -"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a :term:" -"`borrowed reference` to the new value that is about to be stored in *func* " -"for the attribute that is being modified." +"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold " +"a :term:`borrowed reference` to the new value that is about to be stored in " +"*func* for the attribute that is being modified." msgstr "" -#: ../../c-api/function.rst:167 +#: ../../c-api/function.rst:168 msgid "" "The callback may inspect but must not modify *func*; doing so could have " "unpredictable effects, including infinite recursion." msgstr "" -#: ../../c-api/function.rst:170 +#: ../../c-api/function.rst:171 msgid "" "If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked " "after `func` has been fully initialized. Otherwise, the callback is invoked " @@ -224,7 +243,7 @@ msgid "" "semantics of the Python code being executed." msgstr "" -#: ../../c-api/function.rst:179 +#: ../../c-api/function.rst:180 msgid "" "If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the " "callback to the about-to-be-destroyed function will resurrect it, preventing " @@ -232,14 +251,14 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: ../../c-api/function.rst:184 +#: ../../c-api/function.rst:185 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " -"will be printed as an unraisable exception using :c:func:" -"`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/function.rst:188 +#: ../../c-api/function.rst:189 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 51c11e9884..5fd35ae6f8 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-04-13 00:40+0000\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -369,7 +369,7 @@ msgstr "" msgid "" "Type of the visitor function to be passed to :c:func:" "`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " -"``PyUnstable_GC_VisitObjects``. Return ``0`` to continue iteration, return " -"``1`` to stop iteration. Other return values are reserved for now so " +"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " +"``0`` to stop iteration. Other return values are reserved for now so " "behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/hash.po b/c-api/hash.po index 42324bd36d..01b52c5549 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -22,10 +22,9 @@ msgid "PyHash API" msgstr "PyHash API" #: ../../c-api/hash.rst:6 -#, fuzzy msgid "" "See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." -msgstr "另請參閱 :c:member:`PyTypeObject.tp_hash` 成員。" +msgstr "另請參閱 :c:member:`PyTypeObject.tp_hash` 成員和 :ref:`numeric-hash`。" #: ../../c-api/hash.rst:10 msgid "Hash value type: signed integer." diff --git a/c-api/init.po b/c-api/init.po index 5809d4bf46..0ce89e728e 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -205,10 +205,8 @@ msgstr ":c:func:`PyMutex_Unlock`" msgid "" "Despite their apparent similarity to some of the functions listed above, the " "following functions **should not be called** before the interpreter has been " -"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" -"`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" -"`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" -"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, " +"and :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:90 @@ -218,30 +216,30 @@ msgstr "" #: ../../c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " -"features and options. By default, these flags are controlled by :ref:" -"`command line options `." +"features and options. By default, these flags are controlled " +"by :ref:`command line options `." msgstr "" #: ../../c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " -"times that the option was set. For example, ``-b`` sets :c:data:" -"`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to " -"2." +"times that the option was set. For example, ``-b`` " +"sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` " +"sets :c:data:`Py_BytesWarningFlag` to 2." msgstr "" #: ../../c-api/init.rst:102 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"bytes_warning` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.bytes_warning` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:106 msgid "" -"Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" -"class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " -"or equal to ``2``." +"Issue a warning when comparing :class:`bytes` or :class:`bytearray` " +"with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if " +"greater or equal to ``2``." msgstr "" #: ../../c-api/init.rst:110 @@ -250,9 +248,9 @@ msgstr "由 :option:`-b` 選項設定。" #: ../../c-api/init.rst:116 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"parser_debug` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.parser_debug` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:120 @@ -269,9 +267,9 @@ msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" #: ../../c-api/init.rst:130 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"write_bytecode` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.write_bytecode` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:134 @@ -289,15 +287,15 @@ msgstr "" #: ../../c-api/init.rst:144 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"pathconfig_warnings` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.pathconfig_warnings` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:148 msgid "" -"Suppress error messages when calculating the module search path in :c:func:" -"`Py_GetPath`." +"Suppress error messages when calculating the module search path " +"in :c:func:`Py_GetPath`." msgstr "" #: ../../c-api/init.rst:151 @@ -306,8 +304,9 @@ msgstr "" #: ../../c-api/init.rst:157 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.hash_seed` " +"and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" @@ -326,15 +325,15 @@ msgstr "" #: ../../c-api/init.rst:172 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"use_environment` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.use_environment` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:176 msgid "" -"Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" -"`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." +"Ignore all :envvar:`!PYTHON*` environment variables, " +"e.g. :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" @@ -345,9 +344,9 @@ msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" #: ../../c-api/init.rst:185 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"inspect` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.inspect` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:189 @@ -365,9 +364,9 @@ msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。 #: ../../c-api/init.rst:200 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"interactive` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.interactive` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:204 @@ -376,9 +375,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:210 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"isolated` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.isolated` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:214 @@ -393,9 +392,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:225 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used " +"instead, see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:229 @@ -423,15 +422,15 @@ msgstr "" #: ../../c-api/init.rst:244 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"legacy_windows_stdio` should be used instead, see :ref:`Python " -"Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.legacy_windows_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:248 msgid "" -"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." -"_WindowsConsoleIO` for :mod:`sys` standard streams." +"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!" +"io._WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" #: ../../c-api/init.rst:251 @@ -446,17 +445,17 @@ msgstr "更多詳情請見 :pep:`528`。" #: ../../c-api/init.rst:262 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"site_import` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.site_import` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:266 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later (call :func:`site." -"main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" #: ../../c-api/init.rst:271 @@ -465,30 +464,30 @@ msgstr "由 :option:`-S` 選項設定。" #: ../../c-api/init.rst:277 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"user_site_directory` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.user_site_directory` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:281 msgid "" -"Don't add the :data:`user site-packages directory ` to :data:" -"`sys.path`." +"Don't add the :data:`user site-packages directory ` " +"to :data:`sys.path`." msgstr "" #: ../../c-api/init.rst:284 msgid "" -"Set by the :option:`-s` and :option:`-I` options, and the :envvar:" -"`PYTHONNOUSERSITE` environment variable." +"Set by the :option:`-s` and :option:`-I` options, and " +"the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" #: ../../c-api/init.rst:291 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"optimization_level` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.optimization_level` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:295 @@ -499,9 +498,9 @@ msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定 #: ../../c-api/init.rst:302 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"quiet` should be used instead, see :ref:`Python Initialization Configuration " -"`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.quiet` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:306 @@ -515,9 +514,9 @@ msgstr "由 :option:`-q` 選項設定。" #: ../../c-api/init.rst:316 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"buffered_stdio` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.buffered_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:320 @@ -532,9 +531,9 @@ msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定 #: ../../c-api/init.rst:329 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"verbose` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.verbose` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" #: ../../c-api/init.rst:333 @@ -558,8 +557,9 @@ msgstr "" #: ../../c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " -"this should be called before using any other Python/C API functions; see :" -"ref:`Before Python Initialization ` for the few exceptions." +"this should be called before using any other Python/C API functions; " +"see :ref:`Before Python Initialization ` for the few " +"exceptions." msgstr "" #: ../../c-api/init.rst:364 @@ -622,19 +622,20 @@ msgstr "" #: ../../c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " -"of Python/C API functions, and destroy all sub-interpreters (see :c:func:" -"`Py_NewInterpreter` below) that were created and not yet destroyed since the " -"last call to :c:func:`Py_Initialize`. Ideally, this frees all memory " -"allocated by the Python interpreter. This is a no-op when called for a " -"second time (without calling :c:func:`Py_Initialize` again first)." +"of Python/C API functions, and destroy all sub-interpreters " +"(see :c:func:`Py_NewInterpreter` below) that were created and not yet " +"destroyed since the last call to :c:func:`Py_Initialize`. Ideally, this " +"frees all memory allocated by the Python interpreter. This is a no-op when " +"called for a second time (without calling :c:func:`Py_Initialize` again " +"first)." msgstr "" #: ../../c-api/init.rst:424 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " -"thread and the main interpreter. This should never be called while :c:func:" -"`Py_RunMain` is running." +"thread and the main interpreter. This should never be called " +"while :c:func:`Py_RunMain` is running." msgstr "" #: ../../c-api/init.rst:429 @@ -671,11 +672,11 @@ msgstr "" #: ../../c-api/init.rst:452 msgid "" -"Raises an :ref:`auditing event ` ``cpython." -"_PySys_ClearAuditHooks`` with no arguments." +"Raises an :ref:`auditing event ` " +"``cpython._PySys_ClearAuditHooks`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." -"_PySys_ClearAuditHooks``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``cpython._PySys_ClearAuditHooks``。" #: ../../c-api/init.rst:459 msgid "" @@ -735,9 +736,9 @@ msgstr "" #: ../../c-api/init.rst:503 msgid "" -"In terms of the CPython runtime configuration APIs documented in the :ref:" -"`runtime configuration ` section (and without accounting for " -"error handling), ``Py_Main`` is approximately equivalent to::" +"In terms of the CPython runtime configuration APIs documented in " +"the :ref:`runtime configuration ` section (and without " +"accounting for error handling), ``Py_Main`` is approximately equivalent to::" msgstr "" #: ../../c-api/init.rst:507 @@ -754,14 +755,14 @@ msgstr "" #: ../../c-api/init.rst:515 msgid "" "In normal usage, an embedding application will call this function *instead* " -"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" -"`Py_InitializeFromConfig` directly, and all settings will be applied as " -"described elsewhere in this documentation. If this function is instead " -"called *after* a preceding runtime initialization API call, then exactly " -"which environmental and command line configuration settings will be updated " -"is version dependent (as it depends on which settings correctly support " -"being modified after they have already been set once when the runtime was " -"first initialized)." +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` " +"or :c:func:`Py_InitializeFromConfig` directly, and all settings will be " +"applied as described elsewhere in this documentation. If this function is " +"instead called *after* a preceding runtime initialization API call, then " +"exactly which environmental and command line configuration settings will be " +"updated is version dependent (as it depends on which settings correctly " +"support being modified after they have already been set once when the " +"runtime was first initialized)." msgstr "" #: ../../c-api/init.rst:528 @@ -770,11 +771,11 @@ msgstr "" #: ../../c-api/init.rst:530 msgid "" -"Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" -"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." -"run_module`) specified on the command line or in the configuration. If none " -"of these values are set, runs the interactive Python prompt (REPL) using the " -"``__main__`` module's global namespace." +"Executes the command (:c:member:`PyConfig.run_command`), the script " +"(:c:member:`PyConfig.run_filename`) or the module " +"(:c:member:`PyConfig.run_module`) specified on the command line or in the " +"configuration. If none of these values are set, runs the interactive Python " +"prompt (REPL) using the ``__main__`` module's global namespace." msgstr "" #: ../../c-api/init.rst:536 @@ -802,29 +803,40 @@ msgstr "" #: ../../c-api/init.rst:552 msgid "" "This function always finalizes the Python interpreter regardless of whether " -"it returns a value or immediately exits the process due to an unhandled :exc:" -"`SystemExit` exception." +"it returns a value or immediately exits the process due to an " +"unhandled :exc:`SystemExit` exception." msgstr "" #: ../../c-api/init.rst:556 msgid "" "See :ref:`Python Configuration ` for an example of a " -"customized Python that always runs in isolated mode using :c:func:" -"`Py_RunMain`." +"customized Python that always runs in isolated mode " +"using :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:562 +msgid "" +"Register an :mod:`atexit` callback for the target interpreter *interp*. This " +"is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and " +"data pointer for the callback." +msgstr "" + +#: ../../c-api/init.rst:566 +msgid "The :term:`GIL` must be held for *interp*." +msgstr "" + +#: ../../c-api/init.rst:571 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:572 +#: ../../c-api/init.rst:581 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"program_name` should be used instead, see :ref:`Python Initialization " -"Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.program_name` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:576 +#: ../../c-api/init.rst:585 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -838,37 +850,37 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:587 ../../c-api/init.rst:829 ../../c-api/init.rst:865 -#: ../../c-api/init.rst:891 +#: ../../c-api/init.rst:596 ../../c-api/init.rst:838 ../../c-api/init.rst:874 +#: ../../c-api/init.rst:900 msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_*` string." +"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " +"a :c:expr:`wchar_t*` string." msgstr "" -#: ../../c-api/init.rst:595 +#: ../../c-api/init.rst:604 msgid "" "Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:599 ../../c-api/init.rst:621 ../../c-api/init.rst:667 -#: ../../c-api/init.rst:689 ../../c-api/init.rst:715 ../../c-api/init.rst:903 +#: ../../c-api/init.rst:608 ../../c-api/init.rst:630 ../../c-api/init.rst:676 +#: ../../c-api/init.rst:698 ../../c-api/init.rst:724 ../../c-api/init.rst:912 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:602 ../../c-api/init.rst:624 ../../c-api/init.rst:670 -#: ../../c-api/init.rst:692 ../../c-api/init.rst:720 ../../c-api/init.rst:906 +#: ../../c-api/init.rst:611 ../../c-api/init.rst:633 ../../c-api/init.rst:679 +#: ../../c-api/init.rst:701 ../../c-api/init.rst:729 ../../c-api/init.rst:915 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:605 ../../c-api/init.rst:695 +#: ../../c-api/init.rst:614 ../../c-api/init.rst:704 msgid "Get :data:`sys.executable` instead." msgstr "" -#: ../../c-api/init.rst:611 +#: ../../c-api/init.rst:620 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " @@ -882,27 +894,27 @@ msgid "" "See also the next function." msgstr "" -#: ../../c-api/init.rst:627 +#: ../../c-api/init.rst:636 msgid "" "Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if :ref:`virtual " "environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:634 +#: ../../c-api/init.rst:643 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " "with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " -"caller should not modify its value. This corresponds to the :makevar:" -"`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" -"prefix`` argument to the :program:`configure` script at build time. The " -"value is available to Python code as ``sys.base_exec_prefix``. It is only " -"useful on Unix." +"caller should not modify its value. This corresponds to " +"the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and " +"the ``--exec-prefix`` argument to the :program:`configure` script at build " +"time. The value is available to Python code as ``sys.base_exec_prefix``. " +"It is only useful on Unix." msgstr "" -#: ../../c-api/init.rst:645 +#: ../../c-api/init.rst:654 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -911,7 +923,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:651 +#: ../../c-api/init.rst:660 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -925,21 +937,21 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:662 +#: ../../c-api/init.rst:671 msgid "" -"System administrators will know how to configure the :program:`mount` or :" -"program:`automount` programs to share :file:`/usr/local` between platforms " -"while having :file:`/usr/local/plat` be a different filesystem for each " -"platform." +"System administrators will know how to configure the :program:`mount` " +"or :program:`automount` programs to share :file:`/usr/local` between " +"platforms while having :file:`/usr/local/plat` be a different filesystem for " +"each platform." msgstr "" -#: ../../c-api/init.rst:673 +#: ../../c-api/init.rst:682 msgid "" -"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if :ref:" -"`virtual environments ` need to be handled." +"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` " +"if :ref:`virtual environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:683 +#: ../../c-api/init.rst:692 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -948,7 +960,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:705 +#: ../../c-api/init.rst:714 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:member:`PyConfig.program_name`) and some environment " @@ -961,34 +973,34 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:723 +#: ../../c-api/init.rst:732 msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:729 +#: ../../c-api/init.rst:738 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:732 +#: ../../c-api/init.rst:741 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:736 +#: ../../c-api/init.rst:745 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " "period. The returned string points into static storage; the caller should " -"not modify its value. The value is available to Python code as :data:`sys." -"version`." +"not modify its value. The value is available to Python code " +"as :data:`sys.version`." msgstr "" -#: ../../c-api/init.rst:741 +#: ../../c-api/init.rst:750 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:748 +#: ../../c-api/init.rst:757 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -999,58 +1011,58 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:759 +#: ../../c-api/init.rst:768 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:761 +#: ../../c-api/init.rst:770 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:765 +#: ../../c-api/init.rst:774 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:771 +#: ../../c-api/init.rst:780 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:774 +#: ../../c-api/init.rst:783 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:778 ../../c-api/init.rst:792 +#: ../../c-api/init.rst:787 ../../c-api/init.rst:801 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:785 +#: ../../c-api/init.rst:794 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:788 +#: ../../c-api/init.rst:797 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:804 +#: ../../c-api/init.rst:813 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " -"should be used instead, see :ref:`Python Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` " +"and :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:809 +#: ../../c-api/init.rst:818 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -1061,84 +1073,85 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:817 +#: ../../c-api/init.rst:826 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:821 +#: ../../c-api/init.rst:830 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " -"path of the directory where the script is located is prepended to :data:`sys." -"path`." +"path of the directory where the script is located is prepended " +"to :data:`sys.path`." msgstr "" -#: ../../c-api/init.rst:824 +#: ../../c-api/init.rst:833 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:832 ../../c-api/init.rst:868 +#: ../../c-api/init.rst:841 ../../c-api/init.rst:877 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:836 +#: ../../c-api/init.rst:845 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:841 +#: ../../c-api/init.rst:850 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " -"popping the first :data:`sys.path` element after having called :c:func:" -"`PySys_SetArgv`, for example using::" +"popping the first :data:`sys.path` element after having " +"called :c:func:`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:845 +#: ../../c-api/init.rst:854 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:857 +#: ../../c-api/init.rst:866 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" -"`Python Initialization Configuration `." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should " +"be used instead, see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:861 +#: ../../c-api/init.rst:870 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " -"``1`` unless the :program:`python` interpreter was started with the :option:" -"`-I`." +"``1`` unless the :program:`python` interpreter was started with " +"the :option:`-I`." msgstr "" -#: ../../c-api/init.rst:871 +#: ../../c-api/init.rst:880 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:878 +#: ../../c-api/init.rst:887 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"home` should be used instead, see :ref:`Python Initialization Configuration " -"`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.home` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:882 +#: ../../c-api/init.rst:891 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:886 +#: ../../c-api/init.rst:895 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -1146,24 +1159,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:899 +#: ../../c-api/init.rst:908 msgid "" -"Return the default \"home\", that is, the value set by :c:member:`PyConfig." -"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " -"is set." +"Return the default \"home\", that is, the value set " +"by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` " +"environment variable if it is set." msgstr "" -#: ../../c-api/init.rst:909 +#: ../../c-api/init.rst:918 msgid "" "Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " "instead." msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../c-api/init.rst:917 +#: ../../c-api/init.rst:926 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:924 +#: ../../c-api/init.rst:933 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -1175,17 +1188,18 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:934 +#: ../../c-api/init.rst:943 msgid "" -"Therefore, the rule exists that only the thread that has acquired the :term:" -"`GIL` may operate on Python objects or call Python/C API functions. In order " -"to emulate concurrency of execution, the interpreter regularly tries to " -"switch threads (see :func:`sys.setswitchinterval`). The lock is also " -"released around potentially blocking I/O operations like reading or writing " -"a file, so that other Python threads can run in the meantime." +"Therefore, the rule exists that only the thread that has acquired " +"the :term:`GIL` may operate on Python objects or call Python/C API " +"functions. In order to emulate concurrency of execution, the interpreter " +"regularly tries to switch threads (see :func:`sys.setswitchinterval`). The " +"lock is also released around potentially blocking I/O operations like " +"reading or writing a file, so that other Python threads can run in the " +"meantime." msgstr "" -#: ../../c-api/init.rst:944 +#: ../../c-api/init.rst:953 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1193,17 +1207,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:950 +#: ../../c-api/init.rst:959 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:952 +#: ../../c-api/init.rst:961 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:955 +#: ../../c-api/init.rst:964 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1212,29 +1226,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:961 +#: ../../c-api/init.rst:970 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:963 +#: ../../c-api/init.rst:972 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:971 +#: ../../c-api/init.rst:980 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:975 +#: ../../c-api/init.rst:984 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:977 +#: ../../c-api/init.rst:986 msgid "" "PyThreadState *_save;\n" "\n" @@ -1243,7 +1257,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:987 +#: ../../c-api/init.rst:996 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1254,7 +1268,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:996 +#: ../../c-api/init.rst:1005 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1264,21 +1278,21 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:1007 +#: ../../c-api/init.rst:1016 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:1009 +#: ../../c-api/init.rst:1018 msgid "" -"When threads are created using the dedicated Python APIs (such as the :mod:" -"`threading` module), a thread state is automatically associated to them and " -"the code showed above is therefore correct. However, when threads are " -"created from C (for example by a third-party library with its own thread " +"When threads are created using the dedicated Python APIs (such as " +"the :mod:`threading` module), a thread state is automatically associated to " +"them and the code showed above is therefore correct. However, when threads " +"are created from C (for example by a third-party library with its own thread " "management), they don't hold the GIL, nor is there a thread state structure " "for them." msgstr "" -#: ../../c-api/init.rst:1016 +#: ../../c-api/init.rst:1025 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1289,14 +1303,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:1024 +#: ../../c-api/init.rst:1033 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:1028 +#: ../../c-api/init.rst:1037 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1309,20 +1323,20 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:1038 +#: ../../c-api/init.rst:1047 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " -"supports the creation of additional interpreters (using :c:func:" -"`Py_NewInterpreter`), but mixing multiple interpreters and the " -"``PyGILState_*`` API is unsupported." +"supports the creation of additional interpreters " +"(using :c:func:`Py_NewInterpreter`), but mixing multiple interpreters and " +"the ``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:1048 +#: ../../c-api/init.rst:1057 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:1050 +#: ../../c-api/init.rst:1059 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1331,7 +1345,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:1056 +#: ../../c-api/init.rst:1065 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1341,14 +1355,14 @@ msgid "" "of additional (non-Python) locks that need to be acquired before or reset " "after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to " "be used to accomplish the same thing. Additionally, when extending or " -"embedding Python, calling :c:func:`fork` directly rather than through :func:" -"`os.fork` (and returning to or calling into Python) may result in a deadlock " -"by one of Python's internal locks being held by a thread that is defunct " -"after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary " -"locks, but is not always able to." +"embedding Python, calling :c:func:`fork` directly rather than " +"through :func:`os.fork` (and returning to or calling into Python) may result " +"in a deadlock by one of Python's internal locks being held by a thread that " +"is defunct after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the " +"necessary locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:1071 +#: ../../c-api/init.rst:1080 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1361,17 +1375,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1084 +#: ../../c-api/init.rst:1093 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1086 +#: ../../c-api/init.rst:1095 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1091 +#: ../../c-api/init.rst:1100 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1379,7 +1393,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1096 +#: ../../c-api/init.rst:1105 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1387,41 +1401,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1104 +#: ../../c-api/init.rst:1113 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1109 +#: ../../c-api/init.rst:1118 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1120 +#: ../../c-api/init.rst:1129 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1122 +#: ../../c-api/init.rst:1131 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1124 +#: ../../c-api/init.rst:1133 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1127 +#: ../../c-api/init.rst:1136 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1131 +#: ../../c-api/init.rst:1140 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1141 +#: ../../c-api/init.rst:1150 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1429,7 +1443,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1149 +#: ../../c-api/init.rst:1158 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1437,8 +1451,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1155 ../../c-api/init.rst:1214 -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1164 ../../c-api/init.rst:1223 +#: ../../c-api/init.rst:1519 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1447,87 +1461,87 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1163 +#: ../../c-api/init.rst:1172 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1167 +#: ../../c-api/init.rst:1176 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1172 +#: ../../c-api/init.rst:1181 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" -#: ../../c-api/init.rst:1176 +#: ../../c-api/init.rst:1185 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1183 +#: ../../c-api/init.rst:1192 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:1188 +#: ../../c-api/init.rst:1197 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1193 +#: ../../c-api/init.rst:1202 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " "be called as many times as desired by a thread as long as each call is " "matched with a call to :c:func:`PyGILState_Release`. In general, other " -"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls as long as the thread state is restored to " -"its previous state before the Release(). For example, normal usage of the :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " -"is acceptable." +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls as long as the thread state is " +"restored to its previous state before the Release(). For example, normal " +"usage of the :c:macro:`Py_BEGIN_ALLOW_THREADS` " +"and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable." msgstr "" -#: ../../c-api/init.rst:1203 +#: ../../c-api/init.rst:1212 msgid "" -"The return value is an opaque \"handle\" to the thread state when :c:func:" -"`PyGILState_Ensure` was called, and must be passed to :c:func:" -"`PyGILState_Release` to ensure Python is left in the same state. Even though " -"recursive calls are allowed, these handles *cannot* be shared - each unique " -"call to :c:func:`PyGILState_Ensure` must save the handle for its call to :c:" -"func:`PyGILState_Release`." +"The return value is an opaque \"handle\" to the thread state " +"when :c:func:`PyGILState_Ensure` was called, and must be passed " +"to :c:func:`PyGILState_Release` to ensure Python is left in the same state. " +"Even though recursive calls are allowed, these handles *cannot* be shared - " +"each unique call to :c:func:`PyGILState_Ensure` must save the handle for its " +"call to :c:func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1210 +#: ../../c-api/init.rst:1219 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1222 +#: ../../c-api/init.rst:1231 msgid "" "Release any resources previously acquired. After this call, Python's state " -"will be the same as it was prior to the corresponding :c:func:" -"`PyGILState_Ensure` call (but generally this state will be unknown to the " -"caller, hence the use of the GILState API)." +"will be the same as it was prior to the " +"corresponding :c:func:`PyGILState_Ensure` call (but generally this state " +"will be unknown to the caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1227 +#: ../../c-api/init.rst:1236 msgid "" -"Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" -"func:`PyGILState_Release` on the same thread." +"Every call to :c:func:`PyGILState_Ensure` must be matched by a call " +"to :c:func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1233 +#: ../../c-api/init.rst:1242 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1535,7 +1549,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1241 +#: ../../c-api/init.rst:1250 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1546,241 +1560,248 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1253 +#: ../../c-api/init.rst:1262 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1259 +#: ../../c-api/init.rst:1268 msgid "" -"This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" -"``. Note that it contains an opening brace; it must be matched with a " -"following :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further " -"discussion of this macro." +"This macro expands to ``{ PyThreadState *_save; _save = " +"PyEval_SaveThread();``. Note that it contains an opening brace; it must be " +"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above " +"for further discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1267 +#: ../../c-api/init.rst:1276 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " -"contains a closing brace; it must be matched with an earlier :c:macro:" -"`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this " -"macro." +"contains a closing brace; it must be matched with an " +"earlier :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further " +"discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1275 +#: ../../c-api/init.rst:1284 msgid "" -"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" -"c:macro:`Py_END_ALLOW_THREADS` without the closing brace." +"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent " +"to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1281 +#: ../../c-api/init.rst:1290 msgid "" -"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " +"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent " +"to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1287 +#: ../../c-api/init.rst:1296 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1289 +#: ../../c-api/init.rst:1298 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1291 +#: ../../c-api/init.rst:1300 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1297 +#: ../../c-api/init.rst:1306 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1301 +#: ../../c-api/init.rst:1310 msgid "" -"Raises an :ref:`auditing event ` ``cpython." -"PyInterpreterState_New`` with no arguments." +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_New`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." -"PyInterpreterState_New``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``cpython.PyInterpreterState_New``。" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1315 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1309 +#: ../../c-api/init.rst:1318 msgid "" -"Raises an :ref:`auditing event ` ``cpython." -"PyInterpreterState_Clear`` with no arguments." +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_Clear`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." -"PyInterpreterState_Clear``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` " +"``cpython.PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1314 +#: ../../c-api/init.rst:1323 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1321 +#: ../../c-api/init.rst:1330 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1328 +#: ../../c-api/init.rst:1337 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1331 +#: ../../c-api/init.rst:1340 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1335 +#: ../../c-api/init.rst:1344 msgid "The :c:member:`PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1341 +#: ../../c-api/init.rst:1350 msgid "" "Destroy a thread state object. The global interpreter lock need not be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"held. The thread state must have been reset with a previous call " +"to :c:func:`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1348 +#: ../../c-api/init.rst:1357 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"held. The thread state must have been reset with a previous call " +"to :c:func:`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1356 +#: ../../c-api/init.rst:1365 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1358 +#: ../../c-api/init.rst:1367 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1361 +#: ../../c-api/init.rst:1370 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1363 ../../c-api/init.rst:1372 -#: ../../c-api/init.rst:1381 +#: ../../c-api/init.rst:1372 ../../c-api/init.rst:1381 +#: ../../c-api/init.rst:1390 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1370 +#: ../../c-api/init.rst:1379 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1379 +#: ../../c-api/init.rst:1388 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1388 +#: ../../c-api/init.rst:1397 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1390 +#: ../../c-api/init.rst:1399 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1397 +#: ../../c-api/init.rst:1406 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1400 +#: ../../c-api/init.rst:1409 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1408 +#: ../../c-api/init.rst:1417 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1410 +#: ../../c-api/init.rst:1419 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1413 ../../c-api/init.rst:1423 +#: ../../c-api/init.rst:1422 ../../c-api/init.rst:1432 +#: ../../c-api/init.rst:1454 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1420 +#: ../../c-api/init.rst:1429 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1430 +#: ../../c-api/init.rst:1439 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1434 +#: ../../c-api/init.rst:1443 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1441 +#: ../../c-api/init.rst:1451 +msgid "" +"Return a :term:`strong reference` to the ``__main__`` :ref:`module object " +"` for the given interpreter." +msgstr "" + +#: ../../c-api/init.rst:1461 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1463 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1446 +#: ../../c-api/init.rst:1466 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1449 +#: ../../c-api/init.rst:1469 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1454 +#: ../../c-api/init.rst:1474 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1456 ../../c-api/init.rst:1464 +#: ../../c-api/init.rst:1476 ../../c-api/init.rst:1484 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1462 +#: ../../c-api/init.rst:1482 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1471 +#: ../../c-api/init.rst:1491 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1789,7 +1810,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1480 +#: ../../c-api/init.rst:1500 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1801,33 +1822,34 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1488 +#: ../../c-api/init.rst:1508 msgid "" -"The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" -"`unsigned long`." +"The type of the *id* parameter changed from :c:expr:`long` " +"to :c:expr:`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1494 +#: ../../c-api/init.rst:1514 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1525 msgid "" -"Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " -"current thread if called while the interpreter is finalizing." +"Updated to be consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`, and terminate the current thread if called " +"while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1510 +#: ../../c-api/init.rst:1530 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1516 +#: ../../c-api/init.rst:1536 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1836,17 +1858,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1522 +#: ../../c-api/init.rst:1542 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1529 +#: ../../c-api/init.rst:1549 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1531 +#: ../../c-api/init.rst:1551 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1854,7 +1876,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1536 +#: ../../c-api/init.rst:1556 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1865,134 +1887,134 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1543 +#: ../../c-api/init.rst:1563 msgid "" -"You can switch between sub-interpreters using the :c:func:" -"`PyThreadState_Swap` function. You can create and destroy them using the " -"following functions:" +"You can switch between sub-interpreters using " +"the :c:func:`PyThreadState_Swap` function. You can create and destroy them " +"using the following functions:" msgstr "" -#: ../../c-api/init.rst:1549 +#: ../../c-api/init.rst:1569 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1555 +#: ../../c-api/init.rst:1575 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1559 +#: ../../c-api/init.rst:1579 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1563 +#: ../../c-api/init.rst:1583 msgid "" -"If this is ``0`` then :c:member:`~PyInterpreterConfig." -"check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " -"then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:" -"`PyInterpreterConfig_OWN_GIL`." +"If this is ``0`` " +"then :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` must be " +"``1`` (non-zero). If this is ``1`` then :c:member:`~PyInterpreterConfig.gil` " +"must not be :c:macro:`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1571 +#: ../../c-api/init.rst:1591 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1575 +#: ../../c-api/init.rst:1595 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1580 +#: ../../c-api/init.rst:1600 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1585 +#: ../../c-api/init.rst:1605 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1590 +#: ../../c-api/init.rst:1610 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1596 +#: ../../c-api/init.rst:1616 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " -"create daemon threads. Otherwise daemon threads are allowed (as long as :c:" -"member:`~PyInterpreterConfig.allow_threads` is non-zero)." +"create daemon threads. Otherwise daemon threads are allowed (as long " +"as :c:member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1603 +#: ../../c-api/init.rst:1623 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " -"is currently active. Otherwise only multi-phase init extension modules (see :" -"pep:`489`) may be imported. (Also see :c:macro:" -"`Py_mod_multiple_interpreters`.)" +"is currently active. Otherwise only multi-phase init extension modules " +"(see :pep:`489`) may be imported. (Also " +"see :c:macro:`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1610 +#: ../../c-api/init.rst:1630 msgid "" -"This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." -"use_main_obmalloc` is ``0``." +"This must be ``1`` (non-zero) " +"if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1615 +#: ../../c-api/init.rst:1635 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1622 +#: ../../c-api/init.rst:1642 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1626 +#: ../../c-api/init.rst:1646 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1630 +#: ../../c-api/init.rst:1650 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1632 +#: ../../c-api/init.rst:1652 msgid "" -"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" -"`PyInterpreterConfig.use_main_obmalloc` must be ``0``." +"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` " +"then :c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1646 +#: ../../c-api/init.rst:1666 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " "interpreter has separate, independent versions of all imported modules, " -"including the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:" -"`sys`. The table of loaded modules (``sys.modules``) and the module search " -"path (``sys.path``) are also separate. The new environment has no ``sys." -"argv`` variable. It has new standard I/O stream file objects ``sys.stdin``, " -"``sys.stdout`` and ``sys.stderr`` (however these refer to the same " -"underlying file descriptors)." +"including the fundamental modules :mod:`builtins`, :mod:`__main__` " +"and :mod:`sys`. The table of loaded modules (``sys.modules``) and the " +"module search path (``sys.path``) are also separate. The new environment " +"has no ``sys.argv`` variable. It has new standard I/O stream file objects " +"``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the " +"same underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1656 +#: ../../c-api/init.rst:1676 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1659 +#: ../../c-api/init.rst:1679 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -2003,7 +2025,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1668 +#: ../../c-api/init.rst:1688 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -2015,13 +2037,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1679 +#: ../../c-api/init.rst:1699 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:1702 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2053,58 +2075,59 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1697 +#: ../../c-api/init.rst:1717 msgid "" "Note that the config is used only briefly and does not get modified. During " -"initialization the config's values are converted into various :c:type:" -"`PyInterpreterState` values. A read-only copy of the config may be stored " -"internally on the :c:type:`PyInterpreterState`." +"initialization the config's values are converted into " +"various :c:type:`PyInterpreterState` values. A read-only copy of the config " +"may be stored internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1706 +#: ../../c-api/init.rst:1726 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1728 msgid "" -"For modules using multi-phase initialization, e.g. :c:func:" -"`PyModule_FromDefAndSpec`, a separate module object is created and " -"initialized for each interpreter. Only C-level static and global variables " -"are shared between these module objects." +"For modules using multi-phase initialization, " +"e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is created " +"and initialized for each interpreter. Only C-level static and global " +"variables are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1714 +#: ../../c-api/init.rst:1734 msgid "" -"For modules using single-phase initialization, e.g. :c:func:" -"`PyModule_Create`, the first time a particular extension is imported, it is " -"initialized normally, and a (shallow) copy of its module's dictionary is " -"squirreled away. When the same extension is imported by another " -"(sub-)interpreter, a new module is initialized and filled with the contents " -"of this copy; the extension's ``init`` function is not called. Objects in " -"the module's dictionary thus end up shared across (sub-)interpreters, which " -"might cause unwanted behavior (see `Bugs and caveats`_ below)." +"For modules using single-phase initialization, " +"e.g. :c:func:`PyModule_Create`, the first time a particular extension is " +"imported, it is initialized normally, and a (shallow) copy of its module's " +"dictionary is squirreled away. When the same extension is imported by " +"another (sub-)interpreter, a new module is initialized and filled with the " +"contents of this copy; the extension's ``init`` function is not called. " +"Objects in the module's dictionary thus end up shared across " +"(sub-)interpreters, which might cause unwanted behavior (see `Bugs and " +"caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1725 +#: ../../c-api/init.rst:1745 msgid "" "Note that this is different from what happens when an extension is imported " -"after the interpreter has been completely re-initialized by calling :c:func:" -"`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's " -"``initmodule`` function *is* called again. As with multi-phase " -"initialization, this means that only C-level static and global variables are " -"shared between these modules." +"after the interpreter has been completely re-initialized by " +"calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, " +"the extension's ``initmodule`` function *is* called again. As with multi-" +"phase initialization, this means that only C-level static and global " +"variables are shared between these modules." msgstr "" -#: ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:1765 msgid "" -"Create a new sub-interpreter. This is essentially just a wrapper around :c:" -"func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " -"behavior. The result is an unisolated sub-interpreter that shares the main " -"interpreter's GIL, allows fork/exec, allows daemon threads, and allows " -"single-phase init modules." +"Create a new sub-interpreter. This is essentially just a wrapper " +"around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves " +"the existing behavior. The result is an unisolated sub-interpreter that " +"shares the main interpreter's GIL, allows fork/exec, allows daemon threads, " +"and allows single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1777 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2114,17 +2137,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1765 +#: ../../c-api/init.rst:1785 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1770 +#: ../../c-api/init.rst:1790 msgid "A Per-Interpreter GIL" -msgstr "" +msgstr "直譯器各別持有的 GIL" -#: ../../c-api/init.rst:1772 +#: ../../c-api/init.rst:1792 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2136,7 +2159,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1782 +#: ../../c-api/init.rst:1802 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2150,7 +2173,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1793 +#: ../../c-api/init.rst:1813 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2158,7 +2181,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1798 +#: ../../c-api/init.rst:1818 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2168,11 +2191,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1809 +#: ../../c-api/init.rst:1829 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1811 +#: ../../c-api/init.rst:1831 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2185,7 +2208,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1821 +#: ../../c-api/init.rst:1841 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2194,37 +2217,37 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1827 +#: ../../c-api/init.rst:1847 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " "and OS-level threads, an assumption broken by the presence of sub-" "interpreters. It is highly recommended that you don't switch sub-" -"interpreters between a pair of matching :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:" -"`ctypes`) using these APIs to allow calling of Python code from non-Python " -"created threads will probably be broken when using sub-interpreters." +"interpreters between a pair of matching :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such " +"as :mod:`ctypes`) using these APIs to allow calling of Python code from non-" +"Python created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1838 +#: ../../c-api/init.rst:1858 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1840 +#: ../../c-api/init.rst:1860 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1847 +#: ../../c-api/init.rst:1867 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1851 +#: ../../c-api/init.rst:1871 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2232,17 +2255,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1856 +#: ../../c-api/init.rst:1876 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1857 +#: ../../c-api/init.rst:1877 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1860 +#: ../../c-api/init.rst:1880 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2250,30 +2273,30 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1865 +#: ../../c-api/init.rst:1885 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1868 +#: ../../c-api/init.rst:1888 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:1893 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " "thread is busy executing a system call, *func* won't be called before the " "system call returns. This function is generally **not** suitable for " -"calling Python code from arbitrary C threads. Instead, use the :ref:" -"`PyGILState API`." +"calling Python code from arbitrary C threads. Instead, use " +"the :ref:`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1882 +#: ../../c-api/init.rst:1902 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2281,18 +2304,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1891 +#: ../../c-api/init.rst:1911 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1896 +#: ../../c-api/init.rst:1916 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1900 +#: ../../c-api/init.rst:1920 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2302,78 +2325,76 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1910 +#: ../../c-api/init.rst:1930 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " "the registration function as *obj*, *frame* is the frame object to which the " -"event pertains, *what* is one of the constants :c:data:`PyTrace_CALL`, :c:" -"data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :" -"c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:" -"`PyTrace_C_RETURN`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the " -"value of *what*:" +"event pertains, *what* is one of the " +"constants :c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, " +"or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1939 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1939 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1921 +#: ../../c-api/init.rst:1941 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1921 ../../c-api/init.rst:1926 -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1941 ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:1957 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1943 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1943 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1946 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1948 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1948 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1931 +#: ../../c-api/init.rst:1951 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1931 ../../c-api/init.rst:1933 -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1951 ../../c-api/init.rst:1953 +#: ../../c-api/init.rst:1955 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1933 +#: ../../c-api/init.rst:1953 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1955 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1957 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1942 +#: ../../c-api/init.rst:1962 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2382,7 +2403,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1951 +#: ../../c-api/init.rst:1971 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2394,133 +2415,134 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1962 +#: ../../c-api/init.rst:1982 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " -"reported. It may be disabled for a frame by setting :attr:`~frame." -"f_trace_lines` to *0* on that frame." +"reported. It may be disabled for a frame by " +"setting :attr:`~frame.f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1970 +#: ../../c-api/init.rst:1990 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1976 +#: ../../c-api/init.rst:1996 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1982 +#: ../../c-api/init.rst:2002 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1988 +#: ../../c-api/init.rst:2008 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1994 +#: ../../c-api/init.rst:2014 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " -"event is not emitted by default: it must be explicitly requested by setting :" -"attr:`~frame.f_trace_opcodes` to *1* on the frame." +"event is not emitted by default: it must be explicitly requested by " +"setting :attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2002 +#: ../../c-api/init.rst:2022 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " "If the profile function needs to maintain state, using a different value for " "*obj* for each thread provides a convenient and thread-safe place to store " -"it. The profile function is called for all monitored events except :c:data:" -"`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." +"it. The profile function is called for all monitored events " +"except :c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` " +"and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2009 +#: ../../c-api/init.rst:2029 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2011 ../../c-api/init.rst:2018 -#: ../../c-api/init.rst:2037 ../../c-api/init.rst:2044 +#: ../../c-api/init.rst:2031 ../../c-api/init.rst:2038 +#: ../../c-api/init.rst:2057 ../../c-api/init.rst:2064 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2015 +#: ../../c-api/init.rst:2035 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2020 +#: ../../c-api/init.rst:2040 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2028 +#: ../../c-api/init.rst:2048 msgid "" -"Set the tracing function to *func*. This is similar to :c:func:" -"`PyEval_SetProfile`, except the tracing function does receive line-number " -"events and per-opcode events, but does not receive any event related to C " -"function objects being called. Any trace function registered using :c:func:" -"`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, :c:data:" -"`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the " -"*what* parameter." +"Set the tracing function to *func*. This is similar " +"to :c:func:`PyEval_SetProfile`, except the tracing function does receive " +"line-number events and per-opcode events, but does not receive any event " +"related to C function objects being called. Any trace function registered " +"using :c:func:`PyEval_SetTrace` will not " +"receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` " +"or :c:data:`PyTrace_C_RETURN` as a value for the *what* parameter." msgstr "" -#: ../../c-api/init.rst:2035 +#: ../../c-api/init.rst:2055 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2041 +#: ../../c-api/init.rst:2061 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2046 +#: ../../c-api/init.rst:2066 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2052 +#: ../../c-api/init.rst:2072 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2058 +#: ../../c-api/init.rst:2078 msgid "" -"The type of the trace function registered using :c:func:" -"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " -"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " -"about to be destroyed (when **event** is set to :c:data:" -"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " -"provided when :c:func:`PyRefTracer_SetTracer` was called." +"The type of the trace function registered " +"using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python " +"object that has been just created (when **event** is set " +"to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is " +"set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque " +"pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2068 +#: ../../c-api/init.rst:2088 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2073 +#: ../../c-api/init.rst:2093 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2078 +#: ../../c-api/init.rst:2098 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2529,7 +2551,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2084 +#: ../../c-api/init.rst:2104 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2537,11 +2559,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2089 ../../c-api/init.rst:2100 +#: ../../c-api/init.rst:2109 ../../c-api/init.rst:2120 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2095 +#: ../../c-api/init.rst:2115 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2549,48 +2571,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2107 +#: ../../c-api/init.rst:2127 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2112 +#: ../../c-api/init.rst:2132 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2137 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2122 +#: ../../c-api/init.rst:2142 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2127 +#: ../../c-api/init.rst:2147 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2133 +#: ../../c-api/init.rst:2153 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2139 +#: ../../c-api/init.rst:2159 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2146 +#: ../../c-api/init.rst:2166 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2150 +#: ../../c-api/init.rst:2170 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2600,42 +2622,42 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2157 +#: ../../c-api/init.rst:2177 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2160 +#: ../../c-api/init.rst:2180 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2164 +#: ../../c-api/init.rst:2184 msgid "" -"None of these API functions handle memory management on behalf of the :c:" -"expr:`void*` values. You need to allocate and deallocate them yourself. If " -"the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, these functions " -"don't do refcount operations on them either." +"None of these API functions handle memory management on behalf of " +"the :c:expr:`void*` values. You need to allocate and deallocate them " +"yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, " +"these functions don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2172 +#: ../../c-api/init.rst:2192 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2174 +#: ../../c-api/init.rst:2194 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2180 +#: ../../c-api/init.rst:2200 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2185 +#: ../../c-api/init.rst:2205 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2643,66 +2665,67 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2190 +#: ../../c-api/init.rst:2210 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2196 +#: ../../c-api/init.rst:2216 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2201 +#: ../../c-api/init.rst:2221 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2203 +#: ../../c-api/init.rst:2223 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2210 +#: ../../c-api/init.rst:2230 msgid "" -"Return a value which is the same state as a value initialized with :c:macro:" -"`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." +"Return a value which is the same state as a value initialized " +"with :c:macro:`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic " +"allocation failure." msgstr "" -#: ../../c-api/init.rst:2217 +#: ../../c-api/init.rst:2237 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2223 +#: ../../c-api/init.rst:2243 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2228 +#: ../../c-api/init.rst:2248 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2230 +#: ../../c-api/init.rst:2250 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " -"undefined if the given :c:type:`Py_tss_t` has not been initialized by :c:" -"func:`PyThread_tss_create`." +"undefined if the given :c:type:`Py_tss_t` has not been initialized " +"by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2238 +#: ../../c-api/init.rst:2258 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2244 +#: ../../c-api/init.rst:2264 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2711,40 +2734,40 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2253 +#: ../../c-api/init.rst:2273 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " -"destroyed key is able to be initialized again by :c:func:" -"`PyThread_tss_create`. This function can be called repeatedly on the same " -"key -- calling it on an already destroyed key is a no-op." +"destroyed key is able to be initialized again " +"by :c:func:`PyThread_tss_create`. This function can be called repeatedly on " +"the same key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2262 +#: ../../c-api/init.rst:2282 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2269 +#: ../../c-api/init.rst:2289 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2277 +#: ../../c-api/init.rst:2297 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2279 +#: ../../c-api/init.rst:2299 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2284 +#: ../../c-api/init.rst:2304 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2753,62 +2776,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2289 +#: ../../c-api/init.rst:2309 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2300 +#: ../../c-api/init.rst:2320 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2302 +#: ../../c-api/init.rst:2322 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2306 +#: ../../c-api/init.rst:2326 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2309 +#: ../../c-api/init.rst:2329 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2311 +#: ../../c-api/init.rst:2331 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2317 +#: ../../c-api/init.rst:2337 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2325 +#: ../../c-api/init.rst:2345 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2333 +#: ../../c-api/init.rst:2353 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2341 +#: ../../c-api/init.rst:2361 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2343 +#: ../../c-api/init.rst:2363 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2816,17 +2839,18 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2348 +#: ../../c-api/init.rst:2368 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " -"sections and releasing the locks during calls to :c:func:" -"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most " -"recent critical section is resumed, and its locks reacquired. This means " -"the critical section API provides weaker guarantees than traditional locks " -"-- they are useful because their behavior is similar to the :term:`GIL`." +"sections and releasing the locks during calls " +"to :c:func:`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is " +"called, the most recent critical section is resumed, and its locks " +"reacquired. This means the critical section API provides weaker guarantees " +"than traditional locks -- they are useful because their behavior is similar " +"to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2355 +#: ../../c-api/init.rst:2375 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2834,20 +2858,20 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2362 +#: ../../c-api/init.rst:2382 msgid "" -"Operations that need to lock two objects at once must use :c:macro:" -"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " -"lock more than one object at once, because the inner critical section may " -"suspend the outer critical sections. This API does not provide a way to " -"lock more than two objects at once." +"Operations that need to lock two objects at once must " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical " +"sections to lock more than one object at once, because the inner critical " +"section may suspend the outer critical sections. This API does not provide " +"a way to lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2368 +#: ../../c-api/init.rst:2388 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2370 +#: ../../c-api/init.rst:2390 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2859,71 +2883,71 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2379 +#: ../../c-api/init.rst:2399 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " "critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " -"if the code triggered by the finalizer blocks and calls :c:func:" -"`PyEval_SaveThread`." +"if the code triggered by the finalizer blocks and " +"calls :c:func:`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2387 +#: ../../c-api/init.rst:2407 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2390 ../../c-api/init.rst:2404 -#: ../../c-api/init.rst:2419 ../../c-api/init.rst:2433 +#: ../../c-api/init.rst:2410 ../../c-api/init.rst:2424 +#: ../../c-api/init.rst:2439 ../../c-api/init.rst:2453 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2392 +#: ../../c-api/init.rst:2412 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2396 ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2416 ../../c-api/init.rst:2445 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2402 +#: ../../c-api/init.rst:2422 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2406 +#: ../../c-api/init.rst:2426 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2409 ../../c-api/init.rst:2438 +#: ../../c-api/init.rst:2429 ../../c-api/init.rst:2458 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2415 +#: ../../c-api/init.rst:2435 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2421 +#: ../../c-api/init.rst:2441 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2431 +#: ../../c-api/init.rst:2451 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2435 +#: ../../c-api/init.rst:2455 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -2937,147 +2961,147 @@ msgstr "PyEval_InitThreads()" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 ../../c-api/init.rst:1136 -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 ../../c-api/init.rst:1145 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1702 ../../c-api/init.rst:1755 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1722 ../../c-api/init.rst:1775 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:567 +#: ../../c-api/init.rst:576 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:567 ../../c-api/init.rst:799 +#: ../../c-api/init.rst:576 ../../c-api/init.rst:808 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:567 +#: ../../c-api/init.rst:576 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:680 +#: ../../c-api/init.rst:689 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:734 ../../c-api/init.rst:776 ../../c-api/init.rst:790 +#: ../../c-api/init.rst:743 ../../c-api/init.rst:785 ../../c-api/init.rst:799 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:746 +#: ../../c-api/init.rst:755 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:763 +#: ../../c-api/init.rst:772 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:799 +#: ../../c-api/init.rst:808 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:799 +#: ../../c-api/init.rst:808 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:932 +#: ../../c-api/init.rst:941 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:941 +#: ../../c-api/init.rst:950 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:967 +#: ../../c-api/init.rst:976 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:967 +#: ../../c-api/init.rst:976 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:992 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:992 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1136 +#: ../../c-api/init.rst:1145 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1702 +#: ../../c-api/init.rst:1722 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1732 +#: ../../c-api/init.rst:1752 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/init_config.po b/c-api/init_config.po index 5293b616d7..3397a5853b 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2025-03-14 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" diff --git a/c-api/intro.po b/c-api/intro.po index 9854c7f4d0..f246ab03ee 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +32,8 @@ msgid "" "API. The first reason is to write *extension modules* for specific purposes; " "these are C modules that extend the Python interpreter. This is probably " "the most common use. The second reason is to use Python as a component in a " -"larger application; this technique is generally referred to as :dfn:" -"`embedding` Python in an application." +"larger application; this technique is generally referred to " +"as :dfn:`embedding` Python in an application." msgstr "" "對於 Python 的應用程式開發介面使得 C 和 C++ 開發者能夠在各種層級存取 Python " "直譯器。該 API 同樣可用於 C++,但為簡潔起見,通常將其稱為 Python/C API。使用 " @@ -106,8 +105,8 @@ msgstr "" #: ../../c-api/intro.rst:54 msgid "" "This implies inclusion of the following standard headers: ````, " -"````, ````, ````, ```` and ```` (if available)." +"````, ````, ````, ```` and " +"```` (if available)." msgstr "" "這意味著會引入以下標準標頭:````、````、````、" "````、```` 和 ````\\ (如果可用)。" @@ -155,17 +154,17 @@ msgstr "" #: ../../c-api/intro.rst:79 msgid "" "The header files are typically installed with Python. On Unix, these are " -"located in the directories :file:`{prefix}/include/pythonversion/` and :file:" -"`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` " -"and :option:`exec_prefix <--exec-prefix>` are defined by the corresponding " -"parameters to Python's :program:`configure` script and *version* is ``'%d." -"%d' % sys.version_info[:2]``. On Windows, the headers are installed in :" -"file:`{prefix}/include`, where ``prefix`` is the installation directory " -"specified to the installer." +"located in the directories :file:`{prefix}/include/pythonversion/` " +"and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--" +"prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the " +"corresponding parameters to Python's :program:`configure` script and " +"*version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers " +"are installed in :file:`{prefix}/include`, where ``prefix`` is the " +"installation directory specified to the installer." msgstr "" "標頭檔通常隨 Python 一起安裝。在 Unix 上它們位於目錄 :file:`{prefix}/include/" -"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其中 :" -"option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " +"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其" +"中 :option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " "Python 的 :program:`configure` 腳本的相應參數定義,*version* 是 ``'%d.%d' % " "sys.version_info[:2]``。在 Windows 上,標頭安裝在 :file:`{prefix}/include` " "中,其中 ``prefix`` 是指定給安裝程式 (installer) 用的安裝目錄。" @@ -175,14 +174,14 @@ msgid "" "To include the headers, place both directories (if different) on your " "compiler's search path for includes. Do *not* place the parent directories " "on the search path and then use ``#include ``; this will " -"break on multi-platform builds since the platform independent headers under :" -"option:`prefix <--prefix>` include the platform specific headers from :" -"option:`exec_prefix <--exec-prefix>`." +"break on multi-platform builds since the platform independent headers " +"under :option:`prefix <--prefix>` include the platform specific headers " +"from :option:`exec_prefix <--exec-prefix>`." msgstr "" -"要引入標頭,請將兩個(如果不同)目錄放在編譯器的引入搜索路徑 (search path) " -"中。*不要*\\ 將父目錄放在搜索路徑上,然後使用 ``#include ``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立於平台的" -"標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" +"要引入標頭,請將兩個(如果不同)目錄放在編譯器的引入搜尋路徑 (search path) " +"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include ``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立" +"於平台的標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" #: ../../c-api/intro.rst:95 msgid "" @@ -204,8 +203,9 @@ msgid "" "Others of a more general utility are defined here. This is not necessarily " "a complete listing." msgstr "" -"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例如 :c:" -"macro:`Py_RETURN_NONE`),其他是更通用的工具程式。以下並不一定是完整的列表。" +"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例" +"如 :c:macro:`Py_RETURN_NONE`),其他是更通用的工具程式。以下並不一定是完整的" +"列表。" #: ../../c-api/intro.rst:110 msgid "" @@ -255,7 +255,7 @@ msgstr "回傳 ``x`` 的絕對值。" #: ../../c-api/intro.rst:140 msgid "" "Ask the compiler to always inline a static inline function. The compiler can " -"ignore it and decides to not inline the function." +"ignore it and decide to not inline the function." msgstr "" "要求編譯器總是嵌入靜態行內函式 (static inline function),編譯器可以忽略它並決" "定不嵌入該函式。" @@ -280,12 +280,13 @@ msgstr "" #: ../../c-api/intro.rst:151 msgid "" -"If Python is :ref:`built in debug mode ` (if the :c:macro:" -"`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does " -"nothing." +"If Python is :ref:`built in debug mode ` (if " +"the :c:macro:`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` " +"macro does nothing." msgstr "" -"如果 Python 是\\ :ref:`在除錯模式下建置 `\\ (如果 :c:macro:" -"`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼都不會做。" +"如果 Python 是\\ :ref:`在除錯模式下建置 `\\ (如" +"果 :c:macro:`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼" +"都不會做。" #: ../../c-api/intro.rst:154 msgid "It must be specified before the function return type. Usage::" @@ -345,8 +346,8 @@ msgstr "回傳 ``x`` 和 ``y`` 之間的最小值。" #: ../../c-api/intro.rst:202 msgid "" "Disable inlining on a function. For example, it reduces the C stack " -"consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" -"`33720`)." +"consumption: useful on LTO+PGO builds which heavily inline code " +"(see :issue:`33720`)." msgstr "" "禁用函式的嵌入。例如,它減少了 C 堆疊的消耗:對大量嵌入程式碼的 LTO+PGO 建置" "很有用(請參閱 :issue:`33720`)。" @@ -391,8 +392,8 @@ msgid "" "A use for ``Py_UNREACHABLE()`` is following a call a function that never " "returns but that is not declared :c:macro:`_Py_NO_RETURN`." msgstr "" -"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明為 :c:macro:" -"`_Py_NO_RETURN` 的函式之呼叫後使用。" +"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明" +"為 :c:macro:`_Py_NO_RETURN` 的函式之呼叫後使用。" #: ../../c-api/intro.rst:233 msgid "" @@ -476,9 +477,9 @@ msgid "" "are treated the same way by the Python language in most situations (e.g., " "assignments, scope rules, and argument passing), it is only fitting that " "they should be represented by a single C type. Almost all Python objects " -"live on the heap: you never declare an automatic or static variable of type :" -"c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` can " -"be declared. The sole exception are the type objects; since these must " +"live on the heap: you never declare an automatic or static variable of " +"type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` " +"can be declared. The sole exception are the type objects; since these must " "never be deallocated, they are typically static :c:type:`PyTypeObject` " "objects." msgstr "" @@ -493,19 +494,20 @@ msgstr "" #: ../../c-api/intro.rst:301 msgid "" -"All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" -"`reference count`. An object's type determines what kind of object it is (e." -"g., an integer, a list, or a user-defined function; there are many more as " -"explained in :ref:`types`). For each of the well-known types there is a " -"macro to check whether an object is of that type; for instance, " +"All Python objects (even Python integers) have a :dfn:`type` and " +"a :dfn:`reference count`. An object's type determines what kind of object " +"it is (e.g., an integer, a list, or a user-defined function; there are many " +"more as explained in :ref:`types`). For each of the well-known types there " +"is a macro to check whether an object is of that type; for instance, " "``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is " "a Python list." msgstr "" "所有 Python 物件(甚至是 Python 整數)都有一個型別 (:dfn:`type`) 和一個參照計" "數 (:dfn:`reference count`)。一個物件的型別決定了它是什麼種類的物件(例如一個" -"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見\\ :ref:" -"`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於該型別;" -"例如,若(且唯若)*a* 指向的物件是 Python list 時,``PyList_Check(a)`` 為真。" +"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見" +"\\ :ref:`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於" +"該型別;例如,若(且唯若)*a* 指向的物件是 Python list 時," +"``PyList_Check(a)`` 為真。" #: ../../c-api/intro.rst:312 msgid "Reference Counts" @@ -539,18 +541,18 @@ msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " "increment its reference count by one), and :c:func:`Py_DECREF` to release " -"that reference (i.e. decrement the reference count by one). The :c:func:" -"`Py_DECREF` macro is considerably more complex than the incref one, since it " -"must check whether the reference count becomes zero and then cause the " -"object's deallocator to be called. The deallocator is a function pointer " -"contained in the object's type structure. The type-specific deallocator " -"takes care of releasing references for other objects contained in the object " -"if this is a compound object type, such as a list, as well as performing any " -"additional finalization that's needed. There's no chance that the reference " -"count can overflow; at least as many bits are used to hold the reference " -"count as there are distinct memory locations in virtual memory (assuming " -"``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the reference count " -"increment is a simple operation." +"that reference (i.e. decrement the reference count by one). " +"The :c:func:`Py_DECREF` macro is considerably more complex than the incref " +"one, since it must check whether the reference count becomes zero and then " +"cause the object's deallocator to be called. The deallocator is a function " +"pointer contained in the object's type structure. The type-specific " +"deallocator takes care of releasing references for other objects contained " +"in the object if this is a compound object type, such as a list, as well as " +"performing any additional finalization that's needed. There's no chance " +"that the reference count can overflow; at least as many bits are used to " +"hold the reference count as there are distinct memory locations in virtual " +"memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the " +"reference count increment is a simple operation." msgstr "" "參照計數總是被明確地操作。正常的方法是使用巨集 :c:func:`Py_INCREF` 來取得對於" "物件的參照(即參照計數加一),並使用巨集 :c:func:`Py_DECREF` 來釋放參照(即將" @@ -595,12 +597,12 @@ msgid "" "conceivably remove the object from the list, releasing that reference, and " "possibly deallocating it. The real danger is that innocent-looking " "operations may invoke arbitrary Python code which could do this; there is a " -"code path which allows control to flow back to the user from a :c:func:" -"`Py_DECREF`, so almost any operation is potentially dangerous." +"code path which allows control to flow back to the user from " +"a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" "然而,一個常見的陷阱是從一個 list 中提取一個物件並保留它一段時間而不取得其參" "照。某些其他操作可能會從列表中刪除該物件,減少其參照計數並可能取消分配它。真" -"正的危險是看似無害的操作可能會呼叫可以執行此操作的任意 Python 程式碼;有一個" +"正的危險是看似無害的操作可能會叫用可以執行此操作的任意 Python 程式碼;有一個" "程式碼路徑允許控制權從 :c:func:`Py_DECREF` 回歸使用者,因此幾乎任何操作都有潛" "在危險。" @@ -631,22 +633,22 @@ msgid "" "shared). \"Owning a reference\" means being responsible for calling " "Py_DECREF on it when the reference is no longer needed. Ownership can also " "be transferred, meaning that the code that receives ownership of the " -"reference then becomes responsible for eventually releasing it by calling :c:" -"func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or " -"passing on this responsibility (usually to its caller). When a function " -"passes ownership of a reference on to its caller, the caller is said to " -"receive a *new* reference. When no ownership is transferred, the caller is " -"said to *borrow* the reference. Nothing needs to be done for a :term:" -"`borrowed reference`." +"reference then becomes responsible for eventually releasing it by " +"calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer " +"needed---or passing on this responsibility (usually to its caller). When a " +"function passes ownership of a reference on to its caller, the caller is " +"said to receive a *new* reference. When no ownership is transferred, the " +"caller is said to *borrow* the reference. Nothing needs to be done for " +"a :term:`borrowed reference`." msgstr "" "Python/C API 中函式的參照計數行為最好用\\ *參照的所有權*\\ 來解釋。所有權附屬" "於參照而非物件(物件並非被擁有,它們總是共享的)。「擁有參照」意味著當不再需" "要該參照時,負責在其上呼叫 Py_DECREF。所有權也可以轉移,這意味著接收參照所有" -"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` 或 :c:func:" -"`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼叫者)。當" -"一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ *新*\\ 參" -"照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是\\ :term:`借用參" -"照 `\\ 就不需要做任何事情。" +"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` " +"或 :c:func:`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼" +"叫者)。當一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ " +"*新*\\ 參照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是" +"\\ :term:`借用參照 `\\ 就不需要做任何事情。" #: ../../c-api/intro.rst:397 msgid "" @@ -662,20 +664,20 @@ msgstr "" #: ../../c-api/intro.rst:407 msgid "" -"Few functions steal references; the two notable exceptions are :c:func:" -"`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " -"the item (but not to the tuple or list into which the item is put!). These " -"functions were designed to steal a reference because of a common idiom for " -"populating a tuple or list with newly created objects; for example, the code " -"to create the tuple ``(1, 2, \"three\")`` could look like this (forgetting " -"about error handling for the moment; a better way to code this is shown " -"below)::" -msgstr "" -"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` 和 :c:" -"func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 tuple 或 " -"list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 list 的習" -"慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的程式碼可以" -"如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" +"Few functions steal references; the two notable exceptions " +"are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a " +"reference to the item (but not to the tuple or list into which the item is " +"put!). These functions were designed to steal a reference because of a " +"common idiom for populating a tuple or list with newly created objects; for " +"example, the code to create the tuple ``(1, 2, \"three\")`` could look like " +"this (forgetting about error handling for the moment; a better way to code " +"this is shown below)::" +msgstr "" +"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` " +"和 :c:func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 " +"tuple 或 list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 " +"list 的習慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的" +"程式碼可以如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" #: ../../c-api/intro.rst:415 msgid "" @@ -700,26 +702,26 @@ msgid "" "although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab " "another reference before calling the reference-stealing function." msgstr "" -"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即被 :c:func:" -"`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將被竊取,請" -"在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來獲取另一個參照。" +"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即" +"被 :c:func:`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將" +"被竊取,請在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" #: ../../c-api/intro.rst:427 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " -"do this since tuples are an immutable data type. You should only use :c:" -"func:`PyTuple_SetItem` for tuples that you are creating yourself." +"do this since tuples are an immutable data type. You should only " +"use :c:func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方法; :c:" -"func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做,因為 " -"tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple 使" -"用 :c:func:`PyTuple_SetItem`。" +"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方" +"法; :c:func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做," +"因為 tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple " +"使用 :c:func:`PyTuple_SetItem`。" #: ../../c-api/intro.rst:432 msgid "" -"Equivalent code for populating a list can be written using :c:func:" -"`PyList_New` and :c:func:`PyList_SetItem`." +"Equivalent code for populating a list can be written " +"using :c:func:`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" "可以使用 :c:func:`PyList_New` 和 :c:func:`PyList_SetItem` 編寫用於填充列表的" "等效程式碼。" @@ -727,10 +729,11 @@ msgstr "" #: ../../c-api/intro.rst:435 msgid "" "However, in practice, you will rarely use these ways of creating and " -"populating a tuple or list. There's a generic function, :c:func:" -"`Py_BuildValue`, that can create most common objects from C values, directed " -"by a :dfn:`format string`. For example, the above two blocks of code could " -"be replaced by the following (which also takes care of the error checking)::" +"populating a tuple or list. There's a generic " +"function, :c:func:`Py_BuildValue`, that can create most common objects from " +"C values, directed by a :dfn:`format string`. For example, the above two " +"blocks of code could be replaced by the following (which also takes care of " +"the error checking)::" msgstr "" "但是在實際操作中你很少會使用這些方法來建立和增加 tuple 和 list。有一個通用函" "式 :c:func:`Py_BuildValue` 可以從 C 值建立最常見的物件,由 :dfn:`format " @@ -839,7 +842,7 @@ msgstr "" "重要的是要意識到你是否擁有一個函式回傳的參照只取決於你呼叫哪個函式 --- *羽毛 " "(plumage)*(作為引數傳遞給函式的物件之型別)\\ *不會進入它!*\\ 因此,如果你" "使用 :c:func:`PyList_GetItem` 從 list 中提取一個項目,你不會擁有其參照 --- 但" -"如果你使用 :c:func:`PySequence_GetItem` 從同一 list 中獲取相同的項目(且恰好" +"如果你使用 :c:func:`PySequence_GetItem` 從同一 list 中取得相同的項目(且恰好" "使用完全相同的引數),你確實會擁有對回傳物件的參照。" #: ../../c-api/intro.rst:497 @@ -848,8 +851,8 @@ msgid "" "of the items in a list of integers; once using :c:func:`PyList_GetItem`, " "and once using :c:func:`PySequence_GetItem`. ::" msgstr "" -"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使用 :" -"c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" +"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使" +"用 :c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" #: ../../c-api/intro.rst:501 msgid "" @@ -914,12 +917,12 @@ msgstr "型別" #: ../../c-api/intro.rst:563 msgid "" "There are few other data types that play a significant role in the Python/C " -"API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" -"`double` and :c:expr:`char*`. A few structure types are used to describe " -"static tables used to list the functions exported by a module or the data " -"attributes of a new object type, and another is used to describe the value " -"of a complex number. These will be discussed together with the functions " -"that use them." +"API; most are simple C types such " +"as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A " +"few structure types are used to describe static tables used to list the " +"functions exported by a module or the data attributes of a new object type, " +"and another is used to describe the value of a complex number. These will " +"be discussed together with the functions that use them." msgstr "" "有少數幾個其他的資料型別在 Python/C API 中發揮重要作用;大多數是簡單的 C 型" "別,例如 :c:expr:`int`、:c:expr:`long`、:c:expr:`double` 和 :c:expr:`char*`。" @@ -934,8 +937,8 @@ msgid "" "positive value of type :c:type:`Py_ssize_t`." msgstr "" "一個帶符號的整數型別,使得 ``sizeof(Py_ssize_t) == sizeof(size_t)``。 C99 沒" -"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參閱 :pep:" -"`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" +"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參" +"閱 :pep:`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" #: ../../c-api/intro.rst:582 msgid "Exceptions" @@ -979,32 +982,32 @@ msgstr "" msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " -"of two states: an exception has occurred, or not. The function :c:func:" -"`PyErr_Occurred` can be used to check for this: it returns a borrowed " -"reference to the exception type object when an exception has occurred, and " -"``NULL`` otherwise. There are a number of functions to set the exception " -"state: :c:func:`PyErr_SetString` is the most common (though not the most " -"general) function to set the exception state, and :c:func:`PyErr_Clear` " -"clears the exception state." +"of two states: an exception has occurred, or not. The " +"function :c:func:`PyErr_Occurred` can be used to check for this: it returns " +"a borrowed reference to the exception type object when an exception has " +"occurred, and ``NULL`` otherwise. There are a number of functions to set " +"the exception state: :c:func:`PyErr_SetString` is the most common (though " +"not the most general) function to set the exception state, " +"and :c:func:`PyErr_Clear` clears the exception state." msgstr "" "例外的狀態會在個別執行緒的存儲空間 (per-thread storage) 中維護(這相當於在非" "執行緒應用程式中使用全域存儲空間)。執行緒可以處於兩種狀態之一:發生例外或未" "發生例外。函式 :c:func:`PyErr_Occurred` 可用於檢查這一點:當例外發生時,它回" -"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很多::c:" -"func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函式,而 :" -"c:func:`PyErr_Clear` 是用來清除例外狀態。" +"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很" +"多::c:func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函" +"式,而 :c:func:`PyErr_Clear` 是用來清除例外狀態。" #: ../../c-api/intro.rst:617 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " -"traceback. These have the same meanings as the Python result of ``sys." -"exc_info()``; however, they are not the same: the Python objects represent " -"the last exception being handled by a Python :keyword:`try` ... :keyword:" -"`except` statement, while the C level exception state only exists while an " -"exception is being passed on between C functions until it reaches the Python " -"bytecode interpreter's main loop, which takes care of transferring it to " -"``sys.exc_info()`` and friends." +"traceback. These have the same meanings as the Python result of " +"``sys.exc_info()``; however, they are not the same: the Python objects " +"represent the last exception being handled by a " +"Python :keyword:`try` ... :keyword:`except` statement, while the C level " +"exception state only exists while an exception is being passed on between C " +"functions until it reaches the Python bytecode interpreter's main loop, " +"which takes care of transferring it to ``sys.exc_info()`` and friends." msgstr "" "完整的例外狀態由三個(都可以為 ``NULL`` 的)物件組成:例外型別、對應的例外值" "和回溯。這些與 ``sys.exc_info()`` 的 Python 結果具有相同的含義;但是它們並不" @@ -1016,15 +1019,15 @@ msgstr "" #: ../../c-api/intro.rst:629 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " -"the exception state from Python code is to call the function :func:`sys." -"exc_info`, which returns the per-thread exception state for Python code. " -"Also, the semantics of both ways to access the exception state have changed " -"so that a function which catches an exception will save and restore its " -"thread's exception state so as to preserve the exception state of its " -"caller. This prevents common bugs in exception handling code caused by an " -"innocent-looking function overwriting the exception being handled; it also " -"reduces the often unwanted lifetime extension for objects that are " -"referenced by the stack frames in the traceback." +"the exception state from Python code is to call the " +"function :func:`sys.exc_info`, which returns the per-thread exception state " +"for Python code. Also, the semantics of both ways to access the exception " +"state have changed so that a function which catches an exception will save " +"and restore its thread's exception state so as to preserve the exception " +"state of its caller. This prevents common bugs in exception handling code " +"caused by an innocent-looking function overwriting the exception being " +"handled; it also reduces the often unwanted lifetime extension for objects " +"that are referenced by the stack frames in the traceback." msgstr "" "請注意,從 Python 1.5 開始,從 Python 程式碼存取例外狀態的首選且支援執行緒安" "全的方法是呼叫 :func:`sys.exc_info` 函式,它回傳 Python 程式碼的個別執行緒例" @@ -1123,21 +1126,22 @@ msgstr "" #: ../../c-api/intro.rst:716 msgid "" "This example represents an endorsed use of the ``goto`` statement in C! It " -"illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" -"`PyErr_Clear` to handle specific exceptions, and the use of :c:func:" -"`Py_XDECREF` to dispose of owned references that may be ``NULL`` (note the " -"``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a " -"``NULL`` reference). It is important that the variables used to hold owned " -"references are initialized to ``NULL`` for this to work; likewise, the " -"proposed return value is initialized to ``-1`` (failure) and only set to " -"success after the final call made is successful." -msgstr "" -"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了以 :c:func:" -"`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例外,以及以 :" -"c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意名稱中的 " -"``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要的是,用" -"於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣地,回傳值" -"被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成功。" +"illustrates the use of :c:func:`PyErr_ExceptionMatches` " +"and :c:func:`PyErr_Clear` to handle specific exceptions, and the use " +"of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` " +"(note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when " +"confronted with a ``NULL`` reference). It is important that the variables " +"used to hold owned references are initialized to ``NULL`` for this to work; " +"likewise, the proposed return value is initialized to ``-1`` (failure) and " +"only set to success after the final call made is successful." +msgstr "" +"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了" +"以 :c:func:`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例" +"外,以及以 :c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意" +"名稱中的 ``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要" +"的是,用於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣" +"地,回傳值被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成" +"功。" #: ../../c-api/intro.rst:730 msgid "Embedding Python" @@ -1166,15 +1170,16 @@ msgstr "" #: ../../c-api/intro.rst:750 msgid "" -":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." -"argv``). If this variable is needed by Python code that will be executed " -"later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` " -"must be set: see :ref:`Python Initialization Configuration `." +":c:func:`Py_Initialize` does not set the \"script argument list\" " +"(``sys.argv``). If this variable is needed by Python code that will be " +"executed later, setting :c:member:`PyConfig.argv` " +"and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python " +"Initialization Configuration `." msgstr "" -":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 (``sys." -"argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設定 :c:member:" -"`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請見 :ref:`Python 初始化" -"配置 `。" +":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 " +"(``sys.argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設" +"定 :c:member:`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請" +"見 :ref:`Python 初始化配置 `。" #: ../../c-api/intro.rst:755 msgid "" @@ -1187,68 +1192,70 @@ msgid "" "to the parent directory where the executable named :file:`python` is found " "on the shell command search path (the environment variable :envvar:`PATH`)." msgstr "" -"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不同),:c:func:" -"`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔案的位置固定," -"並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組搜索路徑。或者" -"更詳細地說,它會在 shell 命令搜索路徑(環境變數 :envvar:`PATH`)中找到名為 :" -"file:`python` 的可執行檔案,並在其父目錄中查找一個名為 :file:`lib/python{X.Y}" -"` 的目錄的相對位置。" +"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不" +"同),:c:func:`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔" +"案的位置固定,並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組" +"搜尋路徑。或者更詳細地說,它會在 shell 命令搜尋路徑(環境變" +"數 :envvar:`PATH`)中找到名為 :file:`python` 的可執行檔案,並在其父目錄中查找" +"一個名為 :file:`lib/python{X.Y}` 的目錄的相對位置。" #: ../../c-api/intro.rst:764 msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" "python{X.Y}`. (In fact, this particular path is also the \"fallback\" " -"location, used when no executable file named :file:`python` is found along :" -"envvar:`PATH`.) The user can override this behavior by setting the " +"location, used when no executable file named :file:`python` is found " +"along :envvar:`PATH`.) The user can override this behavior by setting the " "environment variable :envvar:`PYTHONHOME`, or insert additional directories " "in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" "例如,如果在 :file:`/usr/local/bin/python` 中找到 Python 可執行檔案,它將假定" "函式庫位於 :file:`/usr/local/lib/python{X.Y}` 中。(事實上這個特定的路徑也是" "「後備 (fallback)」位置,當在 :envvar:`PATH` 中找不到名為 :file:`python` 的可" -"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行為 :envvar:" -"`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入額外的目" -"錄。" +"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行" +"為 :envvar:`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入" +"額外的目錄。" #: ../../c-api/intro.rst:778 #, fuzzy msgid "" -"The embedding application can steer the search by setting :c:member:" -"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " -"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " -"is still inserted in front of the standard path. An application that " -"requires total control has to provide its own implementation of :c:func:" -"`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" -"func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." +"The embedding application can steer the search by " +"setting :c:member:`PyConfig.program_name` *before* " +"calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` " +"still overrides this and :envvar:`PYTHONPATH` is still inserted in front of " +"the standard path. An application that requires total control has to " +"provide its own implementation " +"of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, " +"and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/" +"getpath.c`)." msgstr "" "嵌入的應用程式可以透過在呼叫 :c:func:`Py_Initialize` *之前*\\ 呼叫 " -"``Py_SetProgramName(file)`` 來引導搜索。請注意 :envvar:`PYTHONHOME` 仍然覆蓋" +"``Py_SetProgramName(file)`` 來引導搜尋。請注意 :envvar:`PYTHONHOME` 仍然覆蓋" "它並且 :envvar:`PYTHONPATH` 仍然插入在標準路徑的前面。需要完全控制權的應用程" -"式必須實作自己的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:" -"`Py_GetExecPrefix` 和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:" -"`Modules/getpath.c`)。" +"式必須實作自己" +"的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix` " +"和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:`Modules/getpath.c`)。" #: ../../c-api/intro.rst:789 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " -"application may want to start over (make another call to :c:func:" -"`Py_Initialize`) or the application is simply done with its use of Python " -"and wants to free memory allocated by Python. This can be accomplished by " -"calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` " -"returns true if Python is currently in the initialized state. More " -"information about these functions is given in a later chapter. Notice that :" -"c:func:`Py_FinalizeEx` does *not* free all memory allocated by the Python " -"interpreter, e.g. memory allocated by extension modules currently cannot be " -"released." +"application may want to start over (make another call " +"to :c:func:`Py_Initialize`) or the application is simply done with its use " +"of Python and wants to free memory allocated by Python. This can be " +"accomplished by calling :c:func:`Py_FinalizeEx`. The " +"function :c:func:`Py_IsInitialized` returns true if Python is currently in " +"the initialized state. More information about these functions is given in a " +"later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all " +"memory allocated by the Python interpreter, e.g. memory allocated by " +"extension modules currently cannot be released." msgstr "" "有時會希望能夠「取消初始化 (uninitialize)」Python。例如,應用程式可能想要重新" "開始(再次呼叫 :c:func:`Py_Initialize`)或者應用程式簡單地完成了對 Python 的" "使用並想要釋放 Python 分配的記憶體。這可以透過呼叫 :c:func:`Py_FinalizeEx` 來" -"完成。如果 Python 當前處於初始化狀態,函式 :c:func:`Py_IsInitialized` 會回傳 " -"true。有關這些功能的更多資訊將在後面的章節中給出。請注意 :c:func:" -"`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例如目前無法釋" -"放被擴充模組所分配的記憶體。" +"完成。如果 Python 目前處於初始化狀態,函式 :c:func:`Py_IsInitialized` 會回傳 " +"true。有關這些功能的更多資訊將在後面的章節中給出。請注" +"意 :c:func:`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例" +"如目前無法釋放被擴充模組所分配的記憶體。" #: ../../c-api/intro.rst:803 msgid "Debugging Builds" @@ -1265,11 +1272,11 @@ msgstr "" #: ../../c-api/intro.rst:809 msgid "" -"A full list of the various types of debugging builds is in the file :file:" -"`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " -"available that support tracing of reference counts, debugging the memory " -"allocator, or low-level profiling of the main interpreter loop. Only the " -"most frequently used builds will be described in the remainder of this " +"A full list of the various types of debugging builds is in the " +"file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. " +"Builds are available that support tracing of reference counts, debugging the " +"memory allocator, or low-level profiling of the main interpreter loop. Only " +"the most frequently used builds will be described in the remainder of this " "section." msgstr "" "Python 原始碼發佈版本中的 :file:`Misc/SpecialBuilds.txt` 檔案有一份包含多種除" @@ -1280,17 +1287,17 @@ msgstr "" msgid "" "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python `. :c:macro:`!Py_DEBUG` is enabled in the Unix build by adding :option:" -"`--with-pydebug` to the :file:`./configure` command. It is also implied by " -"the presence of the not-Python-specific :c:macro:`!_DEBUG` macro. When :c:" -"macro:`!Py_DEBUG` is enabled in the Unix build, compiler optimization is " -"disabled." +"build>`. :c:macro:`!Py_DEBUG` is enabled in the Unix build by " +"adding :option:`--with-pydebug` to the :file:`./configure` command. It is " +"also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` " +"macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler " +"optimization is disabled." msgstr "" "使用定義的 :c:macro:`!Py_DEBUG` 巨集編譯直譯器會生成 :ref:`Python 的除錯建置 " "`。 :c:macro:`!Py_DEBUG` 在 Unix 建置中要透過在 :file:`./" -"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定的 :c:" -"macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 Unix 建" -"置中啟用時,編譯器最佳化會被禁用。" +"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定" +"的 :c:macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 " +"Unix 建置中啟用時,編譯器最佳化會被禁用。" #: ../../c-api/intro.rst:825 msgid "" @@ -1302,26 +1309,26 @@ msgstr "" #: ../../c-api/intro.rst:828 msgid "" -"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" -"`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " -"circular doubly linked list of active objects is maintained by adding two " -"extra fields to every :c:type:`PyObject`. Total allocations are tracked as " -"well. Upon exit, all existing references are printed. (In interactive mode " -"this happens after every statement run by the interpreter.)" +"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see " +"the :option:`configure --with-trace-refs option <--with-trace-refs>`). When " +"defined, a circular doubly linked list of active objects is maintained by " +"adding two extra fields to every :c:type:`PyObject`. Total allocations are " +"tracked as well. Upon exit, all existing references are printed. (In " +"interactive mode this happens after every statement run by the interpreter.)" msgstr "" -"定義 :c:macro:`Py_TRACE_REFS` 來啟用參照追蹤(參見\\ :option:`調用 --with-" -"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每個 :c:type:" -"`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular doubly " -"linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模式下," -"這發生在直譯器運行的每個陳述句之後。)" +"定義 :c:macro:`Py_TRACE_REFS` 來啟用參照追蹤(參見\\ :option:`設定 --with-" +"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每" +"個 :c:type:`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular " +"doubly linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模" +"式下,這發生在直譯器運行的每個陳述句之後。)" #: ../../c-api/intro.rst:835 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." msgstr "" -"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/SpecialBuilds." -"txt`。" +"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/" +"SpecialBuilds.txt`。" #: ../../c-api/intro.rst:288 msgid "object" diff --git a/c-api/list.po b/c-api/list.po index 8627316f79..5b7fb4a6e1 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -33,8 +33,8 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python list type. " "This is the same object as :class:`list` in the Python layer." msgstr "" -"此 :c:type:`PyTypeObject` 實例表示 Python 的 list 型別。這與 Python 層中的 :" -"class:`list` 是同一個物件。" +"此 :c:type:`PyTypeObject` 實例表示 Python 的 list 型別。這與 Python 層中" +"的 :class:`list` 是同一個物件。" #: ../../c-api/list.rst:24 msgid "" @@ -57,20 +57,20 @@ msgid "Return a new list of length *len* on success, or ``NULL`` on failure." msgstr "成功時回傳長度為 *len* 的新串列,失敗時回傳 ``NULL``。" #: ../../c-api/list.rst:40 -#, fuzzy msgid "" "If *len* is greater than zero, the returned list object's items are set to " -"``NULL``. Thus you cannot use abstract API functions such as :c:func:" -"`PySequence_SetItem` or expose the object to Python code before setting all " -"items to a real object with :c:func:`PyList_SetItem` or :c:func:" -"`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is " -"fully initialized: :c:func:`PyList_SetItem()` and :c:func:" -"`PyList_SET_ITEM()`." +"``NULL``. Thus you cannot use abstract API functions such " +"as :c:func:`PySequence_SetItem` or expose the object to Python code before " +"setting all items to a real object with :c:func:`PyList_SetItem` " +"or :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before the " +"list is fully initialized: :c:func:`PyList_SetItem()` " +"and :c:func:`PyList_SET_ITEM()`." msgstr "" -"如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使用 :" -"c:func:`PyList_SetItem` 來將所有項目設定為一個真實物件前,你無法使用像是 :c:" -"func:`PySequence_SetItem` 的使用抽象 API 函式,也不能將物件暴露 (expose) 給 " -"Python 程式碼。" +"如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使" +"用 :c:func:`PyList_SetItem` 或 :c:func:`PyList_SET_ITEM()` 來將所有項目設定為" +"一個真實物件前,你無法使用像是 :c:func:`PySequence_SetItem` 的抽象 API 函式," +"也不能將物件暴露 (expose) 給 Python 程式碼。以下 API 在串列完全初始化之前是安" +"全的::c:func:`PyList_SetItem()` 和 :c:func:`PyList_SET_ITEM()`。" #: ../../c-api/list.rst:53 msgid "" @@ -83,7 +83,6 @@ msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr "與 :c:func:`PyList_Size` 類似,但沒有錯誤檢查。" #: ../../c-api/list.rst:64 -#, fuzzy msgid "" "Return the object at position *index* in the list pointed to by *list*. The " "position must be non-negative; indexing from the end of the list is not " @@ -91,8 +90,8 @@ msgid "" "``NULL`` and set an :exc:`IndexError` exception." msgstr "" "回傳 *list* 指向的串列中位於 *index* 位置的物件。該位置不可為負數;並不支援從" -"串列尾末開始索引。如果 *index* 超出邊界範圍(<0 或 >=len(list))則回傳 " -"``NULL`` 並設定 :exc:`IndexError` 例外。" +"串列尾末開始索引。如果 *index* 超出邊界範圍 (:code:`<0 or >=len(list)`) 則回" +"傳 ``NULL`` 並設定 :exc:`IndexError` 例外。" #: ../../c-api/list.rst:74 msgid "" @@ -130,15 +129,17 @@ msgstr "" #: ../../c-api/list.rst:100 msgid "" -"Bounds checking is performed as an assertion if Python is built in :ref:" -"`debug mode ` or :option:`with assertions <--with-assertions>`." +"Bounds checking is performed as an assertion if Python is built " +"in :ref:`debug mode ` or :option:`with assertions <--with-" +"assertions>`." msgstr "" #: ../../c-api/list.rst:106 msgid "" -"This macro \"steals\" a reference to *item*, and, unlike :c:func:" -"`PyList_SetItem`, does *not* discard a reference to any item that is being " -"replaced; any reference in *list* at position *i* will be leaked." +"This macro \"steals\" a reference to *item*, and, " +"unlike :c:func:`PyList_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in *list* at position *i* will be " +"leaked." msgstr "" "該巨集「竊取」對 *item* 的參照,並且與 :c:func:`PyList_SetItem` 不同的是,它" "\\ *不會*\\ 丟棄對任意被替換項目的參照;*list* 中位置 *i* 的任何參照都將被洩" @@ -226,8 +227,8 @@ msgid "" "Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is the equivalent of ``list.reverse()``." msgstr "" -"原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 ``list." -"reverse()``。" +"原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 " +"``list.reverse()``。" #: ../../c-api/list.rst:182 msgid "" diff --git a/c-api/long.po b/c-api/long.po index db11da07a8..0df0341414 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -640,11 +640,11 @@ msgstr "object(物件)" #: ../../c-api/long.rst:8 msgid "long integer" -msgstr "long integer(長整数)" +msgstr "long integer(長整數)" #: ../../c-api/long.rst:8 msgid "integer" -msgstr "integer(整数)" +msgstr "integer(整數)" #: ../../c-api/long.rst:144 msgid "LONG_MAX (C macro)" @@ -653,7 +653,7 @@ msgstr "LONG_MAX(C 巨集)" #: ../../c-api/long.rst:144 ../../c-api/long.rst:204 ../../c-api/long.rst:247 #: ../../c-api/long.rst:262 ../../c-api/long.rst:278 ../../c-api/long.rst:294 msgid "OverflowError (built-in exception)" -msgstr "OverflowError(内建例外)" +msgstr "OverflowError(內建例外)" #: ../../c-api/long.rst:247 msgid "PY_SSIZE_T_MAX (C macro)" diff --git a/c-api/module.po b/c-api/module.po index bfd8be22ed..8df6ee5240 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,17 +36,18 @@ msgstr "" #: ../../c-api/module.rst:27 msgid "" -"Return true if *p* is a module object, but not a subtype of :c:data:" -"`PyModule_Type`. This function always succeeds." +"Return true if *p* is a module object, but not a subtype " +"of :c:data:`PyModule_Type`. This function always succeeds." msgstr "" #: ../../c-api/module.rst:40 msgid "" "Return a new module object with :attr:`module.__name__` set to *name*. The " -"module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." -"__package__` and :attr:`~module.__loader__` attributes are filled in (all " -"but :attr:`!__name__` are set to ``None``). The caller is responsible for " -"setting a :attr:`~module.__file__` attribute." +"module's :attr:`!" +"__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes are filled in (all but :attr:`!" +"__name__` are set to ``None``). The caller is responsible for setting " +"a :attr:`~module.__file__` attribute." msgstr "" #: ../../c-api/module.rst:46 ../../c-api/module.rst:272 @@ -79,8 +80,8 @@ msgstr "" #: ../../c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " -"functions rather than directly manipulate a module's :attr:`~object." -"__dict__`." +"functions rather than directly manipulate a " +"module's :attr:`~object.__dict__`." msgstr "" #: ../../c-api/module.rst:81 @@ -99,8 +100,8 @@ msgstr "" #: ../../c-api/module.rst:95 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " -"memory allocated at module creation time, or ``NULL``. See :c:member:" -"`PyModuleDef.m_size`." +"memory allocated at module creation time, or ``NULL``. " +"See :c:member:`PyModuleDef.m_size`." msgstr "" #: ../../c-api/module.rst:102 @@ -111,10 +112,10 @@ msgstr "" #: ../../c-api/module.rst:112 msgid "" -"Return the name of the file from which *module* was loaded using *module*'s :" -"attr:`~module.__file__` attribute. If this is not defined, or if it is not " -"a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " -"reference to a Unicode object." +"Return the name of the file from which *module* was loaded using " +"*module*'s :attr:`~module.__file__` attribute. If this is not defined, or " +"if it is not a string, raise :exc:`SystemError` and return ``NULL``; " +"otherwise return a reference to a Unicode object." msgstr "" #: ../../c-api/module.rst:122 @@ -143,9 +144,10 @@ msgstr "" #: ../../c-api/module.rst:140 msgid "" -"The initialization function can either pass a module definition instance to :" -"c:func:`PyModule_Create`, and return the resulting module object, or request " -"\"multi-phase initialization\" by returning the definition struct itself." +"The initialization function can either pass a module definition instance " +"to :c:func:`PyModule_Create`, and return the resulting module object, or " +"request \"multi-phase initialization\" by returning the definition struct " +"itself." msgstr "" #: ../../c-api/module.rst:146 @@ -165,8 +167,8 @@ msgstr "" #: ../../c-api/module.rst:160 msgid "" -"Docstring for the module; usually a docstring variable created with :c:macro:" -"`PyDoc_STRVAR` is used." +"Docstring for the module; usually a docstring variable created " +"with :c:macro:`PyDoc_STRVAR` is used." msgstr "" #: ../../c-api/module.rst:165 @@ -179,8 +181,8 @@ msgstr "" #: ../../c-api/module.rst:169 msgid "" "This memory area is allocated based on *m_size* on module creation, and " -"freed when the module object is deallocated, after the :c:member:" -"`~PyModuleDef.m_free` function has been called, if present." +"freed when the module object is deallocated, after " +"the :c:member:`~PyModuleDef.m_free` function has been called, if present." msgstr "" #: ../../c-api/module.rst:173 @@ -203,8 +205,9 @@ msgstr "更多詳情請見 :pep:`3121`。" #: ../../c-api/module.rst:185 msgid "" -"A pointer to a table of module-level functions, described by :c:type:" -"`PyMethodDef` values. Can be ``NULL`` if no functions are present." +"A pointer to a table of module-level functions, described " +"by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are " +"present." msgstr "" #: ../../c-api/module.rst:190 @@ -233,8 +236,8 @@ msgid "" "allocated yet. This is the case immediately after the module is created and " "before the module is executed (:c:data:`Py_mod_exec` function). More " "precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is " -"greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"greater than 0 and the module state (as returned " +"by :c:func:`PyModule_GetState`) is ``NULL``." msgstr "" #: ../../c-api/module.rst:213 ../../c-api/module.rst:234 @@ -277,8 +280,8 @@ msgstr "" #: ../../c-api/module.rst:261 msgid "" "Create a new module object, given the definition in *def*. This behaves " -"like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" -"`PYTHON_API_VERSION`." +"like :c:func:`PyModule_Create2` with *module_api_version* set " +"to :c:macro:`PYTHON_API_VERSION`." msgstr "" #: ../../c-api/module.rst:268 @@ -297,8 +300,8 @@ msgstr "" #: ../../c-api/module.rst:279 msgid "" "Before it is returned from in the initialization function, the resulting " -"module object is typically populated using functions like :c:func:" -"`PyModule_AddObjectRef`." +"module object is typically populated using functions " +"like :c:func:`PyModule_AddObjectRef`." msgstr "" #: ../../c-api/module.rst:285 @@ -323,9 +326,10 @@ msgid "" "normal garbage collection -- as with Python modules. By default, multiple " "modules created from the same definition should be independent: changes to " "one should not affect the others. This means that all state should be " -"specific to the module object (using e.g. using :c:func:" -"`PyModule_GetState`), or its contents (such as the module's :attr:`~object." -"__dict__` or individual classes created with :c:func:`PyType_FromSpec`)." +"specific to the module object (using e.g. " +"using :c:func:`PyModule_GetState`), or its contents (such as the " +"module's :attr:`~object.__dict__` or individual classes created " +"with :c:func:`PyType_FromSpec`)." msgstr "" #: ../../c-api/module.rst:304 @@ -338,9 +342,9 @@ msgstr "" #: ../../c-api/module.rst:308 msgid "" "To request multi-phase initialization, the initialization function " -"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" -"c:member:`~PyModuleDef.m_slots`. Before it is returned, the ``PyModuleDef`` " -"instance must be initialized with the following function:" +"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-" +"empty :c:member:`~PyModuleDef.m_slots`. Before it is returned, the " +"``PyModuleDef`` instance must be initialized with the following function:" msgstr "" #: ../../c-api/module.rst:315 @@ -412,12 +416,12 @@ msgstr "" #: ../../c-api/module.rst:368 msgid "" -"There is no requirement for the returned object to be an instance of :c:type:" -"`PyModule_Type`. Any type can be used, as long as it supports setting and " -"getting import-related attributes. However, only ``PyModule_Type`` instances " -"may be returned if the ``PyModuleDef`` has non-``NULL`` ``m_traverse``, " -"``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than " -"``Py_mod_create``." +"There is no requirement for the returned object to be an instance " +"of :c:type:`PyModule_Type`. Any type can be used, as long as it supports " +"setting and getting import-related attributes. However, only " +"``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-" +"``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or " +"slots other than ``Py_mod_create``." msgstr "" #: ../../c-api/module.rst:377 @@ -469,7 +473,7 @@ msgstr "" #: ../../c-api/module.rst:417 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " -"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." +"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" #: ../../c-api/module.rst:430 @@ -584,18 +588,12 @@ msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:526 -msgid "" -"Return ``-1`` if *value* is ``NULL``. It must be called with an exception " -"raised in this case." -msgstr "" - -#: ../../c-api/module.rst:529 ../../c-api/module.rst:576 -#: ../../c-api/module.rst:603 +#: ../../c-api/module.rst:526 ../../c-api/module.rst:577 +#: ../../c-api/module.rst:604 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:531 +#: ../../c-api/module.rst:528 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -621,13 +619,20 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:543 +#: ../../c-api/module.rst:540 +msgid "" +"To be convenient, the function accepts ``NULL`` *value* with an exception " +"set. In this case, return ``-1`` and just leave the raised exception " +"unchanged." +msgstr "" + +#: ../../c-api/module.rst:544 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:546 +#: ../../c-api/module.rst:547 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -647,23 +652,23 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:555 +#: ../../c-api/module.rst:556 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:558 +#: ../../c-api/module.rst:559 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " -"For names that aren't known at compile time, prefer calling :c:func:" -"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " -"details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." +"For names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" -#: ../../c-api/module.rst:571 +#: ../../c-api/module.rst:572 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -671,39 +676,39 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:578 +#: ../../c-api/module.rst:579 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" -#: ../../c-api/module.rst:587 +#: ../../c-api/module.rst:588 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:590 +#: ../../c-api/module.rst:591 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:597 +#: ../../c-api/module.rst:598 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:600 +#: ../../c-api/module.rst:601 msgid "" -"This means that its return value must be checked, and calling code must :c:" -"func:`Py_XDECREF` *value* manually on error." +"This means that its return value must be checked, and calling code " +"must :c:func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:605 +#: ../../c-api/module.rst:606 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -717,24 +722,24 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:618 +#: ../../c-api/module.rst:619 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:623 +#: ../../c-api/module.rst:624 msgid "" "Add an integer constant to *module* as *name*. This convenience function " "can be used from the module's initialization function. Return ``-1`` with an " "exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:627 +#: ../../c-api/module.rst:628 msgid "" -"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" -"func:`PyModule_AddObjectRef`; see their documentation for details." +"This is a convenience function that calls :c:func:`PyLong_FromLong` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: ../../c-api/module.rst:633 +#: ../../c-api/module.rst:634 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " @@ -742,14 +747,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:638 +#: ../../c-api/module.rst:639 msgid "" -"This is a convenience function that calls :c:func:" -"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " -"documentation for details." +"This is a convenience function that " +"calls :c:func:`PyUnicode_InternFromString` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: ../../c-api/module.rst:645 +#: ../../c-api/module.rst:646 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " @@ -757,11 +762,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:653 +#: ../../c-api/module.rst:654 msgid "Add a string constant to *module*." -msgstr "" +msgstr "將字串常數加入到 *module* 中。" -#: ../../c-api/module.rst:657 +#: ../../c-api/module.rst:658 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " @@ -769,7 +774,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:667 +#: ../../c-api/module.rst:668 msgid "" "Indicate that *module* does or does not support running without the global " "interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " @@ -780,25 +785,25 @@ msgid "" "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:680 +#: ../../c-api/module.rst:681 msgid "Module lookup" msgstr "模組查找" -#: ../../c-api/module.rst:682 +#: ../../c-api/module.rst:683 msgid "" "Single-phase initialization creates singleton modules that can be looked up " "in the context of the current interpreter. This allows the module object to " "be retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:686 +#: ../../c-api/module.rst:687 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:691 +#: ../../c-api/module.rst:692 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -807,18 +812,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:698 +#: ../../c-api/module.rst:699 msgid "" "Attaches the module object passed to the function to the interpreter state. " -"This allows the module object to be accessible via :c:func:" -"`PyState_FindModule`." +"This allows the module object to be accessible " +"via :c:func:`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:701 +#: ../../c-api/module.rst:702 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:703 +#: ../../c-api/module.rst:704 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module, " "so it is unnecessary (but harmless) to call it from module initialization " @@ -829,15 +834,15 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:711 ../../c-api/module.rst:722 +#: ../../c-api/module.rst:712 ../../c-api/module.rst:723 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/module.rst:713 +#: ../../c-api/module.rst:714 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:719 +#: ../../c-api/module.rst:720 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." diff --git a/c-api/monitoring.po b/c-api/monitoring.po index 67816dfd7a..ac7e58b853 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -282,3 +282,13 @@ msgstr ":monitoring-event:`STOP_ITERATION`" msgid "" "Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." msgstr "" + +#: ../../c-api/monitoring.rst:197 +msgid "" +"Return true if the event corresponding to the event ID *ev* is a :ref:`local " +"event `." +msgstr "" + +#: ../../c-api/monitoring.rst:204 +msgid "This function is :term:`soft deprecated`." +msgstr "" diff --git a/c-api/none.po b/c-api/none.po index eb714cd111..2a360b0167 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -38,9 +38,8 @@ msgid "" msgstr "" #: ../../c-api/none.rst:21 -#, fuzzy msgid ":c:data:`Py_None` is :term:`immortal`." -msgstr ":c:data:`Py_None` 為不滅的 (immortal)。" +msgstr ":c:data:`Py_None` 為\\ :term:`不滅的 (immortal) `。" #: ../../c-api/none.rst:26 msgid "Return :c:data:`Py_None` from a function." diff --git a/c-api/object.po b/c-api/object.po index d557e3d5c6..85e8adfd09 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-05 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,23 +28,23 @@ msgstr "" #: ../../c-api/object.rst:13 msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." -msgstr "" +msgstr "如果 *constant_id* 無效,則設定一個例外並回傳 ``NULL``。" #: ../../c-api/object.rst:15 msgid "*constant_id* must be one of these constant identifiers:" -msgstr "" +msgstr "*constant_id* 必須是這些常數識別字之一:" #: ../../c-api/object.rst:20 msgid "Constant Identifier" -msgstr "" +msgstr "常數識別字" #: ../../c-api/object.rst:20 msgid "Value" -msgstr "" +msgstr "數值" #: ../../c-api/object.rst:20 msgid "Returned object" -msgstr "" +msgstr "回傳物件" #: ../../c-api/object.rst:22 ../../c-api/object.rst:27 msgid "``0``" @@ -126,7 +126,7 @@ msgstr "" #: ../../c-api/object.rst:42 msgid "In CPython, all of these constants are :term:`immortal`." -msgstr "" +msgstr "在 CPython 中,所有這些常數都是\\ :term:`不滅 `\\ 的。" #: ../../c-api/object.rst:47 msgid "" @@ -135,8 +135,8 @@ msgstr "" #: ../../c-api/object.rst:50 msgid "" -"This function is primarily intended for backwards compatibility: using :c:" -"func:`Py_GetConstant` is recommended for new code." +"This function is primarily intended for backwards compatibility: " +"using :c:func:`Py_GetConstant` is recommended for new code." msgstr "" #: ../../c-api/object.rst:53 @@ -154,15 +154,16 @@ msgstr "" #: ../../c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " -"function (that is, create a new :term:`strong reference` to :const:" -"`NotImplemented` and return it)." +"function (that is, create a new :term:`strong reference` " +"to :const:`NotImplemented` and return it)." msgstr "" #: ../../c-api/object.rst:74 msgid "" -"Flag to be used with multiple functions that print the object (like :c:func:" -"`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " -"function would use the :func:`str` of the object instead of the :func:`repr`." +"Flag to be used with multiple functions that print the object " +"(like :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, " +"these function would use the :func:`str` of the object instead of " +"the :func:`repr`." msgstr "" #: ../../c-api/object.rst:82 @@ -195,124 +196,128 @@ msgstr "" #: ../../c-api/object.rst:113 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods are silently ignored. For proper error " -"handling, use :c:func:`PyObject_HasAttrWithError`, :c:func:" -"`PyObject_GetOptionalAttr` or :c:func:`PyObject_GetAttr` instead." +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods aren't propagated, but instead " +"given to :func:`sys.unraisablehook`. For proper error handling, " +"use :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` " +"or :c:func:`PyObject_GetAttr` instead." msgstr "" -#: ../../c-api/object.rst:121 +#: ../../c-api/object.rst:122 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/object.rst:127 +#: ../../c-api/object.rst:128 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods or while creating the temporary :class:" -"`str` object are silently ignored. For proper error handling, use :c:func:" -"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods or while creating the " +"temporary :class:`str` object are silently ignored. For proper error " +"handling, " +"use :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " "or :c:func:`PyObject_GetAttrString` instead." msgstr "" -#: ../../c-api/object.rst:137 +#: ../../c-api/object.rst:138 msgid "" "Retrieve an attribute named *attr_name* from object *o*. Returns the " "attribute value on success, or ``NULL`` on failure. This is the equivalent " "of the Python expression ``o.attr_name``." msgstr "" -#: ../../c-api/object.rst:141 +#: ../../c-api/object.rst:142 msgid "" -"If the missing attribute should not be treated as a failure, you can use :c:" -"func:`PyObject_GetOptionalAttr` instead." +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttr` instead." msgstr "" -#: ../../c-api/object.rst:147 +#: ../../c-api/object.rst:148 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/object.rst:151 +#: ../../c-api/object.rst:152 msgid "" -"If the missing attribute should not be treated as a failure, you can use :c:" -"func:`PyObject_GetOptionalAttrString` instead." +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttrString` instead." msgstr "" -#: ../../c-api/object.rst:157 +#: ../../c-api/object.rst:158 msgid "" -"Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" -"`AttributeError` if the attribute is not found." +"Variant of :c:func:`PyObject_GetAttr` which doesn't " +"raise :exc:`AttributeError` if the attribute is not found." msgstr "" -#: ../../c-api/object.rst:160 +#: ../../c-api/object.rst:161 msgid "" -"If the attribute is found, return ``1`` and set *\\*result* to a new :term:" -"`strong reference` to the attribute. If the attribute is not found, return " -"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " -"silenced. If an error other than :exc:`AttributeError` is raised, return " -"``-1`` and set *\\*result* to ``NULL``." +"If the attribute is found, return ``1`` and set *\\*result* to a " +"new :term:`strong reference` to the attribute. If the attribute is not " +"found, return ``0`` and set *\\*result* to ``NULL``; " +"the :exc:`AttributeError` is silenced. If an error other " +"than :exc:`AttributeError` is raised, return ``-1`` and set *\\*result* to " +"``NULL``." msgstr "" -#: ../../c-api/object.rst:172 +#: ../../c-api/object.rst:173 msgid "" "This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/object.rst:180 +#: ../../c-api/object.rst:181 msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " -"of classes in the object's MRO as well as an attribute in the object's :attr:" -"`~object.__dict__` (if present). As outlined in :ref:`descriptors`, data " -"descriptors take preference over instance attributes, while non-data " -"descriptors don't. Otherwise, an :exc:`AttributeError` is raised." +"of classes in the object's MRO as well as an attribute in the " +"object's :attr:`~object.__dict__` (if present). As outlined " +"in :ref:`descriptors`, data descriptors take preference over instance " +"attributes, while non-data descriptors don't. Otherwise, " +"an :exc:`AttributeError` is raised." msgstr "" -#: ../../c-api/object.rst:190 +#: ../../c-api/object.rst:191 msgid "" "Set the value of the attribute named *attr_name*, for object *o*, to the " "value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on " "success. This is the equivalent of the Python statement ``o.attr_name = v``." msgstr "" -#: ../../c-api/object.rst:195 +#: ../../c-api/object.rst:196 msgid "" "If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated " "in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " "plans to remove it." msgstr "" -#: ../../c-api/object.rst:202 +#: ../../c-api/object.rst:203 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/object.rst:206 +#: ../../c-api/object.rst:207 msgid "" "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " "in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -#: ../../c-api/object.rst:209 +#: ../../c-api/object.rst:210 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" -#: ../../c-api/object.rst:219 +#: ../../c-api/object.rst:220 msgid "" "Generic attribute setter and deleter function that is meant to be put into a " "type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a " @@ -324,36 +329,36 @@ msgid "" "returned." msgstr "" -#: ../../c-api/object.rst:231 +#: ../../c-api/object.rst:232 msgid "" "Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on " "failure. This is the equivalent of the Python statement ``del o.attr_name``." msgstr "" -#: ../../c-api/object.rst:237 +#: ../../c-api/object.rst:238 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/object.rst:241 +#: ../../c-api/object.rst:242 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object for lookup." +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object for lookup." msgstr "" -#: ../../c-api/object.rst:252 +#: ../../c-api/object.rst:253 msgid "" "A generic implementation for the getter of a ``__dict__`` descriptor. It " "creates the dictionary if necessary." msgstr "" -#: ../../c-api/object.rst:255 +#: ../../c-api/object.rst:256 msgid "" "This function may also be called to get the :py:attr:`~object.__dict__` of " "the object *o*. Pass ``NULL`` for *context* when calling it. Since this " @@ -362,67 +367,67 @@ msgid "" "the object." msgstr "" -#: ../../c-api/object.rst:261 +#: ../../c-api/object.rst:262 msgid "On failure, returns ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/object.rst:268 +#: ../../c-api/object.rst:269 msgid "" "A generic implementation for the setter of a ``__dict__`` descriptor. This " "implementation does not allow the dictionary to be deleted." msgstr "" -#: ../../c-api/object.rst:276 +#: ../../c-api/object.rst:277 msgid "" "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " "there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" -#: ../../c-api/object.rst:279 +#: ../../c-api/object.rst:280 msgid "" "This function may need to allocate memory for the dictionary, so it may be " "more efficient to call :c:func:`PyObject_GetAttr` when accessing an " "attribute on the object." msgstr "" -#: ../../c-api/object.rst:286 +#: ../../c-api/object.rst:287 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " -"which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" -"c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to " -"``<``, ``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the " -"equivalent of the Python expression ``o1 op o2``, where ``op`` is the " -"operator corresponding to *opid*. Returns the value of the comparison on " -"success, or ``NULL`` on failure." +"which must be one " +"of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_GT`, " +"or :c:macro:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, " +"or ``>=`` respectively. This is the equivalent of the Python expression ``o1 " +"op o2``, where ``op`` is the operator corresponding to *opid*. Returns the " +"value of the comparison on success, or ``NULL`` on failure." msgstr "" -#: ../../c-api/object.rst:296 +#: ../../c-api/object.rst:297 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if " "the result is false, ``1`` otherwise." msgstr "" -#: ../../c-api/object.rst:301 +#: ../../c-api/object.rst:302 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." msgstr "" -#: ../../c-api/object.rst:306 +#: ../../c-api/object.rst:307 msgid "" "Format *obj* using *format_spec*. This is equivalent to the Python " "expression ``format(obj, format_spec)``." msgstr "" -#: ../../c-api/object.rst:309 +#: ../../c-api/object.rst:310 msgid "" "*format_spec* may be ``NULL``. In this case the call is equivalent to " "``format(obj)``. Returns the formatted string on success, ``NULL`` on " "failure." msgstr "" -#: ../../c-api/object.rst:317 +#: ../../c-api/object.rst:318 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -430,22 +435,22 @@ msgid "" "function." msgstr "" -#: ../../c-api/object.rst:321 ../../c-api/object.rst:345 +#: ../../c-api/object.rst:322 ../../c-api/object.rst:346 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/object.rst:329 +#: ../../c-api/object.rst:330 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " -"but escape the non-ASCII characters in the string returned by :c:func:" -"`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This generates a " -"string similar to that returned by :c:func:`PyObject_Repr` in Python 2. " -"Called by the :func:`ascii` built-in function." +"but escape the non-ASCII characters in the string returned " +"by :c:func:`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This " +"generates a string similar to that returned by :c:func:`PyObject_Repr` in " +"Python 2. Called by the :func:`ascii` built-in function." msgstr "" -#: ../../c-api/object.rst:340 +#: ../../c-api/object.rst:341 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -453,7 +458,7 @@ msgid "" "function and, therefore, by the :func:`print` function." msgstr "" -#: ../../c-api/object.rst:354 +#: ../../c-api/object.rst:355 msgid "" "Compute a bytes representation of object *o*. ``NULL`` is returned on " "failure and a bytes object on success. This is equivalent to the Python " @@ -462,73 +467,73 @@ msgid "" "bytes object." msgstr "" -#: ../../c-api/object.rst:363 +#: ../../c-api/object.rst:364 msgid "" "Return ``1`` if the class *derived* is identical to or derived from the " "class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -#: ../../c-api/object.rst:366 ../../c-api/object.rst:385 +#: ../../c-api/object.rst:367 ../../c-api/object.rst:386 msgid "" "If *cls* is a tuple, the check will be done against every entry in *cls*. " "The result will be ``1`` when at least one of the checks returns ``1``, " "otherwise it will be ``0``." msgstr "" -#: ../../c-api/object.rst:370 +#: ../../c-api/object.rst:371 msgid "" "If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " -"*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in :attr:`cls.__mro__ `." +"*derived* is a subclass of *cls* if it is a direct or indirect subclass, " +"i.e. contained in :attr:`cls.__mro__ `." msgstr "" -#: ../../c-api/object.rst:375 +#: ../../c-api/object.rst:376 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " "a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:382 +#: ../../c-api/object.rst:383 msgid "" "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " "*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -#: ../../c-api/object.rst:389 +#: ../../c-api/object.rst:390 msgid "" "If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" -#: ../../c-api/object.rst:393 +#: ../../c-api/object.rst:394 msgid "" -"An instance *inst* can override what is considered its class by having a :" -"attr:`~object.__class__` attribute." +"An instance *inst* can override what is considered its class by having " +"a :attr:`~object.__class__` attribute." msgstr "" -#: ../../c-api/object.rst:396 +#: ../../c-api/object.rst:397 msgid "" "An object *cls* can override if it is considered a class, and what its base " "classes are, by having a :attr:`~type.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:405 +#: ../../c-api/object.rst:406 msgid "" "Compute and return the hash value of an object *o*. On failure, return " "``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -#: ../../c-api/object.rst:408 +#: ../../c-api/object.rst:409 msgid "" "The return type is now Py_hash_t. This is a signed integer the same size " "as :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/object.rst:415 +#: ../../c-api/object.rst:416 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " "and return ``-1``. This function receives special treatment when stored in a " @@ -536,21 +541,21 @@ msgid "" "that it is not hashable." msgstr "" -#: ../../c-api/object.rst:423 +#: ../../c-api/object.rst:424 msgid "" "Returns ``1`` if the object *o* is considered to be true, and ``0`` " "otherwise. This is equivalent to the Python expression ``not not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:430 +#: ../../c-api/object.rst:431 msgid "" "Returns ``0`` if the object *o* is considered to be true, and ``1`` " "otherwise. This is equivalent to the Python expression ``not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:439 +#: ../../c-api/object.rst:440 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -561,13 +566,13 @@ msgid "" "when a new :term:`strong reference` is needed." msgstr "" -#: ../../c-api/object.rst:451 +#: ../../c-api/object.rst:452 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -#: ../../c-api/object.rst:460 +#: ../../c-api/object.rst:461 msgid "" "Return the length of object *o*. If the object *o* provides either the " "sequence and mapping protocols, the sequence length is returned. On error, " @@ -575,7 +580,7 @@ msgid "" "``len(o)``." msgstr "" -#: ../../c-api/object.rst:467 +#: ../../c-api/object.rst:468 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -584,36 +589,43 @@ msgid "" "defaultvalue)``." msgstr "" -#: ../../c-api/object.rst:477 +#: ../../c-api/object.rst:478 msgid "" "Return element of *o* corresponding to the object *key* or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -#: ../../c-api/object.rst:483 +#: ../../c-api/object.rst:484 msgid "" "Map the object *key* to the value *v*. Raise an exception and return ``-1`` " "on failure; return ``0`` on success. This is the equivalent of the Python " "statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -#: ../../c-api/object.rst:491 +#: ../../c-api/object.rst:492 msgid "" "Remove the mapping for the object *key* from the object *o*. Return ``-1`` " "on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -#: ../../c-api/object.rst:497 +#: ../../c-api/object.rst:498 +msgid "" +"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: ../../c-api/object.rst:505 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " "``NULL`` if there was an error. If the argument is ``NULL``, this is like " "the Python ``dir()``, returning the names of the current locals; in this " -"case, if no execution frame is active then ``NULL`` is returned but :c:func:" -"`PyErr_Occurred` will return false." +"case, if no execution frame is active then ``NULL`` is returned " +"but :c:func:`PyErr_Occurred` will return false." msgstr "" -#: ../../c-api/object.rst:506 +#: ../../c-api/object.rst:514 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -621,113 +633,122 @@ msgid "" "object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:514 +#: ../../c-api/object.rst:522 msgid "" -"This is the equivalent to the Python expression ``aiter(o)``. Takes an :" -"class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " -"This is typically a new iterator but if the argument is an :class:" -"`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and returns " -"``NULL`` if the object cannot be iterated." +"This is equivalent to the Python ``__iter__(self): return self`` method. It " +"is intended for :term:`iterator` types, to be used in " +"the :c:member:`PyTypeObject.tp_iter` slot." msgstr "" -#: ../../c-api/object.rst:524 +#: ../../c-api/object.rst:528 +msgid "" +"This is the equivalent to the Python expression ``aiter(o)``. Takes " +"an :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for " +"it. This is typically a new iterator but if the argument is " +"an :class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and " +"returns ``NULL`` if the object cannot be iterated." +msgstr "" + +#: ../../c-api/object.rst:538 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: ../../c-api/object.rst:526 +#: ../../c-api/object.rst:540 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: ../../c-api/object.rst:530 +#: ../../c-api/object.rst:544 msgid "On error, set an exception and return ``NULL``." -msgstr "" +msgstr "錯誤時設定一個例外並回傳 ``NULL``。" -#: ../../c-api/object.rst:536 +#: ../../c-api/object.rst:550 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: ../../c-api/object.rst:539 +#: ../../c-api/object.rst:553 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " -"`; it is safe to use this larger size (e.g. with :c:" -"func:`!memset`)." +"`; it is safe to use this larger size (e.g. " +"with :c:func:`!memset`)." msgstr "" -#: ../../c-api/object.rst:542 +#: ../../c-api/object.rst:556 msgid "" -"The type *cls* **must** have been created using negative :c:member:" -"`PyType_Spec.basicsize`. Python does not check this." +"The type *cls* **must** have been created using " +"negative :c:member:`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: ../../c-api/object.rst:546 +#: ../../c-api/object.rst:560 msgid "On error, set an exception and return a negative value." -msgstr "" +msgstr "錯誤時設定一個例外並回傳一個負值。" -#: ../../c-api/object.rst:552 +#: ../../c-api/object.rst:566 msgid "" -"Get a pointer to per-item data for a class with :c:macro:" -"`Py_TPFLAGS_ITEMS_AT_END`." +"Get a pointer to per-item data for a class " +"with :c:macro:`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: ../../c-api/object.rst:555 +#: ../../c-api/object.rst:569 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" +"錯誤時設定一個例外並回傳 ``NULL``。如果 *o* 沒有設" +"定 :c:macro:`Py_TPFLAGS_ITEMS_AT_END`,則會引發 :py:exc:`TypeError`。" -#: ../../c-api/object.rst:563 +#: ../../c-api/object.rst:577 msgid "Visit the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:565 ../../c-api/object.rst:574 +#: ../../c-api/object.rst:579 ../../c-api/object.rst:588 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" -#: ../../c-api/object.rst:572 +#: ../../c-api/object.rst:586 msgid "Clear the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:315 ../../c-api/object.rst:327 -#: ../../c-api/object.rst:352 ../../c-api/object.rst:403 -#: ../../c-api/object.rst:437 ../../c-api/object.rst:458 +#: ../../c-api/object.rst:316 ../../c-api/object.rst:328 +#: ../../c-api/object.rst:353 ../../c-api/object.rst:404 +#: ../../c-api/object.rst:438 ../../c-api/object.rst:459 msgid "built-in function" msgstr "bulit-in function(內建函式)" -#: ../../c-api/object.rst:315 +#: ../../c-api/object.rst:316 msgid "repr" msgstr "repr" -#: ../../c-api/object.rst:327 +#: ../../c-api/object.rst:328 msgid "ascii" msgstr "ascii" -#: ../../c-api/object.rst:335 +#: ../../c-api/object.rst:336 msgid "string" msgstr "string(字串)" -#: ../../c-api/object.rst:335 +#: ../../c-api/object.rst:336 msgid "PyObject_Str (C function)" msgstr "PyObject_Str(C 函式)" -#: ../../c-api/object.rst:352 +#: ../../c-api/object.rst:353 msgid "bytes" msgstr "bytes(位元組)" -#: ../../c-api/object.rst:403 +#: ../../c-api/object.rst:404 msgid "hash" msgstr "hash(雜湊)" -#: ../../c-api/object.rst:437 +#: ../../c-api/object.rst:438 msgid "type" msgstr "type(型別)" -#: ../../c-api/object.rst:458 +#: ../../c-api/object.rst:459 msgid "len" msgstr "len" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index 6c8314aa43..09e683c2bb 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -75,7 +75,7 @@ msgid "" "information about the cause of a failure." msgstr "" "建立/打開 perf map 檔案成功時回傳 ``0``,失敗時回傳 ``-1``,建立鎖時失敗則回" -"傳 ``-2``。檢查 ``errno`` 以獲取更多造成失敗的資訊。" +"傳 ``-2``。檢查 ``errno`` 以取得更多造成失敗的資訊。" #: ../../c-api/perfmaps.rst:35 msgid "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index d5cacea802..fa04ff0352 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -238,9 +238,9 @@ msgid "" "object in a temporary variable, update the list data structure, and then " "call :c:func:`Py_DECREF` for the temporary variable." msgstr "" -"釋放函式可以導致任意 Python 程式碼被調用(例如,當釋放具有 :meth:`~object." +"釋放函式可以導致任意 Python 程式碼被叫用(例如,當釋放具有 :meth:`~object." "__del__` 方法的類別實例時)。雖然此類程式碼中的例外不會被傳遞出來,但​​執行的程" -"式碼可以自由存取所有 Python 全域變數。這意味著在調用 :c:func:`Py_DECREF` 之" +"式碼可以自由存取所有 Python 全域變數。這意味著在叫用 :c:func:`Py_DECREF` 之" "前,可從全域變數存取的任何物件都應處於一致狀態。例如,從 list 中刪除物件的程" "式碼應將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數" "呼叫 :c:func:`Py_DECREF`。" diff --git a/c-api/sequence.po b/c-api/sequence.po index edb70e4c6f..88d5a0d4fa 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -202,7 +202,7 @@ msgstr "" #: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:123 msgid "built-in function" -msgstr "built-in function(内建函式)" +msgstr "built-in function(內建函式)" #: ../../c-api/sequence.rst:21 msgid "len" @@ -210,4 +210,4 @@ msgstr "len" #: ../../c-api/sequence.rst:123 msgid "tuple" -msgstr "tuple(元组)" +msgstr "tuple(元組)" diff --git a/c-api/slice.po b/c-api/slice.po index a2b3dbc7a7..fbac58a43a 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-18 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,8 +88,8 @@ msgstr "成功時回傳 ``0`` ,在失敗時回傳 ``-1`` 並設定例外。" #: ../../c-api/slice.rst:60 msgid "" "This function is considered not safe for resizable sequences. Its invocation " -"should be replaced by a combination of :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` where ::" +"should be replaced by a combination of :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` where ::" msgstr "" #: ../../c-api/slice.rst:64 @@ -156,14 +156,20 @@ msgstr "" #: ../../c-api/slice.rst:118 msgid "Ellipsis Object" -msgstr "" +msgstr "Ellipsis 物件" #: ../../c-api/slice.rst:123 msgid "" -"The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" -"`Py_None`, it is an :term:`immortal` singleton object." +"The type of Python :const:`Ellipsis` object. Same " +"as :class:`types.EllipsisType` in the Python layer." +msgstr "" + +#: ../../c-api/slice.rst:129 +msgid "" +"The Python ``Ellipsis`` object. This object has no methods. " +"Like :c:data:`Py_None`, it is an :term:`immortal` singleton object." msgstr "" -#: ../../c-api/slice.rst:126 +#: ../../c-api/slice.rst:132 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr ":c:data:`Py_Ellipsis` 為不滅的 (immortal)。" diff --git a/c-api/stable.po b/c-api/stable.po index 919634426e..5aa8323e0c 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-19 00:03+0000\n" +"POT-Creation-Date: 2024-12-04 00:14+0000\n" "PO-Revision-Date: 2023-01-24 21:07+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -134,13 +134,13 @@ msgstr "受限 C API" #: ../../c-api/stable.rst:67 msgid "" "Python 3.2 introduced the *Limited API*, a subset of Python's C API. " -"Extensions that only use the Limited API can be compiled once and work with " -"multiple versions of Python. Contents of the Limited API are :ref:`listed " +"Extensions that only use the Limited API can be compiled once and be loaded " +"on multiple versions of Python. Contents of the Limited API are :ref:`listed " "below `." msgstr "" "Python 3.2 引入了\\ *受限 API (Limited API)*,它是 Python C API 的一個子集。" -"僅使用受限 API 的擴充可以只編譯一次就使用於多個版本的 Python。受限 API 的內容" -"\\ :ref:`列在下方 `。" +"僅使用受限 API 的擴充可以只編譯一次就被載入於多個版本的 Python。受限 API 的內" +"容\\ :ref:`列在下方 `。" #: ../../c-api/stable.rst:74 msgid "" @@ -153,13 +153,12 @@ msgstr "" msgid "" "Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` " "corresponding to the lowest Python version your extension supports. The " -"extension will work without recompilation with all Python 3 releases from " -"the specified one onward, and can use Limited API introduced up to that " -"version." +"extension will be ABI-compatible with all Python 3 releases from the " +"specified one onward, and can use Limited API introduced up to that version." msgstr "" "將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本的 :c:" -"macro:`PY_VERSION_HEX` 值。該擴充無需重新編譯即可與從指定版本開始的所有 " -"Python 3 版本一起使用,並且可以使用過去版本有引入的受限 API。" +"macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本之 ABI " +"相容,並且可以使用過去版本有引入的受限 API。" #: ../../c-api/stable.rst:83 msgid "" @@ -186,12 +185,21 @@ msgstr "穩定 ABI" #: ../../c-api/stable.rst:96 msgid "" "To enable this, Python provides a *Stable ABI*: a set of symbols that will " -"remain compatible across Python 3.x versions." +"remain ABI-compatible across Python 3.x versions." msgstr "" "為了實現它,Python 提供了一個\\ *穩定 ABI (Stable ABI)*:一組將在各個 Python " -"3.x 版本之間保持相容的符號。" +"3.x 版本之間保持 ABI 相容的符號。" -#: ../../c-api/stable.rst:99 +#: ../../c-api/stable.rst:101 +msgid "" +"The Stable ABI prevents ABI issues, like linker errors due to missing " +"symbols or data corruption due to changes in structure layouts or function " +"signatures. However, other changes in Python can change the *behavior* of " +"extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for " +"details." +msgstr "" + +#: ../../c-api/stable.rst:107 msgid "" "The Stable ABI contains symbols exposed in the :ref:`Limited API `, but also other ones – for example, functions necessary to support " @@ -200,7 +208,7 @@ msgstr "" "穩定 ABI 被包含在\\ :ref:`受限 API ` 中開放的符號,但也包含其" "他符號 - 例如,支援舊版受限 API 所必需的函式。" -#: ../../c-api/stable.rst:103 +#: ../../c-api/stable.rst:111 msgid "" "On Windows, extensions that use the Stable ABI should be linked against " "``python3.dll`` rather than a version-specific library such as ``python39." @@ -209,7 +217,7 @@ msgstr "" "在 Windows 上,使用穩定 ABI 的擴充應該連接到 ``python3.dll`` 而不是特定版本的" "函式庫,例如 ``python39.dll``。" -#: ../../c-api/stable.rst:107 +#: ../../c-api/stable.rst:115 msgid "" "On some platforms, Python will look for and load shared library files named " "with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such " @@ -222,7 +230,7 @@ msgstr "" "用者(或者打包工具)身上,例如使用 3.10+ 受限 API 建置的擴充不會為較低版本的 " "Python 所安裝。" -#: ../../c-api/stable.rst:114 +#: ../../c-api/stable.rst:122 msgid "" "All functions in the Stable ABI are present as functions in Python's shared " "library, not solely as macros. This makes them usable from languages that " @@ -231,18 +239,18 @@ msgstr "" "穩定 ABI 中的所有函式都作為函式存在於 Python 的共享函式庫中,而不僅是作為巨" "集。這使得它們可被用於不使用 C 預處理器 (preprocessor) 的語言。" -#: ../../c-api/stable.rst:120 +#: ../../c-api/stable.rst:128 msgid "Limited API Scope and Performance" msgstr "受限 API 範圍和性能" -#: ../../c-api/stable.rst:122 +#: ../../c-api/stable.rst:130 msgid "" "The goal for the Limited API is to allow everything that is possible with " "the full C API, but possibly with a performance penalty." msgstr "" "受限 API 的目標是允許使用完整的 C API 進行所有可能的操作,但可能會降低性能。" -#: ../../c-api/stable.rst:125 +#: ../../c-api/stable.rst:133 msgid "" "For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro " "variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it " @@ -252,7 +260,7 @@ msgstr "" "`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list 物件的特定" "版本實作細節。" -#: ../../c-api/stable.rst:130 +#: ../../c-api/stable.rst:138 msgid "" "Without ``Py_LIMITED_API`` defined, some C API functions are inlined or " "replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, " @@ -263,7 +271,7 @@ msgstr "" "``Py_LIMITED_API`` 會禁用嵌入,從而隨著 Python 資料結構的改進而提高穩定性,但" "可能會降低性能。" -#: ../../c-api/stable.rst:135 +#: ../../c-api/stable.rst:143 msgid "" "By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile " "a Limited API extension with a version-specific ABI. This can improve " @@ -277,11 +285,11 @@ msgstr "" "將產生一個擴充,可以在特定版本的擴充不可用的地方發布 — 例如,用於即將發布的 " "Python 版本的預發布版本 (prerelease)。" -#: ../../c-api/stable.rst:144 +#: ../../c-api/stable.rst:152 msgid "Limited API Caveats" msgstr "受限 API 注意事項" -#: ../../c-api/stable.rst:146 +#: ../../c-api/stable.rst:154 msgid "" "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " "that code conforms to the :ref:`Limited API ` or the :ref:" @@ -293,7 +301,7 @@ msgstr "" "``Py_LIMITED_API`` 僅涵蓋定義,但 API 還包括其他議題,例如預期的語義 " "(semantic)。" -#: ../../c-api/stable.rst:151 +#: ../../c-api/stable.rst:159 msgid "" "One issue that ``Py_LIMITED_API`` does not guard against is calling a " "function with arguments that are invalid in a lower Python version. For " @@ -307,7 +315,7 @@ msgstr "" "現在代表選擇預設行為,但在 Python 3.8 中,引數將被直接使用,導致 ``NULL`` 取" "消參照 (dereference) 且崩潰 (crash)。類似的引數適用於結構 (struct) 的欄位。" -#: ../../c-api/stable.rst:158 +#: ../../c-api/stable.rst:166 msgid "" "Another issue is that some struct fields are currently not hidden when " "``Py_LIMITED_API`` is defined, even though they're part of the Limited API." @@ -315,7 +323,7 @@ msgstr "" "另一個問題是,當有定義 ``Py_LIMITED_API`` 時,一些結構欄位目前不會被隱藏,即" "使它們是受限 API 的一部分。" -#: ../../c-api/stable.rst:161 +#: ../../c-api/stable.rst:169 msgid "" "For these reasons, we recommend testing an extension with *all* minor Python " "versions it supports, and preferably to build with the *lowest* such version." @@ -323,7 +331,7 @@ msgstr "" "出於這些原因,我們建議要以它支援的\\ *所有*\\ 次要 Python 版本來測試擴充,並" "且最好使用\\ *最低*\\ 版本進行建置。" -#: ../../c-api/stable.rst:164 +#: ../../c-api/stable.rst:172 msgid "" "We also recommend reviewing documentation of all used API to check if it is " "explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a " @@ -334,7 +342,7 @@ msgstr "" "義 ``Py_LIMITED_API``,一些私有聲明也會因為技術原因(或者甚至是無意地,例如臭" "蟲)而被公開出來。" -#: ../../c-api/stable.rst:169 +#: ../../c-api/stable.rst:177 msgid "" "Also note that the Limited API is not necessarily stable: compiling with " "``Py_LIMITED_API`` with Python 3.8 means that the extension will run with " @@ -346,11 +354,11 @@ msgstr "" "行編譯意味著擴充將能以 Python 3.12 運行,但不一定能以 Python 3.12 *編譯*。特" "別是如果穩定 ABI 保持穩定,部分受限 API 可能會被棄用和刪除。" -#: ../../c-api/stable.rst:179 +#: ../../c-api/stable.rst:187 msgid "Platform Considerations" msgstr "平台注意事項" -#: ../../c-api/stable.rst:181 +#: ../../c-api/stable.rst:189 msgid "" "ABI stability depends not only on Python, but also on the compiler used, " "lower-level libraries and compiler options. For the purposes of the :ref:" @@ -361,7 +369,7 @@ msgstr "" "於\\ :ref:`穩定 ABI ` 的目的,這些細節定義了一個「平台」。它們通" "常取決於作業系統種類和處理器架構" -#: ../../c-api/stable.rst:186 +#: ../../c-api/stable.rst:194 msgid "" "It is the responsibility of each particular distributor of Python to ensure " "that all Python versions on a particular platform are built in a way that " @@ -372,11 +380,11 @@ msgstr "" "定 ABI 的方式建置。``python.org`` 和許多第三方發布者發布的 Windows 和 macOS " "版本就是這種情況。" -#: ../../c-api/stable.rst:196 +#: ../../c-api/stable.rst:204 msgid "Contents of Limited API" msgstr "受限 API 的內容" -#: ../../c-api/stable.rst:199 +#: ../../c-api/stable.rst:207 msgid "" "Currently, the :ref:`Limited API ` includes the following " "items:" diff --git a/c-api/structures.po b/c-api/structures.po index 76d856ee90..eacbf76707 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-11 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,11 +57,11 @@ msgstr "" #: ../../c-api/structures.rst:38 msgid "" -"This is an extension of :c:type:`PyObject` that adds the :c:member:" -"`~PyVarObject.ob_size` field. This is only used for objects that have some " -"notion of *length*. This type does not often appear in the Python/C API. " -"Access to the members must be done by using the macros :c:macro:" -"`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." +"This is an extension of :c:type:`PyObject` that adds " +"the :c:member:`~PyVarObject.ob_size` field. This is only used for objects " +"that have some notion of *length*. This type does not often appear in the " +"Python/C API. Access to the members must be done by using the " +"macros :c:macro:`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." msgstr "" #: ../../c-api/structures.rst:47 @@ -95,80 +95,85 @@ msgstr "請見上面 :c:type:`PyVarObject` 的文件。" #: ../../c-api/structures.rst:68 msgid "" +"The base class of all other objects, the same as :class:`object` in Python." +msgstr "" + +#: ../../c-api/structures.rst:73 +msgid "" "Test if the *x* object is the *y* object, the same as ``x is y`` in Python." msgstr "" -#: ../../c-api/structures.rst:75 +#: ../../c-api/structures.rst:80 msgid "" "Test if an object is the ``None`` singleton, the same as ``x is None`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:83 +#: ../../c-api/structures.rst:88 msgid "" "Test if an object is the ``True`` singleton, the same as ``x is True`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:91 +#: ../../c-api/structures.rst:96 msgid "" "Test if an object is the ``False`` singleton, the same as ``x is False`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:99 +#: ../../c-api/structures.rst:104 msgid "Get the type of the Python object *o*." msgstr "" -#: ../../c-api/structures.rst:101 +#: ../../c-api/structures.rst:106 msgid "Return a :term:`borrowed reference`." msgstr "" -#: ../../c-api/structures.rst:103 +#: ../../c-api/structures.rst:108 msgid "Use the :c:func:`Py_SET_TYPE` function to set an object type." msgstr "" -#: ../../c-api/structures.rst:105 +#: ../../c-api/structures.rst:110 msgid "" ":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyObject*`." msgstr "" -#: ../../c-api/structures.rst:112 +#: ../../c-api/structures.rst:117 msgid "" "Return non-zero if the object *o* type is *type*. Return zero otherwise. " "Equivalent to: ``Py_TYPE(o) == type``." msgstr "" -#: ../../c-api/structures.rst:120 +#: ../../c-api/structures.rst:125 msgid "Set the object *o* type to *type*." msgstr "將物件 *o* 的型別設為 *type*。" -#: ../../c-api/structures.rst:127 +#: ../../c-api/structures.rst:132 msgid "Get the size of the Python object *o*." msgstr "取得 Python 物件 *o* 的大小。" -#: ../../c-api/structures.rst:129 +#: ../../c-api/structures.rst:134 msgid "Use the :c:func:`Py_SET_SIZE` function to set an object size." msgstr "" -#: ../../c-api/structures.rst:131 +#: ../../c-api/structures.rst:136 msgid "" ":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyVarObject*`." msgstr "" -#: ../../c-api/structures.rst:138 +#: ../../c-api/structures.rst:143 msgid "Set the object *o* size to *size*." msgstr "將物件 *o* 的大小設為 *size*。" -#: ../../c-api/structures.rst:145 +#: ../../c-api/structures.rst:150 msgid "" -"This is a macro which expands to initialization values for a new :c:type:" -"`PyObject` type. This macro expands to::" +"This is a macro which expands to initialization values for a " +"new :c:type:`PyObject` type. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:148 +#: ../../c-api/structures.rst:153 msgid "" "_PyObject_EXTRA_INIT\n" "1, type," @@ -176,14 +181,14 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type," -#: ../../c-api/structures.rst:154 +#: ../../c-api/structures.rst:159 msgid "" -"This is a macro which expands to initialization values for a new :c:type:" -"`PyVarObject` type, including the :c:member:`~PyVarObject.ob_size` field. " -"This macro expands to::" +"This is a macro which expands to initialization values for a " +"new :c:type:`PyVarObject` type, including " +"the :c:member:`~PyVarObject.ob_size` field. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:158 +#: ../../c-api/structures.rst:163 msgid "" "_PyObject_EXTRA_INIT\n" "1, type, size," @@ -191,11 +196,11 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type, size," -#: ../../c-api/structures.rst:163 +#: ../../c-api/structures.rst:168 msgid "Implementing functions and methods" msgstr "實作函式與方法" -#: ../../c-api/structures.rst:167 +#: ../../c-api/structures.rst:172 msgid "" "Type of the functions used to implement most Python callables in C. " "Functions of this type take two :c:expr:`PyObject*` parameters and return " @@ -205,11 +210,11 @@ msgid "" "reference." msgstr "" -#: ../../c-api/structures.rst:174 +#: ../../c-api/structures.rst:179 msgid "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:176 +#: ../../c-api/structures.rst:181 msgid "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" @@ -217,14 +222,14 @@ msgstr "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" -#: ../../c-api/structures.rst:181 +#: ../../c-api/structures.rst:186 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_VARARGS | METH_KEYWORDS `. " "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:185 +#: ../../c-api/structures.rst:190 msgid "" "PyObject *PyCFunctionWithKeywords(PyObject *self,\n" " PyObject *args,\n" @@ -234,51 +239,49 @@ msgstr "" " PyObject *args,\n" " PyObject *kwargs);" -#: ../../c-api/structures.rst:192 +#: ../../c-api/structures.rst:197 msgid "" "Type of the functions used to implement Python callables in C with " "signature :c:macro:`METH_FASTCALL`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:196 -#, fuzzy +#: ../../c-api/structures.rst:201 msgid "" "PyObject *PyCFunctionFast(PyObject *self,\n" " PyObject *const *args,\n" " Py_ssize_t nargs);" msgstr "" -"PyObject *_PyCFunctionFast(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs);" +"PyObject *PyCFunctionFast(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs);" -#: ../../c-api/structures.rst:202 +#: ../../c-api/structures.rst:207 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:206 -#, fuzzy +#: ../../c-api/structures.rst:211 msgid "" "PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" " PyObject *const *args,\n" " Py_ssize_t nargs,\n" " PyObject *kwnames);" msgstr "" -"PyObject *_PyCFunctionFastWithKeywords(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs,\n" -" PyObject *kwnames);" +"PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames);" -#: ../../c-api/structures.rst:213 +#: ../../c-api/structures.rst:218 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:217 +#: ../../c-api/structures.rst:222 msgid "" "PyObject *PyCMethod(PyObject *self,\n" " PyTypeObject *defining_class,\n" @@ -292,29 +295,29 @@ msgstr "" " Py_ssize_t nargs,\n" " PyObject *kwnames)" -#: ../../c-api/structures.rst:228 +#: ../../c-api/structures.rst:233 msgid "" "Structure used to describe a method of an extension type. This structure " "has four fields:" msgstr "" -#: ../../c-api/structures.rst:233 +#: ../../c-api/structures.rst:238 msgid "Name of the method." msgstr "" -#: ../../c-api/structures.rst:237 +#: ../../c-api/structures.rst:242 msgid "Pointer to the C implementation." msgstr "" -#: ../../c-api/structures.rst:241 +#: ../../c-api/structures.rst:246 msgid "Flags bits indicating how the call should be constructed." msgstr "" -#: ../../c-api/structures.rst:245 +#: ../../c-api/structures.rst:250 msgid "Points to the contents of the docstring." msgstr "" -#: ../../c-api/structures.rst:247 +#: ../../c-api/structures.rst:252 msgid "" "The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions " "may be of different types, but they always return :c:expr:`PyObject*`. If " @@ -324,41 +327,42 @@ msgid "" "implementation uses the specific C type of the *self* object." msgstr "" -#: ../../c-api/structures.rst:255 +#: ../../c-api/structures.rst:260 msgid "" "The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include " "the following flags. The individual flags indicate either a calling " "convention or a binding convention." msgstr "" -#: ../../c-api/structures.rst:260 +#: ../../c-api/structures.rst:265 msgid "There are these calling conventions:" msgstr "" -#: ../../c-api/structures.rst:264 +#: ../../c-api/structures.rst:269 msgid "" -"This is the typical calling convention, where the methods have the type :c:" -"type:`PyCFunction`. The function expects two :c:expr:`PyObject*` values. The " -"first one is the *self* object for methods; for module functions, it is the " -"module object. The second parameter (often called *args*) is a tuple object " -"representing all arguments. This parameter is typically processed using :c:" -"func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`." +"This is the typical calling convention, where the methods have the " +"type :c:type:`PyCFunction`. The function expects two :c:expr:`PyObject*` " +"values. The first one is the *self* object for methods; for module " +"functions, it is the module object. The second parameter (often called " +"*args*) is a tuple object representing all arguments. This parameter is " +"typically processed using :c:func:`PyArg_ParseTuple` " +"or :c:func:`PyArg_UnpackTuple`." msgstr "" -#: ../../c-api/structures.rst:274 +#: ../../c-api/structures.rst:279 msgid "" -"Can only be used in certain combinations with other flags: :ref:" -"`METH_VARARGS | METH_KEYWORDS `, :ref:" -"`METH_FASTCALL | METH_KEYWORDS ` and :ref:" -"`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `." +"Can only be used in certain combinations with other " +"flags: :ref:`METH_VARARGS | METH_KEYWORDS `, :ref:`METH_FASTCALL | METH_KEYWORDS ` and :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS " +"`." msgstr "" -#: ../../c-api/structures.rst:282 +#: ../../c-api/structures.rst:287 msgid ":c:expr:`METH_VARARGS | METH_KEYWORDS`" msgstr ":c:expr:`METH_VARARGS | METH_KEYWORDS`" -#: ../../c-api/structures.rst:283 +#: ../../c-api/structures.rst:288 msgid "" "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " "The function expects three parameters: *self*, *args*, *kwargs* where " @@ -367,7 +371,7 @@ msgid "" "using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" -#: ../../c-api/structures.rst:292 +#: ../../c-api/structures.rst:297 msgid "" "Fast calling convention supporting only positional arguments. The methods " "have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " @@ -376,15 +380,15 @@ msgid "" "the array)." msgstr "" -#: ../../c-api/structures.rst:302 +#: ../../c-api/structures.rst:307 msgid "``METH_FASTCALL`` is now part of the :ref:`stable ABI `." msgstr "" -#: ../../c-api/structures.rst:307 +#: ../../c-api/structures.rst:312 msgid ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:308 +#: ../../c-api/structures.rst:313 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " "with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " @@ -396,17 +400,17 @@ msgid "" "the positional arguments." msgstr "" -#: ../../c-api/structures.rst:323 +#: ../../c-api/structures.rst:328 msgid "" "Can only be used in the combination with other flags: :ref:`METH_METHOD | " "METH_FASTCALL | METH_KEYWORDS `." msgstr "" -#: ../../c-api/structures.rst:329 +#: ../../c-api/structures.rst:334 msgid ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:330 +#: ../../c-api/structures.rst:335 msgid "" "Extension of :ref:`METH_FASTCALL | METH_KEYWORDS ` supporting the *defining class*, that is, the class that " @@ -414,14 +418,14 @@ msgid "" "``Py_TYPE(self)``." msgstr "" -#: ../../c-api/structures.rst:335 +#: ../../c-api/structures.rst:340 msgid "" "The method needs to be of type :c:type:`PyCMethod`, the same as for " "``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " "after ``self``." msgstr "" -#: ../../c-api/structures.rst:344 +#: ../../c-api/structures.rst:349 msgid "" "Methods without parameters don't need to check whether arguments are given " "if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of " @@ -430,22 +434,22 @@ msgid "" "the second parameter will be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:350 +#: ../../c-api/structures.rst:355 msgid "" -"The function must have 2 parameters. Since the second parameter is unused, :" -"c:macro:`Py_UNUSED` can be used to prevent a compiler warning." +"The function must have 2 parameters. Since the second parameter is " +"unused, :c:macro:`Py_UNUSED` can be used to prevent a compiler warning." msgstr "" -#: ../../c-api/structures.rst:356 +#: ../../c-api/structures.rst:361 msgid "" -"Methods with a single object argument can be listed with the :c:macro:" -"`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` with a " -"``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with the " -"*self* parameter, and a :c:expr:`PyObject*` parameter representing the " +"Methods with a single object argument can be listed with " +"the :c:macro:`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` " +"with a ``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with " +"the *self* parameter, and a :c:expr:`PyObject*` parameter representing the " "single argument." msgstr "" -#: ../../c-api/structures.rst:362 +#: ../../c-api/structures.rst:367 msgid "" "These two constants are not used to indicate the calling convention but the " "binding when use with methods of classes. These may not be used for " @@ -453,53 +457,53 @@ msgid "" "any given method." msgstr "" -#: ../../c-api/structures.rst:372 +#: ../../c-api/structures.rst:377 msgid "" "The method will be passed the type object as the first parameter rather than " "an instance of the type. This is used to create *class methods*, similar to " "what is created when using the :func:`classmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:382 +#: ../../c-api/structures.rst:387 msgid "" "The method will be passed ``NULL`` as the first parameter rather than an " "instance of the type. This is used to create *static methods*, similar to " "what is created when using the :func:`staticmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:386 +#: ../../c-api/structures.rst:391 msgid "" "One other constant controls whether a method is loaded in place of another " "definition with the same method name." msgstr "" -#: ../../c-api/structures.rst:392 +#: ../../c-api/structures.rst:397 msgid "" "The method will be loaded in place of existing definitions. Without " "*METH_COEXIST*, the default is to skip repeated definitions. Since slot " "wrappers are loaded before the method table, the existence of a " -"*sq_contains* slot, for example, would generate a wrapped method named :meth:" -"`~object.__contains__` and preclude the loading of a corresponding " -"PyCFunction with the same name. With the flag defined, the PyCFunction will " -"be loaded in place of the wrapper object and will co-exist with the slot. " -"This is helpful because calls to PyCFunctions are optimized more than " -"wrapper object calls." +"*sq_contains* slot, for example, would generate a wrapped method " +"named :meth:`~object.__contains__` and preclude the loading of a " +"corresponding PyCFunction with the same name. With the flag defined, the " +"PyCFunction will be loaded in place of the wrapper object and will co-exist " +"with the slot. This is helpful because calls to PyCFunctions are optimized " +"more than wrapper object calls." msgstr "" -#: ../../c-api/structures.rst:404 +#: ../../c-api/structures.rst:409 msgid "" "Turn *ml* into a Python :term:`callable` object. The caller must ensure that " "*ml* outlives the :term:`callable`. Typically, *ml* is defined as a static " "variable." msgstr "" -#: ../../c-api/structures.rst:408 +#: ../../c-api/structures.rst:413 msgid "" "The *self* parameter will be passed as the *self* argument to the C function " "in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:412 +#: ../../c-api/structures.rst:417 msgid "" "The :term:`callable` object's ``__module__`` attribute can be set from the " "given *module* argument. *module* should be a Python string, which will be " @@ -507,89 +511,89 @@ msgid "" "can be set to :const:`None` or ``NULL``." msgstr "" -#: ../../c-api/structures.rst:418 +#: ../../c-api/structures.rst:423 msgid ":attr:`function.__module__`" msgstr ":attr:`function.__module__`" -#: ../../c-api/structures.rst:420 +#: ../../c-api/structures.rst:425 msgid "" "The *cls* parameter will be passed as the *defining_class* argument to the C " "function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." msgstr "" -#: ../../c-api/structures.rst:429 +#: ../../c-api/structures.rst:434 msgid "Equivalent to ``PyCMethod_New(ml, self, module, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, module, NULL)``。" -#: ../../c-api/structures.rst:434 +#: ../../c-api/structures.rst:439 msgid "Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, NULL, NULL)``。" -#: ../../c-api/structures.rst:438 +#: ../../c-api/structures.rst:443 msgid "Accessing attributes of extension types" msgstr "" -#: ../../c-api/structures.rst:442 +#: ../../c-api/structures.rst:447 msgid "" "Structure which describes an attribute of a type which corresponds to a C " "struct member. When defining a class, put a NULL-terminated array of these " "structures in the :c:member:`~PyTypeObject.tp_members` slot." msgstr "" -#: ../../c-api/structures.rst:447 +#: ../../c-api/structures.rst:452 msgid "Its fields are, in order:" msgstr "" -#: ../../c-api/structures.rst:451 +#: ../../c-api/structures.rst:456 msgid "" "Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." msgstr "" -#: ../../c-api/structures.rst:454 +#: ../../c-api/structures.rst:459 msgid "The string should be static, no copy is made of it." msgstr "" -#: ../../c-api/structures.rst:458 +#: ../../c-api/structures.rst:463 msgid "" "The type of the member in the C struct. See :ref:`PyMemberDef-types` for the " "possible values." msgstr "" -#: ../../c-api/structures.rst:463 +#: ../../c-api/structures.rst:468 msgid "" "The offset in bytes that the member is located on the type’s object struct." msgstr "" -#: ../../c-api/structures.rst:467 +#: ../../c-api/structures.rst:472 msgid "" "Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." msgstr "" -#: ../../c-api/structures.rst:471 +#: ../../c-api/structures.rst:476 msgid "" "The docstring, or NULL. The string should be static, no copy is made of it. " "Typically, it is defined using :c:macro:`PyDoc_STR`." msgstr "" -#: ../../c-api/structures.rst:475 +#: ../../c-api/structures.rst:480 msgid "" "By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow " "both read and write access. Use the :c:macro:`Py_READONLY` flag for read-" -"only access. Certain types, like :c:macro:`Py_T_STRING`, imply :c:macro:" -"`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and legacy :c:macro:" -"`T_OBJECT`) members can be deleted." +"only access. Certain types, like :c:macro:`Py_T_STRING`, " +"imply :c:macro:`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and " +"legacy :c:macro:`T_OBJECT`) members can be deleted." msgstr "" -#: ../../c-api/structures.rst:484 +#: ../../c-api/structures.rst:489 msgid "" "For heap-allocated types (created using :c:func:`PyType_FromSpec` or " "similar), ``PyMemberDef`` may contain a definition for the special member " -"``\"__vectorcalloffset__\"``, corresponding to :c:member:`~PyTypeObject." -"tp_vectorcall_offset` in type objects. These must be defined with " -"``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::" +"``\"__vectorcalloffset__\"``, corresponding " +"to :c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects. These " +"must be defined with ``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::" msgstr "" -#: ../../c-api/structures.rst:490 +#: ../../c-api/structures.rst:495 msgid "" "static PyMemberDef spam_type_members[] = {\n" " {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" @@ -603,90 +607,92 @@ msgstr "" " {NULL} /* Sentinel */\n" "};" -#: ../../c-api/structures.rst:496 +#: ../../c-api/structures.rst:501 msgid "(You may need to ``#include `` for :c:func:`!offsetof`.)" msgstr "" -#: ../../c-api/structures.rst:498 +#: ../../c-api/structures.rst:503 msgid "" -"The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` and :c:member:" -"`~PyTypeObject.tp_weaklistoffset` can be defined similarly using " -"``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but " +"The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` " +"and :c:member:`~PyTypeObject.tp_weaklistoffset` can be defined similarly " +"using ``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but " "extensions are strongly encouraged to use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." msgstr "" -#: ../../c-api/structures.rst:506 +#: ../../c-api/structures.rst:511 msgid "" "``PyMemberDef`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:511 +#: ../../c-api/structures.rst:516 msgid "" "Get an attribute belonging to the object at address *obj_addr*. The " "attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" -#: ../../c-api/structures.rst:517 +#: ../../c-api/structures.rst:522 msgid "" "``PyMember_GetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:522 +#: ../../c-api/structures.rst:527 msgid "" "Set an attribute belonging to the object at address *obj_addr* to object " "*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " "``0`` if successful and a negative value on failure." msgstr "" -#: ../../c-api/structures.rst:528 +#: ../../c-api/structures.rst:533 msgid "" "``PyMember_SetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:534 +#: ../../c-api/structures.rst:539 msgid "Member flags" msgstr "" -#: ../../c-api/structures.rst:536 +#: ../../c-api/structures.rst:541 msgid "The following flags can be used with :c:member:`PyMemberDef.flags`:" msgstr "" -#: ../../c-api/structures.rst:540 +#: ../../c-api/structures.rst:545 msgid "Not writable." msgstr "不可寫入。" -#: ../../c-api/structures.rst:544 +#: ../../c-api/structures.rst:549 msgid "" "Emit an ``object.__getattr__`` :ref:`audit event ` before " "reading." msgstr "" -#: ../../c-api/structures.rst:549 +#: ../../c-api/structures.rst:554 msgid "" "Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` " "entry indicates an offset from the subclass-specific data, rather than from " "``PyObject``." msgstr "" -#: ../../c-api/structures.rst:553 +#: ../../c-api/structures.rst:558 msgid "" -"Can only be used as part of :c:member:`Py_tp_members ` :c:type:`slot ` when creating a class using " -"negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in that case." +"Can only be used as part of :c:member:`Py_tp_members " +"` :c:type:`slot ` when creating a " +"class using negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in " +"that case." msgstr "" -#: ../../c-api/structures.rst:558 +#: ../../c-api/structures.rst:563 msgid "" -"This flag is only used in :c:type:`PyType_Slot`. When setting :c:member:" -"`~PyTypeObject.tp_members` during class creation, Python clears it and sets :" -"c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct." +"This flag is only used in :c:type:`PyType_Slot`. When " +"setting :c:member:`~PyTypeObject.tp_members` during class creation, Python " +"clears it and sets :c:member:`PyMemberDef.offset` to the offset from the " +"``PyObject`` struct." msgstr "" -#: ../../c-api/structures.rst:570 +#: ../../c-api/structures.rst:575 msgid "" "The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!" "WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are " @@ -695,20 +701,20 @@ msgid "" "nothing." msgstr "" -#: ../../c-api/structures.rst:581 +#: ../../c-api/structures.rst:586 msgid "" -"The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. The :c:" -"macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The new " -"names are now always available. Previously, these required ``#include " +"The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. " +"The :c:macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The " +"new names are now always available. Previously, these required ``#include " "\"structmember.h\"``. The header is still available and it provides the old " "names." msgstr "" -#: ../../c-api/structures.rst:590 +#: ../../c-api/structures.rst:595 msgid "Member types" msgstr "" -#: ../../c-api/structures.rst:592 +#: ../../c-api/structures.rst:597 msgid "" ":c:member:`PyMemberDef.type` can be one of the following macros " "corresponding to various C types. When the member is accessed in Python, it " @@ -717,147 +723,147 @@ msgid "" "exception such as :exc:`TypeError` or :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/structures.rst:600 +#: ../../c-api/structures.rst:605 msgid "" -"Unless marked (D), attributes defined this way cannot be deleted using e.g. :" -"keyword:`del` or :py:func:`delattr`." +"Unless marked (D), attributes defined this way cannot be deleted using " +"e.g. :keyword:`del` or :py:func:`delattr`." msgstr "" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "Macro name" msgstr "巨集名稱" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "C type" msgstr "" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "Python type" msgstr "" -#: ../../c-api/structures.rst:606 +#: ../../c-api/structures.rst:611 msgid ":c:expr:`char`" msgstr ":c:expr:`char`" -#: ../../c-api/structures.rst:606 ../../c-api/structures.rst:607 -#: ../../c-api/structures.rst:608 ../../c-api/structures.rst:609 -#: ../../c-api/structures.rst:610 ../../c-api/structures.rst:611 -#: ../../c-api/structures.rst:612 ../../c-api/structures.rst:613 -#: ../../c-api/structures.rst:614 ../../c-api/structures.rst:615 -#: ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:611 ../../c-api/structures.rst:612 +#: ../../c-api/structures.rst:613 ../../c-api/structures.rst:614 +#: ../../c-api/structures.rst:615 ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:617 ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:619 ../../c-api/structures.rst:620 +#: ../../c-api/structures.rst:621 msgid ":py:class:`int`" msgstr ":py:class:`int`" -#: ../../c-api/structures.rst:607 +#: ../../c-api/structures.rst:612 msgid ":c:expr:`short`" msgstr ":c:expr:`short`" -#: ../../c-api/structures.rst:608 +#: ../../c-api/structures.rst:613 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/structures.rst:609 +#: ../../c-api/structures.rst:614 msgid ":c:expr:`long`" msgstr ":c:expr:`long`" -#: ../../c-api/structures.rst:610 +#: ../../c-api/structures.rst:615 msgid ":c:expr:`long long`" msgstr ":c:expr:`long long`" -#: ../../c-api/structures.rst:611 +#: ../../c-api/structures.rst:616 msgid ":c:expr:`unsigned char`" msgstr ":c:expr:`unsigned char`" -#: ../../c-api/structures.rst:612 +#: ../../c-api/structures.rst:617 msgid ":c:expr:`unsigned int`" msgstr ":c:expr:`unsigned int`" -#: ../../c-api/structures.rst:613 +#: ../../c-api/structures.rst:618 msgid ":c:expr:`unsigned short`" msgstr ":c:expr:`unsigned short`" -#: ../../c-api/structures.rst:614 +#: ../../c-api/structures.rst:619 msgid ":c:expr:`unsigned long`" msgstr ":c:expr:`unsigned long`" -#: ../../c-api/structures.rst:615 +#: ../../c-api/structures.rst:620 msgid ":c:expr:`unsigned long long`" msgstr ":c:expr:`unsigned long long`" -#: ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:621 msgid ":c:expr:`Py_ssize_t`" msgstr ":c:expr:`Py_ssize_t`" -#: ../../c-api/structures.rst:617 +#: ../../c-api/structures.rst:622 msgid ":c:expr:`float`" msgstr ":c:expr:`float`" -#: ../../c-api/structures.rst:617 ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:622 ../../c-api/structures.rst:623 msgid ":py:class:`float`" msgstr ":py:class:`float`" -#: ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:623 msgid ":c:expr:`double`" msgstr ":c:expr:`double`" -#: ../../c-api/structures.rst:619 +#: ../../c-api/structures.rst:624 msgid ":c:expr:`char` (written as 0 or 1)" msgstr ":c:expr:`char` (寫成 0 或 1)" -#: ../../c-api/structures.rst:619 +#: ../../c-api/structures.rst:624 msgid ":py:class:`bool`" msgstr ":py:class:`bool`" -#: ../../c-api/structures.rst:621 +#: ../../c-api/structures.rst:626 msgid ":c:expr:`const char *` (*)" msgstr ":c:expr:`const char *` (*)" -#: ../../c-api/structures.rst:621 ../../c-api/structures.rst:622 +#: ../../c-api/structures.rst:626 ../../c-api/structures.rst:627 msgid ":py:class:`str` (RO)" msgstr ":py:class:`str` (RO)" -#: ../../c-api/structures.rst:622 +#: ../../c-api/structures.rst:627 msgid ":c:expr:`const char[]` (*)" msgstr ":c:expr:`const char[]` (*)" -#: ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:628 msgid ":c:expr:`char` (0-127)" msgstr ":c:expr:`char` (0-127)" -#: ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:628 msgid ":py:class:`str` (**)" msgstr ":py:class:`str` (**)" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:629 msgid ":c:expr:`PyObject *`" msgstr ":c:expr:`PyObject *`" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:629 msgid ":py:class:`object` (D)" msgstr ":py:class:`object` (D)" -#: ../../c-api/structures.rst:627 +#: ../../c-api/structures.rst:632 msgid "" "(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` " "the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the " "string is stored directly in the structure." msgstr "" -#: ../../c-api/structures.rst:632 +#: ../../c-api/structures.rst:637 msgid "(**): String of length 1. Only ASCII is accepted." msgstr "" -#: ../../c-api/structures.rst:634 +#: ../../c-api/structures.rst:639 msgid "(RO): Implies :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:636 +#: ../../c-api/structures.rst:641 msgid "" "(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a " "``NULL`` pointer raises :py:exc:`AttributeError`." msgstr "" -#: ../../c-api/structures.rst:662 +#: ../../c-api/structures.rst:667 msgid "" "In previous versions, the macros were only available with ``#include " "\"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as " @@ -865,174 +871,174 @@ msgid "" "with the following deprecated types:" msgstr "" -#: ../../c-api/structures.rst:670 +#: ../../c-api/structures.rst:675 msgid "" "Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results " "in surprising behavior in Python: deleting the attribute effectively sets it " "to ``None``." msgstr "" -#: ../../c-api/structures.rst:676 +#: ../../c-api/structures.rst:681 msgid "Always ``None``. Must be used with :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:679 +#: ../../c-api/structures.rst:684 msgid "Defining Getters and Setters" msgstr "" -#: ../../c-api/structures.rst:683 +#: ../../c-api/structures.rst:688 msgid "" "Structure to define property-like access for a type. See also description of " "the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" -#: ../../c-api/structures.rst:688 +#: ../../c-api/structures.rst:693 msgid "attribute name" msgstr "屬性名稱" -#: ../../c-api/structures.rst:692 +#: ../../c-api/structures.rst:697 msgid "C function to get the attribute." msgstr "" -#: ../../c-api/structures.rst:696 +#: ../../c-api/structures.rst:701 msgid "" "Optional C function to set or delete the attribute. If ``NULL``, the " "attribute is read-only." msgstr "" -#: ../../c-api/structures.rst:701 +#: ../../c-api/structures.rst:706 msgid "optional docstring" msgstr "可選的文件字串" -#: ../../c-api/structures.rst:705 +#: ../../c-api/structures.rst:710 msgid "" "Optional user data pointer, providing additional data for getter and setter." msgstr "" -#: ../../c-api/structures.rst:709 +#: ../../c-api/structures.rst:714 msgid "" "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " "and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:712 +#: ../../c-api/structures.rst:717 msgid "" "It should return a new reference on success or ``NULL`` with a set exception " "on failure." msgstr "" -#: ../../c-api/structures.rst:717 +#: ../../c-api/structures.rst:722 msgid "" "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " "the value to be set) and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:720 +#: ../../c-api/structures.rst:725 msgid "" "In case the attribute should be deleted the second parameter is ``NULL``. " "Should return ``0`` on success or ``-1`` with a set exception on failure." msgstr "" -#: ../../c-api/structures.rst:370 ../../c-api/structures.rst:380 +#: ../../c-api/structures.rst:375 ../../c-api/structures.rst:385 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/structures.rst:370 +#: ../../c-api/structures.rst:375 msgid "classmethod" msgstr "classmethod" -#: ../../c-api/structures.rst:380 +#: ../../c-api/structures.rst:385 msgid "staticmethod" msgstr "staticmethod" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "READ_RESTRICTED (C macro)" msgstr "READ_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "WRITE_RESTRICTED (C macro)" msgstr "WRITE_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "RESTRICTED (C macro)" msgstr "RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:576 +#: ../../c-api/structures.rst:581 msgid "READONLY (C macro)" msgstr "READONLY(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_BYTE (C macro)" msgstr "T_BYTE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_SHORT (C macro)" msgstr "T_SHORT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_INT (C macro)" msgstr "T_INT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_LONG (C macro)" msgstr "T_LONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_LONGLONG (C macro)" msgstr "T_LONGLONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_UBYTE (C macro)" msgstr "T_UBYTE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_USHORT (C macro)" msgstr "T_USHORT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_UINT (C macro)" msgstr "T_UINT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_ULONG (C macro)" msgstr "T_ULONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_ULONGULONG (C macro)" msgstr "T_ULONGULONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_PYSSIZET (C macro)" msgstr "T_PYSSIZET(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_FLOAT (C macro)" msgstr "T_FLOAT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_DOUBLE (C macro)" msgstr "T_DOUBLE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_BOOL (C macro)" msgstr "T_BOOL(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_CHAR (C macro)" msgstr "T_CHAR(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_STRING (C macro)" msgstr "T_STRING(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_STRING_INPLACE (C macro)" msgstr "T_STRING_INPLACE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_OBJECT_EX (C macro)" msgstr "T_OBJECT_EX(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "structmember.h" msgstr "structmember.h" diff --git a/c-api/sys.po b/c-api/sys.po index 5fa011518f..9037d85432 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-12 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -486,6 +486,10 @@ msgid "" "should be called by *func*." msgstr "" +#: ../../c-api/sys.rst:432 +msgid ":c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument." +msgstr "" + #: ../../c-api/sys.rst:101 msgid "USE_STACKCHECK (C macro)" msgstr "USE_STACKCHECK(C 巨集)" diff --git a/c-api/time.po b/c-api/time.po index a3c2646b3a..401edfe389 100644 --- a/c-api/time.po +++ b/c-api/time.po @@ -1,14 +1,15 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # -#, fuzzy +# Translators: +# Matt Wang , 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-24 07:20+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2025-05-25 04:26+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -24,28 +25,31 @@ msgstr "PyTime C API" msgid "" "The clock C API provides access to system clocks. It is similar to the " "Python :mod:`time` module." -msgstr "" +msgstr "時鐘 C API 提供對系統時鐘的存取。它類似於 Python 的 :mod:`time` 模組。" #: ../../c-api/time.rst:13 msgid "" "For C API related to the :mod:`datetime` module, see :ref:`datetimeobjects`." msgstr "" +"對於與 :mod:`datetime` 模組相關的 C API,請參閱 :ref:`datetimeobjects`。" #: ../../c-api/time.rst:17 msgid "Types" -msgstr "" +msgstr "型別" #: ../../c-api/time.rst:21 msgid "" "A timestamp or duration in nanoseconds, represented as a signed 64-bit " "integer." -msgstr "" +msgstr "以奈秒為單位的時間戳記或持續時長,以有符號的 64 位元整數表示。" #: ../../c-api/time.rst:24 msgid "" -"The reference point for timestamps depends on the clock used. For example, :" -"c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." +"The reference point for timestamps depends on the clock used. For " +"example, :c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." msgstr "" +"時間戳記的參照點取決於所使用的時鐘。例如 :c:func:`PyTime_Time` 回傳相對於 " +"UNIX 紀元 (UNIX epoch) 的時間戳記。" #: ../../c-api/time.rst:27 msgid "" @@ -53,18 +57,21 @@ msgid "" "epoch (January 1st, 1970) as reference, the supported date range is around " "[1677-09-21; 2262-04-11]. The exact limits are exposed as constants:" msgstr "" +"支援的範圍約為 [-292.3 年;+292.3 年]。以 Unix 紀元 (1970 年 1 月 1 日) 為參" +"照,支援的日期範圍約為 [1677-09-21; 2262-04-11]。確切的限制是以常數的形式公開" +"出來:" #: ../../c-api/time.rst:34 msgid "Minimum value of :c:type:`PyTime_t`." -msgstr "" +msgstr ":c:type:`PyTime_t` 的最小值。" #: ../../c-api/time.rst:38 msgid "Maximum value of :c:type:`PyTime_t`." -msgstr "" +msgstr ":c:type:`PyTime_t` 的最大值。" #: ../../c-api/time.rst:42 msgid "Clock Functions" -msgstr "" +msgstr "時鐘函式" #: ../../c-api/time.rst:44 msgid "" @@ -72,12 +79,14 @@ msgid "" "to the value of a particular clock. Details of each clock are given in the " "documentation of the corresponding Python function." msgstr "" +"以下的函式接受一個指向 :c:expr:`PyTime_t` 的指標,並將其設定為特定時鐘的值。" +"每個時鐘的詳細資訊紀錄在相對應的 Python 函式說明文件中。" #: ../../c-api/time.rst:49 msgid "" "The functions return ``0`` on success, or ``-1`` (with an exception set) on " "failure." -msgstr "" +msgstr "函式成功時會回傳 ``0`` 或在失敗時回傳 ``-1``\\ (並設定一個例外)。" #: ../../c-api/time.rst:52 msgid "" @@ -86,44 +95,51 @@ msgid "" "range. (On current systems, integer overflows are likely caused by " "misconfigured system time.)" msgstr "" +"在整數溢位時,它們會設定 :c:data:`PyExc_OverflowError` 例外,並將 " +"``*result`` 設定為夾在 ``[PyTime_MIN; PyTime_MAX]`` 範圍內的值。(在目前的系" +"統上,整數溢位很可能是由於錯誤設定的系統時間所造成。)" #: ../../c-api/time.rst:58 msgid "" "As any other C API (unless otherwise specified), the functions must be " "called with the :term:`GIL` held." msgstr "" +"如同任何其他 C API(除非另有指定),必須在持有 :term:`GIL` 的情況下呼叫函式。" #: ../../c-api/time.rst:63 msgid "" "Read the monotonic clock. See :func:`time.monotonic` for important details " "on this clock." -msgstr "" +msgstr "讀取單調時鐘。請參閱 :func:`time.monotonic` 取得此時鐘的重要詳細資訊。" #: ../../c-api/time.rst:68 msgid "" "Read the performance counter. See :func:`time.perf_counter` for important " "details on this clock." msgstr "" +"讀取效能計數器。請參閱 :func:`time.perf_counter` 以取得此時鐘的重要詳細資訊。" #: ../../c-api/time.rst:73 msgid "" "Read the “wall clock” time. See :func:`time.time` for details important on " "this clock." msgstr "" +"讀取「牆上時鐘 (wall clock)」的時間。請參閱 :func:`time.time` 以取得詳細資" +"訊。" #: ../../c-api/time.rst:78 msgid "Raw Clock Functions" -msgstr "" +msgstr "原始時鐘函式" #: ../../c-api/time.rst:80 msgid "" "Similar to clock functions, but don't set an exception on error and don't " "require the caller to hold the GIL." -msgstr "" +msgstr "類似於時鐘函式,但不會在出錯時設定例外,也不需要讓呼叫者持有 GIL。" #: ../../c-api/time.rst:83 msgid "On success, the functions return ``0``." -msgstr "" +msgstr "成功時函式會回傳 ``0``。" #: ../../c-api/time.rst:85 msgid "" @@ -132,35 +148,42 @@ msgid "" "call the regular (non-``Raw``) function. Note that the regular function may " "succeed after the ``Raw`` one failed." msgstr "" +"失敗時,它們會將 ``*result`` 設為 ``0`` 並回傳 ``-1``, 而\\ *不*\\ 設定例外。" +"要取得錯誤原因,請取得 GIL 並呼叫常規(非 ``Raw``)函式。請注意,常規函式可能" +"會在 ``Raw`` 的函式失敗後成功。" #: ../../c-api/time.rst:92 msgid "" "Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " "and don't require holding the GIL." msgstr "" +"類似於 :c:func:`PyTime_Monotonic`,但不會在出錯時設定例外,也不需要持有 GIL。" #: ../../c-api/time.rst:97 msgid "" "Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " "and don't require holding the GIL." msgstr "" +"類似於 :c:func:`PyTime_PerfCounter`,但不會在出錯時設定例外,也不需要持有 " +"GIL。" #: ../../c-api/time.rst:102 msgid "" "Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " "don't require holding the GIL." msgstr "" +"類似於 :c:func:`PyTime_Time`,但不會在出錯時設定例外,也不需要持有 GIL。" #: ../../c-api/time.rst:107 msgid "Conversion functions" -msgstr "" +msgstr "轉換函式" #: ../../c-api/time.rst:111 msgid "Convert a timestamp to a number of seconds as a C :c:expr:`double`." -msgstr "" +msgstr "將時間戳記轉換為 C :c:expr:`double` 的秒數。" #: ../../c-api/time.rst:113 msgid "" "The function cannot fail, but note that :c:expr:`double` has limited " "accuracy for large values." -msgstr "" +msgstr "此函式不會失敗,但請注意 :c:expr:`double` 對於大數值的精確度有限。" diff --git a/c-api/tuple.po b/c-api/tuple.po index 0392e13819..d70d49e967 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -72,16 +72,16 @@ msgstr "" #: ../../c-api/tuple.rst:61 msgid "" "Return the object at position *pos* in the tuple pointed to by *p*. If " -"*pos* is negative or out of bounds, return ``NULL`` and set an :exc:" -"`IndexError` exception." +"*pos* is negative or out of bounds, return ``NULL`` and set " +"an :exc:`IndexError` exception." msgstr "" #: ../../c-api/tuple.rst:64 msgid "" "The returned reference is borrowed from the tuple *p* (that is: it is only " "valid as long as you hold a reference to *p*). To get a :term:`strong " -"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` or :c:" -"func:`PySequence_GetItem`." +"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` " +"or :c:func:`PySequence_GetItem`." msgstr "" #: ../../c-api/tuple.rst:73 @@ -122,15 +122,17 @@ msgstr "" #: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:218 #: ../../c-api/tuple.rst:236 msgid "" -"Bounds checking is performed as an assertion if Python is built in :ref:" -"`debug mode ` or :option:`with assertions <--with-assertions>`." +"Bounds checking is performed as an assertion if Python is built " +"in :ref:`debug mode ` or :option:`with assertions <--with-" +"assertions>`." msgstr "" #: ../../c-api/tuple.rst:107 msgid "" -"This function \"steals\" a reference to *o*, and, unlike :c:func:" -"`PyTuple_SetItem`, does *not* discard a reference to any item that is being " -"replaced; any reference in the tuple at position *pos* will be leaked." +"This function \"steals\" a reference to *o*, and, " +"unlike :c:func:`PyTuple_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in the tuple at position *pos* will be " +"leaked." msgstr "" #: ../../c-api/tuple.rst:115 @@ -144,8 +146,8 @@ msgid "" "Client code should never assume that the resulting value of ``*p`` will be " "the same as before calling this function. If the object referenced by ``*p`` " "is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` " -"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or :exc:" -"`SystemError`." +"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` " +"or :exc:`SystemError`." msgstr "" #: ../../c-api/tuple.rst:130 @@ -154,22 +156,22 @@ msgstr "" #: ../../c-api/tuple.rst:132 msgid "" -"Struct sequence objects are the C equivalent of :func:`~collections." -"namedtuple` objects, i.e. a sequence whose items can also be accessed " -"through attributes. To create a struct sequence, you first have to create a " -"specific struct sequence type." +"Struct sequence objects are the C equivalent " +"of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can " +"also be accessed through attributes. To create a struct sequence, you first " +"have to create a specific struct sequence type." msgstr "" #: ../../c-api/tuple.rst:139 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " -"Instances of the resulting type can be created with :c:func:" -"`PyStructSequence_New`." +"Instances of the resulting type can be created " +"with :c:func:`PyStructSequence_New`." msgstr "" #: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:211 msgid "Return ``NULL`` with an exception set on failure." -msgstr "" +msgstr "失敗時回傳 ``NULL`` 並設定例外。" #: ../../c-api/tuple.rst:147 msgid "Initializes a struct sequence type *type* from *desc* in place." @@ -206,16 +208,16 @@ msgstr "" #: ../../c-api/tuple.rst:182 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " -"tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" -"member:`~PyStructSequence_Desc.fields` array of the :c:type:" -"`PyStructSequence_Desc` determines which field of the struct sequence is " -"described." +"tuple, all fields are typed as :c:expr:`PyObject*`. The index in " +"the :c:member:`~PyStructSequence_Desc.fields` array of " +"the :c:type:`PyStructSequence_Desc` determines which field of the struct " +"sequence is described." msgstr "" #: ../../c-api/tuple.rst:190 msgid "" -"Name for the field or ``NULL`` to end the list of named fields, set to :c:" -"data:`PyStructSequence_UnnamedField` to leave unnamed." +"Name for the field or ``NULL`` to end the list of named fields, set " +"to :c:data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" #: ../../c-api/tuple.rst:195 @@ -232,8 +234,8 @@ msgstr "" #: ../../c-api/tuple.rst:208 msgid "" -"Creates an instance of *type*, which must have been created with :c:func:" -"`PyStructSequence_NewType`." +"Creates an instance of *type*, which must have been created " +"with :c:func:`PyStructSequence_NewType`." msgstr "" #: ../../c-api/tuple.rst:216 diff --git a/c-api/type.po b/c-api/type.po index 9ca76377b5..0ff3fc423c 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-04-03 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -98,21 +98,27 @@ msgid "" "exception." msgstr "" -#: ../../c-api/type.rst:90 +#: ../../c-api/type.rst:85 +msgid "" +"In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, so " +"it must be called at start up (before spawning the first thread)." +msgstr "" + +#: ../../c-api/type.rst:93 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" -#: ../../c-api/type.rst:94 +#: ../../c-api/type.rst:97 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:103 +#: ../../c-api/type.rst:106 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -122,61 +128,61 @@ msgid "" "detail and subject to change.)" msgstr "" -#: ../../c-api/type.rst:110 +#: ../../c-api/type.rst:113 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:118 +#: ../../c-api/type.rst:121 msgid "Type of a type-watcher callback function." msgstr "" -#: ../../c-api/type.rst:120 +#: ../../c-api/type.rst:123 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" -#: ../../c-api/type.rst:129 +#: ../../c-api/type.rst:132 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" -#: ../../c-api/type.rst:135 +#: ../../c-api/type.rst:138 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" -#: ../../c-api/type.rst:141 +#: ../../c-api/type.rst:144 msgid "Return true if *a* is a subtype of *b*." msgstr "" -#: ../../c-api/type.rst:143 +#: ../../c-api/type.rst:146 msgid "" "This function only checks for actual subtypes, which means that :meth:`~type." "__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " "to do the same check that :func:`issubclass` would do." msgstr "" -#: ../../c-api/type.rst:151 +#: ../../c-api/type.rst:154 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " "object. Use Python's default memory allocation mechanism to allocate a new " "instance and initialize all its contents to ``NULL``." msgstr "" -#: ../../c-api/type.rst:157 +#: ../../c-api/type.rst:160 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " "object. Create a new instance using the type's :c:member:`~PyTypeObject." "tp_alloc` slot." msgstr "" -#: ../../c-api/type.rst:162 +#: ../../c-api/type.rst:165 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -184,7 +190,7 @@ msgid "" "and sets an exception on error." msgstr "" -#: ../../c-api/type.rst:168 +#: ../../c-api/type.rst:171 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -195,32 +201,32 @@ msgid "" "handle." msgstr "" -#: ../../c-api/type.rst:178 +#: ../../c-api/type.rst:181 msgid "" "Return the type's name. Equivalent to getting the type's :attr:`~type." "__name__` attribute." msgstr "" -#: ../../c-api/type.rst:185 +#: ../../c-api/type.rst:188 msgid "" "Return the type's qualified name. Equivalent to getting the type's :attr:" "`~type.__qualname__` attribute." msgstr "" -#: ../../c-api/type.rst:192 +#: ../../c-api/type.rst:195 msgid "" "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." "{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." "__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -#: ../../c-api/type.rst:200 +#: ../../c-api/type.rst:203 msgid "" "Return the type's module name. Equivalent to getting the :attr:`type." "__module__` attribute." msgstr "" -#: ../../c-api/type.rst:207 +#: ../../c-api/type.rst:210 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -228,30 +234,30 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:213 +#: ../../c-api/type.rst:216 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:217 +#: ../../c-api/type.rst:220 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:223 +#: ../../c-api/type.rst:226 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:226 ../../c-api/type.rst:246 +#: ../../c-api/type.rst:229 ../../c-api/type.rst:249 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:229 +#: ../../c-api/type.rst:232 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -262,31 +268,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:242 +#: ../../c-api/type.rst:245 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:249 +#: ../../c-api/type.rst:252 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:256 +#: ../../c-api/type.rst:259 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:259 +#: ../../c-api/type.rst:262 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:261 +#: ../../c-api/type.rst:264 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -295,40 +301,40 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: ../../c-api/type.rst:271 +#: ../../c-api/type.rst:274 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:273 +#: ../../c-api/type.rst:276 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:280 +#: ../../c-api/type.rst:283 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:282 +#: ../../c-api/type.rst:285 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:287 +#: ../../c-api/type.rst:290 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:290 +#: ../../c-api/type.rst:293 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:294 +#: ../../c-api/type.rst:297 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " @@ -337,7 +343,7 @@ msgid "" "deprecated and in Python 3.14+ such metaclasses will not be supported.)" msgstr "" -#: ../../c-api/type.rst:301 +#: ../../c-api/type.rst:304 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -346,7 +352,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:307 +#: ../../c-api/type.rst:310 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -355,11 +361,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:314 +#: ../../c-api/type.rst:317 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:316 +#: ../../c-api/type.rst:319 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -368,41 +374,41 @@ msgid "" "Specifically:" msgstr "" -#: ../../c-api/type.rst:323 +#: ../../c-api/type.rst:326 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:325 +#: ../../c-api/type.rst:328 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:326 +#: ../../c-api/type.rst:329 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:327 +#: ../../c-api/type.rst:330 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:333 +#: ../../c-api/type.rst:336 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:339 +#: ../../c-api/type.rst:342 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:344 ../../c-api/type.rst:361 +#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 ../../c-api/type.rst:380 +#: ../../c-api/type.rst:350 ../../c-api/type.rst:367 ../../c-api/type.rst:383 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " @@ -410,60 +416,62 @@ msgid "" "it will be no longer allowed." msgstr "" -#: ../../c-api/type.rst:355 +#: ../../c-api/type.rst:358 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:372 +#: ../../c-api/type.rst:375 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:376 +#: ../../c-api/type.rst:379 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:397 +#: ../../c-api/type.rst:400 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:401 +#: ../../c-api/type.rst:404 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:405 +#: ../../c-api/type.rst:408 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:408 +#: ../../c-api/type.rst:411 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:411 +#: ../../c-api/type.rst:414 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" "`PyObject_GetTypeData` to get a pointer to subclass-specific memory reserved " -"this way." +"this way. For negative :c:member:`!basicsize`, Python will insert padding " +"when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s alignment " +"requirements." msgstr "" -#: ../../c-api/type.rst:418 +#: ../../c-api/type.rst:424 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:422 +#: ../../c-api/type.rst:428 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: ../../c-api/type.rst:426 +#: ../../c-api/type.rst:432 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -472,58 +480,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:433 +#: ../../c-api/type.rst:439 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:435 +#: ../../c-api/type.rst:441 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:437 +#: ../../c-api/type.rst:443 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:440 +#: ../../c-api/type.rst:446 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:444 +#: ../../c-api/type.rst:450 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:446 +#: ../../c-api/type.rst:452 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:451 +#: ../../c-api/type.rst:457 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:454 +#: ../../c-api/type.rst:460 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:464 +#: ../../c-api/type.rst:470 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:469 +#: ../../c-api/type.rst:475 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:471 +#: ../../c-api/type.rst:477 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -531,30 +539,30 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:477 +#: ../../c-api/type.rst:483 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:478 +#: ../../c-api/type.rst:484 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:479 +#: ../../c-api/type.rst:485 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:481 +#: ../../c-api/type.rst:487 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:483 +#: ../../c-api/type.rst:489 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:485 +#: ../../c-api/type.rst:491 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" @@ -562,7 +570,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:487 +#: ../../c-api/type.rst:493 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" @@ -570,7 +578,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:491 +#: ../../c-api/type.rst:497 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" @@ -578,48 +586,48 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../c-api/type.rst:497 +#: ../../c-api/type.rst:503 msgid "The following fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:499 +#: ../../c-api/type.rst:505 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." "tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" msgstr "" -#: ../../c-api/type.rst:503 +#: ../../c-api/type.rst:509 msgid "" "Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." "tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." "tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:510 +#: ../../c-api/type.rst:516 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:517 +#: ../../c-api/type.rst:521 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:519 +#: ../../c-api/type.rst:524 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: ../../c-api/type.rst:526 +#: ../../c-api/type.rst:531 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:529 +#: ../../c-api/type.rst:534 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 2b7e6341f3..3ffb4c871b 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,8 +18,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../c-api/typeobj.rst:6 -msgid "Type Objects" -msgstr "型別物件" +msgid "Type Object Structures" +msgstr "型別物件結構" #: ../../c-api/typeobj.rst:8 msgid "" @@ -45,8 +45,8 @@ msgstr "" #: ../../c-api/typeobj.rst:23 msgid "" "In addition to the following quick reference, the :ref:`typedef-examples` " -"section provides at-a-glance insight into the meaning and use of :c:type:" -"`PyTypeObject`." +"section provides at-a-glance insight into the meaning and use " +"of :c:type:`PyTypeObject`." msgstr "" #: ../../c-api/typeobj.rst:29 @@ -1171,9 +1171,9 @@ msgstr "" #: ../../c-api/typeobj.rst:475 msgid "" -"The structure definition for :c:type:`PyTypeObject` can be found in :file:" -"`Include/object.h`. For convenience of reference, this repeats the " -"definition found there:" +"The structure definition for :c:type:`PyTypeObject` can be found " +"in :file:`Include/cpython/object.h`. For convenience of reference, this " +"repeats the definition found there:" msgstr "" #: ../../c-api/typeobj.rst:481 @@ -1272,11 +1272,12 @@ msgstr "" #: ../../c-api/typeobj.rst:487 msgid "" -"The type object structure extends the :c:type:`PyVarObject` structure. The :" -"c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" -"c:func:`!type_new`, usually called from a class statement). Note that :c:" -"data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject." -"tp_itemsize`, which means that its instances (i.e. type objects) *must* have " +"The type object structure extends the :c:type:`PyVarObject` structure. " +"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " +"(created by :c:func:`!type_new`, usually called from a class statement). " +"Note that :c:data:`PyType_Type` (the metatype) " +"initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its " +"instances (i.e. type objects) *must* have " "the :c:member:`~PyVarObject.ob_size` field." msgstr "" @@ -1284,49 +1285,49 @@ msgstr "" msgid "" "This is the type object's reference count, initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " -"objects `, the type's instances (objects whose :c:member:" -"`~PyObject.ob_type` points back to the type) do *not* count as references. " -"But for :ref:`dynamically allocated type objects `, the " -"instances *do* count as references." +"objects `, the type's instances (objects " +"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " +"as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." msgstr "" #: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 -#: ../../c-api/typeobj.rst:540 ../../c-api/typeobj.rst:584 -#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:699 -#: ../../c-api/typeobj.rst:740 ../../c-api/typeobj.rst:757 -#: ../../c-api/typeobj.rst:774 ../../c-api/typeobj.rst:792 -#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:833 -#: ../../c-api/typeobj.rst:845 ../../c-api/typeobj.rst:857 -#: ../../c-api/typeobj.rst:890 ../../c-api/typeobj.rst:912 -#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:953 -#: ../../c-api/typeobj.rst:979 ../../c-api/typeobj.rst:998 -#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1053 -#: ../../c-api/typeobj.rst:1064 ../../c-api/typeobj.rst:1074 -#: ../../c-api/typeobj.rst:1084 ../../c-api/typeobj.rst:1098 -#: ../../c-api/typeobj.rst:1116 ../../c-api/typeobj.rst:1139 -#: ../../c-api/typeobj.rst:1157 ../../c-api/typeobj.rst:1170 -#: ../../c-api/typeobj.rst:1192 ../../c-api/typeobj.rst:1236 -#: ../../c-api/typeobj.rst:1257 ../../c-api/typeobj.rst:1276 -#: ../../c-api/typeobj.rst:1306 ../../c-api/typeobj.rst:1328 -#: ../../c-api/typeobj.rst:1354 ../../c-api/typeobj.rst:1439 -#: ../../c-api/typeobj.rst:1513 ../../c-api/typeobj.rst:1574 -#: ../../c-api/typeobj.rst:1610 ../../c-api/typeobj.rst:1635 -#: ../../c-api/typeobj.rst:1658 ../../c-api/typeobj.rst:1671 -#: ../../c-api/typeobj.rst:1686 ../../c-api/typeobj.rst:1700 -#: ../../c-api/typeobj.rst:1730 ../../c-api/typeobj.rst:1762 -#: ../../c-api/typeobj.rst:1788 ../../c-api/typeobj.rst:1806 -#: ../../c-api/typeobj.rst:1835 ../../c-api/typeobj.rst:1879 -#: ../../c-api/typeobj.rst:1896 ../../c-api/typeobj.rst:1937 -#: ../../c-api/typeobj.rst:1959 ../../c-api/typeobj.rst:1991 -#: ../../c-api/typeobj.rst:2019 ../../c-api/typeobj.rst:2032 -#: ../../c-api/typeobj.rst:2042 ../../c-api/typeobj.rst:2059 -#: ../../c-api/typeobj.rst:2076 ../../c-api/typeobj.rst:2090 -#: ../../c-api/typeobj.rst:2125 ../../c-api/typeobj.rst:2148 +#: ../../c-api/typeobj.rst:543 ../../c-api/typeobj.rst:587 +#: ../../c-api/typeobj.rst:665 ../../c-api/typeobj.rst:741 +#: ../../c-api/typeobj.rst:782 ../../c-api/typeobj.rst:799 +#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:834 +#: ../../c-api/typeobj.rst:858 ../../c-api/typeobj.rst:875 +#: ../../c-api/typeobj.rst:887 ../../c-api/typeobj.rst:899 +#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:954 +#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:995 +#: ../../c-api/typeobj.rst:1021 ../../c-api/typeobj.rst:1040 +#: ../../c-api/typeobj.rst:1056 ../../c-api/typeobj.rst:1095 +#: ../../c-api/typeobj.rst:1106 ../../c-api/typeobj.rst:1116 +#: ../../c-api/typeobj.rst:1126 ../../c-api/typeobj.rst:1140 +#: ../../c-api/typeobj.rst:1158 ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1199 ../../c-api/typeobj.rst:1212 +#: ../../c-api/typeobj.rst:1234 ../../c-api/typeobj.rst:1278 +#: ../../c-api/typeobj.rst:1299 ../../c-api/typeobj.rst:1318 +#: ../../c-api/typeobj.rst:1348 ../../c-api/typeobj.rst:1370 +#: ../../c-api/typeobj.rst:1396 ../../c-api/typeobj.rst:1481 +#: ../../c-api/typeobj.rst:1555 ../../c-api/typeobj.rst:1616 +#: ../../c-api/typeobj.rst:1652 ../../c-api/typeobj.rst:1677 +#: ../../c-api/typeobj.rst:1700 ../../c-api/typeobj.rst:1713 +#: ../../c-api/typeobj.rst:1728 ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:1772 ../../c-api/typeobj.rst:1804 +#: ../../c-api/typeobj.rst:1830 ../../c-api/typeobj.rst:1848 +#: ../../c-api/typeobj.rst:1877 ../../c-api/typeobj.rst:1921 +#: ../../c-api/typeobj.rst:1938 ../../c-api/typeobj.rst:1979 +#: ../../c-api/typeobj.rst:2001 ../../c-api/typeobj.rst:2033 +#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2074 +#: ../../c-api/typeobj.rst:2084 ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2118 ../../c-api/typeobj.rst:2132 +#: ../../c-api/typeobj.rst:2165 ../../c-api/typeobj.rst:2188 msgid "**Inheritance:**" msgstr "" -#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:542 -#: ../../c-api/typeobj.rst:586 +#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:545 +#: ../../c-api/typeobj.rst:589 msgid "This field is not inherited by subtypes." msgstr "" @@ -1348,18 +1349,19 @@ msgstr "Foo_Type.ob_type = &PyType_Type;" #: ../../c-api/typeobj.rst:521 msgid "" -"This should be done before any instances of the type are created. :c:func:" -"`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " -"so, initializes it to the :c:member:`~PyObject.ob_type` field of the base " -"class. :c:func:`PyType_Ready` will not change this field if it is non-zero." +"This should be done before any instances of the type are " +"created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is " +"``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` " +"field of the base class. :c:func:`PyType_Ready` will not change this field " +"if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:701 -#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:914 -#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1637 -#: ../../c-api/typeobj.rst:1660 ../../c-api/typeobj.rst:1790 -#: ../../c-api/typeobj.rst:1808 ../../c-api/typeobj.rst:1881 -#: ../../c-api/typeobj.rst:1993 ../../c-api/typeobj.rst:2127 +#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:743 +#: ../../c-api/typeobj.rst:860 ../../c-api/typeobj.rst:956 +#: ../../c-api/typeobj.rst:976 ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1702 ../../c-api/typeobj.rst:1832 +#: ../../c-api/typeobj.rst:1850 ../../c-api/typeobj.rst:1923 +#: ../../c-api/typeobj.rst:2035 ../../c-api/typeobj.rst:2167 msgid "This field is inherited by subtypes." msgstr "" @@ -1374,38 +1376,45 @@ msgid "" "types>`, this field has a special internal meaning." msgstr "" -#: ../../c-api/typeobj.rst:546 +#: ../../c-api/typeobj.rst:540 +msgid "" +"This field should be accessed using the :c:func:`Py_SIZE()` " +"and :c:func:`Py_SET_SIZE()` macros." +msgstr "" + +#: ../../c-api/typeobj.rst:549 msgid "PyTypeObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:548 +#: ../../c-api/typeobj.rst:551 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " -"\"Default\" section. (Note that many fields set on :c:data:" -"`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" +"\"Default\" section. (Note that many fields set " +"on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as " +"defaults.)" msgstr "" -#: ../../c-api/typeobj.rst:555 +#: ../../c-api/typeobj.rst:558 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " "module name, followed by a dot, followed by the type name; for built-in " "types, it should be just the type name. If the module is a submodule of a " "package, the full package name is part of the full module name. For " -"example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :" -"mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." -"tp_name` initializer ``\"P.Q.M.T\"``." +"example, a type named :class:`!T` defined in module :mod:`!M` in " +"subpackage :mod:`!Q` in package :mod:`!P` should have " +"the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: ../../c-api/typeobj.rst:563 +#: ../../c-api/typeobj.rst:566 msgid "" "For :ref:`dynamically allocated type objects `, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: ../../c-api/typeobj.rst:568 +#: ../../c-api/typeobj.rst:571 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " @@ -1413,90 +1422,147 @@ msgid "" "the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -#: ../../c-api/typeobj.rst:574 +#: ../../c-api/typeobj.rst:577 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" -"`~type.__module__` attribute is undefined (unless explicitly set in the " -"dictionary, as explained above). This means your type will be impossible to " -"pickle. Additionally, it will not be listed in module documentations " -"created with pydoc." +"made accessible as the :attr:`~type.__name__` attribute, and " +"the :attr:`~type.__module__` attribute is undefined (unless explicitly set " +"in the dictionary, as explained above). This means your type will be " +"impossible to pickle. Additionally, it will not be listed in module " +"documentations created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:580 +#: ../../c-api/typeobj.rst:583 msgid "" -"This field must not be ``NULL``. It is the only required field in :c:func:" -"`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." -"tp_itemsize`)." +"This field must not be ``NULL``. It is the only required field " +"in :c:func:`PyTypeObject` (other than " +"potentially :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/typeobj.rst:592 +#: ../../c-api/typeobj.rst:595 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:594 +#: ../../c-api/typeobj.rst:597 msgid "" -"There are two kinds of types: types with fixed-length instances have a zero :" -"c:member:`~PyTypeObject.tp_itemsize` field, types with variable-length " -"instances have a non-zero :c:member:`~PyTypeObject.tp_itemsize` field. For " -"a type with fixed-length instances, all instances have the same size, given " -"in :c:member:`~PyTypeObject.tp_basicsize`." +"There are two kinds of types: types with fixed-length instances have a " +"zero :c:member:`!tp_itemsize` field, types with variable-length instances " +"have a non-zero :c:member:`!tp_itemsize` field. For a type with fixed-" +"length instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made " +"using :c:func:`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" -#: ../../c-api/typeobj.rst:599 +#: ../../c-api/typeobj.rst:604 msgid "" -"For a type with variable-length instances, the instances must have an :c:" -"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:" -"`~PyTypeObject.tp_basicsize` plus N times :c:member:`~PyTypeObject." -"tp_itemsize`, where N is the \"length\" of the object. The value of N is " -"typically stored in the instance's :c:member:`~PyVarObject.ob_size` field. " -"There are exceptions: for example, ints use a negative :c:member:" -"`~PyVarObject.ob_size` to indicate a negative number, and N is " -"``abs(ob_size)`` there. Also, the presence of an :c:member:`~PyVarObject." -"ob_size` field in the instance layout doesn't mean that the instance " -"structure is variable-length (for example, the structure for the list type " -"has fixed-length instances, yet those instances have a meaningful :c:member:" -"`~PyVarObject.ob_size` field)." +"For a type with variable-length instances, the instances must have " +"an :c:member:`~PyVarObject.ob_size` field, and the instance size " +"is :c:member:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N " +"is the \"length\" of the object." msgstr "" -#: ../../c-api/typeobj.rst:610 +#: ../../c-api/typeobj.rst:609 msgid "" -"The basic size includes the fields in the instance declared by the macro :c:" -"macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to " -"declare the instance struct) and this in turn includes the :c:member:" -"`~PyObject._ob_prev` and :c:member:`~PyObject._ob_next` fields if they are " -"present. This means that the only correct way to get an initializer for " -"the :c:member:`~PyTypeObject.tp_basicsize` is to use the ``sizeof`` operator " -"on the struct used to declare the instance layout. The basic size does not " -"include the GC header size." +"Functions like :c:func:`PyObject_NewVar` will take the value of N as an " +"argument, and store in the instance's :c:member:`~PyVarObject.ob_size` " +"field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " +"used for other purposes. For example, :py:type:`int` instances use the bits " +"of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " +"underlying storage and its size should be accessed " +"using :c:func:`PyLong_Export`." msgstr "" -#: ../../c-api/typeobj.rst:618 +#: ../../c-api/typeobj.rst:619 msgid "" -"A note about alignment: if the variable items require a particular " -"alignment, this should be taken care of by the value of :c:member:" -"`~PyTypeObject.tp_basicsize`. Example: suppose a type implements an array " -"of ``double``. :c:member:`~PyTypeObject.tp_itemsize` is ``sizeof(double)``. " -"It is the programmer's responsibility that :c:member:`~PyTypeObject." -"tp_basicsize` is a multiple of ``sizeof(double)`` (assuming this is the " -"alignment requirement for ``double``)." +"The :c:member:`~PyVarObject.ob_size` field should be accessed using " +"the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" -#: ../../c-api/typeobj.rst:625 +#: ../../c-api/typeobj.rst:622 msgid "" -"For any type with variable-length instances, this field must not be ``NULL``." +"Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " +"instance layout doesn't mean that the instance structure is variable-length. " +"For example, the :py:type:`list` type has fixed-length instances, yet those " +"instances have a :c:member:`~PyVarObject.ob_size` field. (As " +"with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. " +"Call :c:func:`PyList_Size` instead.)" msgstr "" #: ../../c-api/typeobj.rst:629 msgid "" -"These fields are inherited separately by subtypes. If the base type has a " -"non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to " -"set :c:member:`~PyTypeObject.tp_itemsize` to a different non-zero value in a " -"subtype (though this depends on the implementation of the base type)." +"The :c:member:`!tp_basicsize` includes size needed for data of the " +"type's :c:member:`~PyTypeObject.tp_base`, plus any extra data needed by each " +"instance." +msgstr "" + +#: ../../c-api/typeobj.rst:633 +msgid "" +"The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " +"operator on the struct used to declare the instance layout. This struct must " +"include the struct used to declare the base type. In other " +"words, :c:member:`!tp_basicsize` must be greater than or equal to the " +"base's :c:member:`!tp_basicsize`." +msgstr "" + +#: ../../c-api/typeobj.rst:639 +msgid "" +"Since every type is a subtype of :py:type:`object`, this struct must " +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on " +"whether :c:member:`~PyVarObject.ob_size` should be included). These are " +"usually defined by the macro :c:macro:`PyObject_HEAD` " +"or :c:macro:`PyObject_VAR_HEAD`, respectively." +msgstr "" + +#: ../../c-api/typeobj.rst:645 +msgid "" +"The basic size does not include the GC header size, as that header is not " +"part of :c:macro:`PyObject_HEAD`." +msgstr "" + +#: ../../c-api/typeobj.rst:648 +msgid "" +"For cases where struct used to declare the base type is unknown, " +"see :c:member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." +msgstr "" + +#: ../../c-api/typeobj.rst:651 +msgid "Notes about alignment:" +msgstr "" + +#: ../../c-api/typeobj.rst:653 +msgid "" +":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " +"using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " +"recommended, the compiler ensures this. When not using a C ``struct``, or " +"when using compiler extensions like ``__attribute__((packed))``, it is up to " +"you." +msgstr "" + +#: ../../c-api/typeobj.rst:658 +msgid "" +"If the variable items require a particular alignment, :c:member:`!" +"tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " +"alignment. For example, if a type's variable part stores a ``double``, it is " +"your responsibility that both fields are a multiple of ``_Alignof(double)``." +msgstr "" + +#: ../../c-api/typeobj.rst:667 +msgid "" +"These fields are inherited separately by subtypes. (That is, if the field is " +"set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " +"indicating that the instances do not need additional storage.)" msgstr "" -#: ../../c-api/typeobj.rst:637 +#: ../../c-api/typeobj.rst:672 +msgid "" +"If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " +"generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " +"different non-zero value in a subtype (though this depends on the " +"implementation of the base type)." +msgstr "" + +#: ../../c-api/typeobj.rst:679 msgid "" "A pointer to the instance destructor function. This function must be " "defined unless the type guarantees that its instances will never be " @@ -1504,36 +1570,38 @@ msgid "" "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:641 +#: ../../c-api/typeobj.rst:683 msgid "void tp_dealloc(PyObject *self);" msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:643 -msgid "" -"The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" -"`Py_XDECREF` macros when the new reference count is zero. At this point, " -"the instance is still in existence, but there are no references to it. The " -"destructor function should free all references which the instance owns, free " -"all memory buffers owned by the instance (using the freeing function " -"corresponding to the allocation function used to allocate the buffer), and " -"call the type's :c:member:`~PyTypeObject.tp_free` function. If the type is " -"not subtypable (doesn't have the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit " -"set), it is permissible to call the object deallocator directly instead of " +#: ../../c-api/typeobj.rst:685 +msgid "" +"The destructor function is called by the :c:func:`Py_DECREF` " +"and :c:func:`Py_XDECREF` macros when the new reference count is zero. At " +"this point, the instance is still in existence, but there are no references " +"to it. The destructor function should free all references which the " +"instance owns, free all memory buffers owned by the instance (using the " +"freeing function corresponding to the allocation function used to allocate " +"the buffer), and call the type's :c:member:`~PyTypeObject.tp_free` " +"function. If the type is not subtypable (doesn't have " +"the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit set), it is permissible to call " +"the object deallocator directly instead of " "via :c:member:`~PyTypeObject.tp_free`. The object deallocator should be the " "one used to allocate the instance; this is normally :c:func:`PyObject_Del` " -"if the instance was allocated using :c:macro:`PyObject_New` or :c:macro:" -"`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance was " -"allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." +"if the instance was allocated using :c:macro:`PyObject_New` " +"or :c:macro:`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance " +"was allocated using :c:macro:`PyObject_GC_New` " +"or :c:macro:`PyObject_GC_NewVar`." msgstr "" -#: ../../c-api/typeobj.rst:658 +#: ../../c-api/typeobj.rst:700 msgid "" -"If the type supports garbage collection (has the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" -"`PyObject_GC_UnTrack` before clearing any member fields." +"If the type supports garbage collection (has " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should " +"call :c:func:`PyObject_GC_UnTrack` before clearing any member fields." msgstr "" -#: ../../c-api/typeobj.rst:662 +#: ../../c-api/typeobj.rst:704 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyObject_GC_UnTrack(self);\n" @@ -1547,15 +1615,15 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *)self);\n" "}" -#: ../../c-api/typeobj.rst:670 +#: ../../c-api/typeobj.rst:712 msgid "" "Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " -"deallocator should release the owned reference to its type object (via :c:" -"func:`Py_DECREF`) after calling the type deallocator. In order to avoid " -"dangling pointers, the recommended way to achieve this is:" +"deallocator should release the owned reference to its type object " +"(via :c:func:`Py_DECREF`) after calling the type deallocator. In order to " +"avoid dangling pointers, the recommended way to achieve this is:" msgstr "" -#: ../../c-api/typeobj.rst:676 +#: ../../c-api/typeobj.rst:718 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyTypeObject *tp = Py_TYPE(self);\n" @@ -1565,7 +1633,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:687 +#: ../../c-api/typeobj.rst:729 msgid "" "In a garbage collected Python, :c:member:`!tp_dealloc` may be called from " "any Python thread, not just the thread which created the object (if the " @@ -1574,68 +1642,69 @@ msgid "" "calls, since the thread on which :c:member:`!tp_dealloc` is called will own " "the Global Interpreter Lock (GIL). However, if the object being destroyed " "in turn destroys objects from some other C or C++ library, care should be " -"taken to ensure that destroying those objects on the thread which called :c:" -"member:`!tp_dealloc` will not violate any assumptions of the library." +"taken to ensure that destroying those objects on the thread which " +"called :c:member:`!tp_dealloc` will not violate any assumptions of the " +"library." msgstr "" -#: ../../c-api/typeobj.rst:706 +#: ../../c-api/typeobj.rst:748 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:711 +#: ../../c-api/typeobj.rst:753 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:715 +#: ../../c-api/typeobj.rst:757 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:719 +#: ../../c-api/typeobj.rst:761 msgid "" -"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" -"`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " -"*vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:" -"`PyVectorcall_Call`." +"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also " +"set :c:member:`~PyTypeObject.tp_call` and make sure its behaviour is " +"consistent with the *vectorcallfunc* function. This can be done by setting " +"*tp_call* to :c:func:`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:726 +#: ../../c-api/typeobj.rst:768 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:732 +#: ../../c-api/typeobj.rst:774 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " -"` to implement the vectorcall protocol. When a user sets :attr:" -"`~object.__call__` in Python code, only *tp_call* is updated, likely making " -"it inconsistent with the vectorcall function. Since 3.12, setting " -"``__call__`` will disable vectorcall optimization by clearing the :c:macro:" -"`Py_TPFLAGS_HAVE_VECTORCALL` flag." +"` to implement the vectorcall protocol. When a user " +"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " +"likely making it inconsistent with the vectorcall function. Since 3.12, " +"setting ``__call__`` will disable vectorcall optimization by clearing " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:742 +#: ../../c-api/typeobj.rst:784 msgid "" -"This field is always inherited. However, the :c:macro:" -"`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " -"then the subclass won't use :ref:`vectorcall `, except when :c:" -"func:`PyVectorcall_Call` is explicitly called." +"This field is always inherited. However, " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If " +"it's not set, then the subclass won't use :ref:`vectorcall `, " +"except when :c:func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:751 +#: ../../c-api/typeobj.rst:793 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:753 +#: ../../c-api/typeobj.rst:795 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1643,29 +1712,28 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:759 ../../c-api/typeobj.rst:955 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." -"tp_getattro`" +#: ../../c-api/typeobj.rst:801 ../../c-api/typeobj.rst:997 +msgid "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject.tp_getattro`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." -"tp_getattro`" +"群" +"組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject.tp_getattro`" -#: ../../c-api/typeobj.rst:761 +#: ../../c-api/typeobj.rst:803 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:768 ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:810 ../../c-api/typeobj.rst:1010 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:770 +#: ../../c-api/typeobj.rst:812 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1673,55 +1741,54 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:776 ../../c-api/typeobj.rst:981 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." -"tp_setattro`" +#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:1023 +msgid "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject.tp_setattro`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." -"tp_setattro`" +"群" +"組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject.tp_setattro`" -#: ../../c-api/typeobj.rst:778 +#: ../../c-api/typeobj.rst:820 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:785 +#: ../../c-api/typeobj.rst:827 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:789 +#: ../../c-api/typeobj.rst:831 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:836 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:802 +#: ../../c-api/typeobj.rst:844 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`repr`." +"An optional pointer to a function that implements the built-in " +"function :func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:805 +#: ../../c-api/typeobj.rst:847 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:807 +#: ../../c-api/typeobj.rst:849 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:851 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1730,153 +1797,152 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:820 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:936 ../../c-api/typeobj.rst:961 -#: ../../c-api/typeobj.rst:987 ../../c-api/typeobj.rst:1028 -#: ../../c-api/typeobj.rst:1583 ../../c-api/typeobj.rst:1617 -#: ../../c-api/typeobj.rst:1734 ../../c-api/typeobj.rst:1767 -#: ../../c-api/typeobj.rst:1842 ../../c-api/typeobj.rst:1883 -#: ../../c-api/typeobj.rst:1901 ../../c-api/typeobj.rst:1943 -#: ../../c-api/typeobj.rst:1964 ../../c-api/typeobj.rst:1995 +#: ../../c-api/typeobj.rst:862 ../../c-api/typeobj.rst:941 +#: ../../c-api/typeobj.rst:978 ../../c-api/typeobj.rst:1003 +#: ../../c-api/typeobj.rst:1029 ../../c-api/typeobj.rst:1070 +#: ../../c-api/typeobj.rst:1625 ../../c-api/typeobj.rst:1659 +#: ../../c-api/typeobj.rst:1776 ../../c-api/typeobj.rst:1809 +#: ../../c-api/typeobj.rst:1884 ../../c-api/typeobj.rst:1925 +#: ../../c-api/typeobj.rst:1943 ../../c-api/typeobj.rst:1985 +#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2037 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:822 +#: ../../c-api/typeobj.rst:864 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:829 +#: ../../c-api/typeobj.rst:871 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:835 +#: ../../c-api/typeobj.rst:877 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:841 +#: ../../c-api/typeobj.rst:883 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:847 +#: ../../c-api/typeobj.rst:889 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:853 +#: ../../c-api/typeobj.rst:895 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:859 +#: ../../c-api/typeobj.rst:901 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:867 +#: ../../c-api/typeobj.rst:909 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`hash`." +"An optional pointer to a function that implements the built-in " +"function :func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:870 +#: ../../c-api/typeobj.rst:912 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:872 +#: ../../c-api/typeobj.rst:914 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:874 +#: ../../c-api/typeobj.rst:916 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:878 +#: ../../c-api/typeobj.rst:920 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " -"is not set), an attempt to take the hash of the object raises :exc:" -"`TypeError`. This is the same as setting it to :c:func:" -"`PyObject_HashNotImplemented`." +"is not set), an attempt to take the hash of the object " +"raises :exc:`TypeError`. This is the same as setting it " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:882 +#: ../../c-api/typeobj.rst:924 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " "as the equivalent of ``__hash__ = None`` at the Python level, causing " "``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " "that the converse is also true - setting ``__hash__ = None`` on a class at " -"the Python level will result in the ``tp_hash`` slot being set to :c:func:" -"`PyObject_HashNotImplemented`." +"the Python level will result in the ``tp_hash`` slot being set " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:892 ../../c-api/typeobj.rst:1576 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." -"tp_richcompare`" +#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1618 +msgid "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject.tp_richcompare`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." -"tp_richcompare`" +"群" +"組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject.tp_richcompare`" -#: ../../c-api/typeobj.rst:894 +#: ../../c-api/typeobj.rst:936 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:" -"member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` " -"are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " +"of :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash`, when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:901 +#: ../../c-api/typeobj.rst:943 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -#: ../../c-api/typeobj.rst:906 +#: ../../c-api/typeobj.rst:948 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:910 +#: ../../c-api/typeobj.rst:952 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:919 +#: ../../c-api/typeobj.rst:961 msgid "" -"An optional pointer to a function that implements the built-in operation :" -"func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " -"the constructor for that type. This constructor calls :c:func:" -"`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call " -"this handler.)" +"An optional pointer to a function that implements the built-in " +"operation :func:`str`. (Note that :class:`str` is a type now, " +"and :func:`str` calls the constructor for that type. This constructor " +"calls :c:func:`PyObject_Str` to do the actual work, " +"and :c:func:`PyObject_Str` will call this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:924 +#: ../../c-api/typeobj.rst:966 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:926 +#: ../../c-api/typeobj.rst:968 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:928 +#: ../../c-api/typeobj.rst:970 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1884,99 +1950,101 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:938 +#: ../../c-api/typeobj.rst:980 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:944 +#: ../../c-api/typeobj.rst:986 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:946 +#: ../../c-api/typeobj.rst:988 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:948 +#: ../../c-api/typeobj.rst:990 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:950 +#: ../../c-api/typeobj.rst:992 msgid "" -"It is usually convenient to set this field to :c:func:" -"`PyObject_GenericGetAttr`, which implements the normal way of looking for " -"object attributes." +"It is usually convenient to set this field " +"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " +"looking for object attributes." msgstr "" -#: ../../c-api/typeobj.rst:957 +#: ../../c-api/typeobj.rst:999 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:963 +#: ../../c-api/typeobj.rst:1005 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:970 +#: ../../c-api/typeobj.rst:1012 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:972 +#: ../../c-api/typeobj.rst:1014 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:974 +#: ../../c-api/typeobj.rst:1016 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " -"supported. It is usually convenient to set this field to :c:func:" -"`PyObject_GenericSetAttr`, which implements the normal way of setting object " -"attributes." +"supported. It is usually convenient to set this field " +"to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of " +"setting object attributes." msgstr "" -#: ../../c-api/typeobj.rst:983 +#: ../../c-api/typeobj.rst:1025 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:989 +#: ../../c-api/typeobj.rst:1031 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:994 +#: ../../c-api/typeobj.rst:1036 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:1000 +#: ../../c-api/typeobj.rst:1042 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1006 +#: ../../c-api/typeobj.rst:1048 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " -"fields in the type object (or in the extension structures referenced via :c:" -"member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject." -"tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:" -"`~PyTypeObject.tp_as_buffer`) that were historically not always present are " -"valid; if such a flag bit is clear, the type fields it guards must not be " -"accessed and must be considered to have a zero or ``NULL`` value instead." +"fields in the type object (or in the extension structures referenced " +"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " +"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " +"always present are valid; if such a flag bit is clear, the type fields it " +"guards must not be accessed and must be considered to have a zero or " +"``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1016 +#: ../../c-api/typeobj.rst:1058 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -1985,14 +2053,14 @@ msgid "" "type's value of the flag bit is copied into the subtype together with a " "pointer to the extension structure. The :c:macro:`Py_TPFLAGS_HAVE_GC` flag " "bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" -"`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " -"the subtype exist and have ``NULL`` values. .. XXX are most flag bits " -"*really* inherited individually?" +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values. .. XXX are most flag bits *really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1030 +#: ../../c-api/typeobj.rst:1072 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -2000,20 +2068,20 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1033 +#: ../../c-api/typeobj.rst:1075 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1037 +#: ../../c-api/typeobj.rst:1079 msgid "" "The following bit masks are currently defined; these can be ORed together " -"using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." -"tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a " -"flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-" -"zero." +"using the ``|`` operator to form the value of " +"the :c:member:`~PyTypeObject.tp_flags` field. The " +"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " +"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:1044 +#: ../../c-api/typeobj.rst:1086 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2021,255 +2089,257 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" -"`support garbage collection ` as they can form a " -"reference cycle with their own module object." +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " +"also :ref:`support garbage collection ` as they " +"can form a reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1055 ../../c-api/typeobj.rst:1066 -#: ../../c-api/typeobj.rst:1076 ../../c-api/typeobj.rst:1086 -#: ../../c-api/typeobj.rst:1118 +#: ../../c-api/typeobj.rst:1097 ../../c-api/typeobj.rst:1108 +#: ../../c-api/typeobj.rst:1118 ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1160 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1060 +#: ../../c-api/typeobj.rst:1102 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1071 +#: ../../c-api/typeobj.rst:1113 msgid "" -"This bit is set when the type object has been fully initialized by :c:func:" -"`PyType_Ready`." +"This bit is set when the type object has been fully initialized " +"by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1081 +#: ../../c-api/typeobj.rst:1123 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1091 +#: ../../c-api/typeobj.rst:1133 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " -"destroyed using :c:func:`PyObject_GC_Del`. More information in section :ref:" -"`supporting-cycle-detection`. This bit also implies that the GC-related " -"fields :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject." -"tp_clear` are present in the type object." +"destroyed using :c:func:`PyObject_GC_Del`. More information in " +"section :ref:`supporting-cycle-detection`. This bit also implies that the " +"GC-related fields :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1100 ../../c-api/typeobj.rst:1441 -#: ../../c-api/typeobj.rst:1515 -msgid "" -"Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." -"tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" +#: ../../c-api/typeobj.rst:1142 ../../c-api/typeobj.rst:1483 +#: ../../c-api/typeobj.rst:1557 +msgid "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject.tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1102 +#: ../../c-api/typeobj.rst:1144 msgid "" -"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" -"member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " -"fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the " -"subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:" -"`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " -"values." +"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values." msgstr "" -#: ../../c-api/typeobj.rst:1112 +#: ../../c-api/typeobj.rst:1154 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1123 +#: ../../c-api/typeobj.rst:1165 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1125 +#: ../../c-api/typeobj.rst:1167 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1127 +#: ../../c-api/typeobj.rst:1169 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1130 +#: ../../c-api/typeobj.rst:1172 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1133 +#: ../../c-api/typeobj.rst:1175 msgid "" -"This flag enables an optimization for typical method calls like ``obj." -"meth()``: it avoids creating a temporary \"bound method\" object for ``obj." -"meth``." +"This flag enables an optimization for typical method calls like " +"``obj.meth()``: it avoids creating a temporary \"bound method\" object for " +"``obj.meth``." msgstr "" -#: ../../c-api/typeobj.rst:1141 +#: ../../c-api/typeobj.rst:1183 msgid "" -"This flag is never inherited by types without the :c:macro:" -"`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " -"whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." +"This flag is never inherited by types without " +"the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it " +"is inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1147 +#: ../../c-api/typeobj.rst:1189 msgid "" "This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1150 +#: ../../c-api/typeobj.rst:1192 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1152 +#: ../../c-api/typeobj.rst:1194 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -#: ../../c-api/typeobj.rst:1159 +#: ../../c-api/typeobj.rst:1201 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1165 +#: ../../c-api/typeobj.rst:1207 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1172 +#: ../../c-api/typeobj.rst:1214 msgid "" -"This flag is inherited unless the :c:member:`~PyTypeObject." -"tp_weaklistoffset` field is set in a superclass." +"This flag is inherited unless " +"the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1178 +#: ../../c-api/typeobj.rst:1220 msgid "" -"Only usable with variable-size types, i.e. ones with non-zero :c:member:" -"`~PyTypeObject.tp_itemsize`." +"Only usable with variable-size types, i.e. ones with non-" +"zero :c:member:`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1223 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1186 +#: ../../c-api/typeobj.rst:1228 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1194 +#: ../../c-api/typeobj.rst:1236 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1208 +#: ../../c-api/typeobj.rst:1250 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " "are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have their :c:member:`~PyTypeObject." -"tp_flags` set appropriately, or the code that interacts with such types will " -"behave differently depending on what kind of check is used." +"types that inherit from built-ins should have " +"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " +"interacts with such types will behave differently depending on what kind of " +"check is used." msgstr "" -#: ../../c-api/typeobj.rst:1219 +#: ../../c-api/typeobj.rst:1261 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1224 +#: ../../c-api/typeobj.rst:1266 msgid "" -"This flag isn't necessary anymore, as the interpreter assumes the :c:member:" -"`~PyTypeObject.tp_finalize` slot is always present in the type structure." +"This flag isn't necessary anymore, as the interpreter assumes " +"the :c:member:`~PyTypeObject.tp_finalize` slot is always present in the type " +"structure." msgstr "" -#: ../../c-api/typeobj.rst:1232 +#: ../../c-api/typeobj.rst:1274 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1238 +#: ../../c-api/typeobj.rst:1280 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1245 +#: ../../c-api/typeobj.rst:1287 msgid "" -"This flag is now removed from a class when the class's :py:meth:`~object." -"__call__` method is reassigned." +"This flag is now removed from a class when the " +"class's :py:meth:`~object.__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1248 +#: ../../c-api/typeobj.rst:1290 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1252 +#: ../../c-api/typeobj.rst:1294 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1254 +#: ../../c-api/typeobj.rst:1296 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1259 +#: ../../c-api/typeobj.rst:1301 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1265 +#: ../../c-api/typeobj.rst:1307 msgid "" -"Disallow creating instances of the type: set :c:member:`~PyTypeObject." -"tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." +"Disallow creating instances of the type: " +"set :c:member:`~PyTypeObject.tp_new` to NULL and don't create the " +"``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1269 +#: ../../c-api/typeobj.rst:1311 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1272 +#: ../../c-api/typeobj.rst:1314 msgid "" -"The flag is set automatically on :ref:`static types ` if :c:" -"member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" -"member:`~PyTypeObject.tp_new` is NULL." +"The flag is set automatically on :ref:`static types ` " +"if :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` " +"and :c:member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1278 +#: ../../c-api/typeobj.rst:1320 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1285 +#: ../../c-api/typeobj.rst:1327 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1296 +#: ../../c-api/typeobj.rst:1338 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2277,23 +2347,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1303 ../../c-api/typeobj.rst:1325 +#: ../../c-api/typeobj.rst:1345 ../../c-api/typeobj.rst:1367 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1308 +#: ../../c-api/typeobj.rst:1350 msgid "" -"This flag is inherited by types that do not already set :c:macro:" -"`Py_TPFLAGS_SEQUENCE`." +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1311 ../../c-api/typeobj.rst:1333 +#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1375 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1318 +#: ../../c-api/typeobj.rst:1360 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2301,63 +2371,63 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1330 +#: ../../c-api/typeobj.rst:1372 msgid "" -"This flag is inherited by types that do not already set :c:macro:" -"`Py_TPFLAGS_MAPPING`." +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1340 +#: ../../c-api/typeobj.rst:1382 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1344 +#: ../../c-api/typeobj.rst:1386 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1350 +#: ../../c-api/typeobj.rst:1392 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1356 +#: ../../c-api/typeobj.rst:1398 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1361 +#: ../../c-api/typeobj.rst:1403 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1364 +#: ../../c-api/typeobj.rst:1406 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1366 ../../c-api/typeobj.rst:1510 +#: ../../c-api/typeobj.rst:1408 ../../c-api/typeobj.rst:1552 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1369 +#: ../../c-api/typeobj.rst:1411 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " -"collector to detect reference cycles. A typical implementation of a :c:" -"member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` " -"on each of the instance's members that are Python objects that the instance " -"owns. For example, this is function :c:func:`!local_traverse` from the :mod:" -"`!_thread` extension module::" +"collector to detect reference cycles. A typical implementation of " +"a :c:member:`~PyTypeObject.tp_traverse` function simply " +"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " +"objects that the instance owns. For example, this is function :c:func:`!" +"local_traverse` from the :mod:`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1375 +#: ../../c-api/typeobj.rst:1417 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2377,7 +2447,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1384 +#: ../../c-api/typeobj.rst:1426 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2385,29 +2455,29 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1388 +#: ../../c-api/typeobj.rst:1430 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1392 +#: ../../c-api/typeobj.rst:1434 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1394 +#: ../../c-api/typeobj.rst:1436 msgid "Py_VISIT(Py_TYPE(self));" msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1396 +#: ../../c-api/typeobj.rst:1438 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1399 +#: ../../c-api/typeobj.rst:1441 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" @@ -2417,18 +2487,18 @@ msgstr "" " Py_VISIT(Py_TYPE(self));\n" "#endif" -#: ../../c-api/typeobj.rst:1403 +#: ../../c-api/typeobj.rst:1445 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" -"`PyObject_VisitManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " +"call :c:func:`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1407 +#: ../../c-api/typeobj.rst:1449 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1410 +#: ../../c-api/typeobj.rst:1452 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " -"their type. Their traversal function must therefore either visit :c:func:" -"`Py_TYPE(self) `, or delegate this responsibility by calling " -"``tp_traverse`` of another heap-allocated type (such as a heap-allocated " -"superclass). If they do not, the type object may not be garbage-collected." +"their type. Their traversal function must therefore either " +"visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by " +"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" +"allocated superclass). If they do not, the type object may not be garbage-" +"collected." msgstr "" -#: ../../c-api/typeobj.rst:1434 +#: ../../c-api/typeobj.rst:1476 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1443 +#: ../../c-api/typeobj.rst:1485 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" -"member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " -"are all inherited from the base type if they are all zero in the subtype." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_clear` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1451 +#: ../../c-api/typeobj.rst:1493 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1454 +#: ../../c-api/typeobj.rst:1496 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1456 +#: ../../c-api/typeobj.rst:1498 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2492,13 +2565,14 @@ msgid "" "doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For example, " "the tuple type does not implement a :c:member:`~PyTypeObject.tp_clear` " "function, because it's possible to prove that no reference cycle can be " -"composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." -"tp_clear` functions of other types must be sufficient to break any cycle " -"containing a tuple. This isn't immediately obvious, and there's rarely a " -"good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." +"composed entirely of tuples. Therefore " +"the :c:member:`~PyTypeObject.tp_clear` functions of other types must be " +"sufficient to break any cycle containing a tuple. This isn't immediately " +"obvious, and there's rarely a good reason to avoid " +"implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1466 +#: ../../c-api/typeobj.rst:1508 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2506,7 +2580,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1470 +#: ../../c-api/typeobj.rst:1512 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2528,12 +2602,12 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1480 +#: ../../c-api/typeobj.rst:1522 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " -"delicate: the reference to the contained object must not be released (via :" -"c:func:`Py_DECREF`) until after the pointer to the contained object is set " -"to ``NULL``. This is because releasing the reference may cause the " +"delicate: the reference to the contained object must not be released " +"(via :c:func:`Py_DECREF`) until after the pointer to the contained object is " +"set to ``NULL``. This is because releasing the reference may cause the " "contained object to become trash, triggering a chain of reclamation activity " "that may include invoking arbitrary Python code (due to finalizers, or " "weakref callbacks, associated with the contained object). If it's possible " @@ -2543,18 +2617,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1492 +#: ../../c-api/typeobj.rst:1534 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" -"`PyObject_ClearManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " +"call :c:func:`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1496 +#: ../../c-api/typeobj.rst:1538 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1498 +#: ../../c-api/typeobj.rst:1540 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2562,7 +2636,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1546 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2572,30 +2646,32 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1517 +#: ../../c-api/typeobj.rst:1559 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" -"c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " -"are all inherited from the base type if they are all zero in the subtype." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_traverse` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1525 +#: ../../c-api/typeobj.rst:1567 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1527 +#: ../../c-api/typeobj.rst:1569 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1529 +#: ../../c-api/typeobj.rst:1571 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1574 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2603,50 +2679,51 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1537 +#: ../../c-api/typeobj.rst:1579 msgid "" -"The following constants are defined to be used as the third argument for :c:" -"member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" +"The following constants are defined to be used as the third argument " +"for :c:member:`~PyTypeObject.tp_richcompare` and " +"for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1543 +#: ../../c-api/typeobj.rst:1585 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1543 +#: ../../c-api/typeobj.rst:1585 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1545 +#: ../../c-api/typeobj.rst:1587 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1547 +#: ../../c-api/typeobj.rst:1589 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1549 +#: ../../c-api/typeobj.rst:1591 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1551 +#: ../../c-api/typeobj.rst:1593 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1553 +#: ../../c-api/typeobj.rst:1595 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:1597 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1558 +#: ../../c-api/typeobj.rst:1600 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1562 +#: ../../c-api/typeobj.rst:1604 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2654,60 +2731,62 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1568 +#: ../../c-api/typeobj.rst:1610 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1570 +#: ../../c-api/typeobj.rst:1612 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1578 +#: ../../c-api/typeobj.rst:1620 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" -"member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_hash`: a subtype " +"inherits :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1585 +#: ../../c-api/typeobj.rst:1627 msgid "" -":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." -"tp_richcompare` implementation, which may be inherited. However, if only :c:" -"member:`~PyTypeObject.tp_hash` is defined, not even the inherited function " -"is used and instances of the type will not be able to participate in any " -"comparisons." +":c:data:`PyBaseObject_Type` provides " +"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " +"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " +"not even the inherited function is used and instances of the type will not " +"be able to participate in any comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1594 +#: ../../c-api/typeobj.rst:1636 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1597 +#: ../../c-api/typeobj.rst:1639 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " "weak reference list head (ignoring the GC header, if present); this offset " "is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " -"functions. The instance structure needs to include a field of type :c:expr:" -"`PyObject*` which is initialized to ``NULL``." +"functions. The instance structure needs to include a field of " +"type :c:expr:`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1604 +#: ../../c-api/typeobj.rst:1646 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1607 +#: ../../c-api/typeobj.rst:1649 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1612 +#: ../../c-api/typeobj.rst:1654 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2716,115 +2795,116 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1619 +#: ../../c-api/typeobj.rst:1661 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." -"tp_weaklistoffset` will be set to a negative value, to indicate that it is " -"unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative " +"value, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1627 +#: ../../c-api/typeobj.rst:1669 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " -"object. Its presence normally signals that the instances of this type are :" -"term:`iterable` (although sequences may be iterable without this function)." +"object. Its presence normally signals that the instances of this type " +"are :term:`iterable` (although sequences may be iterable without this " +"function)." msgstr "" -#: ../../c-api/typeobj.rst:1631 +#: ../../c-api/typeobj.rst:1673 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1633 +#: ../../c-api/typeobj.rst:1675 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1642 +#: ../../c-api/typeobj.rst:1684 msgid "" -"An optional pointer to a function that returns the next item in an :term:" -"`iterator`. The signature is::" +"An optional pointer to a function that returns the next item in " +"an :term:`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1645 +#: ../../c-api/typeobj.rst:1687 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1647 +#: ../../c-api/typeobj.rst:1689 msgid "" -"When the iterator is exhausted, it must return ``NULL``; a :exc:" -"`StopIteration` exception may or may not be set. When another error occurs, " -"it must return ``NULL`` too. Its presence signals that the instances of " -"this type are iterators." +"When the iterator is exhausted, it must return ``NULL``; " +"a :exc:`StopIteration` exception may or may not be set. When another error " +"occurs, it must return ``NULL`` too. Its presence signals that the " +"instances of this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1694 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1656 +#: ../../c-api/typeobj.rst:1698 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1665 +#: ../../c-api/typeobj.rst:1707 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMethodDef` structures, declaring regular methods of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1668 +#: ../../c-api/typeobj.rst:1710 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1673 +#: ../../c-api/typeobj.rst:1715 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1721 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMemberDef` structures, declaring regular data members (fields or slots) " -"of instances of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMemberDef` structures, declaring regular data members (fields " +"or slots) of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1683 +#: ../../c-api/typeobj.rst:1725 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1688 +#: ../../c-api/typeobj.rst:1730 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1694 +#: ../../c-api/typeobj.rst:1736 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyGetSetDef` structures, declaring computed attributes of instances of this " -"type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " +"instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1697 +#: ../../c-api/typeobj.rst:1739 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1702 +#: ../../c-api/typeobj.rst:1744 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1708 +#: ../../c-api/typeobj.rst:1750 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2832,7 +2912,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1716 +#: ../../c-api/typeobj.rst:1758 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2840,173 +2920,176 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1763 msgid "" -"However, the unary '&' operator applied to a non-static variable like :c:" -"data:`PyBaseObject_Type` is not required to produce an address constant. " -"Compilers may support this (gcc does), MSVC does not. Both compilers are " -"strictly standard conforming in this particular behavior." +"However, the unary '&' operator applied to a non-static variable " +"like :c:data:`PyBaseObject_Type` is not required to produce an address " +"constant. Compilers may support this (gcc does), MSVC does not. Both " +"compilers are strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1727 +#: ../../c-api/typeobj.rst:1769 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1732 +#: ../../c-api/typeobj.rst:1774 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1736 +#: ../../c-api/typeobj.rst:1778 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:1784 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1744 +#: ../../c-api/typeobj.rst:1786 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " "attributes for the type. Once :c:func:`PyType_Ready` has initialized the " "type, extra attributes for the type may be added to this dictionary only if " -"they don't correspond to overloaded operations (like :meth:`~object." -"__add__`). Once initialization for the type has finished, this field should " -"be treated as read-only." +"they don't correspond to overloaded operations " +"(like :meth:`~object.__add__`). Once initialization for the type has " +"finished, this field should be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1752 +#: ../../c-api/typeobj.rst:1794 msgid "" -"Some types may not store their dictionary in this slot. Use :c:func:" -"`PyType_GetDict` to retrieve the dictionary for an arbitrary type." +"Some types may not store their dictionary in this slot. " +"Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary " +"type." msgstr "" -#: ../../c-api/typeobj.rst:1758 +#: ../../c-api/typeobj.rst:1800 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " -"Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" -"func:`PyType_GetDict` to get the dict for an arbitrary type." +"Instead, the dict for such types is stored on ``PyInterpreterState``. " +"Use :c:func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1764 +#: ../../c-api/typeobj.rst:1806 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1769 +#: ../../c-api/typeobj.rst:1811 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1816 msgid "" -"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" -"member:`~PyTypeObject.tp_dict` with the dictionary C-API." +"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise " +"modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1780 +#: ../../c-api/typeobj.rst:1822 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1782 ../../c-api/typeobj.rst:1798 -#: ../../c-api/typeobj.rst:1862 ../../c-api/typeobj.rst:1892 -#: ../../c-api/typeobj.rst:1916 +#: ../../c-api/typeobj.rst:1824 ../../c-api/typeobj.rst:1840 +#: ../../c-api/typeobj.rst:1904 ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1958 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1784 +#: ../../c-api/typeobj.rst:1826 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1837 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1842 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1802 +#: ../../c-api/typeobj.rst:1844 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1813 +#: ../../c-api/typeobj.rst:1855 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1858 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " -"of the type of the instance variable dictionary; this offset is used by :c:" -"func:`PyObject_GenericGetAttr`." +"of the type of the instance variable dictionary; this offset is used " +"by :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1821 +#: ../../c-api/typeobj.rst:1863 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1824 +#: ../../c-api/typeobj.rst:1866 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1868 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" -"only. To get the pointer to the dictionary call :c:func:" -"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " -"need to allocate memory for the dictionary, so it is may be more efficient " -"to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +"only. To get the pointer to the dictionary " +"call :c:func:`PyObject_GenericGetDict`. " +"Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for " +"the dictionary, so it is may be more efficient to " +"call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1832 +#: ../../c-api/typeobj.rst:1874 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit " "and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1837 +#: ../../c-api/typeobj.rst:1879 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " -"at the previous offset. To properly support inheritance, use :c:macro:" -"`Py_TPFLAGS_MANAGED_DICT`." +"at the previous offset. To properly support inheritance, " +"use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1844 +#: ../../c-api/typeobj.rst:1886 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1847 +#: ../../c-api/typeobj.rst:1889 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " -"will be set to ``-1``, to indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_dictoffset` will be set to ``-1``, to " +"indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1855 +#: ../../c-api/typeobj.rst:1897 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1857 +#: ../../c-api/typeobj.rst:1899 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3014,110 +3097,112 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1906 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1866 +#: ../../c-api/typeobj.rst:1908 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " -"arguments represent positional and keyword arguments of the call to :meth:" -"`~object.__init__`." +"arguments represent positional and keyword arguments of the call " +"to :meth:`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1870 +#: ../../c-api/typeobj.rst:1912 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " -"when an instance is created normally by calling its type, after the type's :" -"c:member:`~PyTypeObject.tp_new` function has returned an instance of the " -"type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance " -"of some other type that is not a subtype of the original type, no :c:member:" -"`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject." -"tp_new` returns an instance of a subtype of the original type, the " -"subtype's :c:member:`~PyTypeObject.tp_init` is called." +"when an instance is created normally by calling its type, after the " +"type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of " +"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " +"instance of some other type that is not a subtype of the original type, " +"no :c:member:`~PyTypeObject.tp_init` function is called; " +"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " +"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1877 +#: ../../c-api/typeobj.rst:1919 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1885 +#: ../../c-api/typeobj.rst:1927 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:1932 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1894 +#: ../../c-api/typeobj.rst:1936 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1898 +#: ../../c-api/typeobj.rst:1940 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1903 +#: ../../c-api/typeobj.rst:1945 msgid "" -"For dynamic subtypes, this field is always set to :c:func:" -"`PyType_GenericAlloc`, to force a standard heap allocation strategy." +"For dynamic subtypes, this field is always set " +"to :c:func:`PyType_GenericAlloc`, to force a standard heap allocation " +"strategy." msgstr "" -#: ../../c-api/typeobj.rst:1907 +#: ../../c-api/typeobj.rst:1949 msgid "" -"For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" -"`PyType_GenericAlloc`. That is the recommended value for all statically " -"defined types." +"For static subtypes, :c:data:`PyBaseObject_Type` " +"uses :c:func:`PyType_GenericAlloc`. That is the recommended value for all " +"statically defined types." msgstr "" -#: ../../c-api/typeobj.rst:1914 +#: ../../c-api/typeobj.rst:1956 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1918 +#: ../../c-api/typeobj.rst:1960 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1920 +#: ../../c-api/typeobj.rst:1962 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " -"to the type. Note that *subtype* doesn't have to equal the type whose :c:" -"member:`~PyTypeObject.tp_new` function is called; it may be a subtype of " -"that type (but not an unrelated type)." +"to the type. Note that *subtype* doesn't have to equal the type " +"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " +"subtype of that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1968 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " "only as much further initialization as is absolutely necessary. " "Initialization that can safely be ignored or repeated should be placed in " "the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " -"for immutable types, all initialization should take place in :c:member:" -"`~PyTypeObject.tp_new`, while for mutable types, most initialization should " -"be deferred to :c:member:`~PyTypeObject.tp_init`." +"for immutable types, all initialization should take place " +"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " +"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1976 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1939 +#: ../../c-api/typeobj.rst:1981 msgid "" -"This field is inherited by subtypes, except it is not inherited by :ref:" -"`static types ` whose :c:member:`~PyTypeObject.tp_base` is " -"``NULL`` or ``&PyBaseObject_Type``." +"This field is inherited by subtypes, except it is not inherited " +"by :ref:`static types ` " +"whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or " +"``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1945 +#: ../../c-api/typeobj.rst:1987 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3125,142 +3210,142 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1953 +#: ../../c-api/typeobj.rst:1995 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1955 +#: ../../c-api/typeobj.rst:1997 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1957 +#: ../../c-api/typeobj.rst:1999 msgid "" -"An initializer that is compatible with this signature is :c:func:" -"`PyObject_Free`." +"An initializer that is compatible with this signature " +"is :c:func:`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1961 +#: ../../c-api/typeobj.rst:2003 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1966 +#: ../../c-api/typeobj.rst:2008 msgid "" -"In dynamic subtypes, this field is set to a deallocator suitable to match :c:" -"func:`PyType_GenericAlloc` and the value of the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit." +"In dynamic subtypes, this field is set to a deallocator suitable to " +"match :c:func:`PyType_GenericAlloc` and the value of " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1970 +#: ../../c-api/typeobj.rst:2012 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:1975 +#: ../../c-api/typeobj.rst:2017 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1977 +#: ../../c-api/typeobj.rst:2019 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " -"type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically " -"and dynamically allocated instances, and the statically allocated instances " -"are not collectible. Such types should define this function; it should " -"return ``1`` for a collectible instance, and ``0`` for a non-collectible " -"instance. The signature is::" +"type's :c:member:`~PyTypeObject.tp_flags` field, and check " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " +"of statically and dynamically allocated instances, and the statically " +"allocated instances are not collectible. Such types should define this " +"function; it should return ``1`` for a collectible instance, and ``0`` for a " +"non-collectible instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1985 +#: ../../c-api/typeobj.rst:2027 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:1987 +#: ../../c-api/typeobj.rst:2029 msgid "" -"(The only example of this are types themselves. The metatype, :c:data:" -"`PyType_Type`, defines this function to distinguish between statically and :" -"ref:`dynamically allocated types `.)" +"(The only example of this are types themselves. The " +"metatype, :c:data:`PyType_Type`, defines this function to distinguish " +"between statically and :ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:1997 +#: ../../c-api/typeobj.rst:2039 msgid "" -"This slot has no default. If this field is ``NULL``, :c:macro:" -"`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." +"This slot has no default. If this field is " +"``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2003 +#: ../../c-api/typeobj.rst:2045 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2005 ../../c-api/typeobj.rst:2029 +#: ../../c-api/typeobj.rst:2047 ../../c-api/typeobj.rst:2071 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:2008 +#: ../../c-api/typeobj.rst:2050 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " -"` can be used instead of the *bases* argument of :c:func:" -"`PyType_FromSpecWithBases`. The argument form is preferred." +"` can be used instead of the *bases* argument " +"of :c:func:`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2015 +#: ../../c-api/typeobj.rst:2057 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2021 ../../c-api/typeobj.rst:2044 -#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2078 -#: ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2086 +#: ../../c-api/typeobj.rst:2103 ../../c-api/typeobj.rst:2120 +#: ../../c-api/typeobj.rst:2134 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2026 +#: ../../c-api/typeobj.rst:2068 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2034 +#: ../../c-api/typeobj.rst:2076 msgid "" -"This field is not inherited; it is calculated fresh by :c:func:" -"`PyType_Ready`." +"This field is not inherited; it is calculated fresh " +"by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2040 +#: ../../c-api/typeobj.rst:2082 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2049 +#: ../../c-api/typeobj.rst:2091 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2051 +#: ../../c-api/typeobj.rst:2093 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~type." -"__subclasses__`." +"To get a list of subclasses, call the Python " +"method :py:meth:`~type.__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2056 +#: ../../c-api/typeobj.rst:2098 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2066 +#: ../../c-api/typeobj.rst:2108 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2071 +#: ../../c-api/typeobj.rst:2113 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3268,25 +3353,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2083 +#: ../../c-api/typeobj.rst:2125 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2088 +#: ../../c-api/typeobj.rst:2130 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2097 +#: ../../c-api/typeobj.rst:2139 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2099 +#: ../../c-api/typeobj.rst:2141 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2143 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3296,138 +3381,136 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2108 +#: ../../c-api/typeobj.rst:2150 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2111 +#: ../../c-api/typeobj.rst:2153 msgid "" "static void\n" "local_finalize(PyObject *self)\n" "{\n" -" PyObject *error_type, *error_value, *error_traceback;\n" -"\n" " /* Save the current exception, if any. */\n" -" PyErr_Fetch(&error_type, &error_value, &error_traceback);\n" +" PyObject *exc = PyErr_GetRaisedException();\n" "\n" " /* ... */\n" "\n" " /* Restore the saved exception. */\n" -" PyErr_Restore(error_type, error_value, error_traceback);\n" +" PyErr_SetRaisedException(exc);\n" "}" msgstr "" -#: ../../c-api/typeobj.rst:2133 +#: ../../c-api/typeobj.rst:2173 msgid "" -"Before version 3.8 it was necessary to set the :c:macro:" -"`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " -"This is no longer required." +"Before version 3.8 it was necessary to set " +"the :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to " +"be used. This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2137 +#: ../../c-api/typeobj.rst:2177 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2142 +#: ../../c-api/typeobj.rst:2182 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " -"If ``tp_vectorcall`` is ``NULL``, the default call implementation using :" -"meth:`~object.__new__` and :meth:`~object.__init__` is used." +"If ``tp_vectorcall`` is ``NULL``, the default call implementation " +"using :meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2150 +#: ../../c-api/typeobj.rst:2190 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2152 +#: ../../c-api/typeobj.rst:2192 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2157 +#: ../../c-api/typeobj.rst:2197 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2165 +#: ../../c-api/typeobj.rst:2205 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2167 +#: ../../c-api/typeobj.rst:2207 msgid "" -"Traditionally, types defined in C code are *static*, that is, a static :c:" -"type:`PyTypeObject` structure is defined directly in code and initialized " -"using :c:func:`PyType_Ready`." +"Traditionally, types defined in C code are *static*, that is, a " +"static :c:type:`PyTypeObject` structure is defined directly in code and " +"initialized using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2211 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2173 +#: ../../c-api/typeobj.rst:2213 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2175 +#: ../../c-api/typeobj.rst:2215 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2177 +#: ../../c-api/typeobj.rst:2217 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2181 +#: ../../c-api/typeobj.rst:2221 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2189 +#: ../../c-api/typeobj.rst:2229 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2191 +#: ../../c-api/typeobj.rst:2231 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " -"created by Python's ``class`` statement. Heap types have the :c:macro:" -"`Py_TPFLAGS_HEAPTYPE` flag set." +"created by Python's ``class`` statement. Heap types have " +"the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2196 +#: ../../c-api/typeobj.rst:2236 msgid "" -"This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" -"func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" -"`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." +"This is done by filling a :c:type:`PyType_Spec` structure and " +"calling :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:`PyType_FromModuleAndSpec`, " +"or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2204 +#: ../../c-api/typeobj.rst:2244 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2211 +#: ../../c-api/typeobj.rst:2251 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2217 ../../c-api/typeobj.rst:2541 +#: ../../c-api/typeobj.rst:2257 ../../c-api/typeobj.rst:2581 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2219 +#: ../../c-api/typeobj.rst:2259 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3515,7 +3598,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2264 +#: ../../c-api/typeobj.rst:2304 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3525,81 +3608,82 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2273 +#: ../../c-api/typeobj.rst:2313 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2318 +#: ../../c-api/typeobj.rst:2358 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2325 +#: ../../c-api/typeobj.rst:2365 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2330 +#: ../../c-api/typeobj.rst:2370 msgid "" -"This function is used by :c:func:`PyMapping_Size` and :c:func:" -"`PyObject_Size`, and has the same signature. This slot may be set to " -"``NULL`` if the object has no defined length." +"This function is used by :c:func:`PyMapping_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. This slot may be " +"set to ``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2336 +#: ../../c-api/typeobj.rst:2376 msgid "" -"This function is used by :c:func:`PyObject_GetItem` and :c:func:" -"`PySequence_GetSlice`, and has the same signature as :c:func:`!" -"PyObject_GetItem`. This slot must be filled for the :c:func:" -"`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." +"This function is used by :c:func:`PyObject_GetItem` " +"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for " +"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " +"otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2344 +#: ../../c-api/typeobj.rst:2384 msgid "" -"This function is used by :c:func:`PyObject_SetItem`, :c:func:" -"`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" -"`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"This function is used " +"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " +"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" "PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " "If this slot is ``NULL``, the object does not support item assignment and " "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2355 +#: ../../c-api/typeobj.rst:2395 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2362 +#: ../../c-api/typeobj.rst:2402 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2367 +#: ../../c-api/typeobj.rst:2407 msgid "" -"This function is used by :c:func:`PySequence_Size` and :c:func:" -"`PyObject_Size`, and has the same signature. It is also used for handling " -"negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:" -"member:`~PySequenceMethods.sq_ass_item` slots." +"This function is used by :c:func:`PySequence_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. It is also used " +"for handling negative indices via the :c:member:`~PySequenceMethods.sq_item` " +"and the :c:member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2374 +#: ../../c-api/typeobj.rst:2414 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2380 +#: ../../c-api/typeobj.rst:2420 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2386 +#: ../../c-api/typeobj.rst:2426 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3608,42 +3692,43 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2392 +#: ../../c-api/typeobj.rst:2432 msgid "" -"Negative indexes are handled as follows: if the :c:member:" -"`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " -"length is used to compute a positive index which is passed to :c:member:" -"`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " -"index is passed as is to the function." +"Negative indexes are handled as follows: if " +"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " +"and the sequence length is used to compute a positive index which is passed " +"to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is " +"``NULL``, the index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2399 +#: ../../c-api/typeobj.rst:2439 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " -"signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" -"`PyObject_DelItem`, after trying the item assignment and deletion via the :c:" -"member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " -"``NULL`` if the object does not support item assignment and deletion." +"signature. It is also used by :c:func:`PyObject_SetItem` " +"and :c:func:`PyObject_DelItem`, after trying the item assignment and " +"deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This " +"slot may be left to ``NULL`` if the object does not support item assignment " +"and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2408 +#: ../../c-api/typeobj.rst:2448 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2415 +#: ../../c-api/typeobj.rst:2455 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " "may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " "will fall back to :c:func:`PySequence_Concat`. It is also used by the " -"augmented assignment ``+=``, after trying numeric in-place addition via the :" -"c:member:`~PyNumberMethods.nb_inplace_add` slot." +"augmented assignment ``+=``, after trying numeric in-place addition via " +"the :c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2424 +#: ../../c-api/typeobj.rst:2464 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3653,76 +3738,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2435 +#: ../../c-api/typeobj.rst:2475 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2443 +#: ../../c-api/typeobj.rst:2483 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2449 ../../c-api/typeobj.rst:2498 -#: ../../c-api/typeobj.rst:2552 ../../c-api/typeobj.rst:2563 -#: ../../c-api/typeobj.rst:2575 ../../c-api/typeobj.rst:2585 +#: ../../c-api/typeobj.rst:2489 ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2592 ../../c-api/typeobj.rst:2603 +#: ../../c-api/typeobj.rst:2615 ../../c-api/typeobj.rst:2625 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2451 +#: ../../c-api/typeobj.rst:2491 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2453 +#: ../../c-api/typeobj.rst:2493 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2457 +#: ../../c-api/typeobj.rst:2497 msgid "" -"Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" -"expr:`view->obj` to ``NULL`` and return ``-1``." +"Check if the request can be met. If not, raise :exc:`BufferError`, " +"set :c:expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2500 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2462 +#: ../../c-api/typeobj.rst:2502 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2504 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2466 +#: ../../c-api/typeobj.rst:2506 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2468 +#: ../../c-api/typeobj.rst:2508 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2471 +#: ../../c-api/typeobj.rst:2511 msgid "" -"Re-export: Each member of the tree acts as the exporting object and sets :c:" -"expr:`view->obj` to a new reference to itself." +"Re-export: Each member of the tree acts as the exporting object and " +"sets :c:expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2474 +#: ../../c-api/typeobj.rst:2514 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2478 +#: ../../c-api/typeobj.rst:2518 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3730,32 +3815,31 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2483 +#: ../../c-api/typeobj.rst:2523 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " -"exporter and must remain valid until there are no consumers left. :c:member:" -"`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." -"strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer." -"internal` are read-only for the consumer." +"exporter and must remain valid until there are no consumers " +"left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " +"and :c:member:`~Py_buffer.internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2490 +#: ../../c-api/typeobj.rst:2530 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2493 +#: ../../c-api/typeobj.rst:2533 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2500 +#: ../../c-api/typeobj.rst:2540 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2502 +#: ../../c-api/typeobj.rst:2542 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3763,15 +3847,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2547 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2509 +#: ../../c-api/typeobj.rst:2549 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2511 +#: ../../c-api/typeobj.rst:2551 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3779,30 +3863,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2517 +#: ../../c-api/typeobj.rst:2557 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2522 +#: ../../c-api/typeobj.rst:2562 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2530 +#: ../../c-api/typeobj.rst:2570 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2578 msgid "" -"This structure holds pointers to the functions required to implement :term:" -"`awaitable` and :term:`asynchronous iterator` objects." +"This structure holds pointers to the functions required to " +"implement :term:`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2543 +#: ../../c-api/typeobj.rst:2583 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3818,149 +3902,150 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2554 +#: ../../c-api/typeobj.rst:2594 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2556 +#: ../../c-api/typeobj.rst:2596 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2559 +#: ../../c-api/typeobj.rst:2599 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2565 +#: ../../c-api/typeobj.rst:2605 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2567 +#: ../../c-api/typeobj.rst:2607 msgid "" -"Must return an :term:`asynchronous iterator` object. See :meth:`~object." -"__anext__` for details." +"Must return an :term:`asynchronous iterator` object. " +"See :meth:`~object.__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2570 +#: ../../c-api/typeobj.rst:2610 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2577 +#: ../../c-api/typeobj.rst:2617 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2579 +#: ../../c-api/typeobj.rst:2619 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2587 +#: ../../c-api/typeobj.rst:2627 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2589 +#: ../../c-api/typeobj.rst:2629 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2598 +#: ../../c-api/typeobj.rst:2638 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2602 +#: ../../c-api/typeobj.rst:2642 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " "length for the instance, suitably aligned, and initialized to zeros, but " -"with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject." -"ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject." -"tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` " -"field should be initialized to *nitems* and the length of the allocated " -"memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to " -"a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " -"length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " +"and :c:member:`~PyObject.ob_type` set to the type argument. If the " +"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " +"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " +"*nitems* and the length of the allocated memory block should be " +"``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of " +"``sizeof(void*)``; otherwise, *nitems* is not used and the length of the " +"block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2612 +#: ../../c-api/typeobj.rst:2652 msgid "" "This function should not do any other instance initialization, not even to " -"allocate additional memory; that should be done by :c:member:`~PyTypeObject." -"tp_new`." +"allocate additional memory; that should be done " +"by :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2619 +#: ../../c-api/typeobj.rst:2659 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2623 +#: ../../c-api/typeobj.rst:2663 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2627 +#: ../../c-api/typeobj.rst:2667 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2631 +#: ../../c-api/typeobj.rst:2671 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2635 ../../c-api/typeobj.rst:2644 +#: ../../c-api/typeobj.rst:2675 ../../c-api/typeobj.rst:2684 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2639 ../../c-api/typeobj.rst:2650 +#: ../../c-api/typeobj.rst:2679 ../../c-api/typeobj.rst:2690 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2646 +#: ../../c-api/typeobj.rst:2686 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2653 +#: ../../c-api/typeobj.rst:2693 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2657 +#: ../../c-api/typeobj.rst:2697 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2661 +#: ../../c-api/typeobj.rst:2701 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2665 +#: ../../c-api/typeobj.rst:2705 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2669 +#: ../../c-api/typeobj.rst:2709 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2673 +#: ../../c-api/typeobj.rst:2713 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2677 +#: ../../c-api/typeobj.rst:2717 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2691 +#: ../../c-api/typeobj.rst:2731 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2707 +#: ../../c-api/typeobj.rst:2747 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2709 +#: ../../c-api/typeobj.rst:2749 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3968,11 +4053,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2714 +#: ../../c-api/typeobj.rst:2754 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2716 +#: ../../c-api/typeobj.rst:2756 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -3990,13 +4075,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2731 +#: ../../c-api/typeobj.rst:2771 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2734 +#: ../../c-api/typeobj.rst:2774 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4080,11 +4165,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2775 +#: ../../c-api/typeobj.rst:2815 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2777 +#: ../../c-api/typeobj.rst:2817 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4110,14 +4195,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2800 +#: ../../c-api/typeobj.rst:2840 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " -"instances (e.g. uses a separate factory func) using :c:macro:" -"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" +"instances (e.g. uses a separate factory func) " +"using :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2804 +#: ../../c-api/typeobj.rst:2844 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4135,12 +4220,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2819 +#: ../../c-api/typeobj.rst:2859 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2821 +#: ../../c-api/typeobj.rst:2861 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4160,13 +4245,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2830 +#: ../../c-api/typeobj.rst:2870 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2832 +#: ../../c-api/typeobj.rst:2872 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4192,14 +4277,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:800 ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:842 ../../c-api/typeobj.rst:907 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:800 +#: ../../c-api/typeobj.rst:842 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:907 msgid "hash" msgstr "hash(雜湊)" diff --git a/c-api/unicode.po b/c-api/unicode.po index 8ebbcebe8f..f29bafb0e6 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,23 +41,25 @@ msgstr "" #: ../../c-api/unicode.rst:20 msgid "" "UTF-8 representation is created on demand and cached in the Unicode object." -msgstr "" +msgstr "UTF-8 表示法會在需要時建立並快取在 Unicode 物件中。" #: ../../c-api/unicode.rst:23 msgid "" "The :c:type:`Py_UNICODE` representation has been removed since Python 3.12 " "with deprecated APIs. See :pep:`623` for more information." msgstr "" +"自 Python 3.12 起,已移除 :c:type:`Py_UNICODE` 表示法,並標示為已棄用的 API。" +"更多資訊請參閱 :pep:`623`。" #: ../../c-api/unicode.rst:29 msgid "Unicode Type" -msgstr "" +msgstr "Unicode 型別" #: ../../c-api/unicode.rst:31 msgid "" "These are the basic Unicode object types used for the Unicode implementation " "in Python:" -msgstr "" +msgstr "這些是 Python 中用於 Unicode 實作的基本 Unicode 物件型別:" #: ../../c-api/unicode.rst:38 msgid "" @@ -88,43 +90,49 @@ msgstr "" #: ../../c-api/unicode.rst:71 msgid "" -"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " +"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " "It is exposed to Python code as ``str``." msgstr "" -#: ../../c-api/unicode.rst:75 +#: ../../c-api/unicode.rst:77 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python Unicode " +"iterator type. It is used to iterate over Unicode string objects." +msgstr "" + +#: ../../c-api/unicode.rst:81 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" -#: ../../c-api/unicode.rst:80 +#: ../../c-api/unicode.rst:86 msgid "" "Return true if the object *obj* is a Unicode object or an instance of a " "Unicode subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:86 +#: ../../c-api/unicode.rst:92 msgid "" "Return true if the object *obj* is a Unicode object, but not an instance of " "a subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:92 +#: ../../c-api/unicode.rst:98 msgid "Returns ``0``. This API is kept only for backward compatibility." -msgstr "" +msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" -#: ../../c-api/unicode.rst:96 +#: ../../c-api/unicode.rst:102 msgid "This API does nothing since Python 3.12." -msgstr "" +msgstr "自 Python 3.12 起,此 API 不再執行任何動作。" -#: ../../c-api/unicode.rst:102 +#: ../../c-api/unicode.rst:108 msgid "" "Return the length of the Unicode string, in code points. *unicode* has to " "be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:112 +#: ../../c-api/unicode.rst:118 msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " @@ -132,15 +140,15 @@ msgid "" "`PyUnicode_KIND` to select the right function." msgstr "" -#: ../../c-api/unicode.rst:124 +#: ../../c-api/unicode.rst:130 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr "" -#: ../../c-api/unicode.rst:128 +#: ../../c-api/unicode.rst:134 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "``PyUnicode_WCHAR_KIND`` 已被移除。" -#: ../../c-api/unicode.rst:134 +#: ../../c-api/unicode.rst:140 msgid "" "Return one of the PyUnicode kind constants (see above) that indicate how " "many bytes per character this Unicode object uses to store its data. " @@ -148,13 +156,13 @@ msgid "" "(not checked)." msgstr "" -#: ../../c-api/unicode.rst:143 +#: ../../c-api/unicode.rst:149 msgid "" "Return a void pointer to the raw Unicode buffer. *unicode* has to be a " "Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:152 +#: ../../c-api/unicode.rst:158 msgid "" "Write into a canonical representation *data* (as obtained with :c:func:" "`PyUnicode_DATA`). This function performs no sanity checks, and is intended " @@ -164,158 +172,163 @@ msgid "" "written to that location." msgstr "" -#: ../../c-api/unicode.rst:165 +#: ../../c-api/unicode.rst:171 msgid "" "Read a code point from a canonical representation *data* (as obtained with :" "c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" -#: ../../c-api/unicode.rst:173 +#: ../../c-api/unicode.rst:179 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " "\"canonical\" representation. This is less efficient than :c:func:" "`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" -#: ../../c-api/unicode.rst:182 +#: ../../c-api/unicode.rst:188 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *unicode*, which must be in the \"canonical\" representation. This " "is always an approximation but more efficient than iterating over the string." msgstr "" -#: ../../c-api/unicode.rst:191 +#: ../../c-api/unicode.rst:197 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -#: ../../c-api/unicode.rst:194 +#: ../../c-api/unicode.rst:200 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" -#: ../../c-api/unicode.rst:200 +#: ../../c-api/unicode.rst:206 msgid "Unicode Character Properties" msgstr "" -#: ../../c-api/unicode.rst:202 +#: ../../c-api/unicode.rst:208 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" -#: ../../c-api/unicode.rst:209 +#: ../../c-api/unicode.rst:215 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." -msgstr "" +msgstr "根據 *ch* 是否為空白字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:214 +#: ../../c-api/unicode.rst:220 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." -msgstr "" +msgstr "根據 *ch* 是否為小寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:219 +#: ../../c-api/unicode.rst:225 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." -msgstr "" +msgstr "根據 *ch* 是否為大寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:224 +#: ../../c-api/unicode.rst:230 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." -msgstr "" +msgstr "根據 *ch* 是否為首字大寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:229 +#: ../../c-api/unicode.rst:235 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." -msgstr "" +msgstr "根據 *ch* 是否為換行字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:234 +#: ../../c-api/unicode.rst:240 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." -msgstr "" +msgstr "根據 *ch* 是否為十進位字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:239 +#: ../../c-api/unicode.rst:245 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." -msgstr "" +msgstr "根據 *ch* 是否為數字 (digit) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:244 +#: ../../c-api/unicode.rst:250 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." -msgstr "" +msgstr "根據 *ch* 是否為數值 (numeric) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:249 +#: ../../c-api/unicode.rst:255 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." -msgstr "" +msgstr "根據 *ch* 是否為字母字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:254 +#: ../../c-api/unicode.rst:260 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." -msgstr "" +msgstr "根據 *ch* 是否為字母數字 (alphanumeric) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:259 +#: ../../c-api/unicode.rst:265 msgid "" -"Return ``1`` or ``0`` depending on whether *ch* is a printable character. " -"Nonprintable characters are those characters defined in the Unicode " -"character database as \"Other\" or \"Separator\", excepting the ASCII space " -"(0x20) which is considered printable. (Note that printable characters in " -"this context are those which should not be escaped when :func:`repr` is " -"invoked on a string. It has no bearing on the handling of strings written " -"to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " +"the sense of :meth:`str.isprintable`." msgstr "" +"根據 *ch* 是否為可列印字元(如 :meth:`str.isprintable` 所定義)來回傳 ``1`` " +"或 ``0``。" -#: ../../c-api/unicode.rst:268 +#: ../../c-api/unicode.rst:269 msgid "These APIs can be used for fast direct character conversions:" -msgstr "" +msgstr "這些 API 可用於快速直接字元轉換:" -#: ../../c-api/unicode.rst:273 +#: ../../c-api/unicode.rst:274 msgid "Return the character *ch* converted to lower case." -msgstr "" +msgstr "回傳轉換為小寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:278 +#: ../../c-api/unicode.rst:279 msgid "Return the character *ch* converted to upper case." -msgstr "" +msgstr "回傳轉換為大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:283 +#: ../../c-api/unicode.rst:284 msgid "Return the character *ch* converted to title case." -msgstr "" +msgstr "回傳轉換為首字大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:288 +#: ../../c-api/unicode.rst:289 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." msgstr "" +"回傳轉換為十進位正整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" +"外。" -#: ../../c-api/unicode.rst:294 +#: ../../c-api/unicode.rst:295 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." msgstr "" +"回傳轉換為單一數字整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" +"外。" -#: ../../c-api/unicode.rst:300 +#: ../../c-api/unicode.rst:301 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." msgstr "" +"回傳轉換為雙精度浮點數 (double) 的 *ch* 字元,若無法轉換則回傳 ``-1.0``。此函" +"式不會引發例外。" -#: ../../c-api/unicode.rst:304 +#: ../../c-api/unicode.rst:305 msgid "These APIs can be used to work with surrogates:" -msgstr "" +msgstr "這些 API 可用於處理代理字元:" -#: ../../c-api/unicode.rst:308 +#: ../../c-api/unicode.rst:309 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." -msgstr "" +msgstr "檢查 *ch* 是否為代理字元 (surrogate, ``0xD800 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:312 +#: ../../c-api/unicode.rst:313 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" +"檢查 *ch* 是否為高代理字元 (high surrogate, ``0xD800 <= ch <= 0xDBFF``)。" -#: ../../c-api/unicode.rst:316 +#: ../../c-api/unicode.rst:317 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" +"檢查 *ch* 是否為低代理字元 (low surrogate, ``0xDC00 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:320 +#: ../../c-api/unicode.rst:321 msgid "" "Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " @@ -323,34 +336,34 @@ msgid "" "be in the range [0xDC00; 0xDFFF]." msgstr "" -#: ../../c-api/unicode.rst:327 +#: ../../c-api/unicode.rst:328 msgid "Creating and accessing Unicode strings" msgstr "" -#: ../../c-api/unicode.rst:329 +#: ../../c-api/unicode.rst:330 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: ../../c-api/unicode.rst:334 +#: ../../c-api/unicode.rst:335 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: ../../c-api/unicode.rst:338 +#: ../../c-api/unicode.rst:339 msgid "" "This is the recommended way to allocate a new Unicode object. Objects " "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:341 +#: ../../c-api/unicode.rst:342 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:349 +#: ../../c-api/unicode.rst:350 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" @@ -358,7 +371,7 @@ msgid "" "1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:354 +#: ../../c-api/unicode.rst:355 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" @@ -366,7 +379,7 @@ msgid "" "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:365 +#: ../../c-api/unicode.rst:366 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -374,29 +387,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:371 +#: ../../c-api/unicode.rst:372 msgid "This function raises :exc:`SystemError` when:" -msgstr "" +msgstr "此函式在以下情況下會引發 :exc:`SystemError`:" -#: ../../c-api/unicode.rst:373 +#: ../../c-api/unicode.rst:374 msgid "*size* < 0," -msgstr "" +msgstr "*size* < 0," -#: ../../c-api/unicode.rst:374 +#: ../../c-api/unicode.rst:375 msgid "*str* is ``NULL`` and *size* > 0" -msgstr "" +msgstr "*str* 為 ``NULL`` 且 *size* > 0" -#: ../../c-api/unicode.rst:376 +#: ../../c-api/unicode.rst:377 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." -msgstr "" +msgstr "*str* == ``NULL`` 且 *size* > 0 不再被允許。" -#: ../../c-api/unicode.rst:382 +#: ../../c-api/unicode.rst:383 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:388 +#: ../../c-api/unicode.rst:389 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -405,23 +418,23 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:394 +#: ../../c-api/unicode.rst:395 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:397 +#: ../../c-api/unicode.rst:398 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:399 +#: ../../c-api/unicode.rst:400 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:402 +#: ../../c-api/unicode.rst:403 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" @@ -429,7 +442,7 @@ msgid "" "optional precision." msgstr "" -#: ../../c-api/unicode.rst:407 +#: ../../c-api/unicode.rst:408 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -437,316 +450,316 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:412 +#: ../../c-api/unicode.rst:413 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:414 +#: ../../c-api/unicode.rst:415 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:416 +#: ../../c-api/unicode.rst:417 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:422 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:422 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:424 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:424 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:425 +#: ../../c-api/unicode.rst:426 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:425 +#: ../../c-api/unicode.rst:426 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:429 +#: ../../c-api/unicode.rst:430 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:437 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:437 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:439 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:439 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:441 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:441 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:443 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:443 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:445 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:445 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:446 +#: ../../c-api/unicode.rst:447 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:446 +#: ../../c-api/unicode.rst:447 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:449 +#: ../../c-api/unicode.rst:450 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:452 +#: ../../c-api/unicode.rst:453 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:458 +#: ../../c-api/unicode.rst:459 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:459 +#: ../../c-api/unicode.rst:460 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:460 +#: ../../c-api/unicode.rst:461 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:463 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:463 +#: ../../c-api/unicode.rst:464 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:465 msgid "The literal ``%`` character." -msgstr "" +msgstr "字面 ``%`` 字元。" -#: ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:467 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:467 ../../c-api/unicode.rst:471 -#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 -#: ../../c-api/unicode.rst:483 +#: ../../c-api/unicode.rst:468 ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:476 ../../c-api/unicode.rst:480 +#: ../../c-api/unicode.rst:484 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:468 +#: ../../c-api/unicode.rst:469 msgid "The decimal representation of a signed C integer." -msgstr "" +msgstr "一個有符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:470 +#: ../../c-api/unicode.rst:471 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:473 msgid "The decimal representation of an unsigned C integer." -msgstr "" +msgstr "一個無符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:474 +#: ../../c-api/unicode.rst:475 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:476 +#: ../../c-api/unicode.rst:477 msgid "The octal representation of an unsigned C integer." -msgstr "" +msgstr "一個無符號 C 整數的八進位表示法。" -#: ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:479 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:480 +#: ../../c-api/unicode.rst:481 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." -msgstr "" +msgstr "一個無符號 C 整數的十六進位表示法(小寫)。" -#: ../../c-api/unicode.rst:482 +#: ../../c-api/unicode.rst:483 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:485 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." -msgstr "" +msgstr "一個無符號 C 整數的十六進位表示法(大寫)。" -#: ../../c-api/unicode.rst:486 +#: ../../c-api/unicode.rst:487 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:488 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:489 msgid "A single character." -msgstr "" +msgstr "一個單一字元。" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:491 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:491 +#: ../../c-api/unicode.rst:492 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:493 msgid "A null-terminated C character array." -msgstr "" +msgstr "一個以 null 結尾的 C 字元陣列。" -#: ../../c-api/unicode.rst:494 +#: ../../c-api/unicode.rst:495 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:495 +#: ../../c-api/unicode.rst:496 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:497 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:502 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:502 ../../c-api/unicode.rst:506 -#: ../../c-api/unicode.rst:516 ../../c-api/unicode.rst:520 -#: ../../c-api/unicode.rst:524 ../../c-api/unicode.rst:529 +#: ../../c-api/unicode.rst:503 ../../c-api/unicode.rst:507 +#: ../../c-api/unicode.rst:517 ../../c-api/unicode.rst:521 +#: ../../c-api/unicode.rst:525 ../../c-api/unicode.rst:530 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:503 +#: ../../c-api/unicode.rst:504 msgid "The result of calling :func:`ascii`." -msgstr "" +msgstr "呼叫 :func:`ascii` 的結果。" -#: ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:506 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:507 +#: ../../c-api/unicode.rst:508 msgid "A Unicode object." -msgstr "一 Unicode 物件。" +msgstr "一個 Unicode 物件。" -#: ../../c-api/unicode.rst:509 +#: ../../c-api/unicode.rst:510 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:510 +#: ../../c-api/unicode.rst:511 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:511 +#: ../../c-api/unicode.rst:512 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:516 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:517 +#: ../../c-api/unicode.rst:518 msgid "The result of calling :c:func:`PyObject_Str`." -msgstr "" +msgstr "呼叫 :c:func:`PyObject_Str` 的結果。" -#: ../../c-api/unicode.rst:519 +#: ../../c-api/unicode.rst:520 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:521 +#: ../../c-api/unicode.rst:522 msgid "The result of calling :c:func:`PyObject_Repr`." -msgstr "" +msgstr "呼叫 :c:func:`PyObject_Repr` 的結果。" -#: ../../c-api/unicode.rst:523 +#: ../../c-api/unicode.rst:524 msgid "``T``" msgstr "``T``" -#: ../../c-api/unicode.rst:525 +#: ../../c-api/unicode.rst:526 msgid "" "Get the fully qualified name of an object type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:528 +#: ../../c-api/unicode.rst:529 msgid "``#T``" msgstr "``#T``" -#: ../../c-api/unicode.rst:530 +#: ../../c-api/unicode.rst:531 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:533 +#: ../../c-api/unicode.rst:534 msgid "``N``" msgstr "``N``" -#: ../../c-api/unicode.rst:534 ../../c-api/unicode.rst:539 +#: ../../c-api/unicode.rst:535 ../../c-api/unicode.rst:540 msgid ":c:expr:`PyTypeObject*`" msgstr ":c:expr:`PyTypeObject*`" -#: ../../c-api/unicode.rst:535 +#: ../../c-api/unicode.rst:536 msgid "" "Get the fully qualified name of a type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:538 +#: ../../c-api/unicode.rst:539 msgid "``#N``" msgstr "``#N``" -#: ../../c-api/unicode.rst:540 +#: ../../c-api/unicode.rst:541 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:544 +#: ../../c-api/unicode.rst:545 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -756,28 +769,30 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:552 +#: ../../c-api/unicode.rst:553 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:556 +#: ../../c-api/unicode.rst:557 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." -msgstr "" +msgstr "新增對 ``\"%lld\"`` 和 ``\"%llu\"`` 的支援。" -#: ../../c-api/unicode.rst:559 +#: ../../c-api/unicode.rst:560 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." -msgstr "" +msgstr "新增對 ``\"%li\"``、``\"%lli\"`` 和 ``\"%zi\"`` 的支援。" -#: ../../c-api/unicode.rst:562 +#: ../../c-api/unicode.rst:563 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" +"新增對 ``\"%s\"``、``\"%A\"``、``\"%U\"``、``\"%V\"``、``\"%S\"``、" +"``\"%R\"`` 的寬度和精確度格式化支援。" -#: ../../c-api/unicode.rst:566 +#: ../../c-api/unicode.rst:567 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -786,68 +801,90 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:574 +#: ../../c-api/unicode.rst:575 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:578 +#: ../../c-api/unicode.rst:579 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." -msgstr "" +msgstr "新增對 ``%T``、``%#T``、``%N`` 和 ``%#N`` 格式的支援。" -#: ../../c-api/unicode.rst:584 +#: ../../c-api/unicode.rst:585 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:590 +#: ../../c-api/unicode.rst:591 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:594 +#: ../../c-api/unicode.rst:595 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" #: ../../c-api/unicode.rst:600 -msgid "Decode an encoded object *obj* to a Unicode object." +msgid "Create a Unicode Object from the given Unicode code point *ordinal*." msgstr "" #: ../../c-api/unicode.rst:602 msgid "" +"The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " +"the case it is not." +msgstr "" + +#: ../../c-api/unicode.rst:609 +msgid "Decode an encoded object *obj* to a Unicode object." +msgstr "" + +#: ../../c-api/unicode.rst:611 +msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " "the error handling defined by *errors*. Both can be ``NULL`` to have the " "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:608 +#: ../../c-api/unicode.rst:617 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:611 +#: ../../c-api/unicode.rst:620 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:617 +#: ../../c-api/unicode.rst:626 +msgid "" +"Return the name of the default string encoding, ``\"utf-8\"``. See :func:" +"`sys.getdefaultencoding`." +msgstr "" + +#: ../../c-api/unicode.rst:629 +msgid "" +"The returned string does not need to be freed, and is valid until " +"interpreter shutdown." +msgstr "" + +#: ../../c-api/unicode.rst:635 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:619 +#: ../../c-api/unicode.rst:637 msgid "On error, set an exception and return ``-1``." -msgstr "" +msgstr "發生錯誤時,設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:630 +#: ../../c-api/unicode.rst:648 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -855,61 +892,61 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:641 +#: ../../c-api/unicode.rst:659 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: ../../c-api/unicode.rst:644 +#: ../../c-api/unicode.rst:662 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:647 +#: ../../c-api/unicode.rst:665 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:656 +#: ../../c-api/unicode.rst:674 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:660 +#: ../../c-api/unicode.rst:678 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:664 +#: ../../c-api/unicode.rst:682 msgid "Return ``0`` on success, ``-1`` on error with an exception set." -msgstr "" +msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:671 +#: ../../c-api/unicode.rst:689 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" "`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:675 +#: ../../c-api/unicode.rst:693 msgid "Return character on success, ``-1`` on error with an exception set." -msgstr "" +msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:683 +#: ../../c-api/unicode.rst:701 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:693 +#: ../../c-api/unicode.rst:711 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -917,7 +954,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:721 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -925,17 +962,17 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:712 +#: ../../c-api/unicode.rst:730 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:714 +#: ../../c-api/unicode.rst:732 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:721 +#: ../../c-api/unicode.rst:739 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -944,21 +981,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:728 +#: ../../c-api/unicode.rst:746 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:731 ../../c-api/unicode.rst:766 +#: ../../c-api/unicode.rst:749 ../../c-api/unicode.rst:784 msgid "This function ignores the :ref:`Python UTF-8 Mode `." -msgstr "" +msgstr "此函式會忽略 :ref:`Python UTF-8 模式 `。" -#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:832 +#: ../../c-api/unicode.rst:753 ../../c-api/unicode.rst:869 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:739 +#: ../../c-api/unicode.rst:757 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -966,13 +1003,15 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:748 +#: ../../c-api/unicode.rst:766 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" +"類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" +"字串長度。" -#: ../../c-api/unicode.rst:756 +#: ../../c-api/unicode.rst:774 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -981,17 +1020,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:763 +#: ../../c-api/unicode.rst:781 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:863 +#: ../../c-api/unicode.rst:788 ../../c-api/unicode.rst:900 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:774 +#: ../../c-api/unicode.rst:792 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -999,103 +1038,124 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:783 +#: ../../c-api/unicode.rst:801 msgid "File System Encoding" -msgstr "" +msgstr "檔案系統編碼" -#: ../../c-api/unicode.rst:785 +#: ../../c-api/unicode.rst:803 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:788 +#: ../../c-api/unicode.rst:806 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " -"``\"O&\"`` converter should be used, passing :c:func:`PyUnicode_FSConverter` " -"as the conversion function:" +"``\"O&\"`` converter should be used, passing :c:func:`!" +"PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:794 +#: ../../c-api/unicode.rst:812 msgid "" -"ParseTuple converter: encode :class:`str` objects -- obtained directly or " -"through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" -"func:`PyUnicode_EncodeFSDefault`; :class:`bytes` objects are output as-is. " -"*result* must be a :c:expr:`PyBytesObject*` which must be released when it " -"is no longer used." +":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " +"-- obtained directly or through the :class:`os.PathLike` interface -- to :" +"class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"objects are output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " +"variable to a new :term:`strong reference` to a :ref:`bytes object " +"` which must be released when it is no longer used and return " +"a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null bytes are " +"not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:802 ../../c-api/unicode.rst:819 -msgid "Accepts a :term:`path-like object`." +#: ../../c-api/unicode.rst:824 +msgid "" +"If *obj* is ``NULL``, the function releases a strong reference stored in the " +"variable referred by *result* and returns ``1``." msgstr "" -#: ../../c-api/unicode.rst:805 +#: ../../c-api/unicode.rst:829 ../../c-api/unicode.rst:856 +msgid "Accepts a :term:`path-like object`." +msgstr "接受一個 :term:`path-like object`。" + +#: ../../c-api/unicode.rst:832 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " -"converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " +"converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:811 +#: ../../c-api/unicode.rst:838 +msgid "" +":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " +"-- obtained either directly or indirectly through the :class:`os.PathLike` " +"interface -- to :class:`str` using :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " +"*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" +"c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" +"`strong reference` to a :ref:`Unicode object ` which must be " +"released when it is no longer used and return a non-zero value (:c:macro:" +"`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " +"result. On failure, return ``0`` with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:851 msgid "" -"ParseTuple converter: decode :class:`bytes` objects -- obtained either " -"directly or indirectly through the :class:`os.PathLike` interface -- to :" -"class:`str` using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` " -"objects are output as-is. *result* must be a :c:expr:`PyUnicodeObject*` " -"which must be released when it is no longer used." +"If *obj* is ``NULL``, release the strong reference to the object referred to " +"by *result* and return ``1``." msgstr "" -#: ../../c-api/unicode.rst:825 +#: ../../c-api/unicode.rst:862 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:827 +#: ../../c-api/unicode.rst:864 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:834 ../../c-api/unicode.rst:847 -#: ../../c-api/unicode.rst:867 +#: ../../c-api/unicode.rst:871 ../../c-api/unicode.rst:884 +#: ../../c-api/unicode.rst:904 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:841 +#: ../../c-api/unicode.rst:878 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:844 +#: ../../c-api/unicode.rst:881 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." -msgstr "" +msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" -#: ../../c-api/unicode.rst:854 +#: ../../c-api/unicode.rst:891 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:858 +#: ../../c-api/unicode.rst:895 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:872 +#: ../../c-api/unicode.rst:909 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:874 +#: ../../c-api/unicode.rst:911 msgid ":c:type:`wchar_t` support for platforms which support it:" -msgstr "" +msgstr "對支援 :c:type:`wchar_t` 的平台提供支援:" -#: ../../c-api/unicode.rst:878 +#: ../../c-api/unicode.rst:915 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1103,7 +1163,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:886 +#: ../../c-api/unicode.rst:923 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1111,13 +1171,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:891 +#: ../../c-api/unicode.rst:928 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:894 +#: ../../c-api/unicode.rst:931 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1127,7 +1187,7 @@ msgid "" "most C functions." msgstr "" -#: ../../c-api/unicode.rst:904 +#: ../../c-api/unicode.rst:941 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1138,37 +1198,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:912 +#: ../../c-api/unicode.rst:949 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:919 +#: ../../c-api/unicode.rst:956 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:927 +#: ../../c-api/unicode.rst:964 msgid "Built-in Codecs" -msgstr "" +msgstr "內建編解碼器" -#: ../../c-api/unicode.rst:929 +#: ../../c-api/unicode.rst:966 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:932 +#: ../../c-api/unicode.rst:969 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:936 +#: ../../c-api/unicode.rst:973 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1176,28 +1236,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:978 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:945 +#: ../../c-api/unicode.rst:982 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:950 +#: ../../c-api/unicode.rst:987 msgid "Generic Codecs" -msgstr "" +msgstr "泛用編解碼器" -#: ../../c-api/unicode.rst:952 +#: ../../c-api/unicode.rst:989 msgid "These are the generic codec APIs:" -msgstr "" +msgstr "這些是泛用編解碼器的 API:" -#: ../../c-api/unicode.rst:958 +#: ../../c-api/unicode.rst:995 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1206,7 +1266,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:968 +#: ../../c-api/unicode.rst:1005 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1215,21 +1275,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:976 +#: ../../c-api/unicode.rst:1013 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:978 +#: ../../c-api/unicode.rst:1015 msgid "These are the UTF-8 codec APIs:" -msgstr "" +msgstr "這些是 UTF-8 編解碼器的 API:" -#: ../../c-api/unicode.rst:983 +#: ../../c-api/unicode.rst:1020 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:990 +#: ../../c-api/unicode.rst:1027 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1237,20 +1297,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:998 +#: ../../c-api/unicode.rst:1035 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1002 ../../c-api/unicode.rst:1017 +#: ../../c-api/unicode.rst:1039 ../../c-api/unicode.rst:1054 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" -#: ../../c-api/unicode.rst:1008 +#: ../../c-api/unicode.rst:1045 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1259,13 +1319,15 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1014 +#: ../../c-api/unicode.rst:1051 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." msgstr "" +"發生錯誤時,設定例外並將 *size* 設為 ``-1``\\ (如果不是 NULL),並回傳 " +"``NULL``。" -#: ../../c-api/unicode.rst:1020 +#: ../../c-api/unicode.rst:1057 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1274,47 +1336,57 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1027 ../../c-api/unicode.rst:1040 +#: ../../c-api/unicode.rst:1064 ../../c-api/unicode.rst:1086 msgid "The return type is now ``const char *`` rather of ``char *``." -msgstr "" +msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。" -#: ../../c-api/unicode.rst:1030 +#: ../../c-api/unicode.rst:1067 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1036 +#: ../../c-api/unicode.rst:1073 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." +msgstr "與 :c:func:`PyUnicode_AsUTF8AndSize` 類似,但不儲存大小。" + +#: ../../c-api/unicode.rst:1077 +msgid "" +"This function does not have any special behavior for `null characters " +"`_ embedded within *unicode*. " +"As a result, strings containing null characters will remain in the returned " +"string, which some C functions might interpret as the end of the string, " +"leading to truncation. If truncation is an issue, it is recommended to use :" +"c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" -#: ../../c-api/unicode.rst:1045 +#: ../../c-api/unicode.rst:1091 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1047 +#: ../../c-api/unicode.rst:1093 msgid "These are the UTF-32 codec APIs:" -msgstr "" +msgstr "這些是 UTF-32 編解碼器的 API:" -#: ../../c-api/unicode.rst:1053 +#: ../../c-api/unicode.rst:1099 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1107 +#: ../../c-api/unicode.rst:1103 ../../c-api/unicode.rst:1153 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1060 ../../c-api/unicode.rst:1110 +#: ../../c-api/unicode.rst:1106 ../../c-api/unicode.rst:1156 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1064 +#: ../../c-api/unicode.rst:1110 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1322,21 +1394,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1069 +#: ../../c-api/unicode.rst:1115 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1072 ../../c-api/unicode.rst:1123 +#: ../../c-api/unicode.rst:1118 ../../c-api/unicode.rst:1169 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1125 +#: ../../c-api/unicode.rst:1120 ../../c-api/unicode.rst:1171 msgid "Return ``NULL`` if an exception was raised by the codec." -msgstr "" +msgstr "如果編解碼器引發例外則回傳 ``NULL``。" -#: ../../c-api/unicode.rst:1080 +#: ../../c-api/unicode.rst:1126 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1345,29 +1417,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1089 +#: ../../c-api/unicode.rst:1135 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1095 +#: ../../c-api/unicode.rst:1141 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1097 +#: ../../c-api/unicode.rst:1143 msgid "These are the UTF-16 codec APIs:" -msgstr "" +msgstr "這些是 UTF-16 編解碼器的 API:" -#: ../../c-api/unicode.rst:1103 +#: ../../c-api/unicode.rst:1149 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1114 +#: ../../c-api/unicode.rst:1160 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1376,13 +1448,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1120 +#: ../../c-api/unicode.rst:1166 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1131 +#: ../../c-api/unicode.rst:1177 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1392,28 +1464,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1140 +#: ../../c-api/unicode.rst:1186 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1146 +#: ../../c-api/unicode.rst:1192 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1148 +#: ../../c-api/unicode.rst:1194 msgid "These are the UTF-7 codec APIs:" -msgstr "" +msgstr "這些是 UTF-7 編解碼器的 API:" -#: ../../c-api/unicode.rst:1153 +#: ../../c-api/unicode.rst:1199 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1160 +#: ../../c-api/unicode.rst:1206 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1421,101 +1493,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1167 +#: ../../c-api/unicode.rst:1213 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1169 +#: ../../c-api/unicode.rst:1215 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1175 +#: ../../c-api/unicode.rst:1221 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1181 +#: ../../c-api/unicode.rst:1227 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1187 +#: ../../c-api/unicode.rst:1233 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1189 +#: ../../c-api/unicode.rst:1235 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1195 +#: ../../c-api/unicode.rst:1241 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1201 +#: ../../c-api/unicode.rst:1247 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1207 +#: ../../c-api/unicode.rst:1253 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1209 +#: ../../c-api/unicode.rst:1255 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1215 +#: ../../c-api/unicode.rst:1261 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1221 +#: ../../c-api/unicode.rst:1267 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1227 +#: ../../c-api/unicode.rst:1273 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1229 +#: ../../c-api/unicode.rst:1275 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1235 +#: ../../c-api/unicode.rst:1281 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1241 +#: ../../c-api/unicode.rst:1287 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1247 +#: ../../c-api/unicode.rst:1293 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1249 +#: ../../c-api/unicode.rst:1295 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1525,18 +1597,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1255 +#: ../../c-api/unicode.rst:1301 msgid "These are the mapping codec APIs:" -msgstr "" +msgstr "這些是對映編解碼器的 API:" -#: ../../c-api/unicode.rst:1260 +#: ../../c-api/unicode.rst:1306 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1264 +#: ../../c-api/unicode.rst:1310 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1546,14 +1618,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1275 +#: ../../c-api/unicode.rst:1321 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1279 +#: ../../c-api/unicode.rst:1325 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1561,41 +1633,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1285 +#: ../../c-api/unicode.rst:1331 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1289 +#: ../../c-api/unicode.rst:1335 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1293 +#: ../../c-api/unicode.rst:1339 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1296 +#: ../../c-api/unicode.rst:1342 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1300 +#: ../../c-api/unicode.rst:1346 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1305 +#: ../../c-api/unicode.rst:1351 msgid "MBCS codecs for Windows" -msgstr "" +msgstr "Windows 的 MBCS 編解碼器" -#: ../../c-api/unicode.rst:1307 +#: ../../c-api/unicode.rst:1353 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1603,13 +1675,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1314 +#: ../../c-api/unicode.rst:1360 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1367 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1617,44 +1689,50 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1329 +#: ../../c-api/unicode.rst:1376 +msgid "" +"Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " +"specified by *code_page*." +msgstr "" + +#: ../../c-api/unicode.rst:1382 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1336 +#: ../../c-api/unicode.rst:1389 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1344 +#: ../../c-api/unicode.rst:1397 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1350 +#: ../../c-api/unicode.rst:1403 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1352 +#: ../../c-api/unicode.rst:1405 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1356 +#: ../../c-api/unicode.rst:1409 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." -msgstr "" +msgstr "如果發生例外,則回傳 ``NULL`` 或 ``-1``。" -#: ../../c-api/unicode.rst:1361 +#: ../../c-api/unicode.rst:1414 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1366 +#: ../../c-api/unicode.rst:1419 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1663,27 +1741,73 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1374 +#: ../../c-api/unicode.rst:1424 ../../c-api/unicode.rst:1434 +#: ../../c-api/unicode.rst:1455 ../../c-api/unicode.rst:1468 +msgid "On error, return ``NULL`` with an exception set." +msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" + +#: ../../c-api/unicode.rst:1426 +msgid "Equivalent to :py:meth:`str.split`." +msgstr "等價於 :py:meth:`str.split`。" + +#: ../../c-api/unicode.rst:1431 +msgid "" +"Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " +"at the end of the string." +msgstr "" + +#: ../../c-api/unicode.rst:1436 +msgid "Equivalent to :py:meth:`str.rsplit`." +msgstr "等價於 :py:meth:`str.rsplit`。" + +#: ../../c-api/unicode.rst:1441 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1381 +#: ../../c-api/unicode.rst:1448 +msgid "" +"Split a Unicode string at the first occurrence of *sep*, and return a 3-" +"tuple containing the part before the separator, the separator itself, and " +"the part after the separator. If the separator is not found, return a 3-" +"tuple containing the string itself, followed by two empty strings." +msgstr "" + +#: ../../c-api/unicode.rst:1453 ../../c-api/unicode.rst:1466 +msgid "*sep* must not be empty." +msgstr "*sep* 不得為空。" + +#: ../../c-api/unicode.rst:1457 +msgid "Equivalent to :py:meth:`str.partition`." +msgstr "等價於 :py:meth:`str.partition`。" + +#: ../../c-api/unicode.rst:1462 +msgid "" +"Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " +"last occurrence of *sep*. If the separator is not found, return a 3-tuple " +"containing two empty strings, followed by the string itself." +msgstr "" + +#: ../../c-api/unicode.rst:1470 +msgid "Equivalent to :py:meth:`str.rpartition`." +msgstr "等價於 :py:meth:`str.rpartition`。" + +#: ../../c-api/unicode.rst:1475 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1388 +#: ../../c-api/unicode.rst:1482 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1396 +#: ../../c-api/unicode.rst:1490 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1692,7 +1816,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1406 +#: ../../c-api/unicode.rst:1500 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1702,37 +1826,37 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1414 +#: ../../c-api/unicode.rst:1508 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1421 +#: ../../c-api/unicode.rst:1515 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1428 +#: ../../c-api/unicode.rst:1522 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1435 +#: ../../c-api/unicode.rst:1529 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1438 +#: ../../c-api/unicode.rst:1532 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1444 +#: ../../c-api/unicode.rst:1538 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -1741,18 +1865,18 @@ msgid "" "is returned." msgstr "" -#: ../../c-api/unicode.rst:1451 ../../c-api/unicode.rst:1472 +#: ../../c-api/unicode.rst:1545 ../../c-api/unicode.rst:1566 msgid "This function does not raise exceptions." -msgstr "" +msgstr "此函式不會引發例外。" -#: ../../c-api/unicode.rst:1458 +#: ../../c-api/unicode.rst:1552 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1467 +#: ../../c-api/unicode.rst:1561 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1760,47 +1884,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1477 +#: ../../c-api/unicode.rst:1571 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1479 +#: ../../c-api/unicode.rst:1573 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1480 +#: ../../c-api/unicode.rst:1574 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1481 +#: ../../c-api/unicode.rst:1575 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1483 +#: ../../c-api/unicode.rst:1577 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1489 +#: ../../c-api/unicode.rst:1583 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1495 +#: ../../c-api/unicode.rst:1589 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1498 +#: ../../c-api/unicode.rst:1592 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1504 +#: ../../c-api/unicode.rst:1598 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1811,7 +1935,7 @@ msgid "" "interns it." msgstr "" -#: ../../c-api/unicode.rst:1511 +#: ../../c-api/unicode.rst:1605 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1819,39 +1943,39 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1516 +#: ../../c-api/unicode.rst:1610 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1519 +#: ../../c-api/unicode.rst:1613 msgid "" "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" "expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " "as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1523 +#: ../../c-api/unicode.rst:1617 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1529 +#: ../../c-api/unicode.rst:1623 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" -#: ../../c-api/unicode.rst:1532 +#: ../../c-api/unicode.rst:1626 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1536 +#: ../../c-api/unicode.rst:1630 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " @@ -1860,6 +1984,6 @@ msgid "" "`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1544 +#: ../../c-api/unicode.rst:1638 msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 468bb4f7bf..80cabb8b50 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2025-01-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,7 +390,17 @@ msgstr "" msgid "Added *cf_feature_version* field." msgstr "新增 *cf_feature_version* 欄位。" -#: ../../c-api/veryhigh.rst:354 +#: ../../c-api/veryhigh.rst:351 +msgid "The available compiler flags are accessible as macros:" +msgstr "" + +#: ../../c-api/veryhigh.rst:360 +msgid "" +"See :ref:`compiler flags ` in documentation of the :py:" +"mod:`!ast` Python module, which exports these constants under the same names." +msgstr "" + +#: ../../c-api/veryhigh.rst:366 msgid "" "This bit can be set in *flags* to cause division operator ``/`` to be " "interpreted as \"true division\" according to :pep:`238`." diff --git a/copyright.po b/copyright.po index 63bcc2fbfa..50a39fdee2 100644 --- a/copyright.po +++ b/copyright.po @@ -32,9 +32,8 @@ msgid "Python and this documentation is:" msgstr "Python 和這份說明文件的版權:" #: ../../copyright.rst:7 -#, fuzzy msgid "Copyright © 2001-2024 Python Software Foundation. All rights reserved." -msgstr "Copyright © 2001-2023 Python Software Foundation 保留一切權利。" +msgstr "Copyright © 2001-2024 Python Software Foundation. All rights reserved." #: ../../copyright.rst:9 msgid "Copyright © 2000 BeOpen.com. All rights reserved." diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index ed8747f95e..8541753787 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -24,16 +24,16 @@ msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" -"`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " +"(:pep:`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" -"`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 ` " +"(:gh:`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -63,8 +63,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -121,24 +121,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." -"use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." -"write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." -"user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." -"user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -161,48 +161,48 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." -"legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." -"legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." -"filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." -"filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" -"c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" -"func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" +"見 :c:func:`Py_PreInitialize`)" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index f828c57849..4faa829fa8 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -25,27 +25,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" -"`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" -"`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" -"func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" -"func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" -"type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" -"`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -56,16 +56,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" -"data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." -"exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " +"and :data:`sys.exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" -"`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " +"與 :data:`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -76,8 +76,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." -"prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " +"與 :data:`sys.prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -89,8 +89,8 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" -"`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index 49bec35846..a9930288d2 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -38,8 +38,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改用 :c:func:" -"`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改" +"用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -59,11 +59,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" -"`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " +"和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -109,8 +109,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" -"`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" +"叫 :c:func:`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." diff --git a/deprecations/index.po b/deprecations/index.po index b6c4ff73e5..05c5babe57 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -321,10 +321,19 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -337,11 +346,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -349,11 +358,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -362,11 +371,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -377,11 +398,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -393,11 +414,11 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -408,7 +429,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -418,11 +439,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -472,7 +493,7 @@ msgstr "" "gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:10 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" @@ -556,15 +577,11 @@ msgid "" "groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -573,7 +590,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -591,7 +608,7 @@ msgstr "" "`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" "本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -600,7 +617,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -609,7 +626,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -618,11 +635,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; it should only be passed as a " @@ -632,7 +649,7 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -642,18 +659,18 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -661,7 +678,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -669,19 +686,11 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -689,19 +698,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -709,19 +718,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -729,7 +738,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -741,12 +750,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -754,15 +763,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -770,58 +779,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -829,11 +831,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -841,7 +843,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -849,20 +851,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -870,58 +872,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -931,13 +933,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -948,7 +950,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -1354,3 +1356,6 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:50 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index f6e86c446f..bd8e164bd3 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -60,8 +60,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" -"`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " +"in :gh:`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -71,27 +71,26 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" -"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" -"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher " +"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " +"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." -"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." -"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " -"Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類" +"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " +"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " -"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " +"and will be removed in Python 3.14. (Contributed by Kumar Aditya " +"in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" -"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " +"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -108,18 +107,21 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, " +"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " +"in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" -"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" -"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " -"Shantanu Jain 於 :gh:`91896` 貢獻。)" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" +"時,請改用聯集,如 ``bytes | bytearray``," +"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." -"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter " +"in :func:`email.utils.localtime`. (Contributed by Alan Williams " +"in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -173,24 +175,25 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." -"set_start_method` APIs to explicitly specify when your code *requires* " -"``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` " +"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " +"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" -"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " -"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" -"`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" +"用 :func:`~multiprocessing.get_context` " +"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" +"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." -"PurePath.relative_to`: passing additional arguments is deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " +"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " +"deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" -"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " +"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -199,8 +202,9 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." -"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改" +"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -224,9 +228,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" -"ref:`named placeholders ` are used and *parameters* is " -"a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " +"if :ref:`named placeholders ` are used and " +"*parameters* is a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" @@ -243,8 +247,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" -"`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith " +"in :gh:`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 8c048042e0..726d403414 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-28 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,10 +25,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached ` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached ` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -36,10 +36,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent ` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent ` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -79,39 +80,49 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -120,11 +131,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -135,11 +158,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -147,26 +170,26 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -176,16 +199,17 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 785fc0e03f..168f04617f 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -25,10 +25,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader ` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -59,8 +59,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" -"gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " +"於 :gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 msgid ":mod:`builtins`:" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index 9649475ba7..230bd84669 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,18 +33,14 @@ msgid "" msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" #: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:12 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -53,7 +49,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -71,7 +67,7 @@ msgstr "" "`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" "本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -80,7 +76,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -89,7 +85,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -98,11 +94,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; it should only be passed as a " @@ -112,7 +108,7 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -122,18 +118,18 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -141,7 +137,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -149,19 +145,15 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:58 +#: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 +#: ../../deprecations/pending-removal-in-future.rst:58 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -169,19 +161,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -189,19 +181,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -209,7 +201,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -221,12 +213,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -234,15 +226,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -250,58 +242,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -309,11 +294,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -321,7 +306,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -329,20 +314,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -350,58 +335,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -411,13 +396,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -428,10 +413,13 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/extending/building.po b/extending/building.po index 1e0c34fe84..46539b1e5e 100644 --- a/extending/building.po +++ b/extending/building.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 +# Matt Wang , 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2018-05-23 14:09+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2025-02-07 14:09+0000\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -32,21 +33,25 @@ msgstr "" #: ../../extending/building.rst:12 msgid "" -"To be importable, the shared library must be available on :envvar:" -"`PYTHONPATH`, and must be named after the module name, with an appropriate " -"extension. When using setuptools, the correct filename is generated " -"automatically." +"To be importable, the shared library must be available " +"on :envvar:`PYTHONPATH`, and must be named after the module name, with an " +"appropriate extension. When using setuptools, the correct filename is " +"generated automatically." msgstr "" +"要能夠被引入,共用函式庫必須在 :envvar:`PYTHONPATH` 上可用,並且必須以模組名" +"稱命名,並且必須有適當的副檔名。使用 setuptools 時,正確的檔名會自動產生。" #: ../../extending/building.rst:16 msgid "The initialization function has the signature:" -msgstr "" +msgstr "初始化函式具有簽名:" #: ../../extending/building.rst:20 msgid "" "It returns either a fully initialized module, or a :c:type:`PyModuleDef` " "instance. See :ref:`initializing-modules` for details." msgstr "" +"它回傳一個完全初始化的模組,或一個 :c:type:`PyModuleDef` 實例。詳細資訊請參" +"見 :ref:`initializing-modules`。" #: ../../extending/building.rst:25 msgid "" @@ -57,6 +62,11 @@ msgid "" "``PyInitU_``, with ```` encoded using Python's " "*punycode* encoding with hyphens replaced by underscores. In Python::" msgstr "" +"對於僅包含 ASCII 名稱的模組,函式必須以 ``PyInit_`` 命名,其中 " +"```` 要替換為模組的名稱。當使用 :ref:`multi-phase-" +"initialization` 時,允許非 ASCII 模組名稱。在這種情況下,初始化函式名稱是 " +"``PyInitU_``,其中 ```` 使用 Python 的 *punycode* 編" +"碼,並將連字符號替換為底線。在 Python 中: ::" #: ../../extending/building.rst:32 msgid "" @@ -82,10 +92,13 @@ msgid "" "function corresponding to the filename is found. See the *\"Multiple modules " "in one library\"* section in :pep:`489` for details." msgstr "" +"可以透過定義多個初始化函式,來從單一共用函式庫中匯出多個模組。然而要引入它們" +"需要使用符號連結或自訂引入器,因為預設只會找到對應於檔名的函式。詳細資訊請參" +"見 :pep:`489` 中的 *\"Multiple modules in one library\"* 部分。" #: ../../extending/building.rst:52 msgid "Building C and C++ Extensions with setuptools" -msgstr "" +msgstr "用 setuptools 建置 C 與 C++ 擴充套件" #: ../../extending/building.rst:54 msgid "" @@ -94,3 +107,6 @@ msgid "" "setuptools.html to learn more about how build and distribute C/C++ " "extensions with setuptools." msgstr "" +"Python 3.12 與之後的版本不再帶有 distutils。請在 https://" +"setuptools.readthedocs.io/en/latest/setuptools.html 上參閱 ``setuptools`` 文" +"件,以了解如何使用 setuptools 建置和發佈 C/C++ 擴充套件。" diff --git a/extending/embedding.po b/extending/embedding.po index ac486c5aef..4f1244dc1c 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-07 15:49+0000\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -356,7 +356,7 @@ msgstr "" msgid "" "After initializing the interpreter, the script is loaded using :c:func:" "`PyImport_Import`. This routine needs a Python string as its argument, " -"which is constructed using the :c:func:`PyUnicode_FromString` data " +"which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` data " "conversion routine. ::" msgstr "" diff --git a/extending/extending.po b/extending/extending.po index 6ff3917736..da956c0dc4 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -1,16 +1,17 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-202DESCRIPTIVE TITLE., Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 +# Adrian Liaw , 2018 +# Matt Wang , 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2018-05-23 14:34+0000\n" -"Last-Translator: Adrian Liaw \n" +"POT-Creation-Date: 2025-02-07 15:02+0800\n" +"PO-Revision-Date: 2025-02-17 14:34+0000\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -30,6 +31,9 @@ msgid "" "done directly in Python: they can implement new built-in object types, and " "they can call C library functions and system calls." msgstr "" +"如果你會撰寫 C 程式語言,那要向 Python 新增內建模組就不困難。這種\\ :dfn:`擴" +"充模組 (extension modules)` 可以做兩件在 Python 中無法直接完成的事:它們可以" +"實作新的內建物件型別,並且可以呼叫 C 的函式庫函式和系統呼叫。" #: ../../extending/extending.rst:15 msgid "" @@ -38,12 +42,17 @@ msgid "" "aspects of the Python run-time system. The Python API is incorporated in a " "C source file by including the header ``\"Python.h\"``." msgstr "" +"為了支援擴充,Python API (Application Programmers Interface) 定義了一組函式、" +"巨集和變數,提供對 Python run-time 系統大部分面向的存取。Python API 是透過引" +"入標頭檔 ``\"Python.h\"`` 來被納入到一個 C 原始碼檔案中。" #: ../../extending/extending.rst:20 msgid "" "The compilation of an extension module depends on its intended use as well " "as on your system setup; details are given in later chapters." msgstr "" +"擴充模組的編譯取決於其預期用途以及你的系統設定;詳細資訊將在後面的章節中提" +"供。" #: ../../extending/extending.rst:25 msgid "" @@ -57,6 +66,12 @@ msgid "" "with C code and are more portable between implementations of Python than " "writing and compiling a C extension module." msgstr "" +"C 擴充介面是 CPython 所特有的,擴充模組在其他 Python 實作上無法運作。在許多情" +"況下,可以避免撰寫 C 擴充並保留對其他實作的可移植性。例如,如果你的用例是呼" +"叫 C 函式庫函式或系統呼叫,你應該考慮使用 :mod:`ctypes` 模組或 `cffi " +"`_ 函式庫,而不是編寫自定義的 C 程式碼。這些模" +"組讓你可以撰寫 Python 程式碼來與 C 程式碼介接,而且比起撰寫和編譯 C 擴充模" +"組,這些模組在 Python 實作之間更容易移植。" #: ../../extending/extending.rst:40 msgid "A Simple Example" @@ -70,6 +85,10 @@ msgid "" "terminated character string as argument and returns an integer. We want " "this function to be callable from Python as follows:" msgstr "" +"讓我們來建立一個叫做 ``spam``\\ (Monty Python 粉絲最愛的食物...)的擴充模" +"組。假設我們要建立一個 Python 介面給 C 函式庫的函式 :c:func:`system` [#]_ 使" +"用,這個函式接受一個以 null 終止的 (null-terminated) 字元字串做為引數,並回傳" +"一個整數。我們希望這個函式可以在 Python 中被呼叫,如下所示:" #: ../../extending/extending.rst:48 msgid "" @@ -82,14 +101,17 @@ msgstr "" #: ../../extending/extending.rst:53 msgid "" "Begin by creating a file :file:`spammodule.c`. (Historically, if a module " -"is called ``spam``, the C file containing its implementation is called :file:" -"`spammodule.c`; if the module name is very long, like ``spammify``, the " -"module name can be just :file:`spammify.c`.)" +"is called ``spam``, the C file containing its implementation is " +"called :file:`spammodule.c`; if the module name is very long, like " +"``spammify``, the module name can be just :file:`spammify.c`.)" msgstr "" +"首先建立一個檔案 :file:`spammodule.c`。(從過去歷史來看,如果一個模組叫做 " +"``spam``,包含其實作的 C 檔案就會叫做 :file:`spammodule.c`;如果模組名稱很" +"長,像是 ``spammify``,模組名稱也可以只是 :file:`spammify.c`)。" #: ../../extending/extending.rst:58 msgid "The first two lines of our file can be::" -msgstr "" +msgstr "我們檔案的前兩列可以為: ::" #: ../../extending/extending.rst:60 ../../extending/extending.rst:663 msgid "" @@ -104,6 +126,8 @@ msgid "" "which pulls in the Python API (you can add a comment describing the purpose " "of the module and a copyright notice if you like)." msgstr "" +"這會將 Python API 拉進來(你可以加入註解來說明模組的目的,也可以加入版權聲" +"明)。" #: ../../extending/extending.rst:68 msgid "" @@ -111,6 +135,8 @@ msgid "" "standard headers on some systems, you *must* include :file:`Python.h` before " "any standard headers are included." msgstr "" +"由於 Python 可能定義一些影響系統上某些標準標頭檔的預處理器定義,你\\ *必須" +"*\\ 在引入任何標準標頭檔之前引入 :file:`Python.h`。" #: ../../extending/extending.rst:72 msgid "" @@ -119,17 +145,26 @@ msgid "" "3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" "string-and-buffers` for a description of this macro." msgstr "" +"``#define PY_SSIZE_T_CLEAN`` 被用來表示在某些 API 中應該使用 ``Py_ssize_t`` " +"而不是 ``int``。自 Python 3.13 起,它就不再是必要的了,但我們在此保留它以便向" +"後相容。關於這個巨集的描述請參閱 :ref:`arg-parsing-string-and-buffers`。" #: ../../extending/extending.rst:77 msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " "or ``PY``, except those defined in standard header files. For convenience, " -"and since they are used extensively by the Python interpreter, ``\"Python." -"h\"`` includes a few standard header files: ````, ````, " -"````, and ````. If the latter header file does not exist " -"on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " -"and :c:func:`realloc` directly." -msgstr "" +"and since they are used extensively by the Python interpreter, " +"``\"Python.h\"`` includes a few standard header files: ````, " +"````, ````, and ````. If the latter header " +"file does not exist on your system, it declares the " +"functions :c:func:`malloc`, :c:func:`free` and :c:func:`realloc` directly." +msgstr "" +"除了那些在標準標頭檔中定義的符號以外,所有由 :file:`Python.h` 定義的使用者可" +"見符號 (user-visible symbols) 的前綴都是 ``Py`` 或 ``PY``。為了方便,也因為 " +"Python 直譯器的大量使用,``\"Python.h\"`` 也引入了一些標準的標頭檔:" +"````、````、```` 和 ````。如果 " +"```` 在你的系統上不存在,它會直接宣" +"告 :c:func:`malloc`、:c:func:`free` 和 :c:func:`realloc` 函式。" #: ../../extending/extending.rst:85 msgid "" @@ -137,6 +172,9 @@ msgid "" "called when the Python expression ``spam.system(string)`` is evaluated " "(we'll see shortly how it ends up being called)::" msgstr "" +"接下來我們要加入到模組檔案的是 C 函式,當 Python 運算式 " +"``spam.system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它" +"最後是如何被呼叫的): ::" #: ../../extending/extending.rst:89 msgid "" @@ -171,12 +209,16 @@ msgid "" "C function. The C function always has two arguments, conventionally named " "*self* and *args*." msgstr "" +"可以很直觀地從 Python 的引數串列(例如單一的運算式 ``\"ls -l\"``)直接轉換成" +"傳給 C 函式的引數。C 函式總是有兩個引數,習慣上會命名為 *self* 和 *args*。" #: ../../extending/extending.rst:106 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." msgstr "" +"對於模組層級的函式,*self* 引數會指向模組物件;而對於方法來說則是指向物件的實" +"例。" #: ../../extending/extending.rst:109 msgid "" @@ -189,6 +231,11 @@ msgid "" "determine the required types of the arguments as well as the types of the C " "variables into which to store the converted values. More about this later." msgstr "" +"*args* 引數會是一個指向包含引數的 Python 元組物件的指標。元組中的每一項都對應" +"於呼叫的引數串列中的一個引數。引數是 Python 物件 --- 為了在我們的 C 函式中對" +"它們做任何事情,我們必須先將它們轉換成 C 值。Python API 中" +"的 :c:func:`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用" +"模板字串來決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" #: ../../extending/extending.rst:118 msgid "" @@ -199,10 +246,14 @@ msgid "" "the calling function can return ``NULL`` immediately (as we saw in the " "example)." msgstr "" +"如果所有的引數都有正確的型別,且其元件已儲存在傳入位址的變數中," +"則 :c:func:`PyArg_ParseTuple` 會回傳 true(非零)。如果傳入的是無效引數串列則" +"回傳 false(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回" +"傳 ``NULL``\\ (就像我們在範例中所看到的)。" #: ../../extending/extending.rst:128 msgid "Intermezzo: Errors and Exceptions" -msgstr "" +msgstr "插曲:錯誤與例外" #: ../../extending/extending.rst:130 msgid "" @@ -215,12 +266,17 @@ msgid "" "the exception type, exception instance, and a traceback object. It is " "important to know about them to understand how errors are passed around." msgstr "" +"在整個 Python 直譯器中的一個重要慣例為:當一個函式失敗時,它就應該設定一個例" +"外條件,並回傳一個錯誤值(通常是 ``-1`` 或一個 ``NULL`` 指標)。例外資訊會儲" +"存在直譯器執行緒狀態的三個成員中。如果沒有例外,它們就會是 ``NULL``。否則,它" +"們是由 :meth:`sys.exc_info` 所回傳的 Python 元組中的 C 等效元組。它們是例外型" +"別、例外實例和回溯物件。了解它們對於理解錯誤是如何傳遞是很重要的。" #: ../../extending/extending.rst:139 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." -msgstr "" +msgstr "Python API 定義了許多能夠設定各種類型例外的函式。" #: ../../extending/extending.rst:141 msgid "" @@ -230,25 +286,37 @@ msgid "" "indicates the cause of the error and is converted to a Python string object " "and stored as the \"associated value\" of the exception." msgstr "" +"最常見的是 :c:func:`PyErr_SetString`。它的引數是一個例外物件和一個 C 字串。例" +"外物件通常是預先定義的物件,例如 :c:data:`PyExc_ZeroDivisionError`。C 字串則" +"指出錯誤的原因,並被轉換為 Python 字串物件且被儲存為例外的「關聯值 " +"(associated value)」。" #: ../../extending/extending.rst:147 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " -"global variable :c:data:`errno`. The most general function is :c:func:" -"`PyErr_SetObject`, which takes two object arguments, the exception and its " -"associated value. You don't need to :c:func:`Py_INCREF` the objects passed " -"to any of these functions." +"global variable :c:data:`errno`. The most general function " +"is :c:func:`PyErr_SetObject`, which takes two object arguments, the " +"exception and its associated value. You don't need to :c:func:`Py_INCREF` " +"the objects passed to any of these functions." msgstr "" +"另一個有用的函式是 :c:func:`PyErr_SetFromErrno`,它只接受一個例外引數,並透過" +"檢查全域變數 :c:data:`errno` 來建立關聯值。最一般的函式" +"是 :c:func:`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需" +"要對傳給任何這些函式的物件呼叫 :c:func:`Py_INCREF`。" #: ../../extending/extending.rst:154 msgid "" -"You can test non-destructively whether an exception has been set with :c:" -"func:`PyErr_Occurred`. This returns the current exception object, or " -"``NULL`` if no exception has occurred. You normally don't need to call :c:" -"func:`PyErr_Occurred` to see whether an error occurred in a function call, " -"since you should be able to tell from the return value." +"You can test non-destructively whether an exception has been set " +"with :c:func:`PyErr_Occurred`. This returns the current exception object, " +"or ``NULL`` if no exception has occurred. You normally don't need to " +"call :c:func:`PyErr_Occurred` to see whether an error occurred in a function " +"call, since you should be able to tell from the return value." msgstr "" +"你可以使用 :c:func:`PyErr_Occurred` 來不具破壞性地測試例外是否已被設定。這會" +"回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼" +"叫 :c:func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就" +"得知。" #: ../../extending/extending.rst:160 msgid "" @@ -262,6 +330,12 @@ msgid "" "interpreter's main loop, this aborts the currently executing Python code and " "tries to find an exception handler specified by the Python programmer." msgstr "" +"當函式 *f* 呼叫另一個函式 *g* 時檢測到後者失敗,*f* 本身應該回傳一個錯誤值" +"(通常是 ``NULL`` 或 ``-1``)。它\\ *不*\\ 應該呼叫 ``PyErr_*`` 函式的其中一" +"個,這會已被 *g* 呼叫過。*f* 的呼叫者然後也應該回傳一個錯誤指示給\\ *它的*\\ " +"呼叫者,同樣\\ *不會*\\ 呼叫 ``PyErr_*``,依此類推 --- 最詳細的錯誤原因已經被" +"首先檢測到它的函式回報了。一旦錯誤到達 Python 直譯器的主要迴圈,這會中止目前" +"執行的 Python 程式碼,並嘗試尋找 Python 程式設計者指定的例外處理程式。" #: ../../extending/extending.rst:170 msgid "" @@ -271,6 +345,9 @@ msgid "" "cause information about the cause of the error to be lost: most operations " "can fail for a variety of reasons.)" msgstr "" +"(在某些情況下,模組可以透過呼叫另一個 ``PyErr_*`` 函式來提供更詳細的錯誤訊" +"息,在這種情況下這樣做是沒問題的。然而這一般來說並非必要,而且可能會導致錯誤" +"原因資訊的遺失:大多數的操作都可能因為各種原因而失敗。)" #: ../../extending/extending.rst:176 msgid "" @@ -280,15 +357,25 @@ msgid "" "pass the error on to the interpreter but wants to handle it completely by " "itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" +"要忽略由函式呼叫失敗所設定的例外,必須明確地呼叫 :c:func:`PyErr_Clear` 來清除" +"例外條件。C 程式碼唯一要呼叫 :c:func:`PyErr_Clear` 的情況為當它不想將錯誤傳遞" +"給直譯器而想要完全是自己來處理它時(可能是要再嘗試其他東西,或者假裝什麼都沒" +"出錯)。" #: ../../extending/extending.rst:182 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " -"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" -"`PyErr_NoMemory` and return a failure indicator itself. All the object-" -"creating functions (for example, :c:func:`PyLong_FromLong`) already do this, " -"so this note is only relevant to those who call :c:func:`malloc` directly." -msgstr "" +"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must " +"call :c:func:`PyErr_NoMemory` and return a failure indicator itself. All " +"the object-creating functions (for example, :c:func:`PyLong_FromLong`) " +"already do this, so this note is only relevant to those who " +"call :c:func:`malloc` directly." +msgstr "" +"每個失敗的 :c:func:`malloc` 呼叫都必須被轉換成一個例外 " +"--- :c:func:`malloc`\\ (或 :c:func:`realloc`)的直接呼叫者必須呼" +"叫 :c:func:`PyErr_NoMemory` 並回傳一個失敗指示器。所有建立物件的函式(例" +"如 :c:func:`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼" +"叫 :c:func:`malloc` 的函式有關。" #: ../../extending/extending.rst:188 msgid "" @@ -297,13 +384,18 @@ msgid "" "positive value or zero for success and ``-1`` for failure, like Unix system " "calls." msgstr "" +"還要注意的是,有 :c:func:`PyArg_ParseTuple` 及同系列函式的這些重要例外,回傳" +"整數狀態的函式通常會回傳一個正值或 0 表示成功、回傳 ``-1`` 表示失敗,就像 " +"Unix 系統呼叫一樣。" #: ../../extending/extending.rst:192 msgid "" -"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" -"c:func:`Py_DECREF` calls for objects you have already created) when you " +"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` " +"or :c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" +"最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼" +"叫 :c:func:`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" #: ../../extending/extending.rst:196 msgid "" @@ -311,18 +403,28 @@ msgid "" "predeclared C objects corresponding to all built-in Python exceptions, such " "as :c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, " "you should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` " -"to mean that a file couldn't be opened (that should probably be :c:data:" -"`PyExc_OSError`). If something's wrong with the argument list, the :c:func:" -"`PyArg_ParseTuple` function usually raises :c:data:`PyExc_TypeError`. If " -"you have an argument whose value must be in a particular range or must " -"satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." -msgstr "" +"to mean that a file couldn't be opened (that should probably " +"be :c:data:`PyExc_OSError`). If something's wrong with the argument list, " +"the :c:func:`PyArg_ParseTuple` function usually " +"raises :c:data:`PyExc_TypeError`. If you have an argument whose value must " +"be in a particular range or must satisfy other " +"conditions, :c:data:`PyExc_ValueError` is appropriate." +msgstr "" +"你完全可以自行選擇要產生的例外。有一些預先宣告的 C 物件會對應到所有內建的 " +"Python 例外,例如 :c:data:`PyExc_ZeroDivisionError`,你可以直接使用它們。當" +"然,你應該明智地選擇例外,像是不要使用 :c:data:`PyExc_TypeError` 來表示檔案無" +"法打開(應該是 :c:data:`PyExc_OSError`)。如果引數串列有問" +"題,:c:func:`PyArg_ParseTuple` 函式通常會引發 :c:data:`PyExc_TypeError`。如果" +"你有一個引數的值必須在一個特定的範圍內或必須滿足其他條件,則可以使" +"用 :c:data:`PyExc_ValueError`。" #: ../../extending/extending.rst:206 msgid "" "You can also define a new exception that is unique to your module. For this, " "you usually declare a static object variable at the beginning of your file::" msgstr "" +"你也可以定義一個你的模組特有的新例外。為此你通常會在檔案開頭宣告一個靜態物件" +"變數: ::" #: ../../extending/extending.rst:209 msgid "static PyObject *SpamError;" @@ -333,9 +435,10 @@ msgid "" "and initialize it in your module's initialization function (:c:func:`!" "PyInit_spam`) with an exception object::" msgstr "" +"並在你的模組初始化函式中使用一個例外物件來初始化它 (:c:func:`!" +"PyInit_spam`): ::" #: ../../extending/extending.rst:214 -#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -366,9 +469,7 @@ msgstr "" " return NULL;\n" "\n" " SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);\n" -" Py_XINCREF(SpamError);\n" -" if (PyModule_AddObject(m, \"error\", SpamError) < 0) {\n" -" Py_XDECREF(SpamError);\n" +" if (PyModule_AddObjectRef(m, \"error\", SpamError) < 0) {\n" " Py_CLEAR(SpamError);\n" " Py_DECREF(m);\n" " return NULL;\n" @@ -384,6 +485,9 @@ msgid "" "class being :exc:`Exception` (unless another class is passed in instead of " "``NULL``), described in :ref:`bltin-exceptions`." msgstr "" +"請注意,例外物件的 Python 名稱是 :exc:`!spam.error`。如同\\ :ref:`bltin-" +"exceptions`\\ 所述,:c:func:`PyErr_NewException` 函式可能會建立一個基底類別" +"為 :exc:`Exception` 的類別(除非傳入另一個類別來代替 ``NULL``)。" #: ../../extending/extending.rst:238 msgid "" @@ -395,18 +499,25 @@ msgid "" "pointer, C code which raises the exception could cause a core dump or other " "unintended side effects." msgstr "" +"請注意,:c:data:`!SpamError` 變數保留了對新建立的例外類別的參照;這是故意的!" +"因為外部程式碼可能會從模組中移除這個例外,所以需要一個對這個類別的參照來確保" +"它不會被丟棄而導致 :c:data:`!SpamError` 變成一個迷途指標 (dangling pointer)。" +"如果它變成迷途指標,那產生例外的 C 程式碼可能會導致核心轉儲 (core dump) 或其" +"他不預期的 side effect。" #: ../../extending/extending.rst:245 msgid "" "We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type " "later in this sample." -msgstr "" +msgstr "我們稍後會討論 :c:macro:`PyMODINIT_FUNC` 作為函式回傳型別的用法。" #: ../../extending/extending.rst:248 msgid "" "The :exc:`!spam.error` exception can be raised in your extension module " "using a call to :c:func:`PyErr_SetString` as shown below::" msgstr "" +"可以在你的擴充模組中呼叫 :c:func:`PyErr_SetString` 來引發 :exc:`!spam.error` " +"例外,如下所示: ::" #: ../../extending/extending.rst:251 msgid "" @@ -450,7 +561,7 @@ msgstr "回到範例" msgid "" "Going back to our example function, you should now be able to understand " "this statement::" -msgstr "" +msgstr "回到我們的範例函式,現在你應該可以理解這個陳述式了: ::" #: ../../extending/extending.rst:276 msgid "" @@ -470,12 +581,19 @@ msgid "" "which it points (so in Standard C, the variable :c:data:`!command` should " "properly be declared as ``const char *command``)." msgstr "" +"如果在引數串列中檢測到錯誤則會回傳 ``NULL``\\ (回傳物件指標之函式的錯誤指示" +"器),其依賴於 :c:func:`PyArg_ParseTuple` 設定的例外,否則引數的字串值會已被" +"複製到區域變數 :c:data:`!command` 中。這是一個指標賦值,你不應該修改它所指向" +"的字串(所以在標準 C 中,:c:data:`!command` 變數應該正確地被宣告為 ``const " +"char *command``)。" #: ../../extending/extending.rst:287 msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" +"接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才" +"從 :c:func:`PyArg_ParseTuple` 得到的字串傳給它:" #: ../../extending/extending.rst:290 msgid "sts = system(command);" @@ -484,9 +602,11 @@ msgstr "sts = system(command);" #: ../../extending/extending.rst:292 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " -"a Python object. This is done using the function :c:func:" -"`PyLong_FromLong`. ::" +"a Python object. This is done using the " +"function :c:func:`PyLong_FromLong`. ::" msgstr "" +"我們的 :func:`!spam.system` 函式必須以 Python 物件的形式來回傳 :c:data:`!" +"sts` 的值。這是透過 :c:func:`PyLong_FromLong` 函式來達成。 ::" #: ../../extending/extending.rst:295 msgid "return PyLong_FromLong(sts);" @@ -497,14 +617,19 @@ msgid "" "In this case, it will return an integer object. (Yes, even integers are " "objects on the heap in Python!)" msgstr "" +"在這種情況下它會回傳一個整數物件。(是的,在 Python 中連整數也是堆積 (heap) 上" +"的物件!)" #: ../../extending/extending.rst:300 msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " -"``None``. You need this idiom to do so (which is implemented by the :c:" -"macro:`Py_RETURN_NONE` macro)::" +"``None``. You need this idiom to do so (which is implemented by " +"the :c:macro:`Py_RETURN_NONE` macro)::" msgstr "" +"如果你有一個不回傳任何有用引數的 C 函式(一個回傳 :c:expr:`void` 的函式),對" +"應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成" +"(由 :c:macro:`Py_RETURN_NONE` 巨集實作): ::" #: ../../extending/extending.rst:305 msgid "" @@ -520,16 +645,21 @@ msgid "" "is a genuine Python object rather than a ``NULL`` pointer, which means " "\"error\" in most contexts, as we have seen." msgstr "" +":c:data:`Py_None` 是特殊 Python 物件 ``None`` 的 C 名稱。它是一個真正的 " +"Python 物件而不是一個 ``NULL`` 指標,在大多數的情況下它的意思是「錯誤」,如我" +"們所見過的那樣。" #: ../../extending/extending.rst:316 msgid "The Module's Method Table and Initialization Function" -msgstr "" +msgstr "模組的方法表和初始化函式" #: ../../extending/extending.rst:318 msgid "" "I promised to show how :c:func:`!spam_system` is called from Python " "programs. First, we need to list its name and address in a \"method table\"::" msgstr "" +"我承諾過要展示 :c:func:`!spam_system` 是如何從 Python 程式中呼叫的。首先,我" +"們需要在「方法表」中列出它的名稱和位址: ::" #: ../../extending/extending.rst:321 msgid "" @@ -541,6 +671,13 @@ msgid "" " {NULL, NULL, 0, NULL} /* Sentinel */\n" "};" msgstr "" +"static PyMethodDef SpamMethods[] = {\n" +" ...\n" +" {\"system\", spam_system, METH_VARARGS,\n" +" \"Execute a shell command.\"},\n" +" ...\n" +" {NULL, NULL, 0, NULL} /* Sentinel */\n" +"};" #: ../../extending/extending.rst:329 msgid "" @@ -550,13 +687,20 @@ msgid "" "value of ``0`` means that an obsolete variant of :c:func:`PyArg_ParseTuple` " "is used." msgstr "" +"請注意第三個項目 (``METH_VARARGS``)。這是一個告訴直譯器 C 函式之呼叫方式的旗" +"標。通常應該是 ``METH_VARARGS`` 或 ``METH_VARARGS | METH_KEYWORDS``;``0`` 表" +"示是使用 :c:func:`PyArg_ParseTuple` 的一個過時變體。" #: ../../extending/extending.rst:334 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" -"level parameters to be passed in as a tuple acceptable for parsing via :c:" -"func:`PyArg_ParseTuple`; more information on this function is provided below." +"level parameters to be passed in as a tuple acceptable for parsing " +"via :c:func:`PyArg_ParseTuple`; more information on this function is " +"provided below." msgstr "" +"當只使用 ``METH_VARARGS`` 時,函式應預期 Python 層級的參數是以元組形式傳入且" +"能夠接受以 :c:func:`PyArg_ParseTuple` 進行剖析;有關此函式的更多資訊將在下面" +"提供。" #: ../../extending/extending.rst:338 msgid "" @@ -566,11 +710,15 @@ msgid "" "keywords. Use :c:func:`PyArg_ParseTupleAndKeywords` to parse the arguments " "to such a function." msgstr "" +"如果要將關鍵字引數傳給函式,可以在第三個欄位設定 :c:macro:`METH_KEYWORDS` 位" +"元。在這種情況下,C 函式應該要能接受第三個 ``PyObject *`` 參數,這個參數將會" +"是關鍵字的字典。可使用 :c:func:`PyArg_ParseTupleAndKeywords` 來剖析這種函式的" +"引數。" #: ../../extending/extending.rst:344 msgid "" "The method table must be referenced in the module definition structure::" -msgstr "" +msgstr "方法表必須在模組定義結構中被參照: ::" #: ../../extending/extending.rst:346 msgid "" @@ -583,14 +731,25 @@ msgid "" " SpamMethods\n" "};" msgstr "" +"static struct PyModuleDef spammodule = {\n" +" PyModuleDef_HEAD_INIT,\n" +" \"spam\", /* 模組名稱 */\n" +" spam_doc, /* 模組文件,可能為 NULL */\n" +" -1, /* 模組的個別直譯器狀態的大小,\n" +" 如果模組將狀態保存在全域變數中則為 -1 */\n" +" SpamMethods\n" +"};" #: ../../extending/extending.rst:355 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " -"initialization function. The initialization function must be named :c:func:" -"`!PyInit_name`, where *name* is the name of the module, and should be the " -"only non-\\ ``static`` item defined in the module file::" +"initialization function. The initialization function must be " +"named :c:func:`!PyInit_name`, where *name* is the name of the module, and " +"should be the only non-\\ ``static`` item defined in the module file::" msgstr "" +"反過來說,這個結構必須在模組的初始化函式中被傳給直譯器。初始化函式必須被命名" +"為 :c:func:`!PyInit_name`,其中 *name* 是模組的名稱,且應該是模組檔案中唯一定" +"義的非「靜態 (``static``)」項目: ::" #: ../../extending/extending.rst:360 msgid "" @@ -612,28 +771,42 @@ msgid "" "return type, declares any special linkage declarations required by the " "platform, and for C++ declares the function as ``extern \"C\"``." msgstr "" +"請注意,:c:macro:`PyMODINIT_FUNC` 宣告函式的回傳型別為 ``PyObject *``、宣告平" +"台所需的任何特殊連結宣告、並針對 C++ 宣告函式為 ``extern \"C\"``。" #: ../../extending/extending.rst:370 msgid "" -"When the Python program imports module :mod:`!spam` for the first time, :c:" -"func:`!PyInit_spam` is called. (See below for comments about embedding " -"Python.) It calls :c:func:`PyModule_Create`, which returns a module object, " -"and inserts built-in function objects into the newly created module based " -"upon the table (an array of :c:type:`PyMethodDef` structures) found in the " -"module definition. :c:func:`PyModule_Create` returns a pointer to the module " -"object that it creates. It may abort with a fatal error for certain errors, " -"or return ``NULL`` if the module could not be initialized satisfactorily. " -"The init function must return the module object to its caller, so that it " -"then gets inserted into ``sys.modules``." -msgstr "" +"When the Python program imports module :mod:`!spam` for the first " +"time, :c:func:`!PyInit_spam` is called. (See below for comments about " +"embedding Python.) It calls :c:func:`PyModule_Create`, which returns a " +"module object, and inserts built-in function objects into the newly created " +"module based upon the table (an array of :c:type:`PyMethodDef` structures) " +"found in the module definition. :c:func:`PyModule_Create` returns a pointer " +"to the module object that it creates. It may abort with a fatal error for " +"certain errors, or return ``NULL`` if the module could not be initialized " +"satisfactorily. The init function must return the module object to its " +"caller, so that it then gets inserted into ``sys.modules``." +msgstr "" +"當 Python 程式第一次引入模組 :mod:`!spam` 時,:c:func:`!PyInit_spam` 會被呼" +"叫。(有關嵌入 Python 的註解請參見下文。)它會呼叫回傳一個模組物件" +"的 :c:func:`PyModule_Create`,並根據在模組定義中所找到的表(一" +"個 :c:type:`PyMethodDef` 結構的陣列)將內建的函式物件插入到新建立的模組" +"中。:c:func:`PyModule_Create` 會回傳一個指向它建立之模組物件的指標。對於某些" +"錯誤情況,它可能會以嚴重錯誤的形式來中止;如果模組無法令人滿意地被初始化,它" +"也會回傳 ``NULL``。初始化函式必須把模組物件回傳給它的呼叫者,這樣它才會被插入" +"到 ``sys.modules`` 中。" #: ../../extending/extending.rst:381 msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`PyImport_Inittab` " -"table. To add the module to the initialization table, use :c:func:" -"`PyImport_AppendInittab`, optionally followed by an import of the module::" +"table. To add the module to the initialization table, " +"use :c:func:`PyImport_AppendInittab`, optionally followed by an import of " +"the module::" msgstr "" +"嵌入 Python 時,除非在 :c:data:`PyImport_Inittab` 表中有相關條目,否則不會自" +"動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使" +"用 :c:func:`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" #: ../../extending/extending.rst:386 msgid "" @@ -687,6 +860,55 @@ msgid "" " Py_ExitStatusException(status);\n" "}" msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* 在 Py_Initialize 之前加入內建模組 */\n" +" if (PyImport_AppendInittab(\"spam\", PyInit_spam) == -1) {\n" +" fprintf(stderr, \"Error: could not extend in-built modules " +"table\\n\");\n" +" exit(1);\n" +" }\n" +"\n" +" /* 將 argv[0] 傳給 Python 直譯器 */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" /* 初始化 Python 直譯器。這會是必要的。\n" +" 如果此步驟失敗就會導致嚴重錯誤。*/\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" /* 可選擇引入模組;或者\n" +" 可以延遲引入,直至嵌入式腳本\n" +" 將其引入。*/\n" +" PyObject *pmodule = PyImport_ImportModule(\"spam\");\n" +" if (!pmodule) {\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Error: could not import module 'spam'\\n\");\n" +" }\n" +"\n" +" // ... 在此使用 Python C API ...\n" +"\n" +" return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" #: ../../extending/extending.rst:436 msgid "" @@ -696,6 +918,9 @@ msgid "" "extension modules. Extension module authors should exercise caution when " "initializing internal data structures." msgstr "" +"從 ``sys.modules`` 中移除項目,或在一個行程中將已編譯模組引入到多個直譯器中" +"(或在沒有 :c:func:`exec` 介入的情況下使用 :c:func:`fork`)可能會對某些擴充模" +"組造成問題。擴充模組作者在初始化內部資料結構時應特別小心。" #: ../../extending/extending.rst:442 msgid "" @@ -703,6 +928,8 @@ msgid "" "distribution as :file:`Modules/xxmodule.c`. This file may be used as a " "template or simply read as an example." msgstr "" +"Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/" +"xxmodule.c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" #: ../../extending/extending.rst:448 msgid "" @@ -711,6 +938,10 @@ msgid "" "``PyInit_spam``, and creation of the module is left to the import machinery. " "For details on multi-phase initialization, see :PEP:`489`." msgstr "" +"不像我們的 ``spam`` 範例,``xxmodule`` 使用了\\ *多階段初始化 (multi-phase " +"initialization)*\\ (Python 3.5 新增),其中的 PyModuleDef 結構會從 " +"``PyInit_spam`` 回傳,而模組的建立則交由引入機制來完成。關於多階段初始化的詳" +"細資訊請參閱 :PEP:`489`。" #: ../../extending/extending.rst:457 msgid "Compilation and Linkage" @@ -721,9 +952,10 @@ msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " "loading, the details may depend on the style of dynamic loading your system " -"uses; see the chapters about building extension modules (chapter :ref:" -"`building`) and additional information that pertains only to building on " -"Windows (chapter :ref:`building-on-windows`) for more information about this." +"uses; see the chapters about building extension modules " +"(chapter :ref:`building`) and additional information that pertains only to " +"building on Windows (chapter :ref:`building-on-windows`) for more " +"information about this." msgstr "" #: ../../extending/extending.rst:466 @@ -822,10 +1054,10 @@ msgstr "" #: ../../extending/extending.rst:540 msgid "" -"This function must be registered with the interpreter using the :c:macro:" -"`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" -"c:func:`PyArg_ParseTuple` function and its arguments are documented in " -"section :ref:`parsetuple`." +"This function must be registered with the interpreter using " +"the :c:macro:`METH_VARARGS` flag; this is described in " +"section :ref:`methodtable`. The :c:func:`PyArg_ParseTuple` function and its " +"arguments are documented in section :ref:`parsetuple`." msgstr "" #: ../../extending/extending.rst:545 @@ -838,14 +1070,15 @@ msgstr "" #: ../../extending/extending.rst:552 msgid "" -"Later, when it is time to call the function, you call the C function :c:func:" -"`PyObject_CallObject`. This function has two arguments, both pointers to " -"arbitrary Python objects: the Python function, and the argument list. The " -"argument list must always be a tuple object, whose length is the number of " -"arguments. To call the Python function with no arguments, pass in ``NULL``, " -"or an empty tuple; to call it with one argument, pass a singleton tuple. :c:" -"func:`Py_BuildValue` returns a tuple when its format string consists of zero " -"or more format codes between parentheses. For example::" +"Later, when it is time to call the function, you call the C " +"function :c:func:`PyObject_CallObject`. This function has two arguments, " +"both pointers to arbitrary Python objects: the Python function, and the " +"argument list. The argument list must always be a tuple object, whose " +"length is the number of arguments. To call the Python function with no " +"arguments, pass in ``NULL``, or an empty tuple; to call it with one " +"argument, pass a singleton tuple. :c:func:`Py_BuildValue` returns a tuple " +"when its format string consists of zero or more format codes between " +"parentheses. For example::" msgstr "" #: ../../extending/extending.rst:561 @@ -867,8 +1100,9 @@ msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " "\"reference-count-neutral\" with respect to its arguments. In the example a " -"new tuple was created to serve as the argument list, which is :c:func:" -"`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." +"new tuple was created to serve as the argument list, which " +"is :c:func:`Py_DECREF`\\ -ed immediately after " +"the :c:func:`PyObject_CallObject` call." msgstr "" #: ../../extending/extending.rst:579 @@ -934,9 +1168,10 @@ msgstr "" #: ../../extending/extending.rst:621 msgid "" -"You may also call a function with keyword arguments by using :c:func:" -"`PyObject_Call`, which supports arguments and keyword arguments. As in the " -"above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" +"You may also call a function with keyword arguments by " +"using :c:func:`PyObject_Call`, which supports arguments and keyword " +"arguments. As in the above example, we use :c:func:`Py_BuildValue` to " +"construct the dictionary. ::" msgstr "" #: ../../extending/extending.rst:625 @@ -1078,32 +1313,32 @@ msgid "" msgstr "" #: ../../extending/extending.rst:737 -#, fuzzy msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char * const " "*kwlist, ...);" msgstr "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" -" const char *format, char *kwlist[], ...);" +" const char *format, char * const " +"*kwlist, ...);" #: ../../extending/extending.rst:740 msgid "" -"The *arg* and *format* parameters are identical to those of the :c:func:" -"`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " -"keywords received as the third parameter from the Python runtime. The " -"*kwlist* parameter is a ``NULL``-terminated list of strings which identify " -"the parameters; the names are matched with the type information from " -"*format* from left to right. On success, :c:func:" -"`PyArg_ParseTupleAndKeywords` returns true, otherwise it returns false and " -"raises an appropriate exception." +"The *arg* and *format* parameters are identical to those of " +"the :c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the " +"dictionary of keywords received as the third parameter from the Python " +"runtime. The *kwlist* parameter is a ``NULL``-terminated list of strings " +"which identify the parameters; the names are matched with the type " +"information from *format* from left to right. On " +"success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it " +"returns false and raises an appropriate exception." msgstr "" #: ../../extending/extending.rst:750 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " -"parameters passed in which are not present in the *kwlist* will cause :exc:" -"`TypeError` to be raised." +"parameters passed in which are not present in the *kwlist* will " +"cause :exc:`TypeError` to be raised." msgstr "" #: ../../extending/extending.rst:756 @@ -1182,10 +1417,10 @@ msgstr "PyObject *Py_BuildValue(const char *format, ...);" #: ../../extending/extending.rst:818 msgid "" -"It recognizes a set of format units similar to the ones recognized by :c:" -"func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " -"not output) must not be pointers, just values. It returns a new Python " -"object, suitable for returning from a C function called from Python." +"It recognizes a set of format units similar to the ones recognized " +"by :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the " +"function, not output) must not be pointers, just values. It returns a new " +"Python object, suitable for returning from a C function called from Python." msgstr "" #: ../../extending/extending.rst:823 @@ -1259,16 +1494,16 @@ msgstr "" #: ../../extending/extending.rst:865 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " -"returned to the pool of available memory by exactly one call to :c:func:" -"`free`. It is important to call :c:func:`free` at the right time. If a " -"block's address is forgotten but :c:func:`free` is not called for it, the " -"memory it occupies cannot be reused until the program terminates. This is " -"called a :dfn:`memory leak`. On the other hand, if a program calls :c:func:" -"`free` for a block and then continues to use the block, it creates a " -"conflict with reuse of the block through another :c:func:`malloc` call. " -"This is called :dfn:`using freed memory`. It has the same bad consequences " -"as referencing uninitialized data --- core dumps, wrong results, mysterious " -"crashes." +"returned to the pool of available memory by exactly one call " +"to :c:func:`free`. It is important to call :c:func:`free` at the right " +"time. If a block's address is forgotten but :c:func:`free` is not called " +"for it, the memory it occupies cannot be reused until the program " +"terminates. This is called a :dfn:`memory leak`. On the other hand, if a " +"program calls :c:func:`free` for a block and then continues to use the " +"block, it creates a conflict with reuse of the block through " +"another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It " +"has the same bad consequences as referencing uninitialized data --- core " +"dumps, wrong results, mysterious crashes." msgstr "" #: ../../extending/extending.rst:876 @@ -1332,9 +1567,9 @@ msgstr "" #: ../../extending/extending.rst:920 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " -"The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." -"collect` function), as well as configuration interfaces and the ability to " -"disable the detector at runtime." +"The :mod:`gc` module exposes a way to run the detector " +"(the :func:`~gc.collect` function), as well as configuration interfaces and " +"the ability to disable the detector at runtime." msgstr "" #: ../../extending/extending.rst:929 @@ -1344,12 +1579,12 @@ msgstr "" #: ../../extending/extending.rst:931 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " -"the incrementing and decrementing of the reference count. :c:func:" -"`Py_DECREF` also frees the object when the count reaches zero. For " -"flexibility, it doesn't call :c:func:`free` directly --- rather, it makes a " -"call through a function pointer in the object's :dfn:`type object`. For " -"this purpose (and others), every object also contains a pointer to its type " -"object." +"the incrementing and decrementing of the reference " +"count. :c:func:`Py_DECREF` also frees the object when the count reaches " +"zero. For flexibility, it doesn't call :c:func:`free` directly --- rather, " +"it makes a call through a function pointer in the object's :dfn:`type " +"object`. For this purpose (and others), every object also contains a " +"pointer to its type object." msgstr "" #: ../../extending/extending.rst:938 @@ -1387,11 +1622,11 @@ msgstr "" #: ../../extending/extending.rst:961 msgid "" -"A borrowed reference can be changed into an owned reference by calling :c:" -"func:`Py_INCREF`. This does not affect the status of the owner from which " -"the reference was borrowed --- it creates a new owned reference, and gives " -"full owner responsibilities (the new owner must dispose of the reference " -"properly, as well as the previous owner)." +"A borrowed reference can be changed into an owned reference by " +"calling :c:func:`Py_INCREF`. This does not affect the status of the owner " +"from which the reference was borrowed --- it creates a new owned reference, " +"and gives full owner responsibilities (the new owner must dispose of the " +"reference properly, as well as the previous owner)." msgstr "" #: ../../extending/extending.rst:971 @@ -1411,20 +1646,20 @@ msgid "" "the reference. In particular, all functions whose function it is to create " "a new object, such as :c:func:`PyLong_FromLong` and :c:func:`Py_BuildValue`, " "pass ownership to the receiver. Even if the object is not actually new, you " -"still receive ownership of a new reference to that object. For instance, :c:" -"func:`PyLong_FromLong` maintains a cache of popular values and can return a " -"reference to a cached item." +"still receive ownership of a new reference to that object. For " +"instance, :c:func:`PyLong_FromLong` maintains a cache of popular values and " +"can return a reference to a cached item." msgstr "" #: ../../extending/extending.rst:985 msgid "" "Many functions that extract objects from other objects also transfer " -"ownership with the reference, for instance :c:func:" -"`PyObject_GetAttrString`. The picture is less clear, here, however, since a " -"few common routines are exceptions: :c:func:`PyTuple_GetItem`, :c:func:" -"`PyList_GetItem`, :c:func:`PyDict_GetItem`, and :c:func:" -"`PyDict_GetItemString` all return references that you borrow from the tuple, " -"list or dictionary." +"ownership with the reference, for " +"instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, " +"however, since a few common routines are " +"exceptions: :c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, " +"and :c:func:`PyDict_GetItemString` all return references that you borrow " +"from the tuple, list or dictionary." msgstr "" #: ../../extending/extending.rst:992 @@ -1439,10 +1674,11 @@ msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " "use :c:func:`Py_INCREF` to become an independent owner. There are exactly " -"two important exceptions to this rule: :c:func:`PyTuple_SetItem` and :c:func:" -"`PyList_SetItem`. These functions take over ownership of the item passed to " -"them --- even if they fail! (Note that :c:func:`PyDict_SetItem` and friends " -"don't take over ownership --- they are \"normal.\")" +"two important exceptions to this rule: :c:func:`PyTuple_SetItem` " +"and :c:func:`PyList_SetItem`. These functions take over ownership of the " +"item passed to them --- even if they fail! (Note " +"that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they " +"are \"normal.\")" msgstr "" #: ../../extending/extending.rst:1004 @@ -1617,8 +1853,8 @@ msgstr "" #: ../../extending/extending.rst:1110 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " -"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" -"func:`Py_XDECREF` do." +"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` " +"and :c:func:`Py_XDECREF` do." msgstr "" #: ../../extending/extending.rst:1114 @@ -1946,9 +2182,9 @@ msgstr "" #: ../../extending/extending.rst:1344 msgid "" -"All that a client module must do in order to have access to the function :c:" -"func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" -"import_spam` in its initialization function::" +"All that a client module must do in order to have access to the " +"function :c:func:`!PySpam_System` is to call the function (or rather " +"macro) :c:func:`!import_spam` in its initialization function::" msgstr "" #: ../../extending/extending.rst:1348 @@ -1987,12 +2223,12 @@ msgstr "" #: ../../extending/extending.rst:1374 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../extending/extending.rst:1375 msgid "" -"An interface for this function already exists in the standard module :mod:" -"`os` --- it was chosen as a simple and straightforward example." +"An interface for this function already exists in the standard " +"module :mod:`os` --- it was chosen as a simple and straightforward example." msgstr "" #: ../../extending/extending.rst:1378 diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index d344eb253f..3481c835b2 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -33,14 +33,14 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:26 msgid "" -"The :term:`CPython` runtime sees all Python objects as variables of type :c:" -"expr:`PyObject*`, which serves as a \"base type\" for all Python objects. " -"The :c:type:`PyObject` structure itself only contains the object's :term:" -"`reference count` and a pointer to the object's \"type object\". This is " -"where the action is; the type object determines which (C) functions get " -"called by the interpreter when, for instance, an attribute gets looked up on " -"an object, a method called, or it is multiplied by another object. These C " -"functions are called \"type methods\"." +"The :term:`CPython` runtime sees all Python objects as variables of " +"type :c:expr:`PyObject*`, which serves as a \"base type\" for all Python " +"objects. The :c:type:`PyObject` structure itself only contains the " +"object's :term:`reference count` and a pointer to the object's \"type " +"object\". This is where the action is; the type object determines which (C) " +"functions get called by the interpreter when, for instance, an attribute " +"gets looked up on an object, a method called, or it is multiplied by another " +"object. These C functions are called \"type methods\"." msgstr "" #: ../../extending/newtypes_tutorial.rst:35 @@ -60,8 +60,8 @@ msgstr "" msgid "" "What we're showing here is the traditional way of defining *static* " "extension types. It should be adequate for most uses. The C API also " -"allows defining heap-allocated extension types using the :c:func:" -"`PyType_FromSpec` function, which isn't covered in this tutorial." +"allows defining heap-allocated extension types using " +"the :c:func:`PyType_FromSpec` function, which isn't covered in this tutorial." msgstr "" #: ../../extending/newtypes_tutorial.rst:48 @@ -264,9 +264,10 @@ msgstr "" msgid "" "Note that the name is a dotted name that includes both the module name and " "the name of the type within the module. The module in this case is :mod:`!" -"custom` and the type is :class:`!Custom`, so we set the type name to :class:" -"`!custom.Custom`. Using the real dotted import path is important to make " -"your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" +"custom` and the type is :class:`!Custom`, so we set the type name " +"to :class:`!custom.Custom`. Using the real dotted import path is important " +"to make your type compatible with the :mod:`pydoc` and :mod:`pickle` " +"modules. ::" msgstr "" #: ../../extending/newtypes_tutorial.rst:135 @@ -279,9 +280,9 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:138 msgid "" -"This is so that Python knows how much memory to allocate when creating new :" -"class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only " -"used for variable-sized objects and should otherwise be zero." +"This is so that Python knows how much memory to allocate when creating " +"new :class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is " +"only used for variable-sized objects and should otherwise be zero." msgstr "" #: ../../extending/newtypes_tutorial.rst:144 @@ -324,11 +325,11 @@ msgstr ".tp_doc = PyDoc_STR(\"Custom objects\")," #: ../../extending/newtypes_tutorial.rst:166 msgid "" -"To enable object creation, we have to provide a :c:member:`~PyTypeObject." -"tp_new` handler. This is the equivalent of the Python method :meth:`~object." -"__new__`, but has to be specified explicitly. In this case, we can just use " -"the default implementation provided by the API function :c:func:" -"`PyType_GenericNew`. ::" +"To enable object creation, we have to provide " +"a :c:member:`~PyTypeObject.tp_new` handler. This is the equivalent of the " +"Python method :meth:`~object.__new__`, but has to be specified explicitly. " +"In this case, we can just use the default implementation provided by the API " +"function :c:func:`PyType_GenericNew`. ::" msgstr "" #: ../../extending/newtypes_tutorial.rst:171 @@ -337,8 +338,8 @@ msgstr ".tp_new = PyType_GenericNew," #: ../../extending/newtypes_tutorial.rst:173 msgid "" -"Everything else in the file should be familiar, except for some code in :c:" -"func:`!PyInit_custom`::" +"Everything else in the file should be familiar, except for some code " +"in :c:func:`!PyInit_custom`::" msgstr "" #: ../../extending/newtypes_tutorial.rst:176 @@ -357,24 +358,21 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:183 -#, fuzzy msgid "" "if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" "}" msgstr "" -"Py_INCREF(&CustomType);\n" -"if (PyModule_AddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" -" Py_DECREF(&CustomType);\n" +"if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" "}" #: ../../extending/newtypes_tutorial.rst:188 msgid "" -"This adds the type to the module dictionary. This allows us to create :" -"class:`!Custom` instances by calling the :class:`!Custom` class:" +"This adds the type to the module dictionary. This allows us to " +"create :class:`!Custom` instances by calling the :class:`!Custom` class:" msgstr "" #: ../../extending/newtypes_tutorial.rst:191 @@ -659,13 +657,13 @@ msgstr ".tp_dealloc = (destructor) Custom_dealloc," #: ../../extending/newtypes_tutorial.rst:264 msgid "" -"This method first clears the reference counts of the two Python attributes. :" -"c:func:`Py_XDECREF` correctly handles the case where its argument is " -"``NULL`` (which might happen here if ``tp_new`` failed midway). It then " -"calls the :c:member:`~PyTypeObject.tp_free` member of the object's type " -"(computed by ``Py_TYPE(self)``) to free the object's memory. Note that the " -"object's type might not be :class:`!CustomType`, because the object may be " -"an instance of a subclass." +"This method first clears the reference counts of the two Python " +"attributes. :c:func:`Py_XDECREF` correctly handles the case where its " +"argument is ``NULL`` (which might happen here if ``tp_new`` failed midway). " +"It then calls the :c:member:`~PyTypeObject.tp_free` member of the object's " +"type (computed by ``Py_TYPE(self)``) to free the object's memory. Note that " +"the object's type might not be :class:`!CustomType`, because the object may " +"be an instance of a subclass." msgstr "" #: ../../extending/newtypes_tutorial.rst:273 @@ -738,12 +736,13 @@ msgstr ".tp_new = Custom_new," #: ../../extending/newtypes_tutorial.rst:307 msgid "" "The ``tp_new`` handler is responsible for creating (as opposed to " -"initializing) objects of the type. It is exposed in Python as the :meth:" -"`~object.__new__` method. It is not required to define a ``tp_new`` member, " -"and indeed many extension types will simply reuse :c:func:" -"`PyType_GenericNew` as done in the first version of the :class:`!Custom` " -"type above. In this case, we use the ``tp_new`` handler to initialize the " -"``first`` and ``last`` attributes to non-``NULL`` default values." +"initializing) objects of the type. It is exposed in Python as " +"the :meth:`~object.__new__` method. It is not required to define a " +"``tp_new`` member, and indeed many extension types will simply " +"reuse :c:func:`PyType_GenericNew` as done in the first version of " +"the :class:`!Custom` type above. In this case, we use the ``tp_new`` " +"handler to initialize the ``first`` and ``last`` attributes to non-``NULL`` " +"default values." msgstr "" #: ../../extending/newtypes_tutorial.rst:315 @@ -752,8 +751,8 @@ msgid "" "``CustomType``, if a subclass is instantiated) and any arguments passed when " "the type was called, and is expected to return the instance created. " "``tp_new`` handlers always accept positional and keyword arguments, but they " -"often ignore the arguments, leaving the argument handling to initializer (a." -"k.a. ``tp_init`` in C or ``__init__`` in Python) methods." +"often ignore the arguments, leaving the argument handling to initializer " +"(a.k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" #: ../../extending/newtypes_tutorial.rst:323 @@ -774,8 +773,9 @@ msgstr "self = (CustomObject *) type->tp_alloc(type, 0);" #: ../../extending/newtypes_tutorial.rst:331 msgid "" -"Since memory allocation may fail, we must check the :c:member:`~PyTypeObject." -"tp_alloc` result against ``NULL`` before proceeding." +"Since memory allocation may fail, we must check " +"the :c:member:`~PyTypeObject.tp_alloc` result against ``NULL`` before " +"proceeding." msgstr "" #: ../../extending/newtypes_tutorial.rst:335 @@ -789,14 +789,15 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:341 msgid "" "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " -"that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object." -"__new__`), you must *not* try to determine what method to call using method " -"resolution order at runtime. Always statically determine what type you are " -"going to call, and call its :c:member:`~PyTypeObject.tp_new` directly, or " -"via ``type->tp_base->tp_new``. If you do not do this, Python subclasses of " -"your type that also inherit from other Python-defined classes may not work " -"correctly. (Specifically, you may not be able to create instances of such " -"subclasses without getting a :exc:`TypeError`.)" +"that calls a base type's :c:member:`~PyTypeObject.tp_new` " +"or :meth:`~object.__new__`), you must *not* try to determine what method to " +"call using method resolution order at runtime. Always statically determine " +"what type you are going to call, and call " +"its :c:member:`~PyTypeObject.tp_new` directly, or via ``type->tp_base-" +">tp_new``. If you do not do this, Python subclasses of your type that also " +"inherit from other Python-defined classes may not work correctly. " +"(Specifically, you may not be able to create instances of such subclasses " +"without getting a :exc:`TypeError`.)" msgstr "" #: ../../extending/newtypes_tutorial.rst:351 @@ -869,10 +870,10 @@ msgstr ".tp_init = (initproc) Custom_init," #: ../../extending/newtypes_tutorial.rst:384 msgid "" -"The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:" -"`~object.__init__` method. It is used to initialize an object after it's " -"created. Initializers always accept positional and keyword arguments, and " -"they should return either ``0`` on success or ``-1`` on error." +"The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as " +"the :meth:`~object.__init__` method. It is used to initialize an object " +"after it's created. Initializers always accept positional and keyword " +"arguments, and they should return either ``0`` on success or ``-1`` on error." msgstr "" #: ../../extending/newtypes_tutorial.rst:389 @@ -923,15 +924,15 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:416 msgid "" -"when we know that deallocation of the object [#]_ will neither release the :" -"term:`GIL` nor cause any calls back into our type's code;" +"when we know that deallocation of the object [#]_ will neither release " +"the :term:`GIL` nor cause any calls back into our type's code;" msgstr "" #: ../../extending/newtypes_tutorial.rst:419 msgid "" -"when decrementing a reference count in a :c:member:`~PyTypeObject." -"tp_dealloc` handler on a type which doesn't support cyclic garbage " -"collection [#]_." +"when decrementing a reference count in " +"a :c:member:`~PyTypeObject.tp_dealloc` handler on a type which doesn't " +"support cyclic garbage collection [#]_." msgstr "" #: ../../extending/newtypes_tutorial.rst:422 @@ -1018,12 +1019,12 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:467 msgid "" -"The method is implemented as a C function that takes a :class:`!Custom` (or :" -"class:`!Custom` subclass) instance as the first argument. Methods always " -"take an instance as the first argument. Methods often take positional and " -"keyword arguments as well, but in this case we don't take any and don't need " -"to accept a positional argument tuple or keyword argument dictionary. This " -"method is equivalent to the Python method:" +"The method is implemented as a C function that takes a :class:`!Custom` " +"(or :class:`!Custom` subclass) instance as the first argument. Methods " +"always take an instance as the first argument. Methods often take positional " +"and keyword arguments as well, but in this case we don't take any and don't " +"need to accept a positional argument tuple or keyword argument dictionary. " +"This method is equivalent to the Python method:" msgstr "" #: ../../extending/newtypes_tutorial.rst:474 @@ -1036,11 +1037,11 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:479 msgid "" -"Note that we have to check for the possibility that our :attr:`!first` and :" -"attr:`!last` members are ``NULL``. This is because they can be deleted, in " -"which case they are set to ``NULL``. It would be better to prevent deletion " -"of these attributes and to restrict the attribute values to be strings. " -"We'll see how to do that in the next section." +"Note that we have to check for the possibility that our :attr:`!first` " +"and :attr:`!last` members are ``NULL``. This is because they can be " +"deleted, in which case they are set to ``NULL``. It would be better to " +"prevent deletion of these attributes and to restrict the attribute values to " +"be strings. We'll see how to do that in the next section." msgstr "" #: ../../extending/newtypes_tutorial.rst:485 @@ -1122,9 +1123,9 @@ msgstr "" msgid "" "In this section, we'll provide finer control over how the :attr:`!first` " "and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " -"previous version of our module, the instance variables :attr:`!first` and :" -"attr:`!last` could be set to non-string values or even deleted. We want to " -"make sure that these attributes always contain strings." +"previous version of our module, the instance variables :attr:`!first` " +"and :attr:`!last` could be set to non-string values or even deleted. We want " +"to make sure that these attributes always contain strings." msgstr "" #: ../../extending/newtypes_tutorial.rst:538 @@ -1489,9 +1490,10 @@ msgstr "" msgid "" "In the second version of the :class:`!Custom` example, we allowed any kind " "of object to be stored in the :attr:`!first` or :attr:`!last` attributes " -"[#]_. Besides, in the second and third versions, we allowed subclassing :" -"class:`!Custom`, and subclasses may add arbitrary attributes. For any of " -"those two reasons, :class:`!Custom` objects can participate in cycles:" +"[#]_. Besides, in the second and third versions, we allowed " +"subclassing :class:`!Custom`, and subclasses may add arbitrary attributes. " +"For any of those two reasons, :class:`!Custom` objects can participate in " +"cycles:" msgstr "" #: ../../extending/newtypes_tutorial.rst:673 @@ -1757,11 +1759,11 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:708 msgid "" -"For each subobject that can participate in cycles, we need to call the :c:" -"func:`!visit` function, which is passed to the traversal method. The :c:func:" -"`!visit` function takes as arguments the subobject and the extra argument " -"*arg* passed to the traversal method. It returns an integer value that must " -"be returned if it is non-zero." +"For each subobject that can participate in cycles, we need to call " +"the :c:func:`!visit` function, which is passed to the traversal method. " +"The :c:func:`!visit` function takes as arguments the subobject and the extra " +"argument *arg* passed to the traversal method. It returns an integer value " +"that must be returned if it is non-zero." msgstr "" #: ../../extending/newtypes_tutorial.rst:714 @@ -1847,9 +1849,9 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:756 msgid "" -"Nevertheless, it is much easier and less error-prone to always use :c:func:" -"`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the " -"expense of robustness!" +"Nevertheless, it is much easier and less error-prone to always " +"use :c:func:`Py_CLEAR` when deleting an attribute. Don't try to micro-" +"optimize at the expense of robustness!" msgstr "" #: ../../extending/newtypes_tutorial.rst:760 @@ -1858,8 +1860,8 @@ msgid "" "attributes. It means the circular GC can be triggered inside the function. " "Since the GC assumes reference count is not zero, we need to untrack the " "object from the GC by calling :c:func:`PyObject_GC_UnTrack` before clearing " -"members. Here is our reimplemented deallocator using :c:func:" -"`PyObject_GC_UnTrack` and ``Custom_clear``::" +"members. Here is our reimplemented deallocator " +"using :c:func:`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" #: ../../extending/newtypes_tutorial.rst:767 @@ -1893,9 +1895,10 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:779 msgid "" -"That's pretty much it. If we had written custom :c:member:`~PyTypeObject." -"tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify " -"them for cyclic garbage collection. Most extensions will use the versions " +"That's pretty much it. If we had written " +"custom :c:member:`~PyTypeObject.tp_alloc` " +"or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify them for " +"cyclic garbage collection. Most extensions will use the versions " "automatically provided." msgstr "" @@ -2074,8 +2077,9 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:839 msgid "" -"This pattern is important when writing a type with custom :c:member:" -"`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. " +"This pattern is important when writing a type with " +"custom :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_dealloc` members. " "The :c:member:`~PyTypeObject.tp_new` handler should not actually create the " "memory for the object with its :c:member:`~PyTypeObject.tp_alloc`, but let " "the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." @@ -2083,15 +2087,14 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:845 msgid "" -"The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject." -"tp_base` specifying the type's concrete base class. Due to cross-platform " -"compiler issues, you can't fill that field directly with a reference to :c:" -"type:`PyList_Type`; it should be done later in the module initialization " -"function::" +"The :c:type:`PyTypeObject` struct supports " +"a :c:member:`~PyTypeObject.tp_base` specifying the type's concrete base " +"class. Due to cross-platform compiler issues, you can't fill that field " +"directly with a reference to :c:type:`PyList_Type`; it should be done later " +"in the module initialization function::" msgstr "" #: ../../extending/newtypes_tutorial.rst:851 -#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_sublist(void)\n" @@ -2126,10 +2129,8 @@ msgstr "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&SubListType);\n" -" if (PyModule_AddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) " -"{\n" -" Py_DECREF(&SubListType);\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -2139,11 +2140,11 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:871 msgid "" -"Before calling :c:func:`PyType_Ready`, the type structure must have the :c:" -"member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an " -"existing type, it is not necessary to fill out the :c:member:`~PyTypeObject." -"tp_alloc` slot with :c:func:`PyType_GenericNew` -- the allocation function " -"from the base type will be inherited." +"Before calling :c:func:`PyType_Ready`, the type structure must have " +"the :c:member:`~PyTypeObject.tp_base` slot filled in. When we are deriving " +"an existing type, it is not necessary to fill out " +"the :c:member:`~PyTypeObject.tp_alloc` slot with :c:func:`PyType_GenericNew` " +"-- the allocation function from the base type will be inherited." msgstr "" #: ../../extending/newtypes_tutorial.rst:877 @@ -2154,7 +2155,7 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:882 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../extending/newtypes_tutorial.rst:883 msgid "" diff --git a/faq/design.po b/faq/design.po index 8474f7dc97..91ee765253 100644 --- a/faq/design.po +++ b/faq/design.po @@ -138,17 +138,18 @@ msgstr "" #: ../../faq/design.rst:65 msgid "" -"The :class:`float` type in CPython uses a C ``double`` for storage. A :" -"class:`float` object's value is stored in binary floating-point with a fixed " -"precision (typically 53 bits) and Python uses C operations, which in turn " -"rely on the hardware implementation in the processor, to perform floating-" -"point operations. This means that as far as floating-point operations are " -"concerned, Python behaves like many popular languages including C and Java." -msgstr "" -"CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一個 :class:" -"`float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數,Python 使" -"用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表示就浮點數" -"運算來說,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。" +"The :class:`float` type in CPython uses a C ``double`` for storage. " +"A :class:`float` object's value is stored in binary floating-point with a " +"fixed precision (typically 53 bits) and Python uses C operations, which in " +"turn rely on the hardware implementation in the processor, to perform " +"floating-point operations. This means that as far as floating-point " +"operations are concerned, Python behaves like many popular languages " +"including C and Java." +msgstr "" +"CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一" +"個 :class:`float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數," +"Python 使用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表" +"示就浮點數運算來說,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。" #: ../../faq/design.rst:72 msgid "" @@ -249,11 +250,11 @@ msgid "" "``m_`` prefix, so this explicitness is still useful in those languages, too." msgstr "" "第一,這樣可以更明顯表現出你在用方法 (method) 或是實例 (instance) 的屬性,而" -"非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或 ``self." -"meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你可以藉由" -"沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以你必須去" -"看類別的定義來確定。有些 C++ 和 Java 的程式碼規格要求要在實例屬性的名稱加上前" -"綴 ``m_``,所以這種明確性在那些語言也是很好用的。" +"非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或 " +"``self.meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你" +"可以藉由沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以" +"你必須去看類別的定義來確定。有些 C++ 和 Java 的程式碼規格要求要在實例屬性的名" +"稱加上前綴 ``m_``,所以這種明確性在那些語言也是很好用的。" #: ../../faq/design.rst:127 msgid "" @@ -353,12 +354,12 @@ msgstr "" msgid "" "(b) When I read code that says len(x) I *know* that it is asking for the " "length of something. This tells me two things: the result is an integer, and " -"the argument is some kind of container. To the contrary, when I read x." -"len(), I have to already know that x is some kind of container implementing " -"an interface or inheriting from a class that has a standard len(). Witness " -"the confusion we occasionally have when a class that is not implementing a " -"mapping has a get() or keys() method, or something that isn't a file has a " -"write() method." +"the argument is some kind of container. To the contrary, when I read " +"x.len(), I have to already know that x is some kind of container " +"implementing an interface or inheriting from a class that has a standard " +"len(). Witness the confusion we occasionally have when a class that is not " +"implementing a mapping has a get() or keys() method, or something that isn't " +"a file has a write() method." msgstr "" "(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這" "告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我" @@ -419,8 +420,9 @@ msgstr "" msgid "" "The second objection is typically cast as: \"I am really telling a sequence " "to join its members together with a string constant\". Sadly, you aren't. " -"For some reason there seems to be much less difficulty with having :meth:" -"`~str.split` as a string method, since in that case it is easy to see that ::" +"For some reason there seems to be much less difficulty with " +"having :meth:`~str.split` as a string method, since in that case it is easy " +"to see that ::" msgstr "" "第二個反對意見通常是:「我是在叫一個序列把它的成員用一個字串常數連接起來」。" "但很遺憾地,你並不是在這樣做。因為某種原因,把 :meth:`~str.split` 當成字串方" @@ -544,8 +546,8 @@ msgstr "" #: ../../faq/design.rst:279 msgid "" -"For calling methods on objects, you can simplify yet further by using the :" -"func:`getattr` built-in to retrieve methods with a particular name::" +"For calling methods on objects, you can simplify yet further by using " +"the :func:`getattr` built-in to retrieve methods with a particular name::" msgstr "" "對於呼叫物件裡的方法,你可以利用內建用來找尋特定方法的函式 :func:`getattr` 來" "做進一步的簡化: ::" @@ -818,10 +820,10 @@ msgstr "" msgid "" "Lists, on the other hand, are more like arrays in other languages. They " "tend to hold a varying number of objects all of which have the same type and " -"which are operated on one-by-one. For example, :func:`os.listdir('.') ` returns a list of strings representing the files in the current " -"directory. Functions which operate on this output would generally not break " -"if you added another file or two to the directory." +"which are operated on one-by-one. For example, :func:`os.listdir('.') " +"` returns a list of strings representing the files in the " +"current directory. Functions which operate on this output would generally " +"not break if you added another file or two to the directory." msgstr "" "另一方面,串列更像是其他語言的陣列 (array)。他可以有不固定個同類別物件,且為" "逐項操作。舉例來說,:func:`os.listdir('.') ` 回傳當下目錄裡的檔" @@ -960,8 +962,8 @@ msgstr "" msgid "" "would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` " "used in the second line differs from that in the first line. In other " -"words, dictionary keys should be compared using ``==``, not using :keyword:" -"`is`." +"words, dictionary keys should be compared using ``==``, not " +"using :keyword:`is`." msgstr "" "這將會導致 :exc:`KeyError` 例外,因為 ``[1, 2]`` 的 id 在第一行和第二行是不同" "的。換句話說,字典的鍵應該要用 ``==`` 來做比較,而不是用 :keyword:`is`。" @@ -1011,9 +1013,7 @@ msgstr "" "如果你需要的話,這裡有個小技巧可以幫你,但請自己承擔風險:你可以把一個可變物" "件包裝進一個有 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法的類別" "實例。只要這種包裝物件還存在於字典(或其他類似結構)中,你就必須確定在字典" -"(或其他用雜湊為基底的結構)中他們的雜湊值會保持恆定。\n" -"\n" -"::" +"(或其他用雜湊為基底的結構)中他們的雜湊值會保持恆定。 ::" #: ../../faq/design.rst:513 msgid "" @@ -1062,16 +1062,16 @@ msgstr "" #: ../../faq/design.rst:534 msgid "" -"Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1." -"__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == " -"o2.__hash__()``), regardless of whether the object is in a dictionary or " -"not. If you fail to meet these restrictions dictionaries and other hash " -"based structures will misbehave." +"Furthermore it must always be the case that if ``o1 == o2`` (ie " +"``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, " +"``o1.__hash__() == o2.__hash__()``), regardless of whether the object is in " +"a dictionary or not. If you fail to meet these restrictions dictionaries " +"and other hash based structures will misbehave." msgstr "" "此外,不管物件是否在字典中,如果 ``o1 == o2``\\ (即 ``o1.__eq__(o2) is " -"True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() == o2." -"__hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜湊" -"為基底的結構會出現不正常的行為。" +"True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() == " +"o2.__hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜" +"湊為基底的結構會出現不正常的行為。" #: ../../faq/design.rst:539 msgid "" @@ -1136,16 +1136,17 @@ msgstr "" msgid "" "Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base " "Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` " -"to check whether an instance or a class implements a particular ABC. The :" -"mod:`collections.abc` module defines a set of useful ABCs such as :class:" -"`~collections.abc.Iterable`, :class:`~collections.abc.Container`, and :class:" -"`~collections.abc.MutableMapping`." +"to check whether an instance or a class implements a particular ABC. " +"The :mod:`collections.abc` module defines a set of useful ABCs such " +"as :class:`~collections.abc.Iterable`, :class:`~collections.abc.Container`, " +"and :class:`~collections.abc.MutableMapping`." msgstr "" "Python 2.6 加入了 :mod:`abc` 模組,讓你可以定義抽象基底類別 (Abstract Base " "Class, ABC)。你可以使用 :func:`isinstance` 和 :func:`issubclass` 來確認一個實" "例或是類別是否實作了某個抽象基底類別。而 :mod:`collections.abc` 模組定義了一" -"系列好用的抽象基底類別,像是 :class:`~collections.abc.Iterable`、:class:" -"`~collections.abc.Container` 和 :class:`~collections.abc.MutableMapping`。" +"系列好用的抽象基底類別,像" +"是 :class:`~collections.abc.Iterable`、:class:`~collections.abc.Container` " +"和 :class:`~collections.abc.MutableMapping`。" #: ../../faq/design.rst:578 msgid "" @@ -1159,12 +1160,12 @@ msgid "" "as a module interface specification and a set of examples. Many Python " "modules can be run as a script to provide a simple \"self test.\" Even " "modules which use complex external interfaces can often be tested in " -"isolation using trivial \"stub\" emulations of the external interface. The :" -"mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can " -"be used to construct exhaustive test suites that exercise every line of code " -"in a module." +"isolation using trivial \"stub\" emulations of the external interface. " +"The :mod:`doctest` and :mod:`unittest` modules or third-party test " +"frameworks can be used to construct exhaustive test suites that exercise " +"every line of code in a module." msgstr "" -"一個針對模組的好測試套件提供了回歸測試 (regression testing),並作為模組介面規" +"一個針對模組的好測試套件提供了迴歸測試 (regression testing),並作為模組介面規" "範和一組範例。許多 Python 模組可以直接當成腳本執行,並提供簡單的「自我測" "試」。即便模組使用了複雜的外部介面,他依然可以用外部介面的簡單的「樁」(stub) " "模擬來獨立測試。:mod:`doctest` 和 :mod:`unittest` 模組或第三方的測試框架可以" @@ -1209,16 +1210,16 @@ msgid "" "\"spaghetti\" code that was hard to understand and revise. In a high-level " "language, it is also unneeded as long as there are ways to branch (in " "Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, " -"and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:" -"`while` and :keyword:`for` statements, possibly containing :keyword:" -"`continue` and :keyword:`break`)." +"and :keyword:`if`/:keyword:`else` expressions) and loop " +"(with :keyword:`while` and :keyword:`for` statements, possibly " +"containing :keyword:`continue` and :keyword:`break`)." msgstr "" "在 1970 年代,人們了解到沒有限制的 goto 會導致混亂、難以理解和修改的「義大利" "麵」程式碼 (\"spaghetti\" code)。在高階語言裡,這也是不需要的,因為有方法可以" -"做邏輯分支(以 Python 來說,用 :keyword:`if` 陳述式和 :keyword:`or`、:" -"keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和迴圈(用 :keyword:" -"`while` 和 :keyword:`for` 陳述式,可能會有 :keyword:`continue` 和 :keyword:" -"`break`)。" +"做邏輯分支(以 Python 來說,用 :keyword:`if` 陳述式" +"和 :keyword:`or`、:keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和" +"迴圈(用 :keyword:`while` 和 :keyword:`for` 陳述式,可能會" +"有 :keyword:`continue` 和 :keyword:`break`)。" #: ../../faq/design.rst:614 msgid "" @@ -1437,14 +1438,14 @@ msgstr "為何產生器 (generator) 不支援 with 陳述式?" msgid "" "For technical reasons, a generator used directly as a context manager would " "not work correctly. When, as is most common, a generator is used as an " -"iterator run to completion, no closing is needed. When it is, wrap it as :" -"func:`contextlib.closing(generator) ` in the :keyword:" -"`with` statement." +"iterator run to completion, no closing is needed. When it is, wrap it " +"as :func:`contextlib.closing(generator) ` in " +"the :keyword:`with` statement." msgstr "" "出於技術原因,把產生器直接用作情境 (context) 管理器會無法正常運作。因為通常來" "說,產生器是被當成疊代器 (iterator),到最後完成時不需要被手動關閉。但如果你需" -"要的話,你可以在 :keyword:`with` 陳述式裡用 :func:`contextlib." -"closing(generator) ` 來包裝他。" +"要的話,你可以在 :keyword:`with` 陳述式裡" +"用 :func:`contextlib.closing(generator) ` 來包裝他。" #: ../../faq/design.rst:730 msgid "Why are colons required for the if/while/def/class statements?" diff --git a/faq/extending.po b/faq/extending.po index 720d5e9fe3..3235118126 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -95,7 +95,7 @@ msgid "" "`_ are also alternatives for wrapping C++ " "libraries." msgstr "" -"如果你需要連接到當前不存在 Python 擴充的某些 C 或 C++ 函式庫,你可以嘗試使用 " +"如果你需要連接到目前不存在 Python 擴充的某些 C 或 C++ 函式庫,你可以嘗試使用 " "`SWIG `_ 等工具包裝函式庫的資料型別和函式。`SIP " "`__、`CXX `_ `Boost `_ 或 `Weave " diff --git a/faq/general.po b/faq/general.po index ac24b2276b..ac684d513b 100644 --- a/faq/general.po +++ b/faq/general.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -84,14 +84,14 @@ msgid "" msgstr "" "Python 軟體基金會 (Python Software Foundation) 是一個獨立的非營利性組織,它擁" "有 Python 2.1 版與之後各版本的版權。PSF 的使命在於推展 Python 程式設計語言相" -"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://www." -"python.org/psf/。" +"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://" +"www.python.org/psf/。" #: ../../faq/general.rst:42 msgid "" "Donations to the PSF are tax-exempt in the US. If you use Python and find " -"it helpful, please contribute via `the PSF donation page `_." +"it helpful, please contribute via `the PSF donation page `_." msgstr "" "在美國捐款給 PSF 是免稅的。如果你使用了 Python 且發現它很有用,請至 `PSF 捐款" "頁面 `_\\ 為它做出貢獻。" @@ -333,6 +333,11 @@ msgid "" "See also the documentation for :data:`sys.version`, :data:`sys.hexversion`, " "and :data:`sys.version_info`." msgstr "" +"請參閱\\ `開發人員指南 `__\\ 以獲得更多關於開發週期的資訊,並參閱 :pep:`387` 以瞭" +"解更多關於 Python 的向後相容性政策。另外,也請查" +"看 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys.version_info` 的" +"說明文件。" #: ../../faq/general.rst:169 msgid "How do I obtain a copy of the Python source?" @@ -344,9 +349,9 @@ msgid "" "at https://www.python.org/downloads/. The latest development sources can be " "obtained at https://github.com/python/cpython/." msgstr "" -"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://www.python." -"org/downloads/。最新的開發中原始碼可以在 https://github.com/python/cpython/ " -"取得。" +"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://" +"www.python.org/downloads/。最新的開發中原始碼可以在 https://github.com/" +"python/cpython/ 取得。" #: ../../faq/general.rst:175 msgid "" @@ -421,9 +426,10 @@ msgid "" "There is a newsgroup, :newsgroup:`comp.lang.python`, and a mailing list, " "`python-list `_. The " "newsgroup and mailing list are gatewayed into each other -- if you can read " -"news it's unnecessary to subscribe to the mailing list. :newsgroup:`comp." -"lang.python` is high-traffic, receiving hundreds of postings every day, and " -"Usenet readers are often more able to cope with this volume." +"news it's unnecessary to subscribe to the mailing " +"list. :newsgroup:`comp.lang.python` is high-traffic, receiving hundreds of " +"postings every day, and Usenet readers are often more able to cope with this " +"volume." msgstr "" "有一個新聞群組 (newsgroup),:newsgroup:`comp.lang.python`,也有一個郵件討論" "群 (mailing list),`python-list `_." msgstr "" "新的軟體發布版本及事件的通知,可以在 comp.lang.python.announce 中找到,這是一" @@ -458,9 +464,9 @@ msgstr "如何取得 Python 的 beta 測試版本?" #: ../../faq/general.rst:229 msgid "" "Alpha and beta releases are available from https://www.python.org/" -"downloads/. All releases are announced on the comp.lang.python and comp." -"lang.python.announce newsgroups and on the Python home page at https://www." -"python.org/; an RSS feed of news is available." +"downloads/. All releases are announced on the comp.lang.python and " +"comp.lang.python.announce newsgroups and on the Python home page at https://" +"www.python.org/; an RSS feed of news is available." msgstr "" "Alpha 和 beta 發布版本可以從 https://www.python.org/downloads/ 取得。所有的發" "布版本都會在 comp.lang.python 和 comp.lang.python.announce 新聞群組上宣布,也" @@ -480,8 +486,8 @@ msgstr "如何提交 Python 的錯誤報告和修補程式?" #: ../../faq/general.rst:241 msgid "" -"To report a bug or submit a patch, use the issue tracker at https://github." -"com/python/cpython/issues." +"To report a bug or submit a patch, use the issue tracker at https://" +"github.com/python/cpython/issues." msgstr "" "要回報一個錯誤 (bug) 或提交一個修補程式 (patch),請使用於 https://github.com/" "python/cpython/issues 的問題追蹤系統。" @@ -547,8 +553,8 @@ msgstr "www.python.org 的真實位置在哪裡?" #: ../../faq/general.rst:274 msgid "" "The Python project's infrastructure is located all over the world and is " -"managed by the Python Infrastructure Team. Details `here `__." +"managed by the Python Infrastructure Team. Details `here `__." msgstr "" "Python 專案的基礎建設遍佈世界各地,由 Python 基礎建設團隊管理。詳細資訊\\ `在" "此 `__。" @@ -560,8 +566,8 @@ msgstr "為什麼要取名為 Python?" #: ../../faq/general.rst:281 msgid "" "When he began implementing Python, Guido van Rossum was also reading the " -"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " +"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " "Van Rossum thought he needed a name that was short, unique, and slightly " "mysterious, so he decided to call the language Python." msgstr "" @@ -611,7 +617,6 @@ msgstr "" "且會保證介面在一系列的錯誤修正發布版本中維持不變。" #: ../../faq/general.rst:311 -#, fuzzy msgid "" "The latest stable releases can always be found on the `Python download page " "`_. Python 3.x is the recommended version " @@ -619,9 +624,8 @@ msgid "" "maintained anymore <373>`." msgstr "" "最新的穩定發布版本隨時都可以在 `Python 下載頁面 `_\\ 上找到。Python 有兩個生產就緒 (production-ready) 的版本:2.x " -"和 3.x。推薦的版本是 3.x,此版本能被那些最為廣泛使用的函式庫所支援。雖然 2.x " -"仍然被廣泛使用,但\\ :pep:`它已不再被維護 <0373>`。" +"downloads/>`_\\ 上找到。Python 3.x 是推薦的版本,並且被大多數廣泛使用的函式庫" +"所支援。Python 2.x :pep:`已不再被維護 <0373>`。" #: ../../faq/general.rst:318 msgid "How many people are using Python?" @@ -657,8 +661,8 @@ msgstr "有沒有任何重要的專案使用 Python 完成開發?" #: ../../faq/general.rst:334 msgid "" "See https://www.python.org/about/success for a list of projects that use " -"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " +"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " "different companies and organizations." msgstr "" "要查看使用 Python 的專案清單,請參閱 https://www.python.org/about/success。藉" @@ -668,17 +672,17 @@ msgstr "" #: ../../faq/general.rst:339 msgid "" "High-profile Python projects include `the Mailman mailing list manager " -"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat `_, have written part or all of their installer and system " -"administration software in Python. Companies that use Python internally " -"include Google, Yahoo, and Lucasfilm Ltd." -msgstr "" -"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 `_\\ 和 `Zope 應用程式伺服器 `_。有一些 Linux 發行" -"版,最著名的是 `Red Hat `_,已經用 Python 編寫了部分" -"或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、Yahoo 和 " -"Lucasfilm Ltd。" +"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat " +"`_, have written part or all of their installer and " +"system administration software in Python. Companies that use Python " +"internally include Google, Yahoo, and Lucasfilm Ltd." +msgstr "" +"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 `_\\ 和 `Zope 應用程式伺服器 `_。有一些 " +"Linux 發行版,最著名的是 `Red Hat `_,已經用 Python " +"編寫了部分或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、" +"Yahoo 和 Lucasfilm Ltd。" #: ../../faq/general.rst:348 msgid "What new developments are expected for Python in the future?" @@ -699,8 +703,8 @@ msgstr "" #: ../../faq/general.rst:356 msgid "" -"New development is discussed on `the python-dev mailing list `_." +"New development is discussed on `the python-dev mailing list `_." msgstr "" "新的開發會在 `python-dev 郵件討論群 `_\\ 中討論。" @@ -810,7 +814,7 @@ msgstr "" #: ../../faq/general.rst:412 msgid "" ">>> L = []\n" -">>> dir(L) \n" +">>> dir(L)\n" "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" "'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" "'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" @@ -835,7 +839,7 @@ msgid "" "[1]" msgstr "" ">>> L = []\n" -">>> dir(L) \n" +">>> dir(L)\n" "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" "'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" "'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" @@ -889,13 +893,3 @@ msgid "" msgstr "" "如果你想討論 Python 在教育領域中的使用,你可能會有興趣加入 `edu-sig 郵件討論" "群 `_。" - -#~ msgid "See :pep:`6` for more information about bugfix releases." -#~ msgstr "更多關於錯誤修正發布的資訊請見 :pep:`6`。" - -#~ msgid "" -#~ "See also the documentation for :data:`sys.version`, :data:`sys." -#~ "hexversion`, and :data:`sys.version_info`." -#~ msgstr "" -#~ "另請參閱 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys." -#~ "version_info` 的說明文件。" diff --git a/faq/library.po b/faq/library.po index 3a9a9e0094..816e1e7b39 100644 --- a/faq/library.po +++ b/faq/library.po @@ -49,13 +49,13 @@ msgstr "" #: ../../faq/library.rst:21 #, fuzzy msgid "" -"For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " +"For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " "engine. Searching for \"Python\" plus a keyword or two for your topic of " "interest will usually find something helpful." msgstr "" -"對於第三方包,搜索`Python 包索引`_ 或嘗試`Google `_ 或其他網路搜索引擎。搜索 \"Python\" 加上你感興趣的主題的一" +"對於第三方包,搜尋`Python 包索引`_ 或嘗試`Google `_ 或其他網路搜尋引擎。搜尋 \"Python\" 加上你感興趣的主題的一" "兩個關鍵字通常會找到有用的東西。" #: ../../faq/library.rst:28 @@ -67,13 +67,13 @@ msgstr "哪裡可以找到 math.py (socket.py, regex.py, 等...) 來源檔案? msgid "" "If you can't find a source file for a module it may be a built-in or " "dynamically loaded module implemented in C, C++ or other compiled language. " -"In this case you may not have the source file or it may be something like :" -"file:`mathmodule.c`, somewhere in a C source directory (not on the Python " -"Path)." +"In this case you may not have the source file or it may be something " +"like :file:`mathmodule.c`, somewhere in a C source directory (not on the " +"Python Path)." msgstr "" "如果找不到模組的源檔案,它可能是用 C、C++ 或其他編譯語言實作的內置或動態載入" -"的模組。在這種情況下,你可能沒有源檔案,或者它可能類似於 :file:`mathmodule." -"c`,位於 C 源目錄中(不在 Python 路徑中)。" +"的模組。在這種情況下,你可能沒有源檔案,或者它可能類似" +"於 :file:`mathmodule.c`,位於 C 源目錄中(不在 Python 路徑中)。" #: ../../faq/library.rst:35 msgid "There are (at least) three kinds of modules in Python:" @@ -99,6 +99,8 @@ msgid "" "import sys\n" "print(sys.builtin_module_names)" msgstr "" +"import sys\n" +"print(sys.builtin_module_names)" #: ../../faq/library.rst:47 msgid "How do I make a Python script executable on Unix?" @@ -150,22 +152,21 @@ msgid "" "directory on the user's :envvar:`PATH`::" msgstr "" "如果你希望腳本獨立於 Python 直譯器所在的位置,你可以使用 :program:`env` 程" -"式。幾乎所有 Unix 變體都支援以下內容,假設 Python 直譯器位於使用者的 :envvar:" -"`PATH` 上的目錄中: ::" +"式。幾乎所有 Unix 變體都支援以下內容,假設 Python 直譯器位於使用者" +"的 :envvar:`PATH` 上的目錄中: ::" #: ../../faq/library.rst:69 msgid "#!/usr/bin/env python" msgstr "#!/usr/bin/env python" #: ../../faq/library.rst:71 -#, fuzzy msgid "" "*Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI " "scripts is often very minimal, so you need to use the actual absolute " "pathname of the interpreter." msgstr "" -"*不要*對 CGI 腳本執行此操作。 CGI 腳本的 :envvar:`PATH` 變數通常非常小,因此" -"你需要使用直譯器的實際絕對路徑名。" +"*不要*\\ 對 CGI 腳本執行此操作。CGI 腳本的 :envvar:`PATH` 變數通常非常小,因" +"此你需要使用直譯器的實際絕對路徑名稱。" #: ../../faq/library.rst:75 #, fuzzy @@ -200,7 +201,7 @@ msgstr "" #: ../../faq/library.rst:89 msgid "__doc__ = \"\"\"...Whatever...\"\"\"" -msgstr "" +msgstr "__doc__ = \"\"\"...Whatever...\"\"\"" #: ../../faq/library.rst:94 msgid "Is there a curses/termcap package for Python?" @@ -230,7 +231,7 @@ msgid "" msgstr "" ":mod:`curses` 模組支援基本的 curses 功能以及 ncurses 和 SYSV curses 的許多附" "加功能,例如顏色、替代字元集支援、鍵盤和鼠標支援。這意味著該模組與僅具有 BSD " -"curses 的作業系統不相容,但似乎沒有任何當前維護的作業系統屬於此類型。" +"curses 的作業系統不相容,但似乎沒有任何目前維護的作業系統屬於此類型。" #: ../../faq/library.rst:111 msgid "Is there an equivalent to C's onexit() in Python?" @@ -246,14 +247,14 @@ msgstr "" #: ../../faq/library.rst:118 msgid "Why don't my signal handlers work?" -msgstr "為什麼我的信號處理程式不起作用?" +msgstr "為什麼我的訊號處理程式不起作用?" #: ../../faq/library.rst:120 #, fuzzy msgid "" "The most common problem is that the signal handler is declared with the " "wrong argument list. It is called as ::" -msgstr "最常見的問題是信號處理程式是用錯誤的引數列表聲明的。它被稱為: ::" +msgstr "最常見的問題是訊號處理程式是用錯誤的引數列表聲明的。它被稱為: ::" #: ../../faq/library.rst:123 msgid "handler(signum, frame)" @@ -286,8 +287,8 @@ msgid "" "examples in the docstrings for a module and runs them, comparing the output " "with the expected output given in the docstring." msgstr "" -"Python 帶有兩個測試框架。 :mod:`doctest` 模組在模組的文檔字串中查詢示例並運行" -"它們,將輸出與文檔字串中給出的預期輸出進行比較。" +"Python 帶有兩個測試框架。 :mod:`doctest` 模組在模組的文件字串中查詢示例並運行" +"它們,將輸出與文件字串中給出的預期輸出進行比較。" #: ../../faq/library.rst:141 #, fuzzy @@ -311,19 +312,21 @@ msgid "" msgstr "" "為了使測試更容易,你應該在程式中使用良好的模組化設計。你的程式應該將幾乎所有" "功能都封裝在函式或類別方法中——這有時會產生使程式運行得更快的令人驚訝和令人愉" -"快的效果(因為局部變數存取比全局存取更快)。此外,該程式應避免依賴於可變的全" +"快的效果(因為局部變數存取比全域存取更快)。此外,該程式應避免依賴於可變的全" "局變數,因為這會使測試變得更加困難。" #: ../../faq/library.rst:152 #, fuzzy msgid "The \"global main logic\" of your program may be as simple as ::" -msgstr "你程式的「全局主邏輯」可能像一樣簡單: ::" +msgstr "你程式的「全域主邏輯」可能像一樣簡單: ::" #: ../../faq/library.rst:154 msgid "" "if __name__ == \"__main__\":\n" " main_logic()" msgstr "" +"if __name__ == \"__main__\":\n" +" main_logic()" #: ../../faq/library.rst:157 #, fuzzy @@ -360,6 +363,8 @@ msgid "" "if __name__ == \"__main__\":\n" " self_test()" msgstr "" +"if __name__ == \"__main__\":\n" +" self_test()" #: ../../faq/library.rst:173 #, fuzzy @@ -374,7 +379,7 @@ msgstr "" #: ../../faq/library.rst:179 #, fuzzy msgid "How do I create documentation from doc strings?" -msgstr "如何從文檔字串建立文檔?" +msgstr "如何從文件字串建立文件?" #: ../../faq/library.rst:181 #, fuzzy @@ -384,9 +389,9 @@ msgid "" "docstrings is `epydoc `_. `Sphinx `_ can also include docstring content." msgstr "" -":mod:`pydoc` 模組可以從 Python 源程式碼中的文檔字串建立 HTML。純粹從文檔字串" -"建立 API 文檔的另一種方法是 `epydoc `_。 " -"`Sphinx `_ 也可以包含文檔字串內容。" +":mod:`pydoc` 模組可以從 Python 源程式碼中的文件字串建立 HTML。純粹從文件字串" +"建立 API 文件的另一種方法是 `epydoc `_。 " +"`Sphinx `_ 也可以包含文件字串內容。" #: ../../faq/library.rst:188 #, fuzzy @@ -417,8 +422,9 @@ msgid "" "module. The :mod:`threading` module builds convenient abstractions on top of " "the low-level primitives provided by the :mod:`_thread` module." msgstr "" -"請務必使用 :mod:`threading` 模組而不是 :mod:`_thread` 模組。 :mod:" -"`threading` 模組在 :mod:`_thread` 模組提供的低階原語之上構建方便的抽象。" +"請務必使用 :mod:`threading` 模組而不是 :mod:`_thread` 模" +"組。 :mod:`threading` 模組在 :mod:`_thread` 模組提供的低階原語之上構建方便的" +"抽象。" #: ../../faq/library.rst:245 msgid "None of my threads seem to run: why?" @@ -455,6 +461,17 @@ msgid "" "\n" "time.sleep(10) # <---------------------------!" msgstr "" +"import threading, time\n" +"\n" +"def thread_task(name, n):\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10) # <---------------------------!" #: ../../faq/library.rst:265 #, fuzzy @@ -485,17 +502,27 @@ msgid "" "\n" "time.sleep(10)" msgstr "" +"def thread_task(name, n):\n" +" time.sleep(0.001) # <--------------------!\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10)" #: ../../faq/library.rst:282 #, fuzzy msgid "" "Instead of trying to guess a good delay value for :func:`time.sleep`, it's " -"better to use some kind of semaphore mechanism. One idea is to use the :mod:" -"`queue` module to create a queue object, let each thread append a token to " -"the queue when it finishes, and let the main thread read as many tokens from " -"the queue as there are threads." +"better to use some kind of semaphore mechanism. One idea is to use " +"the :mod:`queue` module to create a queue object, let each thread append a " +"token to the queue when it finishes, and let the main thread read as many " +"tokens from the queue as there are threads." msgstr "" -"與其嘗試為 :func:`time.sleep` 猜測一個好的延遲值,不如使用某種信號量機制。一" +"與其嘗試為 :func:`time.sleep` 猜測一個好的延遲值,不如使用某種訊號量機制。一" "種想法是使用 :mod:`queue` 模組建立一個隊列物件,讓每個執行緒在完成時向隊列新" "增一個權杖,並讓主執行緒從隊列中讀取與執行緒數一樣多的權杖。" @@ -510,8 +537,8 @@ msgid "" "The easiest way is to use the :mod:`concurrent.futures` module, especially " "the :mod:`~concurrent.futures.ThreadPoolExecutor` class." msgstr "" -"最簡單的方法是使用 :mod:`concurrent.futures` 模組,尤其是 :mod:`~concurrent." -"futures.ThreadPoolExecutor` 類別。" +"最簡單的方法是使用 :mod:`concurrent.futures` 模組,尤其" +"是 :mod:`~concurrent.futures.ThreadPoolExecutor` 類別。" #: ../../faq/library.rst:295 #, fuzzy @@ -523,10 +550,10 @@ msgid "" "``.get()`` method to return them. The class will take care of the locking " "necessary to ensure that each job is handed out exactly once." msgstr "" -"或者,如果你想對調度演算法進行精細控制,你可以手動編寫自己的邏輯。使用 :mod:" -"`queue` 模組建立一個包含作業列表的隊列。 :class:`~queue.Queue` 類別維護一個物" -"件列表,並有一個 `.put(obj)`` 方法將項目新增到隊列和一個 ``.get()`` 方法回傳" -"它們。該類別將負責必要的鎖定,以確保每個作業都恰好分發一次。" +"或者,如果你想對調度演算法進行精細控制,你可以手動編寫自己的邏輯。使" +"用 :mod:`queue` 模組建立一個包含作業列表的隊列。 :class:`~queue.Queue` 類別維" +"護一個物件列表,並有一個 `.put(obj)`` 方法將項目新增到隊列和一個 ``.get()`` " +"方法回傳它們。該類別將負責必要的鎖定,以確保每個作業都恰好分發一次。" #: ../../faq/library.rst:302 #, fuzzy @@ -610,16 +637,16 @@ msgstr "" #: ../../faq/library.rst:358 #, fuzzy msgid "" -"Consult the module's documentation for more details; the :class:`~queue." -"Queue` class provides a featureful interface." +"Consult the module's documentation for more details; " +"the :class:`~queue.Queue` class provides a featureful interface." msgstr "" -"有關更多詳細資訊,請參閱模組的文檔; :class:`~queue.Queue` 類別提供了一個功能" +"有關更多詳細資訊,請參閱模組的文件; :class:`~queue.Queue` 類別提供了一個功能" "強大的介面。" #: ../../faq/library.rst:363 #, fuzzy msgid "What kinds of global value mutation are thread-safe?" -msgstr "什麼樣的全局值突變是執行緒安全的?" +msgstr "什麼樣的全域值突變是執行緒安全的?" #: ../../faq/library.rst:365 #, fuzzy @@ -631,7 +658,7 @@ msgid "" "instruction and therefore all the C implementation code reached from each " "instruction is therefore atomic from the point of view of a Python program." msgstr "" -"內部使用 :term:`全局直譯器鎖 (GIL, global interpreter lock)`\\ 來確保一次只有" +"內部使用 :term:`全域直譯器鎖 (GIL, global interpreter lock)`\\ 來確保一次只有" "一個執行緒在 Python VM 中運行。通常,Python 僅提供位元組碼指令之間的執行緒切" "換;可以通過 :func:`sys.setswitchinterval` 設定它切換的頻率。因此,從 Python " "程式的角度來看,每條位元組碼指令以及從每條指令到達的所有 C 實作程式碼都是原子" @@ -703,18 +730,18 @@ msgstr "" #: ../../faq/library.rst:399 #, fuzzy msgid "" -"Operations that replace other objects may invoke those other objects' :meth:" -"`~object.__del__` method when their reference count reaches zero, and that " -"can affect things. This is especially true for the mass updates to " -"dictionaries and lists. When in doubt, use a mutex!" +"Operations that replace other objects may invoke those other " +"objects' :meth:`~object.__del__` method when their reference count reaches " +"zero, and that can affect things. This is especially true for the mass " +"updates to dictionaries and lists. When in doubt, use a mutex!" msgstr "" -"替換其他物件的操作可能會在引用計數達到零時呼叫其他物件的 :meth:`__del__` 方" +"替換其他物件的操作可能會在引用計數達到零時叫用其他物件的 :meth:`__del__` 方" "法,這可能會影響事情。對於字典和列表的大量更新尤其如此。如有疑問,請使用互斥" "體!" #: ../../faq/library.rst:406 msgid "Can't we get rid of the Global Interpreter Lock?" -msgstr "不能擺脫全局直譯器鎖嗎?" +msgstr "不能擺脫全域直譯器鎖嗎?" #: ../../faq/library.rst:408 #, fuzzy @@ -773,10 +800,10 @@ msgid "" "case you want more control over dispatching of tasks." msgstr "" "這並不意味著你不能在多 CPU 機器上用好 Python!你只需要創造性地將工作分配給多" -"個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中的 :class:" -"`~concurrent.futures.ProcessPoolExecutor` 類別提供了一種簡單的方法; :mod:" -"`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控制任務的調" -"度。" +"個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中" +"的 :class:`~concurrent.futures.ProcessPoolExecutor` 類別提供了一種簡單的方" +"法; :mod:`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控" +"制任務的調度。" #: ../../faq/library.rst:446 #, fuzzy @@ -784,8 +811,8 @@ msgid "" "Judicious use of C extensions will also help; if you use a C extension to " "perform a time-consuming task, the extension can release the GIL while the " "thread of execution is in the C code and allow other threads to get some " -"work done. Some standard library modules such as :mod:`zlib` and :mod:" -"`hashlib` already do this." +"work done. Some standard library modules such as :mod:`zlib` " +"and :mod:`hashlib` already do this." msgstr "" "明智地使用 C 擴充也會有所幫助;如果你使用 C 擴充來執行耗時任務,則該擴充可以" "在執行執行緒在 C 程式碼中時釋放 GIL,並允許其他執行緒完成一些工作。一些標準函" @@ -801,6 +828,11 @@ msgid "" "since these must be written with multiple interpreters in mind in order to " "be usable, so many older extension modules will not be usable." msgstr "" +"減少 GIL 影響的另一種方法是將 GIL 設置為直譯器各自狀態的鎖 (per-interpreter-" +"state lock),而不是真正的全域鎖。這在 :ref:`Python 3.12 中首次實現 " +"`,並且可於 C API 中使用。預計 Python 3.13 將會提供其 " +"Python 介面。目前主要的限制可能是第三方擴充模組,因為實作時必須考慮到多個直譯" +"器才能使用,因此許多舊的擴充模組將無法使用。" #: ../../faq/library.rst:462 msgid "Input and Output" @@ -814,12 +846,13 @@ msgstr "如何刪除檔案?(以及其他檔案問題...)" #, fuzzy msgid "" "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " -"see the :mod:`os` module. The two functions are identical; :func:`~os." -"unlink` is simply the name of the Unix system call for this function." +"see the :mod:`os` module. The two functions are " +"identical; :func:`~os.unlink` is simply the name of the Unix system call for " +"this function." msgstr "" -"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文檔,請參閱 :" -"mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 Unix 系" -"統呼叫的名稱。" +"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文件,請參" +"閱 :mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 " +"Unix 系統呼叫的名稱。" #: ../../faq/library.rst:471 #, fuzzy @@ -830,10 +863,10 @@ msgid "" "directories as long as they're empty; if you want to delete an entire " "directory tree and its contents, use :func:`shutil.rmtree`." msgstr "" -"要刪除目錄,請使用 :func:`os.rmdir`;使用 :func:`os.mkdir` 建立一個。 ``os." -"makedirs(path)`` 將在 ``path`` 中建立任何不存在的中間目錄。 ``os." -"removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹及其內" -"容,請使用 :func:`shutil.rmtree`。" +"要刪除目錄,請使用 :func:`os.rmdir`;使用 :func:`os.mkdir` 建立一個。 " +"``os.makedirs(path)`` 將在 ``path`` 中建立任何不存在的中間目錄。 " +"``os.removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹" +"及其內容,請使用 :func:`shutil.rmtree`。" #: ../../faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." @@ -844,23 +877,24 @@ msgstr "要重新命名檔案,請使用 ``os.rename(old_path, new_path)``。" msgid "" "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " "``f.truncate(offset)``; offset defaults to the current seek position. " -"There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os." -"open`, where *fd* is the file descriptor (a small integer)." +"There's also ``os.ftruncate(fd, offset)`` for files opened " +"with :func:`os.open`, where *fd* is the file descriptor (a small integer)." msgstr "" -"要截斷一個檔案,使用``f = open(filename, \"rb+\")``打開它,然後使用``f." -"truncate(offset)``;偏移量預設為當前搜索位置。對於使用 :func:`os.open` 打開的" -"檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" +"要截斷一個檔案,使用``f = open(filename, \"rb+\")``打開它,然後使用" +"``f.truncate(offset)``;偏移量預設為目前搜尋位置。對於使用 :func:`os.open` 打" +"開的檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" "數)。" #: ../../faq/library.rst:484 #, fuzzy msgid "" "The :mod:`shutil` module also contains a number of functions to work on " -"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, and :" -"func:`~shutil.rmtree`." +"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, " +"and :func:`~shutil.rmtree`." msgstr "" -":mod:`shutil` 模組還包含許多用於處理檔案的函式,包括:func:`~shutil." -"copyfile`、:func:`~shutil.copytree` 和:func:`~shutil.rmtree`。" +":mod:`shutil` 模組還包含許多用於處理檔案的函式,包" +"括:func:`~shutil.copyfile`、:func:`~shutil.copytree` " +"和:func:`~shutil.rmtree`。" #: ../../faq/library.rst:490 msgid "How do I copy a file?" @@ -879,10 +913,10 @@ msgid "" msgstr "" ":mod:`shutil` 模組包含一個 :func:`~shutil.copyfile` 函式。請注意,在 Windows " "NTFS 卷上,它不會複製 `alternate data streams `_ 也不會複製 `resource forks `__ 在 macOS HFS+ 卷上,儘管現在兩者都很少" -"使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其中" -"的大部分(儘管不是全部)。" +"NTFS#Alternate_data_stream_(ADS)>`_ 也不會複製 `resource forks `__ 在 macOS HFS+ 卷上,儘管現在兩者都很" +"少使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其" +"中的大部分(儘管不是全部)。" #: ../../faq/library.rst:503 msgid "How do I read (or write) binary data?" @@ -891,11 +925,11 @@ msgstr "如何讀取(或寫入)二進位制資料?" #: ../../faq/library.rst:505 #, fuzzy msgid "" -"To read or write complex binary data formats, it's best to use the :mod:" -"`struct` module. It allows you to take a string containing binary data " -"(usually numbers) and convert it to Python objects; and vice versa." +"To read or write complex binary data formats, it's best to use " +"the :mod:`struct` module. It allows you to take a string containing binary " +"data (usually numbers) and convert it to Python objects; and vice versa." msgstr "" -"要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你獲取包" +"要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你取得包" "含二進制資料(通常是數字)的字串並將其轉換為 Python 物件;反之亦然。" #: ../../faq/library.rst:509 @@ -948,14 +982,13 @@ msgid "" "instead (the default), the file will be open in text mode and ``f.read()`` " "will return :class:`str` objects rather than :class:`bytes` objects." msgstr "" -"要讀取和寫入二進制資料,必須以二進制模式打開檔案(這裡,將 ``\"rb\"`` 傳遞" +"要讀取和寫入二進位資料,必須以二進位模式打開檔案(這裡,將 ``\"rb\"`` 傳遞" "給 :func:`open`)。如果你改用 ``\"r\"``(預設設定),檔案將以文本模式打開,並" -"且 ``f.read()`` 將回傳 str 物件而不是 bytes ` 物件。" +"且 ``f.read()`` 將回傳 :class:`str` 物件而不是 :class:`bytes` 物件。" #: ../../faq/library.rst:535 -#, fuzzy msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" -msgstr "我似乎無法在用 os.popen() 建立的管道上使用 os.read();為什麼?" +msgstr "我似乎無法在用 os.popen() 建立的 pipe 上使用 os.read();為什麼?" #: ../../faq/library.rst:537 #, fuzzy @@ -963,8 +996,8 @@ msgid "" ":func:`os.read` is a low-level function which takes a file descriptor, a " "small integer representing the opened file. :func:`os.popen` creates a high-" "level file object, the same type returned by the built-in :func:`open` " -"function. Thus, to read *n* bytes from a pipe *p* created with :func:`os." -"popen`, you need to use ``p.read(n)``." +"function. Thus, to read *n* bytes from a pipe *p* created " +"with :func:`os.popen`, you need to use ``p.read(n)``." msgstr "" ":func:`os.read` 是一個低階函式,它接受一個檔案描述器,一個代表打開檔案的小整" "數。 :func:`os.popen` 建立一個高階檔案物件,與內置的 :func:`open` 函式回傳的" @@ -1011,9 +1044,9 @@ msgid "" "descriptor. This also happens automatically in ``f``'s destructor, when " "``f`` becomes garbage." msgstr "" -"對於你通過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件,``f." -"close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 C 檔" -"案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" +"對於你通過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件," +"``f.close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 " +"C 檔案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" #: ../../faq/library.rst:646 #, fuzzy @@ -1127,6 +1160,22 @@ msgid "" "server.sendmail(fromaddr, toaddrs, msg)\n" "server.quit()" msgstr "" +"import sys, smtplib\n" +"\n" +"fromaddr = input(\"From: \")\n" +"toaddrs = input(\"To: \").split(',')\n" +"print(\"Enter message, end with ^D:\")\n" +"msg = ''\n" +"while True:\n" +" line = sys.stdin.readline()\n" +" if not line:\n" +" break\n" +" msg += line\n" +"\n" +"# The actual mail send\n" +"server = smtplib.SMTP('localhost')\n" +"server.sendmail(fromaddr, toaddrs, msg)\n" +"server.quit()" #: ../../faq/library.rst:712 #, fuzzy @@ -1178,24 +1227,24 @@ msgid "" "return different values, so you're going to have to check what's returned on " "your system." msgstr "" -"為防止 TCP 連接阻塞,可以將 socket 設定為非阻塞模式。然後當你執行 :meth:" -"`socket.connect` 時,你要麼立即連接(不太可能),要麼得到一個例外,其中包含錯" -"誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未完成。不同" -"的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" +"為防止 TCP 連接阻塞,可以將 socket 設定為非阻塞模式。然後當你執" +"行 :meth:`socket.connect` 時,你要麼立即連接(不太可能),要麼得到一個例外," +"其中包含錯誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未" +"完成。不同的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" #: ../../faq/library.rst:745 #, fuzzy msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " -"an exception. It will just return the errno value. To poll, you can call :" -"meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` " -"indicate that you're connected -- or you can pass this socket to :meth:" -"`select.select` to check if it's writable." +"an exception. It will just return the errno value. To poll, you can " +"call :meth:`~socket.socket.connect_ex` again later -- ``0`` or " +"``errno.EISCONN`` indicate that you're connected -- or you can pass this " +"socket to :meth:`select.select` to check if it's writable." msgstr "" "你可以使用 :meth:`socket.connect_ex` 方法來避免建立例外。它只會回傳 errno " -"值。要輪詢,你可以稍後再次呼叫 :meth:`socket.connect_ex` - ``0`` 或 ``errno." -"EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞給 :meth:`select.select` " -"檢查它是否可寫。" +"值。要輪詢,你可以稍後再次呼叫 :meth:`socket.connect_ex` - ``0`` 或 " +"``errno.EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞" +"給 :meth:`select.select` 檢查它是否可寫。" #: ../../faq/library.rst:753 msgid "" @@ -1224,9 +1273,9 @@ msgstr "有的。" #, fuzzy msgid "" "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " -"` are also included with standard Python. There is also the :mod:" -"`sqlite3` module, which provides a lightweight disk-based relational " -"database." +"` are also included with standard Python. There is also " +"the :mod:`sqlite3` module, which provides a lightweight disk-based " +"relational database." msgstr "" "基於磁盤的雜湊介面,例如 :mod:`DBM ` 和 :mod:`GDBM ` 也包" "含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁盤的" @@ -1243,16 +1292,15 @@ msgstr "" "`_。" #: ../../faq/library.rst:779 -#, fuzzy msgid "How do you implement persistent objects in Python?" -msgstr "你如何在 Python 中實作持久物件?" +msgstr "你如何在 Python 中實作持久性物件?" #: ../../faq/library.rst:781 #, fuzzy msgid "" "The :mod:`pickle` library module solves this in a very general way (though " -"you still can't store things like open files, sockets or windows), and the :" -"mod:`shelve` library module uses pickle and (g)dbm to create persistent " +"you still can't store things like open files, sockets or windows), and " +"the :mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" ":mod:`pickle` 函式庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存" @@ -1301,7 +1349,7 @@ msgstr "``uniform(a, b)`` 會選擇 [a, b) 範圍內的浮點數。" #: ../../faq/library.rst:805 msgid "" "``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." -msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行採樣 (sample)。" +msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行取樣 (sample)。" #: ../../faq/library.rst:807 msgid "Some higher-level functions operate on sequences directly, such as:" @@ -1333,9 +1381,9 @@ msgstr "" #~ "interpreter state. Other object types have their own free list; these " #~ "free lists would have to be moved to the interpreter state. And so on." #~ msgstr "" -#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全局鎖;口譯員將無法共享" +#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全域鎖;口譯員將無法共享" #~ "物件。不幸的是,這也不太可能發生。這將是一項巨大的工作量,因為目前許多物件" -#~ "實作都具有全局狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" +#~ "實作都具有全域狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" #~ "其他物件型別有自己的空閒列表;這些空閒列表必須移至直譯器狀態。等等。" #, fuzzy @@ -1346,30 +1394,19 @@ msgstr "" #~ "to store all their global state in the interpreter state." #~ msgstr "" #~ "而且我懷疑它甚至可以在有限的時間內完成,因為第 3 方擴充存在同樣的問題。 " -#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全局狀態存儲在直譯器狀態中的" +#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全域狀態存儲在直譯器狀態中的" #~ "速度更快。" -#, fuzzy -#~ msgid "" -#~ "And finally, once you have multiple interpreters not sharing any state, " -#~ "what have you gained over running each interpreter in a separate process?" -#~ msgstr "" -#~ "最後,如果你有多個不共享任何狀態的直譯器,那麼在單獨的行程中運行每個直譯器" -#~ "有什麼好處呢?" - #, fuzzy #~ msgid "" #~ "Cameron Laird maintains a useful set of pages about Python web " -#~ "technologies at https://web.archive.org/web/20210224183619/http://phaseit." -#~ "net/claird/comp.lang.python/web_python." +#~ "technologies at https://web.archive.org/web/20210224183619/http://" +#~ "phaseit.net/claird/comp.lang.python/web_python." #~ msgstr "" #~ "Cameron Laird 在 https://web.archive.org/web/20210224183619/http://" #~ "phaseit.net/claird/comp.lang.python/web_python 維護著一組有用的關於 " #~ "Python 網路技術的頁面。" -#~ msgid "How can I mimic CGI form submission (METHOD=POST)?" -#~ msgstr "如何模擬 CGI 表單送出 (submission) (METHOD=POST)?" - #, fuzzy #~ msgid "" #~ "I would like to retrieve web pages that are the result of POSTing a form. " @@ -1387,8 +1424,9 @@ msgstr "" #~ "must be quoted using :func:`urllib.parse.urlencode`. For example, to " #~ "send ``name=Guy Steele, Jr.``::" #~ msgstr "" -#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使用 :func:`urllib." -#~ "parse.urlencode` 引用。例如,發送 ``name=Guy Steele, Jr.``: ::" +#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使" +#~ "用 :func:`urllib.parse.urlencode` 引用。例如,發送 ``name=Guy Steele, " +#~ "Jr.``: ::" #~ msgid "" #~ ">>> import urllib.parse\n" @@ -1398,6 +1436,3 @@ msgstr "" #~ ">>> import urllib.parse\n" #~ ">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" #~ "'name=Guy+Steele%2C+Jr.'" - -#~ msgid ":ref:`urllib-howto` for extensive examples." -#~ msgstr ":ref:`urllib-howto` 內有大量範例。" diff --git a/faq/programming.po b/faq/programming.po index 3a4d4abfe8..3f46c08fa7 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-04-06 00:16+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -296,7 +296,7 @@ msgstr "" msgid "" "In the example above you can access the outer scope variable by declaring it " "global:" -msgstr "在上面的示例中,你可以透過將其聲明為全域變數來存取外部範圍變數:" +msgstr "在上面的範例中,你可以透過將其聲明為全域變數來存取外部範圍變數:" #: ../../faq/programming.rst:167 #, fuzzy @@ -309,11 +309,10 @@ msgstr "" "在外部範圍內修改變數的值:" #: ../../faq/programming.rst:174 -#, fuzzy msgid "" "You can do a similar thing in a nested scope using the :keyword:`nonlocal` " "keyword:" -msgstr "你可以使用 :keyword:`nonlocal` 關鍵字在嵌套範圍內做類似的事情:" +msgstr "你可以使用 :keyword:`nonlocal` 關鍵字在巢狀作用域內做類似的事情:" #: ../../faq/programming.rst:192 msgid "What are the rules for local and global variables in Python?" @@ -347,11 +346,10 @@ msgstr "" "每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明的有用性。" #: ../../faq/programming.rst:208 -#, fuzzy msgid "" "Why do lambdas defined in a loop with different values all return the same " "result?" -msgstr "為什麼在具有不同值的迴圈中定義的 lambda 都回傳相同的結果?" +msgstr "為什麼以不同的值在迴圈中定義的 lambda 都回傳相同的結果?" #: ../../faq/programming.rst:210 msgid "" @@ -371,16 +369,15 @@ msgstr "" "... squares.append(lambda: x**2)" #: ../../faq/programming.rst:217 -#, fuzzy msgid "" "This gives you a list that contains 5 lambdas that calculate ``x**2``. You " "might expect that, when called, they would return, respectively, ``0``, " "``1``, ``4``, ``9``, and ``16``. However, when you actually try you will " "see that they all return ``16``::" msgstr "" -"這為你提供了一個包含 5 個計算 ``x**2`` 的 lambda 的list。你可能期望,當被呼叫" -"時,它們會分別回傳 ``0``、``1``、``4``、``9`` 和 ``16``。然而,當你實際嘗試" -"時,你會發現它們都回傳 ``16``: ::" +"這會提供一個包含五個計算 ``x**2`` 的 lambda 串列。你可能會預期在呼叫它時,它" +"們會分別回傳 ``0``、``1``、``4``、``9`` 和 ``16``,然而當你實際嘗試你會發現它" +"們都回傳 ``16``: ::" #: ../../faq/programming.rst:222 msgid "" @@ -395,7 +392,6 @@ msgstr "" "16" #: ../../faq/programming.rst:227 -#, fuzzy msgid "" "This happens because ``x`` is not local to the lambdas, but is defined in " "the outer scope, and it is accessed when the lambda is called --- not when " @@ -403,9 +399,9 @@ msgid "" "the functions now return ``4**2``, i.e. ``16``. You can also verify this by " "changing the value of ``x`` and see how the results of the lambdas change::" msgstr "" -"發生這種情況是因為 ``x`` 不是 lambda 的局部變數,而是在外部作用域中定義的,並" -"且在呼叫 lambda 時存取它——而不是在定義時存取它。在迴圈結束時,``x`` 的值為 " -"``4``,因此所有函式現在都回傳 ``4**2``,即 ``16``。你還可以透過更改 ``x`` 的" +"發生這種情況是因為 ``x`` 不是 lambda 的局部變數,而是在外部作用域中定義的,且" +"是在呼叫 lambda 時才會存取它,並非於定義時就會存取。在迴圈結束時,``x`` 的值" +"為 ``4``,因此所有函式都回傳 ``4**2``,即為 ``16``。你還可以透過更改 ``x`` 的" "值來驗證這一點,並查看 lambda 運算式的結果如何變化: ::" #: ../../faq/programming.rst:233 @@ -419,7 +415,6 @@ msgstr "" "64" #: ../../faq/programming.rst:237 -#, fuzzy msgid "" "In order to avoid this, you need to save the values in variables local to " "the lambdas, so that they don't rely on the value of the global ``x``::" @@ -494,7 +489,7 @@ msgstr "config.py: ::" #: ../../faq/programming.rst:270 msgid "x = 0 # Default value of the 'x' configuration setting" -msgstr "" +msgstr "x = 0 # 'x' 配置設定的預設值" #: ../../faq/programming.rst:272 msgid "mod.py::" @@ -523,16 +518,14 @@ msgstr "" "print(config.x)" #: ../../faq/programming.rst:283 -#, fuzzy msgid "" "Note that using a module is also the basis for implementing the singleton " "design pattern, for the same reason." msgstr "請注意,出於同樣的原因,使用模組也是實作單例設計模式的基礎。" #: ../../faq/programming.rst:288 -#, fuzzy msgid "What are the \"best practices\" for using import in a module?" -msgstr "在模組中使用 import 的「最佳實踐」是什麼?" +msgstr "在模組中使用 import 的「最佳實踐」有哪些?" #: ../../faq/programming.rst:290 #, fuzzy @@ -578,7 +571,6 @@ msgstr "" "dateutil`, :mod:`!requests`, :mod:`!PIL.Image`" #: ../../faq/programming.rst:304 -#, fuzzy msgid "locally developed modules" msgstr "本地開發的模組" @@ -599,7 +591,7 @@ msgid "" "module is busy importing the 2nd." msgstr "" "在兩個模組都使用 \"import \" 引入形式的情況下,循環引入很好。當第二個" -"模組想要從第一個模組中獲取一個名稱( \"from module import name\" )並且引入位" +"模組想要從第一個模組中取得一個名稱( \"from module import name\" )並且引入位" "於頂層時,它們會失敗。那是因為 1st 中的名稱尚不可用,因為第一個模組正忙於導" "入 2nd。" @@ -649,16 +641,14 @@ msgstr "" "data:`sys.modules` 中可用。" #: ../../faq/programming.rst:338 -#, fuzzy msgid "Why are default values shared between objects?" msgstr "為什麼物件之間共享預設值?" #: ../../faq/programming.rst:340 -#, fuzzy msgid "" "This type of bug commonly bites neophyte programmers. Consider this " "function::" -msgstr "這種型別的錯誤通常會困擾新手程式員。考慮這個功能: ::" +msgstr "這種類型的錯誤通常會困擾新手程式員。像是這個函式: ::" #: ../../faq/programming.rst:342 msgid "" @@ -667,15 +657,18 @@ msgid "" " mydict[key] = value\n" " return mydict" msgstr "" +"def foo(mydict={}): # 危險:所有呼叫共享對字典的參照\n" +" ... 計算一些東西 ...\n" +" mydict[key] = value\n" +" return mydict" #: ../../faq/programming.rst:347 -#, fuzzy msgid "" "The first time you call this function, ``mydict`` contains a single item. " "The second time, ``mydict`` contains two items because when ``foo()`` begins " "executing, ``mydict`` starts out with an item already in it." msgstr "" -"第一次呼叫此函式時, ``mydict`` 包含一個項目。第二次,``mydict`` 包含兩個項" +"第一次呼叫此函式時, ``mydict`` 包含一個項目。第二次後 ``mydict`` 包含兩個項" "目,因為當 ``foo()`` 開始執行時,``mydict`` 以其中已有的項目開始。" #: ../../faq/programming.rst:351 @@ -699,19 +692,18 @@ msgid "" "dictionaries, lists, and class instances can lead to confusion." msgstr "" "根據定義,數字、字串、元組和 ``None`` 等不可變物件是安全的,不會發生變化。對" -"字典、list和類別實例等可變物件的更改可能會導致混淆。" +"字典、串列和類別實例等可變物件的更改可能會導致混淆。" #: ../../faq/programming.rst:360 -#, fuzzy msgid "" "Because of this feature, it is good programming practice to not use mutable " "objects as default values. Instead, use ``None`` as the default value and " "inside the function, check if the parameter is ``None`` and create a new " "list/dictionary/whatever if it is. For example, don't write::" msgstr "" -"由於這個特性,不使用可變物件作為預設值是一個很好的編程習慣。相反,使用 " -"``None`` 作為預設值並在函式內部檢查參數是否為 ``None`` 並建立一個新的list/字" -"典/無論是否是。例如,不要寫: ::" +"由於這個特性,不使用可變物件作為預設值是一個很好的程式設計習慣,而是應使用 " +"``None`` 作為預設值,並在函式內部檢查參數是否為 ``None``,再建立一個新的串列/" +"字典/或其他東西。例如,不要這樣寫: ::" #: ../../faq/programming.rst:365 msgid "" @@ -723,7 +715,7 @@ msgstr "" #: ../../faq/programming.rst:368 msgid "but::" -msgstr "但是: ::" +msgstr "而是寫成: ::" #: ../../faq/programming.rst:370 msgid "" @@ -731,6 +723,9 @@ msgid "" " if mydict is None:\n" " mydict = {} # create a new dict for local namespace" msgstr "" +"def foo(mydict=None):\n" +" if mydict is None:\n" +" mydict = {} # 為區域命名空間建立一個新字典" #: ../../faq/programming.rst:374 #, fuzzy @@ -758,13 +753,21 @@ msgid "" " _cache[(arg1, arg2)] = result # Store result in the cache\n" " return result" msgstr "" +"# 呼叫者只能提供兩個參數,並選擇性地透過關鍵字傳遞 _cache\n" +"def expensive(arg1, arg2, *, _cache={}):\n" +" if (arg1, arg2) in _cache:\n" +" return _cache[(arg1, arg2)]\n" +"\n" +" # Calculate the value\n" +" result = ... expensive computation ...\n" +" _cache[(arg1, arg2)] = result # 將結果存儲在快取中\n" +" return result" #: ../../faq/programming.rst:389 -#, fuzzy msgid "" "You could use a global variable containing a dictionary instead of the " "default value; it's a matter of taste." -msgstr "你可以使用包含字典的全域變數而不是預設值;這是一個品味問題。" +msgstr "你可以使用包含字典的全域變數而不是預設值;這取決於喜好。" #: ../../faq/programming.rst:394 #, fuzzy @@ -803,7 +806,6 @@ msgid "What is the difference between arguments and parameters?" msgstr "引數 (arguments) 和參數 (parameters) 有什麼區別?" #: ../../faq/programming.rst:417 -#, fuzzy msgid "" ":term:`Parameters ` are defined by the names that appear in a " "function definition, whereas :term:`arguments ` are the values " @@ -813,7 +815,7 @@ msgid "" msgstr "" ":term:`參數 `\\ 由出現在函式定義中的名稱定義,而\\ :term:`引數 " "`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的\\ :term:" -"引數種類 `。例如,給定函式定義: ::" +"`引數種類 `。例如,給定以下函式定義: ::" #: ../../faq/programming.rst:423 msgid "" @@ -828,7 +830,7 @@ msgid "" "*foo*, *bar* and *kwargs* are parameters of ``func``. However, when calling " "``func``, for example::" msgstr "" -"*foo*、*bar* 和 *kwargs* 是 ``func`` 的參數。然而,當呼叫 ``func`` 時,例" +"*foo*、*bar* 和 *kwargs* 是 ``func`` 的參數。然而當呼叫 ``func`` 時,例" "如: ::" #: ../../faq/programming.rst:429 @@ -837,11 +839,11 @@ msgstr "func(42, bar=314, extra=somevar)" #: ../../faq/programming.rst:431 msgid "the values ``42``, ``314``, and ``somevar`` are arguments." -msgstr "``42`` 、 ``314`` 和 ``somevar`` 是引數。" +msgstr "``42``、``314`` 和 ``somevar`` 是引數。" #: ../../faq/programming.rst:435 msgid "Why did changing list 'y' also change list 'x'?" -msgstr "為什麼更改 list 'y' 也會更改 list 'x'?" +msgstr "為什麼更改串列 'y' 也會更改串列 'x'?" #: ../../faq/programming.rst:437 msgid "If you wrote code like::" @@ -892,19 +894,17 @@ msgid "" msgstr "list 是 :term:`mutable`,這意味著你可以變更它們的內容。" #: ../../faq/programming.rst:457 -#, fuzzy msgid "" "After the call to :meth:`!append`, the content of the mutable object has " "changed from ``[]`` to ``[10]``. Since both the variables refer to the same " "object, using either name accesses the modified value ``[10]``." msgstr "" "在呼叫 :meth:`!append` 之後,可變物件的內容從 ``[]`` 變成了 ``[10]``。由於這" -"兩個變數都參照同一個物件,因此使用任一名稱都可以存取修改後的值 ``[10]`` 。" +"兩個變數都參照同一個物件,因此使用任一名稱都可以存取修改後的值 ``[10]``。" #: ../../faq/programming.rst:461 -#, fuzzy msgid "If we instead assign an immutable object to ``x``::" -msgstr "如果我們改為將不可變物件分配給 ``x``: ::" +msgstr "如果我們改為賦予一個不可變物件給 ``x``: ::" #: ../../faq/programming.rst:463 msgid "" @@ -916,6 +916,13 @@ msgid "" ">>> y\n" "5" msgstr "" +">>> x = 5 # 整數為不可變的\n" +">>> y = x\n" +">>> x = x + 1 # 5 不可變,在這邊會建立一個新物件\n" +">>> x\n" +"6\n" +">>> y\n" +"5" #: ../../faq/programming.rst:471 #, fuzzy @@ -1004,12 +1011,10 @@ msgstr "" "置函式 :func:`id`。" #: ../../faq/programming.rst:510 -#, fuzzy msgid "How do I write a function with output parameters (call by reference)?" -msgstr "如何編寫帶有輸出參數的函式(透過參照呼叫)?" +msgstr "如何編寫帶有輸出參數的函式(透過傳參照呼叫 (call by reference))?" #: ../../faq/programming.rst:512 -#, fuzzy msgid "" "Remember that arguments are passed by assignment in Python. Since " "assignment just creates references to objects, there's no alias between an " @@ -1017,7 +1022,7 @@ msgid "" "You can achieve the desired effect in a number of ways." msgstr "" "請記住,在 Python 中引數是透過賦值傳遞的。由於賦值只是建立對物件的參照,因此" -"呼叫者和被呼叫者的引數名稱之間沒有別名,因此本身沒有按參照呼叫。你可以透過多" +"呼叫者和被呼叫者的引數名稱之間沒有別名,因此本身沒有傳參照呼叫。你可以透過多" "種方式實作所需的效果。" #: ../../faq/programming.rst:517 @@ -1035,22 +1040,27 @@ msgid "" ">>> func1(x, y)\n" "('new-value', 100)" msgstr "" +">>> def func1(a, b):\n" +"... a = 'new-value' # a 和 b 為區域名稱\n" +"... b = b + 1 # 賦值到新物件\n" +"... return a, b # 回傳新值\n" +"...\n" +">>> x, y = 'old-value', 99\n" +">>> func1(x, y)\n" +"('new-value', 100)" #: ../../faq/programming.rst:528 -#, fuzzy msgid "This is almost always the clearest solution." -msgstr "這幾乎總是最清晰的解決方案。" +msgstr "這幾乎都會是最清楚的方案。" #: ../../faq/programming.rst:530 -#, fuzzy msgid "" "By using global variables. This isn't thread-safe, and is not recommended." -msgstr "透過使用全域變數。這不是執行緒安全的,不推薦。" +msgstr "透過使用全域變數。這不是執行緒安全的,所以不推薦。" #: ../../faq/programming.rst:532 -#, fuzzy msgid "By passing a mutable (changeable in-place) object::" -msgstr "透過傳遞一個可變的(原地可變的)物件: ::" +msgstr "透過傳遞一個可變的(可於原地 (in-place) 改變的)物件: ::" #: ../../faq/programming.rst:534 msgid "" @@ -1063,11 +1073,18 @@ msgid "" ">>> args\n" "['new-value', 100]" msgstr "" +">>> def func2(a):\n" +"... a[0] = 'new-value' # 'a' 參照一個可變的串列\n" +"... a[1] = a[1] + 1 # 改變共享的物件\n" +"...\n" +">>> args = ['old-value', 99]\n" +">>> func2(args)\n" +">>> args\n" +"['new-value', 100]" #: ../../faq/programming.rst:543 -#, fuzzy msgid "By passing in a dictionary that gets mutated::" -msgstr "透過傳入一個發生變異的字典: ::" +msgstr "透過傳入一個發生改變的字典: ::" #: ../../faq/programming.rst:545 msgid "" @@ -1080,9 +1097,16 @@ msgid "" ">>> args\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> def func3(args):\n" +"... args['a'] = 'new-value' # args 是可變字典\n" +"... args['b'] = args['b'] + 1 # 原地改變它\n" +"...\n" +">>> args = {'a': 'old-value', 'b': 99}\n" +">>> func3(args)\n" +">>> args\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:554 -#, fuzzy msgid "Or bundle up values in a class instance::" msgstr "或者在類別實例中捆綁值: ::" @@ -1102,24 +1126,33 @@ msgid "" ">>> vars(args)\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> class Namespace:\n" +"... def __init__(self, /, **args):\n" +"... for key, value in args.items():\n" +"... setattr(self, key, value)\n" +"...\n" +">>> def func4(args):\n" +"... args.a = 'new-value' # args 是可變命名空間\n" +"... args.b = args.b + 1 # 原地改變物件\n" +"...\n" +">>> args = Namespace(a='old-value', b=99)\n" +">>> func4(args)\n" +">>> vars(args)\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:571 -#, fuzzy msgid "There's almost never a good reason to get this complicated." -msgstr "幾乎沒有充分的理由讓事情變得如此復雜。" +msgstr "幾乎不會有要讓事情變得如此複雜的充分理由。" #: ../../faq/programming.rst:573 -#, fuzzy msgid "Your best choice is to return a tuple containing the multiple results." msgstr "你最好的選擇是回傳一個包含多個結果的元組。" #: ../../faq/programming.rst:577 -#, fuzzy msgid "How do you make a higher order function in Python?" msgstr "你如何在 Python 中建立高階函式?" #: ../../faq/programming.rst:579 -#, fuzzy msgid "" "You have two choices: you can use nested scopes or you can use callable " "objects. For example, suppose you wanted to define ``linear(a,b)`` which " @@ -1127,7 +1160,8 @@ msgid "" "scopes::" msgstr "" "你有兩種選擇:可以使用巢狀作用域,也可以使用可呼叫物件。例如,假設你想定義 " -"linear(a,b) ,它回傳一個計算值 a*x+b 的函式 f(x) 。使用嵌套範圍: ::" +"``linear(a,b)``,它會回傳 ``a*x+b`` 計算值的函式 ``f(x)``。使用巢狀作用" +"域: ::" #: ../../faq/programming.rst:583 msgid "" @@ -1164,7 +1198,6 @@ msgstr "" " return self.a * x + self.b" #: ../../faq/programming.rst:598 -#, fuzzy msgid "In both cases, ::" msgstr "在這兩種情況下: ::" @@ -1173,9 +1206,8 @@ msgid "taxes = linear(0.3, 2)" msgstr "taxes = linear(0.3, 2)" #: ../../faq/programming.rst:602 -#, fuzzy msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``." -msgstr "給出一個可呼叫物件,其中 ``taxes(10e6) == 0.3 * 10e6 + 2``。" +msgstr "給定一個可呼叫物件,其中 ``taxes(10e6) == 0.3 * 10e6 + 2``。" #: ../../faq/programming.rst:604 #, fuzzy @@ -1339,7 +1371,7 @@ msgid "" "instance's name is ``a`` or ``b``, since both names are bound to the same " "value." msgstr "" -"可以說該類別有一個名稱:即使它綁定到兩個名稱並透過名稱 ``B`` 呼叫,建立的實例" +"可以說該類別有一個名稱:即使它綁定到兩個名稱並透過名稱 ``B`` 叫用,建立的實例" "仍然被報告為類別 ``A`` 的實例。但是,無法確定實例的名稱是 ``a`` 還是 ``b`` ," "因為這兩個名稱都綁定到相同的值。" @@ -1379,9 +1411,8 @@ msgid "" msgstr "....如果你發現它有很多名字,或者根本沒有名字,請不要感到驚訝!" #: ../../faq/programming.rst:701 -#, fuzzy msgid "What's up with the comma operator's precedence?" -msgstr "逗號運算子的優先級是怎麼回事?" +msgstr "逗號運算子的優先級是什麼?" #: ../../faq/programming.rst:703 #, fuzzy @@ -1482,7 +1513,7 @@ msgid "" "Bartelt::" msgstr "" "是的。通常這是透過在 :keyword:`!lambda` 中嵌套 :keyword:`lambda` 來完成的。請" -"參閱以下三個示例,稍微改編自 Ulf Bartelt: ::" +"參閱以下三個範例,稍微改編自 Ulf Bartelt: ::" #: ../../faq/programming.rst:747 msgid "" @@ -1518,7 +1549,7 @@ msgstr "孩子們,不要在家裡嘗試這個!" #: ../../faq/programming.rst:777 msgid "What does the slash(/) in the parameter list of a function mean?" -msgstr "函式參數串列中的斜槓 (/) 是什麼意思?" +msgstr "函式參數串列中的斜線 (/) 是什麼意思?" #: ../../faq/programming.rst:779 #, fuzzy @@ -1530,7 +1561,7 @@ msgid "" "position. For example, :func:`divmod` is a function that accepts positional-" "only parameters. Its documentation looks like this::" msgstr "" -"函式引數list中的斜杠表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" +"函式引數list中的斜線表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" "的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" "func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" @@ -1549,13 +1580,12 @@ msgstr "" " Return the tuple (x//y, x%y). Invariant: div*y + mod == x." #: ../../faq/programming.rst:792 -#, fuzzy msgid "" "The slash at the end of the parameter list means that both parameters are " "positional-only. Thus, calling :func:`divmod` with keyword arguments would " "lead to an error::" msgstr "" -"參數list末尾的斜杠表示兩個參數都是位置參數。因此,使用關鍵字引數呼叫 :func:" +"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼叫 :func:" "`divmod` 會導致錯誤: ::" #: ../../faq/programming.rst:796 @@ -1670,13 +1700,12 @@ msgid "How do I get int literal attribute instead of SyntaxError?" msgstr "如何取得 int 文字屬性而不是 SyntaxError?" #: ../../faq/programming.rst:850 -#, fuzzy msgid "" "Trying to lookup an ``int`` literal attribute in the normal manner gives a :" "exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" -"嘗試以正常方式查詢 ``int`` 文字屬性會給出一個 SyntaxError ,因為句點被視為小" -"數點: ::" +"嘗試以正常方式查找 ``int`` 字面值屬性會給出一個 :exc:`SyntaxError`,因為句點" +"被視為小數點: ::" #: ../../faq/programming.rst:853 msgid "" @@ -1693,11 +1722,10 @@ msgstr "" "SyntaxError: invalid decimal literal" #: ../../faq/programming.rst:859 -#, fuzzy msgid "" "The solution is to separate the literal from the period with either a space " "or parentheses." -msgstr "解決方案是用空格或圓括號將文字與句點分開。" +msgstr "解決方式是用空格或圓括號將字面值與句點分開。" #: ../../faq/programming.rst:869 msgid "How do I convert a string to a number?" @@ -1710,7 +1738,7 @@ msgid "" "``int('144') == 144``. Similarly, :func:`float` converts to a floating-" "point number, e.g. ``float('144') == 144.0``." msgstr "" -"對於整數,使用內建的 int 型別構造函式,例如``int('144') == 144``。同樣,:" +"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同樣,:" "func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" #: ../../faq/programming.rst:875 @@ -1768,19 +1796,17 @@ msgid "" "sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"." "format(1.0/3.0)`` yields ``'0.333'``." msgstr "" -"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別構造函式 :func:" +"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函式 :func:" "`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` 或 :func:" "`oct`。對於精美的格式,請參閱:ref:`f-strings` 和:ref:`formatstrings` 部分,例" "如``\"{:04d}\".format(144)`` 產生 ``'0144'`` 和 ``\"{:.3f}\"." "format(1.0/3.0)`` 產生 ``'0.333'`` ." #: ../../faq/programming.rst:906 -#, fuzzy msgid "How do I modify a string in place?" msgstr "如何原地修改字串?" #: ../../faq/programming.rst:908 -#, fuzzy msgid "" "You can't, because strings are immutable. In most situations, you should " "simply construct a new string from the various parts you want to assemble it " @@ -1788,12 +1814,11 @@ msgid "" "unicode data, try using an :class:`io.StringIO` object or the :mod:`array` " "module::" msgstr "" -"你不能,因為字串是不可變的。在大多數情況下,你應該簡單地從要組裝的各個部分構" -"造一個新字串。但是,如果你需要一個能夠修改原地 unicode 資料的物件,請嘗試使" +"這沒辦法做到,因為字串是不可變的。在大多數情況下,你應以要拿來組裝的各個部分" +"建構出一個新字串。但是如果你需要一個能夠原地修改 unicode 資料的物件,請嘗試使" "用 :class:`io.StringIO` 物件或 :mod:`array` 模組: ::" #: ../../faq/programming.rst:914 -#, fuzzy msgid "" ">>> import io\n" ">>> s = \"Hello, world\"\n" @@ -1830,24 +1855,22 @@ msgstr "" "'Hello, there!'\n" "\n" ">>> import array\n" -">>> a = array.array('u', s)\n" +">>> a = array.array('w', s)\n" ">>> print(a)\n" -"array('u', 'Hello, world')\n" +"array('w', 'Hello, world')\n" ">>> a[0] = 'y'\n" ">>> print(a)\n" -"array('u', 'yello, world')\n" +"array('w', 'yello, world')\n" ">>> a.tounicode()\n" "'yello, world'" #: ../../faq/programming.rst:938 -#, fuzzy msgid "How do I use strings to call functions/methods?" msgstr "如何使用字串呼叫函式/方法?" #: ../../faq/programming.rst:940 -#, fuzzy msgid "There are various techniques." -msgstr "有各種各樣的技術。" +msgstr "有各式各樣的技法。" #: ../../faq/programming.rst:942 #, fuzzy @@ -1858,7 +1881,7 @@ msgid "" "a case construct::" msgstr "" "最好的方法是使用將字串對映到函式的字典。這種技術的主要優點是字串不需要與函式" -"名稱相匹配。這也是用於模擬案例構造的主要技術: ::" +"名稱相匹配。這也是用於模擬案例建構的主要技術: ::" #: ../../faq/programming.rst:947 msgid "" @@ -1886,16 +1909,14 @@ msgstr "" "getattr(foo, 'bar')()" #: ../../faq/programming.rst:962 -#, fuzzy msgid "" "Note that :func:`getattr` works on any object, including classes, class " "instances, modules, and so on." msgstr "請注意 :func:`getattr` 適用於任何物件,包括類別、類別實例、模組等。" #: ../../faq/programming.rst:965 -#, fuzzy msgid "This is used in several places in the standard library, like this::" -msgstr "這在標準函式庫中的幾個地方使用,如下所示: ::" +msgstr "這在標準函式庫中的幾個地方被使用,如: ::" #: ../../faq/programming.rst:967 msgid "" @@ -1944,9 +1965,10 @@ msgstr "" #: ../../faq/programming.rst:990 #, fuzzy msgid "" -"Is there an equivalent to Perl's chomp() for removing trailing newlines from " -"strings?" -msgstr "是否有與 Perl 的 chomp() 等效的方法用於從字串中刪除尾隨換行符?" +"Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines " +"from strings?" +msgstr "" +"是否有與 Perl 的 chomp() 等效的方法,能用於從字串中刪除後綴的換行符號?" #: ../../faq/programming.rst:992 msgid "" @@ -1982,8 +2004,8 @@ msgstr "" #: ../../faq/programming.rst:1009 #, fuzzy -msgid "Is there a scanf() or sscanf() equivalent?" -msgstr "是否有 scanf() 或 sscanf() 等價物?" +msgid "Is there a ``scanf()`` or ``sscanf()`` equivalent?" +msgstr "是否有 scanf() 或 sscanf() 的等效方法?" #: ../../faq/programming.rst:1011 #, fuzzy @@ -2014,7 +2036,8 @@ msgstr "" "對於更複雜的輸入解析,正則運算式比 C 的 ``sscanf`` 更強大,更適合這項任務。" #: ../../faq/programming.rst:1024 -msgid "What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?" +#, fuzzy +msgid "What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?" msgstr "'UnicodeDecodeError' 或 'UnicodeEncodeErro' 錯誤是什麼意思?" #: ../../faq/programming.rst:1026 @@ -2024,21 +2047,22 @@ msgstr "請參閱 :ref:`unicode-howto`。" #: ../../faq/programming.rst:1032 #, fuzzy msgid "Can I end a raw string with an odd number of backslashes?" -msgstr "我可以用奇數個反斜杠結束原始字串嗎?" +msgstr "我可以用奇數個反斜線結束原始字串嗎?" #: ../../faq/programming.rst:1034 #, fuzzy msgid "" "A raw string ending with an odd number of backslashes will escape the " "string's quote::" -msgstr "以奇數個反斜杠結尾的原始字串將轉義字串的引號: ::" +msgstr "以奇數個反斜線結尾的原始字串將轉義字串的引號: ::" #: ../../faq/programming.rst:1036 +#, fuzzy msgid "" ">>> r'C:\\this\\will\\not\\work\\'\n" " File \"\", line 1\n" " r'C:\\this\\will\\not\\work\\'\n" -" ^\n" +" ^\n" "SyntaxError: unterminated string literal (detected at line 1)" msgstr "" ">>> r'C:\\this\\will\\not\\work\\'\n" @@ -2052,7 +2076,7 @@ msgstr "" msgid "" "There are several workarounds for this. One is to use regular strings and " "double the backslashes::" -msgstr "有幾種解決方法。一種是使用常規字串並加倍反斜杠: ::" +msgstr "有幾種解決方法。一種是使用常規字串並加倍反斜線: ::" #: ../../faq/programming.rst:1045 msgid "" @@ -2067,7 +2091,7 @@ msgstr "" msgid "" "Another is to concatenate a regular string containing an escaped backslash " "to the raw string::" -msgstr "另一種方法是將包含轉義反斜杠的常規字串連接到原始字串: ::" +msgstr "另一種方法是將包含轉義反斜線的常規字串連接到原始字串: ::" #: ../../faq/programming.rst:1051 msgid "" @@ -2082,7 +2106,7 @@ msgstr "" msgid "" "It is also possible to use :func:`os.path.join` to append a backslash on " "Windows::" -msgstr "也可以使用 :func:`os.path.join` 在 Windows 上附加反斜杠: ::" +msgstr "也可以使用 :func:`os.path.join` 在 Windows 上附加反斜線: ::" #: ../../faq/programming.rst:1056 msgid "" @@ -2100,8 +2124,8 @@ msgid "" "the value of the raw string. That is, the backslash remains present in the " "value of the raw string::" msgstr "" -"請注意,雖然為了確定原始字串的結束位置而使用反斜杠「跳脫」引號,但在解釋原始" -"字串的值時不會發生轉義。也就是說,反斜杠仍然存在於原始字串的值中: ::" +"請注意,雖然為了確定原始字串的結束位置而使用反斜線「跳脫」引號,但在解釋原始" +"字串的值時不會發生轉義。也就是說,反斜線仍然存在於原始字串的值中: ::" #: ../../faq/programming.rst:1064 msgid "" @@ -2118,7 +2142,7 @@ msgstr "另請參閱 :ref:`語言參考 ` 中的規範。" #: ../../faq/programming.rst:1070 msgid "Performance" -msgstr "" +msgstr "效能" #: ../../faq/programming.rst:1073 msgid "My program is too slow. How do I speed it up?" @@ -2161,7 +2185,7 @@ msgid "" "Writing benchmark scripts will allow you to iterate quickly when searching " "for improvements (see the :mod:`timeit` module)." msgstr "" -"編寫基準測試腳本將允許你在搜索改進時快速疊代(請參閱 :mod:`timeit` 模組)。" +"編寫基準測試腳本將允許你在搜尋改進時快速疊代(請參閱 :mod:`timeit` 模組)。" #: ../../faq/programming.rst:1086 #, fuzzy @@ -2216,7 +2240,7 @@ msgstr "" "當標準函式庫提供用於執行某些操作的原語時,它很可能(儘管不能保證)比你可能想" "出的任何替代方法都更快。對於用 C 編寫的原語,例如內建函式和一些擴充型別,情況" "更是如此。例如,請務必使用 :meth:`list.sort` 內建方法或相關的 :func:`sorted` " -"函式進行排序(有關高階用法的示例,請參閱 :ref:`sortinghowto` )." +"函式進行排序(有關高階用法的範例,請參閱 :ref:`sortinghowto` )." #: ../../faq/programming.rst:1109 #, fuzzy @@ -2245,9 +2269,9 @@ msgid "" msgstr "" "如果你已經達到純 Python 所能允許的極限,可以使用一些工具讓你走得更遠。例如," "`Cython `_ 可以將稍微修改過的 Python 程式碼編譯成 C 擴" -"充,並且可以在許多不同的平台上使用。 Cython 可以利用編譯(和可選的型別註釋)" -"使你的程式碼比解釋時快得多。如果你對自己的 C 編程技能有信心,你也可以 :ref:`" -"自己編寫一個 C 擴充模組 `。" +"充,並且可以在許多不同的平台上使用。Cython 可以利用編譯(和可選的型別註釋)使" +"你的程式碼比解釋時快得多。如果你對自己的 C 程式設計技能有信心,你也可以\\ :" +"ref:`自己編寫一個 C 擴充模組 `。" #: ../../faq/programming.rst:1125 msgid "" @@ -2290,6 +2314,10 @@ msgid "" " chunks.append(s)\n" "result = ''.join(chunks)" msgstr "" +"chunks = []\n" +"for s in my_strings:\n" +" chunks.append(s)\n" +"result = ''.join(chunks)" #: ../../faq/programming.rst:1146 #, fuzzy @@ -2312,25 +2340,25 @@ msgid "" "for b in my_bytes_objects:\n" " result += b" msgstr "" +"result = bytearray()\n" +"for b in my_bytes_objects:\n" +" result += b" #: ../../faq/programming.rst:1157 -#, fuzzy msgid "Sequences (Tuples/Lists)" -msgstr "序列(元組/list)" +msgstr "序列(元組/串列)" #: ../../faq/programming.rst:1160 -#, fuzzy msgid "How do I convert between tuples and lists?" -msgstr "如何在元組和list之間進行轉換?" +msgstr "如何在元組和串列之間進行轉換?" #: ../../faq/programming.rst:1162 -#, fuzzy msgid "" "The type constructor ``tuple(seq)`` converts any sequence (actually, any " "iterable) into a tuple with the same items in the same order." msgstr "" -"型別構造器 ``tuple(seq)`` 將任何序列(實際上是任何可疊代物件)轉換為具有相同" -"順序的相同項的元組。" +"型別建構函式 ``tuple(seq)`` 將任何序列(實際上是任何可疊代物件)轉換為具有相" +"同順序的相同項的元組。" #: ../../faq/programming.rst:1165 #, fuzzy @@ -2352,15 +2380,14 @@ msgid "" "3))`` yields ``[1, 2, 3]`` and ``list('abc')`` yields ``['a', 'b', 'c']``. " "If the argument is a list, it makes a copy just like ``seq[:]`` would." msgstr "" -"型別構造函式 ``list(seq)`` 將任何序列或可疊代物件轉換為具有相同順序的相同項目" +"型別建構函式 ``list(seq)`` 將任何序列或可疊代物件轉換為具有相同順序的相同項目" "的list。例如,``list((1, 2, 3))`` 產生``[1, 2, 3]`` 和``list('abc')`` 產生" "``['a', 'b ', 'c']``。如果引數是一個list,它會像 ``seq[:]`` 那樣製作一個副" "本。" #: ../../faq/programming.rst:1177 -#, fuzzy msgid "What's a negative index?" -msgstr "什麼是負指數?" +msgstr "什麼是負索引?" #: ../../faq/programming.rst:1179 #, fuzzy @@ -2409,27 +2436,24 @@ msgid "" msgstr "這不會觸及你的原始序列,但會構建一個具有相反順序的新副本以進行疊代。" #: ../../faq/programming.rst:1202 -#, fuzzy msgid "How do you remove duplicates from a list?" -msgstr "如何從list中刪除重複項?" +msgstr "如何從串列中刪除重複項?" #: ../../faq/programming.rst:1204 -#, fuzzy msgid "See the Python Cookbook for a long discussion of many ways to do this:" -msgstr "請參閱 Python Cookbook 以獲取有關執行此操作的多種方法的詳細討論:" +msgstr "請參閱 Python Cookbook 以得到有關執行此操作的各種方法的詳細討論:" #: ../../faq/programming.rst:1206 msgid "https://code.activestate.com/recipes/52560/" msgstr "https://code.activestate.com/recipes/52560/" #: ../../faq/programming.rst:1208 -#, fuzzy msgid "" "If you don't mind reordering the list, sort it and then scan from the end of " "the list, deleting duplicates as you go::" msgstr "" -"如果你不介意重新排序list,請對其進行排序,然後從list末尾開始掃描,同時刪除重" -"複項: ::" +"如果你不介意重新排序串列,可以對其進行排序,然後從串列末尾開始掃描,同時刪除" +"重複項: ::" #: ../../faq/programming.rst:1211 msgid "" @@ -2442,31 +2466,36 @@ msgid "" " else:\n" " last = mylist[i]" msgstr "" +"if mylist:\n" +" mylist.sort()\n" +" last = mylist[-1]\n" +" for i in range(len(mylist)-2, -1, -1):\n" +" if last == mylist[i]:\n" +" del mylist[i]\n" +" else:\n" +" last = mylist[i]" #: ../../faq/programming.rst:1220 -#, fuzzy msgid "" "If all elements of the list may be used as set keys (i.e. they are all :term:" "`hashable`) this is often faster ::" msgstr "" -"如果list的所有元素都可以用作集合鍵(即它們都是 :term:`hashable`),這通常會更" -"快: ::" +"如果串列的所有元素都可以做為集合的鍵(即它們都必須是 :term:`hashable`),那這" +"通常會更快: ::" #: ../../faq/programming.rst:1223 msgid "mylist = list(set(mylist))" -msgstr "" +msgstr "mylist = list(set(mylist))" #: ../../faq/programming.rst:1225 -#, fuzzy msgid "" "This converts the list into a set, thereby removing duplicates, and then " "back into a list." -msgstr "這會將list轉換為一個集合,從而刪除重複項,然後再轉換回list。" +msgstr "這會將串列轉換為一個集合,從而刪除重複項,然後再轉換回串列。" #: ../../faq/programming.rst:1230 -#, fuzzy msgid "How do you remove multiple items from a list" -msgstr "如何從list中刪除多個項目" +msgstr "如何從串列中刪除多個項目" #: ../../faq/programming.rst:1232 #, fuzzy @@ -2550,14 +2579,12 @@ msgstr "" "樣做,因為它通常比使用 Python list慢很多。" #: ../../faq/programming.rst:1273 -#, fuzzy msgid "How do I create a multidimensional list?" -msgstr "如何建立多維 list?" +msgstr "如何建立多維度串列?" #: ../../faq/programming.rst:1275 -#, fuzzy msgid "You probably tried to make a multidimensional array like this::" -msgstr "你可能嘗試製作這樣的多維數組: ::" +msgstr "你可能會這樣建立一個多維度陣列: ::" #: ../../faq/programming.rst:1277 msgid ">>> A = [[None] * 2] * 3" @@ -2576,9 +2603,8 @@ msgstr "" "[[None, None], [None, None], [None, None]]" #: ../../faq/programming.rst:1290 -#, fuzzy msgid "But when you assign a value, it shows up in multiple places:" -msgstr "但是當你分配一個值時,它會出現在多個地方:" +msgstr "但是當你賦予一個值時,它會出現在多個地方:" #: ../../faq/programming.rst:1296 msgid "" @@ -2586,25 +2612,26 @@ msgid "" ">>> A\n" "[[5, None], [5, None], [5, None]]" msgstr "" +">>> A[0][0] = 5\n" +">>> A\n" +"[[5, None], [5, None], [5, None]]" #: ../../faq/programming.rst:1302 -#, fuzzy msgid "" "The reason is that replicating a list with ``*`` doesn't create copies, it " "only creates references to the existing objects. The ``*3`` creates a list " "containing 3 references to the same list of length two. Changes to one row " "will show in all rows, which is almost certainly not what you want." msgstr "" -"原因是複製帶有 ``*`` 的list不會建立副本,它只會建立對現有物件的參照。 ``*3`` " -"建立一個list,其中包含 3 個對長度為 2 的相同list的參照。對一行的更改將顯示在" -"所有行中,這幾乎肯定不是你想要的。" +"原因是複製帶有 ``*`` 的串列不會建立副本,它只會建立對現有物件的參照。``*3`` " +"建立一個串列,其中包含 3 個對長度為 2 的相同串列的參照。對其中一列的變更也將" +"顯示在所有其他列中,而這幾乎不會是你想要的。" #: ../../faq/programming.rst:1307 -#, fuzzy msgid "" "The suggested approach is to create a list of the desired length first and " "then fill in each element with a newly created list::" -msgstr "建議的方法是先建立所需長度的list,然後用新建立的list填充每個元素: ::" +msgstr "建議的方法是先建立所需長度的串列,然後用新建立的串列填充每個元素: ::" #: ../../faq/programming.rst:1310 msgid "" @@ -2612,34 +2639,37 @@ msgid "" "for i in range(3):\n" " A[i] = [None] * 2" msgstr "" +"A = [None] * 3\n" +"for i in range(3):\n" +" A[i] = [None] * 2" #: ../../faq/programming.rst:1314 -#, fuzzy msgid "" "This generates a list containing 3 different lists of length two. You can " "also use a list comprehension::" msgstr "" -"這會生成一個包含 3 個長度為 2 的不同list的list。你還可以使用list推導: ::" +"這會產生一個包含 3 個長度為 2 的不同串列的串列。你也可以使用串列綜合運算" +"式: ::" #: ../../faq/programming.rst:1317 msgid "" "w, h = 2, 3\n" "A = [[None] * w for i in range(h)]" msgstr "" +"w, h = 2, 3\n" +"A = [[None] * w for i in range(h)]" #: ../../faq/programming.rst:1320 -#, fuzzy msgid "" "Or, you can use an extension that provides a matrix datatype; `NumPy " "`_ is the best known." msgstr "" -"或者,你可以使用提供矩陣資料型別的擴充; `NumPy `_ 是最著" -"名的。" +"或者你也可以使用提供矩陣資料型別的擴充套件;`NumPy `_ 是" +"其中最著名的一個。" #: ../../faq/programming.rst:1325 -#, fuzzy msgid "How do I apply a method or function to a sequence of objects?" -msgstr "如何將方法或函式應用於一系列物件?" +msgstr "如何將方法或函式應用於物件序列?" #: ../../faq/programming.rst:1327 #, fuzzy @@ -2656,6 +2686,9 @@ msgid "" "\n" "result = [function(obj) for obj in mylist]" msgstr "" +"result = [obj.method() for obj in mylist]\n" +"\n" +"result = [function(obj) for obj in mylist]" #: ../../faq/programming.rst:1334 #, fuzzy @@ -2672,12 +2705,16 @@ msgid "" "for obj in mylist:\n" " function(obj)" msgstr "" +"for obj in mylist:\n" +" obj.method()\n" +"\n" +"for obj in mylist:\n" +" function(obj)" #: ../../faq/programming.rst:1346 -#, fuzzy msgid "" "Why does a_tuple[i] += ['item'] raise an exception when the addition works?" -msgstr "為什麼 a_tuple[i] += ['item'] 在加法工作時引發例外?" +msgstr "為什麼 a_tuple[i] += ['item'] 做加法時會引發例外?" #: ../../faq/programming.rst:1348 #, fuzzy @@ -2697,10 +2734,9 @@ msgid "" "a ``list`` and ``+=`` as our exemplar." msgstr "" "當擴充賦值運算子應用於指向可變物件的元組元素時,此討論通常適用,但我們將使用 " -"``list`` 和 ``+=\" 作為示例。" +"``list`` 和 ``+=\" 作為範例。" #: ../../faq/programming.rst:1356 -#, fuzzy msgid "If you wrote::" msgstr "如果你寫了: ::" @@ -2712,6 +2748,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> a_tuple = (1, 2)\n" +">>> a_tuple[0] += 1\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1364 #, fuzzy @@ -2727,11 +2768,10 @@ msgstr "" "會得到一個錯誤,因為我們無法更改元組的元素指向的內容。" #: ../../faq/programming.rst:1370 -#, fuzzy msgid "" "Under the covers, what this augmented assignment statement is doing is " "approximately this::" -msgstr "在幕後,這個擴充賦值陳述式所做的大致是這樣的: ::" +msgstr "這個增強賦值陳述式在背後大致是做這些事情: ::" #: ../../faq/programming.rst:1373 msgid "" @@ -2741,6 +2781,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> result = a_tuple[0] + 1\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1379 #, fuzzy @@ -2831,9 +2876,8 @@ msgstr "" "賦值仍然發生。" #: ../../faq/programming.rst:1419 -#, fuzzy msgid "Thus, in our tuple example what is happening is equivalent to::" -msgstr "因此,在我們的元組示例中,發生的事情等同於: ::" +msgstr "因此,在我們的元組範例中,發生的事情等同於: ::" #: ../../faq/programming.rst:1421 msgid "" @@ -2843,6 +2887,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> result = a_tuple[0].__iadd__(['item'])\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1427 #, fuzzy @@ -2857,7 +2906,6 @@ msgstr "" "可變的。" #: ../../faq/programming.rst:1433 -#, fuzzy msgid "" "I want to do a complicated sort: can you do a Schwartzian Transform in " "Python?" @@ -2872,7 +2920,7 @@ msgid "" "method::" msgstr "" "該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素對映到其「排序值」" -"的度量對list的元素進行排序。在 Python 中,對 :meth:`list.sort` 方法使用 " +"的度量對串列的元素進行排序。在 Python 中,對 :meth:`list.sort` 方法使用 " "``key`` 引數: ::" #: ../../faq/programming.rst:1439 @@ -2884,18 +2932,16 @@ msgstr "" "Isorted.sort(key=lambda s: int(s[10:15]))" #: ../../faq/programming.rst:1444 -#, fuzzy msgid "How can I sort one list by values from another list?" -msgstr "如何根據另一個list中的值對一個list進行排序?" +msgstr "如何根據另一個串列中的值對一個串列進行排序?" #: ../../faq/programming.rst:1446 -#, fuzzy msgid "" "Merge them into an iterator of tuples, sort the resulting list, and then " "pick out the element you want. ::" msgstr "" -"將它們合併到一個元組疊代器中,對結果list進行排序,然後挑選出你想要的元" -"素。: ::" +"將它們合併到一個元組疊代器中,對結果的串列進行排序,然後挑選出你想要的元" +"素。 ::" #: ../../faq/programming.rst:1449 msgid "" @@ -2980,32 +3026,29 @@ msgstr "" " return arg * 2 + self.attribute" #: ../../faq/programming.rst:1491 -#, fuzzy msgid "What is self?" -msgstr "什麼是自我?" +msgstr "什麼是 self?" #: ../../faq/programming.rst:1493 -#, fuzzy msgid "" "Self is merely a conventional name for the first argument of a method. A " "method defined as ``meth(self, a, b, c)`` should be called as ``x.meth(a, b, " "c)`` for some instance ``x`` of the class in which the definition occurs; " "the called method will think it is called as ``meth(x, a, b, c)``." msgstr "" -"Self 只是方法第一個引數的約定名稱。一個定義為 ``meth(self, a, b, c)`` 的方法" -"應該被呼叫為 ``x.meth(a, b, c)`` 對於其中類別的某個實例 ``x``定義發生;被呼叫" -"的方法會認為它被稱為 ``meth(x, a, b, c)`` 。" +"Self 只是方法第一個引數的約定名稱。對於所定義類別的某個實例 ``x``,一個定義" +"為 ``meth(self, a, b, c)`` 的方法應該以 ``x.meth(a, b, c)`` 形式來呼叫;被呼" +"叫的方法會認為它是以 ``meth(x, a, b, c)`` 來呼叫的。" #: ../../faq/programming.rst:1498 msgid "See also :ref:`why-self`." msgstr "另請參閱 :ref:`why-self`。" #: ../../faq/programming.rst:1502 -#, fuzzy msgid "" "How do I check if an object is an instance of a given class or of a subclass " "of it?" -msgstr "如何檢查一個物件是給定類別的實例還是它的子類別的實例?" +msgstr "如何檢查物件是否是給定類別的實例或其子類別的實例?" #: ../../faq/programming.rst:1504 #, fuzzy @@ -3024,16 +3067,16 @@ msgstr "" "complex))``。" #: ../../faq/programming.rst:1511 -#, fuzzy msgid "" "Note that :func:`isinstance` also checks for virtual inheritance from an :" "term:`abstract base class`. So, the test will return ``True`` for a " "registered class even if hasn't directly or indirectly inherited from it. " "To test for \"true inheritance\", scan the :term:`MRO` of the class:" msgstr "" -"請注意:func:`isinstance` 還檢查來自:term:`抽象基底類別` 的虛擬繼承。因此,測" -"試將為已註冊的類別回傳 ``True``,即使沒有直接或間接繼承自它。要測試「真正的繼" -"承」,請掃描該類別的 MRO:" +"請注意,:func:`isinstance` 還會檢查來自\\ :term:`抽象基底類別 (abstract base " +"class) ` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 " +"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別的 :" +"term:`MRO`:" #: ../../faq/programming.rst:1516 msgid "" @@ -3075,6 +3118,21 @@ msgid "" ">>> Mapping in type(c).__mro__\n" "False" msgstr "" +">>> c = C()\n" +">>> isinstance(c, C) # 直接\n" +"True\n" +">>> isinstance(c, P) # 間接\n" +"True\n" +">>> isinstance(c, Mapping) # 虛擬\n" +"True\n" +"\n" +"# 實際的繼承鏈結\n" +">>> type(c).__mro__\n" +"(, , )\n" +"\n" +"# 「真正繼承」的檢驗\n" +">>> Mapping in type(c).__mro__\n" +"False" #: ../../faq/programming.rst:1546 #, fuzzy @@ -3101,17 +3159,16 @@ msgid "" msgstr "" "def search(obj):\n" " if isinstance(obj, Mailbox):\n" -" ... # code to search a mailbox\n" +" ... # 搜尋信箱的程式碼\n" " elif isinstance(obj, Document):\n" -" ... # code to search a document\n" +" ... # 搜尋文件的程式碼\n" " elif ..." #: ../../faq/programming.rst:1560 -#, fuzzy msgid "" "A better approach is to define a ``search()`` method on all the classes and " "just call it::" -msgstr "更好的方法是在所有類別上定義一個 ``search()`` 方法,然後呼叫它: ::" +msgstr "更好的方法是在所有類別上定義一個 ``search()`` 方法然後呼叫它: ::" #: ../../faq/programming.rst:1563 msgid "" @@ -3125,14 +3182,21 @@ msgid "" "\n" "obj.search()" msgstr "" +"class Mailbox:\n" +" def search(self):\n" +" ... # 搜尋信箱的程式碼\n" +"\n" +"class Document:\n" +" def search(self):\n" +" ... # 搜尋文件的程式碼\n" +"\n" +"obj.search()" #: ../../faq/programming.rst:1575 -#, fuzzy msgid "What is delegation?" -msgstr "什麼是委派?" +msgstr "什麼是委派 (delegation)?" #: ../../faq/programming.rst:1577 -#, fuzzy msgid "" "Delegation is an object oriented technique (also called a design pattern). " "Let's say you have an object ``x`` and want to change the behaviour of just " @@ -3140,19 +3204,18 @@ msgid "" "implementation of the method you're interested in changing and delegates all " "other methods to the corresponding method of ``x``." msgstr "" -"委託是一種面向物件的技術(也稱為設計模式)。假設你有一個物件 ``x`` 並且只想更" -"改其中一個方法的行為。你可以建立一個新類別,它提供你感興趣的方法的新實作,並" -"將所有其他方法委託給 ``x`` 的相應方法。" +"委派是一種物件導向的技法(也稱為設計模式)。假設你有一個物件 ``x`` 並且只想更" +"改其中一個方法的行為。你可以建立一個新類別,它提供你想改變的那個方法的新實" +"作,並將所有其他方法委派給 ``x`` 的相應方法。" #: ../../faq/programming.rst:1583 -#, fuzzy msgid "" "Python programmers can easily implement delegation. For example, the " "following class implements a class that behaves like a file but converts all " "written data to uppercase::" msgstr "" -"Python 程式員可以輕鬆實作委託。例如,下面的類別實作了一個行為類似於檔案但將所" -"有寫入資料轉換為大寫的類別: ::" +"Python 程式設計師可以輕鬆地實作委派。舉例來說,以下類別實作了一個行為類似檔案" +"的類別,但將所有寫入的資料轉換為大寫:" #: ../../faq/programming.rst:1587 msgid "" @@ -3221,16 +3284,14 @@ msgstr "" " ..." #: ../../faq/programming.rst:1616 -#, fuzzy msgid "" "Many :meth:`~object.__setattr__` implementations call :meth:`!object." "__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" -"大多數 :meth:`!__setattr__` 實作必須修改 :meth:`self.__dict__ ` 以存儲 self 的本地狀態,而不會導致無限遞迴。" +"許多 :meth:`~object.__setattr__` 的實作會呼叫 :meth:`!object.__setattr__` 以" +"設定 self 的屬性,而不會導致無限遞迴。" #: ../../faq/programming.rst:1619 -#, fuzzy msgid "" "class X:\n" " def __setattr__(self, name, value):\n" @@ -3238,10 +3299,9 @@ msgid "" " object.__setattr__(self, name, value)" msgstr "" "class X:\n" -" ...\n" " def __setattr__(self, name, value):\n" -" self.__dict__[name] = value\n" -" ..." +" # 自訂邏輯放在這裡...\n" +" object.__setattr__(self, name, value)" #: ../../faq/programming.rst:1624 msgid "" @@ -3268,23 +3328,19 @@ msgid "" msgstr "" "class Derived(Base):\n" " def meth(self):\n" -" super().meth() # calls Base.meth" +" super().meth() # 呼叫 Base.meth" #: ../../faq/programming.rst:1637 -#, fuzzy msgid "" "In the example, :func:`super` will automatically determine the instance from " "which it was called (the ``self`` value), look up the :term:`method " "resolution order` (MRO) with ``type(self).__mro__``, and return the next in " "line after ``Derived`` in the MRO: ``Base``." msgstr "" -"在示例中,:func:`super` 將自動確定呼叫它的實例(``self`` 值),使用 " -"``type(self ).__mro__``,並回傳 MRO 中``Derived`` 之後的下一行:``Base``。" #: ../../faq/programming.rst:1644 -#, fuzzy msgid "How can I organize my code to make it easier to change the base class?" -msgstr "我如何組織我的程式碼以便更容易地更改基底類別?" +msgstr "我可以如何組織我的程式碼以使得更改基底類別變的更容易?" #: ../../faq/programming.rst:1646 #, fuzzy @@ -3317,25 +3373,22 @@ msgstr "" " ..." #: ../../faq/programming.rst:1661 -#, fuzzy msgid "How do I create static class data and static class methods?" msgstr "如何建立靜態類別資料和靜態類別方法?" #: ../../faq/programming.rst:1663 -#, fuzzy msgid "" "Both static data and static methods (in the sense of C++ or Java) are " "supported in Python." msgstr "Python 支援靜態資料和靜態方法(在 C++ 或 Java 的意義上)。" #: ../../faq/programming.rst:1666 -#, fuzzy msgid "" "For static data, simply define a class attribute. To assign a new value to " "the attribute, you have to explicitly use the class name in the assignment::" msgstr "" "對於靜態資料,只需定義一個類別屬性即可。要為屬性分配新值,你必須在分配中顯式" -"使用類別名: ::" +"使用類別名稱: ::" #: ../../faq/programming.rst:1669 msgid "" @@ -3348,16 +3401,23 @@ msgid "" " def getcount(self):\n" " return C.count # or return self.count" msgstr "" +"class C:\n" +" count = 0 # C.__init__ 被呼叫的次數\n" +"\n" +" def __init__(self):\n" +" C.count = C.count + 1\n" +"\n" +" def getcount(self):\n" +" return C.count # 或回傳 self.count" #: ../../faq/programming.rst:1678 -#, fuzzy msgid "" "``c.count`` also refers to ``C.count`` for any ``c`` such that " "``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some " "class on the base-class search path from ``c.__class__`` back to ``C``." msgstr "" "``c.count`` 還指代任何 ``c`` 的 ``C.count`` 使得 ``isinstance(c, C)`` 成立," -"除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜索路徑" +"除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜尋路徑" "上的類別。" #: ../../faq/programming.rst:1682 @@ -3420,17 +3480,15 @@ msgstr "" "則這提供了所需的封裝。" #: ../../faq/programming.rst:1708 -#, fuzzy msgid "How can I overload constructors (or methods) in Python?" -msgstr "如何在 Python 中重載構造函式(或方法)?" +msgstr "如何在 Python 中多載 (overload) 建構函式(或方法)?" #: ../../faq/programming.rst:1710 -#, fuzzy msgid "" "This answer actually applies to all methods, but the question usually comes " "up first in the context of constructors." msgstr "" -"這個答案實際上適用於所有方法,但這個問題通常首先出現在構造函式的上下文中。" +"這個答案實際上適用於所有方法,但這個問題通常會先出現在建構函式的情境中。" #: ../../faq/programming.rst:1713 msgid "In C++ you'd write" @@ -3449,12 +3507,11 @@ msgstr "" "}" #: ../../faq/programming.rst:1722 -#, fuzzy msgid "" "In Python you have to write a single constructor that catches all cases " "using default arguments. For example::" msgstr "" -"在 Python 中,你必須編寫一個構造函式來捕獲所有使用預設引數的情況。例如: ::" +"在 Python 中,你必須編寫一個建構函式來捕獲所有使用預設引數的情況。例如: ::" #: ../../faq/programming.rst:1725 msgid "" @@ -3473,14 +3530,12 @@ msgstr "" " print(\"Argument is\", i)" #: ../../faq/programming.rst:1732 -#, fuzzy msgid "This is not entirely equivalent, but close enough in practice." -msgstr "這並不完全等價,但在實踐中足夠接近。" +msgstr "這並不完全等價,但在實際情況中已夠接近。" #: ../../faq/programming.rst:1734 -#, fuzzy msgid "You could also try a variable-length argument list, e.g. ::" -msgstr "你也可以嘗試可變長度引數 list,例如: ::" +msgstr "你也可以嘗試長度可變的引數串列,例如: ::" #: ../../faq/programming.rst:1736 msgid "" @@ -3491,17 +3546,14 @@ msgstr "" " ..." #: ../../faq/programming.rst:1739 -#, fuzzy msgid "The same approach works for all method definitions." -msgstr "相同的方法適用於所有方法定義。" +msgstr "相同的手段適用於所有方法的定義。" #: ../../faq/programming.rst:1743 -#, fuzzy msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "我嘗試使用 __spam,但收到有關 _SomeClassName__spam 的錯誤。" #: ../../faq/programming.rst:1745 -#, fuzzy msgid "" "Variable names with double leading underscores are \"mangled\" to provide a " "simple but effective way to define class private variables. Any identifier " @@ -3510,10 +3562,10 @@ msgid "" "``classname`` is the current class name with any leading underscores " "stripped." msgstr "" -"帶有雙前導底線的變數名被「破壞」以提供一種簡單但有效的方法來定義類別私有變" -"數。 ``__spam`` 形式的任何標識器(至少兩個前導底線,最多一個尾隨底線)在文本" -"上替換為 ``_classname__spam``,其中 ``classname`` 是當前類別名,所有前導底線" -"被去除。" +"帶有雙前導底線的變數名會被「破壞 (mangled)」以做為提供定義類別私有變數的一個" +"簡單但有效的方法。``__spam`` 形式的任何識別字(至少兩個前導底線,最多一個尾隨" +"底線)在文字上會被替換為 ``_classname__spam``,其中 ``classname`` 是目前類別" +"之所有前導底線被去除的名稱。" #: ../../faq/programming.rst:1751 msgid "" @@ -3564,24 +3616,21 @@ msgid "" msgstr "" #: ../../faq/programming.rst:1778 -#, fuzzy msgid "My class defines __del__ but it is not called when I delete the object." msgstr "我的類別定義了 __del__ 但是當我刪除物件時它沒有被呼叫。" #: ../../faq/programming.rst:1780 -#, fuzzy msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" #: ../../faq/programming.rst:1782 -#, fuzzy msgid "" "The :keyword:`del` statement does not necessarily call :meth:`~object." "__del__` -- it simply decrements the object's reference count, and if this " "reaches zero :meth:`!__del__` is called." msgstr "" -":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" -"用計數,如果達到零,則呼叫 :meth:`!__del__`。" +":keyword:`del` 陳述式不一定會呼叫 :meth:`~object.__del__` -- 它只是減少物件的" +"參照計數,如果達到零則呼叫 :meth:`!__del__`。" #: ../../faq/programming.rst:1786 #, fuzzy @@ -3641,19 +3690,17 @@ msgstr "" "`sys.stderr`。" #: ../../faq/programming.rst:1822 -#, fuzzy msgid "How do I get a list of all instances of a given class?" -msgstr "如何獲取給定類別的所有實例的 list?" +msgstr "我該如何取得給定類別的所有實例的串列?" #: ../../faq/programming.rst:1824 -#, fuzzy msgid "" "Python does not keep track of all instances of a class (or of a built-in " "type). You can program the class's constructor to keep track of all " "instances by keeping a list of weak references to each instance." msgstr "" -"Python 不會跟踪類別(或內建型別)的所有實例。你可以對類別的構造函式進行編程," -"以透過保留對每個實例的弱參照list來跟踪所有實例。" +"Python 不會追蹤類別(或內建型別)的所有實例。你可以將類別的建構函式進行改寫," +"以透過保留對每個實例之弱參照串列來追蹤所有實例。" #: ../../faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" @@ -3715,16 +3762,18 @@ msgstr "" "說,保證識別性的情況有以下三種:" #: ../../faq/programming.rst:1870 +#, fuzzy msgid "" -"1) Assignments create new names but do not change object identity. After " -"the assignment ``new = old``, it is guaranteed that ``new is old``." +"Assignments create new names but do not change object identity. After the " +"assignment ``new = old``, it is guaranteed that ``new is old``." msgstr "" "1) 賦值建立新名稱但不改變物件識別性。賦值 ``new = old`` 後,保證 ``new is " "old``。" #: ../../faq/programming.rst:1873 +#, fuzzy msgid "" -"2) Putting an object in a container that stores object references does not " +"Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " "guaranteed that ``s[0] is x``." msgstr "" @@ -3734,9 +3783,9 @@ msgstr "" #: ../../faq/programming.rst:1877 #, fuzzy msgid "" -"3) If an object is a singleton, it means that only one instance of that " -"object can exist. After the assignments ``a = None`` and ``b = None``, it " -"is guaranteed that ``a is b`` because ``None`` is a singleton." +"If an object is a singleton, it means that only one instance of that object " +"can exist. After the assignments ``a = None`` and ``b = None``, it is " +"guaranteed that ``a is b`` because ``None`` is a singleton." msgstr "" "3)如果一個物件是單例,則意味著該物件只能存在一個實例。在賦值 ``a = None`` " "和 ``b = None`` 之後,可以保證 ``a is b`` 因為 ``None`` 是單例。" @@ -3801,25 +3850,24 @@ msgstr "在標準函式庫程式碼中,你將看到幾種正確使用識別性 #: ../../faq/programming.rst:1908 msgid "" -"1) As recommended by :pep:`8`, an identity test is the preferred way to " -"check for ``None``. This reads like plain English in code and avoids " -"confusion with other objects that may have boolean values that evaluate to " -"false." +"As recommended by :pep:`8`, an identity test is the preferred way to check " +"for ``None``. This reads like plain English in code and avoids confusion " +"with other objects that may have boolean values that evaluate to false." msgstr "" -"1) 正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中" -"讀起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" +"正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中讀" +"起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" #: ../../faq/programming.rst:1912 #, fuzzy msgid "" -"2) Detecting optional arguments can be tricky when ``None`` is a valid input " +"Detecting optional arguments can be tricky when ``None`` is a valid input " "value. In those situations, you can create a singleton sentinel object " "guaranteed to be distinct from other objects. For example, here is how to " -"implement a method that behaves like :meth:`dict.pop`::" +"implement a method that behaves like :meth:`dict.pop`:" msgstr "" -"2)當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以" -"建立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" -"於 :meth:`dict.pop` 的方法: ::" +"當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以建" +"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似於 :" +"meth:`dict.pop` 的方法:" #: ../../faq/programming.rst:1917 msgid "" @@ -3845,23 +3893,23 @@ msgstr "" " raise KeyError(key)\n" " return default" -#: ../../faq/programming.rst:1928 +#: ../../faq/programming.rst:1930 msgid "" -"3) Container implementations sometimes need to augment equality tests with " +"Container implementations sometimes need to augment equality tests with " "identity tests. This prevents the code from being confused by objects such " "as ``float('NaN')`` that are not equal to themselves." msgstr "" -"3) 容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " +"容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " "float('NaN') 之類的不等於自身的物件所混淆。" -#: ../../faq/programming.rst:1932 +#: ../../faq/programming.rst:1934 msgid "" "For example, here is the implementation of :meth:`!collections.abc.Sequence." "__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" -#: ../../faq/programming.rst:1935 +#: ../../faq/programming.rst:1937 msgid "" "def __contains__(self, value):\n" " for v in self:\n" @@ -3875,12 +3923,12 @@ msgstr "" " return True\n" " return False" -#: ../../faq/programming.rst:1943 +#: ../../faq/programming.rst:1945 msgid "" "How can a subclass control what data is stored in an immutable instance?" msgstr "子類別如何控制不可變實例中存儲的資料?" -#: ../../faq/programming.rst:1945 +#: ../../faq/programming.rst:1947 #, fuzzy msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " @@ -3892,14 +3940,13 @@ msgstr "" "`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" "實例中的資料。" -#: ../../faq/programming.rst:1950 -#, fuzzy +#: ../../faq/programming.rst:1952 msgid "" "All of these immutable classes have a different signature than their parent " "class:" msgstr "所有這些不可變類別都具有與其父類別不同的簽名:" -#: ../../faq/programming.rst:1953 +#: ../../faq/programming.rst:1955 msgid "" "from datetime import date\n" "\n" @@ -3922,12 +3969,32 @@ msgid "" " s = ''.join([c for c in s if c.isalnum() or c == '-'])\n" " return super().__new__(cls, s)" msgstr "" +"from datetime import date\n" +"\n" +"class FirstOfMonthDate(date):\n" +" \"總是選擇每個月的第一天\"\n" +" def __new__(cls, year, month, day):\n" +" return super().__new__(cls, year, month, 1)\n" +"\n" +"class NamedInt(int):\n" +" \"允許一些數字的文字名稱\"\n" +" xlat = {'zero': 0, 'one': 1, 'ten': 10}\n" +" def __new__(cls, value):\n" +" value = cls.xlat.get(value, value)\n" +" return super().__new__(cls, value)\n" +"\n" +"class TitleStr(str):\n" +" \"將 str 轉換成適合作為 URL 路徑的名稱\"\n" +" def __new__(cls, s):\n" +" s = s.lower().replace(' ', '-')\n" +" s = ''.join([c for c in s if c.isalnum() or c == '-'])\n" +" return super().__new__(cls, s)" -#: ../../faq/programming.rst:1976 +#: ../../faq/programming.rst:1978 msgid "The classes can be used like this:" msgstr "這些類別可以像這樣使用:" -#: ../../faq/programming.rst:1978 +#: ../../faq/programming.rst:1980 msgid "" ">>> FirstOfMonthDate(2012, 2, 14)\n" "FirstOfMonthDate(2012, 2, 1)\n" @@ -3947,11 +4014,11 @@ msgstr "" ">>> TitleStr('Blog: Why Python Rocks')\n" "'blog-why-python-rocks'" -#: ../../faq/programming.rst:1993 +#: ../../faq/programming.rst:1995 msgid "How do I cache method calls?" msgstr "如何快取方法呼叫?" -#: ../../faq/programming.rst:1995 +#: ../../faq/programming.rst:1997 #, fuzzy msgid "" "The two principal tools for caching methods are :func:`functools." @@ -3961,17 +4028,17 @@ msgstr "" "快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" "`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" -#: ../../faq/programming.rst:2000 +#: ../../faq/programming.rst:2002 #, fuzzy msgid "" "The *cached_property* approach only works with methods that do not take any " "arguments. It does not create a reference to the instance. The cached " "method result will be kept only as long as the instance is alive." msgstr "" -"*cached_property* 方法僅適用於不帶任何引數的方法。它不會建立對實例的參照。只" +"*cached_property* 方法僅適用於不帶任何引數的方法,它不會建立對實例的參照,只" "要實例還活著,快取的方法結果就會被保留。" -#: ../../faq/programming.rst:2004 +#: ../../faq/programming.rst:2006 #, fuzzy msgid "" "The advantage is that when an instance is no longer used, the cached method " @@ -3982,7 +4049,7 @@ msgstr "" "好處是當一個實例不再使用時,快取的方法結果會立即釋放。缺點是如果實例累積,累" "積的方法結果也會累積。他們可以不受限制地成長。" -#: ../../faq/programming.rst:2009 +#: ../../faq/programming.rst:2011 msgid "" "The *lru_cache* approach works with methods that have :term:`hashable` " "arguments. It creates a reference to the instance unless special efforts " @@ -3991,7 +4058,7 @@ msgstr "" "*lru_cache* 方法適用於具有\\ :term:`可雜湊 `\\ 引數的方法。除非特別" "努力傳遞弱參照,否則它會建立對實例的參照。" -#: ../../faq/programming.rst:2013 +#: ../../faq/programming.rst:2015 #, fuzzy msgid "" "The advantage of the least recently used algorithm is that the cache is " @@ -4001,11 +4068,11 @@ msgstr "" "最近最少使用演算法的優點是快取受指定的 *maxsize* 限制。缺點是實例會一直保持活" "動狀態,直到它們從快取中老化或快取被清除。" -#: ../../faq/programming.rst:2018 +#: ../../faq/programming.rst:2020 msgid "This example shows the various techniques::" msgstr "這個例子展示了各種技術: ::" -#: ../../faq/programming.rst:2020 +#: ../../faq/programming.rst:2022 msgid "" "class Weather:\n" " \"Lookup weather information on a government website\"\n" @@ -4030,7 +4097,7 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2042 +#: ../../faq/programming.rst:2044 #, fuzzy msgid "" "The above example assumes that the *station_id* never changes. If the " @@ -4040,7 +4107,7 @@ msgstr "" "上面的例子假設 *station_id* 永遠不會改變。如果相關的實例屬性是可變的,則 " "*cached_property* 方法無法工作,因為它無法檢測到屬性的更改。" -#: ../../faq/programming.rst:2047 +#: ../../faq/programming.rst:2049 #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " @@ -4051,7 +4118,7 @@ msgstr "" "`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" "新: ::" -#: ../../faq/programming.rst:2051 +#: ../../faq/programming.rst:2053 msgid "" "class Weather:\n" " \"Example with a mutable station identifier\"\n" @@ -4074,15 +4141,15 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2073 +#: ../../faq/programming.rst:2075 msgid "Modules" msgstr "模組" -#: ../../faq/programming.rst:2076 +#: ../../faq/programming.rst:2078 msgid "How do I create a .pyc file?" msgstr "如何建立 .pyc 檔案?" -#: ../../faq/programming.rst:2078 +#: ../../faq/programming.rst:2080 #, fuzzy msgid "" "When a module is imported for the first time (or when the source file has " @@ -4093,13 +4160,13 @@ msgid "" "file, and ends with ``.pyc``, with a middle component that depends on the " "particular ``python`` binary that created it. (See :pep:`3147` for details.)" msgstr "" -"第一次引入模組時(或者源檔案自建立當前編譯檔案後發生更改時)應在 " +"第一次引入模組時(或者源檔案自建立目前編譯檔案後發生更改時)應在 " "``__pycache__`` 的子目錄中建立包含編譯程式碼的 ``.pyc`` 檔案包含 .py 檔案的目" "錄。 ``.pyc`` 檔案的檔案名以與``.py`` 檔案相同的名稱開頭,以``.pyc`` 結尾,中" "間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" "pep:`3147`。)" -#: ../../faq/programming.rst:2086 +#: ../../faq/programming.rst:2088 #, fuzzy msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " @@ -4112,7 +4179,7 @@ msgstr "" "__pycache__ 子目錄。例如,如果你以一個使用者的身份開發但以另一個使用者的身份" "運行,例如你正在使用 Web 服務器進行測試,就會發生這種情況。" -#: ../../faq/programming.rst:2091 +#: ../../faq/programming.rst:2093 #, fuzzy msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " @@ -4125,7 +4192,7 @@ msgstr "" "組並且 Python 有能力(權限、空閒空間等)建立一個 .pyc 檔案是自動的建立一個" "``__pycache__ `` 子目錄並將編譯後的模組寫入該子目錄。" -#: ../../faq/programming.rst:2096 +#: ../../faq/programming.rst:2098 #, fuzzy msgid "" "Running Python on a top level script is not considered an import and no ``." @@ -4140,7 +4207,7 @@ msgstr "" "入 ``python foo.py`` 作為一個 shell 命令),將為 xyz 建立一個 .pyc 因為引入" "了 xyz,但是不會為 foo 建立 .pyc 檔案,因為 ` `foo.py`` 沒有被引入。" -#: ../../faq/programming.rst:2103 +#: ../../faq/programming.rst:2105 msgid "" "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." "pyc`` file for a module that is not imported -- you can, using the :mod:" @@ -4150,7 +4217,7 @@ msgstr "" "建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " "模組。" -#: ../../faq/programming.rst:2107 +#: ../../faq/programming.rst:2109 msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " "use the ``compile()`` function in that module interactively::" @@ -4158,15 +4225,15 @@ msgstr "" ":mod:`py_compile` 模組允許手動編譯任何模組。其中一種方法是在該模組中以交互方" "式使用 ``compile()`` 函式: ::" -#: ../../faq/programming.rst:2110 +#: ../../faq/programming.rst:2112 msgid "" ">>> import py_compile\n" -">>> py_compile.compile('foo.py') " +">>> py_compile.compile('foo.py')" msgstr "" ">>> import py_compile\n" -">>> py_compile.compile('foo.py') " +">>> py_compile.compile('foo.py')" -#: ../../faq/programming.rst:2113 +#: ../../faq/programming.rst:2115 msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " "location as ``foo.py`` (or you can override that with the optional parameter " @@ -4175,7 +4242,7 @@ msgstr "" "這會將 ``.pyc`` 寫入與 ``foo.py`` 相同位置的 ``__pycache__`` 子目錄(或者你可" "以使用可選參數 ``cfile`` 覆蓋它)。" -#: ../../faq/programming.rst:2117 +#: ../../faq/programming.rst:2119 #, fuzzy msgid "" "You can also automatically compile all files in a directory or directories " @@ -4186,15 +4253,15 @@ msgstr "" "你還可以使用 :mod:`compileall` 模組自動編譯目錄中的所有檔案。你可以在 shell " "提示符下運行 ``compileall.py`` 並提供包含要編譯的 Python 檔案的目錄路徑: ::" -#: ../../faq/programming.rst:2122 +#: ../../faq/programming.rst:2124 msgid "python -m compileall ." msgstr "python -m compileall ." -#: ../../faq/programming.rst:2126 +#: ../../faq/programming.rst:2128 msgid "How do I find the current module name?" -msgstr "如何找到當前模組名稱?" +msgstr "如何找到目前模組名稱?" -#: ../../faq/programming.rst:2128 +#: ../../faq/programming.rst:2130 #, fuzzy msgid "" "A module can find out its own module name by looking at the predefined " @@ -4205,9 +4272,9 @@ msgid "" msgstr "" "模組可以透過查看預定義的全域變數 ``__name__`` 來找出自己的模組名稱。如果它的" "值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命" -"令行界面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" +"令行介面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" -#: ../../faq/programming.rst:2134 +#: ../../faq/programming.rst:2136 msgid "" "def main():\n" " print('Running test...')\n" @@ -4216,21 +4283,26 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"def main():\n" +" print('Running test...')\n" +" ...\n" +"\n" +"if __name__ == '__main__':\n" +" main()" -#: ../../faq/programming.rst:2143 -#, fuzzy +#: ../../faq/programming.rst:2145 msgid "How can I have modules that mutually import each other?" -msgstr "我怎樣才能擁有相互引入的模組?" +msgstr "要怎樣才能擁有相互引入的模組?" -#: ../../faq/programming.rst:2145 +#: ../../faq/programming.rst:2147 msgid "Suppose you have the following modules:" msgstr "假設你有以下模組:" -#: ../../faq/programming.rst:2147 +#: ../../faq/programming.rst:2149 msgid ":file:`foo.py`::" msgstr ":file:`foo.py`: ::" -#: ../../faq/programming.rst:2149 +#: ../../faq/programming.rst:2151 msgid "" "from bar import bar_var\n" "foo_var = 1" @@ -4238,11 +4310,11 @@ msgstr "" "from bar import bar_var\n" "foo_var = 1" -#: ../../faq/programming.rst:2152 +#: ../../faq/programming.rst:2154 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`: ::" -#: ../../faq/programming.rst:2154 +#: ../../faq/programming.rst:2156 msgid "" "from foo import foo_var\n" "bar_var = 2" @@ -4250,42 +4322,42 @@ msgstr "" "from foo import foo_var\n" "bar_var = 2" -#: ../../faq/programming.rst:2157 +#: ../../faq/programming.rst:2159 msgid "The problem is that the interpreter will perform the following steps:" msgstr "問題是直譯器將執行以下步驟:" -#: ../../faq/programming.rst:2159 +#: ../../faq/programming.rst:2161 msgid "main imports ``foo``" msgstr "主要引入 ``foo``" -#: ../../faq/programming.rst:2160 +#: ../../faq/programming.rst:2162 msgid "Empty globals for ``foo`` are created" msgstr "建立了 ``foo`` 的空全域變數" -#: ../../faq/programming.rst:2161 +#: ../../faq/programming.rst:2163 msgid "``foo`` is compiled and starts executing" msgstr "``foo`` 被編譯並開始執行" -#: ../../faq/programming.rst:2162 +#: ../../faq/programming.rst:2164 msgid "``foo`` imports ``bar``" msgstr "``foo`` 引入 ``bar``" -#: ../../faq/programming.rst:2163 +#: ../../faq/programming.rst:2165 msgid "Empty globals for ``bar`` are created" msgstr "建立了 ``bar`` 的空全域變數" -#: ../../faq/programming.rst:2164 +#: ../../faq/programming.rst:2166 msgid "``bar`` is compiled and starts executing" msgstr "``bar`` 已被編譯並開始執行" -#: ../../faq/programming.rst:2165 +#: ../../faq/programming.rst:2167 msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " "named ``foo``)" msgstr "" "``bar`` 引入 ``foo``\\ (這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" -#: ../../faq/programming.rst:2166 +#: ../../faq/programming.rst:2168 msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" @@ -4293,8 +4365,7 @@ msgstr "" "引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var``,以設定 ``bar.foo_var = " "foo.foo_var``" -#: ../../faq/programming.rst:2168 -#, fuzzy +#: ../../faq/programming.rst:2170 msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " "and the global symbol dictionary for ``foo`` is still empty." @@ -4302,7 +4373,7 @@ msgstr "" "最後一步失敗了,因為 Python 還沒有完成對 ``foo`` 的直譯,而 ``foo`` 的全域符" "號字典仍然是空的。" -#: ../../faq/programming.rst:2171 +#: ../../faq/programming.rst:2173 #, fuzzy msgid "" "The same thing happens when you use ``import foo``, and then try to access " @@ -4311,11 +4382,11 @@ msgstr "" "當你使用 ``import foo``,然後嘗試在全域程式碼中存取 ``foo.foo_var`` 時,也會" "發生同樣的事情。" -#: ../../faq/programming.rst:2174 +#: ../../faq/programming.rst:2176 msgid "There are (at least) three possible workarounds for this problem." msgstr "此問題有(至少)三種可能的解決方法。" -#: ../../faq/programming.rst:2176 +#: ../../faq/programming.rst:2178 #, fuzzy msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." @@ -4328,35 +4399,35 @@ msgstr "" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" "模組的所有內容都被參照為 ``.``。" -#: ../../faq/programming.rst:2181 +#: ../../faq/programming.rst:2183 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "Jim Roskind 建議在每個模組中按以下順序執行各個步驟:" -#: ../../faq/programming.rst:2183 +#: ../../faq/programming.rst:2185 #, fuzzy msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" msgstr "匯出(不需要引入基底類別的全域變數、函式和類別)" -#: ../../faq/programming.rst:2185 +#: ../../faq/programming.rst:2187 msgid "``import`` statements" msgstr "``import`` 陳述式" -#: ../../faq/programming.rst:2186 +#: ../../faq/programming.rst:2188 msgid "" "active code (including globals that are initialized from imported values)." msgstr "活躍程式碼(包括從引入值初始化的全域變數)。" -#: ../../faq/programming.rst:2188 +#: ../../faq/programming.rst:2190 msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " "strange place, but it does work." msgstr "" "Van Rossum 不太喜歡這種方法,因為引入出現在一個奇怪的地方,但它確實有效。" -#: ../../faq/programming.rst:2191 +#: ../../faq/programming.rst:2193 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." @@ -4364,15 +4435,15 @@ msgstr "" "Matthias Urlichs 建議重組 (restructuring) 你的程式碼,以便打從一開始就不需要" "遞迴引入。" -#: ../../faq/programming.rst:2194 +#: ../../faq/programming.rst:2196 msgid "These solutions are not mutually exclusive." msgstr "這些方案並不衝突。" -#: ../../faq/programming.rst:2198 +#: ../../faq/programming.rst:2200 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "__import__('x.y.z') 回傳 ,那我怎麼得到 z?" -#: ../../faq/programming.rst:2200 +#: ../../faq/programming.rst:2202 #, fuzzy msgid "" "Consider using the convenience function :func:`~importlib.import_module` " @@ -4381,17 +4452,17 @@ msgstr "" "考慮使用來自 :mod:`importlib` 的便利函式 :func:`~importlib.import_module` 代" "替: ::" -#: ../../faq/programming.rst:2203 +#: ../../faq/programming.rst:2205 msgid "z = importlib.import_module('x.y.z')" msgstr "z = importlib.import_module('x.y.z')" -#: ../../faq/programming.rst:2207 +#: ../../faq/programming.rst:2209 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" msgstr "當我編輯需要引入的模組並重新引入它時,更動沒有反應出來。為什麼會這樣?" -#: ../../faq/programming.rst:2209 +#: ../../faq/programming.rst:2211 #, fuzzy msgid "" "For reasons of efficiency as well as consistency, Python only reads the " @@ -4404,7 +4475,7 @@ msgstr "" "一個由許多模組組成的程式中,每個模組都引入相同的基本模組,基本模組將被解析和" "重新解析很多次。要強制重新讀取已更改的模組,請執行以下操作: ::" -#: ../../faq/programming.rst:2215 +#: ../../faq/programming.rst:2217 msgid "" "import importlib\n" "import modname\n" @@ -4414,17 +4485,17 @@ msgstr "" "import modname\n" "importlib.reload(modname)" -#: ../../faq/programming.rst:2219 +#: ../../faq/programming.rst:2221 msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" msgstr "警告:此技術並非 100% 萬無一失。尤其是包含像這樣陳述式的模組: ::" -#: ../../faq/programming.rst:2222 +#: ../../faq/programming.rst:2224 msgid "from modname import some_objects" msgstr "from modname import some_objects" -#: ../../faq/programming.rst:2224 +#: ../../faq/programming.rst:2226 #, fuzzy msgid "" "will continue to work with the old version of the imported objects. If the " @@ -4435,7 +4506,7 @@ msgstr "" "將繼續使用舊版本的引入物件。如果模組包含類別定義,現有的類別實例將*不會*更新" "為使用新的類別定義。這可能會導致以下自相矛盾的行為: ::" -#: ../../faq/programming.rst:2229 +#: ../../faq/programming.rst:2231 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -4445,14 +4516,21 @@ msgid "" ">>> isinstance(c, cls.C) # isinstance is false?!?\n" "False" msgstr "" +">>> import importlib\n" +">>> import cls\n" +">>> c = cls.C() # 建立一個 C 的實例\n" +">>> importlib.reload(cls)\n" +"\n" +">>> isinstance(c, cls.C) # isinstance 為 false?!?\n" +"False" -#: ../../faq/programming.rst:2237 +#: ../../faq/programming.rst:2239 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" msgstr "如果印出類別物件的「識別性」,問題的本質就很清楚了: ::" -#: ../../faq/programming.rst:2240 +#: ../../faq/programming.rst:2242 msgid "" ">>> hex(id(c.__class__))\n" "'0x7352a0'\n" diff --git a/faq/windows.po b/faq/windows.po index a0659bea13..b46fe34cdc 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -150,10 +150,10 @@ msgstr "" #: ../../faq/windows.rst:84 msgid "" "Many people use the interactive mode as a convenient yet highly programmable " -"calculator. When you want to end your interactive Python session, call the :" -"func:`exit` function or hold the :kbd:`Ctrl` key down while you enter a :kbd:" -"`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows command " -"prompt." +"calculator. When you want to end your interactive Python session, call " +"the :func:`exit` function or hold the :kbd:`Ctrl` key down while you enter " +"a :kbd:`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows " +"command prompt." msgstr "" "許多人將互動模式作為方便但可高度程式化的計算機。如果你要結束互動式 Python 對" "話,請呼叫 :func:`exit` 函式或是按住 :kbd:`Ctrl` 鍵再輸入 :kbd:`Z`,然後按下 " @@ -161,12 +161,12 @@ msgstr "" #: ../../faq/windows.rst:90 msgid "" -"You may also find that you have a Start-menu entry such as :menuselection:" -"`Start --> Programs --> Python 3.x --> Python (command line)` that results " -"in you seeing the ``>>>`` prompt in a new window. If so, the window will " -"disappear after you call the :func:`exit` function or enter the :kbd:`Ctrl-" -"Z` character; Windows is running a single \"python\" command in the window, " -"and closes it when you terminate the interpreter." +"You may also find that you have a Start-menu entry such " +"as :menuselection:`Start --> Programs --> Python 3.x --> Python (command " +"line)` that results in you seeing the ``>>>`` prompt in a new window. If " +"so, the window will disappear after you call the :func:`exit` function or " +"enter the :kbd:`Ctrl-Z` character; Windows is running a single \"python\" " +"command in the window, and closes it when you terminate the interpreter." msgstr "" "你可能還會發現你有一個開始功能表項目,像是::menuselection:`開始 --> 所有程" "式 --> Python 3.x --> Python(命令行)`,它會讓你在一個新視窗中看到 ``>>>`` " @@ -221,11 +221,11 @@ msgid "" "typing 'foo' with no extension you need to add .py to the PATHEXT " "environment variable." msgstr "" -"在 Windows 上,標準的 Python 安裝程式已將 .py 副檔名與一種檔案類型 (Python." -"File) 進行關聯,並為該檔案類型提供一個開啟命令來運行直譯器 (``D:\\Program " -"Files\\Python\\python.exe \"%1\" %*``)。這足以使腳本能以類似 'foo.py' 的形式" -"從命令提示字元被執行。如果你希望能夠簡單地輸入 'foo' 來執行腳本,而不用加上副" -"檔名,則需要將 .py 新增至 PATHEXT 環境變數中。" +"在 Windows 上,標準的 Python 安裝程式已將 .py 副檔名與一種檔案類型 " +"(Python.File) 進行關聯,並為該檔案類型提供一個開啟命令來運行直譯器 (``D:" +"\\Program Files\\Python\\python.exe \"%1\" %*``)。這足以使腳本能以類似 " +"'foo.py' 的形式從命令提示字元被執行。如果你希望能夠簡單地輸入 'foo' 來執行腳" +"本,而不用加上副檔名,則需要將 .py 新增至 PATHEXT 環境變數中。" #: ../../faq/windows.rst:124 msgid "Why does Python sometimes take so long to start?" @@ -285,8 +285,8 @@ msgstr "" "是的,.pyd 檔類似於 dll,但也有一些區別。如果你有一個名為 ``foo.pyd`` 的 " "DLL,則它必須具有函式 ``PyInit_foo()``。接著你可以將 \"import foo\" 寫入 " "Python 腳本,Python 將會搜尋 foo.pyd(以及 foo.py、foo.pyc),如果 Python 找" -"到它,將會嘗試呼叫 ``PyInit_foo()`` 來將它初始化。你並不會將你的 .exe 與 foo." -"lib 連結 (link),因為這會導致 Windows 要求 DLL 的存在。" +"到它,將會嘗試呼叫 ``PyInit_foo()`` 來將它初始化。你並不會將你的 .exe 與 " +"foo.lib 連結 (link),因為這會導致 Windows 要求 DLL 的存在。" #: ../../faq/windows.rst:157 msgid "" @@ -318,9 +318,10 @@ msgstr "在 Windows 應用程式中嵌入 Python 直譯器的過程可以總結 msgid "" "Do **not** build Python into your .exe file directly. On Windows, Python " "must be a DLL to handle importing modules that are themselves DLL's. (This " -"is the first key undocumented fact.) Instead, link to :file:`python{NN}." -"dll`; it is typically installed in ``C:\\Windows\\System``. *NN* is the " -"Python version, a number such as \"33\" for Python 3.3." +"is the first key undocumented fact.) Instead, link " +"to :file:`python{NN}.dll`; it is typically installed in ``C:" +"\\Windows\\System``. *NN* is the Python version, a number such as \"33\" " +"for Python 3.3." msgstr "" "**不要**\\ 直接將 Python 建置到你的 .exe 檔中。在 Windows 上,Python 必須是一" "個 DLL 來處理模組的 import,而那些模組本身也是 DLL。(這是第一個未正式記載的" @@ -337,8 +338,9 @@ msgid "" msgstr "" "你可以透過兩種不同的方式連結到 Python。載入時連結 (load-time linking) 表示要" "連結到 :file:`python{NN}.lib`,而執行環境連結 (run-time linking) 表示要連結" -"到 :file:`python{NN}.dll`。(一般註解::file:`python{NN}.lib` 是 :file:" -"`python{NN}.dll` 相對應的所謂 \"import lib\"。它只會為鏈接器定義符號。)" +"到 :file:`python{NN}.dll`。(一般註解::file:`python{NN}.lib` " +"是 :file:`python{NN}.dll` 相對應的所謂 \"import lib\"。它只會為鏈接器定義符" +"號。)" #: ../../faq/windows.rst:182 msgid "" @@ -352,9 +354,9 @@ msgid "" msgstr "" "執行環境連結大大簡化了連結選項;所有事情都會發生在執行環境。你的程式碼必須使" "用 Windows ``LoadLibraryEx()`` 常式 (routine) 來載入 :file:`python{NN}.dll`。" -"該程式碼也必須用 Windows ``GetProcAddress()`` 常式所取得的指標,來使用 :file:" -"`python{NN}.dll` 中的(即為 Python C API 的)存取常式和資料。對於任何呼叫 " -"Python C API 常式的 C 程式碼,巨集可以讓使用這些指標的過程透明化。" +"該程式碼也必須用 Windows ``GetProcAddress()`` 常式所取得的指標,來使" +"用 :file:`python{NN}.dll` 中的(即為 Python C API 的)存取常式和資料。對於任" +"何呼叫 Python C API 常式的 C 程式碼,巨集可以讓使用這些指標的過程透明化。" #: ../../faq/windows.rst:191 msgid "" @@ -498,10 +500,10 @@ msgstr "" #: ../../faq/windows.rst:262 msgid "" "Under any editor, mixing tabs and spaces is a bad idea. MSVC is no " -"different in this respect, and is easily configured to use spaces: Take :" -"menuselection:`Tools --> Options --> Tabs`, and for file type \"Default\" " -"set \"Tab size\" and \"Indent size\" to 4, and select the \"Insert spaces\" " -"radio button." +"different in this respect, and is easily configured to use spaces: " +"Take :menuselection:`Tools --> Options --> Tabs`, and for file type " +"\"Default\" set \"Tab size\" and \"Indent size\" to 4, and select the " +"\"Insert spaces\" radio button." msgstr "" "在任何編輯器下,將 tab 和空格混合都是一個壞主意。MSVC 在這方面也是一樣,且可" "以輕鬆配置為使用空格:選擇\\ :menuselection:`工具 --> 選項 --> Tabs`,然後對" @@ -511,12 +513,12 @@ msgstr "" #: ../../faq/windows.rst:267 msgid "" "Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs and " -"spaces are causing problems in leading whitespace. You may also run the :mod:" -"`tabnanny` module to check a directory tree in batch mode." +"spaces are causing problems in leading whitespace. You may also run " +"the :mod:`tabnanny` module to check a directory tree in batch mode." msgstr "" -"如果混合 tab 和空格造成前導空白字元出現問題,則 Python 會引發 :exc:" -"`IndentationError` 或 :exc:`TabError`。你也可以運行 :mod:`tabnanny` 模組,在" -"批次模式下檢查目錄樹。" +"如果混合 tab 和空格造成前導空白字元出現問題,則 Python 會引" +"發 :exc:`IndentationError` 或 :exc:`TabError`。你也可以運行 :mod:`tabnanny` " +"模組,在批次模式下檢查目錄樹。" #: ../../faq/windows.rst:274 msgid "How do I check for a keypress without blocking?" @@ -549,12 +551,6 @@ msgstr "" "解決問題,請造訪 `Microsoft 支援頁面 `_\\ 以取得關於手動安裝 C Runtime 更新的指南。" -#~ msgid "or::" -#~ msgstr "" -#~ "或是:\n" -#~ "\n" -#~ "::" - #~ msgid "" #~ "This series of screencasts aims to get you up and running with Python on " #~ "Windows XP. The knowledge is distilled into 1.5 hours and will get you " diff --git a/glossary.po b/glossary.po index 428ab89521..df20e8a0a7 100644 --- a/glossary.po +++ b/glossary.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Steven Hsu , 2021-2022 @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,22 +68,23 @@ msgid "" "define interfaces when other techniques like :func:`hasattr` would be clumsy " "or subtly wrong (for example with :ref:`magic methods `). " "ABCs introduce virtual subclasses, which are classes that don't inherit from " -"a class but are still recognized by :func:`isinstance` and :func:" -"`issubclass`; see the :mod:`abc` module documentation. Python comes with " -"many built-in ABCs for data structures (in the :mod:`collections.abc` " -"module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` " -"module), import finders and loaders (in the :mod:`importlib.abc` module). " -"You can create your own ABCs with the :mod:`abc` module." +"a class but are still recognized by :func:`isinstance` " +"and :func:`issubclass`; see the :mod:`abc` module documentation. Python " +"comes with many built-in ABCs for data structures (in " +"the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), " +"streams (in the :mod:`io` module), import finders and loaders (in " +"the :mod:`importlib.abc` module). You can create your own ABCs with " +"the :mod:`abc` module." msgstr "" "抽象基底類別(又稱為 ABC)提供了一種定義介面的方法,作為 :term:`duck-" "typing`\\ (鴨子型別)的補充。其他類似的技術,像是 :func:`hasattr`,則顯得笨" "拙或是帶有細微的錯誤(例如使用\\ :ref:`魔術方法 (magic method) `\\ )。ABC 採用虛擬的 subclass(子類別),它們並不繼承自另一個 class" -"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參閱 :" -"mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構(在 :mod:" -"`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流(在 :mod:`io` " -"模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模組)。你可以使用 :" -"mod:`abc` 模組建立自己的 ABC。" +"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參" +"閱 :mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構" +"(在 :mod:`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流" +"(在 :mod:`io` 模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模" +"組)。你可以使用 :mod:`abc` 模組建立自己的 ABC。" #: ../../glossary.rst:38 msgid "annotation" @@ -112,12 +112,12 @@ msgstr "" #: ../../glossary.rst:50 msgid "" "See :term:`variable annotation`, :term:`function annotation`, :pep:`484` " -"and :pep:`526`, which describe this functionality. Also see :ref:" -"`annotations-howto` for best practices on working with annotations." +"and :pep:`526`, which describe this functionality. Also " +"see :ref:`annotations-howto` for best practices on working with annotations." msgstr "" "請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:`484` " -"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參閱 :ref:" -"`annotations-howto`。" +"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參" +"閱 :ref:`annotations-howto`。" #: ../../glossary.rst:54 msgid "argument" @@ -197,12 +197,12 @@ msgstr "asynchronous context manager(非同步情境管理器)" #: ../../glossary.rst:86 msgid "" "An object which controls the environment seen in an :keyword:`async with` " -"statement by defining :meth:`~object.__aenter__` and :meth:`~object." -"__aexit__` methods. Introduced by :pep:`492`." +"statement by defining :meth:`~object.__aenter__` " +"and :meth:`~object.__aexit__` methods. Introduced by :pep:`492`." msgstr "" -"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定義 :" -"meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" -"的。由 :pep:`492` 引入。" +"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定" +"義 :meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控" +"制的。由 :pep:`492` 引入。" #: ../../glossary.rst:89 msgid "asynchronous generator" @@ -217,8 +217,8 @@ msgid "" msgstr "" "一個會回傳 :term:`asynchronous generator iterator`\\ (非同步產生器疊代器)的" "函式。它看起來像一個以 :keyword:`async def` 定義的協程函式 (coroutine " -"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用於 :" -"keyword:`async for` 迴圈的值。" +"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用" +"於 :keyword:`async for` 迴圈的值。" #: ../../glossary.rst:96 msgid "" @@ -249,28 +249,28 @@ msgstr "" #: ../../glossary.rst:107 msgid "" -"This is an :term:`asynchronous iterator` which when called using the :meth:" -"`~object.__anext__` method returns an awaitable object which will execute " -"the body of the asynchronous generator function until the next :keyword:" -"`yield` expression." +"This is an :term:`asynchronous iterator` which when called using " +"the :meth:`~object.__anext__` method returns an awaitable object which will " +"execute the body of the asynchronous generator function until the " +"next :keyword:`yield` expression." msgstr "" -"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它以 :meth:" -"`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable " -"object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " -"運算式。" +"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它" +"以 :meth:`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 " +"(awaitable object),該物件將執行非同步產生器的函式主體,直到遇到下一" +"個 :keyword:`yield` 運算式。" #: ../../glossary.rst:112 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " -"location execution state (including local variables and pending try-" -"statements). When the *asynchronous generator iterator* effectively resumes " -"with another awaitable returned by :meth:`~object.__anext__`, it picks up " -"where it left off. See :pep:`492` and :pep:`525`." +"execution state (including local variables and pending try-statements). " +"When the *asynchronous generator iterator* effectively resumes with another " +"awaitable returned by :meth:`~object.__anext__`, it picks up where it left " +"off. See :pep:`492` and :pep:`525`." msgstr "" -"每個 :keyword:`yield` 會暫停處理程序,並記住位置執行狀態(包括區域變數及擱置" -"中的 try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`~object." -"__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" -"pep:`492` 和 :pep:`525`。" +"每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " +"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個" +"被 :meth:`~object.__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼" +"續執行。請參閱 :pep:`492` 和 :pep:`525`。" #: ../../glossary.rst:117 msgid "asynchronous iterable" @@ -282,9 +282,9 @@ msgid "" "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " "method. Introduced by :pep:`492`." msgstr "" -"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它的 :meth:" -"`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" -"疊代器)。由 :pep:`492` 引入。" +"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它" +"的 :meth:`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ " +"(非同步疊代器)。由 :pep:`492` 引入。" #: ../../glossary.rst:122 msgid "asynchronous iterator" @@ -292,17 +292,18 @@ msgstr "asynchronous iterator(非同步疊代器)" #: ../../glossary.rst:124 msgid "" -"An object that implements the :meth:`~object.__aiter__` and :meth:`~object." -"__anext__` methods. :meth:`~object.__anext__` must return an :term:" -"`awaitable` object. :keyword:`async for` resolves the awaitables returned by " -"an asynchronous iterator's :meth:`~object.__anext__` method until it raises " -"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." +"An object that implements the :meth:`~object.__aiter__` " +"and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must " +"return an :term:`awaitable` object. :keyword:`async for` resolves the " +"awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` " +"method until it raises a :exc:`StopAsyncIteration` exception. Introduced " +"by :pep:`492`." msgstr "" "一個實作 :meth:`~object.__aiter__` 和 :meth:`~object.__anext__` method 的物" "件。:meth:`~object.__anext__` 必須回傳一個 :term:`awaitable`\\ (可等待物" "件)。:keyword:`async for` 會解析非同步疊代器的 :meth:`~object.__anext__` " -"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" -"pep:`492` 引入。" +"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。" +"由 :pep:`492` 引入。" #: ../../glossary.rst:129 msgid "attribute" @@ -320,10 +321,10 @@ msgstr "" #: ../../glossary.rst:136 msgid "" "It is possible to give an object an attribute whose name is not an " -"identifier as defined by :ref:`identifiers`, for example using :func:" -"`setattr`, if the object allows it. Such an attribute will not be accessible " -"using a dotted expression, and would instead need to be retrieved with :func:" -"`getattr`." +"identifier as defined by :ref:`identifiers`, for example " +"using :func:`setattr`, if the object allows it. Such an attribute will not " +"be accessible using a dotted expression, and would instead need to be " +"retrieved with :func:`getattr`." msgstr "" "如果一個物件允許,給予該物件一個名稱不是由\\ :ref:`identifiers`\\ 所定義之識" "別符 (identifier) 的屬性是有可能的,例如使用 :func:`setattr`。像這樣的屬性將" @@ -335,13 +336,13 @@ msgstr "awaitable(可等待物件)" #: ../../glossary.rst:143 msgid "" -"An object that can be used in an :keyword:`await` expression. Can be a :" -"term:`coroutine` or an object with an :meth:`~object.__await__` method. See " -"also :pep:`492`." +"An object that can be used in an :keyword:`await` expression. Can be " +"a :term:`coroutine` or an object with an :meth:`~object.__await__` method. " +"See also :pep:`492`." msgstr "" -"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一個 :term:" -"`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" -"另請參閱 :pep:`492`。" +"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一" +"個 :term:`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method " +"的物件。另請參閱 :pep:`492`。" #: ../../glossary.rst:146 msgid "BDFL" @@ -349,8 +350,8 @@ msgstr "BDFL" #: ../../glossary.rst:148 msgid "" -"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." +"Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." msgstr "" "Benevolent Dictator For Life(終身仁慈獨裁者),又名 `Guido van Rossum " "`_,Python 的創造者。" @@ -363,23 +364,23 @@ msgstr "binary file(二進位檔案)" msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " -"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, and instances of :class:`io." -"BytesIO` and :class:`gzip.GzipFile`." +"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer " +"`, :data:`sys.stdout.buffer `, and instances " +"of :class:`io.BytesIO` and :class:`gzip.GzipFile`." msgstr "" "一個能夠讀取和寫入 :term:`bytes-like objects `\\ (類位元" "組串物件)的 :term:`file object`\\ (檔案物件)。二進位檔案的例子有:以二進位" "模式(``'rb'``、``'wb'`` 或 ``'rb+'``)開啟的檔案、:data:`sys.stdin.buffer " -"`、:data:`sys.stdout.buffer `,以及 :class:`io." -"BytesIO` 和 :class:`gzip.GzipFile` 實例。" +"`、:data:`sys.stdout.buffer `,以" +"及 :class:`io.BytesIO` 和 :class:`gzip.GzipFile` 實例。" #: ../../glossary.rst:159 msgid "" -"See also :term:`text file` for a file object able to read and write :class:" -"`str` objects." +"See also :term:`text file` for a file object able to read and " +"write :class:`str` objects." msgstr "" -"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫入 :class:" -"`str` 物件的檔案物件。" +"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫" +"入 :class:`str` 物件的檔案物件。" #: ../../glossary.rst:161 msgid "borrowed reference" @@ -401,8 +402,8 @@ msgstr "" msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " -"cannot be destroyed before the last usage of the borrowed reference. The :c:" -"func:`Py_NewRef` function can be used to create a new :term:`strong " +"cannot be destroyed before the last usage of the borrowed reference. " +"The :c:func:`Py_NewRef` function can be used to create a new :term:`strong " "reference`." msgstr "" "對 :term:`borrowed reference` 呼叫 :c:func:`Py_INCREF` 以將它原地 (in-place) " @@ -416,12 +417,12 @@ msgstr "bytes-like object(類位元組串物件)" #: ../../glossary.rst:176 msgid "" -"An object that supports the :ref:`bufferobjects` and can export a C-:term:" -"`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " -"and :class:`array.array` objects, as well as many common :class:`memoryview` " -"objects. Bytes-like objects can be used for various operations that work " -"with binary data; these include compression, saving to a binary file, and " -"sending over a socket." +"An object that supports the :ref:`bufferobjects` and can export a " +"C-:term:`contiguous` buffer. This includes " +"all :class:`bytes`, :class:`bytearray`, and :class:`array.array` objects, as " +"well as many common :class:`memoryview` objects. Bytes-like objects can be " +"used for various operations that work with binary data; these include " +"compression, saving to a binary file, and sending over a socket." msgstr "" "一個支援\\ :ref:`bufferobjects`\\ 且能夠匯出 C-:term:`contiguous` 緩衝區的物" "件。這包括所有的 :class:`bytes`、:class:`bytearray` 和 :class:`array.array` " @@ -432,9 +433,9 @@ msgstr "" msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " -"buffer objects include :class:`bytearray` and a :class:`memoryview` of a :" -"class:`bytearray`. Other operations require the binary data to be stored in " -"immutable objects (\"read-only bytes-like objects\"); examples of these " +"buffer objects include :class:`bytearray` and a :class:`memoryview` of " +"a :class:`bytearray`. Other operations require the binary data to be stored " +"in immutable objects (\"read-only bytes-like objects\"); examples of these " "include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." msgstr "" "有些運算需要二進位資料是可變的。說明文件通常會將這些物件稱為「可讀寫的類位元" @@ -468,8 +469,8 @@ msgstr "" #: ../../glossary.rst:203 msgid "" -"A list of bytecode instructions can be found in the documentation for :ref:" -"`the dis module `." +"A list of bytecode instructions can be found in the documentation " +"for :ref:`the dis module `." msgstr "" "位元組碼的指令列表可以在 :ref:`dis 模組 `\\ 的說明文件中找到。" @@ -482,8 +483,8 @@ msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" msgstr "" -"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" -"term:`argument`): ::" +"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請" +"見 :term:`argument`): ::" #: ../../glossary.rst:210 msgid "callable(argument1, argument2, argumentN)" @@ -495,8 +496,8 @@ msgid "" "instance of a class that implements the :meth:`~object.__call__` method is " "also a callable." msgstr "" -"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實作 :" -"meth:`~object.__call__` 方法的 class 之實例也是個 callable。" +"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實" +"作 :meth:`~object.__call__` 方法的 class 之實例也是個 callable。" #: ../../glossary.rst:215 msgid "callback" @@ -541,9 +542,9 @@ msgstr "closure variable(閉包變數)" msgid "" "A :term:`free variable` referenced from a :term:`nested scope` that is " "defined in an outer scope rather than being resolved at runtime from the " -"globals or builtin namespaces. May be explicitly defined with the :keyword:" -"`nonlocal` keyword to allow write access, or implicitly defined if the " -"variable is only being read." +"globals or builtin namespaces. May be explicitly defined with " +"the :keyword:`nonlocal` keyword to allow write access, or implicitly defined " +"if the variable is only being read." msgstr "" "從外部作用域中定義且從\\ :term:`巢狀作用域 `\\ 參照的\\ :term:`" "自由變數 `,不是於 runtime 從全域或內建命名空間解析。可以使" @@ -608,10 +609,10 @@ msgstr "" "一個我們熟悉的實數系統的擴充,在此所有數字都會被表示為一個實部和一個虛部之" "和。虛數就是虛數單位(``-1`` 的平方根)的實數倍,此單位通常在數學中被寫為 " "``i``,在工程學中被寫為 ``j``。Python 內建了對複數的支援,它是用後者的記法來" -"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要將 :mod:" -"`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使用是一個" -"相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" -"忽略它們。" +"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要" +"將 :mod:`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使" +"用是一個相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可" +"以安全地忽略它們。" #: ../../glossary.rst:262 msgid "context" @@ -631,9 +632,10 @@ msgstr "" #: ../../glossary.rst:269 msgid "" -"The collection of key­value bindings associated with a particular :class:" -"`contextvars.Context` object and accessed via :class:`~contextvars." -"ContextVar` objects. Also see :term:`context variable`." +"The collection of key­value bindings associated with a " +"particular :class:`contextvars.Context` object and accessed " +"via :class:`~contextvars.ContextVar` objects. Also see :term:`context " +"variable`." msgstr "" #: ../../glossary.rst:273 @@ -651,8 +653,8 @@ msgid "" "The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " "the :keyword:`with` statement. See :pep:`343`." msgstr "" -"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` 和 :meth:" -"`~object.__exit__` 方法。另請參閱 :pep:`343`。" +"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` " +"和 :meth:`~object.__exit__` 方法。另請參閱 :pep:`343`。" #: ../../glossary.rst:279 msgid "context manager" @@ -661,8 +663,8 @@ msgstr "context manager(情境管理器)" #: ../../glossary.rst:281 msgid "" "An object which implements the :term:`context management protocol` and " -"controls the environment seen in a :keyword:`with` statement. See :pep:" -"`343`." +"controls the environment seen in a :keyword:`with` statement. " +"See :pep:`343`." msgstr "" #: ../../glossary.rst:284 @@ -695,7 +697,7 @@ msgstr "" "是連續的。零維 (zero-dimensional) 的緩衝區都是 C 及 Fortran contiguous。在一" "維 (one-dimensional) 陣列中,各項目必須在記憶體中彼此相鄰地排列,而其索引順序" "是從零開始遞增。在多維的 (multidimensional) C-contiguous 陣列中,按記憶體位址" -"的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" +"的順序瀏覽各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" #: ../../glossary.rst:302 @@ -720,13 +722,14 @@ msgstr "coroutine function(協程函式)" #: ../../glossary.rst:311 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " -"may be defined with the :keyword:`async def` statement, and may contain :" -"keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. " -"These were introduced by :pep:`492`." +"may be defined with the :keyword:`async def` statement, and may " +"contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` " +"keywords. These were introduced by :pep:`492`." msgstr "" -"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能以 :keyword:" -"`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " -"for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" +"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能" +"以 :keyword:`async def` 陳述式被定義,並可能會包" +"含 :keyword:`await`、:keyword:`async for` 和 :keyword:`async with` 關鍵字。這" +"些關鍵字由 :pep:`492` 引入。" #: ../../glossary.rst:316 msgid "CPython" @@ -752,9 +755,9 @@ msgid "" "The :term:`context` (:class:`contextvars.Context` object) that is currently " "used by :class:`~contextvars.ContextVar` objects to access (get or set) the " "values of :term:`context variables `. Each thread has its " -"own current context. Frameworks for executing asynchronous tasks (see :mod:" -"`asyncio`) associate each task with a context which becomes the current " -"context whenever the task starts or resumes execution." +"own current context. Frameworks for executing asynchronous tasks " +"(see :mod:`asyncio`) associate each task with a context which becomes the " +"current context whenever the task starts or resumes execution." msgstr "" #: ../../glossary.rst:330 @@ -801,8 +804,8 @@ msgid "" "the documentation for :ref:`function definitions ` and :ref:`class " "definitions ` for more about decorators." msgstr "" -"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" -"ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" +"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱" +"\\ :ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" #: ../../glossary.rst:350 msgid "descriptor" @@ -810,23 +813,24 @@ msgstr "descriptor(描述器)" #: ../../glossary.rst:352 msgid "" -"Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." -"__set__`, or :meth:`~object.__delete__`. When a class attribute is a " -"descriptor, its special binding behavior is triggered upon attribute " -"lookup. Normally, using *a.b* to get, set or delete an attribute looks up " -"the object named *b* in the class dictionary for *a*, but if *b* is a " -"descriptor, the respective descriptor method gets called. Understanding " -"descriptors is a key to a deep understanding of Python because they are the " -"basis for many features including functions, methods, properties, class " -"methods, static methods, and reference to super classes." -msgstr "" -"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` 或 :meth:" -"`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器時,它的特殊" -"連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除某個屬性時," -"會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個描述器,則相" -"對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的關鍵,因為它" -"們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" -"靜態 method,以及對 super class(父類別)的參照。" +"Any object which defines the " +"methods :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`. When a class attribute is a descriptor, its " +"special binding behavior is triggered upon attribute lookup. Normally, " +"using *a.b* to get, set or delete an attribute looks up the object named *b* " +"in the class dictionary for *a*, but if *b* is a descriptor, the respective " +"descriptor method gets called. Understanding descriptors is a key to a deep " +"understanding of Python because they are the basis for many features " +"including functions, methods, properties, class methods, static methods, and " +"reference to super classes." +msgstr "" +"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` " +"或 :meth:`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器" +"時,它的特殊連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除" +"某個屬性時,會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個" +"描述器,則相對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的" +"關鍵,因為它們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、" +"class method、靜態 method,以及對 super class(父類別)的參照。" #: ../../glossary.rst:363 msgid "" @@ -871,11 +875,11 @@ msgstr "dictionary view(字典檢視)" #: ../../glossary.rst:379 msgid "" -"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" -"`dict.items` are called dictionary views. They provide a dynamic view on the " -"dictionary’s entries, which means that when the dictionary changes, the view " -"reflects these changes. To force the dictionary view to become a full list " -"use ``list(dictview)``. See :ref:`dict-views`." +"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, " +"and :meth:`dict.items` are called dictionary views. They provide a dynamic " +"view on the dictionary’s entries, which means that when the dictionary " +"changes, the view reflects these changes. To force the dictionary view to " +"become a full list use ``list(dictview)``. See :ref:`dict-views`." msgstr "" "從 :meth:`dict.keys`、:meth:`dict.values` 及 :meth:`dict.items` 回傳的物件被" "稱為字典檢視。它們提供了字典中項目的動態檢視,這表示當字典有變動時,該檢視會" @@ -895,9 +899,9 @@ msgid "" "introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" -"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" -"覽,因此它是物件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組" +"的 :attr:`~definition.__doc__` 屬性中。由於說明字串可以透過內省 " +"(introspection) 來瀏覽,因此它是物件的說明文件存放的標準位置。" #: ../../glossary.rst:393 msgid "duck-typing" @@ -910,10 +914,10 @@ msgid "" "called or used (\"If it looks like a duck and quacks like a duck, it must be " "a duck.\") By emphasizing interfaces rather than specific types, well-" "designed code improves its flexibility by allowing polymorphic " -"substitution. Duck-typing avoids tests using :func:`type` or :func:" -"`isinstance`. (Note, however, that duck-typing can be complemented with :" -"term:`abstract base classes `.) Instead, it typically " -"employs :func:`hasattr` tests or :term:`EAFP` programming." +"substitution. Duck-typing avoids tests using :func:`type` " +"or :func:`isinstance`. (Note, however, that duck-typing can be complemented " +"with :term:`abstract base classes `.) Instead, it " +"typically employs :func:`hasattr` tests or :term:`EAFP` programming." msgstr "" "一種程式設計風格,它不是藉由檢查一個物件的型別來確定它是否具有正確的介面;取" "而代之的是,method 或屬性會單純地被呼叫或使用。(「如果它看起來像一隻鴨子而且" @@ -939,9 +943,9 @@ msgid "" msgstr "" "Easier to ask for forgiveness than permission.(請求寬恕比請求許可更容易。)" "這種常見的 Python 編碼風格會先假設有效的鍵或屬性的存在,並在該假設被推翻時再" -"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` 和 :" -"keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" -"格形成了對比。" +"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` " +"和 :keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見" +"的 :term:`LBYL` 風格形成了對比。" #: ../../glossary.rst:412 msgid "expression" @@ -1015,9 +1019,10 @@ msgid "" "The canonical way to create a file object is by using the :func:`open` " "function." msgstr "" -"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的\\ :" -"term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" -"面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" +"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 `、緩衝的" +"\\ :term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們" +"的介面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函" +"式。" #: ../../glossary.rst:445 msgid "file-like object" @@ -1050,9 +1055,9 @@ msgstr "" #: ../../glossary.rst:457 msgid "" -"The :func:`sys.getfilesystemencoding` and :func:`sys." -"getfilesystemencodeerrors` functions can be used to get the filesystem " -"encoding and error handler." +"The :func:`sys.getfilesystemencoding` " +"and :func:`sys.getfilesystemencodeerrors` functions can be used to get the " +"filesystem encoding and error handler." msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" @@ -1060,14 +1065,14 @@ msgstr "" #: ../../glossary.rst:461 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." -"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" -"c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.filesystem_encoding` " +"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" ":term:`filesystem encoding and error handler`\\ (檔案系統編碼和錯誤處理函" -"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參閱 :c:" -"member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" -"member:`~PyConfig.filesystem_errors`。" +"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參" +"閱 :c:member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成" +"員 :c:member:`~PyConfig.filesystem_errors`。" #: ../../glossary.rst:466 msgid "See also the :term:`locale encoding`." @@ -1123,8 +1128,8 @@ msgstr "free threading(自由執行緒)" #: ../../glossary.rst:486 msgid "" "A threading model where multiple threads can run Python bytecode " -"simultaneously within the same interpreter. This is in contrast to the :" -"term:`global interpreter lock` which allows only one thread to execute " +"simultaneously within the same interpreter. This is in contrast to " +"the :term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" "為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" @@ -1153,13 +1158,13 @@ msgstr "function(函式)" msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " -"execution of the body. See also :term:`parameter`, :term:`method`, and the :" -"ref:`function` section." +"execution of the body. See also :term:`parameter`, :term:`method`, and " +"the :ref:`function` section." msgstr "" "一連串的陳述式,它能夠向呼叫者回傳一些值。它也可以被傳遞零個或多個\\ :term:`" -"引數 `,這些引數可被使用於函式本體的執行。另請參閱 :term:" -"`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " -"章節。" +"引數 `,這些引數可被使用於函式本體的執行。另請參" +"閱 :term:`parameter`\\ (參數)、:term:`method`\\ (方法),以及" +"\\ :ref:`function`\\ 章節。" #: ../../glossary.rst:503 msgid "function annotation" @@ -1207,14 +1212,14 @@ msgstr "__future__" msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " -"that will become standard in a future release of Python. The :mod:" -"`__future__` module documents the possible values of *feature*. By " +"that will become standard in a future release of Python. " +"The :mod:`__future__` module documents the possible values of *feature*. By " "importing this module and evaluating its variables, you can see when a new " "feature was first added to the language and when it will (or did) become the " "default::" msgstr "" ":ref:`future 陳述式 `:``from __future__ import ``,會指示編" -"譯器使用那些在 Python 未來的發布版本中將成為標準的語法或語義,來編譯當前的模" +"譯器使用那些在 Python 未來的發布版本中將成為標準的語法或語義,來編譯目前的模" "組。而 :mod:`__future__` 模組則記錄了 *feature(功能)*\\ 可能的值。透過 " "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" @@ -1280,13 +1285,13 @@ msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。 #: ../../glossary.rst:556 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " -"location execution state (including local variables and pending try-" -"statements). When the *generator iterator* resumes, it picks up where it " -"left off (in contrast to functions which start fresh on every invocation)." +"execution state (including local variables and pending try-statements). " +"When the *generator iterator* resumes, it picks up where it left off (in " +"contrast to functions which start fresh on every invocation)." msgstr "" -"每個 :keyword:`yield` 會暫停處理程序,並記住位置執行狀態(包括區域變數及擱置" -"中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" -"那些每次調用時都要重新開始的函式有所不同)。" +"每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " +"try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與那些" +"每次呼叫時都要重新開始的函式有所不同)。" #: ../../glossary.rst:562 ../../glossary.rst:563 msgid "generator expression" @@ -1327,11 +1332,11 @@ msgstr "" #: ../../glossary.rst:578 msgid "" -"See also the :term:`single dispatch` glossary entry, the :func:`functools." -"singledispatch` decorator, and :pep:`443`." +"See also the :term:`single dispatch` glossary entry, " +"the :func:`functools.singledispatch` decorator, and :pep:`443`." msgstr "" -"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." -"singledispatch` 裝飾器和 :pep:`443`。" +"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條" +"目、:func:`functools.singledispatch` 裝飾器和 :pep:`443`。" #: ../../glossary.rst:580 msgid "generic type" @@ -1340,20 +1345,21 @@ msgstr "generic type(泛型型別)" #: ../../glossary.rst:582 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " -"class` such as :class:`list` or :class:`dict`. Used for :" -"term:`type hints ` and :term:`annotations `." +"class` such as :class:`list` or :class:`dict`. Used " +"for :term:`type hints ` and :term:`annotations `." msgstr "" -"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一個 :ref:" -"`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" -"\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" +"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一" +"個 :ref:`容器型別 `,像是 :class:`list` 和 :class:`dict`。它" +"被用於\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" #: ../../glossary.rst:587 msgid "" -"For more details, see :ref:`generic alias types`, :pep:" -"`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." +"For more details, see :ref:`generic alias types`, :pep:`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` " +"module." msgstr "" -"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" -"`484`、:pep:`585` 和 :mod:`typing` 模組。" +"詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:`484`、:pep:`585` 和 :mod:`typing` 模組。" #: ../../glossary.rst:589 msgid "GIL" @@ -1434,10 +1440,10 @@ msgid "" "compared to other objects (it needs an :meth:`~object.__eq__` method). " "Hashable objects which compare equal must have the same hash value." msgstr "" -"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一個 :meth:" -"`~object.__hash__` method),且可與其他物件互相比較(它需要一個 :meth:" -"`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" -"多個可雜湊物件,它們必須擁有相同的雜湊值。" +"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一" +"個 :meth:`~object.__hash__` method),且可與其他物件互相比較(它需要一" +"個 :meth:`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結" +"果為相等的多個可雜湊物件,它們必須擁有相同的雜湊值。" #: ../../glossary.rst:627 msgid "" @@ -1478,12 +1484,12 @@ msgstr "" #: ../../glossary.rst:642 msgid "immortal" -msgstr "immportal(不滅)" +msgstr "immortal(不滅)" #: ../../glossary.rst:644 msgid "" -"*Immortal objects* are a CPython implementation detail introduced in :pep:" -"`683`." +"*Immortal objects* are a CPython implementation detail introduced " +"in :pep:`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" #: ../../glossary.rst:647 @@ -1493,8 +1499,8 @@ msgid "" "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" "如果一個物件是不滅的,它的\\ :term:`參照計數 `\\ 永遠不會被" -"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" -"`None` 在 CPython 中是不滅的。" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` " +"和 :const:`None` 在 CPython 中是不滅的。" #: ../../glossary.rst:650 msgid "immutable" @@ -1546,11 +1552,11 @@ msgstr "importer(引入器)" #: ../../glossary.rst:670 msgid "" -"An object that both finds and loads a module; both a :term:`finder` and :" -"term:`loader` object." +"An object that both finds and loads a module; both a :term:`finder` " +"and :term:`loader` object." msgstr "" -"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" -"`loader`\\ (載入器)物件。" +"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也" +"是 :term:`loader`\\ (載入器)物件。" #: ../../glossary.rst:672 msgid "interactive" @@ -1567,7 +1573,7 @@ msgid "" msgstr "" "Python 有一個互動式直譯器,這表示你可以在直譯器的提示字元輸入陳述式和運算式," "立即執行它們並且看到它們的結果。只要啟動 ``python``,不需要任何引數(可能藉由" -"從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" +"從你的電腦的主選單選擇它)。這是測試新想法或檢查模組和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" #: ../../glossary.rst:681 @@ -1596,12 +1602,12 @@ msgstr "interpreter shutdown(直譯器關閉)" msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " -"critical internal structures. It also makes several calls to the :term:" -"`garbage collector `. This can trigger the execution of " -"code in user-defined destructors or weakref callbacks. Code executed during " -"the shutdown phase can encounter various exceptions as the resources it " -"relies on may not function anymore (common examples are library modules or " -"the warnings machinery)." +"critical internal structures. It also makes several calls to " +"the :term:`garbage collector `. This can trigger the " +"execution of code in user-defined destructors or weakref callbacks. Code " +"executed during the shutdown phase can encounter various exceptions as the " +"resources it relies on may not function anymore (common examples are library " +"modules or the warnings machinery)." msgstr "" "當 Python 直譯器被要求關閉時,它會進入一個特殊階段,在此它逐漸釋放所有被配置" "的資源,例如模組和各種關鍵內部結構。它也會多次呼叫\\ :term:`垃圾回收器 " @@ -1625,37 +1631,39 @@ msgstr "iterable(可疊代物件)" msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " -"and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" -"`file objects `, and objects of any classes you define with an :" -"meth:`~iterator.__iter__` method or with a :meth:`~object.__getitem__` " -"method that implements :term:`sequence` semantics." +"and :class:`tuple`) and some non-sequence types " +"like :class:`dict`, :term:`file objects `, and objects of any " +"classes you define with an :meth:`~object.__iter__` method or with " +"a :meth:`~object.__getitem__` method that implements :term:`sequence` " +"semantics." msgstr "" "一種能夠一次回傳一個其中成員的物件。可疊代物件的例子包括所有的序列型別(像" -"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像是 :" -"class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物件," -"只要那些 class 有 :meth:`~iterator.__iter__` method 或是實作 :term:" -"`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" -"疊代物件。" +"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像" +"是 :class:`dict`、:term:`檔案物件 `,以及你所定義的任何 class 物" +"件,只要那些 class 有實作 :term:`sequence`\\ (序列)語意" +"的 :meth:`~object.__iter__` 或是 :meth:`~object.__getitem__` method,該物件就" +"是可疊代物件。" #: ../../glossary.rst:713 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " -"iterable object is passed as an argument to the built-in function :func:" -"`iter`, it returns an iterator for the object. This iterator is good for " -"one pass over the set of values. When using iterables, it is usually not " -"necessary to call :func:`iter` or deal with iterator objects yourself. The :" -"keyword:`for` statement does that automatically for you, creating a " -"temporary unnamed variable to hold the iterator for the duration of the " -"loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." -msgstr "" -"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 (:func:" -"`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函式 :func:" -"`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行一遍 (one " -"pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理疊代器物" -"件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的未命名變" -"數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" -"term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" +"iterable object is passed as an argument to the built-in " +"function :func:`iter`, it returns an iterator for the object. This iterator " +"is good for one pass over the set of values. When using iterables, it is " +"usually not necessary to call :func:`iter` or deal with iterator objects " +"yourself. The :keyword:`for` statement does that automatically for you, " +"creating a temporary unnamed variable to hold the iterator for the duration " +"of the loop. See also :term:`iterator`, :term:`sequence`, " +"and :term:`generator`." +msgstr "" +"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 " +"(:func:`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函" +"式 :func:`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行" +"一遍 (one pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理" +"疊代器物件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的" +"未命名變數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代" +"器)、:term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" #: ../../glossary.rst:723 msgid "iterator" @@ -1663,32 +1671,33 @@ msgstr "iterator(疊代器)" #: ../../glossary.rst:725 msgid "" -"An object representing a stream of data. Repeated calls to the iterator's :" -"meth:`~iterator.__next__` method (or passing it to the built-in function :" -"func:`next`) return successive items in the stream. When no more data are " -"available a :exc:`StopIteration` exception is raised instead. At this " -"point, the iterator object is exhausted and any further calls to its :meth:`!" -"__next__` method just raise :exc:`StopIteration` again. Iterators are " -"required to have an :meth:`~iterator.__iter__` method that returns the " -"iterator object itself so every iterator is also iterable and may be used in " -"most places where other iterables are accepted. One notable exception is " -"code which attempts multiple iteration passes. A container object (such as " -"a :class:`list`) produces a fresh new iterator each time you pass it to the :" -"func:`iter` function or use it in a :keyword:`for` loop. Attempting this " -"with an iterator will just return the same exhausted iterator object used in " -"the previous iteration pass, making it appear like an empty container." +"An object representing a stream of data. Repeated calls to the " +"iterator's :meth:`~iterator.__next__` method (or passing it to the built-in " +"function :func:`next`) return successive items in the stream. When no more " +"data are available a :exc:`StopIteration` exception is raised instead. At " +"this point, the iterator object is exhausted and any further calls to " +"its :meth:`!__next__` method just raise :exc:`StopIteration` again. " +"Iterators are required to have an :meth:`~iterator.__iter__` method that " +"returns the iterator object itself so every iterator is also iterable and " +"may be used in most places where other iterables are accepted. One notable " +"exception is code which attempts multiple iteration passes. A container " +"object (such as a :class:`list`) produces a fresh new iterator each time you " +"pass it to the :func:`iter` function or use it in a :keyword:`for` loop. " +"Attempting this with an iterator will just return the same exhausted " +"iterator object used in the previous iteration pass, making it appear like " +"an empty container." msgstr "" "一個表示資料流的物件。重複地呼叫疊代器的 :meth:`~iterator.__next__` method" "(或是將它傳遞給內建函式 :func:`next`\\ )會依序回傳資料流中的各項目。當不再" "有資料時,則會引發 :exc:`StopIteration` 例外。此時,該疊代器物件已被用盡,而" -"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引發 :exc:" -"`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method,它會回傳" -"疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用其他可疊" -"代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration passes) 的程" -"式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞給 :func:`iter` 函式" -"或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊代器。使用疊代器嘗試" -"此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" -"件,使其看起來就像一個空的容器。" +"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引" +"發 :exc:`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method," +"它會回傳疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用" +"其他可疊代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration " +"passes) 的程式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞" +"給 :func:`iter` 函式或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊" +"代器。使用疊代器嘗試此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一" +"個已被用盡的疊代器物件,使其看起來就像一個空的容器。" #: ../../glossary.rst:740 msgid "More information can be found in :ref:`typeiter`." @@ -1696,13 +1705,14 @@ msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" #: ../../glossary.rst:744 msgid "" -"CPython does not consistently apply the requirement that an iterator define :" -"meth:`~iterator.__iter__`. And also please note that the free-threading " -"CPython does not guarantee the thread-safety of iterator operations." +"CPython does not consistently apply the requirement that an iterator " +"define :meth:`~iterator.__iter__`. And also please note that the free-" +"threading CPython does not guarantee the thread-safety of iterator " +"operations." msgstr "" -"CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." -"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" -"疊代器操作的執行緒安全。" +"CPython 並不是始終如一地都會檢查「疊代器有定" +"義 :meth:`~iterator.__iter__`\\ 」這個規定。另請注意,free-threading(自由執" +"行緒)CPython 不保證疊代器操作的執行緒安全。" #: ../../glossary.rst:749 msgid "key function" @@ -1721,37 +1731,37 @@ msgstr "" #: ../../glossary.rst:756 msgid "" "A number of tools in Python accept key functions to control how elements are " -"ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" -"meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq." -"nlargest`, and :func:`itertools.groupby`." +"ordered or grouped. They " +"include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, " +"and :func:`itertools.groupby`." msgstr "" -"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包括 :" -"func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq." -"merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." -"groupby`。" +"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包" +"括 :func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq.merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` " +"和 :func:`itertools.groupby`。" #: ../../glossary.rst:762 msgid "" -"There are several ways to create a key function. For example. the :meth:" -"`str.lower` method can serve as a key function for case insensitive sorts. " -"Alternatively, a key function can be built from a :keyword:`lambda` " -"expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator." -"attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` " -"are three key function constructors. See the :ref:`Sorting HOW TO " -"` for examples of how to create and use key functions." +"There are several ways to create a key function. For example. " +"the :meth:`str.lower` method can serve as a key function for case " +"insensitive sorts. Alternatively, a key function can be built from " +"a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. " +"Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, " +"and :func:`operator.methodcaller` are three key function constructors. See " +"the :ref:`Sorting HOW TO ` for examples of how to create and " +"use key functions." msgstr "" "有幾種方法可以建立一個鍵函式。例如,:meth:`str.lower` method 可以作為不分大小" "寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造,例" -"如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`、:func:" -"`operator.itemgetter` 和 :func:`operator.methodcaller` 為三個鍵函式的建構函" -"式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " -"`。" +"如 ``lambda r: (r[0], r[2])``。另" +"外,:func:`operator.attrgetter`、:func:`operator.itemgetter` " +"和 :func:`operator.methodcaller` 為三個鍵函式的建構函式 (constructor)。關於如" +"何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 `。" #: ../../glossary.rst:769 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:771 ../../glossary.rst:1075 +#: ../../glossary.rst:771 ../../glossary.rst:1086 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" @@ -1781,8 +1791,8 @@ msgid "" "statements." msgstr "" "Look before you leap.(三思而後行。)這種編碼風格會在進行呼叫或查找之前,明確" -"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" -"keyword:`if` 陳述式的存在。" +"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許" +"多 :keyword:`if` 陳述式的存在。" #: ../../glossary.rst:784 msgid "" @@ -1799,10 +1809,18 @@ msgstr "" "解決。" #: ../../glossary.rst:789 +msgid "lexical analyzer" +msgstr "" + +#: ../../glossary.rst:792 +msgid "Formal name for the *tokenizer*; see :term:`token`." +msgstr "" + +#: ../../glossary.rst:793 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:791 +#: ../../glossary.rst:795 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1812,11 +1830,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:794 +#: ../../glossary.rst:798 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:796 +#: ../../glossary.rst:800 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1826,95 +1844,101 @@ msgid "" msgstr "" "一種用來處理一個序列中的全部或部分元素,並將處理結果以一個 list 回傳的簡要方" "法。``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` 會產" -"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 (0x..)。:" -"keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" -"處理。" +"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 " +"(0x..)。:keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有" +"元素都會被處理。" -#: ../../glossary.rst:802 +#: ../../glossary.rst:806 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:804 +#: ../../glossary.rst:808 msgid "" -"An object that loads a module. It must define a method named :meth:" -"`load_module`. A loader is typically returned by a :term:`finder`. See also:" +"An object that loads a module. It must define the :meth:`!exec_module` " +"and :meth:`!create_module` methods to implement " +"the :class:`~importlib.abc.Loader` interface. A loader is typically returned " +"by a :term:`finder`. See also:" msgstr "" -"一個能夠載入模組的物件。它必須定義一個名為 :meth:`load_module` 的 method(方" -"法)。載入器通常是被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" +"一個能夠載入模組的物件。它必須定義 :meth:`!exec_module` 和 :meth:`!" +"create_module` 方法以實作 :class:`~importlib.abc.Loader` 介面。載入器通常是" +"被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:808 +#: ../../glossary.rst:814 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:809 +#: ../../glossary.rst:815 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:810 +#: ../../glossary.rst:816 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:811 +#: ../../glossary.rst:817 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:813 +#: ../../glossary.rst:819 msgid "" -"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" -"`locale.setlocale(locale.LC_CTYPE, new_locale) `." +"On Unix, it is the encoding of the LC_CTYPE locale. It can be set " +"with :func:`locale.setlocale(locale.LC_CTYPE, new_locale) " +"`." msgstr "" -"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." -"setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" +"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以" +"用 :func:`locale.setlocale(locale.LC_CTYPE, new_locale) ` " +"來設定。" -#: ../../glossary.rst:816 +#: ../../glossary.rst:822 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:818 +#: ../../glossary.rst:824 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:826 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:828 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:823 +#: ../../glossary.rst:829 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:827 +#: ../../glossary.rst:833 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:828 +#: ../../glossary.rst:834 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:830 +#: ../../glossary.rst:836 msgid "" "A container object that supports arbitrary key lookups and implements the " -"methods specified in the :class:`collections.abc.Mapping` or :class:" -"`collections.abc.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:" -"`collections.defaultdict`, :class:`collections.OrderedDict` and :class:" -"`collections.Counter`." +"methods specified in the :class:`collections.abc.Mapping` " +"or :class:`collections.abc.MutableMapping` :ref:`abstract base classes " +"`. Examples " +"include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` " +"and :class:`collections.Counter`." msgstr "" "一個容器物件,它支援任意鍵的查找,且能實作 :ref:`abstract base classes(抽象" -"基底類別) `\\ 中,:class:`collections." -"abc.Mapping` 或 :class:`collections.abc.MutableMapping` 所指定的 method。範例" -"包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." -"OrderedDict` 和 :class:`collections.Counter`。" +"基底類別) `\\ " +"中,:class:`collections.abc.Mapping` " +"或 :class:`collections.abc.MutableMapping` 所指定的 method。範例包" +"括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections.OrderedDict` " +"和 :class:`collections.Counter`。" -#: ../../glossary.rst:836 +#: ../../glossary.rst:842 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:838 +#: ../../glossary.rst:844 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:842 +#: ../../glossary.rst:848 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:844 +#: ../../glossary.rst:850 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:846 +#: ../../glossary.rst:852 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1955,31 +1979,31 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:856 +#: ../../glossary.rst:862 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:825 ../../glossary.rst:857 ../../glossary.rst:1220 +#: ../../glossary.rst:831 ../../glossary.rst:863 ../../glossary.rst:1231 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:859 +#: ../../glossary.rst:865 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " -"first :term:`argument` (which is usually called ``self``). See :term:" -"`function` and :term:`nested scope`." +"first :term:`argument` (which is usually called ``self``). " +"See :term:`function` and :term:`nested scope`." msgstr "" "一個在 class 本體內被定義的函式。如果 method 作為其 class 實例的一個屬性被呼" "叫,則它將會得到該實例物件成為它的第一個 :term:`argument`\\ (引數)(此引數" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:863 +#: ../../glossary.rst:869 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:865 +#: ../../glossary.rst:871 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -1988,11 +2012,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:868 +#: ../../glossary.rst:874 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:870 +#: ../../glossary.rst:876 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -2002,51 +2026,51 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:874 +#: ../../glossary.rst:880 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:875 +#: ../../glossary.rst:881 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:877 +#: ../../glossary.rst:883 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." msgstr "" -"一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." -"machinery.ModuleSpec` 的一個實例。" +"一個命名空間,它包含用於載入模組的 import 相關資訊。它" +"是 :class:`importlib.machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:880 +#: ../../glossary.rst:886 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:881 +#: ../../glossary.rst:887 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:883 +#: ../../glossary.rst:889 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:884 +#: ../../glossary.rst:890 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:886 +#: ../../glossary.rst:892 msgid "" -"Mutable objects can change their value but keep their :func:`id`. See also :" -"term:`immutable`." +"Mutable objects can change their value but keep their :func:`id`. See " +"also :term:`immutable`." msgstr "" -"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" -"`immutable`\\ (不可變物件)。" +"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參" +"閱 :term:`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:888 +#: ../../glossary.rst:894 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:890 +#: ../../glossary.rst:896 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2056,16 +2080,16 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:894 +#: ../../glossary.rst:900 msgid "" -"Several built-in types are named tuples, including the values returned by :" -"func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." -"float_info`::" +"Several built-in types are named tuples, including the values returned " +"by :func:`time.localtime` and :func:`os.stat`. Another example " +"is :data:`sys.float_info`::" msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:898 +#: ../../glossary.rst:904 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2075,71 +2099,86 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:905 +#: ../../glossary.rst:911 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " "that inherits from :class:`tuple` and that defines named fields. Such a " -"class can be written by hand, or it can be created by inheriting :class:" -"`typing.NamedTuple`, or with the factory function :func:`collections." -"namedtuple`. The latter techniques also add some extra methods that may not " -"be found in hand-written or built-in named tuples." +"class can be written by hand, or it can be created by " +"inheriting :class:`typing.NamedTuple`, or with the factory " +"function :func:`collections.namedtuple`. The latter techniques also add " +"some extra methods that may not be found in hand-written or built-in named " +"tuples." msgstr "" "有些 named tuple 是內建型別(如上例)。或者,一個 named tuple 也可以從一個正" "規的 class 定義來建立,只要該 class 是繼承自 :class:`tuple`,且定義了附名欄" -"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承自 :class:`typing." -"NamedTuple` 來建立,也可以使用工廠函式 (factory function) :func:`collections." -"namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" -"寫或內建的 named tuple 中,無法找到的。" +"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承" +"自 :class:`typing.NamedTuple` 來建立,也可以使用工廠函式 (factory " +"function) :func:`collections.namedtuple` 來建立。後者技術也增加了一些額外的 " +"method,這些 method 可能是在手寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:913 +#: ../../glossary.rst:919 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:915 +#: ../../glossary.rst:921 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " "as nested namespaces in objects (in methods). Namespaces support modularity " -"by preventing naming conflicts. For instance, the functions :func:`builtins." -"open <.open>` and :func:`os.open` are distinguished by their namespaces. " -"Namespaces also aid readability and maintainability by making it clear which " -"module implements a function. For instance, writing :func:`random.seed` or :" -"func:`itertools.islice` makes it clear that those functions are implemented " -"by the :mod:`random` and :mod:`itertools` modules, respectively." +"by preventing naming conflicts. For instance, the " +"functions :func:`builtins.open <.open>` and :func:`os.open` are " +"distinguished by their namespaces. Namespaces also aid readability and " +"maintainability by making it clear which module implements a function. For " +"instance, writing :func:`random.seed` or :func:`itertools.islice` makes it " +"clear that those functions are implemented by the :mod:`random` " +"and :mod:`itertools` modules, respectively." msgstr "" "變數被儲存的地方。命名空間是以 dictionary(字典)被實作。有區域的、全域的及內" "建的命名空間,而在物件中(在 method 中)也有巢狀的命名空間。命名空間藉由防止" -"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` 和 :func:" -"`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是哪個模組" -"在實作一個函式,來增進可讀性及可維護性。例如,寫出 :func:`random.seed` 或 :" -"func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" -"`itertools` 模組在實作。" +"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` " +"和 :func:`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是" +"哪個模組在實作一個函式,來增進可讀性及可維護性。例如,寫" +"出 :func:`random.seed` 或 :func:`itertools.islice` 明確地表示,這些函式分別是" +"由 :mod:`random` 和 :mod:`itertools` 模組在實作。" -#: ../../glossary.rst:925 +#: ../../glossary.rst:931 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:927 +#: ../../glossary.rst:933 msgid "" -"A :pep:`420` :term:`package` which serves only as a container for " -"subpackages. Namespace packages may have no physical representation, and " -"specifically are not like a :term:`regular package` because they have no " -"``__init__.py`` file." +"A :term:`package` which serves only as a container for subpackages. " +"Namespace packages may have no physical representation, and specifically are " +"not like a :term:`regular package` because they have no ``__init__.py`` file." msgstr "" -"一個 :pep:`420` :term:`package`\\ (套件),它只能作為子套件 (subpackage) 的" -"一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" -"`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" +"一個 :term:`package`\\ (套件),它只能作為子套件 (subpackage) 的一個容器。命" +"名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:`regular " +"package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" + +#: ../../glossary.rst:938 +msgid "" +"Namespace packages allow several individually installable packages to have a " +"common parent package. Otherwise, it is recommended to use a :term:`regular " +"package`." +msgstr "" +"命名空間套件允許數個可獨立安裝的套件擁有一個共同的父套件。除此之外,建議使" +"用 :term:`regular package`。" + +#: ../../glossary.rst:941 +msgid "" +"For more information, see :pep:`420` and :ref:`reference-namespace-package`." +msgstr "更多資訊,請參閱 :pep:`420` 和 :ref:`reference-namespace-package`。" -#: ../../glossary.rst:932 +#: ../../glossary.rst:943 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:933 +#: ../../glossary.rst:944 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:935 +#: ../../glossary.rst:946 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2154,39 +2193,41 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:942 +#: ../../glossary.rst:953 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:944 +#: ../../glossary.rst:955 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " -"versatile features like :attr:`~object.__slots__`, descriptors, properties, :" -"meth:`~object.__getattribute__`, class methods, and static methods." +"versatile features like :attr:`~object.__slots__`, descriptors, " +"properties, :meth:`~object.__getattribute__`, class methods, and static " +"methods." msgstr "" "一個舊名,它是指現在所有的 class 物件所使用的 class 風格。在早期的 Python 版" -"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像是 :attr:`~object." -"__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." -"__getattribute__`、class method(類別方法)和 static method(靜態方法)。" +"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像" +"是 :attr:`~object.__slots__`、描述器 (descriptor)、屬性 " +"(property)、:meth:`~object.__getattribute__`、class method(類別方法)和 " +"static method(靜態方法)。" -#: ../../glossary.rst:949 +#: ../../glossary.rst:960 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:951 +#: ../../glossary.rst:962 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." msgstr "" -"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" -"`new-style class`\\ (新式類別)的最終 base class(基底類別)。" +"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任" +"何 :term:`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:954 +#: ../../glossary.rst:965 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:956 +#: ../../glossary.rst:967 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2197,11 +2238,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:963 +#: ../../glossary.rst:974 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:965 +#: ../../glossary.rst:976 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2211,17 +2252,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:969 +#: ../../glossary.rst:980 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:970 +#: ../../glossary.rst:981 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:972 +#: ../../glossary.rst:983 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2231,7 +2272,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:976 +#: ../../glossary.rst:987 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2242,11 +2283,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:981 +#: ../../glossary.rst:992 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:985 +#: ../../glossary.rst:996 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2257,11 +2298,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:990 +#: ../../glossary.rst:1001 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:994 +#: ../../glossary.rst:1005 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2274,11 +2315,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:1000 +#: ../../glossary.rst:1011 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:1002 +#: ../../glossary.rst:1013 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2290,11 +2331,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:1008 +#: ../../glossary.rst:1019 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:1010 +#: ../../glossary.rst:1021 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2305,29 +2346,29 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:1016 +#: ../../glossary.rst:1027 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:1019 +#: ../../glossary.rst:1030 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " -"the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:" -"`362`." +"the :class:`inspect.Parameter` class, the :ref:`function` section, " +"and :pep:`362`." msgstr "" "另請參閱術語表的 :term:`argument`\\ (引數)條目、常見問題中的\\ :ref:`引數和" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1023 +#: ../../glossary.rst:1034 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1025 +#: ../../glossary.rst:1036 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2335,33 +2376,33 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1038 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1029 +#: ../../glossary.rst:1040 msgid "" -"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" -"term:`path entry hook`) which knows how to locate modules given a :term:" -"`path entry`." +"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. " +"a :term:`path entry hook`) which knows how to locate modules given " +"a :term:`path entry`." msgstr "" -"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一個 :term:" -"`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" -"`path entry`\\ 定位模組。" +"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一" +"個 :term:`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一" +"個 :term:`path entry`\\ 定位模組。" -#: ../../glossary.rst:1033 +#: ../../glossary.rst:1044 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." msgstr "" -"關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." -"PathEntryFinder`。" +"關於路徑項目尋檢器實作的 method,請參" +"閱 :class:`importlib.abc.PathEntryFinder`。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1046 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1037 +#: ../../glossary.rst:1048 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2371,11 +2412,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1040 +#: ../../glossary.rst:1051 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1042 +#: ../../glossary.rst:1053 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2383,33 +2424,33 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1044 +#: ../../glossary.rst:1055 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1046 -msgid "" -"An object representing a file system path. A path-like object is either a :" -"class:`str` or :class:`bytes` object representing a path, or an object " -"implementing the :class:`os.PathLike` protocol. An object that supports the :" -"class:`os.PathLike` protocol can be converted to a :class:`str` or :class:" -"`bytes` file system path by calling the :func:`os.fspath` function; :func:" -"`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:" -"`str` or :class:`bytes` result instead, respectively. Introduced by :pep:" -"`519`." -msgstr "" -"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` 或 :" -"class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼叫 :" -"func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換為 :" -"class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` 及 :func:" -"`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" -"pep:`519` 引入。" - -#: ../../glossary.rst:1054 +#: ../../glossary.rst:1057 +msgid "" +"An object representing a file system path. A path-like object is either " +"a :class:`str` or :class:`bytes` object representing a path, or an object " +"implementing the :class:`os.PathLike` protocol. An object that supports " +"the :class:`os.PathLike` protocol can be converted to a :class:`str` " +"or :class:`bytes` file system path by calling the :func:`os.fspath` " +"function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to " +"guarantee a :class:`str` or :class:`bytes` result instead, respectively. " +"Introduced by :pep:`519`." +msgstr "" +"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` " +"或 :class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼" +"叫 :func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換" +"為 :class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` " +"及 :func:`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結" +"果。由 :pep:`519` 引入。" + +#: ../../glossary.rst:1065 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1067 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2420,7 +2461,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1062 +#: ../../glossary.rst:1073 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2432,15 +2473,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1068 +#: ../../glossary.rst:1079 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1069 +#: ../../glossary.rst:1080 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1071 +#: ../../glossary.rst:1082 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2448,15 +2489,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1073 +#: ../../glossary.rst:1084 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1076 +#: ../../glossary.rst:1087 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1078 +#: ../../glossary.rst:1089 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2472,7 +2513,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1098 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2481,7 +2522,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1091 +#: ../../glossary.rst:1102 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2490,19 +2531,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1094 +#: ../../glossary.rst:1105 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1096 +#: ../../glossary.rst:1107 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1097 +#: ../../glossary.rst:1108 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1099 +#: ../../glossary.rst:1110 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2511,11 +2552,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1102 +#: ../../glossary.rst:1113 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1104 +#: ../../glossary.rst:1115 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2525,11 +2566,11 @@ msgid "" "Python sometimes use a numerical counter instead::" msgstr "" "一個想法或一段程式碼,它應用了 Python 語言最常見的慣用語,而不是使用其他語言" -"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一個 :" -"keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" -"這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" +"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一" +"個 :keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並" +"沒有這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1111 +#: ../../glossary.rst:1122 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2537,11 +2578,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1114 +#: ../../glossary.rst:1125 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1116 +#: ../../glossary.rst:1127 msgid "" "for piece in food:\n" " print(piece)" @@ -2549,11 +2590,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1118 +#: ../../glossary.rst:1129 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1120 +#: ../../glossary.rst:1131 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2564,7 +2605,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1125 +#: ../../glossary.rst:1136 msgid "" ">>> class C:\n" "... class D:\n" @@ -2590,16 +2631,16 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1137 +#: ../../glossary.rst:1148 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " -"dotted path to the module, including any parent packages, e.g. ``email.mime." -"text``::" +"dotted path to the module, including any parent packages, e.g. " +"``email.mime.text``::" msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1141 +#: ../../glossary.rst:1152 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2609,11 +2650,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1144 +#: ../../glossary.rst:1155 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1146 +#: ../../glossary.rst:1157 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2626,42 +2667,42 @@ msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " "(deallocated)。有些物件是「\\ :term:`不滅的 ` (immortal)」並擁有不" "會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" -"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" -"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼" +"叫 :func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1154 +#: ../../glossary.rst:1165 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1167 msgid "" -"A traditional :term:`package`, such as a directory containing an ``__init__." -"py`` file." +"A traditional :term:`package`, such as a directory containing an " +"``__init__.py`` file." msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1159 +#: ../../glossary.rst:1170 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1160 +#: ../../glossary.rst:1171 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1162 +#: ../../glossary.rst:1173 msgid "" -"An acronym for the \"read–eval–print loop\", another name for the :term:" -"`interactive` interpreter shell." +"An acronym for the \"read–eval–print loop\", another name for " +"the :term:`interactive` interpreter shell." msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1164 +#: ../../glossary.rst:1175 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1166 +#: ../../glossary.rst:1177 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2674,66 +2715,66 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1171 +#: ../../glossary.rst:1182 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1173 +#: ../../glossary.rst:1184 msgid "" "An :term:`iterable` which supports efficient element access using integer " -"indices via the :meth:`~object.__getitem__` special method and defines a :" -"meth:`~object.__len__` method that returns the length of the sequence. Some " -"built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " -"and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." -"__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " -"sequence because the lookups use arbitrary :term:`hashable` keys rather than " -"integers." +"indices via the :meth:`~object.__getitem__` special method and defines " +"a :meth:`~object.__len__` method that returns the length of the sequence. " +"Some built-in sequence types " +"are :class:`list`, :class:`str`, :class:`tuple`, and :class:`bytes`. Note " +"that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!" +"__len__`, but is considered a mapping rather than a sequence because the " +"lookups use arbitrary :term:`hashable` keys rather than integers." msgstr "" "一個 :term:`iterable`\\ (可疊代物件),它透過 :meth:`~object.__getitem__` " "special method(特殊方法),使用整數索引來支援高效率的元素存取,並定義了一" -"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包括 :" -"class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖然 :" -"class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它被視" -"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," -"而不是整數。" +"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包" +"括 :class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖" +"然 :class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它" +"被視為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` " +"鍵,而不是整數。" -#: ../../glossary.rst:1182 +#: ../../glossary.rst:1193 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " -"richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" -"`~object.__len__`, adding :meth:`!count`, :meth:`!index`, :meth:`~object." -"__contains__`, and :meth:`~object.__reversed__`. Types that implement this " -"expanded interface can be registered explicitly using :func:`~abc.ABCMeta." -"register`. For more documentation on sequence methods generally, see :ref:" -"`Common Sequence Operations `." +"richer interface that goes beyond just :meth:`~object.__getitem__` " +"and :meth:`~object.__len__`, adding :meth:`!count`, :meth:`!" +"index`, :meth:`~object.__contains__`, and :meth:`~object.__reversed__`. " +"Types that implement this expanded interface can be registered explicitly " +"using :func:`~abc.ABCMeta.register`. For more documentation on sequence " +"methods generally, see :ref:`Common Sequence Operations `." msgstr "" "抽象基底類別 (abstract base class) :class:`collections.abc.Sequence` 定義了一" -"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` 和 :meth:`~object." -"__len__`,還增加了 :meth:`!count`、:meth:`!index`、:meth:`~object." -"__contains__` 和 :meth:`~object.__reversed__`。實作此擴充介面的型別,可以使" -"用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" -"\\ :ref:`常見序列操作 `。" +"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` " +"和 :meth:`~object.__len__`,還增加了 :meth:`!count`、:meth:`!" +"index`、:meth:`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此" +"擴充介面的型別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於" +"序列方法的文件,請見\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1191 +#: ../../glossary.rst:1202 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1193 +#: ../../glossary.rst:1204 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " -"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. See :ref:" -"`comprehensions`." +"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. " +"See :ref:`comprehensions`." msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個 " "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1197 +#: ../../glossary.rst:1208 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1199 +#: ../../glossary.rst:1210 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2741,11 +2782,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1201 +#: ../../glossary.rst:1212 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1203 +#: ../../glossary.rst:1214 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2757,11 +2798,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1207 +#: ../../glossary.rst:1218 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1209 +#: ../../glossary.rst:1220 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2770,13 +2811,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1213 +#: ../../glossary.rst:1224 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1216 +#: ../../glossary.rst:1227 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -2784,65 +2825,65 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1218 +#: ../../glossary.rst:1229 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1222 +#: ../../glossary.rst:1233 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " -"with double underscores. Special methods are documented in :ref:" -"`specialnames`." +"with double underscores. Special methods are documented " +"in :ref:`specialnames`." msgstr "" "一種會被 Python 自動呼叫的 method,用於對某種型別執行某種運算,例如加法。這" -"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" -"`specialnames`\\ 中有詳細說明。" +"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在" +"\\ :ref:`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1226 +#: ../../glossary.rst:1237 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1228 +#: ../../glossary.rst:1239 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " -"an :term:`expression` or one of several constructs with a keyword, such as :" -"keyword:`if`, :keyword:`while` or :keyword:`for`." +"an :term:`expression` or one of several constructs with a keyword, such " +"as :keyword:`if`, :keyword:`while` or :keyword:`for`." msgstr "" -"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一個 :" -"term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" -"`while` 或 :keyword:`for`\\ )的多種結構之一。" +"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一" +"個 :term:`expression`\\ (運算式),或是含有關鍵字(例" +"如 :keyword:`if`、:keyword:`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1231 +#: ../../glossary.rst:1242 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1233 +#: ../../glossary.rst:1244 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " -"such as incorrect types. See also :term:`type hints ` and the :" -"mod:`typing` module." +"such as incorrect types. See also :term:`type hints ` and " +"the :mod:`typing` module." msgstr "" "會讀取 Python 程式碼並分析的外部工具,能夠找出錯誤,像是使用了不正確的型別。" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1236 +#: ../../glossary.rst:1247 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1238 +#: ../../glossary.rst:1249 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " -"calling :c:func:`Py_INCREF` when the reference is created and released with :" -"c:func:`Py_DECREF` when the reference is deleted." +"calling :c:func:`Py_INCREF` when the reference is created and released " +"with :c:func:`Py_DECREF` when the reference is deleted." msgstr "" "在 Python 的 C API 中,強參照是對物件的參照,該物件為持有該參照的程式碼所擁" -"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" -"func:`Py_DECREF` 釋放強參照。" +"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透" +"過 :c:func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1244 +#: ../../glossary.rst:1255 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2852,15 +2893,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1260 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1250 +#: ../../glossary.rst:1261 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1252 +#: ../../glossary.rst:1263 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2869,7 +2910,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1256 +#: ../../glossary.rst:1267 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2877,7 +2918,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1259 +#: ../../glossary.rst:1270 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2885,37 +2926,56 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1262 +#: ../../glossary.rst:1273 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1264 +#: ../../glossary.rst:1275 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " -"text file actually accesses a byte-oriented datastream and handles the :term:" -"`text encoding` automatically. Examples of text files are files opened in " -"text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and " -"instances of :class:`io.StringIO`." +"text file actually accesses a byte-oriented datastream and handles " +"the :term:`text encoding` automatically. Examples of text files are files " +"opened in text mode (``'r'`` or " +"``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances " +"of :class:`io.StringIO`." msgstr "" "一個能夠讀取和寫入 :class:`str` 物件的一個 :term:`file object`\\ (檔案物" "件)。通常,文字檔案實際上是存取位元組導向的資料流 (byte-oriented " "datastream) 並會自動處理 :term:`text encoding`\\ (文字編碼)。文字檔案的例子" -"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" -"`sys.stdout` 以及 :class:`io.StringIO` 的實例。" +"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔" +"案、:data:`sys.stdin`、:data:`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1271 +#: ../../glossary.rst:1282 msgid "" -"See also :term:`binary file` for a file object able to read and write :term:" -"`bytes-like objects `." +"See also :term:`binary file` for a file object able to read and " +"write :term:`bytes-like objects `." msgstr "" -"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" -"term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" +"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入" +"\\ :term:`類位元組串物件 (bytes-like object) ` 的檔案物" +"件。" -#: ../../glossary.rst:1273 +#: ../../glossary.rst:1284 +msgid "token" +msgstr "" + +#: ../../glossary.rst:1287 +msgid "" +"A small unit of source code, generated by the :ref:`lexical analyzer " +"` (also called the *tokenizer*). Names, numbers, strings, " +"operators, newlines and similar are represented by tokens." +msgstr "" + +#: ../../glossary.rst:1292 +msgid "" +"The :mod:`tokenize` module exposes Python's lexical analyzer. " +"The :mod:`token` module contains information on the various types of tokens." +msgstr "" + +#: ../../glossary.rst:1295 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1297 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2930,36 +2990,37 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1282 +#: ../../glossary.rst:1304 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1284 +#: ../../glossary.rst:1306 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as its :attr:`~object." -"__class__` attribute or can be retrieved with ``type(obj)``." +"object has a type. An object's type is accessible as " +"its :attr:`~object.__class__` attribute or can be retrieved with " +"``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1288 +#: ../../glossary.rst:1310 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1312 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1292 +#: ../../glossary.rst:1314 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1295 +#: ../../glossary.rst:1317 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2969,11 +3030,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1299 +#: ../../glossary.rst:1321 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1301 +#: ../../glossary.rst:1323 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -2985,15 +3046,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1306 ../../glossary.rst:1320 +#: ../../glossary.rst:1328 ../../glossary.rst:1342 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1307 +#: ../../glossary.rst:1329 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1309 +#: ../../glossary.rst:1331 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -3001,7 +3062,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1312 +#: ../../glossary.rst:1334 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -3011,45 +3072,45 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1316 +#: ../../glossary.rst:1338 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." msgstr "" -"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" -"`typing.get_type_hints` 來存取。" +"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使" +"用 :func:`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1321 +#: ../../glossary.rst:1343 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1323 +#: ../../glossary.rst:1345 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " "Windows convention ``'\\r\\n'``, and the old Macintosh convention " -"``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes." -"splitlines` for an additional use." +"``'\\r'``. See :pep:`278` and :pep:`3116`, as well " +"as :func:`bytes.splitlines` for an additional use." msgstr "" "一種解譯文字流 (text stream) 的方式,會將以下所有的情況識別為一行的結束:" "Unix 行尾慣例 ``'\\n'``、Windows 慣例 ``'\\r\\n'`` 和舊的 Macintosh 慣例 " -"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." -"splitlines` 的附加用途。" +"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用" +"於 :func:`bytes.splitlines` 的附加用途。" -#: ../../glossary.rst:1328 +#: ../../glossary.rst:1350 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1330 +#: ../../glossary.rst:1352 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1332 +#: ../../glossary.rst:1354 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1334 +#: ../../glossary.rst:1356 msgid "" "class C:\n" " field: 'annotation'" @@ -3057,7 +3118,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1337 +#: ../../glossary.rst:1359 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -3065,15 +3126,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1341 +#: ../../glossary.rst:1363 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1343 +#: ../../glossary.rst:1365 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1345 +#: ../../glossary.rst:1367 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3082,11 +3143,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1349 +#: ../../glossary.rst:1371 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1351 +#: ../../glossary.rst:1373 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3097,27 +3158,27 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1356 +#: ../../glossary.rst:1378 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1357 +#: ../../glossary.rst:1379 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1359 +#: ../../glossary.rst:1381 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." msgstr "" -"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" -"`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" +"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行" +"由 :term:`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1361 +#: ../../glossary.rst:1383 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1363 +#: ../../glossary.rst:1385 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3134,22 +3195,22 @@ msgstr "C-contiguous(C 連續的)" msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:825 +#: ../../glossary.rst:831 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1220 +#: ../../glossary.rst:1231 msgid "special" msgstr "special" #~ msgid "" #~ "An object which controls the environment seen in a :keyword:`with` " -#~ "statement by defining :meth:`~object.__enter__` and :meth:`~object." -#~ "__exit__` methods. See :pep:`343`." +#~ "statement by defining :meth:`~object.__enter__` " +#~ "and :meth:`~object.__exit__` methods. See :pep:`343`." #~ msgstr "" -#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" -#~ "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :" -#~ "pep:`343`。" +#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定" +#~ "義 :meth:`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。" +#~ "請參閱 :pep:`343`。" #~ msgid "" #~ "A variable which can have different values depending on its context. This " diff --git a/howto/argparse-optparse.po b/howto/argparse-optparse.po index 39f928c87d..62fdf4ecdd 100644 --- a/howto/argparse-optparse.po +++ b/howto/argparse-optparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,103 +16,151 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../howto/argparse-optparse.rst:7 -msgid "Upgrading optparse code" -msgstr "升級 optparse 程式碼" +#: ../../howto/argparse-optparse.rst:8 +msgid "Migrating ``optparse`` code to ``argparse``" +msgstr "將 ``optparse`` 程式碼遷移到 ``argparse``" -#: ../../howto/argparse-optparse.rst:9 +#: ../../howto/argparse-optparse.rst:10 msgid "" -"Originally, the :mod:`argparse` module had attempted to maintain " -"compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " -"to extend transparently, particularly with the changes required to support " -"``nargs=`` specifiers and better usage messages. When most everything in :" -"mod:`optparse` had either been copy-pasted over or monkey-patched, it no " -"longer seemed practical to try to maintain the backwards compatibility." +"The :mod:`argparse` module offers several higher level features not natively " +"provided by the :mod:`optparse` module, including:" msgstr "" +":mod:`argparse` 模組提供了一些高階功能,這些功能在 :mod:`optparse` 模組中並未" +"原生提供,包括:" -#: ../../howto/argparse-optparse.rst:16 -msgid "" -"The :mod:`argparse` module improves on the :mod:`optparse` module in a " -"number of ways including:" -msgstr "" - -#: ../../howto/argparse-optparse.rst:19 +#: ../../howto/argparse-optparse.rst:13 msgid "Handling positional arguments." -msgstr "" +msgstr "處理位置引數。" -#: ../../howto/argparse-optparse.rst:20 +#: ../../howto/argparse-optparse.rst:14 msgid "Supporting subcommands." -msgstr "" +msgstr "支援子命令。" -#: ../../howto/argparse-optparse.rst:21 +#: ../../howto/argparse-optparse.rst:15 msgid "Allowing alternative option prefixes like ``+`` and ``/``." -msgstr "" +msgstr "允許替代選項前綴,如 ``+`` 和 ``/``。" -#: ../../howto/argparse-optparse.rst:22 +#: ../../howto/argparse-optparse.rst:16 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" +"處理零或多個 (zero-or-more) 和一個或多個 (and one-or-more) 樣式的引數。" -#: ../../howto/argparse-optparse.rst:23 +#: ../../howto/argparse-optparse.rst:17 msgid "Producing more informative usage messages." -msgstr "" +msgstr "產生更多資訊的使用訊息。" -#: ../../howto/argparse-optparse.rst:24 +#: ../../howto/argparse-optparse.rst:18 msgid "Providing a much simpler interface for custom ``type`` and ``action``." +msgstr "為自訂 ``type`` 和 ``action`` 提供了一個更簡單的介面。" + +#: ../../howto/argparse-optparse.rst:20 +msgid "" +"Originally, the :mod:`argparse` module attempted to maintain compatibility " +"with :mod:`optparse`. However, the fundamental design differences between " +"supporting declarative command line option processing (while leaving " +"positional argument processing to application code), and supporting both " +"named options and positional arguments in the declarative interface mean " +"that the API has diverged from that of ``optparse`` over time." +msgstr "" +"最初 :mod:`argparse` 模組試圖保持與 :mod:`optparse` 的相容性,但在基礎設計上" +"的存在差異 -- 支援宣告式 (declarative) 命令列選項處理 (同時將位置引數處理留給" +"應用程式的程式碼) 和在宣告式介面中支援命名選項 (named options) 和位置引數 -- " +"代表 API 隨著時間的推移已經與 ``optparse`` API 分歧。" + +#: ../../howto/argparse-optparse.rst:27 +msgid "" +"As described in :ref:`choosing-an-argument-parser`, applications that are " +"currently using :mod:`optparse` and are happy with the way it works can just " +"continue to use ``optparse``." +msgstr "" +"如 :ref:`choosing-an-argument-parser` 中所述,目前使用 :mod:`optparse` 並對其" +"運作方式滿意的應用程式可以繼續使用 ``optparse``。" + +#: ../../howto/argparse-optparse.rst:31 +msgid "" +"Application developers that are considering migrating should also review the " +"list of intrinsic behavioural differences described in that section before " +"deciding whether or not migration is desirable." msgstr "" +"在決定是否遷移之前,應用程式開發人員應該先檢閱該段落中描述的內在行為差異清" +"單,來決定是否值得遷移。" -#: ../../howto/argparse-optparse.rst:26 -msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" +#: ../../howto/argparse-optparse.rst:35 +msgid "" +"For applications that do choose to migrate from :mod:`optparse` to :mod:" +"`argparse`, the following suggestions should be helpful:" msgstr "" +"對於選擇從 :mod:`optparse` 遷移到 :mod:`argparse` 的應用程式,以下建議應會有" +"所幫助:" -#: ../../howto/argparse-optparse.rst:28 +#: ../../howto/argparse-optparse.rst:38 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" +"將所有 :meth:`optparse.OptionParser.add_option` 呼叫替換為 :meth:" +"`ArgumentParser.add_argument` 呼叫。" -#: ../../howto/argparse-optparse.rst:31 +#: ../../howto/argparse-optparse.rst:41 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " "for the positional arguments. Keep in mind that what was previously called " "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" +"將 ``(options, args) = parser.parse_args()`` 替換為 ``args = parser." +"parse_args()``,並為位置引數新增額外的 :meth:`ArgumentParser.add_argument` 呼" +"叫。請記住,以前稱為 ``options`` 的東西,在 :mod:`argparse` 情境中現在稱為 " +"``args``。" -#: ../../howto/argparse-optparse.rst:36 +#: ../../howto/argparse-optparse.rst:46 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" +"使用 :meth:`~ArgumentParser.parse_intermixed_args` 來替換掉 :meth:`optparse." +"OptionParser.disable_interspersed_args`,而不是使用 :meth:`~ArgumentParser." +"parse_args`。" -#: ../../howto/argparse-optparse.rst:40 +#: ../../howto/argparse-optparse.rst:50 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" +"將回呼動作和 ``callback_*`` 關鍵字引數替換為 ``type`` 或 ``action`` 引數。" -#: ../../howto/argparse-optparse.rst:43 +#: ../../howto/argparse-optparse.rst:53 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" +"將 ``type`` 關鍵字引數的字串名稱替換為相應的類型物件 (例如 int、float、" +"complex 等)。" -#: ../../howto/argparse-optparse.rst:46 +#: ../../howto/argparse-optparse.rst:56 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" +"將 :class:`optparse.Values` 替換為 :class:`Namespace`,並將 :exc:`optparse." +"OptionError` 和 :exc:`optparse.OptionValueError` 替換為 :exc:" +"`ArgumentError`。" -#: ../../howto/argparse-optparse.rst:50 +#: ../../howto/argparse-optparse.rst:60 msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" +"將隱式引數的字串,如 ``%default`` 或 ``%prog`` 替換為使用字典來格式化字串的標" +"準 Python 語法,即 ``%(default)s`` 和 ``%(prog)s``。" -#: ../../howto/argparse-optparse.rst:54 +#: ../../howto/argparse-optparse.rst:64 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='version', version='')``." msgstr "" +"將 OptionParser 建構函式的 ``version`` 引數替換為呼叫 ``parser." +"add_argument('--version', action='version', version='')``。" diff --git a/howto/argparse.po b/howto/argparse.po index c71d110388..323727fd39 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-18 00:14+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2023-12-11 17:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,27 +46,36 @@ msgstr "" #: ../../howto/argparse.rst:16 msgid "" -"There are two other modules that fulfill the same task, namely :mod:`getopt` " -"(an equivalent for ``getopt()`` from the C language) and the deprecated :mod:" -"`optparse`. Note also that :mod:`argparse` is based on :mod:`optparse`, and " -"therefore very similar in terms of usage." -msgstr "" -"另外還有兩個模組可以完成相同的任務,即 :mod:`getopt`\\ (相當於 C 語言中的 " -"``getopt()``)和已棄用的 :mod:`optparse`。另請注意,:mod:`argparse` 是基於 :" -"mod:`optparse` 的,因此在用法上非常相似。" +"The standard library includes two other libraries directly related to " +"command-line parameter processing: the lower level :mod:`optparse` module " +"(which may require more code to configure for a given application, but also " +"allows an application to request behaviors that ``argparse`` doesn't " +"support), and the very low level :mod:`getopt` (which specifically serves as " +"an equivalent to the :c:func:`!getopt` family of functions available to C " +"programmers). While neither of those modules is covered directly in this " +"guide, many of the core concepts in ``argparse`` first originated in " +"``optparse``, so some aspects of this tutorial will also be relevant to " +"``optparse`` users." +msgstr "" +"標準函式庫包含另外兩個與命令列參數處理直接相關的函式庫:較低階的 :mod:" +"`optparse` 模組(可能需要更多程式碼來為給定應用程式設定,但也允許應用程式要" +"求 ``argparse`` 不支援的行為),以及非常低階的 :mod:`getopt`\\ (專門用作 C " +"程式設計師可用的 :c:func:`!getopt` 函式系列的等價)。雖然這個指南並未直接涵蓋" +"這些模組,但 ``argparse`` 的許多核心概念最初來自於 ``optparse``,因此本教學的" +"某些部分也適用於 ``optparse`` 使用者。" -#: ../../howto/argparse.rst:24 +#: ../../howto/argparse.rst:29 msgid "Concepts" msgstr "概念" -#: ../../howto/argparse.rst:26 +#: ../../howto/argparse.rst:31 msgid "" "Let's show the sort of functionality that we are going to explore in this " "introductory tutorial by making use of the :command:`ls` command:" msgstr "" "讓我們透過使用 :command:`ls` 指令來展示我們將在本介紹教學中探索的功能類型:" -#: ../../howto/argparse.rst:29 +#: ../../howto/argparse.rst:34 msgid "" "$ ls\n" "cpython devguide prog.py pypy rm-unused-function.patch\n" @@ -102,11 +111,11 @@ msgstr "" "Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n" "..." -#: ../../howto/argparse.rst:48 +#: ../../howto/argparse.rst:53 msgid "A few concepts we can learn from the four commands:" msgstr "我們可以從這四個命令中學到一些概念:" -#: ../../howto/argparse.rst:50 +#: ../../howto/argparse.rst:55 msgid "" "The :command:`ls` command is useful when run without any options at all. It " "defaults to displaying the contents of the current directory." @@ -114,7 +123,7 @@ msgstr "" ":command:`ls` 命令即便在沒有任何選項的情況下執行仍非常有用。它預設顯示目前目" "錄的內容。" -#: ../../howto/argparse.rst:53 +#: ../../howto/argparse.rst:58 msgid "" "If we want beyond what it provides by default, we tell it a bit more. In " "this case, we want it to display a different directory, ``pypy``. What we " @@ -131,7 +140,7 @@ msgstr "" "command:`cp` 這樣的指令更相關,其最基本的用法是 ``cp SRC DEST``。第一個是\\ *" "你想要複製的位置*,第二個是\\ *你想要複製過去的位置*。" -#: ../../howto/argparse.rst:62 +#: ../../howto/argparse.rst:67 msgid "" "Now, say we want to change behaviour of the program. In our example, we " "display more info for each file instead of just showing the file names. The " @@ -140,7 +149,7 @@ msgstr "" "現在假設我們想要改變程式的行為。在我們的範例中,我們顯示每個檔案的更多資訊," "而不僅是顯示檔案名稱。在這種情況下,``-l`` 被稱為可選引數。" -#: ../../howto/argparse.rst:66 +#: ../../howto/argparse.rst:71 msgid "" "That's a snippet of the help text. It's very useful in that you can come " "across a program you have never used before, and can figure out how it works " @@ -149,15 +158,15 @@ msgstr "" "這是幫助文字的片段。它非常有用,因為當你遇到以前從未使用過的程式時,只需閱讀" "其幫助文字即可了解它的工作原理。" -#: ../../howto/argparse.rst:72 +#: ../../howto/argparse.rst:77 msgid "The basics" msgstr "基本用法" -#: ../../howto/argparse.rst:74 +#: ../../howto/argparse.rst:79 msgid "Let us start with a very simple example which does (almost) nothing::" msgstr "讓我們從一個非常簡單的例子開始,它(幾乎)什麼都不做: ::" -#: ../../howto/argparse.rst:76 +#: ../../howto/argparse.rst:81 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -167,12 +176,12 @@ msgstr "" "parser = argparse.ArgumentParser()\n" "parser.parse_args()" -#: ../../howto/argparse.rst:80 ../../howto/argparse.rst:188 -#: ../../howto/argparse.rst:209 +#: ../../howto/argparse.rst:85 ../../howto/argparse.rst:193 +#: ../../howto/argparse.rst:214 msgid "Following is a result of running the code:" msgstr "程式碼執行結果如下:" -#: ../../howto/argparse.rst:82 +#: ../../howto/argparse.rst:87 msgid "" "$ python prog.py\n" "$ python prog.py --help\n" @@ -200,18 +209,18 @@ msgstr "" "usage: prog.py [-h]\n" "prog.py: error: unrecognized arguments: foo" -#: ../../howto/argparse.rst:97 ../../howto/argparse.rst:254 -#: ../../howto/argparse.rst:298 +#: ../../howto/argparse.rst:102 ../../howto/argparse.rst:259 +#: ../../howto/argparse.rst:303 msgid "Here is what is happening:" msgstr "這是發生的事情:" -#: ../../howto/argparse.rst:99 +#: ../../howto/argparse.rst:104 msgid "" "Running the script without any options results in nothing displayed to " "stdout. Not so useful." msgstr "執行不帶任何選項的腳本不會在標準輸出中顯示任何內容。不太有用。" -#: ../../howto/argparse.rst:102 +#: ../../howto/argparse.rst:107 msgid "" "The second one starts to display the usefulness of the :mod:`argparse` " "module. We have done almost nothing, but already we get a nice help message." @@ -219,7 +228,7 @@ msgstr "" "第二個開始能夠顯現 :mod:`argparse` 模組的有用之處。我們幾乎什麼也沒做,但我們" "已經收到了一個很好的幫助訊息。" -#: ../../howto/argparse.rst:105 +#: ../../howto/argparse.rst:110 msgid "" "The ``--help`` option, which can also be shortened to ``-h``, is the only " "option we get for free (i.e. no need to specify it). Specifying anything " @@ -230,15 +239,15 @@ msgstr "" "它)。指定任何其他內容都會導致錯誤。但即便如此,我們也還是輕鬆地獲得了有用的" "使用資訊。" -#: ../../howto/argparse.rst:112 +#: ../../howto/argparse.rst:117 msgid "Introducing Positional arguments" msgstr "位置引數的介紹" -#: ../../howto/argparse.rst:114 +#: ../../howto/argparse.rst:119 msgid "An example::" msgstr "例如: ::" -#: ../../howto/argparse.rst:116 +#: ../../howto/argparse.rst:121 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -252,11 +261,11 @@ msgstr "" "args = parser.parse_args()\n" "print(args.echo)" -#: ../../howto/argparse.rst:122 +#: ../../howto/argparse.rst:127 msgid "And running the code:" msgstr "執行這段程式碼:" -#: ../../howto/argparse.rst:124 +#: ../../howto/argparse.rst:129 msgid "" "$ python prog.py\n" "usage: prog.py [-h] echo\n" @@ -286,11 +295,11 @@ msgstr "" "$ python prog.py foo\n" "foo" -#: ../../howto/argparse.rst:140 +#: ../../howto/argparse.rst:145 msgid "Here is what's happening:" msgstr "這是會發生的事情:" -#: ../../howto/argparse.rst:142 +#: ../../howto/argparse.rst:147 msgid "" "We've added the :meth:`~ArgumentParser.add_argument` method, which is what " "we use to specify which command-line options the program is willing to " @@ -300,11 +309,11 @@ msgstr "" "我們新增了 :meth:`~ArgumentParser.add_argument` 方法,我們用它來指定程式願意" "接受哪些命令列選項。在本例中,我將其命名為 ``echo``,以便與其功能一致。" -#: ../../howto/argparse.rst:146 +#: ../../howto/argparse.rst:151 msgid "Calling our program now requires us to specify an option." msgstr "現在呼叫我們的程式時需要指定一個選項。" -#: ../../howto/argparse.rst:148 +#: ../../howto/argparse.rst:153 msgid "" "The :meth:`~ArgumentParser.parse_args` method actually returns some data " "from the options specified, in this case, ``echo``." @@ -312,7 +321,7 @@ msgstr "" ":meth:`~ArgumentParser.parse_args` 方法實際上從指定的選項中回傳一些資料,在本" "例中為 ``echo``。" -#: ../../howto/argparse.rst:151 +#: ../../howto/argparse.rst:156 msgid "" "The variable is some form of 'magic' that :mod:`argparse` performs for free " "(i.e. no need to specify which variable that value is stored in). You will " @@ -322,7 +331,7 @@ msgstr "" "該變數是某種形式的「魔法」,:mod:`argparse` 可以自由執行(即無需指定該值儲存" "在哪個變數中)。你還會注意到,它的名稱與提供給方法 ``echo`` 的字串引數相符。" -#: ../../howto/argparse.rst:156 +#: ../../howto/argparse.rst:161 msgid "" "Note however that, although the help display looks nice and all, it " "currently is not as helpful as it can be. For example we see that we got " @@ -334,7 +343,7 @@ msgstr "" "看到 ``echo`` 作為位置引數,但除了猜測或閱讀原始程式碼之外,我們不知道它的作" "用。那麼,我們來讓它變得更有用一點: ::" -#: ../../howto/argparse.rst:161 +#: ../../howto/argparse.rst:166 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -348,11 +357,11 @@ msgstr "" "args = parser.parse_args()\n" "print(args.echo)" -#: ../../howto/argparse.rst:167 +#: ../../howto/argparse.rst:172 msgid "And we get:" msgstr "然後我們得到:" -#: ../../howto/argparse.rst:169 +#: ../../howto/argparse.rst:174 msgid "" "$ python prog.py -h\n" "usage: prog.py [-h] echo\n" @@ -372,11 +381,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../howto/argparse.rst:180 +#: ../../howto/argparse.rst:185 msgid "Now, how about doing something even more useful::" msgstr "現在來做一些更有用處的事情: ::" -#: ../../howto/argparse.rst:182 +#: ../../howto/argparse.rst:187 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -392,7 +401,7 @@ msgstr "" "args = parser.parse_args()\n" "print(args.square**2)" -#: ../../howto/argparse.rst:190 +#: ../../howto/argparse.rst:195 msgid "" "$ python prog.py 4\n" "Traceback (most recent call last):\n" @@ -406,7 +415,7 @@ msgstr "" " print(args.square**2)\n" "TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'" -#: ../../howto/argparse.rst:198 +#: ../../howto/argparse.rst:203 msgid "" "That didn't go so well. That's because :mod:`argparse` treats the options we " "give it as strings, unless we tell it otherwise. So, let's tell :mod:" @@ -415,7 +424,7 @@ msgstr "" "進展不太順利。這是因為,除非我們另有說明,:mod:`argparse` 會將我們給它的選項" "視為字串。因此,讓我們告訴 :mod:`argparse` 將該輸入視為整數: ::" -#: ../../howto/argparse.rst:202 +#: ../../howto/argparse.rst:207 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -433,7 +442,7 @@ msgstr "" "args = parser.parse_args()\n" "print(args.square**2)" -#: ../../howto/argparse.rst:211 +#: ../../howto/argparse.rst:216 msgid "" "$ python prog.py 4\n" "16\n" @@ -447,23 +456,23 @@ msgstr "" "usage: prog.py [-h] square\n" "prog.py: error: argument square: invalid int value: 'four'" -#: ../../howto/argparse.rst:219 +#: ../../howto/argparse.rst:224 msgid "" "That went well. The program now even helpfully quits on bad illegal input " "before proceeding." msgstr "順利進展。現在該程式甚至可以在繼續操作之前因錯誤的非法輸入而退出。" -#: ../../howto/argparse.rst:224 +#: ../../howto/argparse.rst:229 msgid "Introducing Optional arguments" msgstr "可選引數的介紹" -#: ../../howto/argparse.rst:226 +#: ../../howto/argparse.rst:231 msgid "" "So far we have been playing with positional arguments. Let us have a look on " "how to add optional ones::" msgstr "到目前為止,我們一直在討論位置引數。我們來看看如何新增可選引數: ::" -#: ../../howto/argparse.rst:229 +#: ../../howto/argparse.rst:234 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -479,12 +488,12 @@ msgstr "" "if args.verbosity:\n" " print(\"verbosity turned on\")" -#: ../../howto/argparse.rst:236 ../../howto/argparse.rst:282 -#: ../../howto/argparse.rst:398 ../../howto/argparse.rst:432 +#: ../../howto/argparse.rst:241 ../../howto/argparse.rst:287 +#: ../../howto/argparse.rst:403 ../../howto/argparse.rst:437 msgid "And the output:" msgstr "接者是結果:" -#: ../../howto/argparse.rst:238 +#: ../../howto/argparse.rst:243 msgid "" "$ python prog.py --verbosity 1\n" "verbosity turned on\n" @@ -514,7 +523,7 @@ msgstr "" "usage: prog.py [-h] [--verbosity VERBOSITY]\n" "prog.py: error: argument --verbosity: expected one argument" -#: ../../howto/argparse.rst:256 +#: ../../howto/argparse.rst:261 msgid "" "The program is written so as to display something when ``--verbosity`` is " "specified and display nothing when not." @@ -522,7 +531,7 @@ msgstr "" "程式被編寫為在指定 ``--verbosity`` 時顯示一些內容,並在未指定時不顯示任何內" "容。" -#: ../../howto/argparse.rst:259 +#: ../../howto/argparse.rst:264 msgid "" "To show that the option is actually optional, there is no error when running " "the program without it. Note that by default, if an optional argument isn't " @@ -534,17 +543,17 @@ msgstr "" "情況下,如果未使用可選引數,則相關變數(在本例中為 ``args.verbosity``)將被賦" "予 ``None`` 作為值,這就是它未能通過 :keyword:`if` 陳述式真值測試的原因。" -#: ../../howto/argparse.rst:265 +#: ../../howto/argparse.rst:270 msgid "The help message is a bit different." msgstr "幫助訊息有點不同。" -#: ../../howto/argparse.rst:267 +#: ../../howto/argparse.rst:272 msgid "" "When using the ``--verbosity`` option, one must also specify some value, any " "value." msgstr "當使用 ``--verbosity`` 選項時必須要指定一些值,任何值都可以。" -#: ../../howto/argparse.rst:270 +#: ../../howto/argparse.rst:275 msgid "" "The above example accepts arbitrary integer values for ``--verbosity``, but " "for our simple program, only two values are actually useful, ``True`` or " @@ -553,7 +562,7 @@ msgstr "" "在上面的例子中,``--verbosity`` 接受任意的整數,但對我們的程式來說只接受兩個" "輸入值, ``True`` 或 ``False``。所以我們來修改一下程式碼使其符合: ::" -#: ../../howto/argparse.rst:274 +#: ../../howto/argparse.rst:279 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -571,7 +580,7 @@ msgstr "" "if args.verbose:\n" " print(\"verbosity turned on\")" -#: ../../howto/argparse.rst:284 +#: ../../howto/argparse.rst:289 msgid "" "$ python prog.py --verbose\n" "verbosity turned on\n" @@ -597,7 +606,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --verbose increase output verbosity" -#: ../../howto/argparse.rst:300 +#: ../../howto/argparse.rst:305 msgid "" "The option is now more of a flag than something that requires a value. We " "even changed the name of the option to match that idea. Note that we now " @@ -610,21 +619,21 @@ msgstr "" "``\"store_true\"``。這意味著,如果指定了該選項,則將值 ``True`` 指派給 " "``args.verbose``。不指定它代表為 ``False``。" -#: ../../howto/argparse.rst:307 +#: ../../howto/argparse.rst:312 msgid "" "It complains when you specify a value, in true spirit of what flags actually " "are." msgstr "當你指定一個值時,它會本著旗標的實際精神來抱怨。" -#: ../../howto/argparse.rst:310 +#: ../../howto/argparse.rst:315 msgid "Notice the different help text." msgstr "請注意不同的幫助文字。" -#: ../../howto/argparse.rst:314 +#: ../../howto/argparse.rst:319 msgid "Short options" msgstr "短選項" -#: ../../howto/argparse.rst:316 +#: ../../howto/argparse.rst:321 msgid "" "If you are familiar with command line usage, you will notice that I haven't " "yet touched on the topic of short versions of the options. It's quite " @@ -632,7 +641,7 @@ msgid "" msgstr "" "如果你熟悉命令列用法,你會注意到我尚未提及選項的簡短版本。這很簡單: ::" -#: ../../howto/argparse.rst:320 +#: ../../howto/argparse.rst:325 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -652,11 +661,11 @@ msgstr "" "if args.verbose:\n" " print(\"verbosity turned on\")" -#: ../../howto/argparse.rst:328 +#: ../../howto/argparse.rst:333 msgid "And here goes:" msgstr "而這為:" -#: ../../howto/argparse.rst:330 +#: ../../howto/argparse.rst:335 msgid "" "$ python prog.py -v\n" "verbosity turned on\n" @@ -676,19 +685,19 @@ msgstr "" " -h, --help show this help message and exit\n" " -v, --verbose increase output verbosity" -#: ../../howto/argparse.rst:341 +#: ../../howto/argparse.rst:346 msgid "Note that the new ability is also reflected in the help text." msgstr "請注意,新功能也反映在幫助文字中。" -#: ../../howto/argparse.rst:345 +#: ../../howto/argparse.rst:350 msgid "Combining Positional and Optional arguments" msgstr "組合位置引數和可選引數" -#: ../../howto/argparse.rst:347 +#: ../../howto/argparse.rst:352 msgid "Our program keeps growing in complexity::" msgstr "我們的程式的複雜性不斷增加: ::" -#: ../../howto/argparse.rst:349 +#: ../../howto/argparse.rst:354 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -716,11 +725,11 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:362 +#: ../../howto/argparse.rst:367 msgid "And now the output:" msgstr "然後現在的輸出結果:" -#: ../../howto/argparse.rst:364 +#: ../../howto/argparse.rst:369 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] square\n" @@ -742,15 +751,15 @@ msgstr "" "$ python prog.py --verbose 4\n" "the square of 4 equals 16" -#: ../../howto/argparse.rst:376 +#: ../../howto/argparse.rst:381 msgid "We've brought back a positional argument, hence the complaint." msgstr "我們帶回了位置引數,因而被抱怨。" -#: ../../howto/argparse.rst:378 +#: ../../howto/argparse.rst:383 msgid "Note that the order does not matter." msgstr "請注意,順序並不重要。" -#: ../../howto/argparse.rst:380 +#: ../../howto/argparse.rst:385 msgid "" "How about we give this program of ours back the ability to have multiple " "verbosity values, and actually get to use them::" @@ -758,7 +767,7 @@ msgstr "" "我們讓這個程式擁有多個訊息詳細級別 (verbosity) 之值的能力,並實際使用它" "們: ::" -#: ../../howto/argparse.rst:383 +#: ../../howto/argparse.rst:388 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -790,7 +799,7 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:400 +#: ../../howto/argparse.rst:405 msgid "" "$ python prog.py 4\n" "16\n" @@ -816,7 +825,7 @@ msgstr "" "$ python prog.py 4 -v 3\n" "16" -#: ../../howto/argparse.rst:414 +#: ../../howto/argparse.rst:419 msgid "" "These all look good except the last one, which exposes a bug in our program. " "Let's fix it by restricting the values the ``--verbosity`` option can " @@ -825,7 +834,7 @@ msgstr "" "除了最後一個外都看起來正常,它透露了我們程式中的一個錯誤。我們可透過限制 ``--" "verbosity`` 選項可以接受的值來修復它: ::" -#: ../../howto/argparse.rst:417 +#: ../../howto/argparse.rst:422 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -857,7 +866,7 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:434 +#: ../../howto/argparse.rst:439 msgid "" "$ python prog.py 4 -v 3\n" "usage: prog.py [-h] [-v {0,1,2}] square\n" @@ -889,13 +898,13 @@ msgstr "" " -v, --verbosity {0,1,2}\n" " increase output verbosity" -#: ../../howto/argparse.rst:450 +#: ../../howto/argparse.rst:455 msgid "" "Note that the change also reflects both in the error message as well as the " "help string." msgstr "請注意,更改也會反映在錯誤訊息和幫助字串中。" -#: ../../howto/argparse.rst:453 +#: ../../howto/argparse.rst:458 msgid "" "Now, let's use a different approach of playing with verbosity, which is " "pretty common. It also matches the way the CPython executable handles its " @@ -904,7 +913,7 @@ msgstr "" "現在,讓我們使用另一種常見方法來玩玩訊息詳細級別。它也與 CPython 執行檔處理其" "自身訊息詳細級別引數的方式相符(請見 ``python --help`` 的輸出): ::" -#: ../../howto/argparse.rst:457 +#: ../../howto/argparse.rst:462 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -936,13 +945,13 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:472 +#: ../../howto/argparse.rst:477 msgid "" "We have introduced another action, \"count\", to count the number of " "occurrences of specific options." msgstr "我們已經介紹過另一個操作 \"count\" 用來計算指定的選項出現的次數。" -#: ../../howto/argparse.rst:476 +#: ../../howto/argparse.rst:481 msgid "" "$ python prog.py 4\n" "16\n" @@ -990,7 +999,7 @@ msgstr "" "$ python prog.py 4 -vvv\n" "16" -#: ../../howto/argparse.rst:501 +#: ../../howto/argparse.rst:506 msgid "" "Yes, it's now more of a flag (similar to ``action=\"store_true\"``) in the " "previous version of our script. That should explain the complaint." @@ -998,29 +1007,29 @@ msgstr "" "是的,現在它更像是我們上一版腳本中的旗標(類似於 " "``action=\"store_true\"``),這應該可以解釋抱怨的原因。" -#: ../../howto/argparse.rst:504 +#: ../../howto/argparse.rst:509 msgid "It also behaves similar to \"store_true\" action." msgstr "它的行為也類似 \"store_true\" 操作。" -#: ../../howto/argparse.rst:506 +#: ../../howto/argparse.rst:511 msgid "" "Now here's a demonstration of what the \"count\" action gives. You've " "probably seen this sort of usage before." msgstr "現在這裡示範了 \"count\" 動作的作用。你可能以前見過這種用法。" -#: ../../howto/argparse.rst:509 +#: ../../howto/argparse.rst:514 msgid "" "And if you don't specify the ``-v`` flag, that flag is considered to have " "``None`` value." msgstr "如果你不指定 ``-v`` 旗標,則該旗標被視為具有 ``None`` 值。" -#: ../../howto/argparse.rst:512 +#: ../../howto/argparse.rst:517 msgid "" "As should be expected, specifying the long form of the flag, we should get " "the same output." msgstr "正如預期的那樣,指定長形式旗標,我們應該得到相同的輸出。" -#: ../../howto/argparse.rst:515 +#: ../../howto/argparse.rst:520 msgid "" "Sadly, our help output isn't very informative on the new ability our script " "has acquired, but that can always be fixed by improving the documentation " @@ -1029,15 +1038,15 @@ msgstr "" "遺憾的是,我們的幫助輸出對於我們腳本獲得的新功能並沒有提供太多資訊,但我們都" "可以透過改進腳本的文件來解決這個問題(例如:透過 ``help`` 關鍵字引數)。" -#: ../../howto/argparse.rst:519 +#: ../../howto/argparse.rst:524 msgid "That last output exposes a bug in our program." msgstr "最後的輸出透露了我們程式中的一個錯誤。" -#: ../../howto/argparse.rst:522 +#: ../../howto/argparse.rst:527 msgid "Let's fix::" msgstr "讓我們來解決問題: ::" -#: ../../howto/argparse.rst:524 +#: ../../howto/argparse.rst:529 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1073,11 +1082,11 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:541 +#: ../../howto/argparse.rst:546 msgid "And this is what it gives:" msgstr "這就是它給出的:" -#: ../../howto/argparse.rst:543 +#: ../../howto/argparse.rst:548 msgid "" "$ python prog.py 4 -vvv\n" "the square of 4 equals 16\n" @@ -1099,7 +1108,7 @@ msgstr "" " if args.verbosity >= 2:\n" "TypeError: '>=' not supported between instances of 'NoneType' and 'int'" -#: ../../howto/argparse.rst:556 +#: ../../howto/argparse.rst:561 msgid "" "First output went well, and fixes the bug we had before. That is, we want " "any value >= 2 to be as verbose as possible." @@ -1107,15 +1116,15 @@ msgstr "" "第一次輸出順利進行,並修復了我們之前遇到的錯誤。也就是說,我們希望任何 >= 2 " "的值都盡可能詳細。" -#: ../../howto/argparse.rst:559 +#: ../../howto/argparse.rst:564 msgid "Third output not so good." msgstr "第三個輸出不太好。" -#: ../../howto/argparse.rst:561 +#: ../../howto/argparse.rst:566 msgid "Let's fix that bug::" msgstr "我們來修復這個錯誤: ::" -#: ../../howto/argparse.rst:563 +#: ../../howto/argparse.rst:568 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1147,7 +1156,7 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:578 +#: ../../howto/argparse.rst:583 msgid "" "We've just introduced yet another keyword, ``default``. We've set it to " "``0`` in order to make it comparable to the other int values. Remember that " @@ -1159,11 +1168,11 @@ msgstr "" "int 值進行比較。請記住,預設情況下,如果未指定可選引數,它將獲得 ``None`` " "值,並且不能與 int 值進行比較(因此會出現 :exc:`TypeError` 例外)。" -#: ../../howto/argparse.rst:585 +#: ../../howto/argparse.rst:590 msgid "And:" msgstr "而且:" -#: ../../howto/argparse.rst:587 +#: ../../howto/argparse.rst:592 msgid "" "$ python prog.py 4\n" "16" @@ -1171,7 +1180,7 @@ msgstr "" "$ python prog.py 4\n" "16" -#: ../../howto/argparse.rst:592 +#: ../../howto/argparse.rst:597 msgid "" "You can go quite far just with what we've learned so far, and we have only " "scratched the surface. The :mod:`argparse` module is very powerful, and " @@ -1181,17 +1190,17 @@ msgstr "" "毛而已。:mod:`argparse` 模組非常強大,在結束本教學之前我們會對它進行更多探" "索。" -#: ../../howto/argparse.rst:599 +#: ../../howto/argparse.rst:604 msgid "Getting a little more advanced" msgstr "更進階一點" -#: ../../howto/argparse.rst:601 +#: ../../howto/argparse.rst:606 msgid "" "What if we wanted to expand our tiny program to perform other powers, not " "just squares::" msgstr "如果我們想擴充我們的小程式來執行其他次方的運算,而不僅是平方: ::" -#: ../../howto/argparse.rst:604 +#: ../../howto/argparse.rst:609 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1221,12 +1230,12 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:618 ../../howto/argparse.rst:656 -#: ../../howto/argparse.rst:872 +#: ../../howto/argparse.rst:623 ../../howto/argparse.rst:661 +#: ../../howto/argparse.rst:877 msgid "Output:" msgstr "結果:" -#: ../../howto/argparse.rst:620 +#: ../../howto/argparse.rst:625 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] x y\n" @@ -1260,7 +1269,7 @@ msgstr "" "$ python prog.py 4 2 -v\n" "4^2 == 16" -#: ../../howto/argparse.rst:639 +#: ../../howto/argparse.rst:644 msgid "" "Notice that so far we've been using verbosity level to *change* the text " "that gets displayed. The following example instead uses verbosity level to " @@ -1269,7 +1278,7 @@ msgstr "" "請注意,到目前為止,我們一直在使用詳細級別來\\ *更改*\\ 顯示的文字。以下範例" "使用詳細級別來顯示\\ *更多*\\ 文字: ::" -#: ../../howto/argparse.rst:643 +#: ../../howto/argparse.rst:648 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1297,7 +1306,7 @@ msgstr "" " print(f\"{args.x}^{args.y} == \", end=\"\")\n" "print(answer)" -#: ../../howto/argparse.rst:658 +#: ../../howto/argparse.rst:663 msgid "" "$ python prog.py 4 2\n" "16\n" @@ -1315,11 +1324,11 @@ msgstr "" "Running 'prog.py'\n" "4^2 == 16" -#: ../../howto/argparse.rst:672 +#: ../../howto/argparse.rst:677 msgid "Specifying ambiguous arguments" msgstr "指定不明確的引數" -#: ../../howto/argparse.rst:674 +#: ../../howto/argparse.rst:679 msgid "" "When there is ambiguity in deciding whether an argument is positional or for " "an argument, ``--`` can be used to tell :meth:`~ArgumentParser.parse_args` " @@ -1328,7 +1337,7 @@ msgstr "" "當決定一個引數是位置引數還是引數會有歧義,可以使用 ``--`` 來告訴 :meth:" "`~ArgumentParser.parse_args` 之後的所有內容都是位置引數: ::" -#: ../../howto/argparse.rst:678 +#: ../../howto/argparse.rst:683 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-n', nargs='+')\n" @@ -1368,11 +1377,11 @@ msgstr "" ">>> parser.parse_args(['-n', '1', '--', '2', '3'])\n" "Namespace(args=['2', '3'], n=['1'])" -#: ../../howto/argparse.rst:699 +#: ../../howto/argparse.rst:704 msgid "Conflicting options" msgstr "相互衝突的選項" -#: ../../howto/argparse.rst:701 +#: ../../howto/argparse.rst:706 msgid "" "So far, we have been working with two methods of an :class:`argparse." "ArgumentParser` instance. Let's introduce a third one, :meth:" @@ -1386,7 +1395,7 @@ msgstr "" "許我們指定彼此衝突的選項。我們還可以更改程式的其餘部分,以使得新功能更有意" "義:我們將引入 ``--quiet`` 選項,該選項與 ``--verbose`` 選項相反: ::" -#: ../../howto/argparse.rst:709 +#: ../../howto/argparse.rst:714 msgid "" "import argparse\n" "\n" @@ -1424,7 +1433,7 @@ msgstr "" "else:\n" " print(f\"{args.x}^{args.y} == {answer}\")" -#: ../../howto/argparse.rst:727 +#: ../../howto/argparse.rst:732 msgid "" "Our program is now simpler, and we've lost some functionality for the sake " "of demonstration. Anyways, here's the output:" @@ -1432,7 +1441,7 @@ msgstr "" "我們的程式現在更簡單了,我們因為功能展示失去了一些功能,但無論如何,以下這是" "輸出:" -#: ../../howto/argparse.rst:730 +#: ../../howto/argparse.rst:735 msgid "" "$ python prog.py 4 2\n" "4^2 == 16\n" @@ -1460,7 +1469,7 @@ msgstr "" "usage: prog.py [-h] [-v | -q] x y\n" "prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose" -#: ../../howto/argparse.rst:745 +#: ../../howto/argparse.rst:750 msgid "" "That should be easy to follow. I've added that last output so you can see " "the sort of flexibility you get, i.e. mixing long form options with short " @@ -1469,14 +1478,14 @@ msgstr "" "這應該很容易理解。我新增了最後一個輸出,以便看到所獲得的靈活性,即可以混合長" "形式與短形式選項。" -#: ../../howto/argparse.rst:749 +#: ../../howto/argparse.rst:754 msgid "" "Before we conclude, you probably want to tell your users the main purpose of " "your program, just in case they don't know::" msgstr "" "在我們結束之前,你可能想告訴使用者你的程式的主要目的,以防他們不知道: ::" -#: ../../howto/argparse.rst:752 +#: ../../howto/argparse.rst:757 msgid "" "import argparse\n" "\n" @@ -1516,7 +1525,7 @@ msgstr "" "else:\n" " print(f\"{args.x}^{args.y} == {answer}\")" -#: ../../howto/argparse.rst:770 +#: ../../howto/argparse.rst:775 msgid "" "Note that slight difference in the usage text. Note the ``[-v | -q]``, which " "tells us that we can either use ``-v`` or ``-q``, but not both at the same " @@ -1525,7 +1534,7 @@ msgstr "" "請注意用法文字中的細微差別。注意 ``[-v | -q]``,它告訴我們可以使用 ``-v`` 或 " "``-q``,但不能同時使用:" -#: ../../howto/argparse.rst:774 ../../howto/argparse.rst:801 +#: ../../howto/argparse.rst:779 ../../howto/argparse.rst:806 msgid "" "$ python prog.py --help\n" "usage: prog.py [-h] [-v | -q] x y\n" @@ -1555,11 +1564,11 @@ msgstr "" " -v, --verbose\n" " -q, --quiet" -#: ../../howto/argparse.rst:792 +#: ../../howto/argparse.rst:797 msgid "How to translate the argparse output" msgstr "如何翻譯 argparse 輸出" -#: ../../howto/argparse.rst:794 +#: ../../howto/argparse.rst:799 msgid "" "The output of the :mod:`argparse` module such as its help text and error " "messages are all made translatable using the :mod:`gettext` module. This " @@ -1570,11 +1579,11 @@ msgstr "" "`gettext` 模組進行翻譯。這允許應用程式能輕鬆本地化 :mod:`argparse` 生成的訊" "息。另請參閱 :ref:`i18n-howto`。" -#: ../../howto/argparse.rst:799 +#: ../../howto/argparse.rst:804 msgid "For instance, in this :mod:`argparse` output:" msgstr "例如,在此 :mod:`argparse` 輸出中:" -#: ../../howto/argparse.rst:817 +#: ../../howto/argparse.rst:822 msgid "" "The strings ``usage:``, ``positional arguments:``, ``options:`` and ``show " "this help message and exit`` are all translatable." @@ -1582,7 +1591,7 @@ msgstr "" "字串 ``usage:``、``positional arguments:``、``options:`` 和 ``show this help " "message and exit`` 都是可被翻譯的。" -#: ../../howto/argparse.rst:820 +#: ../../howto/argparse.rst:825 msgid "" "In order to translate these strings, they must first be extracted into a ``." "po`` file. For example, using `Babel `__, run this " @@ -1591,11 +1600,11 @@ msgstr "" "為了翻譯這些字串,必須先將它們提取到 ``.po`` 檔案中。例如,使用 `Babel " "`__ 並執行下列命令:" -#: ../../howto/argparse.rst:824 +#: ../../howto/argparse.rst:829 msgid "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" msgstr "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" -#: ../../howto/argparse.rst:828 +#: ../../howto/argparse.rst:833 msgid "" "This command will extract all translatable strings from the :mod:`argparse` " "module and output them into a file named ``messages.po``. This command " @@ -1604,13 +1613,13 @@ msgstr "" "此命令將從 :mod:`argparse` 模組中提取出所有可翻譯的字串,並將它們輸出到名為 " "``messages.po`` 的檔案中。這個指令假設你的 Python 是安裝在 ``/usr/lib`` 中。" -#: ../../howto/argparse.rst:832 +#: ../../howto/argparse.rst:837 msgid "" "You can find out the location of the :mod:`argparse` module on your system " "using this script::" msgstr "你可以使用以下腳本找到 :mod:`argparse` 模組在系統上的位置: ::" -#: ../../howto/argparse.rst:835 +#: ../../howto/argparse.rst:840 msgid "" "import argparse\n" "print(argparse.__file__)" @@ -1618,7 +1627,7 @@ msgstr "" "import argparse\n" "print(argparse.__file__)" -#: ../../howto/argparse.rst:838 +#: ../../howto/argparse.rst:843 msgid "" "Once the messages in the ``.po`` file are translated and the translations " "are installed using :mod:`gettext`, :mod:`argparse` will be able to display " @@ -1627,17 +1636,17 @@ msgstr "" "一旦翻譯了 ``.po`` 檔案中的訊息並使用 :mod:`gettext` 安裝了翻譯,:mod:" "`argparse` 將能夠顯示翻譯後的訊息。" -#: ../../howto/argparse.rst:842 +#: ../../howto/argparse.rst:847 msgid "" "To translate your own strings in the :mod:`argparse` output, use :mod:" "`gettext`." msgstr "若要在 :mod:`argparse` 輸出中翻譯你自己的字串,請使用 :mod:`gettext`。" -#: ../../howto/argparse.rst:845 +#: ../../howto/argparse.rst:850 msgid "Custom type converters" msgstr "" -#: ../../howto/argparse.rst:847 +#: ../../howto/argparse.rst:852 msgid "" "The :mod:`argparse` module allows you to specify custom type converters for " "your command-line arguments. This allows you to modify user input before " @@ -1645,7 +1654,7 @@ msgid "" "need to pre-process the input before it is used in your program." msgstr "" -#: ../../howto/argparse.rst:852 +#: ../../howto/argparse.rst:857 msgid "" "When using a custom type converter, you can use any callable that takes a " "single string argument (the argument value) and returns the converted value. " @@ -1653,13 +1662,13 @@ msgid "" "action class with the **action** parameter instead." msgstr "" -#: ../../howto/argparse.rst:857 +#: ../../howto/argparse.rst:862 msgid "" "For example, let's say you want to handle arguments with different prefixes " "and process them accordingly::" msgstr "" -#: ../../howto/argparse.rst:860 +#: ../../howto/argparse.rst:865 msgid "" "import argparse\n" "\n" @@ -1685,7 +1694,7 @@ msgstr "" "args = parser.parse_args()\n" "print(args)" -#: ../../howto/argparse.rst:874 +#: ../../howto/argparse.rst:879 msgid "" "$ python prog.py -a value1 +a value2\n" "Namespace(a=[('-', 'value1'), ('+', 'value2')])" @@ -1693,24 +1702,24 @@ msgstr "" "$ python prog.py -a value1 +a value2\n" "Namespace(a=[('-', 'value1'), ('+', 'value2')])" -#: ../../howto/argparse.rst:879 +#: ../../howto/argparse.rst:884 msgid "In this example, we:" msgstr "在這個範例當中,我們:" -#: ../../howto/argparse.rst:881 +#: ../../howto/argparse.rst:886 msgid "" "Created a parser with custom prefix characters using the ``prefix_chars`` " "parameter." msgstr "" -#: ../../howto/argparse.rst:884 +#: ../../howto/argparse.rst:889 msgid "" "Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter " "to create custom type converters to store the value in a tuple with the " "prefix." msgstr "" -#: ../../howto/argparse.rst:887 +#: ../../howto/argparse.rst:892 msgid "" "Without the custom type converters, the arguments would have treated the ``-" "a`` and ``+a`` as the same argument, which would have been undesirable. By " @@ -1718,11 +1727,11 @@ msgid "" "arguments." msgstr "" -#: ../../howto/argparse.rst:892 +#: ../../howto/argparse.rst:897 msgid "Conclusion" msgstr "結論" -#: ../../howto/argparse.rst:894 +#: ../../howto/argparse.rst:899 msgid "" "The :mod:`argparse` module offers a lot more than shown here. Its docs are " "quite detailed and thorough, and full of examples. Having gone through this " diff --git a/howto/curses.po b/howto/curses.po index d28b8e7fb1..5c22aaf379 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -240,8 +240,8 @@ msgid "" " v = i-10\n" " stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))\n" "\n" -" stdscr.refresh()\n" -" stdscr.getkey()\n" +" stdscr.refresh()\n" +" stdscr.getkey()\n" "\n" "wrapper(main)" msgstr "" diff --git a/howto/descriptor.po b/howto/descriptor.po index 4d1b659340..8a489fafc2 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -75,8 +75,9 @@ msgstr "" msgid "" "The last section has pure Python equivalents for built-in descriptors that " "are written in C. Read this if you're curious about how functions turn into " -"bound methods or about the implementation of common tools like :func:" -"`classmethod`, :func:`staticmethod`, :func:`property`, and :term:`__slots__`." +"bound methods or about the implementation of common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :term:`__slots__`." msgstr "" #: ../../howto/descriptor.rst:36 @@ -230,8 +231,9 @@ msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." -"__set__` methods are triggered when the public attribute is accessed." +"dictionary. The descriptor's :meth:`~object.__get__` " +"and :meth:`~object.__set__` methods are triggered when the public attribute " +"is accessed." msgstr "" #: ../../howto/descriptor.rst:139 @@ -369,9 +371,10 @@ msgstr "" #: ../../howto/descriptor.rst:256 msgid "" -"An interactive session shows that the :class:`!Person` class has called :" -"meth:`~object.__set_name__` so that the field names would be recorded. Here " -"we call :func:`vars` to look up the descriptor without triggering it:" +"An interactive session shows that the :class:`!Person` class has " +"called :meth:`~object.__set_name__` so that the field names would be " +"recorded. Here we call :func:`vars` to look up the descriptor without " +"triggering it:" msgstr "" #: ../../howto/descriptor.rst:260 @@ -428,8 +431,9 @@ msgstr "" #: ../../howto/descriptor.rst:297 msgid "" -"A :term:`descriptor` is what we call any object that defines :meth:`~object." -"__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." +"A :term:`descriptor` is what we call any object that " +"defines :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`." msgstr "" #: ../../howto/descriptor.rst:300 @@ -469,9 +473,9 @@ msgstr "" #: ../../howto/descriptor.rst:319 msgid "" "Descriptors are used throughout the language. It is how functions turn into " -"bound methods. Common tools like :func:`classmethod`, :func:" -"`staticmethod`, :func:`property`, and :func:`functools.cached_property` are " -"all implemented as descriptors." +"bound methods. Common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :func:`functools.cached_property` are all implemented as descriptors." msgstr "" #: ../../howto/descriptor.rst:326 @@ -561,9 +565,9 @@ msgstr "" #: ../../howto/descriptor.rst:374 msgid "" -":class:`!Number` verifies that a value is either an :class:`int` or :class:" -"`float`. Optionally, it verifies that a value is between a given minimum or " -"maximum." +":class:`!Number` verifies that a value is either an :class:`int` " +"or :class:`float`. Optionally, it verifies that a value is between a given " +"minimum or maximum." msgstr "" #: ../../howto/descriptor.rst:378 @@ -716,9 +720,10 @@ msgstr "" #: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " -"in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" -"meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " -"methods are defined for an attribute, it is said to be a :term:`descriptor`." +"in the descriptor protocol. Those methods " +"are :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"attribute, it is said to be a :term:`descriptor`." msgstr "" #: ../../howto/descriptor.rst:508 @@ -736,10 +741,10 @@ msgstr "" #: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " -"mechanism behind properties, methods, static methods, class methods, and :" -"func:`super`. They are used throughout Python itself. Descriptors simplify " -"the underlying C code and offer a flexible set of new tools for everyday " -"Python programs." +"mechanism behind properties, methods, static methods, class methods, " +"and :func:`super`. They are used throughout Python itself. Descriptors " +"simplify the underlying C code and offer a flexible set of new tools for " +"everyday Python programs." msgstr "" #: ../../howto/descriptor.rst:525 @@ -768,9 +773,9 @@ msgstr "" #: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " -"it is considered a data descriptor. Descriptors that only define :meth:" -"`~object.__get__` are called non-data descriptors (they are often used for " -"methods but other uses are possible)." +"it is considered a data descriptor. Descriptors that only " +"define :meth:`~object.__get__` are called non-data descriptors (they are " +"often used for methods but other uses are possible)." msgstr "" #: ../../howto/descriptor.rst:542 @@ -785,9 +790,10 @@ msgstr "" #: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`~object.__get__` " -"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" -"`AttributeError` when called. Defining the :meth:`~object.__set__` method " -"with an exception raising placeholder is enough to make it a data descriptor." +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising " +"an :exc:`AttributeError` when called. Defining the :meth:`~object.__set__` " +"method with an exception raising placeholder is enough to make it a data " +"descriptor." msgstr "" #: ../../howto/descriptor.rst:555 @@ -796,8 +802,8 @@ msgstr "" #: ../../howto/descriptor.rst:557 msgid "" -"A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." -"__get__(None, cls)``." +"A descriptor can be called directly with ``desc.__get__(obj)`` or " +"``desc.__get__(None, cls)``." msgstr "" #: ../../howto/descriptor.rst:560 @@ -834,8 +840,8 @@ msgstr "" #: ../../howto/descriptor.rst:580 msgid "" -"If a descriptor is found for ``a.x``, then it is invoked with: ``desc." -"__get__(a, type(a))``." +"If a descriptor is found for ``a.x``, then it is invoked with: " +"``desc.__get__(a, type(a))``." msgstr "" #: ../../howto/descriptor.rst:583 @@ -875,18 +881,19 @@ msgstr "" #: ../../howto/descriptor.rst:722 msgid "" -"Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." -"__getattribute__` code. That is why calling :meth:`~object." -"__getattribute__` directly or with ``super().__getattribute__`` will bypass :" -"meth:`~object.__getattr__` entirely." +"Note, there is no :meth:`~object.__getattr__` hook in " +"the :meth:`~object.__getattribute__` code. That is why " +"calling :meth:`~object.__getattribute__` directly or with " +"``super().__getattribute__`` will bypass :meth:`~object.__getattr__` " +"entirely." msgstr "" #: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " -"responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." -"__getattribute__` raises an :exc:`AttributeError`. Their logic is " -"encapsulated in a helper function:" +"responsible for invoking :meth:`~object.__getattr__` " +"whenever :meth:`~object.__getattribute__` raises an :exc:`AttributeError`. " +"Their logic is encapsulated in a helper function:" msgstr "" #: ../../howto/descriptor.rst:731 @@ -915,10 +922,10 @@ msgstr "" #: ../../howto/descriptor.rst:778 msgid "" -"The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." -"__getattribute__`. The steps are similar to those for :meth:`!object." -"__getattribute__` but the instance dictionary lookup is replaced by a search " -"through the class's :term:`method resolution order`." +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!" +"type.__getattribute__`. The steps are similar to those for :meth:`!" +"object.__getattribute__` but the instance dictionary lookup is replaced by a " +"search through the class's :term:`method resolution order`." msgstr "" #: ../../howto/descriptor.rst:783 @@ -927,8 +934,8 @@ msgstr "" #: ../../howto/descriptor.rst:785 msgid "" -"The full C implementation can be found in :c:func:`!type_getattro` and :c:" -"func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." +"The full C implementation can be found in :c:func:`!type_getattro` " +"and :c:func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" #: ../../howto/descriptor.rst:790 @@ -937,22 +944,23 @@ msgstr "" #: ../../howto/descriptor.rst:792 msgid "" -"The logic for super's dotted lookup is in the :meth:`~object." -"__getattribute__` method for object returned by :func:`super`." +"The logic for super's dotted lookup is in " +"the :meth:`~object.__getattribute__` method for object returned " +"by :func:`super`." msgstr "" #: ../../howto/descriptor.rst:795 msgid "" -"A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." -"__mro__`` for the base class ``B`` immediately following ``A`` and then " -"returns ``B.__dict__['m'].__get__(obj, A)``. If not a descriptor, ``m`` is " -"returned unchanged." +"A dotted lookup such as ``super(A, obj).m`` searches " +"``obj.__class__.__mro__`` for the base class ``B`` immediately following " +"``A`` and then returns ``B.__dict__['m'].__get__(obj, A)``. If not a " +"descriptor, ``m`` is returned unchanged." msgstr "" #: ../../howto/descriptor.rst:800 msgid "" -"The full C implementation can be found in :c:func:`!super_getattro` in :" -"source:`Objects/typeobject.c`. A pure Python equivalent can be found in " +"The full C implementation can be found in :c:func:`!super_getattro` " +"in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in " "`Guido's Tutorial `_." msgstr "" @@ -963,9 +971,9 @@ msgstr "" #: ../../howto/descriptor.rst:809 msgid "" -"The mechanism for descriptors is embedded in the :meth:`~object." -"__getattribute__` methods for :class:`object`, :class:`type`, and :func:" -"`super`." +"The mechanism for descriptors is embedded in " +"the :meth:`~object.__getattribute__` methods " +"for :class:`object`, :class:`type`, and :func:`super`." msgstr "" #: ../../howto/descriptor.rst:812 @@ -978,8 +986,8 @@ msgstr "" #: ../../howto/descriptor.rst:816 msgid "" -"Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" -"`super`." +"Classes inherit this machinery from :class:`object`, :class:`type`, " +"or :func:`super`." msgstr "" #: ../../howto/descriptor.rst:819 @@ -1038,8 +1046,8 @@ msgstr "ORM 範例" #: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " -"could be used to implement an `object relational mapping `_." +"could be used to implement an `object relational mapping `_." msgstr "" #: ../../howto/descriptor.rst:857 @@ -1083,9 +1091,9 @@ msgstr "" #: ../../howto/descriptor.rst:876 msgid "" -"We can use the :class:`!Field` class to define `models `_ that describe the schema for each table in a " -"database:" +"We can use the :class:`!Field` class to define `models `_ that describe the schema for each " +"table in a database:" msgstr "" #: ../../howto/descriptor.rst:880 @@ -1342,10 +1350,10 @@ msgstr "" #: ../../howto/descriptor.rst:1189 msgid "" -"To support automatic creation of methods, functions include the :meth:" -"`~object.__get__` method for binding methods during attribute access. This " -"means that functions are non-data descriptors that return bound methods " -"during dotted lookup from an instance. Here's how it works:" +"To support automatic creation of methods, functions include " +"the :meth:`~object.__get__` method for binding methods during attribute " +"access. This means that functions are non-data descriptors that return " +"bound methods during dotted lookup from an instance. Here's how it works:" msgstr "" #: ../../howto/descriptor.rst:1194 @@ -1397,8 +1405,9 @@ msgstr "" #: ../../howto/descriptor.rst:1233 msgid "" -"Accessing the function through the class dictionary does not invoke :meth:" -"`~object.__get__`. Instead, it just returns the underlying function object::" +"Accessing the function through the class dictionary does not " +"invoke :meth:`~object.__get__`. Instead, it just returns the underlying " +"function object::" msgstr "" #: ../../howto/descriptor.rst:1236 @@ -1535,10 +1544,10 @@ msgstr "" #: ../../howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " -"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." -"__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a " -"result, the function becomes identically accessible from either an object or " -"a class." +"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into " +"``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, " +"\"f\")``. As a result, the function becomes identically accessible from " +"either an object or a class." msgstr "" #: ../../howto/descriptor.rst:1299 @@ -1591,8 +1600,8 @@ msgstr "" #: ../../howto/descriptor.rst:1328 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`staticmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`staticmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1331 @@ -1617,9 +1626,9 @@ msgstr "" msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " -"attributes necessary to make the wrapper look like the wrapped function: :" -"attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." -"__doc__`, and :attr:`~function.__annotations__`." +"attributes necessary to make the wrapper look like the wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" #: ../../howto/descriptor.rst:1417 @@ -1698,8 +1707,8 @@ msgstr "" #: ../../howto/descriptor.rst:1464 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`classmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`classmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1467 @@ -1724,9 +1733,9 @@ msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " "carries forward the attributes necessary to make the wrapper look like the " -"wrapped function: :attr:`~function.__name__`, :attr:`~function." -"__qualname__`, :attr:`~function.__doc__`, and :attr:`~function." -"__annotations__`." +"wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" #: ../../howto/descriptor.rst:1538 @@ -2053,23 +2062,3 @@ msgstr "" "Traceback (most recent call last):\n" " ...\n" "AttributeError: 'H' object has no attribute 'xz'" - -#~ msgid "" -#~ "class G:\n" -#~ " @classmethod\n" -#~ " @property\n" -#~ " def __doc__(cls):\n" -#~ " return f'A doc for {cls.__name__!r}'" -#~ msgstr "" -#~ "class G:\n" -#~ " @classmethod\n" -#~ " @property\n" -#~ " def __doc__(cls):\n" -#~ " return f'A doc for {cls.__name__!r}'" - -#~ msgid "" -#~ ">>> G.__doc__\n" -#~ "\"A doc for 'G'\"" -#~ msgstr "" -#~ ">>> G.__doc__\n" -#~ "\"A doc for 'G'\"" diff --git a/howto/enum.po b/howto/enum.po index eeeae58470..924ee16d8a 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -211,9 +211,12 @@ msgstr "" #: ../../howto/enum.rst:108 msgid "" ">>> from datetime import date\n" -">>> Weekday.from_date(date.today()) \n" +">>> Weekday.from_date(date.today())\n" "" msgstr "" +">>> from datetime import date\n" +">>> Weekday.from_date(date.today())\n" +"" #: ../../howto/enum.rst:112 msgid "" @@ -312,15 +315,15 @@ msgstr "" #: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" msgstr "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" @@ -383,8 +386,8 @@ msgstr "" #: ../../howto/enum.rst:191 msgid "" -"Sometimes it's useful to access members in enumerations programmatically (i." -"e. situations where ``Color.RED`` won't do because the exact color is not " +"Sometimes it's useful to access members in enumerations programmatically " +"(i.e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" @@ -624,16 +627,16 @@ msgid "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" msgstr "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" #: ../../howto/enum.rst:319 msgid "" @@ -836,24 +839,25 @@ msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`~object." -"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " -"descriptors), and variable names listed in :attr:`~Enum._ignore_`." +"enumeration, with the exception of special methods " +"(:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors " +"(methods are also descriptors), and variable names listed " +"in :attr:`~Enum._ignore_`." msgstr "" #: ../../howto/enum.rst:432 msgid "" -"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" -"`~object.__init__`, any value(s) given to the enum member will be passed " -"into those methods. See `Planet`_ for an example." +"Note: if your enumeration defines :meth:`~object.__new__` and/" +"or :meth:`~object.__init__`, any value(s) given to the enum member will be " +"passed into those methods. See `Planet`_ for an example." msgstr "" #: ../../howto/enum.rst:438 msgid "" "The :meth:`~object.__new__` method, if defined, is used during creation of " "the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " -"which is used after class creation for lookup of existing members. See :ref:" -"`new-vs-init` for more details." +"which is used after class creation for lookup of existing members. " +"See :ref:`new-vs-init` for more details." msgstr "" #: ../../howto/enum.rst:445 @@ -935,8 +939,8 @@ msgstr "" #: ../../howto/enum.rst:486 msgid "" -"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." -"__repr__` omits the inherited class' name. For example::" +"When inheriting from a :class:`~dataclasses.dataclass`, " +"the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" msgstr "" #: ../../howto/enum.rst:489 @@ -1037,9 +1041,10 @@ msgstr "" #: ../../howto/enum.rst:547 msgid "" -"It is possible to modify how enum members are pickled/unpickled by defining :" -"meth:`~object.__reduce_ex__` in the enumeration class. The default method " -"is by-value, but enums with complicated values may want to use by-name::" +"It is possible to modify how enum members are pickled/unpickled by " +"defining :meth:`~object.__reduce_ex__` in the enumeration class. The " +"default method is by-value, but enums with complicated values may want to " +"use by-name::" msgstr "" #: ../../howto/enum.rst:551 @@ -1148,10 +1153,10 @@ msgstr "" #: ../../howto/enum.rst:611 msgid "" -"The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~type.__qualname__` being set to the location where pickle will be able to " -"find the class. For example, if the class was made available in class " -"SomeData in the global scope::" +"The new pickle protocol 4 also, in some circumstances, relies " +"on :attr:`~type.__qualname__` being set to the location where pickle will be " +"able to find the class. For example, if the class was made available in " +"class SomeData in the global scope::" msgstr "" #: ../../howto/enum.rst:616 @@ -1254,10 +1259,10 @@ msgstr "IntEnum" #: ../../howto/enum.rst:667 msgid "" -"The first variation of :class:`Enum` that is provided is also a subclass of :" -"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " -"extension, integer enumerations of different types can also be compared to " -"each other::" +"The first variation of :class:`Enum` that is provided is also a subclass " +"of :class:`int`. Members of an :class:`IntEnum` can be compared to " +"integers; by extension, integer enumerations of different types can also be " +"compared to each other::" msgstr "" #: ../../howto/enum.rst:672 @@ -1366,9 +1371,9 @@ msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " "combined using the bitwise operators (&, \\|, ^, ~) and the result is still " -"an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:" -"`IntFlag` members are also integers and can be used wherever an :class:`int` " -"is used." +"an :class:`IntFlag` member, if possible. " +"Like :class:`IntEnum`, :class:`IntFlag` members are also integers and can be " +"used wherever an :class:`int` is used." msgstr "" #: ../../howto/enum.rst:733 @@ -1458,8 +1463,8 @@ msgstr "" #: ../../howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " -"that if no flags are set (the value is 0), its boolean evaluation is :data:" -"`False`::" +"that if no flags are set (the value is 0), its boolean evaluation " +"is :data:`False`::" msgstr "" #: ../../howto/enum.rst:784 @@ -1527,10 +1532,10 @@ msgstr "Flag" #: ../../howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " -"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" -"class:`IntFlag`, they cannot be combined with, nor compared against, any " -"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " -"specify the values directly it is recommended to use :class:`auto` as the " +"members can be combined using the bitwise operators (&, \\|, ^, ~). " +"Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, " +"any other :class:`Flag` enumeration, nor :class:`int`. While it is possible " +"to specify the values directly it is recommended to use :class:`auto` as the " "value and let :class:`Flag` select an appropriate value." msgstr "" @@ -1639,10 +1644,10 @@ msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " "promises of an enumeration (by being comparable to integers, and thus by " -"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" -"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " -"will not do; for example, when integer constants are replaced with " -"enumerations, or for interoperability with other systems." +"transitivity to other unrelated enumerations). :class:`IntEnum` " +"and :class:`IntFlag` should be used only in cases where :class:`Enum` " +"and :class:`Flag` will not do; for example, when integer constants are " +"replaced with enumerations, or for interoperability with other systems." msgstr "" #: ../../howto/enum.rst:886 @@ -1666,8 +1671,8 @@ msgstr "" #: ../../howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" -"`int`." +"example a :class:`!FloatEnum` that mixes in :class:`float` instead " +"of :class:`int`." msgstr "" #: ../../howto/enum.rst:897 @@ -1676,24 +1681,24 @@ msgstr "一些規則:" #: ../../howto/enum.rst:899 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before the :class:" -"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " -"example above." +"When subclassing :class:`Enum`, mix-in types must appear before " +"the :class:`Enum` class itself in the sequence of bases, as in " +"the :class:`IntEnum` example above." msgstr "" #: ../../howto/enum.rst:902 msgid "" -"Mix-in types must be subclassable. For example, :class:`bool` and :class:" -"`range` are not subclassable and will throw an error during Enum creation if " -"used as the mix-in type." +"Mix-in types must be subclassable. For example, :class:`bool` " +"and :class:`range` are not subclassable and will throw an error during Enum " +"creation if used as the mix-in type." msgstr "" #: ../../howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " -"additional type, all the members must have values of that type, e.g. :class:" -"`int` above. This restriction does not apply to mix-ins which only add " -"methods and don't specify another type." +"additional type, all the members must have values of that type, " +"e.g. :class:`int` above. This restriction does not apply to mix-ins which " +"only add methods and don't specify another type." msgstr "" #: ../../howto/enum.rst:909 @@ -1705,30 +1710,30 @@ msgstr "" #: ../../howto/enum.rst:912 msgid "" -"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" -"`~dataclasses.dataclass`" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or " +"a :class:`~dataclasses.dataclass`" msgstr "" #: ../../howto/enum.rst:914 msgid "" -"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" -"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " -"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " -"type." +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` " +"class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; " +"other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as " +"its mixed-in type." msgstr "" #: ../../howto/enum.rst:917 msgid "" -":ref:`Formatted string literals `, :meth:`str.format`, and :func:" -"`format` will use the enum's :meth:`~object.__str__` method." +":ref:`Formatted string literals `, :meth:`str.format`, " +"and :func:`format` will use the enum's :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " -"designed to be drop-in replacements for existing constants, their :meth:" -"`~object.__str__` method has been reset to their data types' :meth:`~object." -"__str__` method." +"designed to be drop-in replacements for existing constants, " +"their :meth:`~object.__str__` method has been reset to their data " +"types' :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:930 @@ -1739,8 +1744,8 @@ msgstr "" msgid "" ":meth:`~object.__new__` must be used whenever you want to customize the " "actual value of the :class:`Enum` member. Any other modifications may go in " -"either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" -"`~object.__init__` being preferred." +"either :meth:`~object.__new__` or :meth:`~object.__init__`, " +"with :meth:`~object.__init__` being preferred." msgstr "" #: ../../howto/enum.rst:936 @@ -1786,7 +1791,7 @@ msgstr "" #: ../../howto/enum.rst:971 msgid "Supported ``__dunder__`` names" -msgstr "" +msgstr "有支援的 ``__dunder__`` 名稱" #: ../../howto/enum.rst:973 msgid "" @@ -1797,14 +1802,14 @@ msgstr "" #: ../../howto/enum.rst:976 msgid "" ":meth:`~object.__new__`, if specified, must create and return the enum " -"members; it is also a very good idea to set the member's :attr:`~Enum." -"_value_` appropriately. Once all the members are created it is no longer " -"used." +"members; it is also a very good idea to set the " +"member's :attr:`~Enum._value_` appropriately. Once all the members are " +"created it is no longer used." msgstr "" #: ../../howto/enum.rst:982 msgid "Supported ``_sunder_`` names" -msgstr "" +msgstr "有支援的 ``_sunder_`` 名稱" #: ../../howto/enum.rst:984 msgid ":attr:`~Enum._name_` -- name of the member" @@ -1822,9 +1827,9 @@ msgstr "" #: ../../howto/enum.rst:988 msgid "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" -"class:`str`, that will not be transformed into members, and will be removed " -"from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" #: ../../howto/enum.rst:991 @@ -1872,7 +1877,7 @@ msgstr "``_ignore_``" #: ../../howto/enum.rst:1011 msgid "``_add_alias_``, ``_add_value_alias_``" -msgstr "" +msgstr "``_add_alias_``、``_add_value_alias_``" #: ../../howto/enum.rst:1013 msgid "" @@ -1968,11 +1973,11 @@ msgstr "" #: ../../howto/enum.rst:1074 msgid "" -"Enum classes that are mixed with non-:class:`Enum` types (such as :class:" -"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " -"rules; otherwise, all members evaluate as :data:`True`. To make your own " -"enum's boolean evaluation depend on the member's value add the following to " -"your class::" +"Enum classes that are mixed with non-:class:`Enum` types (such " +"as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " +"type's rules; otherwise, all members evaluate as :data:`True`. To make your " +"own enum's boolean evaluation depend on the member's value add the following " +"to your class::" msgstr "" #: ../../howto/enum.rst:1080 @@ -2000,23 +2005,23 @@ msgstr "" #: ../../howto/enum.rst:1093 msgid "" -">>> dir(Planet) \n" +">>> dir(Planet)\n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " "'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" -">>> dir(Planet.EARTH) \n" +">>> dir(Planet.EARTH)\n" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" msgstr "" -">>> dir(Planet) \n" +">>> dir(Planet)\n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " "'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" -">>> dir(Planet.EARTH) \n" +">>> dir(Planet.EARTH)\n" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" #: ../../howto/enum.rst:1100 msgid "Combining members of ``Flag``" -msgstr "" +msgstr "``Flag`` 的成員組合" #: ../../howto/enum.rst:1102 msgid "" @@ -2196,23 +2201,23 @@ msgstr "" #: ../../howto/enum.rst:1193 msgid "STRICT --> raises an exception when presented with invalid values" -msgstr "" +msgstr "STRICT --> 當遇到無效值時引發例外" #: ../../howto/enum.rst:1194 msgid "CONFORM --> discards any invalid bits" -msgstr "" +msgstr "CONFORM --> 捨棄任何無效位元" #: ../../howto/enum.rst:1195 msgid "EJECT --> lose Flag status and become a normal int with the given value" -msgstr "" +msgstr "EJECT --> 失去 Flag 狀態並成為具有給定值的普通 int" #: ../../howto/enum.rst:1196 msgid "KEEP --> keep the extra bits" -msgstr "" +msgstr "KEEP --> 保留額外位元" #: ../../howto/enum.rst:1198 msgid "keeps Flag status and extra bits" -msgstr "" +msgstr "保留 Flag 狀態和額外位元" #: ../../howto/enum.rst:1199 msgid "extra bits do not show up in iteration" @@ -2225,18 +2230,18 @@ msgstr "" #: ../../howto/enum.rst:1202 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " -"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." -"Options`` for an example of when ``KEEP`` is needed)." +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see " +"``ssl.Options`` for an example of when ``KEEP`` is needed)." msgstr "" #: ../../howto/enum.rst:1210 msgid "How are Enums and Flags different?" -msgstr "" +msgstr "Enums 和 Flags 有何不同?" #: ../../howto/enum.rst:1212 msgid "" -"Enums have a custom metaclass that affects many aspects of both derived :" -"class:`Enum` classes and their instances (members)." +"Enums have a custom metaclass that affects many aspects of both " +"derived :class:`Enum` classes and their instances (members)." msgstr "" #: ../../howto/enum.rst:1217 @@ -2245,14 +2250,14 @@ msgstr "Enum 類別" #: ../../howto/enum.rst:1219 msgid "" -"The :class:`EnumType` metaclass is responsible for providing the :meth:" -"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"The :class:`EnumType` metaclass is responsible for providing " +"the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " "and other methods that allow one to do things with an :class:`Enum` class " "that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " "Color``. :class:`EnumType` is responsible for ensuring that various other " -"methods on the final :class:`Enum` class are correct (such as :meth:`~object." -"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" -"`~object.__repr__`)." +"methods on the final :class:`Enum` class are correct (such " +"as :meth:`~object.__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` " +"and :meth:`~object.__repr__`)." msgstr "" #: ../../howto/enum.rst:1228 @@ -2263,8 +2268,8 @@ msgstr "Flag 類別" msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " -"addition to the :class:`Enum` definition of alias, a flag with no value (a.k." -"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " +"addition to the :class:`Enum` definition of alias, a flag with no value " +"(a.k.a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " "considered an alias." msgstr "" @@ -2274,11 +2279,11 @@ msgstr "" #: ../../howto/enum.rst:1238 msgid "" -"The most interesting thing about enum members is that they are singletons. :" -"class:`EnumType` creates them all while it is creating the enum class " -"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " -"that no new ones are ever instantiated by returning only the existing member " -"instances." +"The most interesting thing about enum members is that they are " +"singletons. :class:`EnumType` creates them all while it is creating the enum " +"class itself, and then puts a custom :meth:`~object.__new__` in place to " +"ensure that no new ones are ever instantiated by returning only the existing " +"member instances." msgstr "" #: ../../howto/enum.rst:1244 @@ -2337,15 +2342,16 @@ msgstr "" #: ../../howto/enum.rst:1273 msgid "" -"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" -"class:`IntFlag` are expected to cover the majority of use-cases, they cannot " -"cover them all. Here are recipes for some different types of enumerations " -"that can be used directly, or as examples for creating one's own." +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, " +"and :class:`IntFlag` are expected to cover the majority of use-cases, they " +"cannot cover them all. Here are recipes for some different types of " +"enumerations that can be used directly, or as examples for creating one's " +"own." msgstr "" #: ../../howto/enum.rst:1280 msgid "Omitting values" -msgstr "" +msgstr "省略值" #: ../../howto/enum.rst:1282 msgid "" @@ -2384,7 +2390,7 @@ msgstr "使用 :class:`auto`" #: ../../howto/enum.rst:1299 msgid "Using :class:`auto` would look like::" -msgstr "" +msgstr "使用 :class:`auto` 會像這樣: ::" #: ../../howto/enum.rst:1301 msgid "" @@ -2410,7 +2416,7 @@ msgstr "使用 :class:`object`" #: ../../howto/enum.rst:1313 msgid "Using :class:`object` would look like::" -msgstr "" +msgstr "使用 :class:`object` 會像這樣: ::" #: ../../howto/enum.rst:1315 msgid "" @@ -2419,7 +2425,7 @@ msgid "" "... GREEN = object()\n" "... BLUE = object()\n" "...\n" -">>> Color.GREEN \n" +">>> Color.GREEN\n" ">" msgstr "" ">>> class Color(Enum):\n" @@ -2427,13 +2433,13 @@ msgstr "" "... GREEN = object()\n" "... BLUE = object()\n" "...\n" -">>> Color.GREEN \n" +">>> Color.GREEN\n" ">" #: ../../howto/enum.rst:1323 msgid "" -"This is also a good example of why you might want to write your own :meth:" -"`~object.__repr__`::" +"This is also a good example of why you might want to write your " +"own :meth:`~object.__repr__`::" msgstr "" #: ../../howto/enum.rst:1326 @@ -2486,7 +2492,7 @@ msgstr "" #: ../../howto/enum.rst:1353 msgid "Using a custom :meth:`~object.__new__`" -msgstr "" +msgstr "使用自訂的 :meth:`~object.__new__`" #: ../../howto/enum.rst:1355 msgid "Using an auto-numbering :meth:`~object.__new__` would look like::" @@ -2774,11 +2780,11 @@ msgid "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[, ]\n" +"[, ]\n" ">>> list(Period)[-2:]\n" -"[, ]" +"[, ]" msgstr "" #: ../../howto/enum.rst:1558 diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index d2f09a2deb..2d43d4ae62 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,7 +19,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:5 msgid "Python experimental support for free threading" -msgstr "" +msgstr "Python 自由執行緒的實驗性支援" #: ../../howto/free-threading-python.rst:7 msgid "" @@ -54,7 +53,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:28 msgid "Installation" -msgstr "" +msgstr "安裝" #: ../../howto/free-threading-python.rst:30 msgid "" @@ -83,7 +82,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:45 msgid "" "To check if the current interpreter supports free-threading, :option:`python " -"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"-VV <-V>` and :data:`sys.version` contain \"experimental free-threading " "build\". The new :func:`sys._is_gil_enabled` function can be used to check " "whether the GIL is actually disabled in the running process." msgstr "" @@ -130,7 +129,7 @@ msgstr "https://hugovk.github.io/free-threaded-wheels/" #: ../../howto/free-threading-python.rst:75 msgid "Thread safety" -msgstr "" +msgstr "執行緒安全" #: ../../howto/free-threading-python.rst:77 msgid "" @@ -153,7 +152,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:94 msgid "Known limitations" -msgstr "" +msgstr "已知限制" #: ../../howto/free-threading-python.rst:96 msgid "" @@ -162,7 +161,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:99 msgid "Immortalization" -msgstr "" +msgstr "不滅化 (Immortalization)" #: ../../howto/free-threading-python.rst:101 msgid "" @@ -182,23 +181,23 @@ msgstr "" #: ../../howto/free-threading-python.rst:109 msgid "" ":ref:`function ` objects declared at the module level" -msgstr "" +msgstr "在模組層級宣告的\\ :ref:`函式 `\\ 物件" #: ../../howto/free-threading-python.rst:110 msgid ":ref:`method ` descriptors" -msgstr "" +msgstr ":ref:`方法 `\\ 描述器" #: ../../howto/free-threading-python.rst:111 msgid ":ref:`code ` objects" -msgstr "" +msgstr ":ref:`程式碼 `\\ 物件" #: ../../howto/free-threading-python.rst:112 msgid ":term:`module` objects and their dictionaries" -msgstr "" +msgstr ":term:`模組 `\\ 物件及其字典" #: ../../howto/free-threading-python.rst:113 msgid ":ref:`classes ` (type objects)" -msgstr "" +msgstr ":ref:`類別 `\\ (型別物件)" #: ../../howto/free-threading-python.rst:115 msgid "" @@ -241,7 +240,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:143 msgid "Single-threaded performance" -msgstr "" +msgstr "單執行緒效能" #: ../../howto/free-threading-python.rst:145 msgid "" diff --git a/howto/functional.po b/howto/functional.po index a145631968..b41774276d 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,7 +20,7 @@ msgstr "" #: ../../howto/functional.rst:5 msgid "Functional Programming HOWTO" -msgstr "函式編程 HOWTO" +msgstr "函式程式設計 HOWTO" #: ../../howto/functional.rst:0 msgid "Author" @@ -164,23 +164,23 @@ msgstr "" #: ../../howto/functional.rst:94 msgid "Formal provability." -msgstr "" +msgstr "形式可證明性 (Formal provability)。" #: ../../howto/functional.rst:95 msgid "Modularity." -msgstr "" +msgstr "模組化 (Modularity)。" #: ../../howto/functional.rst:96 msgid "Composability." -msgstr "" +msgstr "可組合性 (Composability)。" #: ../../howto/functional.rst:97 msgid "Ease of debugging and testing." -msgstr "" +msgstr "容易除錯與測試。" #: ../../howto/functional.rst:101 msgid "Formal provability" -msgstr "" +msgstr "形式可證明性" #: ../../howto/functional.rst:103 msgid "" @@ -231,7 +231,7 @@ msgstr "" #: ../../howto/functional.rst:137 msgid "Modularity" -msgstr "" +msgstr "模組化" #: ../../howto/functional.rst:139 msgid "" @@ -244,7 +244,7 @@ msgstr "" #: ../../howto/functional.rst:147 msgid "Ease of debugging and testing" -msgstr "" +msgstr "容易除錯與測試" #: ../../howto/functional.rst:149 msgid "Testing and debugging a functional-style program is easier." @@ -269,7 +269,7 @@ msgstr "" #: ../../howto/functional.rst:163 msgid "Composability" -msgstr "" +msgstr "可組合性" #: ../../howto/functional.rst:165 msgid "" @@ -498,7 +498,7 @@ msgstr "" #: ../../howto/functional.rst:333 msgid "Generator expressions and list comprehensions" -msgstr "" +msgstr "產生器運算式與串列綜合運算式" #: ../../howto/functional.rst:335 msgid "" @@ -527,6 +527,13 @@ msgid "" ">>> # List comprehension -- returns list\n" ">>> stripped_list = [line.strip() for line in line_list]" msgstr "" +">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" +"\n" +">>> # 產生器運算式 -- 回傳疊代器\n" +">>> stripped_iter = (line.strip() for line in line_list)\n" +"\n" +">>> # 串列綜合運算式 -- 回傳串列\n" +">>> stripped_list = [line.strip() for line in line_list]" #: ../../howto/functional.rst:354 msgid "" @@ -692,7 +699,7 @@ msgstr "" #: ../../howto/functional.rst:454 msgid "Here's the simplest example of a generator function:" -msgstr "" +msgstr "以下是最簡單的產生器函式範例:" #: ../../howto/functional.rst:460 msgid "" @@ -715,7 +722,7 @@ msgstr "" #: ../../howto/functional.rst:473 msgid "Here's a sample usage of the ``generate_ints()`` generator:" -msgstr "" +msgstr "以下是 ``generate_ints()`` 產生器的使用範例:" #: ../../howto/functional.rst:490 msgid "" @@ -840,6 +847,15 @@ msgid "" " else:\n" " i += 1" msgstr "" +"def counter(maximum):\n" +" i = 0\n" +" while i < maximum:\n" +" val = (yield i)\n" +" # 如有提供值則改變計數器\n" +" if val is not None:\n" +" i = val\n" +" else:\n" +" i += 1" #: ../../howto/functional.rst:576 msgid "And here's an example of changing the counter:" @@ -917,12 +933,14 @@ msgstr "" #: ../../howto/functional.rst:633 msgid "" ":func:`map(f, iterA, iterB, ...) ` returns an iterator over the sequence" -msgstr "" +msgstr ":func:`map(f, iterA, iterB, ...) ` 回傳一個元素為序列的疊代器" #: ../../howto/functional.rst:634 msgid "" "``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``." msgstr "" +"``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ..." +"``。" #: ../../howto/functional.rst:644 msgid "You can of course achieve the same effect with a list comprehension." @@ -993,11 +1011,11 @@ msgid "" ">>> import random\n" ">>> # Generate 8 random numbers between [0, 10000)\n" ">>> rand_list = random.sample(range(10000), 8)\n" -">>> rand_list \n" +">>> rand_list\n" "[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n" -">>> sorted(rand_list) \n" +">>> sorted(rand_list)\n" "[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n" -">>> sorted(rand_list, reverse=True) \n" +">>> sorted(rand_list, reverse=True)\n" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 67e53cc2e0..3208fed349 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-12 00:04+0000\n" +"POT-Creation-Date: 2024-12-06 00:14+0000\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -391,16 +391,20 @@ msgstr "" #: ../../howto/gdb_helpers.rst:183 msgid "" "The internal structure can be revealed with a cast to :c:expr:`PyLongObject " -"*`:" -msgstr "可以透過轉換 (cast) 為 :c:expr:`PyLongObject *` 來揭示內部結構:" +"*`::" +msgstr "可以透過轉換 (cast) 為 :c:expr:`PyLongObject *` 來揭示內部結構: ::" #: ../../howto/gdb_helpers.rst:185 msgid "" -"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " -"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" msgstr "" -"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " -"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" #: ../../howto/gdb_helpers.rst:189 msgid "" @@ -461,8 +465,8 @@ msgid "" "(if any) for the current frame in the selected thread. The current line is " "marked with a \">\"::" msgstr "" -"該擴充功能新增了一個 ``py-list`` 命令,該命令列出了所選執行緒中當前 frame 的 " -"Python 原始程式碼(如果有)。當前的列會標有 \">\": ::" +"該擴充功能新增了一個 ``py-list`` 命令,該命令列出了所選執行緒中目前 frame 的 " +"Python 原始程式碼(如果有)。目前的列會標有 \">\": ::" #: ../../howto/gdb_helpers.rst:216 msgid "" @@ -803,7 +807,7 @@ msgid "" "looks in locals within the current thread, then globals, then finally " "builtins::" msgstr "" -"``py-print`` 命令查找 Python 名稱並嘗試列印它。它在當前執行緒中尋找局部變數," +"``py-print`` 命令查找 Python 名稱並嘗試列印它。它在目前執行緒中尋找局部變數," "然後是全域變數,最後是內建變數: ::" #: ../../howto/gdb_helpers.rst:346 @@ -843,7 +847,7 @@ msgid "" "The ``py-locals`` command looks up all Python locals within the current " "Python frame in the selected thread, and prints their representations::" msgstr "" -"``py-locals`` 命令尋找所選執行緒中當前 Python frame 內的所有 Python 局部變" +"``py-locals`` 命令尋找所選執行緒中目前 Python frame 內的所有 Python 局部變" "數,並列印它們的表示: ::" #: ../../howto/gdb_helpers.rst:365 diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 69bef65056..b4124f004d 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-07-20 16:09+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,7 +53,7 @@ msgstr "" #: ../../howto/ipaddress.rst:24 msgid "Creating Address/Network/Interface objects" -msgstr "" +msgstr "建立 Address/Network/Interface 物件" #: ../../howto/ipaddress.rst:26 msgid "" @@ -146,8 +145,8 @@ msgstr "定義網路" #: ../../howto/ipaddress.rst:84 msgid "" -"Host addresses are usually grouped together into IP networks, so :mod:" -"`ipaddress` provides a way to create, inspect and manipulate network " +"Host addresses are usually grouped together into IP networks, " +"so :mod:`ipaddress` provides a way to create, inspect and manipulate network " "definitions. IP network objects are constructed from strings that define the " "range of host addresses that are part of that network. The simplest form for " "that information is a \"network address/network prefix\" pair, where the " @@ -243,11 +242,11 @@ msgid "" "network, neither the address nor the network classes are sufficient. " "Notation like ``192.0.2.1/24`` is commonly used by network engineers and the " "people who write tools for firewalls and routers as shorthand for \"the host " -"``192.0.2.1`` on the network ``192.0.2.0/24``\", Accordingly, :mod:" -"`ipaddress` provides a set of hybrid classes that associate an address with " -"a particular network. The interface for creation is identical to that for " -"defining network objects, except that the address portion isn't constrained " -"to being a network address." +"``192.0.2.1`` on the network ``192.0.2.0/24``\", " +"Accordingly, :mod:`ipaddress` provides a set of hybrid classes that " +"associate an address with a particular network. The interface for creation " +"is identical to that for defining network objects, except that the address " +"portion isn't constrained to being a network address." msgstr "" #: ../../howto/ipaddress.rst:152 @@ -258,13 +257,13 @@ msgstr "" #: ../../howto/ipaddress.rst:157 msgid "Inspecting Address/Network/Interface Objects" -msgstr "" +msgstr "檢視 Address/Network/Interface 物件" #: ../../howto/ipaddress.rst:159 msgid "" "You've gone to the trouble of creating an IPv(4|6)(Address|Network|" -"Interface) object, so you probably want to get information about it. :mod:" -"`ipaddress` tries to make doing this easy and intuitive." +"Interface) object, so you probably want to get information about " +"it. :mod:`ipaddress` tries to make doing this easy and intuitive." msgstr "" #: ../../howto/ipaddress.rst:163 @@ -335,7 +334,7 @@ msgstr "" msgid "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" -"... print(x) \n" +"... print(x)\n" "192.0.2.1\n" "192.0.2.2\n" "192.0.2.3\n" @@ -347,7 +346,7 @@ msgid "" msgstr "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" -"... print(x) \n" +"... print(x)\n" "192.0.2.1\n" "192.0.2.2\n" "192.0.2.3\n" @@ -436,6 +435,8 @@ msgid "" "if address in network:\n" " # do something" msgstr "" +"if address in network:\n" +" # 做某些事情" #: ../../howto/ipaddress.rst:259 msgid "Containment testing is done efficiently based on the network prefix::" @@ -457,7 +458,7 @@ msgstr "" #: ../../howto/ipaddress.rst:269 msgid "Comparisons" -msgstr "" +msgstr "比較" #: ../../howto/ipaddress.rst:271 msgid "" @@ -521,9 +522,9 @@ msgstr "" #: ../../howto/ipaddress.rst:305 msgid "" "To support use cases where it is useful to have access to this additional " -"detail, the individual class constructors actually raise the :exc:" -"`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:" -"`ipaddress.NetmaskValueError` to indicate exactly which part of the " +"detail, the individual class constructors actually raise " +"the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` " +"and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the " "definition failed to parse correctly." msgstr "" @@ -587,3 +588,7 @@ msgid "" "except ValueError:\n" " print('address/netmask is invalid for IPv4:', address)" msgstr "" +"try:\n" +" network = ipaddress.IPv4Network(address)\n" +"except ValueError:\n" +" print('address/netmask is invalid for IPv4:', address)" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 340d2075f3..725f48933a 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-08 00:13+0000\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,8 +68,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\n" @@ -100,8 +100,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = logging.getLogger('spam_application.auxiliary." -"Auxiliary')\n" +" self.logger = " +"logging.getLogger('spam_application.auxiliary.Auxiliary')\n" " self.logger.info('creating an instance of Auxiliary')\n" "\n" " def do_something(self):\n" @@ -163,8 +163,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " -"%(threadName)s %(message)s')\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %" +"(threadName)s %(message)s')\n" " info = {'stop': False}\n" " thread = threading.Thread(target=worker, args=(info,))\n" " thread.start()\n" @@ -241,8 +241,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\n" @@ -295,8 +295,8 @@ msgid "" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s " -"%(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s %" +"(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -504,9 +504,9 @@ msgid "" "a function which only returns ``True`` if the level of the passed in record " "is at or below the specified level. Note that in this example I have defined " "the ``filter_maker`` in a test script ``main.py`` that I run from the " -"command line, so its module will be ``__main__`` - hence the ``__main__." -"filter_maker`` in the filter configuration. You will need to change that if " -"you define it in a different module." +"command line, so its module will be ``__main__`` - hence the " +"``__main__.filter_maker`` in the filter configuration. You will need to " +"change that if you define it in a different module." msgstr "" #: ../../howto/logging-cookbook.rst:387 @@ -683,6 +683,22 @@ msgid "" "s.close()\n" "print('complete')" msgstr "" +"#!/usr/bin/env python\n" +"import socket, sys, struct\n" +"\n" +"with open(sys.argv[1], 'rb') as f:\n" +" data_to_send = f.read()\n" +"\n" +"HOST = 'localhost'\n" +"PORT = 9999\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"print('connecting...')\n" +"s.connect((HOST, PORT))\n" +"print('sending config...')\n" +"s.send(struct.pack('>L', len(data_to_send)))\n" +"s.send(data_to_send)\n" +"s.close()\n" +"print('complete')" #: ../../howto/logging-cookbook.rst:547 msgid "Dealing with handlers that block" @@ -697,13 +713,13 @@ msgstr "" #: ../../howto/logging-cookbook.rst:555 msgid "" -"A common culprit which demonstrates sluggish behaviour is the :class:" -"`SMTPHandler`: sending emails can take a long time, for a number of reasons " -"outside the developer's control (for example, a poorly performing mail or " -"network infrastructure). But almost any network-based handler can block: " -"Even a :class:`SocketHandler` operation may do a DNS query under the hood " -"which is too slow (and this query can be deep in the socket library code, " -"below the Python layer, and outside your control)." +"A common culprit which demonstrates sluggish behaviour is " +"the :class:`SMTPHandler`: sending emails can take a long time, for a number " +"of reasons outside the developer's control (for example, a poorly performing " +"mail or network infrastructure). But almost any network-based handler can " +"block: Even a :class:`SocketHandler` operation may do a DNS query under the " +"hood which is too slow (and this query can be deep in the socket library " +"code, below the Python layer, and outside your control)." msgstr "" #: ../../howto/logging-cookbook.rst:563 @@ -723,12 +739,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:574 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " -"designed as the counterpart to :class:`QueueHandler`. A :class:" -"`QueueListener` is very simple: it's passed a queue and some handlers, and " -"it fires up an internal thread which listens to its queue for LogRecords " -"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that " -"matter). The ``LogRecords`` are removed from the queue and passed to the " -"handlers for processing." +"designed as the counterpart to :class:`QueueHandler`. " +"A :class:`QueueListener` is very simple: it's passed a queue and some " +"handlers, and it fires up an internal thread which listens to its queue for " +"LogRecords sent from ``QueueHandlers`` (or any other source of " +"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " +"queue and passed to the handlers for processing." msgstr "" #: ../../howto/logging-cookbook.rst:582 @@ -776,10 +792,10 @@ msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " "logging from async code, network and even file handlers could lead to " -"problems (blocking the event loop) because some logging is done from :mod:" -"`asyncio` internals. It might be best, if any async code is used in an " -"application, to use the above approach for logging, so that any blocking " -"code runs only in the ``QueueListener`` thread." +"problems (blocking the event loop) because some logging is done " +"from :mod:`asyncio` internals. It might be best, if any async code is used " +"in an application, to use the above approach for logging, so that any " +"blocking code runs only in the ``QueueListener`` thread." msgstr "" #: ../../howto/logging-cookbook.rst:619 @@ -801,8 +817,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:634 msgid "" "Let's say you want to send logging events across a network, and handle them " -"at the receiving end. A simple way of doing this is attaching a :class:" -"`SocketHandler` instance to the root logger at the sending end::" +"at the receiving end. A simple way of doing this is attaching " +"a :class:`SocketHandler` instance to the root logger at the sending end::" msgstr "" #: ../../howto/logging-cookbook.rst:638 @@ -835,8 +851,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:662 msgid "" -"At the receiving end, you can set up a receiver using the :mod:" -"`socketserver` module. Here is a basic working example::" +"At the receiving end, you can set up a receiver using " +"the :mod:`socketserver` module. Here is a basic working example::" msgstr "" #: ../../howto/logging-cookbook.rst:665 @@ -920,8 +936,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " -"%(message)s')\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %" +"(message)s')\n" " tcpserver = LogRecordSocketReceiver()\n" " print('About to start TCP server...')\n" " tcpserver.serve_until_stopped()\n" @@ -1054,8 +1070,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:811 msgid "" -"Download `the Gist `__ as a ZIP archive using the :" -"guilabel:`Download ZIP` button." +"Download `the Gist `__ as a ZIP archive using " +"the :guilabel:`Download ZIP` button." msgstr "" #: ../../howto/logging-cookbook.rst:814 @@ -1102,11 +1118,32 @@ msgid "" "configured ports clash with something else in your test environment." msgstr "" -#: ../../howto/logging-cookbook.rst:843 +#: ../../howto/logging-cookbook.rst:838 +msgid "" +"The default configuration uses a TCP socket on port 9020. You can use a Unix " +"Domain socket instead of a TCP socket by doing the following:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:841 +msgid "" +"In :file:`listener.json`, add a ``socket`` key with the path to the domain " +"socket you want to use. If this key is present, the listener listens on the " +"corresponding domain socket and not on a TCP socket (the ``port`` key is " +"ignored)." +msgstr "" + +#: ../../howto/logging-cookbook.rst:846 +msgid "" +"In :file:`webapp.json`, change the socket handler configuration dictionary " +"so that the ``host`` value is the path to the domain socket, and set the " +"``port`` value to ``null``." +msgstr "" + +#: ../../howto/logging-cookbook.rst:856 msgid "Adding contextual information to your logging output" msgstr "" -#: ../../howto/logging-cookbook.rst:845 +#: ../../howto/logging-cookbook.rst:858 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -1118,37 +1155,37 @@ msgid "" "is not a good idea because these instances are not garbage collected. While " "this is not a problem in practice, when the number of :class:`Logger` " "instances is dependent on the level of granularity you want to use in " -"logging an application, it could be hard to manage if the number of :class:" -"`Logger` instances becomes effectively unbounded." +"logging an application, it could be hard to manage if the number " +"of :class:`Logger` instances becomes effectively unbounded." msgstr "" -#: ../../howto/logging-cookbook.rst:860 +#: ../../howto/logging-cookbook.rst:873 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:862 +#: ../../howto/logging-cookbook.rst:875 msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " -"This class is designed to look like a :class:`Logger`, so that you can call :" -"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:" -"`exception`, :meth:`critical` and :meth:`log`. These methods have the same " -"signatures as their counterparts in :class:`Logger`, so you can use the two " -"types of instances interchangeably." +"This class is designed to look like a :class:`Logger`, so that you can " +"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " +"and :meth:`log`. These methods have the same signatures as their " +"counterparts in :class:`Logger`, so you can use the two types of instances " +"interchangeably." msgstr "" -#: ../../howto/logging-cookbook.rst:870 +#: ../../howto/logging-cookbook.rst:883 msgid "" -"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" -"`Logger` instance and a dict-like object which contains your contextual " -"information. When you call one of the logging methods on an instance of :" -"class:`LoggerAdapter`, it delegates the call to the underlying instance of :" -"class:`Logger` passed to its constructor, and arranges to pass the " -"contextual information in the delegated call. Here's a snippet from the code " -"of :class:`LoggerAdapter`::" +"When you create an instance of :class:`LoggerAdapter`, you pass it " +"a :class:`Logger` instance and a dict-like object which contains your " +"contextual information. When you call one of the logging methods on an " +"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " +"instance of :class:`Logger` passed to its constructor, and arranges to pass " +"the contextual information in the delegated call. Here's a snippet from the " +"code of :class:`LoggerAdapter`::" msgstr "" -#: ../../howto/logging-cookbook.rst:878 +#: ../../howto/logging-cookbook.rst:891 msgid "" "def debug(self, msg, /, *args, **kwargs):\n" " \"\"\"\n" @@ -1159,7 +1196,7 @@ msgid "" " self.logger.debug(msg, *args, **kwargs)" msgstr "" -#: ../../howto/logging-cookbook.rst:886 +#: ../../howto/logging-cookbook.rst:899 msgid "" "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " "the contextual information is added to the logging output. It's passed the " @@ -1172,18 +1209,19 @@ msgid "" "be silently overwritten." msgstr "" -#: ../../howto/logging-cookbook.rst:895 +#: ../../howto/logging-cookbook.rst:908 msgid "" "The advantage of using 'extra' is that the values in the dict-like object " "are merged into the :class:`LogRecord` instance's __dict__, allowing you to " "use customized strings with your :class:`Formatter` instances which know " "about the keys of the dict-like object. If you need a different method, e.g. " "if you want to prepend or append the contextual information to the message " -"string, you just need to subclass :class:`LoggerAdapter` and override :meth:" -"`~LoggerAdapter.process` to do what you need. Here is a simple example::" +"string, you just need to subclass :class:`LoggerAdapter` and " +"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " +"simple example::" msgstr "" -#: ../../howto/logging-cookbook.rst:903 +#: ../../howto/logging-cookbook.rst:916 msgid "" "class CustomAdapter(logging.LoggerAdapter):\n" " \"\"\"\n" @@ -1194,27 +1232,27 @@ msgid "" " return '[%s] %s' % (self.extra['connid'], msg), kwargs" msgstr "" -#: ../../howto/logging-cookbook.rst:911 +#: ../../howto/logging-cookbook.rst:924 msgid "which you can use like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:913 +#: ../../howto/logging-cookbook.rst:926 msgid "" "logger = logging.getLogger(__name__)\n" "adapter = CustomAdapter(logger, {'connid': some_conn_id})" msgstr "" -#: ../../howto/logging-cookbook.rst:916 +#: ../../howto/logging-cookbook.rst:929 msgid "" "Then any events that you log to the adapter will have the value of " "``some_conn_id`` prepended to the log messages." msgstr "" -#: ../../howto/logging-cookbook.rst:920 +#: ../../howto/logging-cookbook.rst:933 msgid "Using objects other than dicts to pass contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:922 +#: ../../howto/logging-cookbook.rst:935 msgid "" "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " "could pass an instance of a class which implements ``__getitem__`` and " @@ -1223,32 +1261,32 @@ msgid "" "would be constant)." msgstr "" -#: ../../howto/logging-cookbook.rst:931 +#: ../../howto/logging-cookbook.rst:944 msgid "Using Filters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:933 +#: ../../howto/logging-cookbook.rst:946 msgid "" -"You can also add contextual information to log output using a user-defined :" -"class:`Filter`. ``Filter`` instances are allowed to modify the " +"You can also add contextual information to log output using a user-" +"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " "``LogRecords`` passed to them, including adding additional attributes which " -"can then be output using a suitable format string, or if needed a custom :" -"class:`Formatter`." +"can then be output using a suitable format string, or if needed a " +"custom :class:`Formatter`." msgstr "" -#: ../../howto/logging-cookbook.rst:938 +#: ../../howto/logging-cookbook.rst:951 msgid "" "For example in a web application, the request being processed (or at least, " -"the interesting parts of it) can be stored in a threadlocal (:class:" -"`threading.local`) variable, and then accessed from a ``Filter`` to add, " -"say, information from the request - say, the remote IP address and remote " -"user's username - to the ``LogRecord``, using the attribute names 'ip' and " -"'user' as in the ``LoggerAdapter`` example above. In that case, the same " -"format string can be used to get similar output to that shown above. Here's " -"an example script::" +"the interesting parts of it) can be stored in a threadlocal " +"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " +"add, say, information from the request - say, the remote IP address and " +"remote user's username - to the ``LogRecord``, using the attribute names " +"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " +"same format string can be used to get similar output to that shown above. " +"Here's an example script::" msgstr "" -#: ../../howto/logging-cookbook.rst:947 +#: ../../howto/logging-cookbook.rst:960 msgid "" "import logging\n" "from random import choice\n" @@ -1291,11 +1329,11 @@ msgid "" "'parameters')" msgstr "" -#: ../../howto/logging-cookbook.rst:984 +#: ../../howto/logging-cookbook.rst:997 msgid "which, when run, produces something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:986 +#: ../../howto/logging-cookbook.rst:999 msgid "" "2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " "debug message\n" @@ -1323,11 +1361,11 @@ msgid "" "message at INFO level with 2 parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:1002 +#: ../../howto/logging-cookbook.rst:1015 msgid "Use of ``contextvars``" msgstr "" -#: ../../howto/logging-cookbook.rst:1004 +#: ../../howto/logging-cookbook.rst:1017 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -1337,7 +1375,7 @@ msgid "" "attributes handled by web applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1010 +#: ../../howto/logging-cookbook.rst:1023 msgid "" "For the purposes of illustration, say that you have different web " "applications, each independent of the other but running in the same Python " @@ -1348,11 +1386,11 @@ msgid "" "information such as client IP, HTTP request method and client username?" msgstr "" -#: ../../howto/logging-cookbook.rst:1017 +#: ../../howto/logging-cookbook.rst:1030 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" -#: ../../howto/logging-cookbook.rst:1019 +#: ../../howto/logging-cookbook.rst:1032 msgid "" "# webapplib.py\n" "import logging\n" @@ -1367,14 +1405,14 @@ msgid "" " time.sleep(0.01)" msgstr "" -#: ../../howto/logging-cookbook.rst:1033 +#: ../../howto/logging-cookbook.rst:1046 msgid "" "We can simulate the multiple web applications by means of two simple " "classes, ``Request`` and ``WebApp``. These simulate how real threaded web " "applications work - each request is handled by a thread:" msgstr "" -#: ../../howto/logging-cookbook.rst:1037 +#: ../../howto/logging-cookbook.rst:1050 msgid "" "# main.py\n" "import argparse\n" @@ -1402,8 +1440,8 @@ msgid "" "\n" "# A dummy set of requests which will be used in the simulation - we'll just " "pick\n" -"# from this list randomly. Note that all GET requests are from 192.168.2." -"XXX\n" +"# from this list randomly. Note that all GET requests are from " +"192.168.2.XXX\n" "# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " "users\n" "# are represented in the sample requests.\n" @@ -1421,8 +1459,8 @@ msgid "" "information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " -"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" +"(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" "# Create our context variables. These will be filled at the start of " "request\n" @@ -1529,7 +1567,7 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1177 +#: ../../howto/logging-cookbook.rst:1190 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -1540,7 +1578,7 @@ msgid "" "illustrated by the following shell output:" msgstr "" -#: ../../howto/logging-cookbook.rst:1184 +#: ../../howto/logging-cookbook.rst:1197 msgid "" "~/logging-contextual-webapp$ python main.py\n" "app1 processed 51 requests\n" @@ -1595,11 +1633,11 @@ msgid "" "147" msgstr "" -#: ../../howto/logging-cookbook.rst:1224 +#: ../../howto/logging-cookbook.rst:1237 msgid "Imparting contextual information in handlers" msgstr "" -#: ../../howto/logging-cookbook.rst:1226 +#: ../../howto/logging-cookbook.rst:1239 msgid "" "Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " @@ -1607,7 +1645,7 @@ msgid "" "instead of modifying it in-place, as shown in the following script::" msgstr "" -#: ../../howto/logging-cookbook.rst:1231 +#: ../../howto/logging-cookbook.rst:1244 msgid "" "import copy\n" "import logging\n" @@ -1628,12 +1666,30 @@ msgid "" "\n" " logger.info('A log message')" msgstr "" +"import copy\n" +"import logging\n" +"\n" +"def filter(record: logging.LogRecord):\n" +" record = copy.copy(record)\n" +" record.user = 'jim'\n" +" return record\n" +"\n" +"if __name__ == '__main__':\n" +" logger = logging.getLogger()\n" +" logger.setLevel(logging.INFO)\n" +" handler = logging.StreamHandler()\n" +" formatter = logging.Formatter('%(message)s from %(user)-8s')\n" +" handler.setFormatter(formatter)\n" +" handler.addFilter(filter)\n" +" logger.addHandler(handler)\n" +"\n" +" logger.info('A log message')" -#: ../../howto/logging-cookbook.rst:1253 +#: ../../howto/logging-cookbook.rst:1266 msgid "Logging to a single file from multiple processes" msgstr "" -#: ../../howto/logging-cookbook.rst:1255 +#: ../../howto/logging-cookbook.rst:1268 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -1643,21 +1699,22 @@ msgid "" "this is to have all the processes log to a :class:`~handlers.SocketHandler`, " "and have a separate process which implements a socket server which reads " "from the socket and logs to file. (If you prefer, you can dedicate one " -"thread in one of the existing processes to perform this function.) :ref:" -"`This section ` documents this approach in more detail and " -"includes a working socket receiver which can be used as a starting point for " -"you to adapt in your own applications." +"thread in one of the existing processes to perform this " +"function.) :ref:`This section ` documents this approach in " +"more detail and includes a working socket receiver which can be used as a " +"starting point for you to adapt in your own applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1268 +#: ../../howto/logging-cookbook.rst:1281 msgid "" -"You could also write your own handler which uses the :class:" -"`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " -"serialize access to the file from your processes. The stdlib :class:" -"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." +"You could also write your own handler which uses " +"the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` " +"module to serialize access to the file from your processes. The " +"stdlib :class:`FileHandler` and subclasses do not make use " +"of :mod:`multiprocessing`." msgstr "" -#: ../../howto/logging-cookbook.rst:1275 +#: ../../howto/logging-cookbook.rst:1288 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -1672,7 +1729,7 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1286 +#: ../../howto/logging-cookbook.rst:1299 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -1705,8 +1762,8 @@ msgid "" "def listener_configurer():\n" " root = logging.getLogger()\n" " h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" -" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " -"%(levelname)-8s %(message)s')\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" +"(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -1792,13 +1849,13 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1391 +#: ../../howto/logging-cookbook.rst:1404 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1394 +#: ../../howto/logging-cookbook.rst:1407 msgid "" "import logging\n" "import logging.config\n" @@ -1838,8 +1895,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -1895,7 +1952,7 @@ msgid "" " lp.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1486 +#: ../../howto/logging-cookbook.rst:1499 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -1905,36 +1962,36 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1493 +#: ../../howto/logging-cookbook.rst:1506 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "使用 concurrent.futures.ProcessPoolExecutor" -#: ../../howto/logging-cookbook.rst:1495 +#: ../../howto/logging-cookbook.rst:1508 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1499 +#: ../../howto/logging-cookbook.rst:1512 msgid "queue = multiprocessing.Queue(-1)" msgstr "queue = multiprocessing.Queue(-1)" -#: ../../howto/logging-cookbook.rst:1503 +#: ../../howto/logging-cookbook.rst:1516 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1505 +#: ../../howto/logging-cookbook.rst:1518 msgid "" "queue = multiprocessing.Manager().Queue(-1) # also works with the examples " "above" msgstr "" -#: ../../howto/logging-cookbook.rst:1509 +#: ../../howto/logging-cookbook.rst:1522 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1511 +#: ../../howto/logging-cookbook.rst:1524 msgid "" "workers = []\n" "for i in range(10):\n" @@ -1946,22 +2003,22 @@ msgid "" " w.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1520 +#: ../../howto/logging-cookbook.rst:1533 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1522 +#: ../../howto/logging-cookbook.rst:1535 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" -#: ../../howto/logging-cookbook.rst:1527 +#: ../../howto/logging-cookbook.rst:1540 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1529 +#: ../../howto/logging-cookbook.rst:1542 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -1973,11 +2030,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1539 +#: ../../howto/logging-cookbook.rst:1552 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1544 +#: ../../howto/logging-cookbook.rst:1557 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -1986,7 +2043,7 @@ msgid "" "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1550 +#: ../../howto/logging-cookbook.rst:1563 msgid "" "import glob\n" "import logging\n" @@ -2015,13 +2072,13 @@ msgid "" " print(filename)" msgstr "" -#: ../../howto/logging-cookbook.rst:1576 +#: ../../howto/logging-cookbook.rst:1589 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1579 +#: ../../howto/logging-cookbook.rst:1592 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2031,7 +2088,7 @@ msgid "" "logging_rotatingfile_example.out.5" msgstr "" -#: ../../howto/logging-cookbook.rst:1588 +#: ../../howto/logging-cookbook.rst:1601 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -2039,26 +2096,26 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1593 +#: ../../howto/logging-cookbook.rst:1606 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1601 +#: ../../howto/logging-cookbook.rst:1614 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1603 +#: ../../howto/logging-cookbook.rst:1616 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " -"method. Since then, Python has gained two new formatting approaches: :class:" -"`string.Template` (added in Python 2.4) and :meth:`str.format` (added in " -"Python 2.6)." +"method. Since then, Python has gained two new formatting " +"approaches: :class:`string.Template` (added in Python 2.4) " +"and :meth:`str.format` (added in Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1609 +#: ../../howto/logging-cookbook.rst:1622 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -2066,12 +2123,12 @@ msgid "" "``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " "to the other two formatting styles. Backwards compatibility is maintained by " "default (as you would expect), but by explicitly specifying a style " -"parameter, you get the ability to specify format strings which work with :" -"meth:`str.format` or :class:`string.Template`. Here's an example console " -"session to show the possibilities:" +"parameter, you get the ability to specify format strings which work " +"with :meth:`str.format` or :class:`string.Template`. Here's an example " +"console session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1619 +#: ../../howto/logging-cookbook.rst:1632 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2096,21 +2153,21 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1643 +#: ../../howto/logging-cookbook.rst:1656 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1647 +#: ../../howto/logging-cookbook.rst:1660 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1651 +#: ../../howto/logging-cookbook.rst:1664 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -2118,15 +2175,15 @@ msgid "" "logging call (e.g. the ``exc_info`` keyword parameter to indicate that " "traceback information should be logged, or the ``extra`` keyword parameter " "to indicate additional contextual information to be added to the log). So " -"you cannot directly make logging calls using :meth:`str.format` or :class:" -"`string.Template` syntax, because internally the logging package uses %-" -"formatting to merge the format string and the variable arguments. There " -"would be no changing this while preserving backward compatibility, since all " -"logging calls which are out there in existing code will be using %-format " -"strings." +"you cannot directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1664 +#: ../../howto/logging-cookbook.rst:1677 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -2135,7 +2192,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1670 ../../howto/logging-cookbook.rst:2758 +#: ../../howto/logging-cookbook.rst:1683 ../../howto/logging-cookbook.rst:2771 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -2173,7 +2230,7 @@ msgstr "" " from string import Template\n" " return Template(self.fmt).substitute(**self.kwargs)" -#: ../../howto/logging-cookbook.rst:1688 +#: ../../howto/logging-cookbook.rst:1701 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -2184,14 +2241,14 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1696 +#: ../../howto/logging-cookbook.rst:1709 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1700 +#: ../../howto/logging-cookbook.rst:1713 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -2210,14 +2267,14 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1718 +#: ../../howto/logging-cookbook.rst:1731 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1722 +#: ../../howto/logging-cookbook.rst:1735 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -2228,13 +2285,13 @@ msgid "" "sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1730 +#: ../../howto/logging-cookbook.rst:1743 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1733 +#: ../../howto/logging-cookbook.rst:1746 msgid "" "import logging\n" "\n" @@ -2263,63 +2320,64 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1759 +#: ../../howto/logging-cookbook.rst:1772 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.8 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1768 +#: ../../howto/logging-cookbook.rst:1781 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1770 +#: ../../howto/logging-cookbook.rst:1783 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " -"event is logged and not filtered out by a logger's level, a :class:" -"`LogRecord` is created, populated with information about the event and then " -"passed to the handlers for that logger (and its ancestors, up to and " -"including the logger where further propagation up the hierarchy is " +"event is logged and not filtered out by a logger's level, " +"a :class:`LogRecord` is created, populated with information about the event " +"and then passed to the handlers for that logger (and its ancestors, up to " +"and including the logger where further propagation up the hierarchy is " "disabled). Before Python 3.2, there were only two places where this creation " "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1777 +#: ../../howto/logging-cookbook.rst:1790 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1780 +#: ../../howto/logging-cookbook.rst:1793 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " "suitable dictionary has been received over the network (e.g. in pickle form " -"via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:" -"`~handlers.HTTPHandler`)." +"via a :class:`~handlers.SocketHandler`, or in JSON form via " +"an :class:`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1786 +#: ../../howto/logging-cookbook.rst:1799 msgid "" -"This has usually meant that if you need to do anything special with a :class:" -"`LogRecord`, you've had to do one of the following." +"This has usually meant that if you need to do anything special with " +"a :class:`LogRecord`, you've had to do one of the following." msgstr "" -#: ../../howto/logging-cookbook.rst:1789 +#: ../../howto/logging-cookbook.rst:1802 msgid "" -"Create your own :class:`Logger` subclass, which overrides :meth:`Logger." -"makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " -"loggers that you care about are instantiated." +"Create your own :class:`Logger` subclass, which " +"overrides :meth:`Logger.makeRecord`, and set it " +"using :func:`~logging.setLoggerClass` before any loggers that you care about " +"are instantiated." msgstr "" -#: ../../howto/logging-cookbook.rst:1792 +#: ../../howto/logging-cookbook.rst:1805 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1796 +#: ../../howto/logging-cookbook.rst:1809 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -2327,7 +2385,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1801 +#: ../../howto/logging-cookbook.rst:1814 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -2336,11 +2394,11 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1807 +#: ../../howto/logging-cookbook.rst:1820 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging-cookbook.rst:1809 +#: ../../howto/logging-cookbook.rst:1822 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -2350,17 +2408,17 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1815 +#: ../../howto/logging-cookbook.rst:1828 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " -"can set with :func:`~logging.setLogRecordFactory`, and interrogate with :" -"func:`~logging.getLogRecordFactory`. The factory is invoked with the same " -"signature as the :class:`~logging.LogRecord` constructor, as :class:" -"`LogRecord` is the default setting for the factory." +"can set with :func:`~logging.setLogRecordFactory`, and interrogate " +"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " +"same signature as the :class:`~logging.LogRecord` constructor, " +"as :class:`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1822 +#: ../../howto/logging-cookbook.rst:1835 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -2368,7 +2426,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1826 +#: ../../howto/logging-cookbook.rst:1839 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -2380,7 +2438,7 @@ msgid "" "logging.setLogRecordFactory(record_factory)" msgstr "" -#: ../../howto/logging-cookbook.rst:1835 +#: ../../howto/logging-cookbook.rst:1848 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -2390,22 +2448,22 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1847 +#: ../../howto/logging-cookbook.rst:1860 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1850 ../../howto/logging-cookbook.rst:1983 +#: ../../howto/logging-cookbook.rst:1863 ../../howto/logging-cookbook.rst:1996 msgid "Subclass ``QueueHandler``" msgstr "" -#: ../../howto/logging-cookbook.rst:1852 +#: ../../howto/logging-cookbook.rst:1865 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1856 +#: ../../howto/logging-cookbook.rst:1869 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -2422,13 +2480,13 @@ msgid "" "handler = ZeroMQSocketHandler(sock)" msgstr "" -#: ../../howto/logging-cookbook.rst:1871 +#: ../../howto/logging-cookbook.rst:1884 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1874 +#: ../../howto/logging-cookbook.rst:1887 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -2444,17 +2502,17 @@ msgid "" " self.queue.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:1889 ../../howto/logging-cookbook.rst:1919 +#: ../../howto/logging-cookbook.rst:1902 ../../howto/logging-cookbook.rst:1932 msgid "Subclass ``QueueListener``" msgstr "" -#: ../../howto/logging-cookbook.rst:1891 +#: ../../howto/logging-cookbook.rst:1904 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1894 +#: ../../howto/logging-cookbook.rst:1907 msgid "" "class ZeroMQSocketListener(QueueListener):\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" @@ -2470,20 +2528,20 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" -#: ../../howto/logging-cookbook.rst:1909 +#: ../../howto/logging-cookbook.rst:1922 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" msgstr "" -#: ../../howto/logging-cookbook.rst:1911 +#: ../../howto/logging-cookbook.rst:1924 msgid "" "In a similar way to the above section, we can implement a listener and " -"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The following " -"snippets illustrate -- you can test them in an environment which has " -"``pynng`` installed. Just for variety, we present the listener first." +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The " +"following snippets illustrate -- you can test them in an environment which " +"has ``pynng`` installed. Just for variety, we present the listener first." msgstr "" -#: ../../howto/logging-cookbook.rst:1921 +#: ../../howto/logging-cookbook.rst:1934 msgid "" "# listener.py\n" "import json\n" @@ -2545,7 +2603,7 @@ msgid "" " listener.stop()" msgstr "" -#: ../../howto/logging-cookbook.rst:1987 +#: ../../howto/logging-cookbook.rst:2000 msgid "" "# sender.py\n" "import json\n" @@ -2578,8 +2636,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s " -"%(message)s')\n" +" format='%(levelname)-8s %(name)10s %(process)6s %" +"(message)s')\n" "levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" " logging.CRITICAL)\n" "logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" @@ -2594,14 +2652,14 @@ msgid "" " time.sleep(delay)" msgstr "" -#: ../../howto/logging-cookbook.rst:2034 +#: ../../howto/logging-cookbook.rst:2047 msgid "" "You can run the above two snippets in separate command shells. If we run the " "listener in one shell and run the sender in two separate shells, we should " "see something like the following. In the first sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2038 +#: ../../howto/logging-cookbook.rst:2051 msgid "" "$ python sender.py\n" "DEBUG myapp 613 Message no. 1\n" @@ -2615,11 +2673,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2051 +#: ../../howto/logging-cookbook.rst:2064 msgid "In the second sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2053 +#: ../../howto/logging-cookbook.rst:2066 msgid "" "$ python sender.py\n" "INFO myapp.lib2 657 Message no. 1\n" @@ -2633,11 +2691,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2066 +#: ../../howto/logging-cookbook.rst:2079 msgid "In the listener shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2068 +#: ../../howto/logging-cookbook.rst:2081 msgid "" "$ python listener.py\n" "Press Ctrl-C to stop.\n" @@ -2660,25 +2718,25 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2090 +#: ../../howto/logging-cookbook.rst:2103 msgid "" "As you can see, the logging from the two sender processes is interleaved in " "the listener's output." msgstr "" -#: ../../howto/logging-cookbook.rst:2095 +#: ../../howto/logging-cookbook.rst:2108 msgid "An example dictionary-based configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:2097 +#: ../../howto/logging-cookbook.rst:2110 msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_. This dictionary is passed to :" -"func:`~config.dictConfig` to put the configuration into effect::" +"stable/topics/logging/#configuring-logging>`_. This dictionary is passed " +"to :func:`~config.dictConfig` to put the configuration into effect::" msgstr "" -#: ../../howto/logging-cookbook.rst:2101 +#: ../../howto/logging-cookbook.rst:2114 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -2780,24 +2838,24 @@ msgstr "" " }\n" "}" -#: ../../howto/logging-cookbook.rst:2150 +#: ../../howto/logging-cookbook.rst:2163 msgid "" "For more information about this configuration, you can see the `relevant " "section `_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:2157 +#: ../../howto/logging-cookbook.rst:2170 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:2159 +#: ../../howto/logging-cookbook.rst:2172 msgid "" "An example of how you can define a namer and rotator is given in the " "following runnable script, which shows gzip compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:2162 +#: ../../howto/logging-cookbook.rst:2175 msgid "" "import gzip\n" "import logging\n" @@ -2857,12 +2915,12 @@ msgstr "" "for i in range(1000):\n" " root.info(f'Message no. {i + 1}')" -#: ../../howto/logging-cookbook.rst:2190 +#: ../../howto/logging-cookbook.rst:2203 msgid "" "After running this, you will see six new files, five of which are compressed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2192 +#: ../../howto/logging-cookbook.rst:2205 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -2880,11 +2938,11 @@ msgstr "" "2023-01-20 02:28:17,767 Message no. 997\n" "2023-01-20 02:28:17,767 Message no. 998" -#: ../../howto/logging-cookbook.rst:2203 +#: ../../howto/logging-cookbook.rst:2216 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:2205 +#: ../../howto/logging-cookbook.rst:2218 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -2892,7 +2950,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2210 +#: ../../howto/logging-cookbook.rst:2223 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -2905,13 +2963,13 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2220 +#: ../../howto/logging-cookbook.rst:2233 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:2223 +#: ../../howto/logging-cookbook.rst:2236 msgid "" "import logging\n" "import logging.config\n" @@ -3056,13 +3114,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " -"%(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" +"(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -3134,11 +3192,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2432 +#: ../../howto/logging-cookbook.rst:2445 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:2434 +#: ../../howto/logging-cookbook.rst:2447 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -3147,7 +3205,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2440 +#: ../../howto/logging-cookbook.rst:2453 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -3155,7 +3213,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:2446 +#: ../../howto/logging-cookbook.rst:2459 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -3164,37 +3222,38 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:2452 +#: ../../howto/logging-cookbook.rst:2465 msgid "" -"Attach a :class:`~logging.Formatter` instance to your :class:`~logging." -"handlers.SysLogHandler` instance, with a format string such as::" +"Attach a :class:`~logging.Formatter` instance to " +"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " +"such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2456 +#: ../../howto/logging-cookbook.rst:2469 msgid "'ASCII section\\ufeffUnicode section'" msgstr "" -#: ../../howto/logging-cookbook.rst:2458 +#: ../../howto/logging-cookbook.rst:2471 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2461 +#: ../../howto/logging-cookbook.rst:2474 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2465 +#: ../../howto/logging-cookbook.rst:2478 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2469 +#: ../../howto/logging-cookbook.rst:2482 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -3203,11 +3262,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2476 +#: ../../howto/logging-cookbook.rst:2489 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2478 +#: ../../howto/logging-cookbook.rst:2491 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -3219,7 +3278,7 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2486 +#: ../../howto/logging-cookbook.rst:2499 msgid "" "import json\n" "import logging\n" @@ -3238,11 +3297,11 @@ msgid "" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" -#: ../../howto/logging-cookbook.rst:2502 +#: ../../howto/logging-cookbook.rst:2515 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2504 +#: ../../howto/logging-cookbook.rst:2517 msgid "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" @@ -3250,19 +3309,19 @@ msgstr "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" -#: ../../howto/logging-cookbook.rst:2508 ../../howto/logging-cookbook.rst:2550 +#: ../../howto/logging-cookbook.rst:2521 ../../howto/logging-cookbook.rst:2563 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2511 +#: ../../howto/logging-cookbook.rst:2524 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2514 +#: ../../howto/logging-cookbook.rst:2527 msgid "" "import json\n" "import logging\n" @@ -3295,19 +3354,19 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2544 +#: ../../howto/logging-cookbook.rst:2557 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2546 +#: ../../howto/logging-cookbook.rst:2559 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" msgstr "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" -#: ../../howto/logging-cookbook.rst:2559 +#: ../../howto/logging-cookbook.rst:2572 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2561 +#: ../../howto/logging-cookbook.rst:2574 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -3317,7 +3376,7 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2568 +#: ../../howto/logging-cookbook.rst:2581 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -3333,13 +3392,14 @@ msgstr "" " shutil.chown(filename, *owner)\n" " return logging.FileHandler(filename, mode, encoding)" -#: ../../howto/logging-cookbook.rst:2575 +#: ../../howto/logging-cookbook.rst:2588 msgid "" -"You can then specify, in a logging configuration passed to :func:" -"`dictConfig`, that a logging handler be created by calling this function::" +"You can then specify, in a logging configuration passed " +"to :func:`dictConfig`, that a logging handler be created by calling this " +"function::" msgstr "" -#: ../../howto/logging-cookbook.rst:2578 +#: ../../howto/logging-cookbook.rst:2591 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3372,14 +3432,14 @@ msgid "" "}" msgstr "" -#: ../../howto/logging-cookbook.rst:2608 +#: ../../howto/logging-cookbook.rst:2621 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2612 +#: ../../howto/logging-cookbook.rst:2625 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3425,11 +3485,11 @@ msgid "" "logger.debug('A debug message')" msgstr "" -#: ../../howto/logging-cookbook.rst:2655 +#: ../../howto/logging-cookbook.rst:2668 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2657 +#: ../../howto/logging-cookbook.rst:2670 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -3438,34 +3498,34 @@ msgid "" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" -#: ../../howto/logging-cookbook.rst:2665 +#: ../../howto/logging-cookbook.rst:2678 msgid "" -"Note that this example uses Python 3.3 because that's where :func:`shutil." -"chown` makes an appearance. This approach should work with any Python " -"version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. " -"With pre-3.3 versions, you would need to implement the actual ownership " -"change using e.g. :func:`os.chown`." +"Note that this example uses Python 3.3 because that's " +"where :func:`shutil.chown` makes an appearance. This approach should work " +"with any Python version that supports :func:`dictConfig` - namely, Python " +"2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the " +"actual ownership change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2671 +#: ../../howto/logging-cookbook.rst:2684 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2674 +#: ../../howto/logging-cookbook.rst:2687 msgid "'()': owned_file_handler," msgstr "'()': owned_file_handler," -#: ../../howto/logging-cookbook.rst:2676 +#: ../../howto/logging-cookbook.rst:2689 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2678 +#: ../../howto/logging-cookbook.rst:2691 msgid "'()': 'ext://project.util.owned_file_handler'," msgstr "'()': 'ext://project.util.owned_file_handler'," -#: ../../howto/logging-cookbook.rst:2680 +#: ../../howto/logging-cookbook.rst:2693 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -3473,25 +3533,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2685 +#: ../../howto/logging-cookbook.rst:2698 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2689 +#: ../../howto/logging-cookbook.rst:2702 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2699 +#: ../../howto/logging-cookbook.rst:2712 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2701 +#: ../../howto/logging-cookbook.rst:2714 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -3502,7 +3562,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2708 +#: ../../howto/logging-cookbook.rst:2721 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -3510,14 +3570,15 @@ msgid "" "call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " "information should be logged, or the ``extra`` keyword parameter to indicate " "additional contextual information to be added to the log). So you cannot " -"directly make logging calls using :meth:`str.format` or :class:`string." -"Template` syntax, because internally the logging package uses %-formatting " -"to merge the format string and the variable arguments. There would be no " -"changing this while preserving backward compatibility, since all logging " -"calls which are out there in existing code will be using %-format strings." +"directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2720 +#: ../../howto/logging-cookbook.rst:2733 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -3525,7 +3586,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2724 +#: ../../howto/logging-cookbook.rst:2737 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -3533,11 +3594,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2731 +#: ../../howto/logging-cookbook.rst:2744 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2733 +#: ../../howto/logging-cookbook.rst:2746 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -3552,27 +3613,27 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2744 +#: ../../howto/logging-cookbook.rst:2757 msgid "" -"Refer to the reference documentation on :func:`setLogRecordFactory` and :" -"class:`LogRecord` for more information." +"Refer to the reference documentation on :func:`setLogRecordFactory` " +"and :class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2749 +#: ../../howto/logging-cookbook.rst:2762 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2751 +#: ../../howto/logging-cookbook.rst:2764 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " -"to construct your individual log messages. You may recall (from :ref:" -"`arbitrary-object-messages`) that when logging you can use an arbitrary " -"object as a message format string, and that the logging package will call :" -"func:`str` on that object to get the actual format string. Consider the " -"following two classes::" +"to construct your individual log messages. You may recall " +"(from :ref:`arbitrary-object-messages`) that when logging you can use an " +"arbitrary object as a message format string, and that the logging package " +"will call :func:`str` on that object to get the actual format string. " +"Consider the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2776 +#: ../../howto/logging-cookbook.rst:2789 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -3583,13 +3644,13 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2784 +#: ../../howto/logging-cookbook.rst:2797 msgid "" -"Examples of this approach are given below. Firstly, formatting with :meth:" -"`str.format`::" +"Examples of this approach are given below. Firstly, formatting " +"with :meth:`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2787 +#: ../../howto/logging-cookbook.rst:2800 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -3604,11 +3665,11 @@ msgid "" "Message with coordinates: (0.50, 0.50)" msgstr "" -#: ../../howto/logging-cookbook.rst:2798 +#: ../../howto/logging-cookbook.rst:2811 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2800 +#: ../../howto/logging-cookbook.rst:2813 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" @@ -3616,7 +3677,7 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:2805 +#: ../../howto/logging-cookbook.rst:2818 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -3628,26 +3689,26 @@ msgid "" "shown above." msgstr "" -#: ../../howto/logging-cookbook.rst:2819 +#: ../../howto/logging-cookbook.rst:2832 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2821 +#: ../../howto/logging-cookbook.rst:2834 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " "Since :class:`~logging.Filter` is the only filter class included in the " "standard library, and it is unlikely to cater to many requirements (it's " -"only there as a base class), you will typically need to define your own :" -"class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter." -"filter` method. To do this, specify the ``()`` key in the configuration " -"dictionary for the filter, specifying a callable which will be used to " -"create the filter (a class is the most obvious, but you can provide any " -"callable which returns a :class:`~logging.Filter` instance). Here is a " -"complete example::" +"only there as a base class), you will typically need to define your " +"own :class:`~logging.Filter` subclass with an " +"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " +"``()`` key in the configuration dictionary for the filter, specifying a " +"callable which will be used to create the filter (a class is the most " +"obvious, but you can provide any callable which returns " +"a :class:`~logging.Filter` instance). Here is a complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2832 +#: ../../howto/logging-cookbook.rst:2845 msgid "" "import logging\n" "import logging.config\n" @@ -3733,26 +3794,26 @@ msgstr "" " logging.debug('hello')\n" " logging.debug('hello - noshow')" -#: ../../howto/logging-cookbook.rst:2874 +#: ../../howto/logging-cookbook.rst:2887 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2878 +#: ../../howto/logging-cookbook.rst:2891 msgid "changed: hello" msgstr "changed: hello" -#: ../../howto/logging-cookbook.rst:2882 +#: ../../howto/logging-cookbook.rst:2895 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2884 +#: ../../howto/logging-cookbook.rst:2897 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2886 +#: ../../howto/logging-cookbook.rst:2899 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -3762,7 +3823,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2893 +#: ../../howto/logging-cookbook.rst:2906 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -3771,11 +3832,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2902 +#: ../../howto/logging-cookbook.rst:2915 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2904 +#: ../../howto/logging-cookbook.rst:2917 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -3783,7 +3844,7 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2909 +#: ../../howto/logging-cookbook.rst:2922 msgid "" "import logging\n" "\n" @@ -3822,11 +3883,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2945 +#: ../../howto/logging-cookbook.rst:2958 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2947 +#: ../../howto/logging-cookbook.rst:2960 msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " @@ -3840,35 +3901,35 @@ msgstr "" "in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " "zero'|" -#: ../../howto/logging-cookbook.rst:2952 +#: ../../howto/logging-cookbook.rst:2965 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2959 +#: ../../howto/logging-cookbook.rst:2972 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2961 +#: ../../howto/logging-cookbook.rst:2974 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " "you have text-to-speech (TTS) functionality available in your system, even " "if it doesn't have a Python binding. Most TTS systems have a command line " -"program you can run, and this can be invoked from a handler using :mod:" -"`subprocess`. It's assumed here that TTS command line programs won't expect " -"to interact with users or take a long time to complete, and that the " -"frequency of logged messages will be not so high as to swamp the user with " -"messages, and that it's acceptable to have the messages spoken one at a time " -"rather than concurrently, The example implementation below waits for one " -"message to be spoken before the next is processed, and this might cause " -"other handlers to be kept waiting. Here is a short example showing the " +"program you can run, and this can be invoked from a handler " +"using :mod:`subprocess`. It's assumed here that TTS command line programs " +"won't expect to interact with users or take a long time to complete, and " +"that the frequency of logged messages will be not so high as to swamp the " +"user with messages, and that it's acceptable to have the messages spoken one " +"at a time rather than concurrently, The example implementation below waits " +"for one message to be spoken before the next is processed, and this might " +"cause other handlers to be kept waiting. Here is a short example showing the " "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2974 +#: ../../howto/logging-cookbook.rst:2987 msgid "" "import logging\n" "import subprocess\n" @@ -3900,24 +3961,24 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3003 +#: ../../howto/logging-cookbook.rst:3016 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:3005 +#: ../../howto/logging-cookbook.rst:3018 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:3013 +#: ../../howto/logging-cookbook.rst:3026 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:3015 +#: ../../howto/logging-cookbook.rst:3028 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -3927,7 +3988,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:3022 +#: ../../howto/logging-cookbook.rst:3035 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -3940,7 +4001,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:3032 +#: ../../howto/logging-cookbook.rst:3045 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -3949,23 +4010,23 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:3038 +#: ../../howto/logging-cookbook.rst:3051 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " "parameter and attaches a memory handler for the duration of the call to the " "decorated function. The decorator can be additionally parameterised using a " "target handler, a level at which flushing should occur, and a capacity for " -"the buffer (number of records buffered). These default to a :class:`~logging." -"StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` " -"respectively." +"the buffer (number of records buffered). These default to " +"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " +"``logging.ERROR`` and ``100`` respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:3046 +#: ../../howto/logging-cookbook.rst:3059 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:3048 +#: ../../howto/logging-cookbook.rst:3061 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -4031,11 +4092,11 @@ msgid "" " assert decorated_foo(True)" msgstr "" -#: ../../howto/logging-cookbook.rst:3109 +#: ../../howto/logging-cookbook.rst:3122 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:3111 +#: ../../howto/logging-cookbook.rst:3124 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -4064,40 +4125,41 @@ msgid "" "Actually logged at CRITICAL" msgstr "" -#: ../../howto/logging-cookbook.rst:3139 +#: ../../howto/logging-cookbook.rst:3152 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3143 +#: ../../howto/logging-cookbook.rst:3156 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:3145 +#: ../../howto/logging-cookbook.rst:3158 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" -#: ../../howto/logging-cookbook.rst:3153 +#: ../../howto/logging-cookbook.rst:3166 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:3155 +#: ../../howto/logging-cookbook.rst:3168 msgid "" "To illustrate how you can send log messages via email, so that a set number " -"of messages are sent per email, you can subclass :class:`~logging.handlers." -"BufferingHandler`. In the following example, which you can adapt to suit " -"your specific needs, a simple test harness is provided which allows you to " -"run the script with command line arguments specifying what you typically " -"need to send things via SMTP. (Run the downloaded script with the ``-h`` " -"argument to see the required and optional arguments.)" +"of messages are sent per email, you can " +"subclass :class:`~logging.handlers.BufferingHandler`. In the following " +"example, which you can adapt to suit your specific needs, a simple test " +"harness is provided which allows you to run the script with command line " +"arguments specifying what you typically need to send things via SMTP. (Run " +"the downloaded script with the ``-h`` argument to see the required and " +"optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:3163 +#: ../../howto/logging-cookbook.rst:3176 msgid "" "import logging\n" "import logging.handlers\n" @@ -4117,8 +4179,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " -"%(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" +"(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -4165,7 +4227,7 @@ msgid "" " h.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:3227 +#: ../../howto/logging-cookbook.rst:3240 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -4173,17 +4235,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:3235 +#: ../../howto/logging-cookbook.rst:3248 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3237 +#: ../../howto/logging-cookbook.rst:3250 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:3240 +#: ../../howto/logging-cookbook.rst:3253 msgid "" "import logging\n" "import time\n" @@ -4192,15 +4254,15 @@ msgid "" " converter = time.gmtime" msgstr "" -#: ../../howto/logging-cookbook.rst:3246 +#: ../../howto/logging-cookbook.rst:3259 msgid "" -"and you can then use the ``UTCFormatter`` in your code instead of :class:" -"`~logging.Formatter`. If you want to do that via configuration, you can use " -"the :func:`~logging.config.dictConfig` API with an approach illustrated by " -"the following complete example::" +"and you can then use the ``UTCFormatter`` in your code instead " +"of :class:`~logging.Formatter`. If you want to do that via configuration, " +"you can use the :func:`~logging.config.dictConfig` API with an approach " +"illustrated by the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:3251 +#: ../../howto/logging-cookbook.rst:3264 msgid "" "import logging\n" "import logging.config\n" @@ -4241,11 +4303,11 @@ msgid "" " logging.warning('The local time is %s', time.asctime())" msgstr "" -#: ../../howto/logging-cookbook.rst:3289 +#: ../../howto/logging-cookbook.rst:3302 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:3291 +#: ../../howto/logging-cookbook.rst:3304 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" @@ -4253,17 +4315,17 @@ msgstr "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" -#: ../../howto/logging-cookbook.rst:3296 +#: ../../howto/logging-cookbook.rst:3309 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:3303 +#: ../../howto/logging-cookbook.rst:3316 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3305 +#: ../../howto/logging-cookbook.rst:3318 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -4273,7 +4335,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:3312 +#: ../../howto/logging-cookbook.rst:3325 msgid "" "import logging\n" "import sys\n" @@ -4302,7 +4364,7 @@ msgid "" " # implicit return of None => don't swallow exceptions" msgstr "" -#: ../../howto/logging-cookbook.rst:3338 +#: ../../howto/logging-cookbook.rst:3351 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -4311,13 +4373,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:3344 +#: ../../howto/logging-cookbook.rst:3357 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:3347 +#: ../../howto/logging-cookbook.rst:3360 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4337,7 +4399,7 @@ msgid "" " logger.debug('7. This should not appear.')" msgstr "" -#: ../../howto/logging-cookbook.rst:3362 +#: ../../howto/logging-cookbook.rst:3375 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -4350,11 +4412,11 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:3372 +#: ../../howto/logging-cookbook.rst:3385 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:3374 +#: ../../howto/logging-cookbook.rst:3387 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -4364,23 +4426,23 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3383 +#: ../../howto/logging-cookbook.rst:3396 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3386 +#: ../../howto/logging-cookbook.rst:3399 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" -#: ../../howto/logging-cookbook.rst:3391 +#: ../../howto/logging-cookbook.rst:3404 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:3393 +#: ../../howto/logging-cookbook.rst:3406 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -4389,53 +4451,53 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3401 +#: ../../howto/logging-cookbook.rst:3414 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:3403 +#: ../../howto/logging-cookbook.rst:3416 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:3411 +#: ../../howto/logging-cookbook.rst:3424 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:3413 +#: ../../howto/logging-cookbook.rst:3426 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:3415 +#: ../../howto/logging-cookbook.rst:3428 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:3416 +#: ../../howto/logging-cookbook.rst:3429 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:3418 +#: ../../howto/logging-cookbook.rst:3431 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3420 +#: ../../howto/logging-cookbook.rst:3433 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " "illustration as a file ``app.py`` that is the main script for the " -"application, with individual commands implemented in ``start.py``, ``stop." -"py`` and ``restart.py``. Suppose further that we want to control the " +"application, with individual commands implemented in ``start.py``, " +"``stop.py`` and ``restart.py``. Suppose further that we want to control the " "verbosity of the application via a command-line argument, defaulting to " "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3428 +#: ../../howto/logging-cookbook.rst:3441 msgid "" "import argparse\n" "import importlib\n" @@ -4470,8 +4532,8 @@ msgid "" " mod = importlib.import_module(options.command)\n" " cmd = getattr(mod, 'command')\n" " except (ImportError, AttributeError):\n" -" print('Unable to find the code for command \\'%s\\'' % options." -"command)\n" +" print('Unable to find the code for command \\'%s\\'' % " +"options.command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -4482,13 +4544,13 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3469 +#: ../../howto/logging-cookbook.rst:3482 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3472 +#: ../../howto/logging-cookbook.rst:3485 msgid "" "# start.py\n" "import logging\n" @@ -4501,11 +4563,11 @@ msgid "" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" -#: ../../howto/logging-cookbook.rst:3482 +#: ../../howto/logging-cookbook.rst:3495 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3484 +#: ../../howto/logging-cookbook.rst:3497 msgid "" "# stop.py\n" "import logging\n" @@ -4527,11 +4589,11 @@ msgid "" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3503 +#: ../../howto/logging-cookbook.rst:3516 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3505 +#: ../../howto/logging-cookbook.rst:3518 msgid "" "# restart.py\n" "import logging\n" @@ -4553,13 +4615,13 @@ msgid "" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3524 +#: ../../howto/logging-cookbook.rst:3537 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3526 +#: ../../howto/logging-cookbook.rst:3539 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -4571,19 +4633,19 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3537 +#: ../../howto/logging-cookbook.rst:3550 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3540 +#: ../../howto/logging-cookbook.rst:3553 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3543 +#: ../../howto/logging-cookbook.rst:3556 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -4598,36 +4660,36 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3557 +#: ../../howto/logging-cookbook.rst:3570 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3559 +#: ../../howto/logging-cookbook.rst:3572 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" -#: ../../howto/logging-cookbook.rst:3565 +#: ../../howto/logging-cookbook.rst:3578 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3571 +#: ../../howto/logging-cookbook.rst:3584 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3573 +#: ../../howto/logging-cookbook.rst:3586 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" -"platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" -"`PyQt5` libraries." +"platform UI framework with Python bindings using :pypi:`PySide2` " +"or :pypi:`PyQt5` libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3578 +#: ../../howto/logging-cookbook.rst:3591 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -4637,14 +4699,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3585 +#: ../../howto/logging-cookbook.rst:3598 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3589 +#: ../../howto/logging-cookbook.rst:3602 msgid "" "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " @@ -4652,7 +4714,7 @@ msgid "" "more detailed information." msgstr "" -#: ../../howto/logging-cookbook.rst:3594 +#: ../../howto/logging-cookbook.rst:3607 msgid "" "import datetime\n" "import logging\n" @@ -4835,8 +4897,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : self.work_button." -"setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : " +"self.work_button.setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -4903,28 +4965,29 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3826 +#: ../../howto/logging-cookbook.rst:3839 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3828 +#: ../../howto/logging-cookbook.rst:3841 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "default to use the older :rfc:`3164`, which hails from 2001. When " "``logging`` was added to Python in 2003, it supported the earlier (and only " "existing) protocol at the time. Since RFC5424 came out, as there has not " -"been widespread deployment of it in syslog servers, the :class:`~logging." -"handlers.SysLogHandler` functionality has not been updated." +"been widespread deployment of it in syslog servers, " +"the :class:`~logging.handlers.SysLogHandler` functionality has not been " +"updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3835 +#: ../../howto/logging-cookbook.rst:3848 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3839 +#: ../../howto/logging-cookbook.rst:3852 msgid "" "import datetime\n" "import logging.handlers\n" @@ -4944,8 +5007,8 @@ msgid "" "\n" " def format(self, record):\n" " version = 1\n" -" asctime = datetime.datetime.fromtimestamp(record.created)." -"isoformat()\n" +" asctime = " +"datetime.datetime.fromtimestamp(record.created).isoformat()\n" " m = self.tz_offset.match(time.strftime('%z'))\n" " has_offset = False\n" " if m and time.timezone:\n" @@ -4994,7 +5057,7 @@ msgid "" "{sdata} {msg}'" msgstr "" -#: ../../howto/logging-cookbook.rst:3901 +#: ../../howto/logging-cookbook.rst:3914 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -5003,7 +5066,7 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3906 +#: ../../howto/logging-cookbook.rst:3919 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5021,11 +5084,11 @@ msgstr "" "i = 1\n" "logger.debug('Message %d', i, extra=extra)" -#: ../../howto/logging-cookbook.rst:3915 +#: ../../howto/logging-cookbook.rst:3928 msgid "How to treat a logger like an output stream" msgstr "" -#: ../../howto/logging-cookbook.rst:3917 +#: ../../howto/logging-cookbook.rst:3930 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -5033,7 +5096,7 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: ../../howto/logging-cookbook.rst:3922 +#: ../../howto/logging-cookbook.rst:3935 msgid "" "import logging\n" "\n" @@ -5071,39 +5134,43 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3957 +#: ../../howto/logging-cookbook.rst:3970 msgid "When this script is run, it prints" msgstr "" -#: ../../howto/logging-cookbook.rst:3959 +#: ../../howto/logging-cookbook.rst:3972 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" -#: ../../howto/logging-cookbook.rst:3964 +#: ../../howto/logging-cookbook.rst:3977 msgid "" -"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." -"stderr`` by doing something like this:" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " +"``sys.stderr`` by doing something like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3967 +#: ../../howto/logging-cookbook.rst:3980 msgid "" "import sys\n" "\n" "sys.stdout = LoggerWriter(logger, logging.INFO)\n" "sys.stderr = LoggerWriter(logger, logging.WARNING)" msgstr "" +"import sys\n" +"\n" +"sys.stdout = LoggerWriter(logger, logging.INFO)\n" +"sys.stderr = LoggerWriter(logger, logging.WARNING)" -#: ../../howto/logging-cookbook.rst:3974 +#: ../../howto/logging-cookbook.rst:3987 msgid "" "You should do this *after* configuring logging for your needs. In the above " -"example, the :func:`~logging.basicConfig` call does this (using the ``sys." -"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " -"Then, you'd get this kind of result:" +"example, the :func:`~logging.basicConfig` call does this (using the " +"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " +"instance). Then, you'd get this kind of result:" msgstr "" -#: ../../howto/logging-cookbook.rst:3979 +#: ../../howto/logging-cookbook.rst:3992 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5117,31 +5184,31 @@ msgstr "" "WARNING:demo:Bar\n" ">>>" -#: ../../howto/logging-cookbook.rst:3987 +#: ../../howto/logging-cookbook.rst:4000 msgid "" -"Of course, the examples above show output according to the format used by :" -"func:`~logging.basicConfig`, but you can use a different formatter when you " -"configure logging." +"Of course, the examples above show output according to the format used " +"by :func:`~logging.basicConfig`, but you can use a different formatter when " +"you configure logging." msgstr "" -#: ../../howto/logging-cookbook.rst:3991 +#: ../../howto/logging-cookbook.rst:4004 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: ../../howto/logging-cookbook.rst:3995 +#: ../../howto/logging-cookbook.rst:4008 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" -#: ../../howto/logging-cookbook.rst:4000 +#: ../../howto/logging-cookbook.rst:4013 msgid "then running the script results in" msgstr "" -#: ../../howto/logging-cookbook.rst:4002 +#: ../../howto/logging-cookbook.rst:4015 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" @@ -5160,7 +5227,7 @@ msgid "" "WARNING:demo:division by zero" msgstr "" -#: ../../howto/logging-cookbook.rst:4018 +#: ../../howto/logging-cookbook.rst:4031 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " @@ -5170,7 +5237,7 @@ msgid "" "``LoggerWriter``:" msgstr "" -#: ../../howto/logging-cookbook.rst:4024 +#: ../../howto/logging-cookbook.rst:4037 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -5206,13 +5273,13 @@ msgstr "" " for part in parts:\n" " self.logger.log(self.level, part)" -#: ../../howto/logging-cookbook.rst:4043 +#: ../../howto/logging-cookbook.rst:4056 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: ../../howto/logging-cookbook.rst:4046 +#: ../../howto/logging-cookbook.rst:4059 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " @@ -5232,11 +5299,11 @@ msgstr "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" -#: ../../howto/logging-cookbook.rst:4059 +#: ../../howto/logging-cookbook.rst:4072 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:4061 +#: ../../howto/logging-cookbook.rst:4074 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -5244,11 +5311,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:4067 +#: ../../howto/logging-cookbook.rst:4080 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:4069 +#: ../../howto/logging-cookbook.rst:4082 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -5256,32 +5323,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:4074 +#: ../../howto/logging-cookbook.rst:4087 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:4077 +#: ../../howto/logging-cookbook.rst:4090 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:4080 +#: ../../howto/logging-cookbook.rst:4093 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:4084 +#: ../../howto/logging-cookbook.rst:4097 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:4087 +#: ../../howto/logging-cookbook.rst:4100 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5290,7 +5357,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:4093 +#: ../../howto/logging-cookbook.rst:4106 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -5300,17 +5367,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:4100 +#: ../../howto/logging-cookbook.rst:4113 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:4104 +#: ../../howto/logging-cookbook.rst:4117 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:4106 +#: ../../howto/logging-cookbook.rst:4119 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -5321,13 +5388,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:4115 +#: ../../howto/logging-cookbook.rst:4128 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: ../../howto/logging-cookbook.rst:4117 +#: ../../howto/logging-cookbook.rst:4130 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -5335,11 +5402,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:4123 +#: ../../howto/logging-cookbook.rst:4136 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:4125 +#: ../../howto/logging-cookbook.rst:4138 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -5350,38 +5417,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:4136 +#: ../../howto/logging-cookbook.rst:4149 msgid "Other resources" msgstr "其他資源" -#: ../../howto/logging-cookbook.rst:4140 +#: ../../howto/logging-cookbook.rst:4153 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:4141 +#: ../../howto/logging-cookbook.rst:4154 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4143 +#: ../../howto/logging-cookbook.rst:4156 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:4144 +#: ../../howto/logging-cookbook.rst:4157 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4146 +#: ../../howto/logging-cookbook.rst:4159 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:4147 +#: ../../howto/logging-cookbook.rst:4160 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4149 +#: ../../howto/logging-cookbook.rst:4162 msgid ":ref:`Basic Tutorial `" msgstr ":ref:`基礎教學 `" -#: ../../howto/logging-cookbook.rst:4151 +#: ../../howto/logging-cookbook.rst:4164 msgid ":ref:`Advanced Tutorial `" msgstr ":ref:`進階教學 `" diff --git a/howto/logging.po b/howto/logging.po index fa2c5628aa..4a1f511a6c 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -1653,7 +1653,7 @@ msgstr "將 ``logging.logThreads`` 設為 ``False``。" #: ../../howto/logging.rst:1113 msgid "Current process ID (:func:`os.getpid`)" -msgstr "當前的行程 ID (:func:`os.getpid`)" +msgstr "目前的行程 ID (:func:`os.getpid`)" #: ../../howto/logging.rst:1113 msgid "Set ``logging.logProcesses`` to ``False``." diff --git a/howto/mro.po b/howto/mro.po index 4b1860b886..1f107b45fd 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -615,7 +615,7 @@ msgstr "" msgid "" "We see that class G inherits from F and E, with F *before* E: therefore we " "would expect the attribute *G.remember2buy* to be inherited by *F." -"rembermer2buy* and not by *E.remember2buy*: nevertheless Python 2.2 gives" +"remember2buy* and not by *E.remember2buy*: nevertheless Python 2.2 gives" msgstr "" #: ../../howto/mro.rst:407 diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index d89ee4250b..07ffef15b4 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2023-12-09 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,7 +37,7 @@ msgid "" "that aid with the analysis of the data that it produces." msgstr "" "`Linux 性能分析器 (Linux perf profiler) `_ 是一" -"個非常強大的工具,可讓你分析並獲取有關應用程式的性能資訊。``perf`` 還擁有一個" +"個非常強大的工具,可讓你分析並取得有關應用程式的性能資訊。``perf`` 還擁有一個" "非常活躍的工具生態系統,有助於分析其生成的資料。" #: ../../howto/perf_profiling.rst:17 @@ -48,7 +48,7 @@ msgid "" "and file names of Python functions in your code will not appear in the " "output of ``perf``." msgstr "" -"在 Python 應用程式中使用 ``perf`` 分析器的主要問題是 ``perf`` 僅獲取有關原生" +"在 Python 應用程式中使用 ``perf`` 分析器的主要問題是 ``perf`` 僅取得有關原生" "符號的資訊,即用 C 編寫的函式和程式的名稱。這表示程式碼中的 Python 函式名稱和" "檔案名稱不會出現在 ``perf`` 的輸出中。" @@ -115,7 +115,7 @@ msgstr "" #: ../../howto/perf_profiling.rst:55 msgid "We can run ``perf`` to sample CPU stack traces at 9999 hertz::" -msgstr "我們可以執行 ``perf`` 以 9999 赫茲採樣 CPU 堆疊追蹤 (stack trace): ::" +msgstr "我們可以執行 ``perf`` 以 9999 赫茲取樣 CPU 堆疊追蹤 (stack trace): ::" #: ../../howto/perf_profiling.rst:57 msgid "$ perf record -F 9999 -g -o perf.data python my_script.py" @@ -382,13 +382,13 @@ msgstr "如何啟用 ``perf`` 分析支援" msgid "" "``perf`` profiling support can be enabled either from the start using the " "environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-" -"X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :" -"func:`sys.deactivate_stack_trampoline`." +"X>` option, or dynamically using :func:`sys.activate_stack_trampoline` " +"and :func:`sys.deactivate_stack_trampoline`." msgstr "" -"要啟用 ``perf`` 分析支援,可以在一開始就使用環境變數 :envvar:" -"`PYTHONPERFSUPPORT` 或使用 :option:`-X perf <-X>` 選項,也可以使用 :func:" -"`sys.activate_stack_trampoline` 和 :func:`sys.deactivate_stack_trampoline` 來" -"動態啟用。" +"要啟用 ``perf`` 分析支援,可以在一開始就使用環境變" +"數 :envvar:`PYTHONPERFSUPPORT` 或使用 :option:`-X perf <-X>` 選項,也可以使" +"用 :func:`sys.activate_stack_trampoline` " +"和 :func:`sys.deactivate_stack_trampoline` 來動態啟用。" #: ../../howto/perf_profiling.rst:160 msgid "" @@ -403,10 +403,12 @@ msgstr "例如,使用環境變數: ::" #: ../../howto/perf_profiling.rst:165 msgid "" -"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python " +"my_script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python " +"my_script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:168 @@ -415,10 +417,10 @@ msgstr "例如,使用 :option:`!-X` 選項: ::" #: ../../howto/perf_profiling.rst:170 msgid "" -"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf my_script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf my_script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:173 @@ -507,9 +509,9 @@ msgstr "" #: ../../howto/perf_profiling.rst:220 msgid "" -"To enable this mode, you can use the environment variable :envvar:" -"`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which " -"will enable the JIT mode for the ``perf`` profiler." +"To enable this mode, you can use the environment " +"variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` " +"option, which will enable the JIT mode for the ``perf`` profiler." msgstr "" #: ../../howto/perf_profiling.rst:226 @@ -536,13 +538,13 @@ msgstr "" #: ../../howto/perf_profiling.rst:239 msgid "" -"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " -"my_script.py\n" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python " +"-Xperf_jit my_script.py\n" "$ perf inject -i perf.data --jit --output perf.jit.data\n" "$ perf report -g -i perf.jit.data" msgstr "" -"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " -"my_script.py\n" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python " +"-Xperf_jit my_script.py\n" "$ perf inject -i perf.data --jit --output perf.jit.data\n" "$ perf report -g -i perf.jit.data" @@ -574,13 +576,56 @@ msgstr "" #: ../../howto/perf_profiling.rst:257 msgid "" -"Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take " -"snapshots of the stack of the process being profiled and save the " -"information in the ``perf.data`` file. By default the size of the stack dump " -"is 8192 bytes but the user can change the size by passing the size after " -"comma like ``--call-graph dwarf,4096``. The size of the stack dump is " -"important because if the size is too small ``perf`` will not be able to " -"unwind the stack and the output will be incomplete. On the other hand, if " -"the size is too big, then ``perf`` won't be able to sample the process as " -"frequently as it would like as the overhead will be higher." +"When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of " +"the stack of the process being profiled and save the information in the " +"``perf.data`` file. By default, the size of the stack dump is 8192 bytes, " +"but you can change the size by passing it after a comma like ``--call-graph " +"dwarf,16384``." +msgstr "" + +#: ../../howto/perf_profiling.rst:263 +msgid "" +"The size of the stack dump is important because if the size is too small " +"``perf`` will not be able to unwind the stack and the output will be " +"incomplete. On the other hand, if the size is too big, then ``perf`` won't " +"be able to sample the process as frequently as it would like as the overhead " +"will be higher." +msgstr "" + +#: ../../howto/perf_profiling.rst:269 +msgid "" +"The stack size is particularly important when profiling Python code compiled " +"with low optimization levels (like ``-O0``), as these builds tend to have " +"larger stack frames. If you are compiling Python with ``-O0`` and not seeing " +"Python functions in your profiling output, try increasing the stack dump " +"size to 65528 bytes (the maximum)::" +msgstr "" + +#: ../../howto/perf_profiling.rst:275 +msgid "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python " +"-Xperf_jit my_script.py" +msgstr "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python " +"-Xperf_jit my_script.py" + +#: ../../howto/perf_profiling.rst:277 +msgid "Different compilation flags can significantly impact stack sizes:" +msgstr "" + +#: ../../howto/perf_profiling.rst:279 +msgid "" +"Builds with ``-O0`` typically have much larger stack frames than those with " +"``-O1`` or higher" +msgstr "" + +#: ../../howto/perf_profiling.rst:280 +msgid "" +"Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size" +msgstr "" + +#: ../../howto/perf_profiling.rst:281 +msgid "" +"Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable " +"stack unwinding" msgstr "" diff --git a/howto/regex.po b/howto/regex.po index 42467d34b9..b261243bd7 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -120,12 +120,12 @@ msgstr "" #: ../../howto/regex.rst:70 msgid "" -"There are exceptions to this rule; some characters are special :dfn:" -"`metacharacters`, and don't match themselves. Instead, they signal that " -"some out-of-the-ordinary thing should be matched, or they affect other " -"portions of the RE by repeating them or changing their meaning. Much of " -"this document is devoted to discussing various metacharacters and what they " -"do." +"There are exceptions to this rule; some characters are " +"special :dfn:`metacharacters`, and don't match themselves. Instead, they " +"signal that some out-of-the-ordinary thing should be matched, or they affect " +"other portions of the RE by repeating them or changing their meaning. Much " +"of this document is devoted to discussing various metacharacters and what " +"they do." msgstr "" #: ../../howto/regex.rst:76 @@ -160,12 +160,12 @@ msgstr "" #: ../../howto/regex.rst:97 msgid "" -"You can match the characters not listed within the class by :dfn:" -"`complementing` the set. This is indicated by including a ``'^'`` as the " -"first character of the class. For example, ``[^5]`` will match any character " -"except ``'5'``. If the caret appears elsewhere in a character class, it " -"does not have special meaning. For example: ``[5^]`` will match either a " -"``'5'`` or a ``'^'``." +"You can match the characters not listed within the class " +"by :dfn:`complementing` the set. This is indicated by including a ``'^'`` " +"as the first character of the class. For example, ``[^5]`` will match any " +"character except ``'5'``. If the caret appears elsewhere in a character " +"class, it does not have special meaning. For example: ``[5^]`` will match " +"either a ``'5'`` or a ``'^'``." msgstr "" #: ../../howto/regex.rst:103 @@ -190,10 +190,10 @@ msgid "" "Let's take an example: ``\\w`` matches any alphanumeric character. If the " "regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-" "Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the " -"characters marked as letters in the Unicode database provided by the :mod:" -"`unicodedata` module. You can use the more restricted definition of ``\\w`` " -"in a string pattern by supplying the :const:`re.ASCII` flag when compiling " -"the regular expression." +"characters marked as letters in the Unicode database provided by " +"the :mod:`unicodedata` module. You can use the more restricted definition " +"of ``\\w`` in a string pattern by supplying the :const:`re.ASCII` flag when " +"compiling the regular expression." msgstr "" #: ../../howto/regex.rst:123 @@ -272,9 +272,9 @@ msgstr "" #: ../../howto/regex.rst:156 msgid "" "The final metacharacter in this section is ``.``. It matches anything " -"except a newline character, and there's an alternate mode (:const:`re." -"DOTALL`) where it will match even a newline. ``.`` is often used where you " -"want to match \"any character\"." +"except a newline character, and there's an alternate mode " +"(:const:`re.DOTALL`) where it will match even a newline. ``.`` is often " +"used where you want to match \"any character\"." msgstr "" #: ../../howto/regex.rst:163 @@ -524,8 +524,8 @@ msgid "" "and no special syntax was created for expressing them. (There are " "applications that don't need REs at all, so there's no need to bloat the " "language specification by including them.) Instead, the :mod:`re` module is " -"simply a C extension module included with Python, just like the :mod:" -"`socket` or :mod:`zlib` modules." +"simply a C extension module included with Python, just like " +"the :mod:`socket` or :mod:`zlib` modules." msgstr "" #: ../../howto/regex.rst:292 @@ -612,10 +612,10 @@ msgstr "" #: ../../howto/regex.rst:336 msgid "" "In addition, special escape sequences that are valid in regular expressions, " -"but not valid as Python string literals, now result in a :exc:" -"`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, which " -"means the sequences will be invalid if raw string notation or escaping the " -"backslashes isn't used." +"but not valid as Python string literals, now result in " +"a :exc:`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, " +"which means the sequences will be invalid if raw string notation or escaping " +"the backslashes isn't used." msgstr "" #: ../../howto/regex.rst:344 @@ -698,8 +698,8 @@ msgstr "``finditer()``" #: ../../howto/regex.rst:374 msgid "" -"Find all substrings where the RE matches, and returns them as an :term:" -"`iterator`." +"Find all substrings where the RE matches, and returns them as " +"an :term:`iterator`." msgstr "" #: ../../howto/regex.rst:378 @@ -831,11 +831,11 @@ msgstr "" #: ../../howto/regex.rst:438 msgid "" -":meth:`~re.Match.group` returns the substring that was matched by the RE. :" -"meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting and " -"ending index of the match. :meth:`~re.Match.span` returns both start and end " -"indexes in a single tuple. Since the :meth:`~re.Pattern.match` method only " -"checks if the RE matches at the start of a string, :meth:`!start` will " +":meth:`~re.Match.group` returns the substring that was matched by the " +"RE. :meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting " +"and ending index of the match. :meth:`~re.Match.span` returns both start and " +"end indexes in a single tuple. Since the :meth:`~re.Pattern.match` method " +"only checks if the RE matches at the start of a string, :meth:`!start` will " "always be zero. However, the :meth:`~re.Pattern.search` method of patterns " "scans through the string, so the match may not start at zero in that " "case. ::" @@ -886,8 +886,8 @@ msgstr "" #: ../../howto/regex.rst:466 msgid "" -"Two pattern methods return all of the matches for a pattern. :meth:`~re." -"Pattern.findall` returns a list of matching strings::" +"Two pattern methods return all of the matches for a " +"pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::" msgstr "" #: ../../howto/regex.rst:469 @@ -905,22 +905,22 @@ msgid "" "The ``r`` prefix, making the literal a raw string literal, is needed in this " "example because escape sequences in a normal \"cooked\" string literal that " "are not recognized by Python, as opposed to regular expressions, now result " -"in a :exc:`DeprecationWarning` and will eventually become a :exc:" -"`SyntaxError`. See :ref:`the-backslash-plague`." +"in a :exc:`DeprecationWarning` and will eventually become " +"a :exc:`SyntaxError`. See :ref:`the-backslash-plague`." msgstr "" #: ../../howto/regex.rst:479 msgid "" ":meth:`~re.Pattern.findall` has to create the entire list before it can be " "returned as the result. The :meth:`~re.Pattern.finditer` method returns a " -"sequence of :ref:`match object ` instances as an :term:" -"`iterator`::" +"sequence of :ref:`match object ` instances as " +"an :term:`iterator`::" msgstr "" #: ../../howto/regex.rst:483 msgid "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" -">>> iterator \n" +">>> iterator\n" "\n" ">>> for match in iterator:\n" "... print(match.span())\n" @@ -930,7 +930,7 @@ msgid "" "(29, 31)" msgstr "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" -">>> iterator \n" +">>> iterator\n" "\n" ">>> for match in iterator:\n" "... print(match.span())\n" @@ -941,28 +941,28 @@ msgstr "" #: ../../howto/regex.rst:495 msgid "Module-Level Functions" -msgstr "" +msgstr "模組層級函式" #: ../../howto/regex.rst:497 msgid "" -"You don't have to create a pattern object and call its methods; the :mod:" -"`re` module also provides top-level functions called :func:`~re.match`, :" -"func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, and so forth. " -"These functions take the same arguments as the corresponding pattern method " -"with the RE string added as the first argument, and still return either " -"``None`` or a :ref:`match object ` instance. ::" +"You don't have to create a pattern object and call its methods; " +"the :mod:`re` module also provides top-level functions " +"called :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, " +"and so forth. These functions take the same arguments as the corresponding " +"pattern method with the RE string added as the first argument, and still " +"return either ``None`` or a :ref:`match object ` instance. ::" msgstr "" #: ../../howto/regex.rst:504 msgid "" ">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" "None\n" -">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998') \n" +">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n" "" msgstr "" ">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" "None\n" -">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998') \n" +">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n" "" #: ../../howto/regex.rst:509 @@ -989,12 +989,12 @@ msgstr "" msgid "" "Compilation flags let you modify some aspects of how regular expressions " "work. Flags are available in the :mod:`re` module under two names, a long " -"name such as :const:`IGNORECASE` and a short, one-letter form such as :const:" -"`I`. (If you're familiar with Perl's pattern modifiers, the one-letter " -"forms use the same letters; the short form of :const:`re.VERBOSE` is :const:" -"`re.X`, for example.) Multiple flags can be specified by bitwise OR-ing " -"them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, for " -"example." +"name such as :const:`IGNORECASE` and a short, one-letter form such " +"as :const:`I`. (If you're familiar with Perl's pattern modifiers, the one-" +"letter forms use the same letters; the short form of :const:`re.VERBOSE` " +"is :const:`re.X`, for example.) Multiple flags can be specified by bitwise " +"OR-ing them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, " +"for example." msgstr "" #: ../../howto/regex.rst:534 @@ -1074,8 +1074,8 @@ msgid "" "letter dotless i), 'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, " "Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, ``'spAM'``, or " "``'ſpam'`` (the latter is matched only in Unicode mode). This lowercasing " -"doesn't take the current locale into account; it will if you also set the :" -"const:`LOCALE` flag." +"doesn't take the current locale into account; it will if you also set " +"the :const:`LOCALE` flag." msgstr "" #: ../../howto/regex.rst:581 @@ -1245,9 +1245,9 @@ msgstr "``^``" #: ../../howto/regex.rst:707 msgid "" "Matches at the beginning of lines. Unless the :const:`MULTILINE` flag has " -"been set, this will only match at the beginning of the string. In :const:" -"`MULTILINE` mode, this also matches immediately after each newline within " -"the string." +"been set, this will only match at the beginning of the string. " +"In :const:`MULTILINE` mode, this also matches immediately after each newline " +"within the string." msgstr "" #: ../../howto/regex.rst:711 @@ -1258,12 +1258,12 @@ msgstr "" #: ../../howto/regex.rst:714 msgid "" -">>> print(re.search('^From', 'From Here to Eternity')) \n" +">>> print(re.search('^From', 'From Here to Eternity'))\n" "\n" ">>> print(re.search('^From', 'Reciting From Memory'))\n" "None" msgstr "" -">>> print(re.search('^From', 'From Here to Eternity')) \n" +">>> print(re.search('^From', 'From Here to Eternity'))\n" "\n" ">>> print(re.search('^From', 'Reciting From Memory'))\n" "None" @@ -1284,18 +1284,18 @@ msgstr "" #: ../../howto/regex.rst:725 msgid "" -">>> print(re.search('}$', '{block}')) \n" +">>> print(re.search('}$', '{block}'))\n" "\n" ">>> print(re.search('}$', '{block} '))\n" "None\n" -">>> print(re.search('}$', '{block}\\n')) \n" +">>> print(re.search('}$', '{block}\\n'))\n" "" msgstr "" -">>> print(re.search('}$', '{block}')) \n" +">>> print(re.search('}$', '{block}'))\n" "\n" ">>> print(re.search('}$', '{block} '))\n" "None\n" -">>> print(re.search('}$', '{block}\\n')) \n" +">>> print(re.search('}$', '{block}\\n'))\n" "" #: ../../howto/regex.rst:732 @@ -1459,12 +1459,12 @@ msgstr "" msgid "" "Groups indicated with ``'('``, ``')'`` also capture the starting and ending " "index of the text that they match; this can be retrieved by passing an " -"argument to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re." -"Match.end`, and :meth:`~re.Match.span`. Groups are numbered starting with " -"0. Group 0 is always present; it's the whole RE, so :ref:`match object " -"` methods all have group 0 as their default argument. Later " -"we'll see how to express groups that don't capture the span of text that " -"they match. ::" +"argument " +"to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, " +"and :meth:`~re.Match.span`. Groups are numbered starting with 0. Group 0 " +"is always present; it's the whole RE, so :ref:`match object ` " +"methods all have group 0 as their default argument. Later we'll see how to " +"express groups that don't capture the span of text that they match. ::" msgstr "" #: ../../howto/regex.rst:824 @@ -1693,8 +1693,8 @@ msgstr "" #: ../../howto/regex.rst:946 msgid "" -"Additionally, you can retrieve named groups as a dictionary with :meth:`~re." -"Match.groupdict`::" +"Additionally, you can retrieve named groups as a dictionary " +"with :meth:`~re.Match.groupdict`::" msgstr "" #: ../../howto/regex.rst:949 @@ -1710,8 +1710,8 @@ msgstr "" #: ../../howto/regex.rst:953 msgid "" "Named groups are handy because they let you use easily remembered names, " -"instead of having to remember numbers. Here's an example RE from the :mod:" -"`imaplib` module::" +"instead of having to remember numbers. Here's an example RE from " +"the :mod:`imaplib` module::" msgstr "" #: ../../howto/regex.rst:957 @@ -1743,8 +1743,8 @@ msgid "" "name instead of the number. This is another Python extension: ``(?P=name)`` " "indicates that the contents of the group called *name* should again be " "matched at the current point. The regular expression for finding doubled " -"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?" -"P\\w+)\\s+(?P=word)\\b``::" +"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?P\\w+)\\s+" +"(?P=word)\\b``::" msgstr "" #: ../../howto/regex.rst:974 @@ -1840,10 +1840,10 @@ msgid "" "The expression gets messier when you try to patch up the first solution by " "requiring one of the following cases to match: the first character of the " "extension isn't ``b``; the second character isn't ``a``; or the third " -"character isn't ``t``. This accepts ``foo.bar`` and rejects ``autoexec." -"bat``, but it requires a three-letter extension and won't accept a filename " -"with a two-letter extension such as ``sendmail.cf``. We'll complicate the " -"pattern again in an effort to fix it." +"character isn't ``t``. This accepts ``foo.bar`` and rejects " +"``autoexec.bat``, but it requires a three-letter extension and won't accept " +"a filename with a two-letter extension such as ``sendmail.cf``. We'll " +"complicate the pattern again in an effort to fix it." msgstr "" #: ../../howto/regex.rst:1030 @@ -2216,13 +2216,13 @@ msgstr "" #: ../../howto/regex.rst:1243 msgid "" "Sometimes using the :mod:`re` module is a mistake. If you're matching a " -"fixed string, or a single character class, and you're not using any :mod:" -"`re` features such as the :const:`~re.IGNORECASE` flag, then the full power " -"of regular expressions may not be required. Strings have several methods for " -"performing operations with fixed strings and they're usually much faster, " -"because the implementation is a single small C loop that's been optimized " -"for the purpose, instead of the large, more generalized regular expression " -"engine." +"fixed string, or a single character class, and you're not using " +"any :mod:`re` features such as the :const:`~re.IGNORECASE` flag, then the " +"full power of regular expressions may not be required. Strings have several " +"methods for performing operations with fixed strings and they're usually " +"much faster, because the implementation is a single small C loop that's been " +"optimized for the purpose, instead of the large, more generalized regular " +"expression engine." msgstr "" #: ../../howto/regex.rst:1251 @@ -2234,8 +2234,8 @@ msgid "" "turning ``swordfish`` into ``sdeedfish``, but the naive RE ``word`` would " "have done that, too. (To avoid performing the substitution on parts of " "words, the pattern would have to be ``\\bword\\b``, in order to require that " -"``word`` have a word boundary on either side. This takes the job beyond :" -"meth:`!replace`'s abilities.)" +"``word`` have a word boundary on either side. This takes the job " +"beyond :meth:`!replace`'s abilities.)" msgstr "" #: ../../howto/regex.rst:1260 @@ -2299,14 +2299,15 @@ msgstr "" #: ../../howto/regex.rst:1292 msgid "" -"Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``." -"*`` to the front of your RE. Resist this temptation and use :func:`re." -"search` instead. The regular expression compiler does some analysis of REs " -"in order to speed up the process of looking for a match. One such analysis " -"figures out what the first character of a match must be; for example, a " -"pattern starting with ``Crow`` must match starting with a ``'C'``. The " -"analysis lets the engine quickly scan through the string looking for the " -"starting character, only trying the full match if a ``'C'`` is found." +"Sometimes you'll be tempted to keep using :func:`re.match`, and just add " +"``.*`` to the front of your RE. Resist this temptation and " +"use :func:`re.search` instead. The regular expression compiler does some " +"analysis of REs in order to speed up the process of looking for a match. " +"One such analysis figures out what the first character of a match must be; " +"for example, a pattern starting with ``Crow`` must match starting with a " +"``'C'``. The analysis lets the engine quickly scan through the string " +"looking for the starting character, only trying the full match if a ``'C'`` " +"is found." msgstr "" #: ../../howto/regex.rst:1301 diff --git a/howto/sorting.po b/howto/sorting.po index c61a7fc774..dcdc529f4e 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2023-08-12 15:09+0800\n" +"PO-Revision-Date: 2024-12-20 19:16+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -128,6 +128,8 @@ msgid "" ">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" "['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" msgstr "" +">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" +"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" #: ../../howto/sorting.rst:61 msgid "" @@ -157,6 +159,13 @@ msgid "" ">>> sorted(student_tuples, key=lambda student: student[2]) # sort by age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> student_tuples = [\n" +"... ('john', 'A', 15),\n" +"... ('jane', 'B', 12),\n" +"... ('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_tuples, key=lambda student: student[2]) # 依照年齡排序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:79 msgid "" @@ -182,6 +191,22 @@ msgid "" "age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> class Student:\n" +"... def __init__(self, name, grade, age):\n" +"... self.name = name\n" +"... self.grade = grade\n" +"... self.age = age\n" +"... def __repr__(self):\n" +"... return repr((self.name, self.grade, self.age))\n" +"\n" +">>> student_objects = [\n" +"... Student('john', 'A', 15),\n" +"... Student('jane', 'B', 12),\n" +"... Student('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_objects, key=lambda student: student.age) # 依照年齡排" +"序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:99 msgid "" @@ -363,6 +388,10 @@ msgid "" "primary key, descending\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> s = sorted(student_objects, key=attrgetter('age')) # 依照次要鍵排序\n" +">>> sorted(s, key=attrgetter('grade'), reverse=True) # 現在依照主要鍵降" +"冪排序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:193 msgid "" @@ -436,6 +465,11 @@ msgid "" ">>> [student for grade, i, student in decorated] # undecorate\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" msgstr "" +">>> decorated = [(student.grade, i, student) for i, student in " +"enumerate(student_objects)]\n" +">>> decorated.sort()\n" +">>> [student for grade, i, student in decorated] # 移除裝飾\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" #: ../../howto/sorting.rst:231 msgid "" @@ -532,7 +566,7 @@ msgstr "" #: ../../howto/sorting.rst:273 msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order" -msgstr "" +msgstr "sorted(words, key=cmp_to_key(strcoll)) # 理解語系的排序順序" #: ../../howto/sorting.rst:276 msgid "Odds and Ends" @@ -605,10 +639,10 @@ msgid "" "six comparison methods be implemented. The :func:`~functools.total_ordering` " "decorator is provided to make that task easier." msgstr "" -"然而,請注意,當 :meth:`~object.__lt__` 沒有被實做時,``<`` 可以回退 (fall " +"然而,請注意,當 :meth:`~object.__lt__` 沒有被實作時,``<`` 可以回退 (fall " "back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請看 :func:`object." -"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝飾" -"器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" +"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝" +"飾器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" #: ../../howto/sorting.rst:314 msgid "" @@ -663,7 +697,7 @@ msgid "" msgstr "" ":func:`heapq.nsmallest` 以及 :func:`heapq.nlargest` 會分別回傳 *n* 個最小值及" "最大值。這些函式會將資料進行一次傳遞且一次只會保留 *n* 個元素在記憶體中。對於" -"相對於輸入數量較小的 *n* 個值,這些函數進行的比較比完整排序要少得多。" +"相對於輸入數量較小的 *n* 個值,這些函式進行的比較比完整排序要少得多。" #: ../../howto/sorting.rst:342 msgid "" @@ -672,7 +706,6 @@ msgid "" "position ``0``. These functions are suitable for implementing priority " "queues which are commonly used for task scheduling." msgstr "" -":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資料" -"排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優先" -"佇列。" - +":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資" +"料排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優" +"先佇列。" diff --git a/howto/unicode.po b/howto/unicode.po index b7b29e8cd1..66eab41171 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,10 +79,10 @@ msgstr "" msgid "" "The Unicode standard describes how characters are represented by **code " "points**. A code point value is an integer in the range 0 to 0x10FFFF " -"(about 1.1 million values, the `actual number assigned `_ is less than that). In the standard and in " -"this document, a code point is written using the notation ``U+265E`` to mean " -"the character with value ``0x265e`` (9,822 in decimal)." +"(about 1.1 million values, the `actual number assigned `_ is less than that). In the " +"standard and in this document, a code point is written using the notation " +"``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal)." msgstr "" #: ../../howto/unicode.rst:50 @@ -301,8 +301,8 @@ msgstr "" #: ../../howto/unicode.rst:173 msgid "" -"Another `good introductory article `_ was " "written by Joel Spolsky. If this introduction didn't make things clear to " "you, you should try reading this alternate article before continuing." @@ -406,7 +406,7 @@ msgstr "" #: ../../howto/unicode.rst:236 msgid "" -">>> b'\\x80abc'.decode(\"utf-8\", \"strict\") \n" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" @@ -418,7 +418,7 @@ msgid "" ">>> b'\\x80abc'.decode(\"utf-8\", \"ignore\")\n" "'abc'" msgstr "" -">>> b'\\x80abc'.decode(\"utf-8\", \"strict\") \n" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" @@ -473,10 +473,10 @@ msgstr "" #: ../../howto/unicode.rst:272 msgid "" -"The *errors* parameter is the same as the parameter of the :meth:`~bytes." -"decode` method but supports a few more possible handlers. As well as " -"``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case inserts a " -"question mark instead of the unencodable character), there is also " +"The *errors* parameter is the same as the parameter of " +"the :meth:`~bytes.decode` method but supports a few more possible handlers. " +"As well as ``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case " +"inserts a question mark instead of the unencodable character), there is also " "``'xmlcharrefreplace'`` (inserts an XML character reference), " "``backslashreplace`` (inserts a ``\\uNNNN`` escape sequence) and " "``namereplace`` (inserts a ``\\N{...}`` escape sequence)." @@ -491,7 +491,7 @@ msgid "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" "b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" -">>> u.encode('ascii') \n" +">>> u.encode('ascii')\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" @@ -510,7 +510,7 @@ msgstr "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" "b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" -">>> u.encode('ascii') \n" +">>> u.encode('ascii')\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" @@ -674,9 +674,9 @@ msgid "" "subcategories. To take the codes from the above output, ``'Ll'`` means " "'Letter, lowercase', ``'No'`` means \"Number, other\", ``'Mn'`` is \"Mark, " "nonspacing\", and ``'So'`` is \"Symbol, other\". See `the General Category " -"Values section of the Unicode Character Database documentation `_ for a list of category " -"codes." +"Values section of the Unicode Character Database documentation `_ for a list of " +"category codes." msgstr "" #: ../../howto/unicode.rst:402 @@ -714,12 +714,12 @@ msgstr "" #: ../../howto/unicode.rst:425 msgid "" -"A second tool is the :mod:`unicodedata` module's :func:`~unicodedata." -"normalize` function that converts strings to one of several normal forms, " -"where letters followed by a combining character are replaced with single " -"characters. :func:`~unicodedata.normalize` can be used to perform string " -"comparisons that won't falsely report inequality if two strings use " -"combining characters differently:" +"A second tool is the :mod:`unicodedata` " +"module's :func:`~unicodedata.normalize` function that converts strings to " +"one of several normal forms, where letters followed by a combining character " +"are replaced with single characters. :func:`~unicodedata.normalize` can be " +"used to perform string comparisons that won't falsely report inequality if " +"two strings use combining characters differently:" msgstr "" #: ../../howto/unicode.rst:434 @@ -863,8 +863,9 @@ msgstr "" #: ../../howto/unicode.rst:520 msgid "" -"`Processing Text Files in Python 3 `_, by Nick Coghlan." +"`Processing Text Files in Python 3 `_, " +"by Nick Coghlan." msgstr "" #: ../../howto/unicode.rst:521 @@ -875,8 +876,8 @@ msgstr "" #: ../../howto/unicode.rst:523 msgid "" -"The :class:`str` type is described in the Python library reference at :ref:" -"`textseq`." +"The :class:`str` type is described in the Python library reference " +"at :ref:`textseq`." msgstr "" #: ../../howto/unicode.rst:526 @@ -947,8 +948,8 @@ msgid "" "object that assumes the file's contents are in a specified encoding and " "accepts Unicode parameters for methods such as :meth:`~io.TextIOBase.read` " "and :meth:`~io.TextIOBase.write`. This works through :func:`open`\\'s " -"*encoding* and *errors* parameters which are interpreted just like those in :" -"meth:`str.encode` and :meth:`bytes.decode`." +"*encoding* and *errors* parameters which are interpreted just like those " +"in :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../howto/unicode.rst:574 @@ -1217,8 +1218,8 @@ msgstr "" #: ../../howto/unicode.rst:737 msgid "" -"One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " +"One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " "Beazley, discusses text processing and binary data handling." msgstr "" diff --git a/howto/urllib2.po b/howto/urllib2.po index 4e79e88dd9..bff4e431ba 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-06-27 09:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,11 +43,11 @@ msgstr "以下這些與 Python 有關的文章說不定能幫到你::" #: ../../howto/urllib2.rst:18 msgid "" -"`Basic Authentication `_" +"`Basic Authentication `_" msgstr "" -"`Basic Authentication `_" +"`Basic Authentication `_" #: ../../howto/urllib2.rst:20 msgid "A tutorial on *Basic Authentication*, with examples in Python." @@ -114,8 +114,8 @@ msgstr "" #: ../../howto/urllib2.rst:52 msgid "" "If you wish to retrieve a resource via URL and store it in a temporary " -"location, you can do so via the :func:`shutil.copyfileobj` and :func:" -"`tempfile.NamedTemporaryFile` functions::" +"location, you can do so via the :func:`shutil.copyfileobj` " +"and :func:`tempfile.NamedTemporaryFile` functions::" msgstr "" #: ../../howto/urllib2.rst:56 @@ -274,7 +274,7 @@ msgid "" ">>> data['location'] = 'Northampton'\n" ">>> data['language'] = 'Python'\n" ">>> url_values = urllib.parse.urlencode(data)\n" -">>> print(url_values) # The order may differ from below. \n" +">>> print(url_values) # The order may differ from below.\n" "name=Somebody+Here&language=Python&location=Northampton\n" ">>> url = 'http://www.example.com/example.cgi'\n" ">>> full_url = url + '?' + url_values\n" @@ -287,7 +287,7 @@ msgstr "" ">>> data['location'] = 'Northampton'\n" ">>> data['language'] = 'Python'\n" ">>> url_values = urllib.parse.urlencode(data)\n" -">>> print(url_values) # The order may differ from below. \n" +">>> print(url_values) # The order may differ from below.\n" "name=Somebody+Here&language=Python&location=Northampton\n" ">>> url = 'http://www.example.com/example.cgi'\n" ">>> full_url = url + '?' + url_values\n" @@ -370,14 +370,14 @@ msgstr "" #: ../../howto/urllib2.rst:197 msgid "" "*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a " -"response (though as usual with Python APIs, built-in exceptions such as :exc:" -"`ValueError`, :exc:`TypeError` etc. may also be raised)." +"response (though as usual with Python APIs, built-in exceptions such " +"as :exc:`ValueError`, :exc:`TypeError` etc. may also be raised)." msgstr "" #: ../../howto/urllib2.rst:201 msgid "" -":exc:`~urllib.error.HTTPError` is the subclass of :exc:`~urllib.error." -"URLError` raised in the specific case of HTTP URLs." +":exc:`~urllib.error.HTTPError` is the subclass " +"of :exc:`~urllib.error.URLError` raised in the specific case of HTTP URLs." msgstr "" #: ../../howto/urllib2.rst:204 @@ -405,14 +405,14 @@ msgid "" ">>> req = urllib.request.Request('http://www.pretend_server.org')\n" ">>> try: urllib.request.urlopen(req)\n" "... except urllib.error.URLError as e:\n" -"... print(e.reason) \n" +"... print(e.reason)\n" "...\n" "(4, 'getaddrinfo failed')" msgstr "" ">>> req = urllib.request.Request('http://www.pretend_server.org')\n" ">>> try: urllib.request.urlopen(req)\n" "... except urllib.error.URLError as e:\n" -"... print(e.reason) \n" +"... print(e.reason)\n" "...\n" "(4, 'getaddrinfo failed')" @@ -427,9 +427,9 @@ msgid "" "request. The default handlers will handle some of these responses for you " "(for example, if the response is a \"redirection\" that requests the client " "fetch the document from a different URL, urllib will handle that for you). " -"For those it can't handle, urlopen will raise an :exc:`~urllib.error." -"HTTPError`. Typical errors include '404' (page not found), '403' (request " -"forbidden), and '401' (authentication required)." +"For those it can't handle, urlopen will raise " +"an :exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not " +"found), '403' (request forbidden), and '401' (authentication required)." msgstr "" #: ../../howto/urllib2.rst:235 @@ -548,12 +548,12 @@ msgid "" "... urllib.request.urlopen(req)\n" "... except urllib.error.HTTPError as e:\n" "... print(e.code)\n" -"... print(e.read()) \n" +"... print(e.read())\n" "...\n" "404\n" "b'\\n\\n\\n\\n\\n\\nPage Not Found\\n\n" " ..." @@ -563,12 +563,12 @@ msgstr "" "... urllib.request.urlopen(req)\n" "... except urllib.error.HTTPError as e:\n" "... print(e.code)\n" -"... print(e.read()) \n" +"... print(e.read())\n" "...\n" "404\n" "b'\\n\\n\\n\\n\\n\\nPage Not Found\\n\n" " ..." @@ -579,9 +579,9 @@ msgstr "" #: ../../howto/urllib2.rst:341 msgid "" -"So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:" -"`~urllib.error.URLError` there are two basic approaches. I prefer the second " -"approach." +"So if you want to be prepared for :exc:`~urllib.error.HTTPError` " +"*or* :exc:`~urllib.error.URLError` there are two basic approaches. I prefer " +"the second approach." msgstr "" #: ../../howto/urllib2.rst:345 @@ -655,8 +655,8 @@ msgstr "" #: ../../howto/urllib2.rst:402 msgid "" "**info** - this returns a dictionary-like object that describes the page " -"fetched, particularly the headers sent by the server. It is currently an :" -"class:`http.client.HTTPMessage` instance." +"fetched, particularly the headers sent by the server. It is currently " +"an :class:`http.client.HTTPMessage` instance." msgstr "" #: ../../howto/urllib2.rst:406 @@ -691,8 +691,8 @@ msgstr "" #: ../../howto/urllib2.rst:427 msgid "" -"To create an opener, instantiate an ``OpenerDirector``, and then call ``." -"add_handler(some_handler_instance)`` repeatedly." +"To create an opener, instantiate an ``OpenerDirector``, and then call " +"``.add_handler(some_handler_instance)`` repeatedly." msgstr "" #: ../../howto/urllib2.rst:430 @@ -850,8 +850,8 @@ msgstr "" #: ../../howto/urllib2.rst:540 msgid "" "Currently ``urllib.request`` *does not* support fetching of ``https`` " -"locations through a proxy. However, this can be enabled by extending urllib." -"request as shown in the recipe [#]_." +"locations through a proxy. However, this can be enabled by extending " +"urllib.request as shown in the recipe [#]_." msgstr "" #: ../../howto/urllib2.rst:546 @@ -875,9 +875,9 @@ msgid "" "As of Python 2.3 you can specify how long a socket should wait for a " "response before timing out. This can be useful in applications which have to " "fetch web pages. By default the socket module has *no timeout* and can hang. " -"Currently, the socket timeout is not exposed at the http.client or urllib." -"request levels. However, you can set the default timeout globally for all " -"sockets using ::" +"Currently, the socket timeout is not exposed at the http.client or " +"urllib.request levels. However, you can set the default timeout globally for " +"all sockets using ::" msgstr "" #: ../../howto/urllib2.rst:562 @@ -897,7 +897,7 @@ msgstr "" #: ../../howto/urllib2.rst:579 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../howto/urllib2.rst:581 msgid "This document was reviewed and revised by John Lee." @@ -940,13 +940,3 @@ msgid "" "code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-" "method/>`_." msgstr "" - -#~ msgid "" -#~ "There is a French translation of an earlier revision of this HOWTO, " -#~ "available at `urllib2 - Le Manuel manquant `_." -#~ msgstr "" -#~ "這份指南出自於早期版本的法文翻譯 `urllib2 - Le Manuel manquant `_。" diff --git a/library/_thread.po b/library/_thread.po index 91130e2cc2..17e592407e 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -156,7 +156,7 @@ msgid "" "identifiers may be recycled when a thread exits and another thread is " "created." msgstr "" -"回傳當前執行緒的「執行緒識別字」。這是一個非零的整數。它的值沒有直接的含義;" +"回傳目前執行緒的「執行緒識別字」。這是一個非零的整數。它的值沒有直接的含義;" "它被用作一個 magic cookie,例如用於索引特定於執行緒的資料的字典。當執行緒退出" "並建立另一個執行緒時,執行緒識別字可能會被重複使用。" @@ -167,7 +167,7 @@ msgid "" "identify this particular thread system-wide (until the thread terminates, " "after which the value may be recycled by the OS)." msgstr "" -"回傳由核心 (kernel) 分配的當前執行緒的原生整數執行緒 ID。這是一個非負整數。它" +"回傳由核心 (kernel) 分配的目前執行緒的原生整數執行緒 ID。這是一個非負整數。它" "的值可用於在整個系統中唯一標識此特定執行緒(直到執行緒終止後,該值可能被操作" "系統重新使用)。" @@ -204,7 +204,7 @@ msgstr "" "`ValueError` 錯誤,並且堆疊大小不會被修改。目前,32 KiB 是保證解譯器本身具有" "足夠堆疊空間所支持的最小堆疊大小值。請注意,某些平台對於堆疊大小的值可能有特" "定的限制,例如要求最小堆疊大小 > 32 KiB,或要求按系統記憶體頁面大小的倍數進行" -"分配。應參考平台文檔以獲取更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" +"分配。應參考平台文件以取得更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" "的情況下,建議使用 4096 的倍數作為堆疊大小)。" #: ../../library/_thread.rst:150 @@ -231,8 +231,8 @@ msgid "" "(only one thread at a time can acquire a lock --- that's their reason for " "existence)." msgstr "" -"沒有任何可選引數時,此方法無條件地獲取鎖,必要時會等待直到被另一個執行緒釋放" -"(一次只能有一個執行緒獲取鎖 --- 這正是鎖存在的原因)。" +"沒有任何可選引數時,此方法無條件地取得鎖,必要時會等待直到被另一個執行緒釋放" +"(一次只能有一個執行緒取得鎖 --- 這正是鎖存在的原因)。" #: ../../library/_thread.rst:171 msgid "" @@ -242,7 +242,7 @@ msgid "" "as above." msgstr "" "如果存在 *blocking* 引數,則根據其值執行操作:如果為 False,只有在可以立即獲" -"取鎖而無需等待的情況下才獲取鎖,而如果為 True,則像上面一樣無條件地獲取鎖。" +"取鎖而無需等待的情況下才取得鎖,而如果為 True,則像上面一樣無條件地取得鎖。" #: ../../library/_thread.rst:176 msgid "" @@ -259,7 +259,7 @@ msgstr "" msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not." -msgstr "如果成功獲取鎖,回傳值為 ``True``,否則為 ``False``。" +msgstr "如果成功取得鎖,回傳值為 ``True``,否則為 ``False``。" #: ../../library/_thread.rst:184 msgid "The *timeout* parameter is new." @@ -267,20 +267,20 @@ msgstr "新增的 *timeout* 參數。" #: ../../library/_thread.rst:187 msgid "Lock acquires can now be interrupted by signals on POSIX." -msgstr "現在獲取鎖的操作可以被 POSIX 訊號中斷。" +msgstr "現在取得鎖的操作可以被 POSIX 訊號中斷。" #: ../../library/_thread.rst:193 msgid "" "Releases the lock. The lock must have been acquired earlier, but not " "necessarily by the same thread." -msgstr "釋放鎖。鎖必須先前被獲取,但不一定是由同一個執行緒獲取的。" +msgstr "釋放鎖。鎖必須先前被取得,但不一定是由同一個執行緒取得的。" #: ../../library/_thread.rst:199 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" -"回傳鎖的狀態:如果鎖已被某個執行緒獲取,則回傳 ``True``,否則回傳 ``False``。" +"回傳鎖的狀態:如果鎖已被某個執行緒取得,則回傳 ``True``,否則回傳 ``False``。" #: ../../library/_thread.rst:202 msgid "" @@ -319,7 +319,7 @@ msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." msgstr "" -"呼叫 :func:`sys.exit` 函數或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" +"呼叫 :func:`sys.exit` 函式或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" "`_thread.exit` 函式。" #: ../../library/_thread.rst:222 diff --git a/library/abc.po b/library/abc.po index 5d5dde6b3b..9a2d736b8d 100644 --- a/library/abc.po +++ b/library/abc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-27 00:15+0000\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,9 @@ msgstr "**原始碼:**\\ :source:`Lib/abc.py`" msgid "" "This module provides the infrastructure for defining :term:`abstract base " "classes ` (ABCs) in Python, as outlined in :pep:`3119`; " -"see the PEP for why this was added to Python. (See also :pep:`3141` and the :" -"mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)" +"see the PEP for why this was added to Python. (See also :pep:`3141` and " +"the :mod:`numbers` module regarding a type hierarchy for numbers based on " +"ABCs.)" msgstr "" "如同在 :pep:`3119` 中所述,該模組提供了在 Python 中定義\\ :term:`抽象基底類" "別 ` (ABC) 的基礎元件;若想瞭解為什麼需要在 Python 中增" @@ -44,10 +45,10 @@ msgstr "" #: ../../library/abc.rst:20 msgid "" "The :mod:`collections` module has some concrete classes that derive from " -"ABCs; these can, of course, be further derived. In addition, the :mod:" -"`collections.abc` submodule has some ABCs that can be used to test whether a " -"class or instance provides a particular interface, for example, if it is :" -"term:`hashable` or if it is a :term:`mapping`." +"ABCs; these can, of course, be further derived. In addition, " +"the :mod:`collections.abc` submodule has some ABCs that can be used to test " +"whether a class or instance provides a particular interface, for example, if " +"it is :term:`hashable` or if it is a :term:`mapping`." msgstr "" ":mod:`collections` 模組中有一些衍生自 ABC 的具體類別;當然這些類別還可以進一" "步衍生出其他類別。此外,:mod:`collections.abc` 子模組中有一些 ABC 可被用於測" @@ -68,9 +69,9 @@ msgid "" "an abstract base class can be created by simply deriving from :class:`!ABC` " "avoiding sometimes confusing metaclass usage, for example::" msgstr "" -"一個使用 :class:`ABCMeta` 作為元類別的工具類別。抽象基底類別可以透過自 :" -"class:`!ABC` 衍生而建立,這就避免了在某些情況下會令人混淆的元類別用法,用法如" -"以下範例: ::" +"一個使用 :class:`ABCMeta` 作為元類別的工具類別。抽象基底類別可以透過" +"自 :class:`!ABC` 衍生而建立,這就避免了在某些情況下會令人混淆的元類別用法,用" +"法如以下範例: ::" #: ../../library/abc.rst:36 msgid "" @@ -125,10 +126,10 @@ msgid "" msgstr "" "使用該元類別以建立一個 ABC。一個 ABC 可以像 mix-in 類別一樣直接被子類別繼承。" "你也可以將不相關的具體類別(甚至是內建類別)和 ABC 註冊為「虛擬子類別 " -"(virtual subclass)」 —— 這些類別以及它們的子類別會被內建函式 :func:" -"`issubclass` 識別為已註冊 ABC 的子類別,但是該 ABC 不會出現在其 MRO(Method " -"Resolution Order,方法解析順序)中,由該 ABC 所定義的方法實作也不可呼叫(即使" -"透過 :func:`super` 呼叫也不行)。[#]_" +"(virtual subclass)」 —— 這些類別以及它們的子類別會被內建函" +"式 :func:`issubclass` 識別為已註冊 ABC 的子類別,但是該 ABC 不會出現在其 MRO" +"(Method Resolution Order,方法解析順序)中,由該 ABC 所定義的方法實作也不可" +"呼叫(即使透過 :func:`super` 呼叫也不行)。[#]_" #: ../../library/abc.rst:68 msgid "" @@ -169,8 +170,8 @@ msgstr "回傳已註冊的子類別,使其能夠作為類別裝飾器。" #: ../../library/abc.rst:88 msgid "" -"To detect calls to :meth:`!register`, you can use the :func:" -"`get_cache_token` function." +"To detect calls to :meth:`!register`, you can use " +"the :func:`get_cache_token` function." msgstr "" "你可以使用 :func:`get_cache_token` 函式來檢測對 :meth:`!register` 的呼叫。" @@ -187,13 +188,13 @@ msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~type." -"__subclasscheck__` method of the ABC.)" +"subclass of the ABC. (This class method is called from " +"the :meth:`~type.__subclasscheck__` method of the ABC.)" msgstr "" -"檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自訂 :func:" -"`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別都個別呼" -"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~type." -"__subclasscheck__` 方法中呼叫。)" +"檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自" +"訂 :func:`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別" +"都個別呼叫 :meth:`register` 方法。(這個類別方法是在 ABC " +"的 :meth:`~type.__subclasscheck__` 方法中呼叫。)" #: ../../library/abc.rst:104 msgid "" @@ -205,8 +206,8 @@ msgid "" msgstr "" "此方法必須回傳 ``True``、``False`` 或是 :data:`NotImplemented`。如果回傳 " "``True``,*subclass* 就會被認為是這個 ABC 的子類別。如果回傳 ``False``," -"*subclass* 就會被判定並非該 ABC 的子類別,即便正常情況應如此。如果回傳 :data:" -"`!NotImplemented`,子類別檢查會按照正常機制繼續執行。" +"*subclass* 就會被判定並非該 ABC 的子類別,即便正常情況應如此。如果回" +"傳 :data:`!NotImplemented`,子類別檢查會按照正常機制繼續執行。" #: ../../library/abc.rst:114 msgid "" @@ -271,39 +272,40 @@ msgstr "" #: ../../library/abc.rst:143 msgid "" -"The ABC ``MyIterable`` defines the standard iterable method, :meth:" -"`~iterator.__iter__`, as an abstract method. The implementation given here " -"can still be called from subclasses. The :meth:`!get_iterator` method is " -"also part of the ``MyIterable`` abstract base class, but it does not have to " -"be overridden in non-abstract derived classes." +"The ABC ``MyIterable`` defines the standard iterable " +"method, :meth:`~object.__iter__`, as an abstract method. The implementation " +"given here can still be called from subclasses. The :meth:`!get_iterator` " +"method is also part of the ``MyIterable`` abstract base class, but it does " +"not have to be overridden in non-abstract derived classes." msgstr "" -"ABC ``MyIterable`` 定義了作為抽象方法的一個標準疊代方法 :meth:`~iterator." -"__iter__`。這裡給定的實作仍可在子類別中被呼叫。:meth:`!get_iterator` 方法也" -"是 ``MyIterable`` 抽象基底類別的一部分,但它不必被非抽象衍生類別覆寫。" +"ABC ``MyIterable`` 定義了作為抽象方法的一個標準疊代方" +"法 :meth:`~object.__iter__`。這裡給定的實作仍可在子類別中被呼叫。:meth:`!" +"get_iterator` 方法也是 ``MyIterable`` 抽象基底類別的一部分,但它不必被非抽象" +"衍生類別覆寫。" #: ../../library/abc.rst:149 msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " -"that has an :meth:`~iterator.__iter__` method in its :attr:`~object." -"__dict__` (or in that of one of its base classes, accessed via the :attr:" -"`~type.__mro__` list) is considered a ``MyIterable`` too." +"that has an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` " +"(or in that of one of its base classes, accessed via " +"the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" -"這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在其 :attr:`~object." -"__dict__` (或在其透過 :attr:`~type.__mro__` 列表訪問的基底類別) 中具有 :meth:" -"`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" +"這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在" +"其 :attr:`~object.__dict__` (或在其透過 :attr:`~type.__mro__` 列表存取的基底" +"類別) 中具有 :meth:`~object.__iter__` 方法的類別也都會被視為 ``MyIterable``。" #: ../../library/abc.rst:154 msgid "" "Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, " -"even though it does not define an :meth:`~iterator.__iter__` method (it uses " +"even though it does not define an :meth:`~object.__iter__` method (it uses " "the old-style iterable protocol, defined in terms of :meth:`~object.__len__` " "and :meth:`~object.__getitem__`). Note that this will not make " "``get_iterator`` available as a method of ``Foo``, so it is provided " "separately." msgstr "" -"最後,即使 ``Foo`` 沒有定義 :meth:`~iterator.__iter__` 方法(它使用了以 :" -"meth:`~object.__len__` 和 :meth:`~object.__getitem__` 所定義的舊式可疊代物件" -"協定),最末一行使其成為 ``MyIterable`` 的一個虛擬子類別。請注意這不會使 " +"最後,即使 ``Foo`` 沒有定義 :meth:`~object.__iter__` 方法(它使用了" +"以 :meth:`~object.__len__` 和 :meth:`~object.__getitem__` 所定義的舊式可疊代" +"物件協定),最末一行使其成為 ``MyIterable`` 的一個虛擬子類別。請注意這不會使 " "``get_iterator`` 成為 ``Foo`` 的一個可用方法,所以它是需要被另外提供的。" #: ../../library/abc.rst:163 @@ -423,8 +425,8 @@ msgid "" msgstr "" "為了能正確地與 ABC 機制實作相互操作,描述器必須使用 :attr:`!" "__isabstractmethod__` 將自身標識為抽象的。一般來說,如果被用於組成描述器的任" -"一方法是抽象的,則此屬性應當為 ``True``。 例如,Python 的內建 :class:" -"`property` 所做的就等價於: ::" +"一方法是抽象的,則此屬性應當為 ``True``。 例如,Python 的內" +"建 :class:`property` 所做的就等價於: ::" #: ../../library/abc.rst:223 msgid "" @@ -536,13 +538,15 @@ msgstr "" #: ../../library/abc.rst:285 msgid "" -"It is now possible to use :class:`property`, :meth:`property.getter`, :meth:" -"`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, " -"making this decorator redundant." +"It is now possible to " +"use :class:`property`, :meth:`property.getter`, :meth:`property.setter` " +"and :meth:`property.deleter` with :func:`abstractmethod`, making this " +"decorator redundant." msgstr "" -"現在可以讓 :class:`property`、:meth:`property.getter`、:meth:`property." -"setter` 和 :meth:`property.deleter` 配合 :func:`abstractmethod` 使用,使得此" -"裝飾器變得冗餘。" +"現在可以" +"讓 :class:`property`、:meth:`property.getter`、:meth:`property.setter` " +"和 :meth:`property.deleter` 配合 :func:`abstractmethod` 使用,使得此裝飾器變" +"得冗餘。" #: ../../library/abc.rst:290 msgid "" @@ -627,7 +631,7 @@ msgstr ":mod:`!abc` 模組也提供了這些函式:" #: ../../library/abc.rst:330 msgid "Returns the current abstract base class cache token." -msgstr "回傳當前 ABC 快取令牌 (cache token)。" +msgstr "回傳目前 ABC 快取令牌 (cache token)。" #: ../../library/abc.rst:332 msgid "" @@ -636,8 +640,8 @@ msgid "" "The token changes with every call to :meth:`ABCMeta.register` on any ABC." msgstr "" "此令牌是一個(支援相等性測試的)不透明物件 (opaque object),用於為虛擬子類別" -"標識抽象基底類別快取的當前版本。此令牌會在任何 ABC 上每次呼叫 :meth:`ABCMeta." -"register` 時發生更改。" +"標識抽象基底類別快取的目前版本。此令牌會在任何 ABC 上每次呼" +"叫 :meth:`ABCMeta.register` 時發生更改。" #: ../../library/abc.rst:340 msgid "" @@ -666,7 +670,7 @@ msgstr "" #: ../../library/abc.rst:357 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/abc.rst:358 msgid "" diff --git a/library/argparse.po b/library/argparse.po index 4bdf1f6631..ba81a4c6d3 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,34 +21,47 @@ msgstr "" msgid "" ":mod:`!argparse` --- Parser for command-line options, arguments and " "subcommands" -msgstr "" +msgstr ":mod:`!argparse` --- 命令列選項、引數和子命令的剖析器" #: ../../library/argparse.rst:12 msgid "**Source code:** :source:`Lib/argparse.py`" msgstr "**原始碼:**\\ :source:`Lib/argparse.py`" +#: ../../library/argparse.rst:16 +msgid "" +"While :mod:`argparse` is the default recommended standard library module for " +"implementing basic command line applications, authors with more exacting " +"requirements for exactly how their command line applications behave may find " +"it doesn't provide the necessary level of control. Refer to :ref:`choosing-" +"an-argument-parser` for alternatives to consider when ``argparse`` doesn't " +"support behaviors that the application requires (such as entirely disabling " +"support for interspersed options and positional arguments, or accepting " +"option parameter values that start with ``-`` even when they correspond to " +"another defined option)." +msgstr "" + #: ../../library/argparse.rst:-1 msgid "Tutorial" msgstr "教學" -#: ../../library/argparse.rst:18 +#: ../../library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " -"introduction to Python command-line parsing, have a look at the :ref:" -"`argparse tutorial `." +"introduction to Python command-line parsing, have a look at " +"the :ref:`argparse tutorial `." msgstr "" -#: ../../library/argparse.rst:22 +#: ../../library/argparse.rst:34 msgid "" "The :mod:`!argparse` module makes it easy to write user-friendly command-" "line interfaces. The program defines what arguments it requires, and :mod:`!" -"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`!argparse` module also automatically generates help and usage " +"argparse` will figure out how to parse those out of :data:`sys.argv`. " +"The :mod:`!argparse` module also automatically generates help and usage " "messages. The module will also issue errors when users give the program " "invalid arguments." msgstr "" -#: ../../library/argparse.rst:28 +#: ../../library/argparse.rst:40 msgid "" "The :mod:`!argparse` module's support for command-line interfaces is built " "around an instance of :class:`argparse.ArgumentParser`. It is a container " @@ -57,177 +69,187 @@ msgid "" "whole::" msgstr "" -#: ../../library/argparse.rst:32 +#: ../../library/argparse.rst:44 msgid "" "parser = argparse.ArgumentParser(\n" " prog='ProgramName',\n" " description='What the program does',\n" " epilog='Text at the bottom of help')" msgstr "" +"parser = argparse.ArgumentParser(\n" +" prog='ProgramName',\n" +" description='What the program does',\n" +" epilog='Text at the bottom of help')" -#: ../../library/argparse.rst:37 +#: ../../library/argparse.rst:49 msgid "" "The :meth:`ArgumentParser.add_argument` method attaches individual argument " "specifications to the parser. It supports positional arguments, options " "that accept values, and on/off flags::" msgstr "" -#: ../../library/argparse.rst:41 +#: ../../library/argparse.rst:53 msgid "" "parser.add_argument('filename') # positional argument\n" "parser.add_argument('-c', '--count') # option that takes a value\n" "parser.add_argument('-v', '--verbose',\n" " action='store_true') # on/off flag" msgstr "" +"parser.add_argument('filename') # 位置引數\n" +"parser.add_argument('-c', '--count') # 接收一個值的選項\n" +"parser.add_argument('-v', '--verbose',\n" +" action='store_true') # 開關旗標" -#: ../../library/argparse.rst:46 +#: ../../library/argparse.rst:58 msgid "" "The :meth:`ArgumentParser.parse_args` method runs the parser and places the " "extracted data in a :class:`argparse.Namespace` object::" msgstr "" -#: ../../library/argparse.rst:49 +#: ../../library/argparse.rst:61 msgid "" "args = parser.parse_args()\n" "print(args.filename, args.count, args.verbose)" msgstr "" +"args = parser.parse_args()\n" +"print(args.filename, args.count, args.verbose)" -#: ../../library/argparse.rst:53 +#: ../../library/argparse.rst:65 msgid "" -"If you're looking for a guide about how to upgrade :mod:`optparse` code to :" -"mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" -#: ../../library/argparse.rst:57 +#: ../../library/argparse.rst:69 msgid "ArgumentParser objects" msgstr "ArgumentParser 物件" -#: ../../library/argparse.rst:66 +#: ../../library/argparse.rst:78 msgid "" "Create a new :class:`ArgumentParser` object. All parameters should be passed " "as keyword arguments. Each parameter has its own more detailed description " "below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:70 +#: ../../library/argparse.rst:82 msgid "" "prog_ - The name of the program (default: ``os.path.basename(sys.argv[0])``)" -msgstr "" +msgstr "prog_ - 程式的名稱(預設值:``os.path.basename(sys.argv[0])``)" -#: ../../library/argparse.rst:73 +#: ../../library/argparse.rst:85 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" -msgstr "" +msgstr "usage_ - 描述程式用法的字串(預設值:從新增到剖析器的引數產生)" -#: ../../library/argparse.rst:76 +#: ../../library/argparse.rst:88 msgid "" "description_ - Text to display before the argument help (by default, no text)" -msgstr "" +msgstr "description_ - 引數說明之前要顯示的文字(預設值:無文字)" -#: ../../library/argparse.rst:79 +#: ../../library/argparse.rst:91 msgid "epilog_ - Text to display after the argument help (by default, no text)" -msgstr "" +msgstr "epilog_ - 引數說明之後要顯示的文字(預設值:無文字)" -#: ../../library/argparse.rst:81 +#: ../../library/argparse.rst:93 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" -msgstr "" +msgstr "parents_ - 一個 :class:`ArgumentParser` 物件的串列,其引數也應該被包含" -#: ../../library/argparse.rst:84 +#: ../../library/argparse.rst:96 msgid "formatter_class_ - A class for customizing the help output" -msgstr "" +msgstr "formatter_class_ - 用於自訂說明輸出的類別" -#: ../../library/argparse.rst:86 +#: ../../library/argparse.rst:98 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" -msgstr "" +msgstr "prefix_chars_ - 前綴可選引數的字元集合(預設值:'-')" -#: ../../library/argparse.rst:89 +#: ../../library/argparse.rst:101 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" -#: ../../library/argparse.rst:92 +#: ../../library/argparse.rst:104 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" -#: ../../library/argparse.rst:95 +#: ../../library/argparse.rst:107 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "" -#: ../../library/argparse.rst:98 +#: ../../library/argparse.rst:110 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:100 +#: ../../library/argparse.rst:112 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " "unambiguous. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:103 +#: ../../library/argparse.rst:115 msgid "" "exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " "with error info when an error occurs. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:106 +#: ../../library/argparse.rst:118 msgid "*allow_abbrev* parameter was added." msgstr "新增 *allow_abbrev* 參數。" -#: ../../library/argparse.rst:109 +#: ../../library/argparse.rst:121 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" -#: ../../library/argparse.rst:113 +#: ../../library/argparse.rst:125 msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:116 ../../library/argparse.rst:598 +#: ../../library/argparse.rst:128 ../../library/argparse.rst:610 msgid "The following sections describe how each of these are used." msgstr "" -#: ../../library/argparse.rst:122 +#: ../../library/argparse.rst:134 msgid "prog" -msgstr "" +msgstr "prog" -#: ../../library/argparse.rst:125 +#: ../../library/argparse.rst:137 msgid "" "By default, :class:`ArgumentParser` calculates the name of the program to " "display in help messages depending on the way the Python interpreter was run:" msgstr "" -#: ../../library/argparse.rst:128 +#: ../../library/argparse.rst:140 msgid "" "The :func:`base name ` of ``sys.argv[0]`` if a file was " "passed as argument." msgstr "" -#: ../../library/argparse.rst:130 +#: ../../library/argparse.rst:142 msgid "" "The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " "zipfile was passed as argument." msgstr "" -#: ../../library/argparse.rst:132 +#: ../../library/argparse.rst:144 msgid "" "The Python interpreter name followed by ``-m`` followed by the module or " "package name if the :option:`-m` option was used." msgstr "" -#: ../../library/argparse.rst:135 +#: ../../library/argparse.rst:147 msgid "" "This default is almost always desirable because it will make the help " "messages match the string that was used to invoke the program on the command " @@ -235,7 +257,7 @@ msgid "" "supplied using the ``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:140 +#: ../../library/argparse.rst:152 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -251,14 +273,14 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:147 +#: ../../library/argparse.rst:159 msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" -#: ../../library/argparse.rst:153 +#: ../../library/argparse.rst:165 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -278,18 +300,18 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:164 +#: ../../library/argparse.rst:176 msgid "usage" -msgstr "" +msgstr "usage" -#: ../../library/argparse.rst:166 +#: ../../library/argparse.rst:178 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains. The default message can be overridden with the " "``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:170 +#: ../../library/argparse.rst:182 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -319,17 +341,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:183 +#: ../../library/argparse.rst:195 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:190 +#: ../../library/argparse.rst:202 msgid "description" -msgstr "描述" +msgstr "description" -#: ../../library/argparse.rst:192 +#: ../../library/argparse.rst:204 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -338,24 +360,24 @@ msgid "" "messages for the various arguments." msgstr "" -#: ../../library/argparse.rst:198 +#: ../../library/argparse.rst:210 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:203 +#: ../../library/argparse.rst:215 msgid "epilog" -msgstr "" +msgstr "epilog" -#: ../../library/argparse.rst:205 +#: ../../library/argparse.rst:217 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:209 +#: ../../library/argparse.rst:221 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -383,29 +405,29 @@ msgstr "" "\n" "And that's how you'd foo a bar" -#: ../../library/argparse.rst:222 +#: ../../library/argparse.rst:234 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:228 +#: ../../library/argparse.rst:240 msgid "parents" -msgstr "" +msgstr "parents" -#: ../../library/argparse.rst:230 +#: ../../library/argparse.rst:242 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " -"shared arguments and passed to ``parents=`` argument to :class:" -"`ArgumentParser` can be used. The ``parents=`` argument takes a list of :" -"class:`ArgumentParser` objects, collects all the positional and optional " -"actions from them, and adds these actions to the :class:`ArgumentParser` " -"object being constructed::" +"shared arguments and passed to ``parents=`` argument " +"to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a " +"list of :class:`ArgumentParser` objects, collects all the positional and " +"optional actions from them, and adds these actions to " +"the :class:`ArgumentParser` object being constructed::" msgstr "" -#: ../../library/argparse.rst:237 +#: ../../library/argparse.rst:249 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -433,40 +455,40 @@ msgstr "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:250 +#: ../../library/argparse.rst:262 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:255 +#: ../../library/argparse.rst:267 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:263 +#: ../../library/argparse.rst:275 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:265 +#: ../../library/argparse.rst:277 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:274 +#: ../../library/argparse.rst:286 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " -"more control over how textual descriptions are displayed. By default, :class:" -"`ArgumentParser` objects line-wrap the description_ and epilog_ texts in " -"command-line help messages::" +"more control over how textual descriptions are displayed. By " +"default, :class:`ArgumentParser` objects line-wrap the description_ and " +"epilog_ texts in command-line help messages::" msgstr "" -#: ../../library/argparse.rst:279 +#: ../../library/argparse.rst:291 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -490,14 +512,14 @@ msgid "" "will be wrapped across a couple lines" msgstr "" -#: ../../library/argparse.rst:299 +#: ../../library/argparse.rst:311 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:303 +#: ../../library/argparse.rst:315 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -521,8 +543,29 @@ msgid "" "options:\n" " -h, --help show this help message and exit" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.RawDescriptionHelpFormatter,\n" +"... description=textwrap.dedent('''\\\n" +"... Please do not mess up this text!\n" +"... --------------------------------\n" +"... I have indented it\n" +"... exactly the way\n" +"... I want it\n" +"... '''))\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"Please do not mess up this text!\n" +"--------------------------------\n" +" I have indented it\n" +" exactly the way\n" +" I want it\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" -#: ../../library/argparse.rst:325 +#: ../../library/argparse.rst:337 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple newlines are " @@ -530,13 +573,13 @@ msgid "" "between the newlines." msgstr "" -#: ../../library/argparse.rst:330 +#: ../../library/argparse.rst:342 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:333 +#: ../../library/argparse.rst:345 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -568,14 +611,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" -#: ../../library/argparse.rst:348 +#: ../../library/argparse.rst:360 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:352 +#: ../../library/argparse.rst:364 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -607,11 +650,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo int" -#: ../../library/argparse.rst:369 +#: ../../library/argparse.rst:381 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:371 +#: ../../library/argparse.rst:383 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -619,7 +662,7 @@ msgid "" "``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" -#: ../../library/argparse.rst:377 +#: ../../library/argparse.rst:389 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -633,18 +676,18 @@ msgstr "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" -#: ../../library/argparse.rst:383 +#: ../../library/argparse.rst:395 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:389 +#: ../../library/argparse.rst:401 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:391 +#: ../../library/argparse.rst:403 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -654,7 +697,7 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:398 +#: ../../library/argparse.rst:410 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -672,54 +715,55 @@ msgstr "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" -#: ../../library/argparse.rst:406 +#: ../../library/argparse.rst:418 msgid "" -"Arguments read from a file must by default be one per line (but see also :" -"meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " -"were in the same place as the original file referencing argument on the " +"Arguments read from a file must by default be one per line (but see " +"also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if " +"they were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " "'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:412 +#: ../../library/argparse.rst:424 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: ../../library/argparse.rst:415 +#: ../../library/argparse.rst:427 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:418 +#: ../../library/argparse.rst:430 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " -"from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to the :term:`filesystem encoding " -"and error handler`. Arguments file should be encoded in UTF-8 instead of " -"ANSI Codepage on Windows." +"from default (e.g. :func:`locale.getpreferredencoding(False) " +"` and ``\"strict\"``) to the :term:`filesystem " +"encoding and error handler`. Arguments file should be encoded in UTF-8 " +"instead of ANSI Codepage on Windows." msgstr "" -#: ../../library/argparse.rst:426 +#: ../../library/argparse.rst:438 msgid "argument_default" msgstr "argument_default" -#: ../../library/argparse.rst:428 +#: ../../library/argparse.rst:440 msgid "" -"Generally, argument defaults are specified either by passing a default to :" -"meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." -"set_defaults` methods with a specific set of name-value pairs. Sometimes " -"however, it may be useful to specify a single parser-wide default for " -"arguments. This can be accomplished by passing the ``argument_default=`` " -"keyword argument to :class:`ArgumentParser`. For example, to globally " -"suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we " -"supply ``argument_default=SUPPRESS``::" +"Generally, argument defaults are specified either by passing a default " +"to :meth:`~ArgumentParser.add_argument` or by calling " +"the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-" +"value pairs. Sometimes however, it may be useful to specify a single parser-" +"wide default for arguments. This can be accomplished by passing the " +"``argument_default=`` keyword argument to :class:`ArgumentParser`. For " +"example, to globally suppress attribute creation " +"on :meth:`~ArgumentParser.parse_args` calls, we supply " +"``argument_default=SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:437 +#: ../../library/argparse.rst:449 msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -737,22 +781,22 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:448 +#: ../../library/argparse.rst:460 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:450 +#: ../../library/argparse.rst:462 msgid "" -"Normally, when you pass an argument list to the :meth:`~ArgumentParser." -"parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " -"abbreviations ` of long options." +"Normally, when you pass an argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it :ref:`recognizes abbreviations ` of long options." msgstr "" -#: ../../library/argparse.rst:454 +#: ../../library/argparse.rst:466 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:456 +#: ../../library/argparse.rst:468 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -768,11 +812,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:467 +#: ../../library/argparse.rst:479 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:469 +#: ../../library/argparse.rst:481 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -780,7 +824,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:474 +#: ../../library/argparse.rst:486 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -796,7 +840,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:481 +#: ../../library/argparse.rst:493 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -804,7 +848,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:486 +#: ../../library/argparse.rst:498 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -830,7 +874,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:497 +#: ../../library/argparse.rst:509 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -838,25 +882,25 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:504 +#: ../../library/argparse.rst:516 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:506 +#: ../../library/argparse.rst:518 msgid "" "By default, :class:`ArgumentParser` objects add an option which simply " "displays the parser's help message. If ``-h`` or ``--help`` is supplied at " "the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" -#: ../../library/argparse.rst:510 +#: ../../library/argparse.rst:522 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " -"This can be achieved by passing ``False`` as the ``add_help=`` argument to :" -"class:`ArgumentParser`::" +"This can be achieved by passing ``False`` as the ``add_help=`` argument " +"to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:514 +#: ../../library/argparse.rst:526 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -874,7 +918,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:522 +#: ../../library/argparse.rst:534 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -882,7 +926,7 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:528 +#: ../../library/argparse.rst:540 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -898,24 +942,25 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:537 +#: ../../library/argparse.rst:549 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:539 +#: ../../library/argparse.rst:551 msgid "" -"Normally, when you pass an invalid argument list to the :meth:" -"`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " -"print a *message* to :data:`sys.stderr` and exit with a status code of 2." +"Normally, when you pass an invalid argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it will print a *message* to :data:`sys.stderr` and exit with a status code " +"of 2." msgstr "" -#: ../../library/argparse.rst:543 +#: ../../library/argparse.rst:555 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:546 +#: ../../library/argparse.rst:558 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -941,113 +986,113 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:560 +#: ../../library/argparse.rst:572 msgid "The add_argument() method" -msgstr "" +msgstr "add_argument() 方法" -#: ../../library/argparse.rst:566 +#: ../../library/argparse.rst:578 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:569 +#: ../../library/argparse.rst:581 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " "or ``'-f', '--foo'``." msgstr "" -#: ../../library/argparse.rst:572 +#: ../../library/argparse.rst:584 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:575 +#: ../../library/argparse.rst:587 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:577 +#: ../../library/argparse.rst:589 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:579 +#: ../../library/argparse.rst:591 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:582 +#: ../../library/argparse.rst:594 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:584 +#: ../../library/argparse.rst:596 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:586 +#: ../../library/argparse.rst:598 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:589 +#: ../../library/argparse.rst:601 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:591 +#: ../../library/argparse.rst:603 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:593 +#: ../../library/argparse.rst:605 msgid "" -"dest_ - The name of the attribute to be added to the object returned by :" -"meth:`parse_args`." +"dest_ - The name of the attribute to be added to the object returned " +"by :meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:596 +#: ../../library/argparse.rst:608 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" -#: ../../library/argparse.rst:604 +#: ../../library/argparse.rst:616 msgid "name or flags" -msgstr "" +msgstr "name or flags" -#: ../../library/argparse.rst:606 +#: ../../library/argparse.rst:618 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " -"a list of filenames, is expected. The first arguments passed to :meth:" -"`~ArgumentParser.add_argument` must therefore be either a series of flags, " -"or a simple argument name." +"a list of filenames, is expected. The first arguments passed " +"to :meth:`~ArgumentParser.add_argument` must therefore be either a series of " +"flags, or a simple argument name." msgstr "" -#: ../../library/argparse.rst:612 +#: ../../library/argparse.rst:624 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:614 +#: ../../library/argparse.rst:626 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:616 +#: ../../library/argparse.rst:628 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:618 +#: ../../library/argparse.rst:630 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:620 +#: ../../library/argparse.rst:632 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:624 +#: ../../library/argparse.rst:636 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1071,11 +1116,11 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:639 +#: ../../library/argparse.rst:651 msgid "action" -msgstr "" +msgstr "action" -#: ../../library/argparse.rst:641 +#: ../../library/argparse.rst:653 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1085,13 +1130,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:647 +#: ../../library/argparse.rst:659 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action." msgstr "" -#: ../../library/argparse.rst:650 +#: ../../library/argparse.rst:662 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1099,7 +1144,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:655 +#: ../../library/argparse.rst:667 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" @@ -1111,7 +1156,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:660 +#: ../../library/argparse.rst:672 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -1119,7 +1164,7 @@ msgid "" "``True`` respectively::" msgstr "" -#: ../../library/argparse.rst:665 +#: ../../library/argparse.rst:677 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1135,7 +1180,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:672 +#: ../../library/argparse.rst:684 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1144,7 +1189,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:678 +#: ../../library/argparse.rst:690 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='append')\n" @@ -1156,7 +1201,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:683 +#: ../../library/argparse.rst:695 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1165,7 +1210,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:689 +#: ../../library/argparse.rst:701 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='append_const', " @@ -1183,7 +1228,7 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:695 +#: ../../library/argparse.rst:707 msgid "" "``'extend'`` - This stores a list and appends each item from the multi-value " "argument list to it. The ``'extend'`` action is typically used with the " @@ -1192,7 +1237,7 @@ msgid "" "will be appended to the list. Example usage::" msgstr "" -#: ../../library/argparse.rst:703 +#: ../../library/argparse.rst:715 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1208,13 +1253,13 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:710 +#: ../../library/argparse.rst:722 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:713 +#: ../../library/argparse.rst:725 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -1222,11 +1267,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:718 +#: ../../library/argparse.rst:730 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:720 +#: ../../library/argparse.rst:732 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1234,14 +1279,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:725 +#: ../../library/argparse.rst:737 msgid "" -"``'version'`` - This expects a ``version=`` keyword argument in the :meth:" -"`~ArgumentParser.add_argument` call, and prints version information and " -"exits when invoked::" +"``'version'`` - This expects a ``version=`` keyword argument in " +"the :meth:`~ArgumentParser.add_argument` call, and prints version " +"information and exits when invoked::" msgstr "" -#: ../../library/argparse.rst:729 +#: ../../library/argparse.rst:741 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1257,13 +1302,13 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:735 +#: ../../library/argparse.rst:747 msgid "" "Only actions that consume command-line arguments (e.g. ``'store'``, " "``'append'`` or ``'extend'``) can be used with positional arguments." msgstr "" -#: ../../library/argparse.rst:740 +#: ../../library/argparse.rst:752 msgid "" "You may also specify an arbitrary action by passing an :class:`Action` " "subclass or other object that implements the same interface. The :class:`!" @@ -1271,7 +1316,7 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:745 +#: ../../library/argparse.rst:757 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1285,7 +1330,7 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:765 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " @@ -1294,11 +1339,11 @@ msgid "" "their registered name." msgstr "" -#: ../../library/argparse.rst:758 +#: ../../library/argparse.rst:770 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:760 +#: ../../library/argparse.rst:772 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1319,15 +1364,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:778 +#: ../../library/argparse.rst:790 msgid "For more details, see :class:`Action`." msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:784 +#: ../../library/argparse.rst:796 msgid "nargs" msgstr "nargs" -#: ../../library/argparse.rst:786 +#: ../../library/argparse.rst:798 msgid "" ":class:`ArgumentParser` objects usually associate a single command-line " "argument with a single action to be taken. The ``nargs`` keyword argument " @@ -1336,13 +1381,13 @@ msgid "" "are:" msgstr "" -#: ../../library/argparse.rst:791 +#: ../../library/argparse.rst:803 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:794 +#: ../../library/argparse.rst:806 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1356,13 +1401,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:812 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:805 +#: ../../library/argparse.rst:817 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1372,7 +1417,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:812 +#: ../../library/argparse.rst:824 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1394,13 +1439,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:822 +#: ../../library/argparse.rst:834 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:825 +#: ../../library/argparse.rst:837 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1426,7 +1471,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:839 +#: ../../library/argparse.rst:851 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1434,7 +1479,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:856 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1450,14 +1495,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:853 +#: ../../library/argparse.rst:865 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:857 +#: ../../library/argparse.rst:869 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1475,7 +1520,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:865 +#: ../../library/argparse.rst:877 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1484,11 +1529,11 @@ msgid "" "``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:875 +#: ../../library/argparse.rst:887 msgid "const" -msgstr "" +msgstr "const" -#: ../../library/argparse.rst:877 +#: ../../library/argparse.rst:889 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1496,17 +1541,18 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:881 +#: ../../library/argparse.rst:893 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " -"the ``const`` value to one of the attributes of the object returned by :meth:" -"`~ArgumentParser.parse_args`. See the action_ description for examples. If " -"``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " -"receive a default value of ``None``." +"the ``const`` value to one of the attributes of the object returned " +"by :meth:`~ArgumentParser.parse_args`. See the action_ description for " +"examples. If ``const`` is not provided " +"to :meth:`~ArgumentParser.add_argument`, it will receive a default value of " +"``None``." msgstr "" -#: ../../library/argparse.rst:889 +#: ../../library/argparse.rst:901 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1516,27 +1562,27 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:896 +#: ../../library/argparse.rst:908 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" -#: ../../library/argparse.rst:903 +#: ../../library/argparse.rst:915 msgid "default" -msgstr "" +msgstr "default" -#: ../../library/argparse.rst:905 +#: ../../library/argparse.rst:917 msgid "" "All optional arguments and some positional arguments may be omitted at the " -"command line. The ``default`` keyword argument of :meth:`~ArgumentParser." -"add_argument`, whose value defaults to ``None``, specifies what value should " -"be used if the command-line argument is not present. For optional arguments, " -"the ``default`` value is used when the option string was not present at the " -"command line::" +"command line. The ``default`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, " +"specifies what value should be used if the command-line argument is not " +"present. For optional arguments, the ``default`` value is used when the " +"option string was not present at the command line::" msgstr "" -#: ../../library/argparse.rst:912 +#: ../../library/argparse.rst:924 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1552,13 +1598,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:919 +#: ../../library/argparse.rst:931 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:922 +#: ../../library/argparse.rst:934 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1570,15 +1616,16 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:927 +#: ../../library/argparse.rst:939 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " -"conversion argument, if provided, before setting the attribute on the :class:" -"`Namespace` return value. Otherwise, the parser uses the value as is::" +"conversion argument, if provided, before setting the attribute on " +"the :class:`Namespace` return value. Otherwise, the parser uses the value " +"as is::" msgstr "" -#: ../../library/argparse.rst:932 +#: ../../library/argparse.rst:944 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1592,13 +1639,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:938 +#: ../../library/argparse.rst:950 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:941 +#: ../../library/argparse.rst:953 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1614,20 +1661,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:948 +#: ../../library/argparse.rst:960 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" -#: ../../library/argparse.rst:952 +#: ../../library/argparse.rst:964 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:955 +#: ../../library/argparse.rst:967 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1643,11 +1690,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:966 +#: ../../library/argparse.rst:978 msgid "type" -msgstr "" +msgstr "type" -#: ../../library/argparse.rst:968 +#: ../../library/argparse.rst:980 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1656,26 +1703,26 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:974 +#: ../../library/argparse.rst:986 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:977 +#: ../../library/argparse.rst:989 msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " -"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" -"`ValueError`, the exception is caught and a nicely formatted error message " -"is displayed. Other exception types are not handled." +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, " +"or :exc:`ValueError`, the exception is caught and a nicely formatted error " +"message is displayed. Other exception types are not handled." msgstr "" -#: ../../library/argparse.rst:983 +#: ../../library/argparse.rst:995 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:985 +#: ../../library/argparse.rst:997 msgid "" "import argparse\n" "import pathlib\n" @@ -1701,11 +1748,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:998 +#: ../../library/argparse.rst:1010 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1000 +#: ../../library/argparse.rst:1012 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1723,14 +1770,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1010 +#: ../../library/argparse.rst:1022 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1014 +#: ../../library/argparse.rst:1026 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -1738,15 +1785,15 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1019 +#: ../../library/argparse.rst:1031 msgid "" "For example, JSON or YAML conversions have complex error cases that require " -"better reporting than can be given by the ``type`` keyword. A :exc:`~json." -"JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` " -"exception would not be handled at all." +"better reporting than can be given by the ``type`` keyword. " +"A :exc:`~json.JSONDecodeError` would not be well formatted and " +"a :exc:`FileNotFoundError` exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1024 +#: ../../library/argparse.rst:1036 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1756,17 +1803,17 @@ msgid "" "files." msgstr "" -#: ../../library/argparse.rst:1031 +#: ../../library/argparse.rst:1043 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1038 +#: ../../library/argparse.rst:1050 msgid "choices" -msgstr "" +msgstr "choices" -#: ../../library/argparse.rst:1040 +#: ../../library/argparse.rst:1052 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -1775,7 +1822,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1046 +#: ../../library/argparse.rst:1058 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1795,26 +1842,26 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1055 +#: ../../library/argparse.rst:1067 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified." msgstr "" -#: ../../library/argparse.rst:1059 +#: ../../library/argparse.rst:1071 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1062 +#: ../../library/argparse.rst:1074 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1065 +#: ../../library/argparse.rst:1077 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -1822,11 +1869,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1074 +#: ../../library/argparse.rst:1086 msgid "required" -msgstr "" +msgstr "required" -#: ../../library/argparse.rst:1076 +#: ../../library/argparse.rst:1088 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -1834,7 +1881,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1081 +#: ../../library/argparse.rst:1093 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1852,24 +1899,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1089 +#: ../../library/argparse.rst:1101 msgid "" -"As the example shows, if an option is marked as ``required``, :meth:" -"`~ArgumentParser.parse_args` will report an error if that option is not " -"present at the command line." +"As the example shows, if an option is marked as " +"``required``, :meth:`~ArgumentParser.parse_args` will report an error if " +"that option is not present at the command line." msgstr "" -#: ../../library/argparse.rst:1095 +#: ../../library/argparse.rst:1107 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1102 +#: ../../library/argparse.rst:1114 msgid "help" -msgstr "幫助" +msgstr "help" -#: ../../library/argparse.rst:1104 +#: ../../library/argparse.rst:1116 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -1877,16 +1924,16 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1109 +#: ../../library/argparse.rst:1121 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " -"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " -"``%(type)s``, etc.::" +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%" +"(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1114 +#: ../../library/argparse.rst:1126 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -1912,19 +1959,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1126 +#: ../../library/argparse.rst:1138 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1129 +#: ../../library/argparse.rst:1141 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1132 +#: ../../library/argparse.rst:1144 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -1942,11 +1989,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1144 +#: ../../library/argparse.rst:1156 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1146 +#: ../../library/argparse.rst:1158 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -1958,7 +2005,7 @@ msgid "" "command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1155 +#: ../../library/argparse.rst:1167 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1990,11 +2037,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1170 +#: ../../library/argparse.rst:1182 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1172 +#: ../../library/argparse.rst:1184 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2026,21 +2073,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1187 +#: ../../library/argparse.rst:1199 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1191 +#: ../../library/argparse.rst:1203 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1195 +#: ../../library/argparse.rst:1207 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2064,21 +2111,21 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1210 +#: ../../library/argparse.rst:1222 msgid "dest" msgstr "dest" -#: ../../library/argparse.rst:1212 +#: ../../library/argparse.rst:1224 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " -"attribute is determined by the ``dest`` keyword argument of :meth:" -"`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` " -"is normally supplied as the first argument to :meth:`~ArgumentParser." -"add_argument`::" +"attribute is determined by the ``dest`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`. For positional argument actions, " +"``dest`` is normally supplied as the first argument " +"to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1219 +#: ../../library/argparse.rst:1231 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2090,7 +2137,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1224 +#: ../../library/argparse.rst:1236 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2102,7 +2149,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1233 +#: ../../library/argparse.rst:1245 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2120,11 +2167,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1241 +#: ../../library/argparse.rst:1253 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1243 +#: ../../library/argparse.rst:1255 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2136,11 +2183,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1252 +#: ../../library/argparse.rst:1264 msgid "deprecated" -msgstr "" +msgstr "deprecated" -#: ../../library/argparse.rst:1254 +#: ../../library/argparse.rst:1266 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2151,14 +2198,14 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1264 +#: ../../library/argparse.rst:1276 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" ">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" ">>> parser.parse_args([])\n" "Namespace(legs=0)\n" -">>> parser.parse_args(['--legs', '4']) \n" +">>> parser.parse_args(['--legs', '4'])\n" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" msgstr "" @@ -2167,32 +2214,32 @@ msgstr "" ">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" ">>> parser.parse_args([])\n" "Namespace(legs=0)\n" -">>> parser.parse_args(['--legs', '4']) \n" +">>> parser.parse_args(['--legs', '4'])\n" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1277 +#: ../../library/argparse.rst:1289 msgid "Action classes" -msgstr "" +msgstr "Action 類別" -#: ../../library/argparse.rst:1279 +#: ../../library/argparse.rst:1291 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " -"follows this API may be passed as the ``action`` parameter to :meth:" -"`~ArgumentParser.add_argument`." +"follows this API may be passed as the ``action`` parameter " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1288 +#: ../../library/argparse.rst:1300 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " "from the command line. The :class:`!Action` class must accept the two " -"positional arguments plus any keyword arguments passed to :meth:" -"`ArgumentParser.add_argument` except for the ``action`` itself." +"positional arguments plus any keyword arguments passed " +"to :meth:`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1294 +#: ../../library/argparse.rst:1306 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2201,46 +2248,46 @@ msgid "" "is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1302 +#: ../../library/argparse.rst:1314 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1305 +#: ../../library/argparse.rst:1317 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1307 +#: ../../library/argparse.rst:1319 msgid "" -"*namespace* - The :class:`Namespace` object that will be returned by :meth:" -"`~ArgumentParser.parse_args`. Most actions add an attribute to this object " -"using :func:`setattr`." +"*namespace* - The :class:`Namespace` object that will be returned " +"by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to " +"this object using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1311 +#: ../../library/argparse.rst:1323 msgid "" "*values* - The associated command-line arguments, with any type conversions " -"applied. Type conversions are specified with the type_ keyword argument to :" -"meth:`~ArgumentParser.add_argument`." +"applied. Type conversions are specified with the type_ keyword argument " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1315 +#: ../../library/argparse.rst:1327 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " "associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1319 +#: ../../library/argparse.rst:1331 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " "``values``." msgstr "" -#: ../../library/argparse.rst:1324 +#: ../../library/argparse.rst:1336 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " @@ -2248,47 +2295,47 @@ msgid "" "will be used." msgstr "" -#: ../../library/argparse.rst:1330 +#: ../../library/argparse.rst:1342 msgid "The parse_args() method" msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1334 +#: ../../library/argparse.rst:1346 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1337 +#: ../../library/argparse.rst:1349 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" "add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1341 +#: ../../library/argparse.rst:1353 msgid "" -"args_ - List of strings to parse. The default is taken from :data:`sys." -"argv`." +"args_ - List of strings to parse. The default is taken " +"from :data:`sys.argv`." msgstr "" -#: ../../library/argparse.rst:1344 +#: ../../library/argparse.rst:1356 msgid "" -"namespace_ - An object to take the attributes. The default is a new empty :" -"class:`Namespace` object." +"namespace_ - An object to take the attributes. The default is a new " +"empty :class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1349 +#: ../../library/argparse.rst:1361 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1351 +#: ../../library/argparse.rst:1363 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1355 +#: ../../library/argparse.rst:1367 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2306,14 +2353,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1363 +#: ../../library/argparse.rst:1375 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1367 +#: ../../library/argparse.rst:1379 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2321,13 +2368,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1370 +#: ../../library/argparse.rst:1382 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1373 +#: ../../library/argparse.rst:1385 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2335,13 +2382,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1376 +#: ../../library/argparse.rst:1388 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1379 +#: ../../library/argparse.rst:1391 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2357,11 +2404,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1388 +#: ../../library/argparse.rst:1400 msgid "Invalid arguments" msgstr "無效引數" -#: ../../library/argparse.rst:1390 +#: ../../library/argparse.rst:1402 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2369,7 +2416,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1395 +#: ../../library/argparse.rst:1407 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2390,12 +2437,30 @@ msgid "" "usage: PROG [-h] [--foo FOO] [bar]\n" "PROG: error: extra arguments found: badger" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo', type=int)\n" +">>> parser.add_argument('bar', nargs='?')\n" +"\n" +">>> # 無效型別\n" +">>> parser.parse_args(['--foo', 'spam'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: argument --foo: invalid int value: 'spam'\n" +"\n" +">>> # 無效選項\n" +">>> parser.parse_args(['--bar'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: no such option: --bar\n" +"\n" +">>> # 錯誤引數數量\n" +">>> parser.parse_args(['spam', 'badger'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: extra arguments found: badger" -#: ../../library/argparse.rst:1416 +#: ../../library/argparse.rst:1428 msgid "Arguments containing ``-``" msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1418 +#: ../../library/argparse.rst:1430 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2407,7 +2472,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1426 +#: ../../library/argparse.rst:1438 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2440,7 +2505,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1456 +#: ../../library/argparse.rst:1468 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2448,7 +2513,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1461 +#: ../../library/argparse.rst:1473 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2456,24 +2521,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1464 +#: ../../library/argparse.rst:1476 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1470 +#: ../../library/argparse.rst:1482 msgid "Argument abbreviations (prefix matching)" -msgstr "" +msgstr "引數縮寫 (前綴匹配)" -#: ../../library/argparse.rst:1472 +#: ../../library/argparse.rst:1484 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1476 +#: ../../library/argparse.rst:1488 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2497,17 +2562,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1487 +#: ../../library/argparse.rst:1499 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1493 +#: ../../library/argparse.rst:1505 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1495 +#: ../../library/argparse.rst:1507 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " @@ -2515,7 +2580,7 @@ msgid "" "useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1500 +#: ../../library/argparse.rst:1512 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2541,24 +2606,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1515 +#: ../../library/argparse.rst:1527 msgid "The Namespace object" msgstr "命名空間物件" -#: ../../library/argparse.rst:1519 +#: ../../library/argparse.rst:1531 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1522 +#: ../../library/argparse.rst:1534 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1526 +#: ../../library/argparse.rst:1538 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2572,14 +2637,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1532 +#: ../../library/argparse.rst:1544 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1536 +#: ../../library/argparse.rst:1548 msgid "" ">>> class C:\n" "... pass\n" @@ -2601,92 +2666,93 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1548 +#: ../../library/argparse.rst:1560 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1551 +#: ../../library/argparse.rst:1563 msgid "Sub-commands" -msgstr "" +msgstr "子命令" -#: ../../library/argparse.rst:1558 +#: ../../library/argparse.rst:1570 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " -"functions which require different kinds of command-line arguments. :class:" -"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" -"add_subparsers` method. The :meth:`!add_subparsers` method is normally " -"called with no arguments and returns a special action object. This object " -"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " -"command name and any :class:`!ArgumentParser` constructor arguments, and " -"returns an :class:`!ArgumentParser` object that can be modified as usual." +"functions which require different kinds of command-line " +"arguments. :class:`ArgumentParser` supports the creation of such subcommands " +"with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method " +"is normally called with no arguments and returns a special action object. " +"This object has a single method, :meth:`~_SubParsersAction.add_parser`, " +"which takes a command name and any :class:`!ArgumentParser` constructor " +"arguments, and returns an :class:`!ArgumentParser` object that can be " +"modified as usual." msgstr "" -#: ../../library/argparse.rst:1570 +#: ../../library/argparse.rst:1582 msgid "Description of parameters:" msgstr "參數的解釋:" -#: ../../library/argparse.rst:1572 +#: ../../library/argparse.rst:1584 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1576 +#: ../../library/argparse.rst:1588 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1579 +#: ../../library/argparse.rst:1591 msgid "" "*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1583 +#: ../../library/argparse.rst:1595 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1586 +#: ../../library/argparse.rst:1598 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1589 +#: ../../library/argparse.rst:1601 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1592 +#: ../../library/argparse.rst:1604 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1595 +#: ../../library/argparse.rst:1607 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1597 +#: ../../library/argparse.rst:1609 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1600 +#: ../../library/argparse.rst:1612 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1602 +#: ../../library/argparse.rst:1614 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2709,7 +2775,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1621 +#: ../../library/argparse.rst:1633 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -2719,7 +2785,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1628 +#: ../../library/argparse.rst:1640 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -2728,7 +2794,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1636 +#: ../../library/argparse.rst:1648 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2786,14 +2852,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1664 +#: ../../library/argparse.rst:1676 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1668 +#: ../../library/argparse.rst:1680 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2829,7 +2895,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1685 +#: ../../library/argparse.rst:1697 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -2837,7 +2903,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1690 +#: ../../library/argparse.rst:1702 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2853,13 +2919,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1697 +#: ../../library/argparse.rst:1709 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1711 +#: ../../library/argparse.rst:1723 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -2867,7 +2933,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1716 +#: ../../library/argparse.rst:1728 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2902,7 +2968,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1748 +#: ../../library/argparse.rst:1760 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -2912,7 +2978,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1755 +#: ../../library/argparse.rst:1767 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -2932,24 +2998,24 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1764 +#: ../../library/argparse.rst:1776 msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1769 +#: ../../library/argparse.rst:1781 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1773 +#: ../../library/argparse.rst:1785 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " -"argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" -"`FileType` objects as their type will open command-line arguments as files " -"with the requested modes, buffer sizes, encodings and error handling (see " -"the :func:`open` function for more details)::" +"argument of :meth:`ArgumentParser.add_argument`. Arguments that " +"have :class:`FileType` objects as their type will open command-line " +"arguments as files with the requested modes, buffer sizes, encodings and " +"error handling (see the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1779 +#: ../../library/argparse.rst:1791 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -2967,14 +3033,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1785 +#: ../../library/argparse.rst:1797 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1789 +#: ../../library/argparse.rst:1801 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -2986,15 +3052,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1794 +#: ../../library/argparse.rst:1806 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1799 +#: ../../library/argparse.rst:1811 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1804 +#: ../../library/argparse.rst:1816 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3003,7 +3069,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1810 +#: ../../library/argparse.rst:1822 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3027,18 +3093,18 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1821 +#: ../../library/argparse.rst:1833 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " -"has an :meth:`~ArgumentParser.add_argument` method just like a regular :" -"class:`ArgumentParser`. When an argument is added to the group, the parser " -"treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`!add_argument_group` method " -"accepts *title* and *description* arguments which can be used to customize " -"this display::" +"has an :meth:`~ArgumentParser.add_argument` method just like a " +"regular :class:`ArgumentParser`. When an argument is added to the group, " +"the parser treats it just like a normal argument, but displays the argument " +"in a separate group for help messages. The :meth:`!add_argument_group` " +"method accepts *title* and *description* arguments which can be used to " +"customize this display::" msgstr "" -#: ../../library/argparse.rst:1829 +#: ../../library/argparse.rst:1841 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3076,22 +3142,22 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1847 +#: ../../library/argparse.rst:1859 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " -"argument group. These parameters have the same meaning as in the :class:" -"`ArgumentParser` constructor, but apply specifically to the argument group " -"rather than the entire parser." +"argument group. These parameters have the same meaning as in " +"the :class:`ArgumentParser` constructor, but apply specifically to the " +"argument group rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1852 +#: ../../library/argparse.rst:1864 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1855 +#: ../../library/argparse.rst:1867 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3099,18 +3165,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:1863 +#: ../../library/argparse.rst:1875 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1867 +#: ../../library/argparse.rst:1879 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:1871 +#: ../../library/argparse.rst:1883 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3136,14 +3202,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:1883 +#: ../../library/argparse.rst:1895 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:1887 +#: ../../library/argparse.rst:1899 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3161,15 +3227,16 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:1895 +#: ../../library/argparse.rst:1907 msgid "" "Note that currently mutually exclusive argument groups do not support the " -"*title* and *description* arguments of :meth:`~ArgumentParser." -"add_argument_group`. However, a mutually exclusive group can be added to an " -"argument group that has a title and description. For example::" +"*title* and *description* arguments " +"of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive " +"group can be added to an argument group that has a title and description. " +"For example::" msgstr "" -#: ../../library/argparse.rst:1901 +#: ../../library/argparse.rst:1913 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3205,7 +3272,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1918 +#: ../../library/argparse.rst:1930 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3213,20 +3280,20 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:1926 +#: ../../library/argparse.rst:1938 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:1930 +#: ../../library/argparse.rst:1942 msgid "" -"Most of the time, the attributes of the object returned by :meth:" -"`parse_args` will be fully determined by inspecting the command-line " -"arguments and the argument actions. :meth:`set_defaults` allows some " +"Most of the time, the attributes of the object returned " +"by :meth:`parse_args` will be fully determined by inspecting the command-" +"line arguments and the argument actions. :meth:`set_defaults` allows some " "additional attributes that are determined without any inspection of the " "command line to be added::" msgstr "" -#: ../../library/argparse.rst:1936 +#: ../../library/argparse.rst:1948 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3240,12 +3307,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:1942 +#: ../../library/argparse.rst:1954 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:1944 +#: ../../library/argparse.rst:1956 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3259,20 +3326,21 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:1950 +#: ../../library/argparse.rst:1962 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:1956 +#: ../../library/argparse.rst:1968 msgid "" -"Get the default value for a namespace attribute, as set by either :meth:" -"`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" +"Get the default value for a namespace attribute, as set by " +"either :meth:`~ArgumentParser.add_argument` or " +"by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:1960 +#: ../../library/argparse.rst:1972 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3284,54 +3352,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:1967 +#: ../../library/argparse.rst:1979 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:1969 +#: ../../library/argparse.rst:1981 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:1975 +#: ../../library/argparse.rst:1987 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:1981 +#: ../../library/argparse.rst:1993 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:1985 +#: ../../library/argparse.rst:1997 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:1990 +#: ../../library/argparse.rst:2002 msgid "" -"Return a string containing a brief description of how the :class:" -"`ArgumentParser` should be invoked on the command line." +"Return a string containing a brief description of how " +"the :class:`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:1995 +#: ../../library/argparse.rst:2007 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2000 +#: ../../library/argparse.rst:2012 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2004 +#: ../../library/argparse.rst:2016 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3342,7 +3410,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2013 +#: ../../library/argparse.rst:2025 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3356,19 +3424,19 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2020 +#: ../../library/argparse.rst:2032 msgid "" -":ref:`Prefix matching ` rules apply to :meth:" -"`~ArgumentParser.parse_known_args`. The parser may consume an option even if " -"it's just a prefix of one of its known options, instead of leaving it in the " -"remaining arguments list." +":ref:`Prefix matching ` rules apply " +"to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an " +"option even if it's just a prefix of one of its known options, instead of " +"leaving it in the remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2027 +#: ../../library/argparse.rst:2039 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2031 +#: ../../library/argparse.rst:2043 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3376,20 +3444,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2036 +#: ../../library/argparse.rst:2048 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:2052 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2043 +#: ../../library/argparse.rst:2055 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3399,18 +3467,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2049 +#: ../../library/argparse.rst:2061 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2053 +#: ../../library/argparse.rst:2065 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2057 +#: ../../library/argparse.rst:2069 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3424,17 +3492,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2065 +#: ../../library/argparse.rst:2077 msgid "" -"This method prints a usage message, including the *message*, to :data:`sys." -"stderr` and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, " +"to :data:`sys.stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2070 +#: ../../library/argparse.rst:2082 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2075 +#: ../../library/argparse.rst:2087 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3442,7 +3510,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2080 +#: ../../library/argparse.rst:2092 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -3450,15 +3518,16 @@ msgid "" "positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2085 +#: ../../library/argparse.rst:2097 msgid "" -"The following example shows the difference between :meth:`~ArgumentParser." -"parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " -"former returns ``['2', '3']`` as unparsed arguments, while the latter " -"collects all the positionals into ``rest``. ::" +"The following example shows the difference " +"between :meth:`~ArgumentParser.parse_known_args` " +"and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns " +"``['2', '3']`` as unparsed arguments, while the latter collects all the " +"positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2091 +#: ../../library/argparse.rst:2103 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3478,7 +3547,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2100 +#: ../../library/argparse.rst:2112 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3486,11 +3555,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2109 +#: ../../library/argparse.rst:2121 msgid "Registering custom types or actions" msgstr "" -#: ../../library/argparse.rst:2113 +#: ../../library/argparse.rst:2125 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " @@ -3498,7 +3567,7 @@ msgid "" "the type by their registered name instead of their callable name." msgstr "" -#: ../../library/argparse.rst:2118 +#: ../../library/argparse.rst:2130 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " @@ -3506,12 +3575,12 @@ msgid "" "be registered, and object, the callable to be registered." msgstr "" -#: ../../library/argparse.rst:2123 +#: ../../library/argparse.rst:2135 msgid "" "The following example shows how to register a custom type with a parser::" msgstr "" -#: ../../library/argparse.rst:2125 +#: ../../library/argparse.rst:2137 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -3527,42 +3596,42 @@ msgid "" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" -#: ../../library/argparse.rst:2137 +#: ../../library/argparse.rst:2149 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2141 +#: ../../library/argparse.rst:2153 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2143 +#: ../../library/argparse.rst:2155 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2148 +#: ../../library/argparse.rst:2160 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2152 +#: ../../library/argparse.rst:2164 msgid "Guides and Tutorials" msgstr "" -#: ../../library/argparse.rst:803 +#: ../../library/argparse.rst:815 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:803 ../../library/argparse.rst:837 -#: ../../library/argparse.rst:851 +#: ../../library/argparse.rst:815 ../../library/argparse.rst:849 +#: ../../library/argparse.rst:863 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:837 +#: ../../library/argparse.rst:849 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:851 +#: ../../library/argparse.rst:863 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/array.po b/library/array.po index 8d66dac4e6..d1ee4d39e6 100644 --- a/library/array.po +++ b/library/array.po @@ -254,9 +254,9 @@ msgstr "這個模組定義了下方的型別:" #: ../../library/array.rst:81 msgid "" "A new array whose items are restricted by *typecode*, and initialized from " -"the optional *initializer* value, which must be a :class:`bytes` or :class:" -"`bytearray` object, a Unicode string, or iterable over elements of the " -"appropriate type." +"the optional *initializer* value, which must be a :class:`bytes` " +"or :class:`bytearray` object, a Unicode string, or iterable over elements of " +"the appropriate type." msgstr "" "一個新的陣列中的元素被 *typecode* 限制,並由選用的 *initializer* 參數初始化," "*initializer* 必須是一個 :class:`bytes` 或 :class:`bytearray` 物件、一個 " @@ -321,7 +321,7 @@ msgid "" "as long as the array exists and no length-changing operations are applied to " "it." msgstr "" -"回傳一個 tuple ``(address, length)`` 表示當前的記憶體位置和陣列儲存元素的緩衝" +"回傳一個 tuple ``(address, length)`` 表示目前的記憶體位置和陣列儲存元素的緩衝" "區記憶體長度。緩衝區的長度單位是位元組,並可以用 ``array.buffer_info()[1] * " "array.itemsize`` 計算得到。這偶爾會在底層操作需要記憶體位置的輸出輸入時很有" "用,例如 :c:func:`!ioctl` 指令。只要陣列存在且沒有使用任何更改長度的操作時," @@ -342,9 +342,9 @@ msgstr "" #: ../../library/array.rst:138 msgid "" "\"Byteswap\" all items of the array. This is only supported for values " -"which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:" -"`RuntimeError` is raised. It is useful when reading data from a file " -"written on a machine with a different byte order." +"which are 1, 2, 4, or 8 bytes in size; for other types of " +"values, :exc:`RuntimeError` is raised. It is useful when reading data from " +"a file written on a machine with a different byte order." msgstr "" "\"Byteswap\" 所有陣列中的物件。這只有支援物件長度為 1、2、4 或 8 位元組的陣" "列,其他型別的值會導致 :exc:`RuntimeError`。這在從機器讀取位元順序不同的檔案" @@ -357,9 +357,10 @@ msgstr "回傳 *x* 在陣列中出現了幾次。" #: ../../library/array.rst:151 msgid "" "Append items from *iterable* to the end of the array. If *iterable* is " -"another array, it must have *exactly* the same type code; if not, :exc:" -"`TypeError` will be raised. If *iterable* is not an array, it must be " -"iterable and its elements must be the right type to be appended to the array." +"another array, it must have *exactly* the same type code; if " +"not, :exc:`TypeError` will be raised. If *iterable* is not an array, it " +"must be iterable and its elements must be the right type to be appended to " +"the array." msgstr "" "從 *iterable* 中新增元素到陣列的尾端,如果 *iterable* 是另一個陣列,它必須有" "完全相同的 type code,如果不同會導致 :exc:`TypeError`。如果 *iterable* 不是一" @@ -369,8 +370,8 @@ msgstr "" #: ../../library/array.rst:159 msgid "" "Appends items from the :term:`bytes-like object`, interpreting its content " -"as an array of machine values (as if it had been read from a file using the :" -"meth:`fromfile` method)." +"as an array of machine values (as if it had been read from a file using " +"the :meth:`fromfile` method)." msgstr "" "從 :term:`bytes-like object` 中新增元素。讀取時會將其內容當作一個機器數值組成" "的陣列(就像從檔案中使用 :meth:`fromfile` 方法讀出的資料)。" @@ -382,9 +383,9 @@ msgstr "將 :meth:`!fromstring` 更名為 :meth:`frombytes`,使其更加清晰 #: ../../library/array.rst:169 msgid "" "Read *n* items (as machine values) from the :term:`file object` *f* and " -"append them to the end of the array. If less than *n* items are available, :" -"exc:`EOFError` is raised, but the items that were available are still " -"inserted into the array." +"append them to the end of the array. If less than *n* items are " +"available, :exc:`EOFError` is raised, but the items that were available are " +"still inserted into the array." msgstr "" "從 :term:`file object` *f* 讀取 *n* 個元素(作為機器數值),接著將這些元素加" "入陣列的最尾端。如果只有少於 *n* 個有效的元素會導致 :exc:`EOFError`,但有效的" @@ -392,30 +393,30 @@ msgstr "" #: ../../library/array.rst:177 msgid "" -"Append items from the list. This is equivalent to ``for x in list: a." -"append(x)`` except that if there is a type error, the array is unchanged." +"Append items from the list. This is equivalent to ``for x in list: " +"a.append(x)`` except that if there is a type error, the array is unchanged." msgstr "" "從 list 中新增元素。這等價於 ``for x in list: a.append(x)``,除了有型別錯誤產" "生時,陣列會保持原狀不會被更改。" #: ../../library/array.rst:183 -#, fuzzy msgid "" "Extends this array with data from the given Unicode string. The array must " "have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " "Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to " "an array of some other type." msgstr "" -"用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u``;其他的型別" -"會導致 :exc:`ValueError` 被引發。使用 ``array.frombytes(unicodestring." -"encode(enc))`` 來新增 Unicode 資料到一個其他型別的陣列。" +"用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u`` 或 ``'w'``;" +"其他的型別會導致 :exc:`ValueError` 被引發。使用 " +"``array.frombytes(unicodestring.encode(enc))`` 來新增 Unicode 資料到一個其他" +"型別的陣列。" #: ../../library/array.rst:191 msgid "" "Return the smallest *i* such that *i* is the index of the first occurrence " "of *x* in the array. The optional arguments *start* and *stop* can be " -"specified to search for *x* within a subsection of the array. Raise :exc:" -"`ValueError` if *x* is not found." +"specified to search for *x* within a subsection of the array. " +"Raise :exc:`ValueError` if *x* is not found." msgstr "" "回傳 *i* 的最小數值,使得 *i* 成為陣列之中第一次出現 *x* 的索引。選擇性的引" "數 *start* 及 *stop* 則可以被用來在指定的陣列空間中搜尋 *x*。如果 *x* 不存在" @@ -478,12 +479,13 @@ msgstr "不更改元素,將陣列轉為一般的 list。" #, fuzzy msgid "" "Convert the array to a Unicode string. The array must have a type ``'u'`` " -"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes()." -"decode(enc)`` to obtain a Unicode string from an array of some other type." +"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use " +"``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of " +"some other type." msgstr "" -"將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導致 :" -"exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型別的" -"陣列轉為 Unicode 字串。" +"將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導" +"致 :exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型" +"別的陣列轉為 Unicode 字串。" #: ../../library/array.rst:257 #, fuzzy @@ -501,8 +503,8 @@ msgstr "" "陣列物件的字串表示形式為 ``array(typecode, initializer)``。若為空陣列則參數 " "*initializer* 被省略,若 *typecode* 是 ``'u'`` 將被表示為 Unicode 字串,其他" "情況則被表示為由數字組成的 list。只要 :class:`~array.array` class(類別)透" -"過 ``from array import array`` 的方式引入,便能確保該字串表示能透過 :func:" -"`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" +"過 ``from array import array`` 的方式引入,便能確保該字串表示能透" +"過 :func:`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" #: ../../library/array.rst:269 #, fuzzy diff --git a/library/ast.po b/library/ast.po index 2bfa5f5ae3..8e6a61b972 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-04-29 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,16 +34,16 @@ msgid "" msgstr "" ":mod:`ast` 模組可以幫助 Python 應用程式處理 Python 抽象語法文法 (abstract " "syntax grammar) 樹狀資料結構。抽象語法本身可能會隨著每個 Python 版本發布而改" -"變;此模組有助於以程式化的方式來得知當前文法的面貌。" +"變;此模組有助於以程式化的方式來得知目前文法的面貌。" #: ../../library/ast.rst:23 msgid "" -"An abstract syntax tree can be generated by passing :data:`ast." -"PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using " -"the :func:`parse` helper provided in this module. The result will be a tree " -"of objects whose classes all inherit from :class:`ast.AST`. An abstract " -"syntax tree can be compiled into a Python code object using the built-in :" -"func:`compile` function." +"An abstract syntax tree can be generated by " +"passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in " +"function, or using the :func:`parse` helper provided in this module. The " +"result will be a tree of objects whose classes all inherit " +"from :class:`ast.AST`. An abstract syntax tree can be compiled into a " +"Python code object using the built-in :func:`compile` function." msgstr "" "要生成抽象語法樹,可以透過將 :data:`ast.PyCF_ONLY_AST` 作為旗標傳遞給內建函" "式 :func:`compile` 或使用此模組所提供的 :func:`parse` 輔助函式。結果將會是一" @@ -239,13 +239,13 @@ msgstr "節點 (Node) 類別" #: ../../library/ast.rst:46 msgid "" "This is the base of all AST node classes. The actual node classes are " -"derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:" -"`above `. They are defined in the :mod:`!_ast` C module " -"and re-exported in :mod:`ast`." +"derived from the :file:`Parser/Python.asdl` file, which is " +"reproduced :ref:`above `. They are defined in the :mod:`!" +"_ast` C module and re-exported in :mod:`ast`." msgstr "" -"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/Python." -"asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義於 :" -"mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" +"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/" +"Python.asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義" +"於 :mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" #: ../../library/ast.rst:51 msgid "" @@ -257,11 +257,11 @@ msgid "" "rules with alternatives (aka \"sums\"), the left-hand side class is " "abstract: only instances of specific constructor nodes are ever created." msgstr "" -"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` 或 :class:" -"`ast.expr`\\ )。此外,也為每個右側的建構函式 (constructor) 定義了一個類別;" -"這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承自 :class:`ast." -"expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類別是抽象的:僅" -"有特定建構函式節點的實例會被建立。" +"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` " +"或 :class:`ast.expr`\\ )。此外,也為每個右側的建構函式 (constructor) 定義了" +"一個類別;這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承" +"自 :class:`ast.expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類" +"別是抽象的:僅有特定建構函式節點的實例會被建立。" #: ../../library/ast.rst:64 msgid "" @@ -275,8 +275,8 @@ msgid "" "the type as defined in the grammar. For example, :class:`ast.BinOp` " "instances have an attribute :attr:`left` of type :class:`ast.expr`." msgstr "" -"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例如,:" -"class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" +"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例" +"如,:class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" #: ../../library/ast.rst:71 msgid "" @@ -287,16 +287,16 @@ msgid "" "compiling an AST with :func:`compile`." msgstr "" "如果這些屬性在文法中被標記為可選(使用問號),則該值可能為 ``None``。如果屬性" -"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使用 :func:" -"`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" +"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使" +"用 :func:`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" #: ../../library/ast.rst:79 msgid "" "The :attr:`!_field_types` attribute on each concrete class is a dictionary " "mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" -"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也在 :attr:" -"`_fields` 中列出)對映到其型別的字典。" +"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也" +"在 :attr:`_fields` 中列出)對映到其型別的字典。" #: ../../library/ast.rst:82 msgid "" @@ -310,21 +310,22 @@ msgstr "" #: ../../library/ast.rst:94 msgid "" -"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" -"`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " -"attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " -"last line numbers of source text span (1-indexed so the first line is line " -"1) and the :attr:`col_offset` and :attr:`end_col_offset` are the " -"corresponding UTF-8 byte offsets of the first and last tokens that generated " -"the node. The UTF-8 offset is recorded because the parser uses UTF-8 " -"internally." -msgstr "" -":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具有 :attr:`lineno`、:" -"attr:`col_offset`、:attr:`end_lineno` 和 :attr:`end_col_offset` 屬性。:attr:" -"`lineno` 和 :attr:`end_lineno` 是原始文本跨度 (source text span) 的第一個和最" -"後一個列號(1-indexed,因此第一列號是 1)以及 :attr:`col_offset` 和 :attr:" -"`end_col_offset` 是生成節點的第一個和最後一個標記對應的 UTF-8 位元組偏移量。" -"會記錄 UTF-8 偏移量是因為剖析器 (parser) 內部使用 UTF-8。" +"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses " +"have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, " +"and :attr:`end_col_offset` attributes. The :attr:`lineno` " +"and :attr:`end_lineno` are the first and last line numbers of source text " +"span (1-indexed so the first line is line 1) and the :attr:`col_offset` " +"and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the " +"first and last tokens that generated the node. The UTF-8 offset is recorded " +"because the parser uses UTF-8 internally." +msgstr "" +":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具" +"有 :attr:`lineno`、:attr:`col_offset`、:attr:`end_lineno` " +"和 :attr:`end_col_offset` 屬性。:attr:`lineno` 和 :attr:`end_lineno` 是原始文" +"本跨度 (source text span) 的第一個和最後一個列號(1-indexed,因此第一列號是 " +"1)以及 :attr:`col_offset` 和 :attr:`end_col_offset` 是生成節點的第一個和最後" +"一個標記對應的 UTF-8 位元組偏移量。會記錄 UTF-8 偏移量是因為剖析器 (parser) " +"內部使用 UTF-8。" #: ../../library/ast.rst:103 msgid "" @@ -335,7 +336,7 @@ msgid "" msgstr "" "請注意,編譯器並不需要結束位置,因此其為可選的。結束偏移量在最後一個符號\\ *" "之後*,例如可以使用 ``source_line[node.col_offset : node.end_col_offset]`` 來" -"獲取單列運算式節點 (expression node) 的原始片段。" +"取得單列運算式節點 (expression node) 的原始片段。" #: ../../library/ast.rst:108 msgid "" @@ -376,15 +377,15 @@ msgid "" "If a field that is optional in the grammar is omitted from the constructor, " "it defaults to ``None``. If a list field is omitted, it defaults to the " "empty list. If a field of type :class:`!ast.expr_context` is omitted, it " -"defaults to :class:`Load() `. If any other field is omitted, a :" -"exc:`DeprecationWarning` is raised and the AST node will not have this " +"defaults to :class:`Load() `. If any other field is omitted, " +"a :exc:`DeprecationWarning` is raised and the AST node will not have this " "field. In Python 3.15, this condition will raise an error." msgstr "" "如果建構函式中省略了文法中可選的欄位,則它預設為 ``None``。如果省略串列欄位," -"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設為 :" -"class:`Load() `。如果省略任何其他欄位,則會引發 :exc:" -"`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這種情況會" -"引發錯誤。" +"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設" +"為 :class:`Load() `。如果省略任何其他欄位,則會引" +"發 :exc:`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這" +"種情況會引發錯誤。" #: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." @@ -398,10 +399,10 @@ msgstr "以它們的值表示簡單索引,擴充切片 (slice) 則以元組 (t #: ../../library/ast.rst:139 msgid "" -"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" -"class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " -"but they will be removed in future Python releases. In the meantime, " -"instantiating them will return an instance of a different class." +"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!" +"ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still " +"available, but they will be removed in future Python releases. In the " +"meantime, instantiating them will return an instance of a different class." msgstr "" "舊的類別 :class:`!ast.Num`、:class:`!ast.Str`、:class:`!ast.Bytes`、:class:`!" "ast.NameConstant` 和 :class:`!ast.Ellipsis` 仍然可用,但它們將在未來的 " @@ -431,8 +432,9 @@ msgstr "" #: ../../library/ast.rst:160 msgid "" "The descriptions of the specific node classes displayed here were initially " -"adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." +"adapted from the fantastic `Green Tree Snakes `__ project and all its " +"contributors." msgstr "" "這裡顯示的特定節點類別的描述最初是從出色的 `Green Tree Snakes `__ 專案和所有貢獻者那裡改編而來" @@ -447,8 +449,8 @@ msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" -"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。由 :func:`ast." -"parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" +"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。" +"由 :func:`ast.parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" #: ../../library/ast.rst:176 msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." @@ -516,8 +518,8 @@ msgstr "" #: ../../library/ast.rst:212 msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" -"`list`。" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` " +"的 :class:`list`。" #: ../../library/ast.rst:214 msgid "" @@ -665,8 +667,8 @@ msgstr "" #: ../../library/ast.rst:299 msgid "" -"An f-string, comprising a series of :class:`FormattedValue` and :class:" -"`Constant` nodes." +"An f-string, comprising a series of :class:`FormattedValue` " +"and :class:`Constant` nodes." msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" @@ -718,8 +720,8 @@ msgid "" "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " "``(x,y)=something``), and :class:`Load` otherwise." msgstr "" -"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 ``(x," -"y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" +"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 " +"``(x,y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" #: ../../library/ast.rst:331 msgid "" @@ -885,9 +887,9 @@ msgstr "" #: ../../library/ast.rst:432 msgid "" -"A ``*var`` variable reference. ``value`` holds the variable, typically a :" -"class:`Name` node. This type must be used when building a :class:`Call` node " -"with ``*args``." +"A ``*var`` variable reference. ``value`` holds the variable, typically " +"a :class:`Name` node. This type must be used when building a :class:`Call` " +"node with ``*args``." msgstr "" "一個 ``*var`` 變數參照。``value`` 保存變數,通常是一個 :class:`Name` 節點。在" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" @@ -930,14 +932,14 @@ msgstr "運算式" msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " -"container. ``value`` holds one of the other nodes in this section, a :class:" -"`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:" -"`YieldFrom` node." +"container. ``value`` holds one of the other nodes in this section, " +"a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` " +"or :class:`YieldFrom` node." msgstr "" "當運算式(例如函式呼叫)本身作為陳述式出現且未使用或儲存其回傳值時,它將被包" -"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節點::class:" -"`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` 或 :class:" -"`YieldFrom`" +"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節" +"點::class:`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` " +"或 :class:`YieldFrom`" #: ../../library/ast.rst:465 msgid "" @@ -1090,11 +1092,11 @@ msgstr "比較運算子 token。" #: ../../library/ast.rst:593 msgid "" -"A function call. ``func`` is the function, which will often be a :class:" -"`Name` or :class:`Attribute` object. Of the arguments:" +"A function call. ``func`` is the function, which will often be " +"a :class:`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" -"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` 或 :class:" -"`Attribute` 物件。而在引數中:" +"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` " +"或 :class:`Attribute` 物件。而在引數中:" #: ../../library/ast.rst:596 msgid "``args`` holds a list of the arguments passed by position." @@ -1183,14 +1185,14 @@ msgstr "" #: ../../library/ast.rst:644 msgid "" -"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" -"`Name`. ``attr`` is a bare string giving the name of the attribute, and " -"``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how " -"the attribute is acted on." +"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically " +"a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, " +"and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to " +"how the attribute is acted on." msgstr "" "屬性的存取,例如 ``d.keys``。``value`` 是一個節點,通常是一個 :class:`Name`。" -"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能是 :class:" -"`Load`、:class:`Store` 或 :class:`Del`。" +"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能" +"是 :class:`Load`、:class:`Store` 或 :class:`Del`。" #: ../../library/ast.rst:649 msgid "" @@ -1211,9 +1213,9 @@ msgstr "" #: ../../library/ast.rst:661 msgid "" "A named expression. This AST node is produced by the assignment expressions " -"operator (also known as the walrus operator). As opposed to the :class:" -"`Assign` node in which the first argument can be multiple nodes, in this " -"case both ``target`` and ``value`` must be single nodes." +"operator (also known as the walrus operator). As opposed to " +"the :class:`Assign` node in which the first argument can be multiple nodes, " +"in this case both ``target`` and ``value`` must be single nodes." msgstr "" "一個附名運算式 (named expression)。該 AST 節點由賦值運算式運算子(也稱為海象" "運算子)產生。相對於 :class:`Assign` 節點之第一個引數可為多個節點,在這種情況" @@ -1240,14 +1242,15 @@ msgstr "下標 (Subscripting)" #: ../../library/ast.rst:681 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " -"sequence or mapping). ``slice`` is an index, slice or key. It can be a :" -"class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:" -"`Store` or :class:`Del` according to the action performed with the subscript." +"sequence or mapping). ``slice`` is an index, slice or key. It can be " +"a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` " +"is :class:`Load`, :class:`Store` or :class:`Del` according to the action " +"performed with the subscript." msgstr "" "一個下標,例如 ``l[1]``。``value`` 是下標物件(通常是序列或對映)。``slice`` " "是索引、切片或鍵。它可以是一個 :class:`Tuple` 並包含一個 :class:`Slice`。根據" -"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` 或 :class:" -"`Del`。" +"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` " +"或 :class:`Del`。" #: ../../library/ast.rst:687 msgid "" @@ -1414,9 +1417,9 @@ msgid "" "``iter`` is the object to iterate over. ``ifs`` is a list of test " "expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常是 :" -"class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是測試" -"運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" +"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常" +"是 :class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是" +"測試運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" #: ../../library/ast.rst:786 msgid "" @@ -1564,7 +1567,7 @@ msgstr "" "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" #: ../../library/ast.rst:863 ../../library/ast.rst:1158 -#: ../../library/ast.rst:1352 ../../library/ast.rst:1881 +#: ../../library/ast.rst:1352 ../../library/ast.rst:1918 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" @@ -1617,25 +1620,26 @@ msgstr "" msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " -"``annotation`` is the annotation, such as a :class:`Constant` or :class:" -"`Name` node. ``value`` is a single optional node." +"``annotation`` is the annotation, such as a :class:`Constant` " +"or :class:`Name` node. ``value`` is a single optional node." msgstr "" -"帶有型別註釋的賦值。``target`` 是單個節點,可以是 :class:`Name`、:class:" -"`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" -"`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" +"帶有型別註釋的賦值。``target`` 是單個節點,可以" +"是 :class:`Name`、:class:`Attribute` 或 :class:`Subscript`。``annotation`` 是" +"註釋,例如 :class:`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節" +"點。" #: ../../library/ast.rst:896 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " -"(indicating a \"simple\" target). A \"simple\" target consists solely of a :" -"class:`Name` node that does not appear between parentheses; all other " -"targets are considered complex. Only simple targets appear in the :attr:" -"`~object.__annotations__` dictionary of modules and classes." +"(indicating a \"simple\" target). A \"simple\" target consists solely of " +"a :class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in " +"the :attr:`~object.__annotations__` dictionary of modules and classes." msgstr "" "``simple`` 總會是 0(表示一個「複雜」目標)或 1(表示一個「簡單」目標)。一個" "「簡單」目標僅包含一個 :class:`Name` 節點,且不出現在括號之間;所有其他目標都" -"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`~object." -"__annotations__` 字典中。" +"被視為是複雜的。只有簡單目標會出現在模組和類別" +"的 :attr:`~object.__annotations__` 字典中。" #: ../../library/ast.rst:902 msgid "" @@ -1729,16 +1733,16 @@ msgid "" "value for 1." msgstr "" "增加賦值 (augmented assignment),例如 ``a += 1``。在下面的範例中,``target`` " -"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" -"`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" +"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` " +"是 :class:`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" #: ../../library/ast.rst:951 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" -"class:`List` 類別。" +"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` " +"或 :class:`List` 類別。" #: ../../library/ast.rst:954 msgid "" @@ -1764,8 +1768,8 @@ msgid "" "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` 或 :" -"class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " +"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` " +"或 :class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" #: ../../library/ast.rst:971 @@ -1810,11 +1814,11 @@ msgstr "" #: ../../library/ast.rst:998 msgid "" -"Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" -"class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." +"Represents a ``del`` statement. ``targets`` is a list of nodes, such " +"as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" -"`Attribute` 或 :class:`Subscript` 節點。" +"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例" +"如 :class:`Name`、:class:`Attribute` 或 :class:`Subscript` 節點。" #: ../../library/ast.rst:1001 msgid "" @@ -1855,9 +1859,9 @@ msgstr "" #: ../../library/ast.rst:1027 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " -"statement. ``name`` is the name of the alias, ``type_params`` is a list of :" -"ref:`type parameters `, and ``value`` is the value of the " -"type alias." +"statement. ``name`` is the name of the alias, ``type_params`` is a list " +"of :ref:`type parameters `, and ``value`` is the value of " +"the type alias." msgstr "" "透過 :keyword:`type` 陳述式建立的\\ :ref:`型別別名 (type alias) `。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " @@ -1990,8 +1994,8 @@ msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存 #: ../../library/ast.rst:1112 msgid "" -"An ``if`` statement. ``test`` holds a single node, such as a :class:" -"`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." +"An ``if`` statement. ``test`` holds a single node, such as " +"a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" @@ -2060,17 +2064,17 @@ msgstr "" #: ../../library/ast.rst:1149 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " -"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" -"class:`Subscript` node. ``iter`` holds the item to be looped over, again as " -"a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " +"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` " +"or :class:`Subscript` node. ``iter`` holds the item to be looped over, again " +"as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " "Those in ``orelse`` are executed if the loop finishes normally, rather than " "via a ``break`` statement." msgstr "" -"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單個 :class:`Name`、:" -"class:`Tuple`、:class:`List`、:class:`Attribute` 或 :class:`Subscript` 節點。" -"``iter`` 保存要迴圈跑過的項目,也為單個節點。``body`` 和 ``orelse`` 包含要執" -"行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " -"``break`` 陳述式執行。" +"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單" +"個 :class:`Name`、:class:`Tuple`、:class:`List`、:class:`Attribute` " +"或 :class:`Subscript` 節點。``iter`` 保存要迴圈跑過的項目,也為單個節點。" +"``body`` 和 ``orelse`` 包含要執行的節點串列。如果迴圈正常完成,則執行 " +"``orelse`` 中的內容,而不是透過 ``break`` 陳述式執行。" #: ../../library/ast.rst:1160 msgid "" @@ -2118,7 +2122,7 @@ msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare #: ../../library/ast.rst:1186 msgid "" -">> print(ast.dump(ast.parse(\"\"\"\n" +">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" "... ...\n" "... else:\n" @@ -2135,7 +2139,7 @@ msgid "" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgstr "" -">> print(ast.dump(ast.parse(\"\"\"\n" +">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" "... ...\n" "... else:\n" @@ -2351,10 +2355,10 @@ msgid "" "clause). ``name`` is a raw string for the name to hold the exception, or " "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一個 :class:" -"`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子句)。" -"``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " -"``None``。``body`` 是節點串列。" +"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一" +"個 :class:`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子" +"句)。``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則" +"為 ``None``。``body`` 是節點串列。" #: ../../library/ast.rst:1321 msgid "" @@ -2412,13 +2416,14 @@ msgstr "" #: ../../library/ast.rst:1357 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " -"context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" -"`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` " -"if that isn't used." +"context manager, often a :class:`Call` node. ``optional_vars`` is " +"a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or " +"``None`` if that isn't used." msgstr "" -"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一個 :" -"class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" -"class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" +"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一" +"個 :class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分" +"的 :class:`Name`、:class:`Tuple` 或 :class:`List`,或者如果不使用則為 " +"``None`` 。" #: ../../library/ast.rst:1362 msgid "" @@ -2482,8 +2487,8 @@ msgstr "" #: ../../library/ast.rst:1401 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " -"match pattern that the subject will be matched against. Note that the :class:" -"`AST` nodes produced for patterns differ from those produced for " +"match pattern that the subject will be matched against. Note that " +"the :class:`AST` nodes produced for patterns differ from those produced for " "expressions, even when they share the same syntax." msgstr "" "``match`` 陳述式中的單個案例模式。``pattern`` 包含主題將與之匹配的匹配模式。" @@ -3121,30 +3126,93 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1762 +#: ../../library/ast.rst:1761 +msgid "Type annotations" +msgstr "" + +#: ../../library/ast.rst:1765 +msgid "" +"A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " +"specified by the form ``# type: ignore ``." +msgstr "" + +#: ../../library/ast.rst:1768 +msgid "" +">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " +"indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1))],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='')])\n" +">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', " +"type_comments=True), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='x', ctx=Store()),\n" +" annotation=Name(id='bool', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=1)],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='[assignment]')])" +msgstr "" +">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " +"indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1))],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='')])\n" +">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', " +"type_comments=True), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='x', ctx=Store()),\n" +" annotation=Name(id='bool', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=1)],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='[assignment]')])" + +#: ../../library/ast.rst:1791 +msgid "" +":class:`!TypeIgnore` nodes are not generated when the *type_comments* " +"parameter is set to ``False`` (default). See :func:`ast.parse` for more " +"details." +msgstr "" + +#: ../../library/ast.rst:1799 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1764 +#: ../../library/ast.rst:1801 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1769 +#: ../../library/ast.rst:1806 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " -"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" -"`Tuple`, it represents constraints; otherwise it represents the bound. " -"``default_value`` is the default value; if the :class:`!TypeVar` has no " -"default, this attribute will be set to ``None``." +"``bound`` is the bound or constraints, if any. If ``bound`` is " +"a :class:`Tuple`, it represents constraints; otherwise it represents the " +"bound. ``default_value`` is the default value; if the :class:`!TypeVar` has " +"no default, this attribute will be set to ``None``." msgstr "" "一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" -"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" -"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" -"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一" +"個 :class:`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如" +"果 :class:`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" -#: ../../library/ast.rst:1775 +#: ../../library/ast.rst:1812 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " "indent=4))\n" @@ -3178,12 +3246,12 @@ msgstr "" " slice=Name(id='T', ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1794 ../../library/ast.rst:1829 -#: ../../library/ast.rst:1861 +#: ../../library/ast.rst:1831 ../../library/ast.rst:1866 +#: ../../library/ast.rst:1898 msgid "Added the *default_value* parameter." msgstr "新增 *default_value* 參數。" -#: ../../library/ast.rst:1799 +#: ../../library/ast.rst:1836 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " "specification. ``default_value`` is the default value; if the :class:`!" @@ -3192,9 +3260,9 @@ msgstr "" "一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " "是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" -#: ../../library/ast.rst:1803 +#: ../../library/ast.rst:1840 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" "Module(\n" " body=[\n" @@ -3203,7 +3271,7 @@ msgid "" " type_params=[\n" " ParamSpec(\n" " name='P',\n" -" default_value=Tuple(\n" +" default_value=List(\n" " elts=[\n" " Name(id='int', ctx=Load()),\n" " Name(id='str', ctx=Load())],\n" @@ -3217,7 +3285,7 @@ msgid "" " ctx=Load()),\n" " ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" "Module(\n" " body=[\n" @@ -3226,7 +3294,7 @@ msgstr "" " type_params=[\n" " ParamSpec(\n" " name='P',\n" -" default_value=Tuple(\n" +" default_value=List(\n" " elts=[\n" " Name(id='int', ctx=Load()),\n" " Name(id='str', ctx=Load())],\n" @@ -3240,7 +3308,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1834 +#: ../../library/ast.rst:1871 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " "tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " @@ -3250,7 +3318,7 @@ msgstr "" "``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" "會被設為 ``None``。" -#: ../../library/ast.rst:1838 +#: ../../library/ast.rst:1875 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " "indent=4))\n" @@ -3292,27 +3360,27 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1865 +#: ../../library/ast.rst:1902 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1869 +#: ../../library/ast.rst:1906 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1871 +#: ../../library/ast.rst:1908 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1872 +#: ../../library/ast.rst:1909 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1873 +#: ../../library/ast.rst:1910 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1874 +#: ../../library/ast.rst:1911 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -3320,20 +3388,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1876 +#: ../../library/ast.rst:1913 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1877 ../../library/ast.rst:2040 +#: ../../library/ast.rst:1914 ../../library/ast.rst:2077 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1883 ../../library/ast.rst:2067 -#: ../../library/ast.rst:2078 +#: ../../library/ast.rst:1920 ../../library/ast.rst:2104 +#: ../../library/ast.rst:2115 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1889 +#: ../../library/ast.rst:1926 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -3341,7 +3409,7 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1892 +#: ../../library/ast.rst:1929 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3365,17 +3433,17 @@ msgstr "" " arg(arg='y')]),\n" " body=Constant(value=Ellipsis)))])" -#: ../../library/ast.rst:1908 +#: ../../library/ast.rst:1945 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:1910 +#: ../../library/ast.rst:1947 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:1911 +#: ../../library/ast.rst:1948 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -3383,7 +3451,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:1913 +#: ../../library/ast.rst:1950 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -3391,7 +3459,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:1915 +#: ../../library/ast.rst:1952 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -3400,7 +3468,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:1922 +#: ../../library/ast.rst:1959 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -3408,12 +3476,12 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:1927 +#: ../../library/ast.rst:1964 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:1929 +#: ../../library/ast.rst:1966 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3487,11 +3555,11 @@ msgstr "" " Name(id='decorator2', ctx=Load())],\n" " returns=Constant(value='return annotation'))])" -#: ../../library/ast.rst:1969 +#: ../../library/ast.rst:2006 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:1971 +#: ../../library/ast.rst:2008 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -3505,7 +3573,7 @@ msgstr "" " Return(\n" " value=Constant(value=4))])" -#: ../../library/ast.rst:1983 +#: ../../library/ast.rst:2020 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " @@ -3514,7 +3582,7 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:1986 +#: ../../library/ast.rst:2023 msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -3544,12 +3612,12 @@ msgstr "" " value=YieldFrom(\n" " value=Name(id='x', ctx=Load())))])" -#: ../../library/ast.rst:2006 +#: ../../library/ast.rst:2043 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2008 +#: ../../library/ast.rst:2045 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3587,38 +3655,38 @@ msgstr "" " 'y',\n" " 'z'])])" -#: ../../library/ast.rst:2031 +#: ../../library/ast.rst:2068 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2033 +#: ../../library/ast.rst:2070 msgid "``name`` is a raw string for the class name" -msgstr "``name`` 是類別名的原始字串" +msgstr "``name`` 是類別名稱的原始字串" -#: ../../library/ast.rst:2034 +#: ../../library/ast.rst:2071 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2035 +#: ../../library/ast.rst:2072 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" -"`3115`." +"'metaclass'. Other keywords will be passed to the metaclass, as " +"per :pep:`3115`." msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2037 +#: ../../library/ast.rst:2074 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2039 +#: ../../library/ast.rst:2076 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2042 +#: ../../library/ast.rst:2079 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3666,25 +3734,25 @@ msgstr "" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())])])" -#: ../../library/ast.rst:2071 +#: ../../library/ast.rst:2108 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2075 +#: ../../library/ast.rst:2112 msgid "" -"An ``async def`` function definition. Has the same fields as :class:" -"`FunctionDef`." +"An ``async def`` function definition. Has the same fields " +"as :class:`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2084 +#: ../../library/ast.rst:2121 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -"一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" -"`AsyncFunctionDef` 主體 (body) 中有效。" +"一個 ``await`` 運算式。``value`` 是它等待的東西。僅" +"在 :class:`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2087 +#: ../../library/ast.rst:2124 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3716,7 +3784,7 @@ msgstr "" " value=Call(\n" " func=Name(id='other_func', ctx=Load()))))])])" -#: ../../library/ast.rst:2108 +#: ../../library/ast.rst:2145 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3725,24 +3793,24 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2113 +#: ../../library/ast.rst:2150 msgid "" -"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" -"class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." -"boolop` and :class:`ast.expr_context`) on the returned tree will be " -"singletons. Changes to one will be reflected in all other occurrences of the " -"same value (e.g. :class:`ast.Add`)." +"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " +"of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " +"and :class:`ast.expr_context`) on the returned tree will be singletons. " +"Changes to one will be reflected in all other occurrences of the same value " +"(e.g. :class:`ast.Add`)." msgstr "" -"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點(\\ :class:`ast." -"operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class: :class:`ast." -"boolop` 和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所" -"有其他出現的相同值中(例如 :class:`ast.Add`\\ )。" +"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點" +"(\\ :class:`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class: :class:`ast.boolop` " +"和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所有其他出" +"現的相同值中(例如 :class:`ast.Add`\\ )。" -#: ../../library/ast.rst:2121 +#: ../../library/ast.rst:2158 msgid ":mod:`ast` Helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2123 +#: ../../library/ast.rst:2160 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3750,37 +3818,37 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2128 +#: ../../library/ast.rst:2165 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " -"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." -"PyCF_OPTIMIZED_AST`` otherwise." +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and " +"``ast.PyCF_OPTIMIZED_AST`` otherwise." msgstr "" "將原始碼剖析為 AST 節點,相當於 ``compile(source, filename, mode, " "flags=FLAGS_VALUE, optimize=optimize)``,其中 ``FLAGS_VALUE`` 在 ``optimize " "<= 0`` 時為 ``ast.PyCF_ONLY_AST``,否則為 ``ast.PyCF_OPTIMIZED_AST``。" -#: ../../library/ast.rst:2133 +#: ../../library/ast.rst:2170 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " -"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :" -"func:`compile`. This will report syntax errors for misplaced type " +"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed " +"to :func:`compile`. This will report syntax errors for misplaced type " "comments. Without this flag, type comments will be ignored, and the " "``type_comment`` field on selected AST nodes will always be ``None``. In " "addition, the locations of ``# type: ignore`` comments will be returned as " "the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an " "empty list)." msgstr "" -"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` 和 :" -"pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增到傳" -"遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此旗" -"標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " +"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` " +"和 :pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增" +"到傳遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此" +"旗標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2143 +#: ../../library/ast.rst:2180 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3790,7 +3858,7 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2147 +#: ../../library/ast.rst:2184 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -3803,19 +3871,19 @@ msgid "" "``feature_version``." msgstr "" "將 ``feature_version`` 設定為元組 ``(major, minor)`` 將「盡可能」嘗試使用該 " -"Python 版本的文法進行剖析。當前 ``major`` 必須等於 ``3``。例如,設定 " +"Python 版本的文法進行剖析。目前 ``major`` 必須等於 ``3``。例如,設定 " "``feature_version=(3, 9)`` 將嘗試禁止剖析 :keyword:`match` 陳述式。目前 " "``major`` 必須為 ``3``、支援的最低版本為 ``(3, 7)``\\ (這在未來的 Python 版" "本中可能會增加);最高的是 ``sys.version_info[0:2]``。「盡可能」嘗試意味著不" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2157 +#: ../../library/ast.rst:2194 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2160 +#: ../../library/ast.rst:2197 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3829,14 +3897,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2167 +#: ../../library/ast.rst:2204 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2171 +#: ../../library/ast.rst:2208 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -3844,11 +3912,11 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2175 +#: ../../library/ast.rst:2212 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2178 +#: ../../library/ast.rst:2215 msgid "" "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " "``optimize`` argument was added." @@ -3856,16 +3924,16 @@ msgstr "" "``feature_version`` 的最低支援版本現在是 ``(3, 7)``。新增了 ``optimize`` 引" "數。" -#: ../../library/ast.rst:2185 +#: ../../library/ast.rst:2222 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " -"would produce an equivalent :class:`ast.AST` object if parsed back with :" -"func:`ast.parse`." +"would produce an equivalent :class:`ast.AST` object if parsed back " +"with :func:`ast.parse`." msgstr "" -"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." -"parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" +"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使" +"用 :func:`ast.parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2190 +#: ../../library/ast.rst:2227 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -3874,13 +3942,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2195 +#: ../../library/ast.rst:2232 msgid "" -"Trying to unparse a highly complex expression would result with :exc:" -"`RecursionError`." +"Trying to unparse a highly complex expression would result " +"with :exc:`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2203 +#: ../../library/ast.rst:2240 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -3891,7 +3959,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2208 +#: ../../library/ast.rst:2245 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -3900,7 +3968,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2213 +#: ../../library/ast.rst:2250 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -3917,60 +3985,62 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2223 +#: ../../library/ast.rst:2260 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2226 +#: ../../library/ast.rst:2263 msgid "" -"It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" -"`MemoryError` and :exc:`RecursionError` depending on the malformed input." +"It can " +"raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` " +"and :exc:`RecursionError` depending on the malformed input." msgstr "" -"它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" -"`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" +"它可能會引" +"發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:`MemoryError` " +"和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2230 +#: ../../library/ast.rst:2267 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2233 +#: ../../library/ast.rst:2270 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2236 +#: ../../library/ast.rst:2273 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2242 +#: ../../library/ast.rst:2279 msgid "" -"Return the docstring of the given *node* (which must be a :class:" -"`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" -"`Module` node), or ``None`` if it has no docstring. If *clean* is true, " -"clean up the docstring's indentation with :func:`inspect.cleandoc`." +"Return the docstring of the given *node* (which must be " +"a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, " +"or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is " +"true, clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -"回傳給定 *node* 的文件字串 (docstring)(必須是 :class:`FunctionDef`、:class:" -"`AsyncFunctionDef`、:class:`ClassDef` 或 :class:`Module` 節點)或如果它沒有文" -"件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" -"理文件字串的縮排。" +"回傳給定 *node* 的文件字串 (docstring)(必須" +"是 :class:`FunctionDef`、:class:`AsyncFunctionDef`、:class:`ClassDef` " +"或 :class:`Module` 節點)或如果它沒有文件字串則為 ``None``。如果 *clean* 為 " +"true,則使用 :func:`inspect.cleandoc` 清理文件字串的縮排。" -#: ../../library/ast.rst:2248 +#: ../../library/ast.rst:2285 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2254 +#: ../../library/ast.rst:2291 msgid "" "Get source code segment of the *source* that generated *node*. If some " -"location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" -"attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, " -"return ``None``." +"location information " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :attr:`~ast.AST.col_offset`, " +"or :attr:`~ast.AST.end_col_offset`) is missing, return ``None``." msgstr "" -"獲取生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊(:attr:`~ast.AST." -"lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" -"`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" +"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊" +"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` " +"或 :attr:`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2258 +#: ../../library/ast.rst:2295 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -3978,21 +4048,22 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2266 +#: ../../library/ast.rst:2303 msgid "" -"When you compile a node tree with :func:`compile`, the compiler expects :" -"attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " -"node that supports them. This is rather tedious to fill in for generated " -"nodes, so this helper adds these attributes recursively where not already " -"set, by setting them to the values of the parent node. It works recursively " -"starting at *node*." +"When you compile a node tree with :func:`compile`, the compiler " +"expects :attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes " +"for every node that supports them. This is rather tedious to fill in for " +"generated nodes, so this helper adds these attributes recursively where not " +"already set, by setting them to the values of the parent node. It works " +"recursively starting at *node*." msgstr "" -"當你使用 :func:`compile` 編譯節點樹時,對於每個有支援 :attr:`~ast.AST." -"lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器預期他們的這些屬性都" -"要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" -"值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" +"當你使用 :func:`compile` 編譯節點樹時,對於每個有支" +"援 :attr:`~ast.AST.lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器" +"預期他們的這些屬性都要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些" +"屬性設定為父節點的值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞" +"迴地作用。" -#: ../../library/ast.rst:2275 +#: ../../library/ast.rst:2312 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -4001,17 +4072,19 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2282 +#: ../../library/ast.rst:2319 msgid "" -"Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" -"attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " -"*old_node* to *new_node* if possible, and return *new_node*." +"Copy source location " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :attr:`~ast.AST.end_lineno`, " +"and :attr:`~ast.AST.end_col_offset`) from *old_node* to *new_node* if " +"possible, and return *new_node*." msgstr "" -"如果可行,將原始位置(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:" -"attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " -"*old_node* 複製到 *new_node*,並回傳 *new_node* 。" +"如果可行,將原始位置" +"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:attr:`~ast.AST.end_lineno` " +"和 :attr:`~ast.AST.end_col_offset` )從 *old_node* 複製到 *new_node*,並回傳 " +"*new_node* 。" -#: ../../library/ast.rst:2289 +#: ../../library/ast.rst:2326 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -4019,7 +4092,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2295 +#: ../../library/ast.rst:2332 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -4027,7 +4100,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2301 +#: ../../library/ast.rst:2338 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4036,75 +4109,75 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2308 +#: ../../library/ast.rst:2345 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " "which is forwarded by the :meth:`visit` method." msgstr "" -"節點訪問者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫訪問者函式。該函式" +"節點瀏覽者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫瀏覽者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2312 +#: ../../library/ast.rst:2349 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." -msgstr "這個類別應該被子類別化,子類別新增訪問者方法。" +msgstr "這個類別應該被子類別化,子類別新增瀏覽者方法。" -#: ../../library/ast.rst:2317 +#: ../../library/ast.rst:2354 msgid "" -"Visit a node. The default implementation calls the method called :samp:" -"`self.visit_{classname}` where *classname* is the name of the node class, " -"or :meth:`generic_visit` if that method doesn't exist." +"Visit a node. The default implementation calls the method " +"called :samp:`self.visit_{classname}` where *classname* is the name of the " +"node class, or :meth:`generic_visit` if that method doesn't exist." msgstr "" -"訪問一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " -"*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" -"`generic_visit`。" +"瀏覽一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " +"*classname* 是節點類別的名稱,或者在該方法不存在時呼" +"叫 :meth:`generic_visit`。" -#: ../../library/ast.rst:2323 +#: ../../library/ast.rst:2360 msgid "This visitor calls :meth:`visit` on all children of the node." -msgstr "該訪問者對該節點的所有子節點呼叫 :meth:`visit`。" +msgstr "該瀏覽者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2325 +#: ../../library/ast.rst:2362 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." msgstr "" -"請注意,除非訪問者呼叫 :meth:`generic_visit` 或訪問它們本身,否則不會訪問具有" -"自定義訪問者方法的節點之子節點。" +"請注意,除非瀏覽者呼叫 :meth:`generic_visit` 或瀏覽它們本身,否則不會瀏覽具有" +"自定義瀏覽者方法的節點之子節點。" -#: ../../library/ast.rst:2331 +#: ../../library/ast.rst:2368 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2333 +#: ../../library/ast.rst:2370 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " -"during traversal. For this a special visitor exists (:class:" -"`NodeTransformer`) that allows modifications." +"during traversal. For this a special visitor exists " +"(:class:`NodeTransformer`) that allows modifications." msgstr "" -"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使用 :class:" -"`NodeVisitor`。為此,有個允許修改的特殊遍歷訪問者工具 :class:" -"`NodeTransformer`。" +"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使" +"用 :class:`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工" +"具 :class:`NodeTransformer`。" -#: ../../library/ast.rst:2339 +#: ../../library/ast.rst:2376 msgid "" -"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" -"`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " -"will not be called in future Python versions. Add the :meth:" -"`visit_Constant` method to handle all constant nodes." +"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!" +"visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are " +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`visit_Constant` method to handle all constant nodes." msgstr "" ":meth:`!visit_Num`、:meth:`!visit_Str`、:meth:`!visit_Bytes`、:meth:`!" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2347 +#: ../../library/ast.rst:2384 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2350 +#: ../../library/ast.rst:2387 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4112,11 +4185,11 @@ msgid "" "location, otherwise it is replaced with the return value. The return value " "may be the original node in which case no replacement takes place." msgstr "" -":class:`NodeTransformer` 將遍歷 AST 並使用訪問者方法的回傳值來替換或刪除舊節" -"點。如果訪問者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" +":class:`NodeTransformer` 將遍歷 AST 並使用瀏覽者方法的回傳值來替換或刪除舊節" +"點。如果瀏覽者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2356 +#: ../../library/ast.rst:2393 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4124,7 +4197,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2359 +#: ../../library/ast.rst:2396 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4144,36 +4217,36 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2368 +#: ../../library/ast.rst:2405 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " -"either transform the child nodes yourself or call the :meth:`~ast." -"NodeVisitor.generic_visit` method for the node first." +"either transform the child nodes yourself or call " +"the :meth:`~ast.NodeVisitor.generic_visit` method for the node first." msgstr "" -"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" -"meth:`~ast.NodeVisitor.generic_visit` 方法。" +"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點" +"的 :meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2372 +#: ../../library/ast.rst:2409 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " "just a single node." msgstr "" -"對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),訪問者" +"對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),瀏覽者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2376 +#: ../../library/ast.rst:2413 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " -"original tree) without giving them location information (such as :attr:`~ast." -"AST.lineno`), :func:`fix_missing_locations` should be called with the new " -"sub-tree to recalculate the location information::" +"original tree) without giving them location information (such " +"as :attr:`~ast.AST.lineno`), :func:`fix_missing_locations` should be called " +"with the new sub-tree to recalculate the location information::" msgstr "" "如果 :class:`NodeTransformer` 引進了新節點(不屬於原始樹的一部分),但沒有給" -"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼叫 :" -"func:`fix_missing_locations` 以重新計算位置資訊: ::" +"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼" +"叫 :func:`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2381 +#: ../../library/ast.rst:2418 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4181,15 +4254,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2384 +#: ../../library/ast.rst:2421 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2386 +#: ../../library/ast.rst:2423 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2391 +#: ../../library/ast.rst:2428 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4205,7 +4278,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2399 +#: ../../library/ast.rst:2436 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4219,7 +4292,7 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2406 +#: ../../library/ast.rst:2443 msgid "" "If *show_empty* is ``False`` (the default), empty lists and fields that are " "``None`` will be omitted from the output." @@ -4227,15 +4300,15 @@ msgstr "" "如果 *show_empty* 為 ``False`` (預設值),則輸出中將省略 ``False`` 的空串列" "和欄位。" -#: ../../library/ast.rst:2409 +#: ../../library/ast.rst:2446 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2412 +#: ../../library/ast.rst:2449 msgid "Added the *show_empty* option." msgstr "新增 *show_empty* 選項。" -#: ../../library/ast.rst:2415 +#: ../../library/ast.rst:2452 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -4287,17 +4360,17 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2446 +#: ../../library/ast.rst:2483 msgid "Compiler Flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2448 +#: ../../library/ast.rst:2485 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2453 +#: ../../library/ast.rst:2490 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -4305,21 +4378,21 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2460 +#: ../../library/ast.rst:2497 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2465 +#: ../../library/ast.rst:2502 msgid "" -"The returned AST is optimized according to the *optimize* argument in :func:" -"`compile` or :func:`ast.parse`." +"The returned AST is optimized according to the *optimize* argument " +"in :func:`compile` or :func:`ast.parse`." msgstr "" "回傳的 AST 會根據 :func:`compile` 或 :func:`ast.parse` 中的 *optimize* 引數進" "行最佳化。" -#: ../../library/ast.rst:2472 +#: ../../library/ast.rst:2509 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." @@ -4327,47 +4400,47 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2481 +#: ../../library/ast.rst:2518 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/ast.rst:2485 +#: ../../library/ast.rst:2522 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2488 +#: ../../library/ast.rst:2525 msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" -#: ../../library/ast.rst:2492 +#: ../../library/ast.rst:2529 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2498 +#: ../../library/ast.rst:2535 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2503 +#: ../../library/ast.rst:2540 msgid "" -"Specify what kind of code must be compiled, like the *mode* argument in :" -"func:`parse`." +"Specify what kind of code must be compiled, like the *mode* argument " +"in :func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2508 +#: ../../library/ast.rst:2545 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2512 +#: ../../library/ast.rst:2549 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2517 +#: ../../library/ast.rst:2554 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2519 +#: ../../library/ast.rst:2556 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4375,7 +4448,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2525 +#: ../../library/ast.rst:2562 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4383,7 +4456,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2528 +#: ../../library/ast.rst:2565 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4394,7 +4467,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2533 +#: ../../library/ast.rst:2570 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -4404,7 +4477,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2538 +#: ../../library/ast.rst:2575 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4414,7 +4487,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2543 +#: ../../library/ast.rst:2580 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index 1530baa6c8..dba5a76c2a 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -87,7 +87,7 @@ msgstr ":func:`current_task`" #: ../../library/asyncio-api-index.rst:39 msgid "Return the current Task." -msgstr "回傳當前 Task 物件。" +msgstr "回傳目前 Task 物件。" #: ../../library/asyncio-api-index.rst:41 msgid ":func:`all_tasks`" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index 7362cbb454..ad5c2a8c28 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -375,7 +375,7 @@ msgstr "" #: ../../library/asyncio-dev.rst:202 msgid "Detect never-retrieved exceptions" -msgstr "偵測從未被獲取的 (never-retrieved) 例外" +msgstr "偵測從未被取得的 (never-retrieved) 例外" #: ../../library/asyncio-dev.rst:204 msgid "" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index dba9cad94d..fe2e0e3861 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-12 00:13+0000\n" +"POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,7 +67,7 @@ msgstr "以下的低階函式可用於取得、設置或建立事件迴圈:" #: ../../library/asyncio-eventloop.rst:34 msgid "Return the running event loop in the current OS thread." -msgstr "在當前作業系統執行緒中回傳正在運行的事件迴圈。" +msgstr "在目前作業系統執行緒中回傳正在運行的事件迴圈。" #: ../../library/asyncio-eventloop.rst:36 msgid "Raise a :exc:`RuntimeError` if there is no running event loop." @@ -122,12 +121,12 @@ msgid "" "Deprecation warning is emitted if there is no current event loop. In some " "future Python release this will become an error." msgstr "" -"如果沒有當前事件迴圈,則會發出棄用警告。在未來的某個 Python 發行版中,這將變" +"如果沒有目前事件迴圈,則會發出棄用警告。在未來的某個 Python 發行版中,這將變" "成錯誤。" #: ../../library/asyncio-eventloop.rst:68 msgid "Set *loop* as the current event loop for the current OS thread." -msgstr "將 *loop* 設置為當前 OS 執行緒的當前事件迴圈。" +msgstr "將 *loop* 設置為目前 OS 執行緒的目前事件迴圈。" #: ../../library/asyncio-eventloop.rst:72 msgid "Create and return a new event loop object." @@ -229,8 +228,8 @@ msgid "" "and then exit." msgstr "" "如果在呼叫 :meth:`run_forever` 之前呼叫 :meth:`stop`,則迴圈將使用超時為零的" -"方式輪詢 I/O 選擇器,運行所有回應 I/O 事件(以及已經排程的事件)的回呼函數," -"然後退出。" +"方式輪詢 I/O 選擇器,運行所有回應 I/O 事件(以及已經排程的事件)的回呼,然後" +"退出。" #: ../../library/asyncio-eventloop.rst:134 msgid "" @@ -240,7 +239,7 @@ msgid "" "will run the next time :meth:`run_forever` or :meth:`run_until_complete` is " "called." msgstr "" -"如果在 :meth:`run_forever` 運行時呼叫 :meth:`stop`,則迴圈將運行當前批次的回" +"如果在 :meth:`run_forever` 運行時呼叫 :meth:`stop`,則迴圈將運行目前批次的回" "呼函式,然後退出。請注意,由回呼函式排程的新回呼在此情況下不會運行;而是在下" "次呼叫 :meth:`run_forever` 或 :meth:`run_until_complete` 時運行。" @@ -250,7 +249,7 @@ msgstr "停止事件迴圈。" #: ../../library/asyncio-eventloop.rst:146 msgid "Return ``True`` if the event loop is currently running." -msgstr "如果事件迴圈當前正在運行,則回傳 ``True``。" +msgstr "如果事件迴圈目前正在運行,則回傳 ``True``。" #: ../../library/asyncio-eventloop.rst:150 msgid "Return ``True`` if the event loop was closed." @@ -278,30 +277,30 @@ msgid "" "called after the event loop is closed." msgstr "此方法是冪等且不可逆的。在事件迴圈關閉後不應呼叫其他方法。" -#: ../../library/asyncio-eventloop.rst:167 +#: ../../library/asyncio-eventloop.rst:168 msgid "" "Schedule all currently open :term:`asynchronous generator` objects to close " "with an :meth:`~agen.aclose` call. After calling this method, the event " "loop will issue a warning if a new asynchronous generator is iterated. This " "should be used to reliably finalize all scheduled asynchronous generators." msgstr "" -"排程所有當前打開的\\ :term:`非同步產生器 `\\ 物件使" +"排程所有目前打開的\\ :term:`非同步產生器 `\\ 物件使" "用 :meth:`~agen.aclose` 呼叫來關閉。呼叫此方法後,如果疊代新的非同步產生器," "事件迴圈將發出警告。應該使用此方法可靠地完成所有已排程的非同步產生器。" -#: ../../library/asyncio-eventloop.rst:173 +#: ../../library/asyncio-eventloop.rst:174 msgid "" "Note that there is no need to call this function when :func:`asyncio.run` is " "used." msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" -#: ../../library/asyncio-eventloop.rst:176 -#: ../../library/asyncio-eventloop.rst:1269 -#: ../../library/asyncio-eventloop.rst:1712 +#: ../../library/asyncio-eventloop.rst:177 +#: ../../library/asyncio-eventloop.rst:1301 +#: ../../library/asyncio-eventloop.rst:1750 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-eventloop.rst:178 +#: ../../library/asyncio-eventloop.rst:179 msgid "" "try:\n" " loop.run_forever()\n" @@ -315,7 +314,7 @@ msgstr "" " loop.run_until_complete(loop.shutdown_asyncgens())\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:188 +#: ../../library/asyncio-eventloop.rst:190 msgid "" "Schedule the closure of the default executor and wait for it to join all of " "the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " @@ -326,7 +325,7 @@ msgstr "" "ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了此方法,使用預設執行器與 :meth:" "`loop.run_in_executor` 將引發 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:194 +#: ../../library/asyncio-eventloop.rst:196 msgid "" "The *timeout* parameter specifies the amount of time (in :class:`float` " "seconds) the executor will be given to finish joining. With the default, " @@ -335,7 +334,7 @@ msgstr "" "*timeout* 參數指定執行器完成加入所需的時間(以 :class:`float` 秒為單位)。預" "設情況下為 ``None``,不會限制執行器所花費的時間。" -#: ../../library/asyncio-eventloop.rst:199 +#: ../../library/asyncio-eventloop.rst:201 msgid "" "If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the " "default executor is terminated without waiting for its threads to finish " @@ -344,7 +343,7 @@ msgstr "" "如果達到 *timeout*,將發出 :exc:`RuntimeWarning` 警告,預設執行器將立即終止," "不等待其執行緒完成加入。" -#: ../../library/asyncio-eventloop.rst:205 +#: ../../library/asyncio-eventloop.rst:207 msgid "" "Do not call this method when using :func:`asyncio.run`, as the latter " "handles default executor shutdown automatically." @@ -352,47 +351,47 @@ msgstr "" "使用 :func:`asyncio.run` 時請勿呼叫此方法,因為後者會自動處理預設執行器的關" "閉。" -#: ../../library/asyncio-eventloop.rst:210 +#: ../../library/asyncio-eventloop.rst:212 msgid "Added the *timeout* parameter." msgstr "加入 *timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:214 +#: ../../library/asyncio-eventloop.rst:216 msgid "Scheduling callbacks" msgstr "排程回呼函式" -#: ../../library/asyncio-eventloop.rst:218 +#: ../../library/asyncio-eventloop.rst:220 msgid "" "Schedule the *callback* :term:`callback` to be called with *args* arguments " "at the next iteration of the event loop." msgstr "" "在事件迴圈的下一次疊代中排程以 *args* 引數呼叫 *callback* :term:`callback`。" -#: ../../library/asyncio-eventloop.rst:221 +#: ../../library/asyncio-eventloop.rst:223 msgid "" "Return an instance of :class:`asyncio.Handle`, which can be used later to " "cancel the callback." msgstr "回傳 :class:`asyncio.Handle` 的實例,稍後可以用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:224 +#: ../../library/asyncio-eventloop.rst:226 msgid "" "Callbacks are called in the order in which they are registered. Each " "callback will be called exactly once." msgstr "回呼函式按照其註冊的順序呼叫。每個回呼函式將被呼叫恰好一次。" -#: ../../library/asyncio-eventloop.rst:227 +#: ../../library/asyncio-eventloop.rst:229 msgid "" "The optional keyword-only *context* argument specifies a custom :class:" "`contextvars.Context` for the *callback* to run in. Callbacks use the " "current context when no *context* is provided." msgstr "" "選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定義 :class:" -"`contextvars.Context`。當未提供 *context* 時,回呼函式使用當前情境。" +"`contextvars.Context`。當未提供 *context* 時,回呼函式使用目前情境。" -#: ../../library/asyncio-eventloop.rst:231 +#: ../../library/asyncio-eventloop.rst:233 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." msgstr "與 :meth:`call_soon_threadsafe` 不同,此方法不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:235 +#: ../../library/asyncio-eventloop.rst:237 msgid "" "A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from " "another thread, this function *must* be used, since :meth:`call_soon` is not " @@ -401,7 +400,14 @@ msgstr "" "這是 :meth:`call_soon` 的執行緒安全變體。當從另一個執行緒排程回呼函式時,*必" "須*\\ 使用此函式,因為 :meth:`call_soon` 不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:239 +#: ../../library/asyncio-eventloop.rst:241 +msgid "" +"This function is safe to be called from a reentrant context or signal " +"handler, however, it is not safe or fruitful to use the returned handle in " +"such contexts." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:244 msgid "" "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " "happen on a secondary thread when the main application is shutting down." @@ -409,21 +415,21 @@ msgstr "" "如果在已關閉的迴圈上呼叫,則引發 :exc:`RuntimeError`。在主應用程式關閉時,這" "可能發生在次要執行緒上。" -#: ../../library/asyncio-eventloop.rst:243 +#: ../../library/asyncio-eventloop.rst:248 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "請參閱文件的\\ :ref:`並行和多執行緒 `\\ 部分。" -#: ../../library/asyncio-eventloop.rst:246 -#: ../../library/asyncio-eventloop.rst:296 -#: ../../library/asyncio-eventloop.rst:316 +#: ../../library/asyncio-eventloop.rst:251 +#: ../../library/asyncio-eventloop.rst:301 +#: ../../library/asyncio-eventloop.rst:321 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "新增了 *context* 僅限關鍵字參數。詳細資訊請參閱 :pep:`567`。" -#: ../../library/asyncio-eventloop.rst:254 +#: ../../library/asyncio-eventloop.rst:259 msgid "" "Most :mod:`asyncio` scheduling functions don't allow passing keyword " "arguments. To do that, use :func:`functools.partial`::" @@ -431,14 +437,17 @@ msgstr "" "大多數 :mod:`asyncio` 排程函式不允許傳遞關鍵字引數。要傳遞關鍵字引數,請使" "用 :func:`functools.partial`: ::" -#: ../../library/asyncio-eventloop.rst:257 +#: ../../library/asyncio-eventloop.rst:262 msgid "" "# will schedule \"print(\"Hello\", flush=True)\"\n" "loop.call_soon(\n" " functools.partial(print, \"Hello\", flush=True))" msgstr "" +"# 將會排程 \"print(\"Hello\", flush=True)\"\n" +"loop.call_soon(\n" +" functools.partial(print, \"Hello\", flush=True))" -#: ../../library/asyncio-eventloop.rst:261 +#: ../../library/asyncio-eventloop.rst:266 msgid "" "Using partial objects is usually more convenient than using lambdas, as " "asyncio can render partial objects better in debug and error messages." @@ -446,11 +455,11 @@ msgstr "" "通常使用 partial 物件比使用 lambda 更方便,因為 asyncio 可以在除錯和錯誤訊息" "中更好地呈現 partial 物件。" -#: ../../library/asyncio-eventloop.rst:269 +#: ../../library/asyncio-eventloop.rst:274 msgid "Scheduling delayed callbacks" msgstr "排程延遲的回呼函式" -#: ../../library/asyncio-eventloop.rst:271 +#: ../../library/asyncio-eventloop.rst:276 msgid "" "Event loop provides mechanisms to schedule callback functions to be called " "at some point in the future. Event loop uses monotonic clocks to track time." @@ -458,20 +467,20 @@ msgstr "" "事件迴圈提供為回呼函式排程在將來某個時間點才呼叫的機制。事件迴圈使用了單調時" "鐘來追蹤時間。" -#: ../../library/asyncio-eventloop.rst:278 +#: ../../library/asyncio-eventloop.rst:283 msgid "" "Schedule *callback* to be called after the given *delay* number of seconds " "(can be either an int or a float)." msgstr "排程 *callback* 在給定的 *delay* 秒數後呼叫(可以是整數或浮點數)。" -#: ../../library/asyncio-eventloop.rst:281 -#: ../../library/asyncio-eventloop.rst:313 +#: ../../library/asyncio-eventloop.rst:286 +#: ../../library/asyncio-eventloop.rst:318 msgid "" "An instance of :class:`asyncio.TimerHandle` is returned which can be used to " "cancel the callback." msgstr "回傳 :class:`asyncio.TimerHandle` 的實例,可用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:284 +#: ../../library/asyncio-eventloop.rst:289 msgid "" "*callback* will be called exactly once. If two callbacks are scheduled for " "exactly the same time, the order in which they are called is undefined." @@ -479,7 +488,7 @@ msgstr "" "*callback* 將只被呼叫恰好一次。如果有兩個回呼函式被排程在完全相同的時間,則其" "呼叫順序是不定的。" -#: ../../library/asyncio-eventloop.rst:288 +#: ../../library/asyncio-eventloop.rst:293 msgid "" "The optional positional *args* will be passed to the callback when it is " "called. If you want the callback to be called with keyword arguments use :" @@ -488,16 +497,16 @@ msgstr "" "可選的位置引數 *args* 將在呼叫回呼函式時傳遞。如果要使用關鍵字引數呼叫回呼函" "數,請使用 :func:`functools.partial`。" -#: ../../library/asyncio-eventloop.rst:292 +#: ../../library/asyncio-eventloop.rst:297 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *callback* to run in. The current " "context is used when no *context* is provided." msgstr "" "可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義的 :class:" -"`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用當前情境。" +"`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用目前情境。" -#: ../../library/asyncio-eventloop.rst:300 +#: ../../library/asyncio-eventloop.rst:305 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "*delay* could not exceed one day. This has been fixed in Python 3.8." @@ -505,7 +514,7 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*delay* 不能超過一天。這" "在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:307 +#: ../../library/asyncio-eventloop.rst:312 msgid "" "Schedule *callback* to be called at the given absolute timestamp *when* (an " "int or a float), using the same time reference as :meth:`loop.time`." @@ -513,26 +522,26 @@ msgstr "" "排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用與 :" "meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:311 +#: ../../library/asyncio-eventloop.rst:316 msgid "This method's behavior is the same as :meth:`call_later`." msgstr "此方法的行為與 :meth:`call_later` 相同。" -#: ../../library/asyncio-eventloop.rst:320 +#: ../../library/asyncio-eventloop.rst:325 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "difference between *when* and the current time could not exceed one day. " "This has been fixed in Python 3.8." msgstr "" -"在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和當前時間之間的差" +"在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和目前時間之間的差" "值不能超過一天。這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:327 +#: ../../library/asyncio-eventloop.rst:332 msgid "" "Return the current time, as a :class:`float` value, according to the event " "loop's internal monotonic clock." -msgstr "根據事件迴圈的內部單調時鐘,回傳當前時間,以 :class:`float` 值表示。" +msgstr "根據事件迴圈的內部單調時鐘,回傳目前時間,以 :class:`float` 值表示。" -#: ../../library/asyncio-eventloop.rst:331 +#: ../../library/asyncio-eventloop.rst:336 msgid "" "In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) " "should not exceed one day. This has been fixed in Python 3.8." @@ -540,19 +549,19 @@ msgstr "" "在 Python 3.7 及更早版本中,超時(相對 *delay* 或絕對 *when*)不應超過一天。" "這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:337 +#: ../../library/asyncio-eventloop.rst:342 msgid "The :func:`asyncio.sleep` function." msgstr "函式 :func:`asyncio.sleep`。" -#: ../../library/asyncio-eventloop.rst:341 +#: ../../library/asyncio-eventloop.rst:346 msgid "Creating Futures and Tasks" msgstr "建立 Futures 和 Tasks" -#: ../../library/asyncio-eventloop.rst:345 +#: ../../library/asyncio-eventloop.rst:350 msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "建立附加到事件迴圈的 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:347 +#: ../../library/asyncio-eventloop.rst:352 msgid "" "This is the preferred way to create Futures in asyncio. This lets third-" "party event loops provide alternative implementations of the Future object " @@ -561,13 +570,13 @@ msgstr "" "這是在 asyncio 中建立 Futures 的首選方式。這允許第三方事件迴圈提供 Future 物" "件的替代實作(具有更好的性能或儀器計測表現)。" -#: ../../library/asyncio-eventloop.rst:355 +#: ../../library/asyncio-eventloop.rst:360 msgid "" "Schedule the execution of :ref:`coroutine ` *coro*. Return a :" "class:`Task` object." msgstr "排程執行\\ :ref:`協程 ` *coro*。回傳 :class:`Task` 物件。" -#: ../../library/asyncio-eventloop.rst:358 +#: ../../library/asyncio-eventloop.rst:363 msgid "" "Third-party event loops can use their own subclass of :class:`Task` for " "interoperability. In this case, the result type is a subclass of :class:" @@ -576,7 +585,7 @@ msgstr "" "第三方事件迴圈可以使用其自己的 :class:`Task` 子類別以實現互操作性" "(interoperability)。在這種情況下,結果類型是 :class:`Task` 的子類別。" -#: ../../library/asyncio-eventloop.rst:362 +#: ../../library/asyncio-eventloop.rst:367 msgid "" "If the *name* argument is provided and not ``None``, it is set as the name " "of the task using :meth:`Task.set_name`." @@ -584,56 +593,56 @@ msgstr "" "如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使用 :meth:" "`Task.set_name`。" -#: ../../library/asyncio-eventloop.rst:365 +#: ../../library/asyncio-eventloop.rst:370 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. The current context " "copy is created when no *context* is provided." msgstr "" "可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義的 :class:" -"`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立當前情境的副" +"`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立目前情境的副" "本。" -#: ../../library/asyncio-eventloop.rst:369 +#: ../../library/asyncio-eventloop.rst:374 msgid "Added the *name* parameter." msgstr "加入 *name* 參數。" -#: ../../library/asyncio-eventloop.rst:372 +#: ../../library/asyncio-eventloop.rst:377 msgid "Added the *context* parameter." msgstr "加入 *context* 參數。" -#: ../../library/asyncio-eventloop.rst:377 +#: ../../library/asyncio-eventloop.rst:382 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "設置將由 :meth:`loop.create_task` 使用的任務工廠。" -#: ../../library/asyncio-eventloop.rst:380 +#: ../../library/asyncio-eventloop.rst:385 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " -"context=None)``, where *loop* is a reference to the active event loop, and " -"*coro* is a coroutine object. The callable must return a :class:`asyncio." -"Future`-compatible object." +"**kwargs)``, where *loop* is a reference to the active event loop, and " +"*coro* is a coroutine object. The callable must pass on all *kwargs*, and " +"return a :class:`asyncio.Task`-compatible object." msgstr "" "如果 *factory* 為 ``None``,將設置預設的任務工廠。否則,*factory* 必須是一個" -"具有匹配簽名 ``(loop, coro, context=None)`` 的 *callable*,其中 *loop* 是有效" -"事件迴圈的參照,*coro* 是一個協程物件。該可呼叫物件必須回傳一個與 :class:" -"`asyncio.Future` 相容的物件。" +"具有匹配簽名 ``(loop, coro, **kwargs)`` 的 *callable*,其中 *loop* 是有效事件" +"迴圈的參照、*coro* 是一個協程物件。該可呼叫物件必須傳遞所有 *kwargs* 並回傳一" +"個與 :class:`asyncio.Task` 相容的物件。" -#: ../../library/asyncio-eventloop.rst:388 +#: ../../library/asyncio-eventloop.rst:393 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "回傳任務工廠,如果使用預設任務工廠則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:392 +#: ../../library/asyncio-eventloop.rst:397 msgid "Opening network connections" msgstr "打開網路連線" -#: ../../library/asyncio-eventloop.rst:403 +#: ../../library/asyncio-eventloop.rst:409 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "打開以 *host* 和 *port* 指定之給定地址的串流傳輸連線。" -#: ../../library/asyncio-eventloop.rst:406 +#: ../../library/asyncio-eventloop.rst:412 msgid "" "The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" "`~socket.AF_INET6` depending on *host* (or the *family* argument, if " @@ -642,13 +651,13 @@ msgstr "" "根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以是 :py:const:" "`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" -#: ../../library/asyncio-eventloop.rst:410 +#: ../../library/asyncio-eventloop.rst:416 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" -#: ../../library/asyncio-eventloop.rst:412 -#: ../../library/asyncio-eventloop.rst:1180 -#: ../../library/asyncio-eventloop.rst:1196 +#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:1211 +#: ../../library/asyncio-eventloop.rst:1228 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -656,24 +665,24 @@ msgstr "" "*protocol_factory* 必須是一個回傳 :ref:`asyncio protocol ` " "實作的可呼叫函式。" -#: ../../library/asyncio-eventloop.rst:415 +#: ../../library/asyncio-eventloop.rst:421 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" "此方法將嘗試在背景建立連線。成功時,它將回傳一對 ``(transport, protocol)``。" -#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:424 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "底層操作的時間軸簡介如下:" -#: ../../library/asyncio-eventloop.rst:420 +#: ../../library/asyncio-eventloop.rst:426 msgid "" "The connection is established and a :ref:`transport ` is " "created for it." msgstr "建立連線並為其建立\\ :ref:`傳輸 `。" -#: ../../library/asyncio-eventloop.rst:423 +#: ../../library/asyncio-eventloop.rst:429 msgid "" "*protocol_factory* is called without arguments and is expected to return a :" "ref:`protocol ` instance." @@ -681,7 +690,7 @@ msgstr "" "*protocol_factory* 在無引數的情況下被呼叫,並且預計回傳一個 :ref:`協定 " "` 實例。" -#: ../../library/asyncio-eventloop.rst:426 +#: ../../library/asyncio-eventloop.rst:432 msgid "" "The protocol instance is coupled with the transport by calling its :meth:" "`~BaseProtocol.connection_made` method." @@ -689,21 +698,21 @@ msgstr "" "通過呼叫其 :meth:`~BaseProtocol.connection_made` 方法,將協議實例與傳輸連線在" "一起。" -#: ../../library/asyncio-eventloop.rst:429 +#: ../../library/asyncio-eventloop.rst:435 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "成功時回傳一個 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:431 +#: ../../library/asyncio-eventloop.rst:437 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "建立的傳輸是一個依賴實作的雙向串流。" -#: ../../library/asyncio-eventloop.rst:434 -#: ../../library/asyncio-eventloop.rst:566 +#: ../../library/asyncio-eventloop.rst:440 +#: ../../library/asyncio-eventloop.rst:573 msgid "Other arguments:" msgstr "其他引數:" -#: ../../library/asyncio-eventloop.rst:436 +#: ../../library/asyncio-eventloop.rst:442 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " @@ -715,11 +724,11 @@ msgstr "" "果 *ssl* 為 :class:`ssl.SSLContext` 物件,則使用該情境來建立傳輸;如果 *ssl* " "為 :const:`True`,則使用 :func:`ssl.create_default_context` 回傳的預設情境。" -#: ../../library/asyncio-eventloop.rst:442 +#: ../../library/asyncio-eventloop.rst:448 msgid ":ref:`SSL/TLS security considerations `" msgstr ":ref:`SSL/TLS 安全考量 `" -#: ../../library/asyncio-eventloop.rst:444 +#: ../../library/asyncio-eventloop.rst:450 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -734,7 +743,7 @@ msgstr "" "預設值,必須傳遞 *server_hostname* 的值。若 *server_hostname* 為空字串,將停" "用主機名稱匹配(這是一個嚴重的安全風險,可能導致中間人攻擊)。" -#: ../../library/asyncio-eventloop.rst:452 +#: ../../library/asyncio-eventloop.rst:458 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -745,7 +754,7 @@ msgstr "" "getaddrinfo() 進行 *host* 解析。若有給定這些應該都是相應 :mod:`socket` 模組常" "數的整數。" -#: ../../library/asyncio-eventloop.rst:457 +#: ../../library/asyncio-eventloop.rst:463 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -759,7 +768,7 @@ msgstr "" "`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒(250 毫" "秒)。" -#: ../../library/asyncio-eventloop.rst:465 +#: ../../library/asyncio-eventloop.rst:471 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -775,7 +784,7 @@ msgstr "" "族計數」。如果未指定 *happy_eyeballs_delay*,則預設值為 ``0``,如果指定則為 " "``1``。" -#: ../../library/asyncio-eventloop.rst:474 +#: ../../library/asyncio-eventloop.rst:480 msgid "" "*sock*, if given, should be an existing, already connected :class:`socket." "socket` object to be used by the transport. If *sock* is given, none of " @@ -786,9 +795,9 @@ msgstr "" "輸使用。如果提供了 *sock*,則不應指定 *host*、*port*、*family*、*proto*、" "*flags*、*happy_eyeballs_delay*、*interleave* 和 *local_addr* 中的任何一項。" -#: ../../library/asyncio-eventloop.rst:482 -#: ../../library/asyncio-eventloop.rst:597 -#: ../../library/asyncio-eventloop.rst:841 +#: ../../library/asyncio-eventloop.rst:488 +#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:852 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." @@ -797,7 +806,7 @@ msgstr "" "引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸的 :meth:" "`~asyncio.BaseTransport.close` 方法。" -#: ../../library/asyncio-eventloop.rst:486 +#: ../../library/asyncio-eventloop.rst:492 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " @@ -807,8 +816,8 @@ msgstr "" "地綁定 socket。將使用 ``getaddrinfo()`` 查找 *local_host* 和 *local_port*,方" "式類似於 *host* 和 *port*。" -#: ../../library/asyncio-eventloop.rst:490 -#: ../../library/asyncio-eventloop.rst:935 +#: ../../library/asyncio-eventloop.rst:496 +#: ../../library/asyncio-eventloop.rst:948 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -818,10 +827,10 @@ msgstr "" "在那之前若未完成則會中斷連線。如果為 ``None`` (預設值),則會等待 ``60.0`` " "秒。" -#: ../../library/asyncio-eventloop.rst:494 -#: ../../library/asyncio-eventloop.rst:750 -#: ../../library/asyncio-eventloop.rst:852 -#: ../../library/asyncio-eventloop.rst:939 +#: ../../library/asyncio-eventloop.rst:500 +#: ../../library/asyncio-eventloop.rst:759 +#: ../../library/asyncio-eventloop.rst:863 +#: ../../library/asyncio-eventloop.rst:952 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -830,7 +839,7 @@ msgstr "" "*ssl_shutdown_timeout* 是等待 SSL 關閉完成以前中斷連線的時間,以秒為單位。如" "果為 ``None`` (預設值),則會等待 ``30.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:498 +#: ../../library/asyncio-eventloop.rst:504 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -844,12 +853,12 @@ msgstr "" "包含所有錯誤訊息的單一 ``OSError``。當 ``all_errors`` 為 ``True`` 時,將引發" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" -#: ../../library/asyncio-eventloop.rst:508 -#: ../../library/asyncio-eventloop.rst:762 +#: ../../library/asyncio-eventloop.rst:514 +#: ../../library/asyncio-eventloop.rst:771 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" -#: ../../library/asyncio-eventloop.rst:512 +#: ../../library/asyncio-eventloop.rst:518 msgid "" "The socket option :ref:`socket.TCP_NODELAY ` is set " "by default for all TCP connections." @@ -857,16 +866,16 @@ msgstr "" "所有 TCP 連線都預設有 :ref:`socket.TCP_NODELAY ` " "socket 選項。" -#: ../../library/asyncio-eventloop.rst:517 -#: ../../library/asyncio-eventloop.rst:862 +#: ../../library/asyncio-eventloop.rst:523 +#: ../../library/asyncio-eventloop.rst:873 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:521 +#: ../../library/asyncio-eventloop.rst:527 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "加入 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-eventloop.rst:523 +#: ../../library/asyncio-eventloop.rst:529 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -882,24 +891,24 @@ msgstr "" "用戶端的使用者體驗變差。本文件具體說明了減少此用戶可見延遲的演算法要求並提供" "了一種演算法。" -#: ../../library/asyncio-eventloop.rst:532 +#: ../../library/asyncio-eventloop.rst:538 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" -#: ../../library/asyncio-eventloop.rst:536 -#: ../../library/asyncio-eventloop.rst:660 -#: ../../library/asyncio-eventloop.rst:776 -#: ../../library/asyncio-eventloop.rst:815 -#: ../../library/asyncio-eventloop.rst:866 -#: ../../library/asyncio-eventloop.rst:947 +#: ../../library/asyncio-eventloop.rst:542 +#: ../../library/asyncio-eventloop.rst:668 +#: ../../library/asyncio-eventloop.rst:785 +#: ../../library/asyncio-eventloop.rst:825 +#: ../../library/asyncio-eventloop.rst:877 +#: ../../library/asyncio-eventloop.rst:960 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:538 +#: ../../library/asyncio-eventloop.rst:544 msgid "*all_errors* was added." msgstr "已新增 *all_errors*。" -#: ../../library/asyncio-eventloop.rst:543 +#: ../../library/asyncio-eventloop.rst:549 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " @@ -908,11 +917,11 @@ msgstr "" "函式 :func:`open_connection` 是高階的替代 API。它回傳一對 (:class:" "`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:553 +#: ../../library/asyncio-eventloop.rst:560 msgid "Create a datagram connection." msgstr "建立一個資料報連線。" -#: ../../library/asyncio-eventloop.rst:555 +#: ../../library/asyncio-eventloop.rst:562 msgid "" "The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" "`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " @@ -922,13 +931,13 @@ msgstr "" "或 :py:const:`~socket.AF_UNIX`,視乎 *host*\\ (或提供的 *family* 引數)而" "定。" -#: ../../library/asyncio-eventloop.rst:559 +#: ../../library/asyncio-eventloop.rst:566 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" -#: ../../library/asyncio-eventloop.rst:561 -#: ../../library/asyncio-eventloop.rst:686 -#: ../../library/asyncio-eventloop.rst:833 +#: ../../library/asyncio-eventloop.rst:568 +#: ../../library/asyncio-eventloop.rst:695 +#: ../../library/asyncio-eventloop.rst:844 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -936,12 +945,12 @@ msgstr "" "*protocol_factory* 必須是可呼叫的函式,回傳 :ref:`protocol ` 實作。" -#: ../../library/asyncio-eventloop.rst:564 -#: ../../library/asyncio-eventloop.rst:642 +#: ../../library/asyncio-eventloop.rst:571 +#: ../../library/asyncio-eventloop.rst:650 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "成功時回傳 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:568 +#: ../../library/asyncio-eventloop.rst:575 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using :" @@ -950,7 +959,7 @@ msgstr "" "*local_addr*,如果提供,是一個 ``(local_host, local_port)`` 元組,用於在本地" "綁定 socket。*local_host* 和 *local_port* 使用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:572 +#: ../../library/asyncio-eventloop.rst:579 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " @@ -960,7 +969,7 @@ msgstr "" "socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使用 :meth:" "`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:576 +#: ../../library/asyncio-eventloop.rst:583 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -971,7 +980,7 @@ msgstr "" "的可選地址家族、協定和旗標。如果提供,這些應該都是來自相應的 :mod:`socket` 模" "組常數的整數。" -#: ../../library/asyncio-eventloop.rst:581 +#: ../../library/asyncio-eventloop.rst:588 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -983,13 +992,13 @@ msgstr "" "時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" "const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" -#: ../../library/asyncio-eventloop.rst:587 +#: ../../library/asyncio-eventloop.rst:594 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "*allow_broadcast* 告訴核心允許此端點向廣播位址發送訊息。" -#: ../../library/asyncio-eventloop.rst:590 +#: ../../library/asyncio-eventloop.rst:597 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " @@ -1000,7 +1009,7 @@ msgstr "" "供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須是 :const:" "`None`\\ )。" -#: ../../library/asyncio-eventloop.rst:601 +#: ../../library/asyncio-eventloop.rst:608 msgid "" "See :ref:`UDP echo client protocol ` and :" "ref:`UDP echo server protocol ` examples." @@ -1008,7 +1017,7 @@ msgstr "" "請參閱 :ref:`UDP 回應用戶端協議 ` 和 :ref:" "`UDP 回應伺服器協議 ` 範例。" -#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:611 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." @@ -1016,11 +1025,11 @@ msgstr "" "新增 *family*、*proto*、*flags*、*reuse_address*、*reuse_port*、" "*allow_broadcast* 和 *sock* 參數。" -#: ../../library/asyncio-eventloop.rst:608 +#: ../../library/asyncio-eventloop.rst:615 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:611 +#: ../../library/asyncio-eventloop.rst:618 msgid "" "The *reuse_address* parameter is no longer supported, as using :ref:`socket." "SO_REUSEADDR ` poses a significant security concern " @@ -1029,7 +1038,7 @@ msgstr "" "不再支援 *reuse_address* 參數,因為使用 :py:const:`~sockets.SO_REUSEADDR` 對" "於 UDP 存有重大的安全疑慮。明確傳遞 ``reuse_address=True`` 將引發例外。" -#: ../../library/asyncio-eventloop.rst:617 +#: ../../library/asyncio-eventloop.rst:624 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " @@ -1038,7 +1047,7 @@ msgstr "" "當具有不同 UID 的多個行程使用 ``SO_REUSEADDR`` 將 socket 分配給相同的 UDP " "socket 地址時,傳入的封包可能會在 socket 之間隨機分佈。" -#: ../../library/asyncio-eventloop.rst:621 +#: ../../library/asyncio-eventloop.rst:628 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is set by default " @@ -1264,7 +1273,7 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" "ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:780 +#: ../../library/asyncio-eventloop.rst:789 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " @@ -1273,7 +1282,7 @@ msgstr "" ":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" "`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:791 +#: ../../library/asyncio-eventloop.rst:801 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." "AF_UNIX` socket family." @@ -1281,7 +1290,7 @@ msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:794 +#: ../../library/asyncio-eventloop.rst:804 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1291,20 +1300,22 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:799 +#: ../../library/asyncio-eventloop.rst:809 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " "been replaced after the server has been created." msgstr "" +"如果 *cleanup_socket* 為真,則 Unix socket 將在伺服器關閉時自動從檔案系統中刪" +"除,除非在建立伺服器後替換了 socket。" -#: ../../library/asyncio-eventloop.rst:803 +#: ../../library/asyncio-eventloop.rst:813 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:810 +#: ../../library/asyncio-eventloop.rst:820 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1312,26 +1323,26 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:819 +#: ../../library/asyncio-eventloop.rst:829 msgid "Added the *cleanup_socket* parameter." msgstr "加入 *cleanup_socket* 參數。" -#: ../../library/asyncio-eventloop.rst:826 +#: ../../library/asyncio-eventloop.rst:837 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協議對。" -#: ../../library/asyncio-eventloop.rst:828 +#: ../../library/asyncio-eventloop.rst:839 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:831 -#: ../../library/asyncio-eventloop.rst:921 +#: ../../library/asyncio-eventloop.rst:842 +#: ../../library/asyncio-eventloop.rst:934 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:836 +#: ../../library/asyncio-eventloop.rst:847 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1339,13 +1350,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:845 +#: ../../library/asyncio-eventloop.rst:856 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:848 +#: ../../library/asyncio-eventloop.rst:859 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1354,29 +1365,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:856 +#: ../../library/asyncio-eventloop.rst:867 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:870 +#: ../../library/asyncio-eventloop.rst:881 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:875 +#: ../../library/asyncio-eventloop.rst:887 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:878 +#: ../../library/asyncio-eventloop.rst:890 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:880 +#: ../../library/asyncio-eventloop.rst:892 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:882 -#: ../../library/asyncio-eventloop.rst:1127 +#: ../../library/asyncio-eventloop.rst:894 +#: ../../library/asyncio-eventloop.rst:1155 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1388,7 +1399,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:889 +#: ../../library/asyncio-eventloop.rst:901 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1397,7 +1408,7 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:893 +#: ../../library/asyncio-eventloop.rst:905 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." @@ -1405,15 +1416,15 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:900 +#: ../../library/asyncio-eventloop.rst:912 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:907 +#: ../../library/asyncio-eventloop.rst:920 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:909 +#: ../../library/asyncio-eventloop.rst:922 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1422,7 +1433,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協議,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:913 +#: ../../library/asyncio-eventloop.rst:926 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1433,13 +1444,13 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:918 +#: ../../library/asyncio-eventloop.rst:931 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:923 +#: ../../library/asyncio-eventloop.rst:936 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." @@ -1447,11 +1458,11 @@ msgstr "" "*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" "`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:927 +#: ../../library/asyncio-eventloop.rst:940 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:929 +#: ../../library/asyncio-eventloop.rst:942 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1459,25 +1470,32 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:932 +#: ../../library/asyncio-eventloop.rst:945 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:952 +#: ../../library/asyncio-eventloop.rst:965 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:956 +#: ../../library/asyncio-eventloop.rst:969 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." msgstr "" -"開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數呼叫 " +"開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:962 +#: ../../library/asyncio-eventloop.rst:973 +#: ../../library/asyncio-eventloop.rst:987 +msgid "" +"Any preexisting callback registered for *fd* is cancelled and replaced by " +"*callback*." +msgstr "任何預先存在、為 *fd* 註冊的回呼函式將被取消並替換為 *callback*。" + +#: ../../library/asyncio-eventloop.rst:978 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1485,16 +1503,16 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:967 +#: ../../library/asyncio-eventloop.rst:983 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." msgstr "" -"開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數呼叫 " +"開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:971 -#: ../../library/asyncio-eventloop.rst:1236 +#: ../../library/asyncio-eventloop.rst:990 +#: ../../library/asyncio-eventloop.rst:1268 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1502,7 +1520,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:976 +#: ../../library/asyncio-eventloop.rst:995 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1510,7 +1528,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:979 +#: ../../library/asyncio-eventloop.rst:998 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1518,11 +1536,11 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:984 +#: ../../library/asyncio-eventloop.rst:1003 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:986 +#: ../../library/asyncio-eventloop.rst:1005 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1534,7 +1552,7 @@ msgstr "" "`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然而在某些情" "況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:995 +#: ../../library/asyncio-eventloop.rst:1015 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." @@ -1542,23 +1560,23 @@ msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:998 +#: ../../library/asyncio-eventloop.rst:1018 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:1000 -#: ../../library/asyncio-eventloop.rst:1014 -#: ../../library/asyncio-eventloop.rst:1025 -#: ../../library/asyncio-eventloop.rst:1037 -#: ../../library/asyncio-eventloop.rst:1052 -#: ../../library/asyncio-eventloop.rst:1067 -#: ../../library/asyncio-eventloop.rst:1077 +#: ../../library/asyncio-eventloop.rst:1020 +#: ../../library/asyncio-eventloop.rst:1035 +#: ../../library/asyncio-eventloop.rst:1047 +#: ../../library/asyncio-eventloop.rst:1060 +#: ../../library/asyncio-eventloop.rst:1076 +#: ../../library/asyncio-eventloop.rst:1092 #: ../../library/asyncio-eventloop.rst:1103 -#: ../../library/asyncio-eventloop.rst:1141 +#: ../../library/asyncio-eventloop.rst:1130 +#: ../../library/asyncio-eventloop.rst:1169 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:1002 +#: ../../library/asyncio-eventloop.rst:1022 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1567,7 +1585,7 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1009 +#: ../../library/asyncio-eventloop.rst:1030 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." @@ -1575,11 +1593,11 @@ msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:1012 +#: ../../library/asyncio-eventloop.rst:1033 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1020 +#: ../../library/asyncio-eventloop.rst:1042 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." @@ -1587,11 +1605,11 @@ msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1023 +#: ../../library/asyncio-eventloop.rst:1045 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1031 +#: ../../library/asyncio-eventloop.rst:1054 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." @@ -1599,11 +1617,11 @@ msgstr "" "從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." "recvfrom_into() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1035 +#: ../../library/asyncio-eventloop.rst:1058 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1043 +#: ../../library/asyncio-eventloop.rst:1067 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." @@ -1611,7 +1629,7 @@ msgstr "" "將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1046 +#: ../../library/asyncio-eventloop.rst:1070 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1623,8 +1641,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1054 -#: ../../library/asyncio-eventloop.rst:1105 +#: ../../library/asyncio-eventloop.rst:1078 +#: ../../library/asyncio-eventloop.rst:1132 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1633,7 +1651,7 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1061 +#: ../../library/asyncio-eventloop.rst:1086 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." @@ -1641,20 +1659,20 @@ msgstr "" "從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1065 +#: ../../library/asyncio-eventloop.rst:1090 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1073 +#: ../../library/asyncio-eventloop.rst:1099 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1075 +#: ../../library/asyncio-eventloop.rst:1101 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1079 +#: ../../library/asyncio-eventloop.rst:1105 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1665,7 +1683,7 @@ msgstr "" "inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." "getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1088 +#: ../../library/asyncio-eventloop.rst:1114 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1673,7 +1691,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1094 +#: ../../library/asyncio-eventloop.rst:1121 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1681,7 +1699,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1097 +#: ../../library/asyncio-eventloop.rst:1124 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1692,34 +1710,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1112 +#: ../../library/asyncio-eventloop.rst:1139 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1117 +#: ../../library/asyncio-eventloop.rst:1145 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1120 +#: ../../library/asyncio-eventloop.rst:1148 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1122 +#: ../../library/asyncio-eventloop.rst:1150 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1125 +#: ../../library/asyncio-eventloop.rst:1153 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1134 +#: ../../library/asyncio-eventloop.rst:1162 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1728,7 +1746,7 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1138 +#: ../../library/asyncio-eventloop.rst:1166 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." @@ -1736,19 +1754,19 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1147 +#: ../../library/asyncio-eventloop.rst:1175 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1152 +#: ../../library/asyncio-eventloop.rst:1181 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1156 +#: ../../library/asyncio-eventloop.rst:1186 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1159 +#: ../../library/asyncio-eventloop.rst:1189 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1758,7 +1776,7 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1166 +#: ../../library/asyncio-eventloop.rst:1196 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1769,19 +1787,19 @@ msgstr "" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1174 +#: ../../library/asyncio-eventloop.rst:1204 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1178 +#: ../../library/asyncio-eventloop.rst:1209 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1214 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1185 +#: ../../library/asyncio-eventloop.rst:1216 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " @@ -1790,22 +1808,22 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1189 -#: ../../library/asyncio-eventloop.rst:1205 +#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:1237 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1226 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1199 +#: ../../library/asyncio-eventloop.rst:1231 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1201 +#: ../../library/asyncio-eventloop.rst:1233 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " @@ -1814,7 +1832,7 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1210 +#: ../../library/asyncio-eventloop.rst:1242 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." @@ -1822,31 +1840,31 @@ msgstr "" ":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" "class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1215 +#: ../../library/asyncio-eventloop.rst:1247 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:1252 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1226 +#: ../../library/asyncio-eventloop.rst:1258 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1228 +#: ../../library/asyncio-eventloop.rst:1260 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " "registered using :func:`signal.signal`, a callback registered with this " "function is allowed to interact with the event loop." msgstr "" -"該回呼將由 *loop* 呼叫,與該事件迴圈的其他排隊回呼和可運行的協程一起。與使" +"該回呼將由 *loop* 叫用,與該事件迴圈的其他排隊回呼和可運行的協程一起。與使" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1233 +#: ../../library/asyncio-eventloop.rst:1265 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1854,16 +1872,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1239 +#: ../../library/asyncio-eventloop.rst:1271 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." -msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中呼叫。" +msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中叫用。" -#: ../../library/asyncio-eventloop.rst:1244 +#: ../../library/asyncio-eventloop.rst:1276 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1246 +#: ../../library/asyncio-eventloop.rst:1278 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1871,19 +1889,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1253 +#: ../../library/asyncio-eventloop.rst:1285 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1257 +#: ../../library/asyncio-eventloop.rst:1289 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1261 +#: ../../library/asyncio-eventloop.rst:1293 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1263 +#: ../../library/asyncio-eventloop.rst:1295 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1892,7 +1910,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1271 +#: ../../library/asyncio-eventloop.rst:1303 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1935,7 +1953,7 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1311 +#: ../../library/asyncio-eventloop.rst:1343 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " @@ -1947,11 +1965,11 @@ msgstr "" "== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1316 +#: ../../library/asyncio-eventloop.rst:1348 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1318 +#: ../../library/asyncio-eventloop.rst:1350 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -1959,7 +1977,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1321 +#: ../../library/asyncio-eventloop.rst:1353 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1970,7 +1988,7 @@ msgstr "" "``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." "ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1362 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." @@ -1979,26 +1997,26 @@ msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1334 +#: ../../library/asyncio-eventloop.rst:1366 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1340 +#: ../../library/asyncio-eventloop.rst:1372 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1342 +#: ../../library/asyncio-eventloop.rst:1374 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1346 +#: ../../library/asyncio-eventloop.rst:1378 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1348 +#: ../../library/asyncio-eventloop.rst:1380 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -2011,7 +2029,7 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1356 +#: ../../library/asyncio-eventloop.rst:1388 msgid "" "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" "`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " @@ -2020,7 +2038,7 @@ msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1362 +#: ../../library/asyncio-eventloop.rst:1394 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2028,18 +2046,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1367 +#: ../../library/asyncio-eventloop.rst:1399 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" -"回傳當前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" +"回傳目前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1374 +#: ../../library/asyncio-eventloop.rst:1406 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1408 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2048,17 +2066,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1380 +#: ../../library/asyncio-eventloop.rst:1412 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1385 +#: ../../library/asyncio-eventloop.rst:1417 msgid "Call the current event loop exception handler." -msgstr "呼叫當前事件迴圈例外處理程式。" +msgstr "呼叫目前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1387 +#: ../../library/asyncio-eventloop.rst:1419 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2066,47 +2084,55 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1390 +#: ../../library/asyncio-eventloop.rst:1422 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1391 +#: ../../library/asyncio-eventloop.rst:1423 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1392 +#: ../../library/asyncio-eventloop.rst:1424 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1393 +#: ../../library/asyncio-eventloop.rst:1425 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1426 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1395 +#: ../../library/asyncio-eventloop.rst:1427 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1396 +#: ../../library/asyncio-eventloop.rst:1428 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1397 +#: ../../library/asyncio-eventloop.rst:1429 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1398 +#: ../../library/asyncio-eventloop.rst:1430 +msgid "'source_traceback' (optional): Traceback of the source;" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1431 +msgid "'handle_traceback' (optional): Traceback of the handle;" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1432 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1433 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1403 +#: ../../library/asyncio-eventloop.rst:1437 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." @@ -2114,15 +2140,15 @@ msgstr "" "此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" "`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1442 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1412 +#: ../../library/asyncio-eventloop.rst:1446 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1414 +#: ../../library/asyncio-eventloop.rst:1448 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." @@ -2130,17 +2156,17 @@ msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1420 +#: ../../library/asyncio-eventloop.rst:1454 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1424 +#: ../../library/asyncio-eventloop.rst:1458 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1429 +#: ../../library/asyncio-eventloop.rst:1463 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " @@ -2149,19 +2175,19 @@ msgstr "" "此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" "後,\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1433 +#: ../../library/asyncio-eventloop.rst:1467 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1437 +#: ../../library/asyncio-eventloop.rst:1471 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1441 +#: ../../library/asyncio-eventloop.rst:1475 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1443 +#: ../../library/asyncio-eventloop.rst:1477 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " @@ -2171,7 +2197,7 @@ msgstr "" "func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." "create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1450 +#: ../../library/asyncio-eventloop.rst:1484 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" @@ -2181,26 +2207,26 @@ msgstr "" "`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " "`。" -#: ../../library/asyncio-eventloop.rst:1461 +#: ../../library/asyncio-eventloop.rst:1496 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1464 +#: ../../library/asyncio-eventloop.rst:1499 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1466 +#: ../../library/asyncio-eventloop.rst:1501 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1467 +#: ../../library/asyncio-eventloop.rst:1502 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1470 +#: ../../library/asyncio-eventloop.rst:1505 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2209,7 +2235,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1474 +#: ../../library/asyncio-eventloop.rst:1509 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2220,7 +2246,7 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1480 +#: ../../library/asyncio-eventloop.rst:1515 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." @@ -2228,67 +2254,67 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1483 +#: ../../library/asyncio-eventloop.rst:1518 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1485 +#: ../../library/asyncio-eventloop.rst:1520 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1487 -#: ../../library/asyncio-eventloop.rst:1498 -#: ../../library/asyncio-eventloop.rst:1508 +#: ../../library/asyncio-eventloop.rst:1522 +#: ../../library/asyncio-eventloop.rst:1533 +#: ../../library/asyncio-eventloop.rst:1543 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1488 +#: ../../library/asyncio-eventloop.rst:1523 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1489 -#: ../../library/asyncio-eventloop.rst:1499 -#: ../../library/asyncio-eventloop.rst:1509 +#: ../../library/asyncio-eventloop.rst:1524 +#: ../../library/asyncio-eventloop.rst:1534 +#: ../../library/asyncio-eventloop.rst:1544 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1491 -#: ../../library/asyncio-eventloop.rst:1501 -#: ../../library/asyncio-eventloop.rst:1511 +#: ../../library/asyncio-eventloop.rst:1526 +#: ../../library/asyncio-eventloop.rst:1536 +#: ../../library/asyncio-eventloop.rst:1546 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1493 -#: ../../library/asyncio-eventloop.rst:1503 -#: ../../library/asyncio-eventloop.rst:1513 +#: ../../library/asyncio-eventloop.rst:1528 +#: ../../library/asyncio-eventloop.rst:1538 +#: ../../library/asyncio-eventloop.rst:1548 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1496 +#: ../../library/asyncio-eventloop.rst:1531 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1506 +#: ../../library/asyncio-eventloop.rst:1541 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1515 +#: ../../library/asyncio-eventloop.rst:1550 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1518 +#: ../../library/asyncio-eventloop.rst:1553 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2298,7 +2324,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1523 +#: ../../library/asyncio-eventloop.rst:1558 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2307,7 +2333,7 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1527 +#: ../../library/asyncio-eventloop.rst:1562 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " "pipe, then the other side of this pipe should be registered with :meth:" @@ -2318,13 +2344,13 @@ msgstr "" "端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." "connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1532 +#: ../../library/asyncio-eventloop.rst:1567 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1535 +#: ../../library/asyncio-eventloop.rst:1570 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " @@ -2334,16 +2360,16 @@ msgstr "" "SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" "件。" -#: ../../library/asyncio-eventloop.rst:1543 +#: ../../library/asyncio-eventloop.rst:1579 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" -"使用平台的 “shell” 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編碼" -"為 :ref:`檔案系統編碼 ` 的 :class:`bytes` 字串。" +"使用平台的 \"shell\" 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編" +"碼為 :ref:`檔案系統編碼 ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1548 +#: ../../library/asyncio-eventloop.rst:1584 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2351,7 +2377,7 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1551 +#: ../../library/asyncio-eventloop.rst:1587 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." @@ -2359,13 +2385,13 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1554 +#: ../../library/asyncio-eventloop.rst:1590 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1557 +#: ../../library/asyncio-eventloop.rst:1593 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " @@ -2375,7 +2401,7 @@ msgstr "" "`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" "的物件。" -#: ../../library/asyncio-eventloop.rst:1562 +#: ../../library/asyncio-eventloop.rst:1598 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2388,11 +2414,11 @@ msgstr "" "wikipedia.org/wiki/Shell_injection#Shell_injection>`_\\ 風險。可以使用 :func:" "`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" -#: ../../library/asyncio-eventloop.rst:1571 +#: ../../library/asyncio-eventloop.rst:1607 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1575 +#: ../../library/asyncio-eventloop.rst:1611 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." @@ -2400,46 +2426,46 @@ msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1580 +#: ../../library/asyncio-eventloop.rst:1616 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1587 +#: ../../library/asyncio-eventloop.rst:1623 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1592 +#: ../../library/asyncio-eventloop.rst:1628 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1598 +#: ../../library/asyncio-eventloop.rst:1634 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1601 +#: ../../library/asyncio-eventloop.rst:1637 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1605 +#: ../../library/asyncio-eventloop.rst:1641 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1607 +#: ../../library/asyncio-eventloop.rst:1643 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1614 +#: ../../library/asyncio-eventloop.rst:1650 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1616 +#: ../../library/asyncio-eventloop.rst:1652 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " @@ -2449,11 +2475,11 @@ msgstr "" "create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" "建立。" -#: ../../library/asyncio-eventloop.rst:1620 +#: ../../library/asyncio-eventloop.rst:1656 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1624 +#: ../../library/asyncio-eventloop.rst:1660 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2462,7 +2488,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1629 +#: ../../library/asyncio-eventloop.rst:1665 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2471,31 +2497,37 @@ msgid "" "\n" "# At this point, srv is closed and no longer accepts new connections." msgstr "" +"srv = await loop.create_server(...)\n" +"\n" +"async with srv:\n" +" # 一些程式碼\n" +"\n" +"# 此時 srv 已關閉,不再接受新的連線。" -#: ../../library/asyncio-eventloop.rst:1637 +#: ../../library/asyncio-eventloop.rst:1673 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1640 +#: ../../library/asyncio-eventloop.rst:1676 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1645 +#: ../../library/asyncio-eventloop.rst:1681 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1648 +#: ../../library/asyncio-eventloop.rst:1684 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1651 +#: ../../library/asyncio-eventloop.rst:1687 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2503,53 +2535,53 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1657 +#: ../../library/asyncio-eventloop.rst:1693 msgid "Close all existing incoming client connections." msgstr "關閉所有現有的傳入客戶端連線。" -#: ../../library/asyncio-eventloop.rst:1659 +#: ../../library/asyncio-eventloop.rst:1695 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." -msgstr "" +msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1662 +#: ../../library/asyncio-eventloop.rst:1698 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1669 +#: ../../library/asyncio-eventloop.rst:1705 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." -msgstr "" +msgstr "立即關閉所有現有的傳入客戶端連線,而不等待待定操作完成。" -#: ../../library/asyncio-eventloop.rst:1672 +#: ../../library/asyncio-eventloop.rst:1708 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." -msgstr "" +msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1675 +#: ../../library/asyncio-eventloop.rst:1711 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1682 +#: ../../library/asyncio-eventloop.rst:1718 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1688 +#: ../../library/asyncio-eventloop.rst:1725 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1690 +#: ../../library/asyncio-eventloop.rst:1727 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1693 +#: ../../library/asyncio-eventloop.rst:1730 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2562,14 +2594,14 @@ msgstr "" "種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." "serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1704 +#: ../../library/asyncio-eventloop.rst:1742 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1708 +#: ../../library/asyncio-eventloop.rst:1746 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2577,7 +2609,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1714 +#: ../../library/asyncio-eventloop.rst:1752 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2591,25 +2623,36 @@ msgid "" "\n" "asyncio.run(main('127.0.0.1', 0))" msgstr "" +"async def client_connected(reader, writer):\n" +" # 透過讀取器/寫入器串流\n" +" # 與客戶端溝通。例如:\n" +" await reader.readline()\n" +"\n" +"async def main(host, port):\n" +" srv = await asyncio.start_server(\n" +" client_connected, host, port)\n" +" await srv.serve_forever()\n" +"\n" +"asyncio.run(main('127.0.0.1', 0))" -#: ../../library/asyncio-eventloop.rst:1730 +#: ../../library/asyncio-eventloop.rst:1768 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1736 +#: ../../library/asyncio-eventloop.rst:1775 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1741 +#: ../../library/asyncio-eventloop.rst:1780 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1744 +#: ../../library/asyncio-eventloop.rst:1783 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2617,11 +2660,11 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1754 +#: ../../library/asyncio-eventloop.rst:1793 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1756 +#: ../../library/asyncio-eventloop.rst:1795 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." @@ -2629,17 +2672,17 @@ msgstr "" "asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" "`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1759 +#: ../../library/asyncio-eventloop.rst:1798 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" -#: ../../library/asyncio-eventloop.rst:1764 +#: ../../library/asyncio-eventloop.rst:1803 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" -#: ../../library/asyncio-eventloop.rst:1767 +#: ../../library/asyncio-eventloop.rst:1806 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2648,7 +2691,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1771 +#: ../../library/asyncio-eventloop.rst:1810 msgid "" "import asyncio\n" "import selectors\n" @@ -2670,7 +2713,7 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1787 +#: ../../library/asyncio-eventloop.rst:1826 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." @@ -2678,7 +2721,7 @@ msgstr "" "用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" "O Completion Ports)」。" -#: ../../library/asyncio-eventloop.rst:1793 +#: ../../library/asyncio-eventloop.rst:1832 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2686,13 +2729,13 @@ msgstr "" "`I/O 完成埠的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1798 +#: ../../library/asyncio-eventloop.rst:1837 msgid "" "An alias to the most efficient available subclass of :class:" "`AbstractEventLoop` for the given platform." msgstr "" -#: ../../library/asyncio-eventloop.rst:1801 +#: ../../library/asyncio-eventloop.rst:1840 msgid "" "It is an alias to :class:`SelectorEventLoop` on Unix and :class:" "`ProactorEventLoop` on Windows." @@ -2700,11 +2743,11 @@ msgstr "" "在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" "`ProactorEventLoop` 的別名。" -#: ../../library/asyncio-eventloop.rst:1807 +#: ../../library/asyncio-eventloop.rst:1846 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1809 +#: ../../library/asyncio-eventloop.rst:1848 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2712,11 +2755,11 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1815 +#: ../../library/asyncio-eventloop.rst:1854 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1817 +#: ../../library/asyncio-eventloop.rst:1856 msgid "" "Note that all examples in this section **purposefully** show how to use the " "low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." @@ -2727,11 +2770,11 @@ msgstr "" "`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" "種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1827 +#: ../../library/asyncio-eventloop.rst:1866 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1829 +#: ../../library/asyncio-eventloop.rst:1868 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2739,7 +2782,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1833 +#: ../../library/asyncio-eventloop.rst:1872 msgid "" "import asyncio\n" "\n" @@ -2759,19 +2802,36 @@ msgid "" "finally:\n" " loop.close()" msgstr "" +"import asyncio\n" +"\n" +"def hello_world(loop):\n" +" \"\"\"列印 'Hello World' 並停止事件迴圈的回呼\"\"\"\n" +" print('Hello World')\n" +" loop.stop()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"# 排程對 hello_world() 的呼叫\n" +"loop.call_soon(hello_world, loop)\n" +"\n" +"# 阻塞呼叫被 loop.stop() 中斷\n" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:1853 +#: ../../library/asyncio-eventloop.rst:1892 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1860 +#: ../../library/asyncio-eventloop.rst:1899 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1862 +#: ../../library/asyncio-eventloop.rst:1901 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2780,7 +2840,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1866 +#: ../../library/asyncio-eventloop.rst:1905 msgid "" "import asyncio\n" "import datetime\n" @@ -2804,8 +2864,29 @@ msgid "" "finally:\n" " loop.close()" msgstr "" +"import asyncio\n" +"import datetime\n" +"\n" +"def display_date(end_time, loop):\n" +" print(datetime.datetime.now())\n" +" if (loop.time() + 1.0) < end_time:\n" +" loop.call_later(1, display_date, end_time, loop)\n" +" else:\n" +" loop.stop()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"# 排程 display_date() 的第一次呼叫\n" +"end_time = loop.time() + 5.0\n" +"loop.call_soon(display_date, end_time, loop)\n" +"\n" +"# 阻塞呼叫被 loop.stop() 中斷\n" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:1890 +#: ../../library/asyncio-eventloop.rst:1929 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2813,11 +2894,11 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1897 +#: ../../library/asyncio-eventloop.rst:1936 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1899 +#: ../../library/asyncio-eventloop.rst:1938 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" @@ -2825,7 +2906,7 @@ msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1902 +#: ../../library/asyncio-eventloop.rst:1941 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2860,8 +2941,40 @@ msgid "" " wsock.close()\n" " loop.close()" msgstr "" +"import asyncio\n" +"from socket import socketpair\n" +"\n" +"# 建立一對連接的檔案描述器\n" +"rsock, wsock = socketpair()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"def reader():\n" +" data = rsock.recv(100)\n" +" print(\"Received:\", data.decode())\n" +"\n" +" # 我們完成了:註銷檔案描述器\n" +" loop.remove_reader(rsock)\n" +"\n" +" # 停止事件迴圈\n" +" loop.stop()\n" +"\n" +"# 為讀取事件註冊檔案描述器\n" +"loop.add_reader(rsock, reader)\n" +"\n" +"# 模擬從網路接收資料\n" +"loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +"try:\n" +" # 運行事件迴圈\n" +" loop.run_forever()\n" +"finally:\n" +" # 我們完成了。關閉 socket 和事件迴圈。\n" +" rsock.close()\n" +" wsock.close()\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:1937 +#: ../../library/asyncio-eventloop.rst:1976 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -2869,7 +2982,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1941 +#: ../../library/asyncio-eventloop.rst:1980 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -2877,15 +2990,15 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1949 +#: ../../library/asyncio-eventloop.rst:1988 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:1951 +#: ../../library/asyncio-eventloop.rst:1990 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:1953 +#: ../../library/asyncio-eventloop.rst:1992 msgid "" "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." "SIGTERM` using the :meth:`loop.add_signal_handler` method::" @@ -2893,7 +3006,7 @@ msgstr "" "使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" "data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:1956 +#: ../../library/asyncio-eventloop.rst:1995 msgid "" "import asyncio\n" "import functools\n" @@ -2919,3 +3032,26 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"import functools\n" +"import os\n" +"import signal\n" +"\n" +"def ask_exit(signame, loop):\n" +" print(\"got signal %s: exit\" % signame)\n" +" loop.stop()\n" +"\n" +"async def main():\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" for signame in {'SIGINT', 'SIGTERM'}:\n" +" loop.add_signal_handler(\n" +" getattr(signal, signame),\n" +" functools.partial(ask_exit, signame, loop))\n" +"\n" +" await asyncio.sleep(3600)\n" +"\n" +"print(\"Event loop running for 1 hour, press Ctrl+C to interrupt.\")\n" +"print(f\"pid {os.getpid()}: send SIGINT or SIGTERM to exit.\")\n" +"\n" +"asyncio.run(main())" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index b208eeee6a..94e7426522 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -285,7 +285,7 @@ msgid "" "context is used when no *context* is provided." msgstr "" "可選僅限關鍵字引數 *context* 用來指定一個讓 *callback* 執行於其中的客製化 :" -"class:`contextvars.Context` 物件。如果沒有提供 *context*,則使用當前情境。" +"class:`contextvars.Context` 物件。如果沒有提供 *context*,則使用目前情境。" #: ../../library/asyncio-future.rst:171 msgid "" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index ad64842802..53e8482029 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -29,7 +29,7 @@ msgstr "本頁列出所有低階 asyncio APIs。" #: ../../library/asyncio-llapi-index.rst:12 msgid "Obtaining the Event Loop" -msgstr "獲取事件迴圈" +msgstr "取得事件迴圈" #: ../../library/asyncio-llapi-index.rst:18 msgid ":func:`asyncio.get_running_loop`" @@ -37,7 +37,7 @@ msgstr ":func:`asyncio.get_running_loop`" #: ../../library/asyncio-llapi-index.rst:19 msgid "The **preferred** function to get the running event loop." -msgstr "**推薦使用**\\ 於獲取當前運行事件迴圈 (event loop) 的函式。" +msgstr "**推薦使用**\\ 於取得目前運行事件迴圈 (event loop) 的函式。" #: ../../library/asyncio-llapi-index.rst:21 msgid ":func:`asyncio.get_event_loop`" @@ -45,7 +45,7 @@ msgstr ":func:`asyncio.get_event_loop`" #: ../../library/asyncio-llapi-index.rst:22 msgid "Get an event loop instance (running or current via the current policy)." -msgstr "獲得一個(正在運行的或透過當前 policy 建立的)事件迴圈實例。" +msgstr "獲得一個(正在運行的或透過目前 policy 建立的)事件迴圈實例。" #: ../../library/asyncio-llapi-index.rst:24 msgid ":func:`asyncio.set_event_loop`" @@ -53,7 +53,7 @@ msgstr ":func:`asyncio.set_event_loop`" #: ../../library/asyncio-llapi-index.rst:25 msgid "Set the event loop as current via the current policy." -msgstr "透過當前 policy 來設定當前事件迴圈。" +msgstr "透過目前 policy 來設定目前事件迴圈。" #: ../../library/asyncio-llapi-index.rst:27 msgid ":func:`asyncio.new_event_loop`" @@ -160,7 +160,7 @@ msgstr ":meth:`loop.get_debug`" #: ../../library/asyncio-llapi-index.rst:78 msgid "Get the current debug mode." -msgstr "獲取當前除錯模式。" +msgstr "取得目前除錯模式。" #: ../../library/asyncio-llapi-index.rst:81 msgid "Scheduling Callbacks" @@ -172,7 +172,7 @@ msgstr ":meth:`loop.call_soon`" #: ../../library/asyncio-llapi-index.rst:87 msgid "Invoke a callback soon." -msgstr "儘快調用回呼函式 (callback)。" +msgstr "儘快呼叫回呼函式 (callback)。" #: ../../library/asyncio-llapi-index.rst:89 msgid ":meth:`loop.call_soon_threadsafe`" @@ -188,7 +188,7 @@ msgstr ":meth:`loop.call_later`" #: ../../library/asyncio-llapi-index.rst:93 msgid "Invoke a callback *after* the given time." -msgstr "在給定時間\\ *之後*\\ 調用回呼函式。" +msgstr "在給定時間\\ *之後*\\ 呼叫回呼函式。" #: ../../library/asyncio-llapi-index.rst:95 msgid ":meth:`loop.call_at`" @@ -196,7 +196,7 @@ msgstr ":meth:`loop.call_at`" #: ../../library/asyncio-llapi-index.rst:96 msgid "Invoke a callback *at* the given time." -msgstr "在給定時間\\ *當下*\\ 調用回呼函式。" +msgstr "在給定時間\\ *當下*\\ 呼叫回呼函式。" #: ../../library/asyncio-llapi-index.rst:99 msgid "Thread/Process Pool" @@ -263,7 +263,7 @@ msgid "" "Get the factory :meth:`loop.create_task` uses to create :class:`Tasks " "`." msgstr "" -"獲取被 :meth:`loop.create_task` 用來建立 :class:`Tasks ` 的工廠函式。" +"取得被 :meth:`loop.create_task` 用來建立 :class:`Tasks ` 的工廠函式。" #: ../../library/asyncio-llapi-index.rst:132 msgid "DNS" @@ -544,7 +544,7 @@ msgstr ":meth:`loop.get_exception_handler`" #: ../../library/asyncio-llapi-index.rst:262 msgid "Get the current exception handler." -msgstr "獲取當前例外處理函式。" +msgstr "取得目前例外處理函式。" #: ../../library/asyncio-llapi-index.rst:264 msgid ":meth:`loop.default_exception_handler`" @@ -644,7 +644,7 @@ msgstr ":meth:`transport.get_protocol() `" #: ../../library/asyncio-llapi-index.rst:311 msgid "Return the current protocol." -msgstr "回傳當前協定。" +msgstr "回傳目前協定。" #: ../../library/asyncio-llapi-index.rst:314 msgid "" @@ -749,7 +749,7 @@ msgstr "" #: ../../library/asyncio-llapi-index.rst:361 msgid "Return the current size of the output buffer." -msgstr "回傳當前輸出緩衝區的大小。" +msgstr "回傳目前輸出緩衝區的大小。" #: ../../library/asyncio-llapi-index.rst:363 msgid "" @@ -1042,7 +1042,7 @@ msgstr ":meth:`asyncio.get_event_loop_policy`" #: ../../library/asyncio-llapi-index.rst:517 msgid "Return the current process-wide policy." -msgstr "回傳當前整個行程中的 Policy。" +msgstr "回傳目前整個行程中的 Policy。" #: ../../library/asyncio-llapi-index.rst:519 msgid ":meth:`asyncio.set_event_loop_policy`" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 088dea0967..90bb2b684a 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -63,7 +63,7 @@ msgid "" "it is an integer greater than ``0``, then ``await put()`` blocks when the " "queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" -"如果 *maxsize* 小於或等於零,則佇列尺寸是無限制的。如果是大於 ``0`` 的整數," +"如果 *maxsize* 小於或等於零,則佇列大小是無限制的。如果是大於 ``0`` 的整數," "則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素被 :" "meth:`get` 取出。" @@ -72,7 +72,7 @@ msgid "" "Unlike the standard library threading :mod:`queue`, the size of the queue is " "always known and can be returned by calling the :meth:`qsize` method." msgstr "" -"不像標準函式庫中執行緒類型的 :mod:`queue`,佇列的尺寸一直是已知的,可以透過呼" +"不像標準函式庫中執行緒類型的 :mod:`queue`,佇列的大小一直是已知的,可以透過呼" "叫 :meth:`qsize` 方法回傳。" #: ../../library/asyncio-queue.rst:39 @@ -103,28 +103,28 @@ msgstr "" "如果佇列用 ``maxsize=0`` (預設)初始化,則 :meth:`full` 永遠不會回傳 " "``True``。" -#: ../../library/asyncio-queue.rst:62 +#: ../../library/asyncio-queue.rst:63 msgid "" "Remove and return an item from the queue. If queue is empty, wait until an " "item is available." msgstr "從佇列中刪除並回傳一個元素。如果佇列為空,則持續等待直到佇列中有元素。" -#: ../../library/asyncio-queue.rst:65 +#: ../../library/asyncio-queue.rst:66 msgid "" "Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " "if the queue has been shut down immediately." msgstr "" -#: ../../library/asyncio-queue.rst:70 +#: ../../library/asyncio-queue.rst:71 msgid "" "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "如果佇列內有值則立即回傳佇列中的元素,否則引發 :exc:`QueueEmpty`。" -#: ../../library/asyncio-queue.rst:75 +#: ../../library/asyncio-queue.rst:77 msgid "Block until all items in the queue have been received and processed." msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。" -#: ../../library/asyncio-queue.rst:77 +#: ../../library/asyncio-queue.rst:79 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer coroutine calls :meth:" @@ -137,7 +137,7 @@ msgstr "" "成,未完成任務計數就會減少。當未完成計數降到零的時候,:meth:`join` 阻塞會被解" "除 (unblock)。" -#: ../../library/asyncio-queue.rst:85 +#: ../../library/asyncio-queue.rst:88 msgid "" "Put an item into the queue. If the queue is full, wait until a free slot is " "available before adding the item." @@ -145,36 +145,36 @@ msgstr "" "將一個元素放進佇列。如果佇列滿了,在新增元素之前,會持續等待直到有空閒插槽 " "(free slot) 能被使用。" -#: ../../library/asyncio-queue.rst:88 +#: ../../library/asyncio-queue.rst:91 msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." -msgstr "" +msgstr "如果佇列已經被關閉,則引發 :exc:`QueueShutDown`。" -#: ../../library/asyncio-queue.rst:92 +#: ../../library/asyncio-queue.rst:95 msgid "Put an item into the queue without blocking." msgstr "不阻塞地將一個元素放入佇列。" -#: ../../library/asyncio-queue.rst:94 +#: ../../library/asyncio-queue.rst:97 msgid "If no free slot is immediately available, raise :exc:`QueueFull`." msgstr "如果沒有立即可用的空閒插槽,引發 :exc:`QueueFull`。" -#: ../../library/asyncio-queue.rst:98 +#: ../../library/asyncio-queue.rst:101 msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" -#: ../../library/asyncio-queue.rst:102 +#: ../../library/asyncio-queue.rst:105 msgid "" "Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" "exc:`QueueShutDown`." msgstr "" -#: ../../library/asyncio-queue.rst:105 +#: ../../library/asyncio-queue.rst:108 msgid "" "By default, :meth:`~Queue.get` on a shut down queue will only raise once the " "queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " "immediately instead." msgstr "" -#: ../../library/asyncio-queue.rst:109 +#: ../../library/asyncio-queue.rst:112 msgid "" "All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " "unblocked. If *immediate* is true, a task will be marked as done for each " @@ -182,75 +182,75 @@ msgid "" "join`." msgstr "" -#: ../../library/asyncio-queue.rst:118 -msgid "Indicate that a formerly enqueued task is complete." -msgstr "表示前面一個排隊的任務已經完成。" +#: ../../library/asyncio-queue.rst:121 +msgid "Indicate that a formerly enqueued work item is complete." +msgstr "表示前面一個排隊的工作項目已經完成。" -#: ../../library/asyncio-queue.rst:120 +#: ../../library/asyncio-queue.rst:123 msgid "" -"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a task, a " -"subsequent call to :meth:`task_done` tells the queue that the processing on " -"the task is complete." +"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " +"item, a subsequent call to :meth:`task_done` tells the queue that the " +"processing on the work item is complete." msgstr "" -"由佇列消耗者使用。對於每個用於獲取一個任務的 :meth:`~Queue.get`,接續的 :" -"meth:`task_done` 呼叫會告訴佇列這個任務的處理已經完成。" +"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續的 :" +"meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" -#: ../../library/asyncio-queue.rst:124 +#: ../../library/asyncio-queue.rst:127 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`~Queue.put` into the queue)." msgstr "" -"如果 :meth:`join` 當前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" -"以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`\\ )。" +"如果 :meth:`join` 目前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" +"以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" -#: ../../library/asyncio-queue.rst:129 +#: ../../library/asyncio-queue.rst:132 msgid "" "``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " "in the queue." msgstr "" -#: ../../library/asyncio-queue.rst:132 +#: ../../library/asyncio-queue.rst:135 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:137 +#: ../../library/asyncio-queue.rst:140 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:141 +#: ../../library/asyncio-queue.rst:144 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:147 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:149 +#: ../../library/asyncio-queue.rst:152 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:153 +#: ../../library/asyncio-queue.rst:156 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:158 +#: ../../library/asyncio-queue.rst:161 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:162 +#: ../../library/asyncio-queue.rst:165 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。" -#: ../../library/asyncio-queue.rst:168 +#: ../../library/asyncio-queue.rst:171 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -258,25 +258,22 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:174 -#, fuzzy +#: ../../library/asyncio-queue.rst:177 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a queue which has been shut down." msgstr "" -"當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" -"法會引發這個例外。" -#: ../../library/asyncio-queue.rst:181 +#: ../../library/asyncio-queue.rst:184 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:185 +#: ../../library/asyncio-queue.rst:188 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:188 +#: ../../library/asyncio-queue.rst:191 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 4030cbdb6e..edf75f6778 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -63,27 +63,28 @@ msgstr "當另一個非同步事件迴圈在同一執行緒中執行時,無法 #: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:85 msgid "" "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " -"disables debug mode explicitly. ``None`` is used to respect the global :ref:" -"`asyncio-debug-mode` settings." +"disables debug mode explicitly. ``None`` is used to respect the " +"global :ref:`asyncio-debug-mode` settings." msgstr "" "如果 *debug* 為 ``True``,事件迴圈會以除錯模式執行。``False`` 則會關閉除錯模" "式。``None`` 則會優先使用\\ :ref:`除錯模式 `\\ 的全域設" "定。" #: ../../library/asyncio-runner.rst:40 -#, fuzzy msgid "" "If *loop_factory* is not ``None``, it is used to create a new event loop; " "otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " "end. This function should be used as a main entry point for asyncio " "programs, and should ideally only be called once. It is recommended to use " -"*loop_factory* to configure the event loop instead of policies. Passing :" -"class:`asyncio.EventLoop` allows running asyncio without the policy system." +"*loop_factory* to configure the event loop instead of policies. " +"Passing :class:`asyncio.EventLoop` allows running asyncio without the policy " +"system." msgstr "" "如果 *loop_factory* 不為 ``None``,它會被用於建立一個新的事件迴圈;否則會改" "用 :func:`asyncio.new_event_loop`。迴圈會在最後關閉。這個函式應該要作為" "asyncio 程式的主要進入點,且理想上僅會被呼叫一次。推薦使用 *loop_factory* 來" -"設定事件迴圈時而不是使用 policies(政策)。" +"設定事件迴圈時而不是使用 policies(政策)。傳遞 :class:`asyncio.EventLoop` 可" +"以讓 asyncio 在沒有政策系統的情況下運行。" #: ../../library/asyncio-runner.rst:48 msgid "" @@ -135,8 +136,8 @@ msgstr "" #: ../../library/asyncio-runner.rst:82 msgid "" -"Sometimes several top-level async functions should be called in the same :" -"ref:`event loop ` and :class:`contextvars.Context`." +"Sometimes several top-level async functions should be called in the " +"same :ref:`event loop ` and :class:`contextvars.Context`." msgstr "" #: ../../library/asyncio-runner.rst:89 @@ -179,9 +180,9 @@ msgstr "" #: ../../library/asyncio-runner.rst:111 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The runner's default " -"context is used if ``None``." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The runner's " +"default context is used if ``None``." msgstr "" #: ../../library/asyncio-runner.rst:120 @@ -216,10 +217,10 @@ msgstr "" #: ../../library/asyncio-runner.rst:143 msgid "" -"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:" -"`KeyboardInterrupt` exception is raised in the main thread by default. " -"However this doesn't work with :mod:`asyncio` because it can interrupt " -"asyncio internals and can hang the program from exiting." +"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-" +"C`, :exc:`KeyboardInterrupt` exception is raised in the main thread by " +"default. However this doesn't work with :mod:`asyncio` because it can " +"interrupt asyncio internals and can hang the program from exiting." msgstr "" #: ../../library/asyncio-runner.rst:148 @@ -247,14 +248,14 @@ msgid "" "handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " "raises :exc:`asyncio.CancelledError` inside the main task. This causes the " "Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be " -"used for resource cleanup. After the main task is cancelled, :meth:`asyncio." -"Runner.run` raises :exc:`KeyboardInterrupt`." +"used for resource cleanup. After the main task is " +"cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" #: ../../library/asyncio-runner.rst:160 msgid "" -"A user could write a tight loop which cannot be interrupted by :meth:" -"`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` " -"immediately raises the :exc:`KeyboardInterrupt` without cancelling the main " -"task." +"A user could write a tight loop which cannot be interrupted " +"by :meth:`asyncio.Task.cancel`, in which case the second " +"following :kbd:`Ctrl-C` immediately raises the :exc:`KeyboardInterrupt` " +"without cancelling the main task." msgstr "" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index f4ca808ca4..6858c444a2 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "這是一個使用 asyncio 串流編寫的 TCP echo 客戶端範例: ::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:419 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:430 msgid "" "import asyncio\n" "\n" @@ -96,13 +96,13 @@ msgid "" "with streams:" msgstr "下面的高階 asyncio 函式可以用來建立和處理串流:" -#: ../../library/asyncio-stream.rst:58 +#: ../../library/asyncio-stream.rst:59 msgid "" "Establish a network connection and return a pair of ``(reader, writer)`` " "objects." msgstr "建立網路連線並回傳一對 ``(reader, writer)`` 物件。" -#: ../../library/asyncio-stream.rst:61 +#: ../../library/asyncio-stream.rst:62 msgid "" "The returned *reader* and *writer* objects are instances of :class:" "`StreamReader` and :class:`StreamWriter` classes." @@ -110,7 +110,7 @@ msgstr "" "回傳的 *reader* 和 *writer* 物件是 :class:`StreamReader` 和 :class:" "`StreamWriter` 類別的實例。" -#: ../../library/asyncio-stream.rst:64 ../../library/asyncio-stream.rst:110 +#: ../../library/asyncio-stream.rst:65 ../../library/asyncio-stream.rst:112 msgid "" "*limit* determines the buffer size limit used by the returned :class:" "`StreamReader` instance. By default the *limit* is set to 64 KiB." @@ -118,43 +118,43 @@ msgstr "" "*limit* 指定了回傳的 :class:`StreamReader` 實例所使用的緩衝區 (buffer) 大小限" "制。*limit* 預設為 64 KiB。" -#: ../../library/asyncio-stream.rst:68 +#: ../../library/asyncio-stream.rst:69 msgid "" "The rest of the arguments are passed directly to :meth:`loop." "create_connection`." msgstr "其餘的引數會直接傳遞到 :meth:`loop.create_connection`。" -#: ../../library/asyncio-stream.rst:73 ../../library/asyncio-stream.rst:151 +#: ../../library/asyncio-stream.rst:74 ../../library/asyncio-stream.rst:154 msgid "" "The *sock* argument transfers ownership of the socket to the :class:" "`StreamWriter` created. To close the socket, call its :meth:`~asyncio." "StreamWriter.close` method." msgstr "" -#: ../../library/asyncio-stream.rst:77 +#: ../../library/asyncio-stream.rst:78 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "新增 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-stream.rst:80 +#: ../../library/asyncio-stream.rst:81 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "新增 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-stream.rst:83 ../../library/asyncio-stream.rst:126 -#: ../../library/asyncio-stream.rst:161 ../../library/asyncio-stream.rst:191 +#: ../../library/asyncio-stream.rst:84 ../../library/asyncio-stream.rst:128 +#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:195 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-stream.rst:86 ../../library/asyncio-stream.rst:129 -#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:194 -#: ../../library/asyncio-stream.rst:387 +#: ../../library/asyncio-stream.rst:87 ../../library/asyncio-stream.rst:131 +#: ../../library/asyncio-stream.rst:167 ../../library/asyncio-stream.rst:198 +#: ../../library/asyncio-stream.rst:397 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-stream.rst:99 +#: ../../library/asyncio-stream.rst:101 msgid "Start a socket server." msgstr "啟動 socket 伺服器。" -#: ../../library/asyncio-stream.rst:101 +#: ../../library/asyncio-stream.rst:103 msgid "" "The *client_connected_cb* callback is called whenever a new client " "connection is established. It receives a ``(reader, writer)`` pair as two " @@ -165,7 +165,7 @@ msgstr "" "式會接收到一對引數 ``(reader, writer)``,分別為 :class:`StreamReader` 和 :" "class:`StreamWriter` 的實例。" -#: ../../library/asyncio-stream.rst:106 +#: ../../library/asyncio-stream.rst:108 msgid "" "*client_connected_cb* can be a plain callable or a :ref:`coroutine function " "`; if it is a coroutine function, it will be automatically " @@ -175,47 +175,47 @@ msgstr "" "ref:`協程函式 `;如果它是一個協程函式,它將自動作為 :class:`Task` " "來被排程。" -#: ../../library/asyncio-stream.rst:114 +#: ../../library/asyncio-stream.rst:116 msgid "" "The rest of the arguments are passed directly to :meth:`loop.create_server`." msgstr "剩下的引數將會直接傳遞給 :meth:`loop.create_server`。" -#: ../../library/asyncio-stream.rst:119 ../../library/asyncio-stream.rst:181 +#: ../../library/asyncio-stream.rst:121 ../../library/asyncio-stream.rst:185 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -#: ../../library/asyncio-stream.rst:123 +#: ../../library/asyncio-stream.rst:125 msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters." msgstr "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。" -#: ../../library/asyncio-stream.rst:132 +#: ../../library/asyncio-stream.rst:134 msgid "Added the *keep_alive* parameter." msgstr "新增 *keep_alive* 參數。" -#: ../../library/asyncio-stream.rst:137 +#: ../../library/asyncio-stream.rst:139 msgid "Unix Sockets" msgstr "Unix Sockets" -#: ../../library/asyncio-stream.rst:142 +#: ../../library/asyncio-stream.rst:145 msgid "" "Establish a Unix socket connection and return a pair of ``(reader, writer)``." msgstr "建立一個 Unix socket 連線並回傳一對 ``(reader, writer)``。" -#: ../../library/asyncio-stream.rst:145 +#: ../../library/asyncio-stream.rst:148 msgid "Similar to :func:`open_connection` but operates on Unix sockets." msgstr "與 :func:`open_connection` 相似,但是是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:147 +#: ../../library/asyncio-stream.rst:150 msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr "另請參閱 :meth:`loop.create_unix_connection` 文件。" -#: ../../library/asyncio-stream.rst:155 ../../library/asyncio-stream.rst:185 +#: ../../library/asyncio-stream.rst:158 ../../library/asyncio-stream.rst:189 msgid "Availability" msgstr "" -#: ../../library/asyncio-stream.rst:157 +#: ../../library/asyncio-stream.rst:160 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`" @@ -223,19 +223,19 @@ msgstr "" "新增 *ssl_handshake_timeout* 參數。*path* 參數現在可以是個 :term:`path-like " "object`" -#: ../../library/asyncio-stream.rst:173 +#: ../../library/asyncio-stream.rst:177 msgid "Start a Unix socket server." msgstr "啟動一個 Unix socket 伺服器。" -#: ../../library/asyncio-stream.rst:175 +#: ../../library/asyncio-stream.rst:179 msgid "Similar to :func:`start_server` but works with Unix sockets." msgstr "與 :func:`start_server` 相似,但會是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:177 +#: ../../library/asyncio-stream.rst:181 msgid "See also the documentation of :meth:`loop.create_unix_server`." msgstr "另請參閱 :meth:`loop.create_unix_server` 文件。" -#: ../../library/asyncio-stream.rst:187 +#: ../../library/asyncio-stream.rst:191 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :term:`path-like object`." @@ -243,11 +243,11 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可以是" "個 :term:`path-like object`。" -#: ../../library/asyncio-stream.rst:199 +#: ../../library/asyncio-stream.rst:203 msgid "StreamReader" msgstr "StreamReader" -#: ../../library/asyncio-stream.rst:203 +#: ../../library/asyncio-stream.rst:207 msgid "" "Represents a reader object that provides APIs to read data from the IO " "stream. As an :term:`asynchronous iterable`, the object supports the :" @@ -256,7 +256,7 @@ msgstr "" "表示一個有提供 API 來從 IO 串流中讀取資料的 reader 物件。作為一個 :term:" "`asynchronous iterable`,此物件支援 :keyword:`async for` 陳述式。" -#: ../../library/asyncio-stream.rst:207 +#: ../../library/asyncio-stream.rst:211 msgid "" "It is not recommended to instantiate *StreamReader* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -264,15 +264,15 @@ msgstr "" "不建議直接實例化 *StreamReader* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:213 +#: ../../library/asyncio-stream.rst:217 msgid "Acknowledge the EOF." msgstr "" -#: ../../library/asyncio-stream.rst:217 +#: ../../library/asyncio-stream.rst:222 msgid "Read up to *n* bytes from the stream." msgstr "從串流中讀取至多 *n* 個位元組的資料。" -#: ../../library/asyncio-stream.rst:219 +#: ../../library/asyncio-stream.rst:224 msgid "" "If *n* is not provided or set to ``-1``, read until EOF, then return all " "read :class:`bytes`. If EOF was received and the internal buffer is empty, " @@ -282,53 +282,53 @@ msgstr "" "的 :class:`bytes`。讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物" "件。" -#: ../../library/asyncio-stream.rst:224 +#: ../../library/asyncio-stream.rst:229 msgid "If *n* is ``0``, return an empty ``bytes`` object immediately." msgstr "如果 *n* 為 ``0``,則立即回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:226 +#: ../../library/asyncio-stream.rst:231 msgid "" "If *n* is positive, return at most *n* available ``bytes`` as soon as at " "least 1 byte is available in the internal buffer. If EOF is received before " "any byte is read, return an empty ``bytes`` object." msgstr "" -#: ../../library/asyncio-stream.rst:233 +#: ../../library/asyncio-stream.rst:239 msgid "" "Read one line, where \"line\" is a sequence of bytes ending with ``\\n``." msgstr "讀取一行,其中\"行\"指的是以 ``\\n`` 結尾的位元組序列。" -#: ../../library/asyncio-stream.rst:236 +#: ../../library/asyncio-stream.rst:242 msgid "" "If EOF is received and ``\\n`` was not found, the method returns partially " "read data." msgstr "如果讀取到 EOF 而沒有找到 ``\\n``,該方法會回傳部分的已讀取資料。" -#: ../../library/asyncio-stream.rst:239 +#: ../../library/asyncio-stream.rst:245 msgid "" "If EOF is received and the internal buffer is empty, return an empty " "``bytes`` object." msgstr "如果讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:244 +#: ../../library/asyncio-stream.rst:251 msgid "Read exactly *n* bytes." msgstr "讀取剛好 *n* 個位元組。" -#: ../../library/asyncio-stream.rst:246 +#: ../../library/asyncio-stream.rst:253 msgid "" "Raise an :exc:`IncompleteReadError` if EOF is reached before *n* can be " "read. Use the :attr:`IncompleteReadError.partial` attribute to get the " "partially read data." msgstr "" "如果在讀取完 *n* 個位元組之前讀取到 EOF,則會引發 :exc:" -"`IncompleteReadError`。使用 :attr:`IncompleteReadError.partial` 屬性來獲取串" +"`IncompleteReadError`。使用 :attr:`IncompleteReadError.partial` 屬性來取得串" "流結束前已讀取的部分資料。" -#: ../../library/asyncio-stream.rst:252 +#: ../../library/asyncio-stream.rst:260 msgid "Read data from the stream until *separator* is found." msgstr "從串流中持續讀取資料直到出現 *separator*。" -#: ../../library/asyncio-stream.rst:254 +#: ../../library/asyncio-stream.rst:262 msgid "" "On success, the data and separator will be removed from the internal buffer " "(consumed). Returned data will include the separator at the end." @@ -336,7 +336,7 @@ msgstr "" "成功後,資料和 separator(分隔符號)會從內部緩衝區中刪除(或者說是被消費掉 " "(consumed))。回傳的資料在末尾會有一個 separator。" -#: ../../library/asyncio-stream.rst:258 +#: ../../library/asyncio-stream.rst:266 msgid "" "If the amount of data read exceeds the configured stream limit, a :exc:" "`LimitOverrunError` exception is raised, and the data is left in the " @@ -345,7 +345,7 @@ msgstr "" "如果讀取的資料量超過了設定的串流限制,將會引發 :exc:`LimitOverrunError` 例" "外,資料將被留在內部緩衝區中,並可以再次被讀取。" -#: ../../library/asyncio-stream.rst:262 +#: ../../library/asyncio-stream.rst:270 msgid "" "If EOF is reached before the complete separator is found, an :exc:" "`IncompleteReadError` exception is raised, and the internal buffer is " @@ -356,7 +356,7 @@ msgstr "" "`IncompleteReadError` 例外,且內部緩衝區會被重置。:attr:`IncompleteReadError." "partial` 屬性可能包含一部分的 separator。" -#: ../../library/asyncio-stream.rst:267 +#: ../../library/asyncio-stream.rst:275 msgid "" "The *separator* may also be a tuple of separators. In this case the return " "value will be the shortest possible that has any separator as the suffix. " @@ -364,24 +364,24 @@ msgid "" "separator is considered to be the one that matched." msgstr "" -#: ../../library/asyncio-stream.rst:277 +#: ../../library/asyncio-stream.rst:285 msgid "The *separator* parameter may now be a :class:`tuple` of separators." msgstr "現在 *separator* 參數可以是一個分隔符號的 :class:`tuple`。" -#: ../../library/asyncio-stream.rst:282 +#: ../../library/asyncio-stream.rst:290 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "如果緩衝區是空的且 :meth:`feed_eof` 曾被呼叫則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:287 +#: ../../library/asyncio-stream.rst:295 msgid "StreamWriter" msgstr "StreamWriter" -#: ../../library/asyncio-stream.rst:291 +#: ../../library/asyncio-stream.rst:299 msgid "" "Represents a writer object that provides APIs to write data to the IO stream." msgstr "表示一個有提供 API 來將資料寫入 IO 串流的 writer 物件。" -#: ../../library/asyncio-stream.rst:294 +#: ../../library/asyncio-stream.rst:302 msgid "" "It is not recommended to instantiate *StreamWriter* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -389,7 +389,7 @@ msgstr "" "不建議直接實例化 *StreamWriter* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:300 +#: ../../library/asyncio-stream.rst:308 msgid "" "The method attempts to write the *data* to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -398,11 +398,11 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:304 ../../library/asyncio-stream.rst:316 +#: ../../library/asyncio-stream.rst:312 ../../library/asyncio-stream.rst:324 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:306 +#: ../../library/asyncio-stream.rst:314 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -410,7 +410,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:311 +#: ../../library/asyncio-stream.rst:319 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -419,7 +419,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:318 +#: ../../library/asyncio-stream.rst:326 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -427,17 +427,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:323 +#: ../../library/asyncio-stream.rst:331 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:325 +#: ../../library/asyncio-stream.rst:333 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:328 +#: ../../library/asyncio-stream.rst:336 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -445,7 +445,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:333 +#: ../../library/asyncio-stream.rst:341 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -453,26 +453,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:338 +#: ../../library/asyncio-stream.rst:346 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:351 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:347 +#: ../../library/asyncio-stream.rst:355 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:352 +#: ../../library/asyncio-stream.rst:361 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:355 +#: ../../library/asyncio-stream.rst:364 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -480,7 +480,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:358 +#: ../../library/asyncio-stream.rst:367 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -492,48 +492,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:368 +#: ../../library/asyncio-stream.rst:378 msgid "Upgrade an existing stream-based connection to TLS." msgstr "將現有的基於串流的連線升級到 TLS。" -#: ../../library/asyncio-stream.rst:370 +#: ../../library/asyncio-stream.rst:380 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:372 +#: ../../library/asyncio-stream.rst:382 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:一個 :class:`~ssl.SSLContext` 的已配置實例。" -#: ../../library/asyncio-stream.rst:374 +#: ../../library/asyncio-stream.rst:384 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設定或覆寫將會被目標伺服器憑證比對的主機名稱。" -#: ../../library/asyncio-stream.rst:377 +#: ../../library/asyncio-stream.rst:387 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:381 +#: ../../library/asyncio-stream.rst:391 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:393 +#: ../../library/asyncio-stream.rst:403 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:400 +#: ../../library/asyncio-stream.rst:411 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:402 +#: ../../library/asyncio-stream.rst:413 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " @@ -542,19 +542,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:410 +#: ../../library/asyncio-stream.rst:421 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:415 +#: ../../library/asyncio-stream.rst:426 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 客戶端" -#: ../../library/asyncio-stream.rst:417 +#: ../../library/asyncio-stream.rst:428 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 客戶端: ::" -#: ../../library/asyncio-stream.rst:441 +#: ../../library/asyncio-stream.rst:452 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -563,15 +563,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 客戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:448 +#: ../../library/asyncio-stream.rst:459 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:450 +#: ../../library/asyncio-stream.rst:461 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:452 +#: ../../library/asyncio-stream.rst:463 msgid "" "import asyncio\n" "\n" @@ -631,7 +631,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:484 +#: ../../library/asyncio-stream.rst:495 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -640,16 +640,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:489 +#: ../../library/asyncio-stream.rst:500 msgid "Get HTTP headers" -msgstr "獲取 HTTP 標頭" +msgstr "取得 HTTP 標頭" -#: ../../library/asyncio-stream.rst:491 +#: ../../library/asyncio-stream.rst:502 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:493 +#: ../../library/asyncio-stream.rst:504 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -688,34 +688,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:530 +#: ../../library/asyncio-stream.rst:541 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:532 +#: ../../library/asyncio-stream.rst:543 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:534 +#: ../../library/asyncio-stream.rst:545 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:536 +#: ../../library/asyncio-stream.rst:547 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:542 +#: ../../library/asyncio-stream.rst:553 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:544 +#: ../../library/asyncio-stream.rst:555 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:547 +#: ../../library/asyncio-stream.rst:558 msgid "" "import asyncio\n" "import socket\n" @@ -748,7 +748,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:579 +#: ../../library/asyncio-stream.rst:590 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -758,7 +758,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:583 +#: ../../library/asyncio-stream.rst:594 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index a3ffe6d7bf..8669d045c3 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-03-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,43 +127,44 @@ msgstr "另請參閱\\ `Examples`_。" msgid "Creating Subprocesses" msgstr "建立子行程" -#: ../../library/asyncio-subprocess.rst:67 +#: ../../library/asyncio-subprocess.rst:68 msgid "Create a subprocess." msgstr "" -#: ../../library/asyncio-subprocess.rst:69 -#: ../../library/asyncio-subprocess.rst:87 +#: ../../library/asyncio-subprocess.rst:70 +#: ../../library/asyncio-subprocess.rst:89 msgid "" "The *limit* argument sets the buffer limit for :class:`StreamReader` " -"wrappers for :attr:`Process.stdout` and :attr:`Process.stderr` (if :const:" -"`subprocess.PIPE` is passed to *stdout* and *stderr* arguments)." +"wrappers for :attr:`~asyncio.subprocess.Process.stdout` and :attr:`~asyncio." +"subprocess.Process.stderr` (if :const:`subprocess.PIPE` is passed to " +"*stdout* and *stderr* arguments)." msgstr "" -#: ../../library/asyncio-subprocess.rst:73 -#: ../../library/asyncio-subprocess.rst:91 +#: ../../library/asyncio-subprocess.rst:74 +#: ../../library/asyncio-subprocess.rst:93 msgid "Return a :class:`~asyncio.subprocess.Process` instance." msgstr "" -#: ../../library/asyncio-subprocess.rst:75 +#: ../../library/asyncio-subprocess.rst:76 msgid "" "See the documentation of :meth:`loop.subprocess_exec` for other parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:78 -#: ../../library/asyncio-subprocess.rst:105 +#: ../../library/asyncio-subprocess.rst:79 +#: ../../library/asyncio-subprocess.rst:107 msgid "Removed the *loop* parameter." msgstr "" -#: ../../library/asyncio-subprocess.rst:85 +#: ../../library/asyncio-subprocess.rst:87 msgid "Run the *cmd* shell command." msgstr "" -#: ../../library/asyncio-subprocess.rst:93 +#: ../../library/asyncio-subprocess.rst:95 msgid "" "See the documentation of :meth:`loop.subprocess_shell` for other parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:98 +#: ../../library/asyncio-subprocess.rst:100 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -173,14 +174,14 @@ msgid "" "be used to construct shell commands." msgstr "" -#: ../../library/asyncio-subprocess.rst:110 +#: ../../library/asyncio-subprocess.rst:112 msgid "" "Subprocesses are available for Windows if a :class:`ProactorEventLoop` is " "used. See :ref:`Subprocess Support on Windows ` " "for details." msgstr "" -#: ../../library/asyncio-subprocess.rst:116 +#: ../../library/asyncio-subprocess.rst:118 msgid "" "asyncio also has the following *low-level* APIs to work with subprocesses: :" "meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop." @@ -189,47 +190,47 @@ msgid "" "Protocols `." msgstr "" -#: ../../library/asyncio-subprocess.rst:124 +#: ../../library/asyncio-subprocess.rst:126 msgid "Constants" msgstr "常數" -#: ../../library/asyncio-subprocess.rst:129 +#: ../../library/asyncio-subprocess.rst:131 msgid "Can be passed to the *stdin*, *stdout* or *stderr* parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:131 +#: ../../library/asyncio-subprocess.rst:133 msgid "" "If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin ` attribute will point to a :class:`StreamWriter` " -"instance." +"subprocess.Process.stdin>` attribute will point to a :class:`~asyncio." +"StreamWriter` instance." msgstr "" -#: ../../library/asyncio-subprocess.rst:135 +#: ../../library/asyncio-subprocess.rst:137 msgid "" "If *PIPE* is passed to *stdout* or *stderr* arguments, the :attr:`Process." "stdout ` and :attr:`Process.stderr " "` attributes will point to :class:" -"`StreamReader` instances." +"`~asyncio.StreamReader` instances." msgstr "" -#: ../../library/asyncio-subprocess.rst:143 +#: ../../library/asyncio-subprocess.rst:145 msgid "" "Special value that can be used as the *stderr* argument and indicates that " "standard error should be redirected into standard output." msgstr "" -#: ../../library/asyncio-subprocess.rst:149 +#: ../../library/asyncio-subprocess.rst:151 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to process creation functions. It indicates that the special file :data:`os." "devnull` will be used for the corresponding subprocess stream." msgstr "" -#: ../../library/asyncio-subprocess.rst:155 +#: ../../library/asyncio-subprocess.rst:157 msgid "Interacting with Subprocesses" msgstr "" -#: ../../library/asyncio-subprocess.rst:157 +#: ../../library/asyncio-subprocess.rst:159 msgid "" "Both :func:`create_subprocess_exec` and :func:`create_subprocess_shell` " "functions return instances of the *Process* class. *Process* is a high-" @@ -237,61 +238,62 @@ msgid "" "their completion." msgstr "" -#: ../../library/asyncio-subprocess.rst:165 +#: ../../library/asyncio-subprocess.rst:167 msgid "" -"An object that wraps OS processes created by the :func:" -"`create_subprocess_exec` and :func:`create_subprocess_shell` functions." +"An object that wraps OS processes created by the :func:`~asyncio." +"create_subprocess_exec` and :func:`~asyncio.create_subprocess_shell` " +"functions." msgstr "" -#: ../../library/asyncio-subprocess.rst:169 +#: ../../library/asyncio-subprocess.rst:171 msgid "" "This class is designed to have a similar API to the :class:`subprocess." "Popen` class, but there are some notable differences:" msgstr "" -#: ../../library/asyncio-subprocess.rst:173 +#: ../../library/asyncio-subprocess.rst:175 msgid "" "unlike Popen, Process instances do not have an equivalent to the :meth:" "`~subprocess.Popen.poll` method;" msgstr "" -#: ../../library/asyncio-subprocess.rst:176 +#: ../../library/asyncio-subprocess.rst:178 msgid "" "the :meth:`~asyncio.subprocess.Process.communicate` and :meth:`~asyncio." "subprocess.Process.wait` methods don't have a *timeout* parameter: use the :" "func:`~asyncio.wait_for` function;" msgstr "" -#: ../../library/asyncio-subprocess.rst:180 +#: ../../library/asyncio-subprocess.rst:182 msgid "" "the :meth:`Process.wait() ` method is " "asynchronous, whereas :meth:`subprocess.Popen.wait` method is implemented as " "a blocking busy loop;" msgstr "" -#: ../../library/asyncio-subprocess.rst:184 +#: ../../library/asyncio-subprocess.rst:186 msgid "the *universal_newlines* parameter is not supported." msgstr "" -#: ../../library/asyncio-subprocess.rst:186 +#: ../../library/asyncio-subprocess.rst:188 msgid "This class is :ref:`not thread safe `." msgstr "" -#: ../../library/asyncio-subprocess.rst:188 +#: ../../library/asyncio-subprocess.rst:190 msgid "" "See also the :ref:`Subprocess and Threads ` " "section." msgstr "" -#: ../../library/asyncio-subprocess.rst:193 +#: ../../library/asyncio-subprocess.rst:196 msgid "Wait for the child process to terminate." msgstr "" -#: ../../library/asyncio-subprocess.rst:195 +#: ../../library/asyncio-subprocess.rst:198 msgid "Set and return the :attr:`returncode` attribute." msgstr "" -#: ../../library/asyncio-subprocess.rst:199 +#: ../../library/asyncio-subprocess.rst:202 msgid "" "This method can deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and " "the child process generates so much output that it blocks waiting for the OS " @@ -299,37 +301,37 @@ msgid "" "using pipes to avoid this condition." msgstr "" -#: ../../library/asyncio-subprocess.rst:207 +#: ../../library/asyncio-subprocess.rst:211 msgid "Interact with process:" msgstr "" -#: ../../library/asyncio-subprocess.rst:209 +#: ../../library/asyncio-subprocess.rst:213 msgid "send data to *stdin* (if *input* is not ``None``);" msgstr "" -#: ../../library/asyncio-subprocess.rst:210 +#: ../../library/asyncio-subprocess.rst:214 msgid "closes *stdin*;" msgstr "" -#: ../../library/asyncio-subprocess.rst:211 +#: ../../library/asyncio-subprocess.rst:215 msgid "read data from *stdout* and *stderr*, until EOF is reached;" msgstr "" -#: ../../library/asyncio-subprocess.rst:212 +#: ../../library/asyncio-subprocess.rst:216 msgid "wait for process to terminate." msgstr "" -#: ../../library/asyncio-subprocess.rst:214 +#: ../../library/asyncio-subprocess.rst:218 msgid "" "The optional *input* argument is the data (:class:`bytes` object) that will " "be sent to the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:217 +#: ../../library/asyncio-subprocess.rst:221 msgid "Return a tuple ``(stdout_data, stderr_data)``." msgstr "" -#: ../../library/asyncio-subprocess.rst:219 +#: ../../library/asyncio-subprocess.rst:223 msgid "" "If either :exc:`BrokenPipeError` or :exc:`ConnectionResetError` exception is " "raised when writing *input* into *stdin*, the exception is ignored. This " @@ -337,7 +339,7 @@ msgid "" "*stdin*." msgstr "" -#: ../../library/asyncio-subprocess.rst:224 +#: ../../library/asyncio-subprocess.rst:228 msgid "" "If it is desired to send data to the process' *stdin*, the process needs to " "be created with ``stdin=PIPE``. Similarly, to get anything other than " @@ -345,75 +347,76 @@ msgid "" "``stdout=PIPE`` and/or ``stderr=PIPE`` arguments." msgstr "" -#: ../../library/asyncio-subprocess.rst:230 +#: ../../library/asyncio-subprocess.rst:234 msgid "" "Note, that the data read is buffered in memory, so do not use this method if " "the data size is large or unlimited." msgstr "" -#: ../../library/asyncio-subprocess.rst:235 -msgid "*stdin* gets closed when `input=None` too." +#: ../../library/asyncio-subprocess.rst:239 +msgid "*stdin* gets closed when ``input=None`` too." msgstr "" -#: ../../library/asyncio-subprocess.rst:239 +#: ../../library/asyncio-subprocess.rst:243 msgid "Sends the signal *signal* to the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:243 +#: ../../library/asyncio-subprocess.rst:247 msgid "" "On Windows, :py:const:`~signal.SIGTERM` is an alias for :meth:`terminate`. " "``CTRL_C_EVENT`` and ``CTRL_BREAK_EVENT`` can be sent to processes started " "with a *creationflags* parameter which includes ``CREATE_NEW_PROCESS_GROUP``." msgstr "" -#: ../../library/asyncio-subprocess.rst:250 +#: ../../library/asyncio-subprocess.rst:254 msgid "Stop the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:252 +#: ../../library/asyncio-subprocess.rst:256 msgid "" "On POSIX systems this method sends :py:const:`~signal.SIGTERM` to the child " "process." msgstr "" -#: ../../library/asyncio-subprocess.rst:255 +#: ../../library/asyncio-subprocess.rst:259 msgid "" "On Windows the Win32 API function :c:func:`!TerminateProcess` is called to " "stop the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:260 +#: ../../library/asyncio-subprocess.rst:264 msgid "Kill the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:262 +#: ../../library/asyncio-subprocess.rst:266 msgid "" -"On POSIX systems this method sends :py:data:`SIGKILL` to the child process." +"On POSIX systems this method sends :py:data:`~signal.SIGKILL` to the child " +"process." msgstr "" -#: ../../library/asyncio-subprocess.rst:265 +#: ../../library/asyncio-subprocess.rst:269 msgid "On Windows this method is an alias for :meth:`terminate`." msgstr "" -#: ../../library/asyncio-subprocess.rst:269 +#: ../../library/asyncio-subprocess.rst:273 msgid "" -"Standard input stream (:class:`StreamWriter`) or ``None`` if the process was " -"created with ``stdin=None``." +"Standard input stream (:class:`~asyncio.StreamWriter`) or ``None`` if the " +"process was created with ``stdin=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:274 +#: ../../library/asyncio-subprocess.rst:278 msgid "" -"Standard output stream (:class:`StreamReader`) or ``None`` if the process " -"was created with ``stdout=None``." +"Standard output stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stdout=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:279 +#: ../../library/asyncio-subprocess.rst:283 msgid "" -"Standard error stream (:class:`StreamReader`) or ``None`` if the process was " -"created with ``stderr=None``." +"Standard error stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stderr=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:284 +#: ../../library/asyncio-subprocess.rst:288 msgid "" "Use the :meth:`communicate` method rather than :attr:`process.stdin.write() " "`, :attr:`await process.stdout.read() ` or :attr:`await " @@ -421,93 +424,94 @@ msgid "" "pausing reading or writing and blocking the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:293 +#: ../../library/asyncio-subprocess.rst:297 msgid "Process identification number (PID)." msgstr "" -#: ../../library/asyncio-subprocess.rst:295 +#: ../../library/asyncio-subprocess.rst:299 msgid "" -"Note that for processes created by the :func:`create_subprocess_shell` " -"function, this attribute is the PID of the spawned shell." +"Note that for processes created by the :func:`~asyncio." +"create_subprocess_shell` function, this attribute is the PID of the spawned " +"shell." msgstr "" -#: ../../library/asyncio-subprocess.rst:300 +#: ../../library/asyncio-subprocess.rst:304 msgid "Return code of the process when it exits." msgstr "" -#: ../../library/asyncio-subprocess.rst:302 +#: ../../library/asyncio-subprocess.rst:306 msgid "A ``None`` value indicates that the process has not terminated yet." msgstr "" -#: ../../library/asyncio-subprocess.rst:304 +#: ../../library/asyncio-subprocess.rst:308 msgid "" "A negative value ``-N`` indicates that the child was terminated by signal " "``N`` (POSIX only)." msgstr "" -#: ../../library/asyncio-subprocess.rst:311 +#: ../../library/asyncio-subprocess.rst:315 msgid "Subprocess and Threads" msgstr "子行程與線程" -#: ../../library/asyncio-subprocess.rst:313 +#: ../../library/asyncio-subprocess.rst:317 msgid "" "Standard asyncio event loop supports running subprocesses from different " "threads by default." msgstr "" -#: ../../library/asyncio-subprocess.rst:316 +#: ../../library/asyncio-subprocess.rst:320 msgid "" "On Windows subprocesses are provided by :class:`ProactorEventLoop` only " "(default), :class:`SelectorEventLoop` has no subprocess support." msgstr "" -#: ../../library/asyncio-subprocess.rst:319 +#: ../../library/asyncio-subprocess.rst:323 msgid "" "On UNIX *child watchers* are used for subprocess finish waiting, see :ref:" "`asyncio-watchers` for more info." msgstr "" -#: ../../library/asyncio-subprocess.rst:325 +#: ../../library/asyncio-subprocess.rst:329 msgid "" "UNIX switched to use :class:`ThreadedChildWatcher` for spawning subprocesses " "from different threads without any limitation." msgstr "" -#: ../../library/asyncio-subprocess.rst:328 +#: ../../library/asyncio-subprocess.rst:332 msgid "" "Spawning a subprocess with *inactive* current child watcher raises :exc:" "`RuntimeError`." msgstr "" -#: ../../library/asyncio-subprocess.rst:331 +#: ../../library/asyncio-subprocess.rst:335 msgid "" "Note that alternative event loop implementations might have own limitations; " "please refer to their documentation." msgstr "" -#: ../../library/asyncio-subprocess.rst:336 +#: ../../library/asyncio-subprocess.rst:340 msgid "" "The :ref:`Concurrency and multithreading in asyncio ` section." msgstr "" -#: ../../library/asyncio-subprocess.rst:341 +#: ../../library/asyncio-subprocess.rst:345 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-subprocess.rst:343 +#: ../../library/asyncio-subprocess.rst:347 msgid "" "An example using the :class:`~asyncio.subprocess.Process` class to control a " "subprocess and the :class:`StreamReader` class to read from its standard " "output." msgstr "" -#: ../../library/asyncio-subprocess.rst:349 +#: ../../library/asyncio-subprocess.rst:353 msgid "" "The subprocess is created by the :func:`create_subprocess_exec` function::" msgstr "" -#: ../../library/asyncio-subprocess.rst:352 +#: ../../library/asyncio-subprocess.rst:356 msgid "" "import asyncio\n" "import sys\n" @@ -533,7 +537,7 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -#: ../../library/asyncio-subprocess.rst:376 +#: ../../library/asyncio-subprocess.rst:380 msgid "" "See also the :ref:`same example ` written " "using low-level APIs." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index f7068e20fe..a539db9b6e 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-30 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -107,8 +107,8 @@ msgid "" " # access shared state" msgstr "" -#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:199 -#: ../../library/asyncio-sync.rst:304 +#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:201 +#: ../../library/asyncio-sync.rst:309 msgid "which is equivalent to::" msgstr "這等價於: ::" @@ -124,17 +124,17 @@ msgid "" " lock.release()" msgstr "" -#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:112 -#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:292 -#: ../../library/asyncio-sync.rst:347 +#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:113 +#: ../../library/asyncio-sync.rst:189 ../../library/asyncio-sync.rst:297 +#: ../../library/asyncio-sync.rst:353 msgid "Removed the *loop* parameter." msgstr "移除 ``loop`` 參數。" -#: ../../library/asyncio-sync.rst:72 +#: ../../library/asyncio-sync.rst:73 msgid "Acquire the lock." msgstr "獲得鎖。" -#: ../../library/asyncio-sync.rst:74 +#: ../../library/asyncio-sync.rst:75 msgid "" "This method waits until the lock is *unlocked*, sets it to *locked* and " "returns ``True``." @@ -142,7 +142,7 @@ msgstr "" "此方法會持續等待直到鎖的狀態成為 *unlocked*,並將其設置為 *locked* 和回傳 " "``True``。" -#: ../../library/asyncio-sync.rst:77 +#: ../../library/asyncio-sync.rst:78 msgid "" "When more than one coroutine is blocked in :meth:`acquire` waiting for the " "lock to be unlocked, only one coroutine eventually proceeds." @@ -150,45 +150,45 @@ msgstr "" "當多於一個的協程 (coroutine) 在 :meth:`acquire` 中等待解鎖而被阻塞,最終只會" "有其中的一個被處理。" -#: ../../library/asyncio-sync.rst:81 +#: ../../library/asyncio-sync.rst:82 msgid "" "Acquiring a lock is *fair*: the coroutine that proceeds will be the first " "coroutine that started waiting on the lock." msgstr "" -"鎖的獲取方式是\\ *公平*\\ 的:被處理的協程會是最早開始等待解鎖的那一個。" +"鎖的取得方式是\\ *公平*\\ 的:被處理的協程會是最早開始等待解鎖的那一個。" -#: ../../library/asyncio-sync.rst:86 +#: ../../library/asyncio-sync.rst:87 msgid "Release the lock." msgstr "釋放鎖。" -#: ../../library/asyncio-sync.rst:88 +#: ../../library/asyncio-sync.rst:89 msgid "When the lock is *locked*, reset it to *unlocked* and return." msgstr "如果鎖的狀態為 *locked* 則將其重置為 *unlocked* 並回傳。" -#: ../../library/asyncio-sync.rst:90 +#: ../../library/asyncio-sync.rst:91 msgid "If the lock is *unlocked*, a :exc:`RuntimeError` is raised." msgstr "如果鎖的狀態為 *unlocked* 則 :exc:`RuntimeError` 會被引發。" -#: ../../library/asyncio-sync.rst:94 +#: ../../library/asyncio-sync.rst:95 msgid "Return ``True`` if the lock is *locked*." msgstr "如果鎖的狀態為 *locked* 則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:98 +#: ../../library/asyncio-sync.rst:99 msgid "Event" msgstr "Event" -#: ../../library/asyncio-sync.rst:102 +#: ../../library/asyncio-sync.rst:103 msgid "An event object. Not thread-safe." msgstr "一個事件 (event) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:104 +#: ../../library/asyncio-sync.rst:105 msgid "" "An asyncio event can be used to notify multiple asyncio tasks that some " "event has happened." msgstr "" "一個 asyncio 事件可以被用於通知多個有發生某些事件於其中的 asyncio 任務。" -#: ../../library/asyncio-sync.rst:107 +#: ../../library/asyncio-sync.rst:108 msgid "" "An Event object manages an internal flag that can be set to *true* with the :" "meth:`~Event.set` method and reset to *false* with the :meth:`clear` " @@ -200,11 +200,11 @@ msgstr "" "wait` 方法會被阻塞 (block) 直到該旗標被設為 *true*。該旗標初始設置為 " "*false*。" -#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:371 +#: ../../library/asyncio-sync.rst:118 ../../library/asyncio-sync.rst:377 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-sync.rst:119 +#: ../../library/asyncio-sync.rst:120 msgid "" "async def waiter(event):\n" " print('waiting for it ...')\n" @@ -228,11 +228,11 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-sync.rst:142 +#: ../../library/asyncio-sync.rst:144 msgid "Wait until the event is set." msgstr "持續等待直到事件被設置。" -#: ../../library/asyncio-sync.rst:144 +#: ../../library/asyncio-sync.rst:146 msgid "" "If the event is set, return ``True`` immediately. Otherwise block until " "another task calls :meth:`~Event.set`." @@ -240,19 +240,19 @@ msgstr "" "如果事件有被設置則立刻回傳 ``True``。否則持續阻塞直到另一個任務呼叫 :meth:" "`~Event.set`。" -#: ../../library/asyncio-sync.rst:149 +#: ../../library/asyncio-sync.rst:151 msgid "Set the event." msgstr "設置事件。" -#: ../../library/asyncio-sync.rst:151 +#: ../../library/asyncio-sync.rst:153 msgid "All tasks waiting for event to be set will be immediately awakened." msgstr "所有正在等待事件被設置的任務會立即被喚醒。" -#: ../../library/asyncio-sync.rst:156 +#: ../../library/asyncio-sync.rst:158 msgid "Clear (unset) the event." msgstr "清除(還原)事件。" -#: ../../library/asyncio-sync.rst:158 +#: ../../library/asyncio-sync.rst:160 msgid "" "Tasks awaiting on :meth:`~Event.wait` will now block until the :meth:`~Event." "set` method is called again." @@ -260,19 +260,19 @@ msgstr "" "正透過 :meth:`~Event.wait` 等待的 Tasks 現在會持續阻塞直到 :meth:`~Event." "set` 方法再次被呼叫。" -#: ../../library/asyncio-sync.rst:163 +#: ../../library/asyncio-sync.rst:165 msgid "Return ``True`` if the event is set." msgstr "如果事件有被設置則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:167 +#: ../../library/asyncio-sync.rst:169 msgid "Condition" msgstr "Condition" -#: ../../library/asyncio-sync.rst:171 +#: ../../library/asyncio-sync.rst:173 msgid "A Condition object. Not thread-safe." msgstr "一個條件 (codition) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:173 +#: ../../library/asyncio-sync.rst:175 msgid "" "An asyncio condition primitive can be used by a task to wait for some event " "to happen and then get exclusive access to a shared resource." @@ -280,7 +280,7 @@ msgstr "" "一個 asyncio 條件原始物件可以被任務用來等待某事件發生,並獲得一個共享資源的獨" "佔存取權。" -#: ../../library/asyncio-sync.rst:177 +#: ../../library/asyncio-sync.rst:179 msgid "" "In essence, a Condition object combines the functionality of an :class:" "`Event` and a :class:`Lock`. It is possible to have multiple Condition " @@ -290,9 +290,9 @@ msgid "" msgstr "" "本質上,一個 Condition 物件會結合 :class:`Event` 和 :class:`Lock` 的功能。多" "個 Condition 物件共享一個 Lock 是有可能發生的,這能夠協調關注同一共享資源的不" -"同狀態以獲取其獨佔存取權的多個任務。" +"同狀態以取得其獨佔存取權的多個任務。" -#: ../../library/asyncio-sync.rst:183 +#: ../../library/asyncio-sync.rst:185 msgid "" "The optional *lock* argument must be a :class:`Lock` object or ``None``. In " "the latter case a new Lock object is created automatically." @@ -300,12 +300,12 @@ msgstr "" "可選的 *lock* 引數必須是一個 :class:`Lock` 物件或者為 ``None``。如為後者則一" "個新的 Lock 物件會被自動建立。" -#: ../../library/asyncio-sync.rst:190 +#: ../../library/asyncio-sync.rst:192 msgid "" "The preferred way to use a Condition is an :keyword:`async with` statement::" msgstr "使用 Condition 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:193 +#: ../../library/asyncio-sync.rst:195 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -314,7 +314,7 @@ msgid "" " await cond.wait()" msgstr "" -#: ../../library/asyncio-sync.rst:201 +#: ../../library/asyncio-sync.rst:203 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -326,11 +326,11 @@ msgid "" " cond.release()" msgstr "" -#: ../../library/asyncio-sync.rst:212 +#: ../../library/asyncio-sync.rst:215 msgid "Acquire the underlying lock." -msgstr "獲取底層的鎖。" +msgstr "取得底層的鎖。" -#: ../../library/asyncio-sync.rst:214 +#: ../../library/asyncio-sync.rst:217 msgid "" "This method waits until the underlying lock is *unlocked*, sets it to " "*locked* and returns ``True``." @@ -338,7 +338,7 @@ msgstr "" "此方法會持續等待直到底層的鎖為 *unlocked*,並將其設為 *locked* 並回傳 " "``True``。" -#: ../../library/asyncio-sync.rst:219 +#: ../../library/asyncio-sync.rst:222 msgid "" "Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " "*n* tasks are waiting they are all awakened." @@ -346,7 +346,7 @@ msgstr "" "喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果少於 *n* 個任務則全部被" "喚醒。" -#: ../../library/asyncio-sync.rst:222 ../../library/asyncio-sync.rst:237 +#: ../../library/asyncio-sync.rst:225 ../../library/asyncio-sync.rst:240 msgid "" "The lock must be acquired before this method is called and released shortly " "after. If called with an *unlocked* lock a :exc:`RuntimeError` error is " @@ -355,49 +355,49 @@ msgstr "" "在此方法被呼叫前必須先獲得鎖,並在之後立刻將其釋放。如果呼叫於一個 " "*unlocked* 的鎖則 :exc:`RuntimeError` 錯誤會被引發。" -#: ../../library/asyncio-sync.rst:228 +#: ../../library/asyncio-sync.rst:231 msgid "Return ``True`` if the underlying lock is acquired." -msgstr "如果已獲取底層的鎖則回傳 ``True``。" +msgstr "如果已取得底層的鎖則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:232 +#: ../../library/asyncio-sync.rst:235 msgid "Wake up all tasks waiting on this condition." msgstr "喚醒所有正在等待此條件的任務。" -#: ../../library/asyncio-sync.rst:234 +#: ../../library/asyncio-sync.rst:237 msgid "This method acts like :meth:`notify`, but wakes up all waiting tasks." msgstr "這個方法的行為就像 :meth:`notify`,但會喚醒所有正在等待的任務。" -#: ../../library/asyncio-sync.rst:243 +#: ../../library/asyncio-sync.rst:246 msgid "Release the underlying lock." msgstr "釋放底層的鎖。" -#: ../../library/asyncio-sync.rst:245 +#: ../../library/asyncio-sync.rst:248 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." -msgstr "當調用於一個未被解開的鎖之上時,會引發一個 :exc:`RuntimeError`。" +msgstr "當叫用於一個未被解開的鎖之上時,會引發一個 :exc:`RuntimeError`。" -#: ../../library/asyncio-sync.rst:250 +#: ../../library/asyncio-sync.rst:254 msgid "Wait until notified." msgstr "持續等待直到被通知 (notify)。" -#: ../../library/asyncio-sync.rst:252 +#: ../../library/asyncio-sync.rst:256 msgid "" "If the calling task has not acquired the lock when this method is called, a :" "exc:`RuntimeError` is raised." msgstr "" -"當此方法被呼叫時,如果呼叫它的任務還沒有獲取鎖的話,:exc:`RuntimeError` 會被" +"當此方法被呼叫時,如果呼叫它的任務還沒有取得鎖的話,:exc:`RuntimeError` 會被" "引發。" -#: ../../library/asyncio-sync.rst:255 +#: ../../library/asyncio-sync.rst:259 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the " "Condition re-acquires its lock and this method returns ``True``." msgstr "" "此方法會釋放底層的鎖,然後持續阻塞直到被 :meth:`notify` 或 :meth:" -"`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新獲取該鎖且此方法會回" +"`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新取得該鎖且此方法會回" "傳 ``True``。" -#: ../../library/asyncio-sync.rst:260 +#: ../../library/asyncio-sync.rst:264 msgid "" "Note that a task *may* return from this call spuriously, which is why the " "caller should always re-check the state and be prepared to :meth:`~Condition." @@ -405,11 +405,11 @@ msgid "" "wait_for` instead." msgstr "" -#: ../../library/asyncio-sync.rst:267 +#: ../../library/asyncio-sync.rst:272 msgid "Wait until a predicate becomes *true*." msgstr "持續等待直到謂語 (predicate) 成為 *true*。" -#: ../../library/asyncio-sync.rst:269 +#: ../../library/asyncio-sync.rst:274 msgid "" "The predicate must be a callable which result will be interpreted as a " "boolean value. The method will repeatedly :meth:`~Condition.wait` until the " @@ -419,15 +419,15 @@ msgstr "" "重複地 :meth:`~Condition.wait` 直到謂語求值結果為 *true*。最終的值即為回傳" "值。" -#: ../../library/asyncio-sync.rst:276 +#: ../../library/asyncio-sync.rst:281 msgid "Semaphore" msgstr "Semaphore" -#: ../../library/asyncio-sync.rst:280 +#: ../../library/asyncio-sync.rst:285 msgid "A Semaphore object. Not thread-safe." msgstr "一個旗號 (semaphore) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:282 +#: ../../library/asyncio-sync.rst:287 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`acquire` call and incremented by each :meth:`release` call. The counter can " @@ -438,7 +438,7 @@ msgstr "" "呼叫 :meth:`release` 時增加一。此計數器永遠不會少於零;當 :meth:`acquire` 發" "現它是零時,它會持續阻塞並等待某任務呼叫 :meth:`release`。" -#: ../../library/asyncio-sync.rst:288 +#: ../../library/asyncio-sync.rst:293 msgid "" "The optional *value* argument gives the initial value for the internal " "counter (``1`` by default). If the given value is less than ``0`` a :exc:" @@ -447,12 +447,12 @@ msgstr "" "可選的 *value* 引數給定了內部計數器的初始值(預設為 ``1``\\ )。如給定的值少" "於 ``0`` 則 :exc:`ValueError` 會被引發。" -#: ../../library/asyncio-sync.rst:295 +#: ../../library/asyncio-sync.rst:300 msgid "" "The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "使用 Semaphore 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:298 +#: ../../library/asyncio-sync.rst:303 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -461,7 +461,7 @@ msgid "" " # work with shared resource" msgstr "" -#: ../../library/asyncio-sync.rst:306 +#: ../../library/asyncio-sync.rst:311 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -473,11 +473,11 @@ msgid "" " sem.release()" msgstr "" -#: ../../library/asyncio-sync.rst:317 +#: ../../library/asyncio-sync.rst:323 msgid "Acquire a semaphore." -msgstr "獲取一個旗號。" +msgstr "取得一個旗號。" -#: ../../library/asyncio-sync.rst:319 +#: ../../library/asyncio-sync.rst:325 msgid "" "If the internal counter is greater than zero, decrement it by one and return " "``True`` immediately. If it is zero, wait until a :meth:`release` is called " @@ -486,19 +486,19 @@ msgstr "" "如果內部計數器大於零,將其減一並立刻回傳 ``True``。如果為零,則持續等待直到 :" "meth:`release` 被呼叫,並回傳 ``True``。" -#: ../../library/asyncio-sync.rst:325 +#: ../../library/asyncio-sync.rst:331 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "如果旗號無法立即被取得則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:329 +#: ../../library/asyncio-sync.rst:335 msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." msgstr "" -"釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待獲取旗號的任務" +"釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待取得旗號的任務" "叫醒。" -#: ../../library/asyncio-sync.rst:332 +#: ../../library/asyncio-sync.rst:338 msgid "" "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " "``release()`` calls than ``acquire()`` calls." @@ -506,15 +506,15 @@ msgstr "" "和 :class:`BoundedSemaphore` 不同,:class:`Semaphore` 允許 ``release()`` 的呼" "叫次數多於 ``acquire()``。" -#: ../../library/asyncio-sync.rst:337 +#: ../../library/asyncio-sync.rst:343 msgid "BoundedSemaphore" msgstr "BoundedSemaphore" -#: ../../library/asyncio-sync.rst:341 +#: ../../library/asyncio-sync.rst:347 msgid "A bounded semaphore object. Not thread-safe." msgstr "一個有界的旗號物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:343 +#: ../../library/asyncio-sync.rst:349 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " @@ -524,15 +524,15 @@ msgstr "" "加至大於初始 *value* 值的話,:exc:`ValueError` 會在 :meth:`~Semaphore." "release` 時被引發。" -#: ../../library/asyncio-sync.rst:352 +#: ../../library/asyncio-sync.rst:358 msgid "Barrier" msgstr "Barrier" -#: ../../library/asyncio-sync.rst:356 +#: ../../library/asyncio-sync.rst:362 msgid "A barrier object. Not thread-safe." msgstr "一個屏障 (barrier) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:358 +#: ../../library/asyncio-sync.rst:364 msgid "" "A barrier is a simple synchronization primitive that allows to block until " "*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" @@ -541,17 +541,17 @@ msgid "" "waiting tasks would unblock simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:364 +#: ../../library/asyncio-sync.rst:370 msgid "" ":keyword:`async with` can be used as an alternative to awaiting on :meth:" "`~Barrier.wait`." msgstr "" -#: ../../library/asyncio-sync.rst:367 +#: ../../library/asyncio-sync.rst:373 msgid "The barrier can be reused any number of times." msgstr "" -#: ../../library/asyncio-sync.rst:373 +#: ../../library/asyncio-sync.rst:379 msgid "" "async def example_barrier():\n" " # barrier with 3 parties\n" @@ -575,11 +575,11 @@ msgid "" "asyncio.run(example_barrier())" msgstr "" -#: ../../library/asyncio-sync.rst:394 +#: ../../library/asyncio-sync.rst:400 msgid "Result of this example is::" msgstr "" -#: ../../library/asyncio-sync.rst:396 +#: ../../library/asyncio-sync.rst:402 msgid "" "\n" "\n" @@ -591,27 +591,27 @@ msgstr "" "barrier passed\n" "" -#: ../../library/asyncio-sync.rst:405 +#: ../../library/asyncio-sync.rst:412 msgid "" "Pass the barrier. When all the tasks party to the barrier have called this " "function, they are all unblocked simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:408 +#: ../../library/asyncio-sync.rst:415 msgid "" "When a waiting or blocked task in the barrier is cancelled, this task exits " "the barrier which stays in the same state. If the state of the barrier is " "\"filling\", the number of waiting task decreases by 1." msgstr "" -#: ../../library/asyncio-sync.rst:413 +#: ../../library/asyncio-sync.rst:420 msgid "" "The return value is an integer in the range of 0 to ``parties-1``, different " "for each task. This can be used to select a task to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/asyncio-sync.rst:417 +#: ../../library/asyncio-sync.rst:424 msgid "" "...\n" "async with barrier as position:\n" @@ -620,26 +620,26 @@ msgid "" " print('End of *draining phase*')" msgstr "" -#: ../../library/asyncio-sync.rst:423 +#: ../../library/asyncio-sync.rst:430 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a task is waiting. It could raise a :exc:" "`CancelledError` if a task is cancelled." msgstr "" -#: ../../library/asyncio-sync.rst:429 +#: ../../library/asyncio-sync.rst:437 msgid "" "Return the barrier to the default, empty state. Any tasks waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/asyncio-sync.rst:432 +#: ../../library/asyncio-sync.rst:440 msgid "" "If a barrier is broken it may be better to just leave it and create a new " "one." msgstr "" -#: ../../library/asyncio-sync.rst:436 +#: ../../library/asyncio-sync.rst:445 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use " @@ -647,30 +647,30 @@ msgid "" "waiting tasks." msgstr "" -#: ../../library/asyncio-sync.rst:443 +#: ../../library/asyncio-sync.rst:452 msgid "The number of tasks required to pass the barrier." msgstr "" -#: ../../library/asyncio-sync.rst:447 +#: ../../library/asyncio-sync.rst:456 msgid "The number of tasks currently waiting in the barrier while filling." msgstr "" -#: ../../library/asyncio-sync.rst:451 +#: ../../library/asyncio-sync.rst:460 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/asyncio-sync.rst:456 +#: ../../library/asyncio-sync.rst:465 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/asyncio-sync.rst:464 +#: ../../library/asyncio-sync.rst:473 msgid "" "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" "`with` statement (``with await lock``, ``with (yield from lock)``) was " "removed. Use ``async with lock`` instead." msgstr "" "透過 ``await lock`` 或 ``yield from lock`` 和/或 :keyword:`with` 陳述式 " -"(``with await lock``, ``with (yield from lock)``) 來獲取鎖的方式已被移除。請" +"(``with await lock``, ``with (yield from lock)``) 來取得鎖的方式已被移除。請" "改用 ``async with lock``。" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 61341b2013..65aa9231e1 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-13 00:14+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -199,8 +199,8 @@ msgstr "" #: ../../library/asyncio-task.rst:110 msgid "" -"The :class:`asyncio.TaskGroup` class provides a more modern alternative to :" -"func:`create_task`. Using this API, the last example becomes::" +"The :class:`asyncio.TaskGroup` class provides a more modern alternative " +"to :func:`create_task`. Using this API, the last example becomes::" msgstr "" #: ../../library/asyncio-task.rst:114 @@ -234,8 +234,8 @@ msgstr "" #: ../../library/asyncio-task.rst:139 msgid "" -"We say that an object is an **awaitable** object if it can be used in an :" -"keyword:`await` expression. Many asyncio APIs are designed to accept " +"We say that an object is an **awaitable** object if it can be used in " +"an :keyword:`await` expression. Many asyncio APIs are designed to accept " "awaitables." msgstr "" @@ -295,8 +295,9 @@ msgstr "" #: ../../library/asyncio-task.rst:183 msgid "" -"When a coroutine is wrapped into a *Task* with functions like :func:`asyncio." -"create_task` the coroutine is automatically scheduled to run soon::" +"When a coroutine is wrapped into a *Task* with functions " +"like :func:`asyncio.create_task` the coroutine is automatically scheduled to " +"run soon::" msgstr "" #: ../../library/asyncio-task.rst:187 @@ -366,8 +367,8 @@ msgstr "" #: ../../library/asyncio-task.rst:230 msgid "" -"A good example of a low-level function that returns a Future object is :meth:" -"`loop.run_in_executor`." +"A good example of a low-level function that returns a Future object " +"is :meth:`loop.run_in_executor`." msgstr "" #: ../../library/asyncio-task.rst:235 @@ -386,21 +387,22 @@ msgstr "" #: ../../library/asyncio-task.rst:246 msgid "" -"If *name* is not ``None``, it is set as the name of the task using :meth:" -"`Task.set_name`." +"If *name* is not ``None``, it is set as the name of the task " +"using :meth:`Task.set_name`." msgstr "" #: ../../library/asyncio-task.rst:249 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The current context " -"copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" #: ../../library/asyncio-task.rst:253 msgid "" -"The task is executed in the loop returned by :func:`get_running_loop`, :exc:" -"`RuntimeError` is raised if there is no running loop in current thread." +"The task is executed in the loop returned " +"by :func:`get_running_loop`, :exc:`RuntimeError` is raised if there is no " +"running loop in current thread." msgstr "" #: ../../library/asyncio-task.rst:259 @@ -435,11 +437,11 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1188 +#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1192 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1195 +#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1199 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" @@ -449,28 +451,30 @@ msgstr "" #: ../../library/asyncio-task.rst:297 msgid "" -"Tasks can easily and safely be cancelled. When a task is cancelled, :exc:" -"`asyncio.CancelledError` will be raised in the task at the next opportunity." +"Tasks can easily and safely be cancelled. When a task is " +"cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the " +"next opportunity." msgstr "" #: ../../library/asyncio-task.rst:301 msgid "" "It is recommended that coroutines use ``try/finally`` blocks to robustly " "perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly " -"caught, it should generally be propagated when clean-up is complete. :exc:" -"`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most " -"code will not need to be aware of it." +"caught, it should generally be propagated when clean-up is " +"complete. :exc:`asyncio.CancelledError` directly " +"subclasses :exc:`BaseException` so most code will not need to be aware of it." msgstr "" #: ../../library/asyncio-task.rst:307 msgid "" -"The asyncio components that enable structured concurrency, like :class:" -"`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using " -"cancellation internally and might misbehave if a coroutine swallows :exc:" -"`asyncio.CancelledError`. Similarly, user code should not generally call :" -"meth:`uncancel `. However, in cases when suppressing :" -"exc:`asyncio.CancelledError` is truly desired, it is necessary to also call " -"``uncancel()`` to completely remove the cancellation state." +"The asyncio components that enable structured concurrency, " +"like :class:`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented " +"using cancellation internally and might misbehave if a coroutine " +"swallows :exc:`asyncio.CancelledError`. Similarly, user code should not " +"generally call :meth:`uncancel `. However, in cases " +"when suppressing :exc:`asyncio.CancelledError` is truly desired, it is " +"necessary to also call ``uncancel()`` to completely remove the cancellation " +"state." msgstr "" #: ../../library/asyncio-task.rst:319 @@ -492,19 +496,19 @@ msgstr "" #: ../../library/asyncio-task.rst:335 msgid "" -"Create a task in this task group. The signature matches that of :func:" -"`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, " -"already finished, or in the process of shutting down), we will close the " -"given ``coro``." +"Create a task in this task group. The signature matches that " +"of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet " +"entered, already finished, or in the process of shutting down), we will " +"close the given ``coro``." msgstr "" #: ../../library/asyncio-task.rst:343 msgid "Close the given coroutine if the task group is not active." msgstr "" -#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:550 -#: ../../library/asyncio-task.rst:723 ../../library/asyncio-task.rst:781 -#: ../../library/asyncio-task.rst:807 ../../library/asyncio-task.rst:847 +#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:551 +#: ../../library/asyncio-task.rst:724 ../../library/asyncio-task.rst:782 +#: ../../library/asyncio-task.rst:808 ../../library/asyncio-task.rst:849 msgid "Example::" msgstr "範例: ::" @@ -514,8 +518,8 @@ msgid "" " async with asyncio.TaskGroup() as tg:\n" " task1 = tg.create_task(some_coro(...))\n" " task2 = tg.create_task(another_coro(...))\n" -" print(f\"Both tasks have completed now: {task1.result()}, {task2." -"result()}\")" +" print(f\"Both tasks have completed now: {task1.result()}, " +"{task2.result()}\")" msgstr "" #: ../../library/asyncio-task.rst:353 @@ -532,11 +536,11 @@ msgid "" "The first time any of the tasks belonging to the group fails with an " "exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " "the group are cancelled. No further tasks can then be added to the group. At " -"this point, if the body of the ``async with`` statement is still active (i." -"e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " -"containing the ``async with`` statement is also cancelled. The resulting :" -"exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not " -"bubble out of the containing ``async with`` statement." +"this point, if the body of the ``async with`` statement is still active " +"(i.e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " +"containing the ``async with`` statement is also cancelled. The " +"resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it " +"will not bubble out of the containing ``async with`` statement." msgstr "" #: ../../library/asyncio-task.rst:370 @@ -549,23 +553,24 @@ msgstr "" #: ../../library/asyncio-task.rst:377 msgid "" -"Two base exceptions are treated specially: If any task fails with :exc:" -"`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " -"remaining tasks and waits for them, but then the initial :exc:" -"`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:" -"`ExceptionGroup` or :exc:`BaseExceptionGroup`." +"Two base exceptions are treated specially: If any task fails " +"with :exc:`KeyboardInterrupt` or :exc:`SystemExit`, the task group still " +"cancels the remaining tasks and waits for them, but then the " +"initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead " +"of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" #: ../../library/asyncio-task.rst:383 msgid "" -"If the body of the ``async with`` statement exits with an exception (so :" -"meth:`~object.__aexit__` is called with an exception set), this is treated " -"the same as if one of the tasks failed: the remaining tasks are cancelled " -"and then waited for, and non-cancellation exceptions are grouped into an " -"exception group and raised. The exception passed into :meth:`~object." -"__aexit__`, unless it is :exc:`asyncio.CancelledError`, is also included in " -"the exception group. The same special case is made for :exc:" -"`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." +"If the body of the ``async with`` statement exits with an exception " +"(so :meth:`~object.__aexit__` is called with an exception set), this is " +"treated the same as if one of the tasks failed: the remaining tasks are " +"cancelled and then waited for, and non-cancellation exceptions are grouped " +"into an exception group and raised. The exception passed " +"into :meth:`~object.__aexit__`, unless it is :exc:`asyncio.CancelledError`, " +"is also included in the exception group. The same special case is made " +"for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous " +"paragraph." msgstr "" #: ../../library/asyncio-task.rst:395 @@ -582,15 +587,16 @@ msgstr "" #: ../../library/asyncio-task.rst:403 msgid "" "In the case where a task group is cancelled externally and also must raise " -"an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio." -"Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will " -"be raised at the next :keyword:`await`, so the cancellation is not lost." +"an :exc:`ExceptionGroup`, it will call the parent " +"task's :meth:`~asyncio.Task.cancel` method. This ensures that " +"a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, " +"so the cancellation is not lost." msgstr "" #: ../../library/asyncio-task.rst:409 msgid "" -"Task groups preserve the cancellation count reported by :meth:`asyncio.Task." -"cancelling`." +"Task groups preserve the cancellation count reported " +"by :meth:`asyncio.Task.cancelling`." msgstr "" #: ../../library/asyncio-task.rst:414 @@ -658,34 +664,34 @@ msgstr "" msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:469 +#: ../../library/asyncio-task.rst:470 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:471 +#: ../../library/asyncio-task.rst:472 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:474 +#: ../../library/asyncio-task.rst:475 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:477 +#: ../../library/asyncio-task.rst:478 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:483 +#: ../../library/asyncio-task.rst:484 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:486 +#: ../../library/asyncio-task.rst:487 msgid "" "import asyncio\n" "import datetime\n" @@ -715,40 +721,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:501 ../../library/asyncio-task.rst:599 -#: ../../library/asyncio-task.rst:698 ../../library/asyncio-task.rst:872 -#: ../../library/asyncio-task.rst:926 ../../library/asyncio-task.rst:983 +#: ../../library/asyncio-task.rst:502 ../../library/asyncio-task.rst:600 +#: ../../library/asyncio-task.rst:699 ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:929 ../../library/asyncio-task.rst:986 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:504 +#: ../../library/asyncio-task.rst:505 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" -#: ../../library/asyncio-task.rst:509 +#: ../../library/asyncio-task.rst:510 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:513 +#: ../../library/asyncio-task.rst:514 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:516 +#: ../../library/asyncio-task.rst:517 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:519 +#: ../../library/asyncio-task.rst:520 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:523 +#: ../../library/asyncio-task.rst:524 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -756,19 +762,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:528 +#: ../../library/asyncio-task.rst:529 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:531 +#: ../../library/asyncio-task.rst:532 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:534 +#: ../../library/asyncio-task.rst:535 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -776,7 +782,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:541 +#: ../../library/asyncio-task.rst:542 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -786,7 +792,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:552 +#: ../../library/asyncio-task.rst:553 msgid "" "import asyncio\n" "\n" @@ -825,7 +831,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:588 +#: ../../library/asyncio-task.rst:589 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -834,44 +840,44 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:595 +#: ../../library/asyncio-task.rst:596 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:602 +#: ../../library/asyncio-task.rst:603 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:611 +#: ../../library/asyncio-task.rst:612 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:615 +#: ../../library/asyncio-task.rst:616 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:617 +#: ../../library/asyncio-task.rst:618 msgid "" -"When using this factory (via :meth:`loop.set_task_factory(asyncio." -"eager_task_factory) `), coroutines begin execution " -"synchronously during :class:`Task` construction. Tasks are only scheduled on " -"the event loop if they block. This can be a performance improvement as the " -"overhead of loop scheduling is avoided for coroutines that complete " -"synchronously." +"When using this factory " +"(via :meth:`loop.set_task_factory(asyncio.eager_task_factory) " +"`), coroutines begin execution synchronously " +"during :class:`Task` construction. Tasks are only scheduled on the event " +"loop if they block. This can be a performance improvement as the overhead of " +"loop scheduling is avoided for coroutines that complete synchronously." msgstr "" -#: ../../library/asyncio-task.rst:623 +#: ../../library/asyncio-task.rst:624 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:628 +#: ../../library/asyncio-task.rst:629 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -880,46 +886,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:639 +#: ../../library/asyncio-task.rst:640 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:643 +#: ../../library/asyncio-task.rst:644 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " -"the signature of :class:`Task.__init__ `. The callable must return a :" -"class:`asyncio.Task`-compatible object." +"the signature of :class:`Task.__init__ `. The callable must return " +"a :class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:647 +#: ../../library/asyncio-task.rst:648 msgid "" "This function returns a *callable* intended to be used as a task factory of " -"an event loop via :meth:`loop.set_task_factory(factory) `)." +"an event loop via :meth:`loop.set_task_factory(factory) " +"`)." msgstr "" -#: ../../library/asyncio-task.rst:654 +#: ../../library/asyncio-task.rst:655 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:658 +#: ../../library/asyncio-task.rst:659 msgid "" -"Protect an :ref:`awaitable object ` from being :meth:" -"`cancelled `." +"Protect an :ref:`awaitable object ` from " +"being :meth:`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:661 ../../library/asyncio-task.rst:827 +#: ../../library/asyncio-task.rst:662 ../../library/asyncio-task.rst:829 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:663 +#: ../../library/asyncio-task.rst:664 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:665 +#: ../../library/asyncio-task.rst:666 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -927,37 +933,37 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:668 +#: ../../library/asyncio-task.rst:669 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:670 +#: ../../library/asyncio-task.rst:671 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:672 +#: ../../library/asyncio-task.rst:673 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " "``something()``, the cancellation did not happen. Although its caller is " -"still cancelled, so the \"await\" expression still raises a :exc:" -"`CancelledError`." +"still cancelled, so the \"await\" expression still raises " +"a :exc:`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:678 +#: ../../library/asyncio-task.rst:679 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:681 +#: ../../library/asyncio-task.rst:682 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:685 +#: ../../library/asyncio-task.rst:686 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -971,7 +977,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:693 +#: ../../library/asyncio-task.rst:694 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -979,36 +985,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:701 +#: ../../library/asyncio-task.rst:702 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:707 +#: ../../library/asyncio-task.rst:708 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:711 +#: ../../library/asyncio-task.rst:712 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:715 +#: ../../library/asyncio-task.rst:716 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:720 +#: ../../library/asyncio-task.rst:721 msgid "" -"In either case, the context manager can be rescheduled after creation using :" -"meth:`Timeout.reschedule`." +"In either case, the context manager can be rescheduled after creation " +"using :meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:725 +#: ../../library/asyncio-task.rst:726 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -1018,26 +1024,26 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:729 +#: ../../library/asyncio-task.rst:730 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " -"manager will cancel the current task and handle the resulting :exc:`asyncio." -"CancelledError` internally, transforming it into a :exc:`TimeoutError` which " -"can be caught and handled." +"manager will cancel the current task and handle the " +"resulting :exc:`asyncio.CancelledError` internally, transforming it into " +"a :exc:`TimeoutError` which can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:736 +#: ../../library/asyncio-task.rst:737 msgid "" -"The :func:`asyncio.timeout` context manager is what transforms the :exc:" -"`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" -"`TimeoutError` can only be caught *outside* of the context manager." +"The :func:`asyncio.timeout` context manager is what transforms " +"the :exc:`asyncio.CancelledError` into a :exc:`TimeoutError`, which means " +"the :exc:`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:741 +#: ../../library/asyncio-task.rst:742 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:743 +#: ../../library/asyncio-task.rst:744 msgid "" "async def main():\n" " try:\n" @@ -1049,48 +1055,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:752 +#: ../../library/asyncio-task.rst:753 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:757 +#: ../../library/asyncio-task.rst:758 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:760 +#: ../../library/asyncio-task.rst:761 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:763 +#: ../../library/asyncio-task.rst:764 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:764 +#: ../../library/asyncio-task.rst:765 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:769 +#: ../../library/asyncio-task.rst:770 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:774 +#: ../../library/asyncio-task.rst:775 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:778 +#: ../../library/asyncio-task.rst:779 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:783 +#: ../../library/asyncio-task.rst:784 msgid "" "async def main():\n" " try:\n" @@ -1108,17 +1114,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:798 +#: ../../library/asyncio-task.rst:799 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:804 +#: ../../library/asyncio-task.rst:805 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:809 +#: ../../library/asyncio-task.rst:810 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1132,41 +1138,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:824 +#: ../../library/asyncio-task.rst:826 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:829 +#: ../../library/asyncio-task.rst:831 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:833 +#: ../../library/asyncio-task.rst:835 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:836 +#: ../../library/asyncio-task.rst:838 msgid "" -"To avoid the task :meth:`cancellation `, wrap it in :func:" -"`shield`." +"To avoid the task :meth:`cancellation `, wrap it " +"in :func:`shield`." msgstr "" -#: ../../library/asyncio-task.rst:839 +#: ../../library/asyncio-task.rst:841 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:843 +#: ../../library/asyncio-task.rst:845 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:849 +#: ../../library/asyncio-task.rst:851 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1187,116 +1193,116 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:867 +#: ../../library/asyncio-task.rst:869 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:875 +#: ../../library/asyncio-task.rst:877 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:880 +#: ../../library/asyncio-task.rst:882 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:884 +#: ../../library/asyncio-task.rst:887 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:888 +#: ../../library/asyncio-task.rst:891 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:890 +#: ../../library/asyncio-task.rst:893 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:892 +#: ../../library/asyncio-task.rst:895 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:894 +#: ../../library/asyncio-task.rst:897 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:896 +#: ../../library/asyncio-task.rst:899 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:899 +#: ../../library/asyncio-task.rst:902 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:903 +#: ../../library/asyncio-task.rst:906 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:909 +#: ../../library/asyncio-task.rst:912 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:910 +#: ../../library/asyncio-task.rst:913 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:913 +#: ../../library/asyncio-task.rst:916 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:916 +#: ../../library/asyncio-task.rst:919 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent to :const:" -"`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:921 +#: ../../library/asyncio-task.rst:924 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:923 +#: ../../library/asyncio-task.rst:926 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:929 +#: ../../library/asyncio-task.rst:932 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:932 ../../library/asyncio-task.rst:990 +#: ../../library/asyncio-task.rst:935 ../../library/asyncio-task.rst:993 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:938 +#: ../../library/asyncio-task.rst:941 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. The returned object can be iterated to obtain the results of " "the awaitables as they finish." msgstr "" -#: ../../library/asyncio-task.rst:942 +#: ../../library/asyncio-task.rst:945 msgid "" -"The object returned by ``as_completed()`` can be iterated as an :term:" -"`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " -"iteration is used, the originally-supplied awaitables are yielded if they " -"are tasks or futures. This makes it easy to correlate previously-scheduled " -"tasks with their results. Example::" +"The object returned by ``as_completed()`` can be iterated as " +"an :term:`asynchronous iterator` or a plain :term:`iterator`. When " +"asynchronous iteration is used, the originally-supplied awaitables are " +"yielded if they are tasks or futures. This makes it easy to correlate " +"previously-scheduled tasks with their results. Example::" msgstr "" -#: ../../library/asyncio-task.rst:948 +#: ../../library/asyncio-task.rst:951 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1313,20 +1319,20 @@ msgid "" " print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:962 +#: ../../library/asyncio-task.rst:965 msgid "" "During asynchronous iteration, implicitly-created tasks will be yielded for " "supplied awaitables that aren't tasks or futures." msgstr "" -#: ../../library/asyncio-task.rst:965 +#: ../../library/asyncio-task.rst:968 msgid "" "When used as a plain iterator, each iteration yields a new coroutine that " "returns the result or raises the exception of the next completed awaitable. " "This pattern is compatible with Python versions older than 3.13::" msgstr "" -#: ../../library/asyncio-task.rst:969 +#: ../../library/asyncio-task.rst:972 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1339,34 +1345,34 @@ msgid "" " reader, writer = await next_connect" msgstr "" -#: ../../library/asyncio-task.rst:979 +#: ../../library/asyncio-task.rst:982 msgid "" "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " "are done. This is raised by the ``async for`` loop during asynchronous " "iteration or by the coroutines yielded during plain iteration." msgstr "" -#: ../../library/asyncio-task.rst:986 +#: ../../library/asyncio-task.rst:989 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:993 +#: ../../library/asyncio-task.rst:996 msgid "" "The result can now be used as either an :term:`asynchronous iterator` or as " "a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" -#: ../../library/asyncio-task.rst:999 +#: ../../library/asyncio-task.rst:1002 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:1003 +#: ../../library/asyncio-task.rst:1007 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1005 +#: ../../library/asyncio-task.rst:1009 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1374,19 +1380,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1010 +#: ../../library/asyncio-task.rst:1014 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:1012 +#: ../../library/asyncio-task.rst:1016 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1016 +#: ../../library/asyncio-task.rst:1020 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1415,7 +1421,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:1042 +#: ../../library/asyncio-task.rst:1046 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1423,7 +1429,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1049 +#: ../../library/asyncio-task.rst:1053 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1431,27 +1437,27 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:1058 +#: ../../library/asyncio-task.rst:1062 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:1062 +#: ../../library/asyncio-task.rst:1066 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1064 +#: ../../library/asyncio-task.rst:1068 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:1067 +#: ../../library/asyncio-task.rst:1071 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:1070 +#: ../../library/asyncio-task.rst:1074 msgid "" "# Create a coroutine\n" "coro = asyncio.sleep(1, result=3)\n" @@ -1463,13 +1469,13 @@ msgid "" "assert future.result(timeout) == 3" msgstr "" -#: ../../library/asyncio-task.rst:1079 +#: ../../library/asyncio-task.rst:1083 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:1083 +#: ../../library/asyncio-task.rst:1087 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1482,59 +1488,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:1093 +#: ../../library/asyncio-task.rst:1097 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:1096 +#: ../../library/asyncio-task.rst:1100 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:1103 +#: ../../library/asyncio-task.rst:1107 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:1108 +#: ../../library/asyncio-task.rst:1112 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:1111 +#: ../../library/asyncio-task.rst:1115 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1119 +#: ../../library/asyncio-task.rst:1123 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1122 +#: ../../library/asyncio-task.rst:1126 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1130 +#: ../../library/asyncio-task.rst:1134 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1136 +#: ../../library/asyncio-task.rst:1140 msgid "Task Object" -msgstr "" +msgstr "Task 物件" -#: ../../library/asyncio-task.rst:1140 +#: ../../library/asyncio-task.rst:1144 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1143 +#: ../../library/asyncio-task.rst:1147 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1542,21 +1548,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1149 +#: ../../library/asyncio-task.rst:1153 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1154 +#: ../../library/asyncio-task.rst:1158 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1159 +#: ../../library/asyncio-task.rst:1163 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1564,28 +1570,28 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1164 +#: ../../library/asyncio-task.rst:1168 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " -"returns ``True`` if the wrapped coroutine did not suppress the :exc:" -"`CancelledError` exception and was actually cancelled." +"returns ``True`` if the wrapped coroutine did not suppress " +"the :exc:`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1169 +#: ../../library/asyncio-task.rst:1173 msgid "" -":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" -"meth:`Future.set_result` and :meth:`Future.set_exception`." +":class:`asyncio.Task` inherits from :class:`Future` all of its APIs " +"except :meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1173 +#: ../../library/asyncio-task.rst:1177 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. If no *context* is " -"provided, the Task copies the current context and later runs its coroutine " -"in the copied context." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. If no " +"*context* is provided, the Task copies the current context and later runs " +"its coroutine in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1178 +#: ../../library/asyncio-task.rst:1182 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1595,96 +1601,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1185 +#: ../../library/asyncio-task.rst:1189 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:1191 +#: ../../library/asyncio-task.rst:1195 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1198 +#: ../../library/asyncio-task.rst:1202 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1203 +#: ../../library/asyncio-task.rst:1207 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1205 +#: ../../library/asyncio-task.rst:1209 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1210 +#: ../../library/asyncio-task.rst:1214 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1212 +#: ../../library/asyncio-task.rst:1216 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1216 ../../library/asyncio-task.rst:1230 +#: ../../library/asyncio-task.rst:1220 ../../library/asyncio-task.rst:1234 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1219 +#: ../../library/asyncio-task.rst:1223 msgid "" -"If the Task's result isn't yet available, this method raises an :exc:" -"`InvalidStateError` exception." +"If the Task's result isn't yet available, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1224 +#: ../../library/asyncio-task.rst:1228 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1226 +#: ../../library/asyncio-task.rst:1230 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1233 +#: ../../library/asyncio-task.rst:1237 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1238 +#: ../../library/asyncio-task.rst:1242 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1240 ../../library/asyncio-task.rst:1249 +#: ../../library/asyncio-task.rst:1244 ../../library/asyncio-task.rst:1253 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1242 +#: ../../library/asyncio-task.rst:1246 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1247 +#: ../../library/asyncio-task.rst:1251 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1251 +#: ../../library/asyncio-task.rst:1255 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1256 +#: ../../library/asyncio-task.rst:1260 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1258 +#: ../../library/asyncio-task.rst:1262 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1692,15 +1698,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1264 +#: ../../library/asyncio-task.rst:1268 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1266 +#: ../../library/asyncio-task.rst:1270 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1268 +#: ../../library/asyncio-task.rst:1272 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1709,107 +1715,113 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1277 +#: ../../library/asyncio-task.rst:1281 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1279 +#: ../../library/asyncio-task.rst:1283 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1282 +#: ../../library/asyncio-task.rst:1286 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1284 +#: ../../library/asyncio-task.rst:1288 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1289 +#: ../../library/asyncio-task.rst:1293 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1293 +#: ../../library/asyncio-task.rst:1297 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1300 +#: ../../library/asyncio-task.rst:1304 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1304 +#: ../../library/asyncio-task.rst:1308 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1311 +#: ../../library/asyncio-task.rst:1315 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1313 +#: ../../library/asyncio-task.rst:1317 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1321 +#: ../../library/asyncio-task.rst:1325 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1323 +#: ../../library/asyncio-task.rst:1327 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1326 +#: ../../library/asyncio-task.rst:1330 msgid "" -"In the default Task implementation, the name will be visible in the :func:" -"`repr` output of a task object." +"In the default Task implementation, the name will be visible in " +"the :func:`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1333 +#: ../../library/asyncio-task.rst:1337 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1335 +#: ../../library/asyncio-task.rst:1339 +msgid "" +"If the Task is already *done* or *cancelled*, return ``False``, otherwise, " +"return ``True``." +msgstr "" + +#: ../../library/asyncio-task.rst:1342 msgid "" -"This arranges for a :exc:`CancelledError` exception to be thrown into the " -"wrapped coroutine on the next cycle of the event loop." +"The method arranges for a :exc:`CancelledError` exception to be thrown into " +"the wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1338 +#: ../../library/asyncio-task.rst:1345 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " -"CancelledError`` ... :keyword:`finally` block. Therefore, unlike :meth:" -"`Future.cancel`, :meth:`Task.cancel` does not guarantee that the Task will " -"be cancelled, although suppressing cancellation completely is not common and " -"is actively discouraged. Should the coroutine nevertheless decide to " -"suppress the cancellation, it needs to call :meth:`Task.uncancel` in " -"addition to catching the exception." +"CancelledError`` ... :keyword:`finally` block. Therefore, " +"unlike :meth:`Future.cancel`, :meth:`Task.cancel` does not guarantee that " +"the Task will be cancelled, although suppressing cancellation completely is " +"not common and is actively discouraged. Should the coroutine nevertheless " +"decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` " +"in addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1348 +#: ../../library/asyncio-task.rst:1355 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1351 +#: ../../library/asyncio-task.rst:1358 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1356 +#: ../../library/asyncio-task.rst:1363 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1359 +#: ../../library/asyncio-task.rst:1366 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1846,41 +1858,41 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1395 +#: ../../library/asyncio-task.rst:1402 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1397 +#: ../../library/asyncio-task.rst:1404 msgid "" -"The Task is *cancelled* when the cancellation was requested with :meth:" -"`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " -"exception thrown into it." +"The Task is *cancelled* when the cancellation was requested " +"with :meth:`cancel` and the wrapped coroutine propagated " +"the :exc:`CancelledError` exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1403 +#: ../../library/asyncio-task.rst:1410 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1405 +#: ../../library/asyncio-task.rst:1412 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1407 +#: ../../library/asyncio-task.rst:1414 msgid "" -"Note that once execution of a cancelled task completed, further calls to :" -"meth:`uncancel` are ineffective." +"Note that once execution of a cancelled task completed, further calls " +"to :meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1412 +#: ../../library/asyncio-task.rst:1419 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " -"allows for elements of structured concurrency like :ref:`taskgroups` and :" -"func:`asyncio.timeout` to continue running, isolating cancellation to the " -"respective structured block. For example::" +"allows for elements of structured concurrency like :ref:`taskgroups` " +"and :func:`asyncio.timeout` to continue running, isolating cancellation to " +"the respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1419 +#: ../../library/asyncio-task.rst:1426 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1894,42 +1906,42 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1430 +#: ../../library/asyncio-task.rst:1437 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " -"running even in case of the timeout. This is implemented with :meth:" -"`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a " -"similar fashion." +"running even in case of the timeout. This is implemented " +"with :meth:`uncancel`. :class:`TaskGroup` context managers " +"use :func:`uncancel` in a similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1436 +#: ../../library/asyncio-task.rst:1443 msgid "" -"If end-user code is, for some reason, suppressing cancellation by catching :" -"exc:`CancelledError`, it needs to call this method to remove the " +"If end-user code is, for some reason, suppressing cancellation by " +"catching :exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1440 +#: ../../library/asyncio-task.rst:1447 msgid "" "When this method decrements the cancellation count to zero, the method " -"checks if a previous :meth:`cancel` call had arranged for :exc:" -"`CancelledError` to be thrown into the task. If it hasn't been thrown yet, " -"that arrangement will be rescinded (by resetting the internal " +"checks if a previous :meth:`cancel` call had arranged " +"for :exc:`CancelledError` to be thrown into the task. If it hasn't been " +"thrown yet, that arrangement will be rescinded (by resetting the internal " "``_must_cancel`` flag)." msgstr "" -#: ../../library/asyncio-task.rst:1446 +#: ../../library/asyncio-task.rst:1453 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" -#: ../../library/asyncio-task.rst:1451 +#: ../../library/asyncio-task.rst:1458 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1455 +#: ../../library/asyncio-task.rst:1462 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1938,7 +1950,7 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1461 +#: ../../library/asyncio-task.rst:1468 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." diff --git a/library/asyncio.po b/library/asyncio.po index 3d069c4f74..dab5421359 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -122,9 +122,9 @@ msgstr "" #: ../../library/asyncio.rst:48 msgid "" "create and manage :ref:`event loops `, which provide " -"asynchronous APIs for :ref:`networking `, running :ref:" -"`subprocesses `, handling :ref:`OS signals " -"`, etc;" +"asynchronous APIs for :ref:`networking `, " +"running :ref:`subprocesses `, handling :ref:`OS " +"signals `, etc;" msgstr "" "建立與管理 :ref:`event loops(事件迴圈) `,它提供了能被" "用於\\ :ref:`網路 `、執行\\ :ref:`子行程 " @@ -161,14 +161,14 @@ msgstr "" #: ../../library/asyncio.rst:64 msgid "asyncio REPL" -msgstr "" +msgstr "asyncio REPL" #: ../../library/asyncio.rst:65 -#, fuzzy msgid "" -"You can experiment with an ``asyncio`` concurrent context in the :term:" -"`REPL`:" -msgstr "你能在 REPL 中對一個 ``asyncio`` 的並行情境 (context) 進行實驗:" +"You can experiment with an ``asyncio`` concurrent context in " +"the :term:`REPL`:" +msgstr "" +"你能在 :term:`REPL` 中對一個 ``asyncio`` 的並行情境 (context) 進行實驗:" #: ../../library/asyncio.rst:67 msgid "" diff --git a/library/bisect.po b/library/bisect.po index 6e3bcf9931..c423cc4f89 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -38,7 +38,7 @@ msgid "" "searches or frequent resorting." msgstr "" "這個模組維護一個已經排序過的 list ,當我們每次做完插入後不需要再次排序整個 " -"list 。一個很長的 list 的比較操作很花費時間,可以透過線性搜索或頻繁地詢問來改" +"list 。一個很長的 list 的比較操作很花費時間,可以透過線性搜尋或頻繁地詢問來改" "善。" #: ../../library/bisect.rst:19 @@ -135,21 +135,21 @@ msgid "" "insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " "*x* at the appropriate position to maintain sort order." msgstr "" -"此函式先使用 :py:func:`~bisect.bisect_left` 搜索插入位置,接著用 :meth:`!" +"此函式先使用 :py:func:`~bisect.bisect_left` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" #: ../../library/bisect.rst:79 ../../library/bisect.rst:99 msgid "" "To support inserting records in a table, the *key* function (if any) is " "applied to *x* for the search step but not for the insertion step." -msgstr "此函式只有在搜索時會使用 *key* 函式,插入時不會。" +msgstr "此函式只有在搜尋時會使用 *key* 函式,插入時不會。" #: ../../library/bisect.rst:82 ../../library/bisect.rst:102 msgid "" "Keep in mind that the *O*\\ (log *n*) search is dominated by the slow *O*\\ " "(*n*) insertion step." msgstr "" -"注意雖然搜索是 *O*\\ (log *n*),但插入是 *O*\\ (*n*),因此此函式整體時間複雜" +"注意雖然搜尋是 *O*\\ (log *n*),但插入是 *O*\\ (*n*),因此此函式整體時間複雜" "度是 *O*\\ (*n*)。" #: ../../library/bisect.rst:92 @@ -166,7 +166,7 @@ msgid "" "insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " "*x* at the appropriate position to maintain sort order." msgstr "" -"此函式先使用 :py:func:`~bisect.bisect_right` 搜索插入位置,接著用 :meth:`!" +"此函式先使用 :py:func:`~bisect.bisect_right` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" #: ../../library/bisect.rst:110 @@ -186,7 +186,7 @@ msgid "" "Bisection is effective for searching ranges of values. For locating specific " "values, dictionaries are more performant." msgstr "" -"二分法在一段範圍的數值中做搜索的效率較佳,但若是要存取特定數值,使用字典的表" +"二分法在一段範圍的數值中做搜尋的效率較佳,但若是要存取特定數值,使用字典的表" "現還是比較好。" #: ../../library/bisect.rst:118 @@ -207,7 +207,7 @@ msgid "" "searching an array of precomputed keys to locate the insertion point (as " "shown in the examples section below)." msgstr "" -"搜索函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜索函" +"搜尋函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜尋函" "式被使用於迴圈當中,鍵函式會不斷被重複呼叫於相同的 list 元素。如果鍵函式執行" "速度不快,請考慮將其以 :py:func:`functools.cache` 包裝起來以減少重複的計算。" "另外,也可以透過搜尋預先計算好的鍵列表 (array of precomputed keys) 來定位插入" @@ -232,8 +232,8 @@ msgid "" msgstr "" "`SortedCollection recipe `_ 使用二分法來建立一個功能完整的集合類別 (collection " -"class) 並帶有符合直覺的搜索方法 (search methods) 與支援鍵函式。鍵會預先被計算" -"好,以減少搜索過程中多餘的鍵函式呼叫。" +"class) 並帶有符合直覺的搜尋方法 (search methods) 與支援鍵函式。鍵會預先被計算" +"好,以減少搜尋過程中多餘的鍵函式呼叫。" #: ../../library/bisect.rst:143 msgid "Searching Sorted Lists" @@ -366,7 +366,7 @@ msgid "" "If the key function is expensive, it is possible to avoid repeated function " "calls by searching a list of precomputed keys to find the index of a record::" msgstr "" -"如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜索該紀錄的索引" +"如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜尋該紀錄的索引" "值,以減少重複的函式呼叫: ::" #: ../../library/bisect.rst:240 diff --git a/library/calendar.po b/library/calendar.po index 564f71a8d6..59c409fce5 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-26 00:13+0000\n" +"POT-Creation-Date: 2025-01-08 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,8 +38,8 @@ msgstr "" "這個模組讓你可以像 Unix 的 :program:`cal` 程式一樣輸出日曆,並額外提供有用的" "日曆相關函式。這些日曆預設把週一當作一週的第一天,而週日當作最後一天(歐洲的" "慣例)。可以使用 :func:`setfirstweekday` 設定一週的第一天為週日 (6) 或一週的" -"其它任一天,其中指定日期的參數是整數。相關功能參考 :mod:`datetime` 和 :mod:" -"`time` 模組。" +"其它任一天,其中指定日期的參數是整數。相關功能參考 :mod:`datetime` " +"和 :mod:`time` 模組。" #: ../../library/calendar.rst:22 msgid "" @@ -60,11 +60,11 @@ msgstr "" #: ../../library/calendar.rst:33 msgid "" "Creates a :class:`Calendar` object. *firstweekday* is an integer specifying " -"the first day of the week. :const:`MONDAY` is ``0`` (the default), :const:" -"`SUNDAY` is ``6``." +"the first day of the week. :const:`MONDAY` is ``0`` (the " +"default), :const:`SUNDAY` is ``6``." msgstr "" -"建立 :class:`Calendar` 物件。*firstweekday* 是一個指定一週第一天的整數,:" -"const:`MONDAY` 是 ``0``\\ (預設值),:const:`SUNDAY` 是 ``6``。" +"建立 :class:`Calendar` 物件。*firstweekday* 是一個指定一週第一天的整" +"數,:const:`MONDAY` 是 ``0``\\ (預設值),:const:`SUNDAY` 是 ``6``。" #: ../../library/calendar.rst:36 msgid "" @@ -76,19 +76,47 @@ msgstr "" "做任何格式化,這是子類別的工作。" #: ../../library/calendar.rst:41 -msgid ":class:`Calendar` instances have the following methods:" -msgstr ":class:`Calendar` 實例有以下方法:" +msgid ":class:`Calendar` instances have the following methods and attributes:" +msgstr ":class:`Calendar` 實例有以下方法與屬性:" #: ../../library/calendar.rst:45 +msgid "The first weekday as an integer (0--6)." +msgstr "" + +#: ../../library/calendar.rst:47 +msgid "" +"This property can also be set and read " +"using :meth:`~Calendar.setfirstweekday` " +"and :meth:`~Calendar.getfirstweekday` respectively." +msgstr "" + +#: ../../library/calendar.rst:53 +msgid "Return an :class:`int` for the current first weekday (0--6)." +msgstr "" + +#: ../../library/calendar.rst:55 +msgid "Identical to reading the :attr:`~Calendar.firstweekday` property." +msgstr "" + +#: ../../library/calendar.rst:59 +msgid "" +"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)" +msgstr "" + +#: ../../library/calendar.rst:61 +msgid "Identical to setting the :attr:`~Calendar.firstweekday` property." +msgstr "" + +#: ../../library/calendar.rst:65 msgid "" "Return an iterator for the week day numbers that will be used for one week. " -"The first value from the iterator will be the same as the value of the :attr:" -"`firstweekday` property." +"The first value from the iterator will be the same as the value of " +"the :attr:`~Calendar.firstweekday` property." msgstr "" -"回傳一個以數字代表一週的每一天的疊代器 (iterator)。疊代器的第一個值和 :attr:" -"`firstweekday` 屬性的值一樣。" +"回傳一個以數字代表一週的每一天的疊代器 (iterator)。疊代器的第一個值" +"和 :attr:`~Calendar.firstweekday` 屬性的值一樣。" -#: ../../library/calendar.rst:52 +#: ../../library/calendar.rst:72 msgid "" "Return an iterator for the month *month* (1--12) in the year *year*. This " "iterator will return all days (as :class:`datetime.date` objects) for the " @@ -98,59 +126,59 @@ msgstr "" "回傳一個在 *year* 年 *month* (1--12) 月的疊代器。這個疊代器會回傳該月的所有日" "期(:class:`datetime.date` 物件)以及在該月之前及之後用來組成完整一週的日期。" -#: ../../library/calendar.rst:60 +#: ../../library/calendar.rst:80 msgid "" -"Return an iterator for the month *month* in the year *year* similar to :meth:" -"`itermonthdates`, but not restricted by the :class:`datetime.date` range. " -"Days returned will simply be day of the month numbers. For the days outside " -"of the specified month, the day number is ``0``." +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will simply be day of the month numbers. For the days " +"outside of the specified month, the day number is ``0``." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期單純是該月當日的數字,對於該月" "之外的日期數字會是 ``0``。" -#: ../../library/calendar.rst:68 +#: ../../library/calendar.rst:88 msgid "" -"Return an iterator for the month *month* in the year *year* similar to :meth:" -"`itermonthdates`, but not restricted by the :class:`datetime.date` range. " -"Days returned will be tuples consisting of a day of the month number and a " -"week day number." +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will be tuples consisting of a day of the month number " +"and a week day number." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由該月當日的數字及代表週" "幾的數字組成的元組。" -#: ../../library/calendar.rst:76 +#: ../../library/calendar.rst:96 msgid "" -"Return an iterator for the month *month* in the year *year* similar to :meth:" -"`itermonthdates`, but not restricted by the :class:`datetime.date` range. " -"Days returned will be tuples consisting of a year, a month and a day of the " -"month numbers." +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will be tuples consisting of a year, a month and a day " +"of the month numbers." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由年、月、日的數字組成的" "元組。" -#: ../../library/calendar.rst:86 +#: ../../library/calendar.rst:106 msgid "" -"Return an iterator for the month *month* in the year *year* similar to :meth:" -"`itermonthdates`, but not restricted by the :class:`datetime.date` range. " -"Days returned will be tuples consisting of a year, a month, a day of the " -"month, and a day of the week numbers." +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will be tuples consisting of a year, a month, a day of " +"the month, and a day of the week numbers." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由年、月、日及代表週幾的" "數字組成的元組。" -#: ../../library/calendar.rst:96 +#: ../../library/calendar.rst:116 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven :class:`datetime.date` objects." msgstr "" -"回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七個 :" -"class:`datetime.date` 物件。" +"回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七" +"個 :class:`datetime.date` 物件。" -#: ../../library/calendar.rst:102 +#: ../../library/calendar.rst:122 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven tuples of day numbers and weekday numbers." @@ -158,7 +186,7 @@ msgstr "" "回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七個該" "月當日的數字及代表週幾的數字組成的元組。" -#: ../../library/calendar.rst:109 +#: ../../library/calendar.rst:129 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven day numbers." @@ -166,7 +194,7 @@ msgstr "" "回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七個該" "月當日的數字。" -#: ../../library/calendar.rst:115 +#: ../../library/calendar.rst:135 msgid "" "Return the data for the specified year ready for formatting. The return " "value is a list of month rows. Each month row contains up to *width* months " @@ -177,76 +205,113 @@ msgstr "" "*width* 個月份組成(預設為 3)。每個月份包含四到六週,每一週包含一到七天,每" "一天則是一個 :class:`datetime.date` 物件。" -#: ../../library/calendar.rst:123 +#: ../../library/calendar.rst:143 msgid "" -"Return the data for the specified year ready for formatting (similar to :" -"meth:`yeardatescalendar`). Entries in the week lists are tuples of day " +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are tuples of day " "numbers and weekday numbers. Day numbers outside this month are zero." msgstr "" "回傳用來格式化的指定年份的資料(類似 :meth:`yeardatescalendar`)。每一天是一" "個該月當日的數字及代表週幾的數字組成的元組,該月外的日期的該月當日數字為 0。" -#: ../../library/calendar.rst:130 +#: ../../library/calendar.rst:150 msgid "" -"Return the data for the specified year ready for formatting (similar to :" -"meth:`yeardatescalendar`). Entries in the week lists are day numbers. Day " -"numbers outside this month are zero." +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are day numbers. " +"Day numbers outside this month are zero." msgstr "" "回傳用來格式化的指定年份的資料(類似 :meth:`yeardatescalendar`)。每一天是一" "個該月當日的數字,該月外的日期的該月當日數字為 0。" -#: ../../library/calendar.rst:137 +#: ../../library/calendar.rst:157 msgid "This class can be used to generate plain text calendars." msgstr "這個類別用來產生純文字的日曆。" -#: ../../library/calendar.rst:139 +#: ../../library/calendar.rst:159 msgid ":class:`TextCalendar` instances have the following methods:" msgstr ":class:`TextCalendar` 實例有以下方法:" -#: ../../library/calendar.rst:143 +#: ../../library/calendar.rst:164 +msgid "" +"Return a string representing a single day formatted with the given *width*. " +"If *theday* is ``0``, return a string of spaces of the specified width, " +"representing an empty day. The *weekday* parameter is unused." +msgstr "" + +#: ../../library/calendar.rst:171 +msgid "" +"Return a single week in a string with no newline. If *w* is provided, it " +"specifies the width of the date columns, which are centered. Depends on the " +"first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." +msgstr "" + +#: ../../library/calendar.rst:178 +msgid "" +"Return a string representing the name of a single weekday formatted to the " +"specified *width*. The *weekday* parameter is an integer representing the " +"day of the week, where ``0`` is Monday and ``6`` is Sunday." +msgstr "" + +#: ../../library/calendar.rst:184 +msgid "" +"Return a string containing the header row of weekday names, formatted with " +"the given *width* for each column. The names depend on the locale settings " +"and are padded to the specified width." +msgstr "" + +#: ../../library/calendar.rst:190 msgid "" "Return a month's calendar in a multi-line string. If *w* is provided, it " "specifies the width of the date columns, which are centered. If *l* is " "given, it specifies the number of lines that each week will use. Depends on " -"the first weekday as specified in the constructor or set by the :meth:" -"`setfirstweekday` method." +"the first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." msgstr "" "以多行字串的形式回傳一個月份的日曆。如果給定 *w*,它會指定置中的日期欄的寬" "度。如果給定 *l*,它會指定每一週使用的行數。這個日曆會依據在建構函式中指定或" "者透過 :meth:`setfirstweekday` 方法設定的一週的第一天來輸出。" -#: ../../library/calendar.rst:152 +#: ../../library/calendar.rst:198 +msgid "" +"Return a string representing the month's name centered within the specified " +"*width*. If *withyear* is ``True``, include the year in the output. The " +"*theyear* and *themonth* parameters specify the year and month for the name " +"to be formatted respectively." +msgstr "" + +#: ../../library/calendar.rst:205 msgid "Print a month's calendar as returned by :meth:`formatmonth`." msgstr "印出一個月份的日曆,內容和 :meth:`formatmonth` 回傳的一樣。" -#: ../../library/calendar.rst:157 +#: ../../library/calendar.rst:210 msgid "" "Return a *m*-column calendar for an entire year as a multi-line string. " "Optional parameters *w*, *l*, and *c* are for date column width, lines per " "week, and number of spaces between month columns, respectively. Depends on " -"the first weekday as specified in the constructor or set by the :meth:" -"`setfirstweekday` method. The earliest year for which a calendar can be " -"generated is platform-dependent." +"the first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method. The earliest year for which a calendar " +"can be generated is platform-dependent." msgstr "" "以多行字串的形式回傳有 *m* 欄的一整年的日曆。可選的參數 *w*、*l* 及 *c* 分別" "是日期欄寬度、每週行數及月份欄中間的空白數。這個日曆會依據在建構函式中指定或" "者透過 :meth:`setfirstweekday` 方法設定的一週的第一天來輸出。最早可以產生日曆" "的年份會依據平台而不同。" -#: ../../library/calendar.rst:167 +#: ../../library/calendar.rst:220 msgid "" "Print the calendar for an entire year as returned by :meth:`formatyear`." msgstr "印出一整年的日曆,內容和 :meth:`formatyear` 回傳的一樣。" -#: ../../library/calendar.rst:172 +#: ../../library/calendar.rst:225 msgid "This class can be used to generate HTML calendars." msgstr "這個類別用來產生 HTML 日曆。" -#: ../../library/calendar.rst:175 +#: ../../library/calendar.rst:228 msgid ":class:`!HTMLCalendar` instances have the following methods:" msgstr ":class:`!HTMLCalendar` 實例有以下方法:" -#: ../../library/calendar.rst:179 +#: ../../library/calendar.rst:232 msgid "" "Return a month's calendar as an HTML table. If *withyear* is true the year " "will be included in the header, otherwise just the month name will be used." @@ -254,14 +319,14 @@ msgstr "" "以 HTML 表格的形式回傳一個月份的日曆。如果 *withyear* 是 true 則標題會包含年" "份,否則只會有月份名稱。" -#: ../../library/calendar.rst:186 +#: ../../library/calendar.rst:239 msgid "" "Return a year's calendar as an HTML table. *width* (defaulting to 3) " "specifies the number of months per row." msgstr "" "以 HTML 表格的形式回傳一整年的日曆。*width*\\ (預設為 3)指定一列有幾個月。" -#: ../../library/calendar.rst:192 +#: ../../library/calendar.rst:245 msgid "" "Return a year's calendar as a complete HTML page. *width* (defaulting to 3) " "specifies the number of months per row. *css* is the name for the cascading " @@ -273,7 +338,7 @@ msgstr "" "月。*css* 是要使用的 CSS (cascading style sheet) 名稱,可以給 :const:`None` " "表示不使用任何 CSS。*encoding* 指定輸出使用的編碼(預設使用系統預設編碼)。" -#: ../../library/calendar.rst:201 +#: ../../library/calendar.rst:254 msgid "" "Return a month name as an HTML table row. If *withyear* is true the year " "will be included in the row, otherwise just the month name will be used." @@ -281,28 +346,28 @@ msgstr "" "以 HTML 表列的形式回傳一個月份的名稱。如果 *withyear* 是 true 則該列會包含年" "份,否則只會有月份名稱。" -#: ../../library/calendar.rst:206 +#: ../../library/calendar.rst:259 msgid "" ":class:`!HTMLCalendar` has the following attributes you can override to " "customize the CSS classes used by the calendar:" msgstr ":class:`!HTMLCalendar` 可以覆寫以下屬性來客製日曆所使用的 CSS 類別:" -#: ../../library/calendar.rst:211 +#: ../../library/calendar.rst:264 msgid "" "A list of CSS classes used for each weekday. The default class list is::" msgstr "對應一週每一天 CSS 類別的串列。預設的串列內容為: ::" -#: ../../library/calendar.rst:213 +#: ../../library/calendar.rst:266 msgid "" "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" msgstr "" "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" -#: ../../library/calendar.rst:215 +#: ../../library/calendar.rst:268 msgid "more styles can be added for each day::" msgstr "可以針對每一天增加更多樣式: ::" -#: ../../library/calendar.rst:217 +#: ../../library/calendar.rst:270 msgid "" "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " "\"sat\", \"sun red\"]" @@ -310,15 +375,15 @@ msgstr "" "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " "\"sat\", \"sun red\"]" -#: ../../library/calendar.rst:219 +#: ../../library/calendar.rst:272 msgid "Note that the length of this list must be seven items." msgstr "注意這個串列的長度必須是七個項目。" -#: ../../library/calendar.rst:224 +#: ../../library/calendar.rst:277 msgid "The CSS class for a weekday occurring in the previous or coming month." msgstr "跟當月為同一週且屬於前一個或下一個月份的日期使用的 CSS 類別。" -#: ../../library/calendar.rst:231 +#: ../../library/calendar.rst:284 msgid "" "A list of CSS classes used for weekday names in the header row. The default " "is the same as :attr:`cssclasses`." @@ -326,7 +391,7 @@ msgstr "" "在標題列中一週每一天名稱的 CSS 類別的串列。預設內容和 :attr:`cssclasses` 相" "同。" -#: ../../library/calendar.rst:239 +#: ../../library/calendar.rst:292 msgid "" "The month's head CSS class (used by :meth:`formatmonthname`). The default " "value is ``\"month\"``." @@ -334,7 +399,7 @@ msgstr "" "月份標題的 CSS 類別(由 :meth:`formatmonthname` 所使用),預設值是 " "``\"month\"``。" -#: ../../library/calendar.rst:247 +#: ../../library/calendar.rst:300 msgid "" "The CSS class for the whole month's table (used by :meth:`formatmonth`). The " "default value is ``\"month\"``." @@ -342,22 +407,22 @@ msgstr "" "整個月份表格的 CSS 類別(由 :meth:`formatmonth` 所使用),預設值是 " "``\"month\"``。" -#: ../../library/calendar.rst:255 +#: ../../library/calendar.rst:308 msgid "" -"The CSS class for the whole year's table of tables (used by :meth:" -"`formatyear`). The default value is ``\"year\"``." +"The CSS class for the whole year's table of tables (used " +"by :meth:`formatyear`). The default value is ``\"year\"``." msgstr "" "整年表格的 CSS 類別(由 :meth:`formatyear` 所使用),預設值是 ``\"year\"``。" -#: ../../library/calendar.rst:263 +#: ../../library/calendar.rst:316 msgid "" -"The CSS class for the table head for the whole year (used by :meth:" -"`formatyear`). The default value is ``\"year\"``." +"The CSS class for the table head for the whole year (used " +"by :meth:`formatyear`). The default value is ``\"year\"``." msgstr "" "整年表格標題的 CSS 類別(由 :meth:`formatyear` 所使用),預設值是 " "``\"year\"``。" -#: ../../library/calendar.rst:269 +#: ../../library/calendar.rst:322 msgid "" "Note that although the naming for the above described class attributes is " "singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the " @@ -367,15 +432,15 @@ msgstr "" "``cssclass_noday``),你可以使用多個以空格隔開的 CSS 類別取代單一 CSS 類別," "例如: ::" -#: ../../library/calendar.rst:273 +#: ../../library/calendar.rst:326 msgid "\"text-bold text-red\"" msgstr "\"text-bold text-red\"" -#: ../../library/calendar.rst:275 +#: ../../library/calendar.rst:328 msgid "Here is an example how :class:`!HTMLCalendar` can be customized::" msgstr "以下是客製化 :class:`!HTMLCalendar` 的範例: ::" -#: ../../library/calendar.rst:277 +#: ../../library/calendar.rst:330 msgid "" "class CustomHTMLCal(calendar.HTMLCalendar):\n" " cssclasses = [style + \" text-nowrap\" for style in\n" @@ -391,7 +456,7 @@ msgstr "" " cssclass_month = \"text-center month\"\n" " cssclass_year = \"text-italic lead\"" -#: ../../library/calendar.rst:287 +#: ../../library/calendar.rst:340 msgid "" "This subclass of :class:`TextCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." @@ -399,7 +464,7 @@ msgstr "" ":class:`TextCalendar` 的子類別,可以在建構函式傳入語系名稱,它會回傳指定語系" "的月份及一週每一天的名稱。" -#: ../../library/calendar.rst:293 +#: ../../library/calendar.rst:346 msgid "" "This subclass of :class:`HTMLCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." @@ -407,7 +472,7 @@ msgstr "" ":class:`HTMLCalendar` 的子類別,可以在建構函式傳入語系名稱,它會回傳指定語系" "的月份及一週每一天的名稱。" -#: ../../library/calendar.rst:299 +#: ../../library/calendar.rst:352 msgid "" "The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods " "of these two classes temporarily change the ``LC_TIME`` locale to the given " @@ -418,22 +483,22 @@ msgstr "" "會把 ``LC_TIME`` 語系暫時改成給定的 *locale*。因為目前的語系是屬於整個行程 " "(process-wide) 的設定,它們不是執行緒安全的。" -#: ../../library/calendar.rst:305 +#: ../../library/calendar.rst:358 msgid "For simple text calendars this module provides the following functions." msgstr "這個模組提供以下函式給單純的文字日曆使用。" -#: ../../library/calendar.rst:309 +#: ../../library/calendar.rst:362 msgid "" "Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The " -"values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:" -"`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are " -"provided for convenience. For example, to set the first weekday to Sunday::" +"values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, " +"and :const:`SUNDAY` are provided for convenience. For example, to set the " +"first weekday to Sunday::" msgstr "" -"設定一週的第一天(``0`` 是週一、``6`` 是週日)。提供 :const:`MONDAY`、:const:" -"`TUESDAY`、:const:`WEDNESDAY`、:const:`THURSDAY`、:const:`FRIDAY`、:const:" -"`SATURDAY` 及 :const:`SUNDAY` 可以方便設定。例如設定一週的第一天為週日: ::" +"設定一週的第一天(``0`` 是週一、``6`` 是週日)。提" +"供 :const:`MONDAY`、:const:`TUESDAY`、:const:`WEDNESDAY`、:const:`THURSDAY`、:const:`FRIDAY`、:const:`SATURDAY` " +"及 :const:`SUNDAY` 可以方便設定。例如設定一週的第一天為週日: ::" -#: ../../library/calendar.rst:314 +#: ../../library/calendar.rst:367 msgid "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" @@ -441,27 +506,27 @@ msgstr "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" -#: ../../library/calendar.rst:320 +#: ../../library/calendar.rst:373 msgid "Returns the current setting for the weekday to start each week." msgstr "回傳目前設定的一週的第一天。" -#: ../../library/calendar.rst:325 +#: ../../library/calendar.rst:378 msgid "" "Returns :const:`True` if *year* is a leap year, otherwise :const:`False`." msgstr "如果 *year* 是閏年回傳 :const:`True`,否則回傳 :const:`False`。" -#: ../../library/calendar.rst:330 +#: ../../library/calendar.rst:383 msgid "" "Returns the number of leap years in the range from *y1* to *y2* (exclusive), " "where *y1* and *y2* are years." msgstr "" "回傳從 *y1* 到 *y2*\\ (不包含)間有幾個閏年,其中 *y1* 和 *y2* 是年份。" -#: ../../library/calendar.rst:333 +#: ../../library/calendar.rst:386 msgid "This function works for ranges spanning a century change." msgstr "這個函式也適用在跨越世紀的時間範圍。" -#: ../../library/calendar.rst:338 +#: ../../library/calendar.rst:391 msgid "" "Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), " "*month* (``1``--``12``), *day* (``1``--``31``)." @@ -469,19 +534,19 @@ msgstr "" "回傳 *year* 年 (``1970``--...) *month* 月 (``1``--``12``) *day* 日 (``1``--" "``31``) 是週幾(``0`` 是星期一)。" -#: ../../library/calendar.rst:344 +#: ../../library/calendar.rst:397 msgid "" "Return a header containing abbreviated weekday names. *n* specifies the " "width in characters for one weekday." msgstr "回傳包含一週每一天的名稱縮寫的標題。*n* 指定每一天的字元寬度。" -#: ../../library/calendar.rst:350 +#: ../../library/calendar.rst:403 msgid "" "Returns weekday of first day of the month and number of days in month, for " "the specified *year* and *month*." msgstr "回傳指定 *year* 年 *month* 月該月第一天代表週幾的數字及該月有多少天。" -#: ../../library/calendar.rst:356 +#: ../../library/calendar.rst:409 msgid "" "Returns a matrix representing a month's calendar. Each row represents a " "week; days outside of the month are represented by zeros. Each week begins " @@ -490,32 +555,32 @@ msgstr "" "回傳代表一個月份日曆的矩陣。每一列為一週;該月以外的日期以 0 表示。每一週以週" "一開始,除非有使用 :func:`setfirstweekday` 改變設定。" -#: ../../library/calendar.rst:363 +#: ../../library/calendar.rst:416 msgid "Prints a month's calendar as returned by :func:`month`." msgstr "印出一個月份的日曆,跟 :func:`month` 回傳的內容一樣。" -#: ../../library/calendar.rst:368 +#: ../../library/calendar.rst:421 msgid "" -"Returns a month's calendar in a multi-line string using the :meth:" -"`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." +"Returns a month's calendar in a multi-line string using " +"the :meth:`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." msgstr "" -"以多行字串的形式回傳一個月的日曆,使用 :class:`TextCalendar` 類別的 :meth:" -"`~TextCalendar.formatmonth`。" +"以多行字串的形式回傳一個月的日曆,使用 :class:`TextCalendar` 類別" +"的 :meth:`~TextCalendar.formatmonth`。" -#: ../../library/calendar.rst:374 +#: ../../library/calendar.rst:427 msgid "" "Prints the calendar for an entire year as returned by :func:`calendar`." msgstr "印出一整年的日曆,跟 :func:`calendar` 回傳的內容一樣。" -#: ../../library/calendar.rst:379 +#: ../../library/calendar.rst:432 msgid "" "Returns a 3-column calendar for an entire year as a multi-line string using " "the :meth:`~TextCalendar.formatyear` of the :class:`TextCalendar` class." msgstr "" -"以多行字串回傳三欄形式的一整年日曆,使用 :class:`TextCalendar` 類別的 :meth:" -"`~TextCalendar.formatyear`。" +"以多行字串回傳三欄形式的一整年日曆,使用 :class:`TextCalendar` 類別" +"的 :meth:`~TextCalendar.formatyear`。" -#: ../../library/calendar.rst:385 +#: ../../library/calendar.rst:438 msgid "" "An unrelated but handy function that takes a time tuple such as returned by " "the :func:`~time.gmtime` function in the :mod:`time` module, and returns the " @@ -523,51 +588,52 @@ msgid "" "encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each others' " "inverse." msgstr "" -"一個跟日曆無關但方便的函式,它接受一個像 :mod:`time` 模組裡的 :func:`~time." -"gmtime` 函式回傳的元組,並回傳對應的 Unix 時間戳,假設從 1970 開始及 POSIX 編" -"碼。事實上,:func:`time.gmtime` 和 :func:`timegm` 是彼此相反的。" +"一個跟日曆無關但方便的函式,它接受一個像 :mod:`time` 模組裡" +"的 :func:`~time.gmtime` 函式回傳的元組,並回傳對應的 Unix 時間戳,假設從 " +"1970 開始及 POSIX 編碼。事實上,:func:`time.gmtime` 和 :func:`timegm` 是彼此" +"相反的。" -#: ../../library/calendar.rst:392 +#: ../../library/calendar.rst:445 msgid "The :mod:`calendar` module exports the following data attributes:" msgstr ":mod:`calendar` 模組匯出以下資料屬性:" -#: ../../library/calendar.rst:396 +#: ../../library/calendar.rst:449 msgid "" "A sequence that represents the days of the week in the current locale, where " "Monday is day number 0." msgstr "以目前語系來表示的一週每一天名稱的序列,其中週一是第 0 天。" -#: ../../library/calendar.rst:406 +#: ../../library/calendar.rst:459 msgid "" "A sequence that represents the abbreviated days of the week in the current " "locale, where Mon is day number 0." msgstr "以目前語系來表示的一週每一天縮寫名稱的序列,其中 Mon 是第 0 天。" -#: ../../library/calendar.rst:421 +#: ../../library/calendar.rst:474 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "一週每一天的別名,其中 ``MONDAY`` 是 ``0`` 而 ``SUNDAY`` 是 ``6``。" -#: ../../library/calendar.rst:429 +#: ../../library/calendar.rst:482 msgid "" "Enumeration defining days of the week as integer constants. The members of " -"this enumeration are exported to the module scope as :data:`MONDAY` through :" -"data:`SUNDAY`." +"this enumeration are exported to the module scope as :data:`MONDAY` " +"through :data:`SUNDAY`." msgstr "" -"將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` 到 :" -"data:`SUNDAY` 匯出到模組作用域。" +"將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` " +"到 :data:`SUNDAY` 匯出到模組作用域。" -#: ../../library/calendar.rst:438 +#: ../../library/calendar.rst:491 msgid "" "A sequence that represents the months of the year in the current locale. " "This follows normal convention of January being month number 1, so it has a " -"length of 13 and ``month_name[0]`` is the empty string." +"length of 13 and ``month_name[0]`` is the empty string." msgstr "" "以目前語系來表示的一年每個月份名稱的序列。它按照一般慣例以數字 1 代表一月,因" "此它的長度為 13,而 ``month_name[0]`` 是空字串。" -#: ../../library/calendar.rst:449 +#: ../../library/calendar.rst:502 msgid "" "A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " @@ -576,77 +642,77 @@ msgstr "" "以目前語系來表示的一年每個月份縮寫名稱的序列。它按照一般慣例以數字 1 代表一" "月,因此它的長度為 13,而 ``month_abbr[0]`` 是空字串。" -#: ../../library/calendar.rst:470 +#: ../../library/calendar.rst:523 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" -"一年內每個月的別名,其中 ``JANUARY`` 是 ``ㄅ`` 而 ``DECEMBER`` 是 ``12``。" +"一年內每個月的別名,其中 ``JANUARY`` 是 ``1`` 而 ``DECEMBER`` 是 ``12``。" -#: ../../library/calendar.rst:478 +#: ../../library/calendar.rst:531 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " "through :data:`DECEMBER`." msgstr "" -"將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` 到 :" -"data:`DECEMBER` 匯出到模組作用域。" +"將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` " +"到 :data:`DECEMBER` 匯出到模組作用域。" -#: ../../library/calendar.rst:485 +#: ../../library/calendar.rst:538 msgid "The :mod:`calendar` module defines the following exceptions:" msgstr ":mod:`calendar` 模組定義了以下例外:" -#: ../../library/calendar.rst:489 +#: ../../library/calendar.rst:542 msgid "" "A subclass of :exc:`ValueError`, raised when the given month number is " "outside of the range 1-12 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。" -#: ../../library/calendar.rst:494 +#: ../../library/calendar.rst:547 msgid "The invalid month number." msgstr "無效的月份號。" -#: ../../library/calendar.rst:499 +#: ../../library/calendar.rst:552 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的週幾的數字超出 0-6(含)範圍時引發。" -#: ../../library/calendar.rst:504 +#: ../../library/calendar.rst:557 msgid "The invalid weekday number." msgstr "無效的週幾編號。" -#: ../../library/calendar.rst:509 +#: ../../library/calendar.rst:562 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:510 +#: ../../library/calendar.rst:563 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "日期與時間的物件導向介面,和 :mod:`time` 模組有相似的功能。" -#: ../../library/calendar.rst:513 +#: ../../library/calendar.rst:566 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:514 +#: ../../library/calendar.rst:567 msgid "Low-level time related functions." msgstr "底層的時間相關函式。" -#: ../../library/calendar.rst:520 +#: ../../library/calendar.rst:573 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/calendar.rst:524 +#: ../../library/calendar.rst:577 msgid "" "The :mod:`calendar` module can be executed as a script from the command line " "to interactively print a calendar." msgstr ":mod:`calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" -#: ../../library/calendar.rst:527 +#: ../../library/calendar.rst:580 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" @@ -656,11 +722,11 @@ msgstr "" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" " [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:534 +#: ../../library/calendar.rst:587 msgid "For example, to print a calendar for the year 2000:" msgstr "例如,要列印 2000 年的日曆:" -#: ../../library/calendar.rst:536 +#: ../../library/calendar.rst:589 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -738,40 +804,40 @@ msgstr "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" -#: ../../library/calendar.rst:577 +#: ../../library/calendar.rst:630 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/calendar.rst:584 +#: ../../library/calendar.rst:637 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/calendar.rst:589 +#: ../../library/calendar.rst:642 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "用於月份和週幾名稱的語系。預設為英語。" -#: ../../library/calendar.rst:595 +#: ../../library/calendar.rst:648 msgid "" -"The encoding to use for output. :option:`--encoding` is required if :option:" -"`--locale` is set." +"The encoding to use for output. :option:`--encoding` is required " +"if :option:`--locale` is set." msgstr "" "用於輸出的編碼。如有設定 :option:`--locale` 則必須給定 :option:`--encoding`。" -#: ../../library/calendar.rst:601 +#: ../../library/calendar.rst:654 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" -#: ../../library/calendar.rst:607 +#: ../../library/calendar.rst:660 msgid "" "The weekday to start each week. Must be a number between 0 (Monday) and 6 " "(Sunday). Defaults to 0." msgstr "一週起始的日子。必須是 0(週一)到 6(週日)之間的數字。預設為 0。" -#: ../../library/calendar.rst:615 +#: ../../library/calendar.rst:668 msgid "The year to print the calendar for. Defaults to the current year." -msgstr "印出日曆的年份。預設為當前年份。" +msgstr "印出日曆的年份。預設為目前年份。" -#: ../../library/calendar.rst:621 +#: ../../library/calendar.rst:674 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -780,11 +846,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:627 +#: ../../library/calendar.rst:680 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:631 +#: ../../library/calendar.rst:684 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -792,7 +858,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:639 +#: ../../library/calendar.rst:692 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -800,21 +866,21 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:647 +#: ../../library/calendar.rst:700 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:654 +#: ../../library/calendar.rst:707 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:658 +#: ../../library/calendar.rst:711 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:662 +#: ../../library/calendar.rst:715 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/cmath.po b/library/cmath.po index ba28b03e18..6d410bc6c9 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-07 00:15+0000\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" "Last-Translator: Enkai Huang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,9 +33,9 @@ msgid "" "result of the conversion." msgstr "" "本模組提供一些適用於複數的數學函式。本模組中的函式接受整數、浮點數或複數作為" -"引數。它們也接受任何具有 :meth:`~object.__complex__` 或 :meth:`~object." -"__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為複數或浮點數,然後" -"再將函式應用於轉換後的結果。" +"引數。它們也接受任何具有 :meth:`~object.__complex__` " +"或 :meth:`~object.__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為" +"複數或浮點數,然後再將函式應用於轉換後的結果。" #: ../../library/cmath.rst:18 msgid "" @@ -87,19 +87,283 @@ msgstr "" "1.4142135623730951j" #: ../../library/cmath.rst:42 +msgid "**Conversions to and from polar coordinates**" +msgstr "**轉換到極座標和從極座標做轉換**" + +#: ../../library/cmath.rst:44 +msgid ":func:`phase(z) `" +msgstr ":func:`phase(z) `" + +#: ../../library/cmath.rst:44 +msgid "Return the phase of *z*" +msgstr "回傳 *z* 的相位角。" + +#: ../../library/cmath.rst:45 +msgid ":func:`polar(z) `" +msgstr ":func:`polar(z) `" + +#: ../../library/cmath.rst:45 +msgid "Return the representation of *z* in polar coordinates" +msgstr "回傳 *z* 在極座標中的表達方式。" + +#: ../../library/cmath.rst:46 +msgid ":func:`rect(r, phi) `" +msgstr ":func:`rect(r, phi) `" + +#: ../../library/cmath.rst:46 +msgid "Return the complex number *z* with polar coordinates *r* and *phi*" +msgstr "透過極座標 *r* 和 *phi* 回傳複數 *z*。" + +#: ../../library/cmath.rst:48 +msgid "**Power and logarithmic functions**" +msgstr "**冪函數和對數函數**" + +#: ../../library/cmath.rst:50 +msgid ":func:`exp(z) `" +msgstr ":func:`exp(z) `" + +#: ../../library/cmath.rst:50 +msgid "Return *e* raised to the power *z*" +msgstr "回傳 *e* 的 *z* 次方。" + +#: ../../library/cmath.rst:51 +msgid ":func:`log(z[, base]) `" +msgstr ":func:`log(z[, base]) `" + +#: ../../library/cmath.rst:51 +msgid "Return the logarithm of *z* to the given *base* (*e* by default)" +msgstr "回傳 *z* 以給定 *base* 為底(預設為 *e*)的對數。" + +#: ../../library/cmath.rst:52 +msgid ":func:`log10(z) `" +msgstr ":func:`log10(z) `" + +#: ../../library/cmath.rst:52 +msgid "Return the base-10 logarithm of *z*" +msgstr "回傳 *z* 以 10 為底的對數。" + +#: ../../library/cmath.rst:53 +msgid ":func:`sqrt(z) `" +msgstr ":func:`sqrt(z) `" + +#: ../../library/cmath.rst:53 +msgid "Return the square root of *z*" +msgstr "回傳 *z* 的平方根。" + +#: ../../library/cmath.rst:55 +msgid "**Trigonometric functions**" +msgstr "**三角函數**" + +#: ../../library/cmath.rst:57 +msgid ":func:`acos(z) `" +msgstr ":func:`acos(z) `" + +#: ../../library/cmath.rst:57 +msgid "Return the arc cosine of *z*" +msgstr "回傳 *z* 的反餘弦值。" + +#: ../../library/cmath.rst:58 +msgid ":func:`asin(z) `" +msgstr ":func:`asin(z) `" + +#: ../../library/cmath.rst:58 +msgid "Return the arc sine of *z*" +msgstr "回傳 *z* 的反正弦值。" + +#: ../../library/cmath.rst:59 +msgid ":func:`atan(z) `" +msgstr ":func:`atan(z) `" + +#: ../../library/cmath.rst:59 +msgid "Return the arc tangent of *z*" +msgstr "回傳 *z* 的反正切值。" + +#: ../../library/cmath.rst:60 +msgid ":func:`cos(z) `" +msgstr ":func:`cos(z) `" + +#: ../../library/cmath.rst:60 +msgid "Return the cosine of *z*" +msgstr "回傳 *z* 的餘弦值。" + +#: ../../library/cmath.rst:61 +msgid ":func:`sin(z) `" +msgstr ":func:`sin(z) `" + +#: ../../library/cmath.rst:61 +msgid "Return the sine of *z*" +msgstr "回傳 *z* 的正弦值。" + +#: ../../library/cmath.rst:62 +msgid ":func:`tan(z) `" +msgstr ":func:`tan(z) `" + +#: ../../library/cmath.rst:62 +msgid "Return the tangent of *z*" +msgstr "回傳 *z* 的正切值。" + +#: ../../library/cmath.rst:64 +msgid "**Hyperbolic functions**" +msgstr "**雙曲函數**" + +#: ../../library/cmath.rst:66 +msgid ":func:`acosh(z) `" +msgstr ":func:`acosh(z) `" + +#: ../../library/cmath.rst:66 +msgid "Return the inverse hyperbolic cosine of *z*" +msgstr "回傳 *z* 的反雙曲餘弦值。" + +#: ../../library/cmath.rst:67 +msgid ":func:`asinh(z) `" +msgstr ":func:`asinh(z) `" + +#: ../../library/cmath.rst:67 +msgid "Return the inverse hyperbolic sine of *z*" +msgstr "回傳 *z* 的反雙曲正弦值。" + +#: ../../library/cmath.rst:68 +msgid ":func:`atanh(z) `" +msgstr ":func:`atanh(z) `" + +#: ../../library/cmath.rst:68 +msgid "Return the inverse hyperbolic tangent of *z*" +msgstr "回傳 *z* 的反雙曲正切值。" + +#: ../../library/cmath.rst:69 +msgid ":func:`cosh(z) `" +msgstr ":func:`cosh(z) `" + +#: ../../library/cmath.rst:69 +msgid "Return the hyperbolic cosine of *z*" +msgstr "回傳 *z* 的雙曲餘弦值。" + +#: ../../library/cmath.rst:70 +msgid ":func:`sinh(z) `" +msgstr ":func:`sinh(z) `" + +#: ../../library/cmath.rst:70 +msgid "Return the hyperbolic sine of *z*" +msgstr "回傳 *z* 的雙曲正弦值。" + +#: ../../library/cmath.rst:71 +msgid ":func:`tanh(z) `" +msgstr ":func:`tanh(z) `" + +#: ../../library/cmath.rst:71 +msgid "Return the hyperbolic tangent of *z*" +msgstr "回傳 *z* 的雙曲正切值。" + +#: ../../library/cmath.rst:73 +msgid "**Classification functions**" +msgstr "**分類函數**" + +#: ../../library/cmath.rst:75 +msgid ":func:`isfinite(z) `" +msgstr ":func:`isfinite(z) `" + +#: ../../library/cmath.rst:75 +msgid "Check if all components of *z* are finite" +msgstr "" + +#: ../../library/cmath.rst:76 +msgid ":func:`isinf(z) `" +msgstr ":func:`isinf(z) `" + +#: ../../library/cmath.rst:76 +msgid "Check if any component of *z* is infinite" +msgstr "" + +#: ../../library/cmath.rst:77 +msgid ":func:`isnan(z) `" +msgstr ":func:`isnan(z) `" + +#: ../../library/cmath.rst:77 +msgid "Check if any component of *z* is a NaN" +msgstr "" + +#: ../../library/cmath.rst:78 +msgid ":func:`isclose(a, b, *, rel_tol, abs_tol) `" +msgstr ":func:`isclose(a, b, *, rel_tol, abs_tol) `" + +#: ../../library/cmath.rst:78 +msgid "Check if the values *a* and *b* are close to each other" +msgstr "檢查 *a* 和 *b* 的值是否接近" + +#: ../../library/cmath.rst:80 +msgid "**Constants**" +msgstr "**常數**" + +#: ../../library/cmath.rst:82 +msgid ":data:`pi`" +msgstr ":data:`pi`" + +#: ../../library/cmath.rst:82 +msgid "*π* = 3.141592..." +msgstr "*π* = 3.141592..." + +#: ../../library/cmath.rst:83 +msgid ":data:`e`" +msgstr ":data:`e`" + +#: ../../library/cmath.rst:83 +msgid "*e* = 2.718281..." +msgstr "*e* = 2.718281..." + +#: ../../library/cmath.rst:84 +msgid ":data:`tau`" +msgstr ":data:`tau`" + +#: ../../library/cmath.rst:84 +msgid "*τ* = 2\\ *π* = 6.283185..." +msgstr "*τ* = 2\\ *π* = 6.283185..." + +#: ../../library/cmath.rst:85 +msgid ":data:`inf`" +msgstr ":data:`inf`" + +#: ../../library/cmath.rst:85 +msgid "Positive infinity" +msgstr "" + +#: ../../library/cmath.rst:86 +msgid ":data:`infj`" +msgstr ":data:`infj`" + +#: ../../library/cmath.rst:86 +msgid "Pure imaginary infinity" +msgstr "" + +#: ../../library/cmath.rst:87 +msgid ":data:`nan`" +msgstr ":data:`nan`" + +#: ../../library/cmath.rst:87 +msgid "\"Not a number\" (NaN)" +msgstr "" + +#: ../../library/cmath.rst:88 +msgid ":data:`nanj`" +msgstr ":data:`nanj`" + +#: ../../library/cmath.rst:88 +msgid "Pure imaginary NaN" +msgstr "" + +#: ../../library/cmath.rst:93 msgid "Conversions to and from polar coordinates" msgstr "轉換到極座標和從極座標做轉換" -#: ../../library/cmath.rst:44 +#: ../../library/cmath.rst:95 msgid "" "A Python complex number ``z`` is stored internally using *rectangular* or " -"*Cartesian* coordinates. It is completely determined by its *real part* ``z." -"real`` and its *imaginary part* ``z.imag``." +"*Cartesian* coordinates. It is completely determined by its *real part* " +"``z.real`` and its *imaginary part* ``z.imag``." msgstr "" "Python 複數 ``z`` 是用 *直角坐標* 或 *笛卡爾坐標* 儲存在內部的。它完全是由其 " "*實部* ``z.real`` 和 *虛部* ``z.imag`` 所決定。" -#: ../../library/cmath.rst:48 +#: ../../library/cmath.rst:99 msgid "" "*Polar coordinates* give an alternative way to represent a complex number. " "In polar coordinates, a complex number *z* is defined by the modulus *r* and " @@ -112,26 +376,26 @@ msgstr "" "*r* 和相位角 (phase) *phi* 定義。絕對值 *r* 是從 *z* 到原點的距離,而相位角 " "*phi* 是從正 x 軸到連接原點到 *z* 的線段的逆時針角度(以弧度為單位)。" -#: ../../library/cmath.rst:55 +#: ../../library/cmath.rst:106 msgid "" "The following functions can be used to convert from the native rectangular " "coordinates to polar coordinates and back." msgstr "以下的函式可用於原始直角座標與極座標之間的相互轉換。" -#: ../../library/cmath.rst:60 +#: ../../library/cmath.rst:111 msgid "" -"Return the phase of *x* (also known as the *argument* of *x*), as a float. " -"``phase(x)`` is equivalent to ``math.atan2(x.imag, x.real)``. The result " +"Return the phase of *z* (also known as the *argument* of *z*), as a float. " +"``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result " "lies in the range [-\\ *π*, *π*], and the branch cut for this operation lies " "along the negative real axis. The sign of the result is the same as the " -"sign of ``x.imag``, even when ``x.imag`` is zero::" +"sign of ``z.imag``, even when ``z.imag`` is zero::" msgstr "" -"以浮點數的形式回傳 *x* 的相位角(也稱為 *x* 的 *引數* )。 ``phase(x)`` 等價" -"於 ``math.atan2(x.imag, x.real)``。結果將位於 [-\\ *π*, *π*] 的範圍內,且此操" -"作的分枝切割將位於負實軸上。結果的符號會與 ``x.imag`` 的符號相同,即使 ``x." -"imag`` 為零: ::" +"以浮點數的形式回傳 *z* 的相位角(也稱為 *z* 的 *引數* )。``phase(z)`` 等價" +"於 ``math.atan2(z.imag, z.real)``。結果將位於 [-\\ *π*, *π*] 的範圍內,且此操" +"作的分枝切割將位於負實軸上。結果的符號會與 ``z.imag`` 的符號相同,即使 " +"``z.imag`` 為零: ::" -#: ../../library/cmath.rst:66 +#: ../../library/cmath.rst:117 msgid "" ">>> phase(complex(-1.0, 0.0))\n" "3.141592653589793\n" @@ -143,171 +407,171 @@ msgstr "" ">>> phase(complex(-1.0, -0.0))\n" "-3.141592653589793" -#: ../../library/cmath.rst:74 +#: ../../library/cmath.rst:125 msgid "" -"The modulus (absolute value) of a complex number *x* can be computed using " +"The modulus (absolute value) of a complex number *z* can be computed using " "the built-in :func:`abs` function. There is no separate :mod:`cmath` module " "function for this operation." msgstr "" -"複數 *x* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨的 :mod:" -"`cmath` 模組函式適用於此操作。" +"複數 *z* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨" +"的 :mod:`cmath` 模組函式適用於此操作。" -#: ../../library/cmath.rst:81 +#: ../../library/cmath.rst:132 msgid "" -"Return the representation of *x* in polar coordinates. Returns a pair ``(r, " -"phi)`` where *r* is the modulus of *x* and phi is the phase of *x*. " -"``polar(x)`` is equivalent to ``(abs(x), phase(x))``." +"Return the representation of *z* in polar coordinates. Returns a pair ``(r, " +"phi)`` where *r* is the modulus of *z* and *phi* is the phase of *z*. " +"``polar(z)`` is equivalent to ``(abs(z), phase(z))``." msgstr "" -"回傳 *x* 在極座標中的表達方式。回傳一組數對 ``(r, phi)``, *r* 是 *x* 的絕對" -"值, *phi* 是 *x* 的相位角。 ``polar(x)`` 相當於 ``(abs(x), phase(x))``。" +"回傳 *z* 在極座標中的表達方式。回傳一組數對 ``(r, phi)``, *r* 是 *z* 的絕對" +"值, *phi* 是 *z* 的相位角。 ``polar(z)`` 相當於 ``(abs(z), phase(z))``。" -#: ../../library/cmath.rst:89 +#: ../../library/cmath.rst:140 msgid "" -"Return the complex number *x* with polar coordinates *r* and *phi*. " +"Return the complex number *z* with polar coordinates *r* and *phi*. " "Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``." msgstr "" -"透過極座標 *r* 和 *phi* 回傳複數 *x*。相當於 ``complex(r * math.cos(phi), r " +"透過極座標 *r* 和 *phi* 回傳複數 *z*。相當於 ``complex(r * math.cos(phi), r " "* math.sin(phi))``。" -#: ../../library/cmath.rst:94 +#: ../../library/cmath.rst:145 msgid "Power and logarithmic functions" msgstr "冪函數和對數函數" -#: ../../library/cmath.rst:98 +#: ../../library/cmath.rst:149 msgid "" -"Return *e* raised to the power *x*, where *e* is the base of natural " +"Return *e* raised to the power *z*, where *e* is the base of natural " "logarithms." -msgstr "回傳 *e* 的 *x* 次方,其中 *e* 是自然對數的底數。" +msgstr "回傳 *e* 的 *z* 次方,其中 *e* 是自然對數的底數。" -#: ../../library/cmath.rst:104 +#: ../../library/cmath.rst:155 msgid "" -"Returns the logarithm of *x* to the given *base*. If the *base* is not " -"specified, returns the natural logarithm of *x*. There is one branch cut, " +"Return the logarithm of *z* to the given *base*. If the *base* is not " +"specified, returns the natural logarithm of *z*. There is one branch cut, " "from 0 along the negative real axis to -∞." msgstr "" -"回傳 *x* 給定 *base* 的對數。如果未指定 *base*,則傳回 *x* 的自然對數。存在一" +"回傳 *z* 給定 *base* 的對數。如果未指定 *base*,則傳回 *z* 的自然對數。存在一" "條分枝切割,從 0 沿負實數軸到 -∞。" -#: ../../library/cmath.rst:111 +#: ../../library/cmath.rst:162 msgid "" -"Return the base-10 logarithm of *x*. This has the same branch cut as :func:" -"`log`." -msgstr "回傳 *x* 以 10 為底的對數。它與 :func:`log` 具有相同的分枝切割。" +"Return the base-10 logarithm of *z*. This has the same branch cut " +"as :func:`log`." +msgstr "回傳 *z* 以 10 為底的對數。它與 :func:`log` 具有相同的分枝切割。" -#: ../../library/cmath.rst:117 +#: ../../library/cmath.rst:168 msgid "" -"Return the square root of *x*. This has the same branch cut as :func:`log`." -msgstr "回傳 *x* 的平方根。它與 :func:`log` 具有相同的分枝切割。" +"Return the square root of *z*. This has the same branch cut as :func:`log`." +msgstr "回傳 *z* 的平方根。它與 :func:`log` 具有相同的分枝切割。" -#: ../../library/cmath.rst:121 +#: ../../library/cmath.rst:172 msgid "Trigonometric functions" msgstr "三角函數" -#: ../../library/cmath.rst:125 +#: ../../library/cmath.rst:176 msgid "" -"Return the arc cosine of *x*. There are two branch cuts: One extends right " +"Return the arc cosine of *z*. There are two branch cuts: One extends right " "from 1 along the real axis to ∞. The other extends left from -1 along the " "real axis to -∞." msgstr "" -"回傳 *x* 的反餘弦值。存在兩條分枝切割:一條是從 1 沿著實數軸向右延伸到 ∞。另" +"回傳 *z* 的反餘弦值。存在兩條分枝切割:一條是從 1 沿著實數軸向右延伸到 ∞。另" "一條從 -1 沿實數軸向左延伸到 -∞。" -#: ../../library/cmath.rst:132 +#: ../../library/cmath.rst:183 msgid "" -"Return the arc sine of *x*. This has the same branch cuts as :func:`acos`." -msgstr "回傳 *x* 的反正弦值。它與 :func:`acos` 具有相同的分枝切割。" +"Return the arc sine of *z*. This has the same branch cuts as :func:`acos`." +msgstr "回傳 *z* 的反正弦值。它與 :func:`acos` 具有相同的分枝切割。" -#: ../../library/cmath.rst:137 +#: ../../library/cmath.rst:188 msgid "" -"Return the arc tangent of *x*. There are two branch cuts: One extends from " +"Return the arc tangent of *z*. There are two branch cuts: One extends from " "``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` " "along the imaginary axis to ``-∞j``." msgstr "" -"回傳 *x* 的反正切值。有兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 ``∞j``。" +"回傳 *z* 的反正切值。有兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 ``∞j``。" "另一條從 ``-1j`` 沿著虛軸延伸到 ``-∞j``。" -#: ../../library/cmath.rst:144 -msgid "Return the cosine of *x*." -msgstr "回傳 *x* 的餘弦值。" +#: ../../library/cmath.rst:195 +msgid "Return the cosine of *z*." +msgstr "回傳 *z* 的餘弦值。" -#: ../../library/cmath.rst:149 -msgid "Return the sine of *x*." -msgstr "回傳 *x* 的正弦值。" +#: ../../library/cmath.rst:200 +msgid "Return the sine of *z*." +msgstr "回傳 *z* 的正弦值。" -#: ../../library/cmath.rst:154 -msgid "Return the tangent of *x*." -msgstr "回傳 *x* 的正切值。" +#: ../../library/cmath.rst:205 +msgid "Return the tangent of *z*." +msgstr "回傳 *z* 的正切值。" -#: ../../library/cmath.rst:158 +#: ../../library/cmath.rst:209 msgid "Hyperbolic functions" msgstr "雙曲函數" -#: ../../library/cmath.rst:162 +#: ../../library/cmath.rst:213 msgid "" -"Return the inverse hyperbolic cosine of *x*. There is one branch cut, " +"Return the inverse hyperbolic cosine of *z*. There is one branch cut, " "extending left from 1 along the real axis to -∞." msgstr "" -"回傳 *x* 的反雙曲餘弦值。存在一條分枝切割,從 1 沿實數軸向左延伸到 -∞。" +"回傳 *z* 的反雙曲餘弦值。存在一條分枝切割,從 1 沿實數軸向左延伸到 -∞。" -#: ../../library/cmath.rst:168 +#: ../../library/cmath.rst:219 msgid "" -"Return the inverse hyperbolic sine of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic sine of *z*. There are two branch cuts: One " "extends from ``1j`` along the imaginary axis to ``∞j``. The other extends " "from ``-1j`` along the imaginary axis to ``-∞j``." msgstr "" -"回傳 *x* 的反雙曲正弦值。存在兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 " +"回傳 *z* 的反雙曲正弦值。存在兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 " "``∞j``。另一條從 ``-1j`` 沿著虛軸延伸到 ``-∞j``。" -#: ../../library/cmath.rst:175 +#: ../../library/cmath.rst:226 msgid "" -"Return the inverse hyperbolic tangent of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One " "extends from ``1`` along the real axis to ``∞``. The other extends from " "``-1`` along the real axis to ``-∞``." msgstr "" -"回傳 *x* 的反雙曲正切值。存在兩條分枝切割:一條是從 ``1`` 沿著實數軸延伸到 " +"回傳 *z* 的反雙曲正切值。存在兩條分枝切割:一條是從 ``1`` 沿著實數軸延伸到 " "``∞``。另一條從 ``-1`` 沿著實數軸延伸到 ``-∞``。" -#: ../../library/cmath.rst:182 -msgid "Return the hyperbolic cosine of *x*." -msgstr "回傳 *x* 的反雙曲餘弦值。" +#: ../../library/cmath.rst:233 +msgid "Return the hyperbolic cosine of *z*." +msgstr "回傳 *z* 的反雙曲餘弦值。" -#: ../../library/cmath.rst:187 -msgid "Return the hyperbolic sine of *x*." -msgstr "回傳 *x* 的反雙曲正弦值。" +#: ../../library/cmath.rst:238 +msgid "Return the hyperbolic sine of *z*." +msgstr "回傳 *z* 的反雙曲正弦值。" -#: ../../library/cmath.rst:192 -msgid "Return the hyperbolic tangent of *x*." -msgstr "回傳 *x* 的反雙曲正切值。" +#: ../../library/cmath.rst:243 +msgid "Return the hyperbolic tangent of *z*." +msgstr "回傳 *z* 的反雙曲正切值。" -#: ../../library/cmath.rst:196 +#: ../../library/cmath.rst:247 msgid "Classification functions" msgstr "分類函式" -#: ../../library/cmath.rst:200 +#: ../../library/cmath.rst:251 msgid "" -"Return ``True`` if both the real and imaginary parts of *x* are finite, and " +"Return ``True`` if both the real and imaginary parts of *z* are finite, and " "``False`` otherwise." -msgstr "如果 *x* 的實部和虛部都是有限的,則回傳 ``True``,否則回傳 ``False``。" +msgstr "如果 *z* 的實部和虛部都是有限的,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:208 +#: ../../library/cmath.rst:259 msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is an " +"Return ``True`` if either the real or the imaginary part of *z* is an " "infinity, and ``False`` otherwise." -msgstr "如果 *x* 的實部或虛部是無窮大,則回傳 ``True``,否則回傳 ``False``。" +msgstr "如果 *z* 的實部或虛部是無窮大,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:214 +#: ../../library/cmath.rst:265 msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is a NaN, " +"Return ``True`` if either the real or the imaginary part of *z* is a NaN, " "and ``False`` otherwise." -msgstr "如果 *x* 的實部或虛部為 NaN,則回傳 ``True``,否則回傳 ``False``。" +msgstr "如果 *z* 的實部或虛部為 NaN,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:220 +#: ../../library/cmath.rst:271 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "如果 *a* 和 *b* 的值相互接近,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:223 +#: ../../library/cmath.rst:274 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -316,7 +580,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/cmath.rst:227 +#: ../../library/cmath.rst:278 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -330,7 +594,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/cmath.rst:234 +#: ../../library/cmath.rst:285 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " @@ -339,7 +603,7 @@ msgid "" "to the call." msgstr "" -#: ../../library/cmath.rst:240 +#: ../../library/cmath.rst:291 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -350,65 +614,66 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/cmath.rst:249 +#: ../../library/cmath.rst:300 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/cmath.rst:253 +#: ../../library/cmath.rst:304 msgid "Constants" msgstr "常數" -#: ../../library/cmath.rst:257 +#: ../../library/cmath.rst:308 msgid "The mathematical constant *π*, as a float." msgstr "數學常數 *π*,作為一個浮點數。" -#: ../../library/cmath.rst:262 +#: ../../library/cmath.rst:313 msgid "The mathematical constant *e*, as a float." msgstr "數學常數 *e*,作為一個浮點數。" -#: ../../library/cmath.rst:267 +#: ../../library/cmath.rst:318 msgid "The mathematical constant *τ*, as a float." msgstr "數學常數 *τ*,作為一個浮點數。" -#: ../../library/cmath.rst:274 +#: ../../library/cmath.rst:325 msgid "Floating-point positive infinity. Equivalent to ``float('inf')``." msgstr "正無窮大的浮點數。相當於 ``float('inf')``。" -#: ../../library/cmath.rst:281 +#: ../../library/cmath.rst:332 msgid "" "Complex number with zero real part and positive infinity imaginary part. " "Equivalent to ``complex(0.0, float('inf'))``." msgstr "實部為零和虛部為正無窮的複數。相當於 ``complex(0.0, float('inf'))``。" -#: ../../library/cmath.rst:289 +#: ../../library/cmath.rst:340 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " "``float('nan')``." msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。" -#: ../../library/cmath.rst:297 +#: ../../library/cmath.rst:348 msgid "" "Complex number with zero real part and NaN imaginary part. Equivalent to " "``complex(0.0, float('nan'))``." msgstr "實部為零和虛部為 NaN 的複數。相當於 ``complex(0.0, float('nan'))``。" -#: ../../library/cmath.rst:305 +#: ../../library/cmath.rst:356 msgid "" "Note that the selection of functions is similar, but not identical, to that " "in module :mod:`math`. The reason for having two modules is that some users " "aren't interested in complex numbers, and perhaps don't even know what they " "are. They would rather have ``math.sqrt(-1)`` raise an exception than " -"return a complex number. Also note that the functions defined in :mod:" -"`cmath` always return a complex number, even if the answer can be expressed " -"as a real number (in which case the complex number has an imaginary part of " -"zero)." +"return a complex number. Also note that the functions defined " +"in :mod:`cmath` always return a complex number, even if the answer can be " +"expressed as a real number (in which case the complex number has an " +"imaginary part of zero)." msgstr "" "請注意,函式的選擇與模組 :mod:`math` 的類似,但並不完全相同。擁有兩個模組的原" -"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 ``math." -"sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定義的函式" -"始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為零)。" +"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 " +"``math.sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定" +"義的函式始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為" +"零)。" -#: ../../library/cmath.rst:313 +#: ../../library/cmath.rst:364 msgid "" "A note on branch cuts: They are curves along which the given function fails " "to be continuous. They are a necessary feature of many complex functions. " @@ -423,17 +688,17 @@ msgstr "" "所有關於複變函數的(不是太初級的)書籍以獲得啟發。對於如何正確地基於數值目的" "選擇分枝切割的相關訊息,以下內容應該是一個很好的參考:" -#: ../../library/cmath.rst:323 +#: ../../library/cmath.rst:374 msgid "" "Kahan, W: Branch cuts for complex elementary functions; or, Much ado about " "nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the " "art in numerical analysis. Clarendon Press (1987) pp165--211." msgstr "" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:354 msgid "module" msgstr "module(模組)" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:354 msgid "math" msgstr "math(數學)" diff --git a/library/cmdline.po b/library/cmdline.po index 51d4a6fe87..aea947803e 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-05-04 00:16+0000\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,8 +62,8 @@ msgid ":ref:`dis `" msgstr ":ref:`dis `" #: ../../library/cmdline.rst:16 -msgid ":mod:`doctest`" -msgstr ":mod:`doctest`" +msgid ":ref:`doctest `" +msgstr ":ref:`doctest `" #: ../../library/cmdline.rst:17 msgid ":mod:`!encodings.rot_13`" @@ -122,8 +122,8 @@ msgid ":ref:`pickletools `" msgstr ":ref:`pickletools `" #: ../../library/cmdline.rst:31 -msgid ":mod:`platform`" -msgstr ":mod:`platform`" +msgid ":ref:`platform `" +msgstr ":ref:`platform `" #: ../../library/cmdline.rst:32 msgid ":mod:`poplib`" diff --git a/library/cmdlinelibs.po b/library/cmdlinelibs.po new file mode 100644 index 0000000000..74afa150da --- /dev/null +++ b/library/cmdlinelibs.po @@ -0,0 +1,32 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/cmdlinelibs.rst:5 +msgid "Command Line Interface Libraries" +msgstr "命令列介面函式庫" + +#: ../../library/cmdlinelibs.rst:7 +msgid "" +"The modules described in this chapter assist with implementing command line " +"and terminal interfaces for applications." +msgstr "本章節所描述的模組協助實作應用程式的命令列與終端介面。" + +#: ../../library/cmdlinelibs.rst:10 +msgid "Here's an overview:" +msgstr "以下為概覽:" diff --git a/library/code.po b/library/code.po index b424c1a11c..3d680b5ea3 100644 --- a/library/code.po +++ b/library/code.po @@ -48,14 +48,13 @@ msgid "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " "familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " -"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" -"`SystemExit`, but instead return to the calling code." +"is true, ``exit()`` and ``quit()`` in the console will not " +"raise :exc:`SystemExit`, but instead return to the calling code." msgstr "" #: ../../library/code.rst:34 ../../library/code.rst:52 -#, fuzzy msgid "Added *local_exit* parameter." -msgstr "新增 *exitmsg* 參數。" +msgstr "新增 *local_exit* 參數。" #: ../../library/code.rst:39 msgid "" @@ -64,9 +63,9 @@ msgid "" "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " "use as the default namespace for the interpreter loop. If *local_exit* is " -"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" -"meth:`~InteractiveConsole.interact` method of the instance is then run with " -"*banner* and *exitmsg* passed as the banner and exit message to use, if " +"provided, it is passed to the :class:`InteractiveConsole` constructor. " +"The :meth:`~InteractiveConsole.interact` method of the instance is then run " +"with *banner* and *exitmsg* passed as the banner and exit message to use, if " "provided. The console object is discarded after use." msgstr "" @@ -114,10 +113,10 @@ msgstr "" #: ../../library/code.rst:88 msgid "" -"The input is incorrect; :func:`compile_command` raised an exception (:exc:" -"`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " -"by calling the :meth:`showsyntaxerror` method. :meth:`runsource` returns " -"``False``." +"The input is incorrect; :func:`compile_command` raised an exception " +"(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be " +"printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` " +"returns ``False``." msgstr "" #: ../../library/code.rst:93 @@ -136,15 +135,15 @@ msgstr "" #: ../../library/code.rst:100 msgid "" -"The return value can be used to decide whether to use ``sys.ps1`` or ``sys." -"ps2`` to prompt the next line." +"The return value can be used to decide whether to use ``sys.ps1`` or " +"``sys.ps2`` to prompt the next line." msgstr "" #: ../../library/code.rst:106 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " -"called to display a traceback. All exceptions are caught except :exc:" -"`SystemExit`, which is allowed to propagate." +"called to display a traceback. All exceptions are caught " +"except :exc:`SystemExit`, which is allowed to propagate." msgstr "" #: ../../library/code.rst:110 @@ -189,9 +188,9 @@ msgstr "" #: ../../library/code.rst:145 msgid "" -"The :class:`InteractiveConsole` class is a subclass of :class:" -"`InteractiveInterpreter`, and so offers all the methods of the interpreter " -"objects as well as the following additions." +"The :class:`InteractiveConsole` class is a subclass " +"of :class:`InteractiveInterpreter`, and so offers all the methods of the " +"interpreter objects as well as the following additions." msgstr "" #: ../../library/code.rst:152 @@ -239,7 +238,7 @@ msgstr "" #: ../../library/code.rst:188 msgid "" "Write a prompt and read a line. The returned line does not include the " -"trailing newline. When the user enters the EOF key sequence, :exc:" -"`EOFError` is raised. The base implementation reads from ``sys.stdin``; a " -"subclass may replace this with a different implementation." +"trailing newline. When the user enters the EOF key " +"sequence, :exc:`EOFError` is raised. The base implementation reads from " +"``sys.stdin``; a subclass may replace this with a different implementation." msgstr "" diff --git a/library/codecs.po b/library/codecs.po index 90de1fd8dd..d12006bce7 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-13 00:40+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1537,7 +1537,7 @@ msgstr "855, IBM855" #: ../../library/codecs.rst:1106 ../../library/codecs.rst:1154 #: ../../library/codecs.rst:1219 ../../library/codecs.rst:1256 -msgid "Bulgarian, Byelorussian, Macedonian, Russian, Serbian" +msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" #: ../../library/codecs.rst:1109 diff --git a/library/collections.abc.po b/library/collections.abc.po index 0012205941..e680b63eff 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,7 +45,7 @@ msgstr "" #: ../../library/collections.abc.rst:30 msgid "" -"1) A newly written class can inherit directly from one of the abstract base " +"A newly written class can inherit directly from one of the abstract base " "classes. The class must supply the required abstract methods. The " "remaining mixin methods come from inheritance and can be overridden if " "desired. Other methods may be added as needed:" @@ -72,7 +71,7 @@ msgstr "" #: ../../library/collections.abc.rst:50 msgid "" -"2) Existing classes and built-in classes can be registered as \"virtual " +"Existing classes and built-in classes can be registered as \"virtual " "subclasses\" of the ABCs. Those classes should define the full API " "including all of the abstract methods and all of the mixin methods. This " "lets users rely on :func:`issubclass` or :func:`isinstance` tests to " @@ -112,11 +111,11 @@ msgstr "" #: ../../library/collections.abc.rst:82 msgid "" -"3) Some simple interfaces are directly recognizable by the presence of the " +"Some simple interfaces are directly recognizable by the presence of the " "required methods (unless those methods have been set to :const:`None`):" msgstr "" -#: ../../library/collections.abc.rst:86 +#: ../../library/collections.abc.rst:85 msgid "" "class E:\n" " def __iter__(self): ...\n" @@ -126,7 +125,7 @@ msgstr "" " def __iter__(self): ...\n" " def __next__(self): ..." -#: ../../library/collections.abc.rst:92 +#: ../../library/collections.abc.rst:91 msgid "" ">>> issubclass(E, Iterable)\n" "True\n" @@ -138,7 +137,7 @@ msgstr "" ">>> isinstance(E(), Iterable)\n" "True" -#: ../../library/collections.abc.rst:99 +#: ../../library/collections.abc.rst:98 msgid "" "Complex interfaces do not support this last technique because an interface " "is more than just the presence of method names. Interfaces specify " @@ -148,184 +147,186 @@ msgid "" "insufficient for distinguishing a :class:`Sequence` from a :class:`Mapping`." msgstr "" -#: ../../library/collections.abc.rst:107 +#: ../../library/collections.abc.rst:106 msgid "" "These abstract classes now support ``[]``. See :ref:`types-genericalias` " "and :pep:`585`." msgstr "" -#: ../../library/collections.abc.rst:114 +#: ../../library/collections.abc.rst:113 msgid "Collections Abstract Base Classes" msgstr "" -#: ../../library/collections.abc.rst:116 +#: ../../library/collections.abc.rst:115 msgid "" "The collections module offers the following :term:`ABCs `:" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "ABC" msgstr "ABC" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Inherits from" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Abstract Methods" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Mixin Methods" msgstr "" -#: ../../library/collections.abc.rst:123 +#: ../../library/collections.abc.rst:122 msgid ":class:`Container` [1]_" msgstr ":class:`Container` [1]_" -#: ../../library/collections.abc.rst:123 +#: ../../library/collections.abc.rst:122 msgid "``__contains__``" msgstr "``__contains__``" -#: ../../library/collections.abc.rst:124 +#: ../../library/collections.abc.rst:123 msgid ":class:`Hashable` [1]_" msgstr ":class:`Hashable` [1]_" -#: ../../library/collections.abc.rst:124 +#: ../../library/collections.abc.rst:123 msgid "``__hash__``" msgstr "``__hash__``" -#: ../../library/collections.abc.rst:125 +#: ../../library/collections.abc.rst:124 msgid ":class:`Iterable` [1]_ [2]_" msgstr ":class:`Iterable` [1]_ [2]_" -#: ../../library/collections.abc.rst:125 ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:124 ../../library/collections.abc.rst:125 msgid "``__iter__``" msgstr "``__iter__``" -#: ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:125 msgid ":class:`Iterator` [1]_" msgstr ":class:`Iterator` [1]_" -#: ../../library/collections.abc.rst:126 ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:125 ../../library/collections.abc.rst:126 msgid ":class:`Iterable`" msgstr ":class:`Iterable`" -#: ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:125 msgid "``__next__``" msgstr "``__next__``" -#: ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:126 msgid ":class:`Reversible` [1]_" msgstr ":class:`Reversible` [1]_" -#: ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:126 msgid "``__reversed__``" msgstr "``__reversed__``" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid ":class:`Generator` [1]_" msgstr ":class:`Generator` [1]_" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid ":class:`Iterator`" msgstr ":class:`Iterator`" -#: ../../library/collections.abc.rst:128 ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:176 msgid "``send``, ``throw``" msgstr "``send``、``throw``" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid "``close``, ``__iter__``, ``__next__``" msgstr "``close``、``__iter__``、``__next__``" -#: ../../library/collections.abc.rst:129 +#: ../../library/collections.abc.rst:128 msgid ":class:`Sized` [1]_" msgstr ":class:`Sized` [1]_" -#: ../../library/collections.abc.rst:129 ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:128 msgid "``__len__``" msgstr "``__len__``" -#: ../../library/collections.abc.rst:130 +#: ../../library/collections.abc.rst:129 msgid ":class:`Callable` [1]_" msgstr ":class:`Callable` [1]_" -#: ../../library/collections.abc.rst:130 +#: ../../library/collections.abc.rst:129 msgid "``__call__``" msgstr "``__call__``" -#: ../../library/collections.abc.rst:131 +#: ../../library/collections.abc.rst:130 msgid ":class:`Collection` [1]_" msgstr ":class:`Collection` [1]_" -#: ../../library/collections.abc.rst:131 +#: ../../library/collections.abc.rst:130 msgid ":class:`Sized`, :class:`Iterable`, :class:`Container`" msgstr ":class:`Sized`、:class:`Iterable`、:class:`Container`" -#: ../../library/collections.abc.rst:131 ../../library/collections.abc.rst:147 +#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:146 msgid "``__contains__``, ``__iter__``, ``__len__``" msgstr "``__contains__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:135 ../../library/collections.abc.rst:138 -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:137 +#: ../../library/collections.abc.rst:143 msgid ":class:`Sequence`" msgstr ":class:`Sequence`" -#: ../../library/collections.abc.rst:135 +#: ../../library/collections.abc.rst:134 msgid ":class:`Reversible`, :class:`Collection`" msgstr ":class:`Reversible`, :class:`Collection`" -#: ../../library/collections.abc.rst:135 ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:143 msgid "``__getitem__``, ``__len__``" msgstr "``__getitem__``、``__len__``" -#: ../../library/collections.abc.rst:135 +#: ../../library/collections.abc.rst:134 msgid "" "``__contains__``, ``__iter__``, ``__reversed__``, ``index``, and ``count``" msgstr "" "``__contains__``、``__iter__``、``__reversed__``、``index`` 和 ``count``" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid ":class:`MutableSequence`" msgstr ":class:`MutableSequence`" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__len__``, ``insert``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__len__``、``insert``" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid "" "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:143 msgid ":class:`ByteString`" msgstr ":class:`ByteString`" -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:143 msgid "Inherited :class:`Sequence` methods" msgstr "" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:151 msgid ":class:`Set`" msgstr ":class:`Set`" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:157 +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:157 msgid ":class:`Collection`" msgstr ":class:`Collection`" -#: ../../library/collections.abc.rst:147 +#: ../../library/collections.abc.rst:146 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " -"``__and__``, ``__or__``, ``__sub__``, ``__xor__``, and ``isdisjoint``" +"``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " +"``__rxor__`` and ``isdisjoint``" msgstr "" "``__le__``、``__lt__``、``__eq__``、``__ne__``、``__gt__``、``__ge__``、" -"``__and__``、``__or__``、``__sub__``、``__xor__`` 與 ``isdisjoint``" +"``__and__``、``__or__``、``__sub__``、``__rsub__``、``__xor__``、" +"``__rxor__`` 和 ``isdisjoint``" #: ../../library/collections.abc.rst:151 msgid ":class:`MutableSet`" @@ -381,6 +382,10 @@ msgstr ":class:`MappingView`" msgid ":class:`Sized`" msgstr ":class:`Sized`" +#: ../../library/collections.abc.rst:168 +msgid "``__init__``, ``__len__`` and ``__repr__``" +msgstr "``__init__``、``__len__`` 和 ``__repr__``" + #: ../../library/collections.abc.rst:169 msgid ":class:`ItemsView`" msgstr ":class:`ItemsView`" @@ -472,7 +477,7 @@ msgstr "``__buffer__``" #: ../../library/collections.abc.rst:185 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/collections.abc.rst:186 msgid "" diff --git a/library/collections.po b/library/collections.po index b2cd7486d9..28aa3f51f9 100644 --- a/library/collections.po +++ b/library/collections.po @@ -1,16 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # 周 忠毅 , 2016 # Adrian Liaw , 2018 -# Matt Wang , 2022 +# Matt Wang , 2022-2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,12 +32,12 @@ msgstr "**原始碼:**\\ :source:`Lib/collections/__init__.py`" #: ../../library/collections.rst:20 msgid "" "This module implements specialized container datatypes providing " -"alternatives to Python's general purpose built-in containers, :class:" -"`dict`, :class:`list`, :class:`set`, and :class:`tuple`." +"alternatives to Python's general purpose built-in " +"containers, :class:`dict`, :class:`list`, :class:`set`, and :class:`tuple`." msgstr "" -"這個模組實作了一些特別的容器資料型態,用來替代 Python 一般內建的容器,例如 :" -"class:`dict`\\ (字典)、:class:`list`\\ (串列)、:class:`set`\\ (集合)" -"和 :class:`tuple`\\ (元組)。" +"這個模組實作了一些特別的容器資料型態,用來替代 Python 一般內建的容器,例" +"如 :class:`dict`\\ (字典)、:class:`list`\\ (串列)、:class:`set`\\ (集" +"合)和 :class:`tuple`\\ (元組)。" #: ../../library/collections.rst:25 msgid ":func:`namedtuple`" @@ -125,8 +124,8 @@ msgid "" "calls." msgstr "" ":class:`ChainMap`\\ (對映鏈結)類別的目的是快速將數個對映連結在一起,讓它們" -"可以被當作一個單元來處理。它通常會比建立一個新的字典並多次呼叫 :meth:`~dict." -"update` 來得更快。" +"可以被當作一個單元來處理。它通常會比建立一個新的字典並多次呼" +"叫 :meth:`~dict.update` 來得更快。" #: ../../library/collections.rst:46 msgid "" @@ -189,8 +188,8 @@ msgid "" "which mappings are searched. The list should always contain at least one " "mapping." msgstr "" -"一個可被更新的對映列表,這個列表是按照被搜索的順序來排列,在 ChainMap 中它是" -"唯一被儲存的狀態,可被修改來變換搜索順序。回傳的列表都至少包含一個對映。" +"一個可被更新的對映列表,這個列表是按照被搜尋的順序來排列,在 ChainMap 中它是" +"唯一被儲存的狀態,可被修改來變換搜尋順序。回傳的列表都至少包含一個對映。" #: ../../library/collections.rst:77 msgid "" @@ -202,10 +201,10 @@ msgid "" "or new empty dict. This method is used for creating subcontexts that can be " "updated without altering values in any of the parent mappings." msgstr "" -"回傳包含一個新對映的 :class:`ChainMap`, 新對映後面接著當前實例的所有現存對" +"回傳包含一個新對映的 :class:`ChainMap`, 新對映後面接著目前實例的所有現存對" "映。如果有給定 ``m``,``m`` 會成為那個最前面的新對映;若沒有指定,則會加上一" -"個空 dict,如此一來呼叫 ``d.new_child()`` 就等同於 ``ChainMap({}, *d." -"maps)``。這個方法用於建立子上下文,而保持父對映的不變。" +"個空 dict,如此一來呼叫 ``d.new_child()`` 就等同於 ``ChainMap({}, " +"*d.maps)``。這個方法用於建立子上下文,而保持父對映的不變。" #: ../../library/collections.rst:86 msgid "The optional ``m`` parameter was added." @@ -219,13 +218,14 @@ msgstr "增加了對關鍵字引數的支援。" msgid "" "Property returning a new :class:`ChainMap` containing all of the maps in the " "current instance except the first one. This is useful for skipping the " -"first map in the search. Use cases are similar to those for the :keyword:" -"`nonlocal` keyword used in :term:`nested scopes `. The use " -"cases also parallel those for the built-in :func:`super` function. A " -"reference to ``d.parents`` is equivalent to: ``ChainMap(*d.maps[1:])``." +"first map in the search. Use cases are similar to those for " +"the :keyword:`nonlocal` keyword used in :term:`nested scopes `. The use cases also parallel those for the built-in :func:`super` " +"function. A reference to ``d.parents`` is equivalent to: " +"``ChainMap(*d.maps[1:])``." msgstr "" "回傳一個包含除了第一個以外所有其他對映的新 :class:`ChainMap` 的特性,可用於需" -"要跳過第一個對映的搜索。使用情境類似於在\\ :term:`巢狀作用域 `\\ 當中使用 :keyword:`nonlocal` 關鍵字,也可與內建函式 :func:`super` " "做類比。引用 ``d.parents`` 等同於 ``ChainMap(*d.maps[1:])``。" @@ -284,14 +284,14 @@ msgstr "" msgid "" "Django's `Context class `_ for templating is a read-only chain of mappings. It " -"also features pushing and popping of contexts similar to the :meth:" -"`~collections.ChainMap.new_child` method and the :attr:`~collections." -"ChainMap.parents` property." +"also features pushing and popping of contexts similar to " +"the :meth:`~collections.ChainMap.new_child` method and " +"the :attr:`~collections.ChainMap.parents` property." msgstr "" "Django 中用於模板的 `Context class `_ 是唯讀的對映鏈,也具有加入 (push) 和移除 " -"(pop) 上下文的功能,與 :meth:`~collections.ChainMap.new_child` 方法和 :attr:" -"`~collections.ChainMap.parents` 特性類似。" +"(pop) 上下文的功能,與 :meth:`~collections.ChainMap.new_child` 方法" +"和 :attr:`~collections.ChainMap.parents` 特性類似。" #: ../../library/collections.rst:136 msgid "" @@ -306,11 +306,11 @@ msgstr "" #: ../../library/collections.rst:141 msgid "" -"A `greatly simplified read-only version of Chainmap `_." +"A `greatly simplified read-only version of Chainmap `_." msgstr "" -"一個\\ `極度簡化、維讀版本的 Chainmap `_。" +"一個\\ `極度簡化、維讀版本的 Chainmap `_。" #: ../../library/collections.rst:146 msgid ":class:`ChainMap` Examples and Recipes" @@ -693,13 +693,13 @@ msgstr "使用 :meth:`~Counter.most_common` 方法的唯一條件是其值要是 msgid "" "For in-place operations such as ``c[key] += 1``, the value type need only " "support addition and subtraction. So fractions, floats, and decimals would " -"work and negative values are supported. The same is also true for :meth:" -"`~Counter.update` and :meth:`~Counter.subtract` which allow negative and " -"zero values for both inputs and outputs." +"work and negative values are supported. The same is also true " +"for :meth:`~Counter.update` and :meth:`~Counter.subtract` which allow " +"negative and zero values for both inputs and outputs." msgstr "" "像是 ``c[key] += 1`` 的原地操作中,其值之型別只必須支援加減,所以分數、浮點" -"數、十進位數與其負值都可以使用。同理,:meth:`~Counter.update` 和 :meth:" -"`~Counter.subtract` 也都允許 0 或負值為輸入或輸出。" +"數、十進位數與其負值都可以使用。同理,:meth:`~Counter.update` " +"和 :meth:`~Counter.subtract` 也都允許 0 或負值為輸入或輸出。" #: ../../library/collections.rst:422 msgid "" @@ -719,8 +719,8 @@ msgstr ":meth:`~Counter.elements` 方法需要其計數為正值,如為 0 或 #: ../../library/collections.rst:432 msgid "" -"`Bag class `_ in Smalltalk." +"`Bag class `_ in Smalltalk." msgstr "" "Smalltalk 中的 `Bag class `_。" @@ -753,8 +753,8 @@ msgid "" "To enumerate all distinct multisets of a given size over a given set of " "elements, see :func:`itertools.combinations_with_replacement`::" msgstr "" -"若要根據給定的元素集合來列舉出所有不重複且擁有指定元素數量的 multiset,請見 :" -"func:`itertools.combinations_with_replacement`: ::" +"若要根據給定的元素集合來列舉出所有不重複且擁有指定元素數量的 multiset,請" +"見 :func:`itertools.combinations_with_replacement`: ::" #: ../../library/collections.rst:447 msgid "" @@ -772,9 +772,9 @@ msgid "" "with data from *iterable*. If *iterable* is not specified, the new deque is " "empty." msgstr "" -"回傳一個新的 deque(雙端佇列)物件,將 *iterable* 中的資料由左至右(使用 :" -"meth:`append`\\ )加入來做初始化。如果 *iterable* 並未給定,回傳的則是一個空" -"的 deque。" +"回傳一個新的 deque(雙端佇列)物件,將 *iterable* 中的資料由左至右(使" +"用 :meth:`append`\\ )加入來做初始化。如果 *iterable* 並未給定,回傳的則是一" +"個空的 deque。" #: ../../library/collections.rst:458 msgid "" @@ -868,32 +868,32 @@ msgstr "在 deque 位置 *i* 中插入 *x*。" #: ../../library/collections.rst:535 msgid "" -"If the insertion would cause a bounded deque to grow beyond *maxlen*, an :" -"exc:`IndexError` is raised." +"If the insertion would cause a bounded deque to grow beyond *maxlen*, " +"an :exc:`IndexError` is raised." msgstr "" -"如果此插入操作導致 deque 超過其長度上限 *maxlen* 的話,會引發 :exc:" -"`IndexError` 例外。" +"如果此插入操作導致 deque 超過其長度上限 *maxlen* 的話,會引" +"發 :exc:`IndexError` 例外。" #: ../../library/collections.rst:543 msgid "" "Remove and return an element from the right side of the deque. If no " "elements are present, raises an :exc:`IndexError`." msgstr "" -"移除並回傳 deque 的最右側元素,若本來就沒有任何元素,則會引發 :exc:" -"`IndexError`。" +"移除並回傳 deque 的最右側元素,若本來就沒有任何元素,則會引" +"發 :exc:`IndexError`。" #: ../../library/collections.rst:549 msgid "" "Remove and return an element from the left side of the deque. If no elements " "are present, raises an :exc:`IndexError`." msgstr "" -"移除並回傳 deque 的最左側元素,若本來就沒有任何元素,則會引發 :exc:" -"`IndexError`。" +"移除並回傳 deque 的最左側元素,若本來就沒有任何元素,則會引" +"發 :exc:`IndexError`。" #: ../../library/collections.rst:555 msgid "" -"Remove the first occurrence of *value*. If not found, raises a :exc:" -"`ValueError`." +"Remove the first occurrence of *value*. If not found, raises " +"a :exc:`ValueError`." msgstr "移除第一個出現的 *value*,如果沒找到的話就引發一個 :exc:`ValueError`。" #: ../../library/collections.rst:561 @@ -1052,17 +1052,17 @@ msgstr "" #: ../../library/collections.rst:678 msgid "" "A `round-robin scheduler `_ can be implemented with input iterators stored in a :" -"class:`deque`. Values are yielded from the active iterator in position " -"zero. If that iterator is exhausted, it can be removed with :meth:`~deque." -"popleft`; otherwise, it can be cycled back to the end with the :meth:`~deque." -"rotate` method::" +"robin_scheduling>`_ can be implemented with input iterators stored in " +"a :class:`deque`. Values are yielded from the active iterator in position " +"zero. If that iterator is exhausted, it can be removed " +"with :meth:`~deque.popleft`; otherwise, it can be cycled back to the end " +"with the :meth:`~deque.rotate` method::" msgstr "" "一個\\ `輪詢調度器 `_\\ 可以透過在 :class:`deque` 中放入 iterator 來實現,值自" -"當前 iterator 的位置 0 取出,如果 iterator 已經消耗完畢就用 :meth:`~deque." -"popleft` 將其從佇列中移除,否則利用 :meth:`~deque.rotate` 來將其移至佇列尾" -"端: ::" +"目前 iterator 的位置 0 取出,如果 iterator 已經消耗完畢就" +"用 :meth:`~deque.popleft` 將其從佇列中移除,否則利用 :meth:`~deque.rotate` 來" +"將其移至佇列尾端: ::" #: ../../library/collections.rst:685 msgid "" @@ -1103,18 +1103,19 @@ msgstr "" #: ../../library/collections.rst:706 msgid "" -"To implement :class:`deque` slicing, use a similar approach applying :meth:" -"`~deque.rotate` to bring a target element to the left side of the deque. " -"Remove old entries with :meth:`~deque.popleft`, add new entries with :meth:" -"`~deque.extend`, and then reverse the rotation. With minor variations on " -"that approach, it is easy to implement Forth style stack manipulations such " -"as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, ``rot``, and ``roll``." +"To implement :class:`deque` slicing, use a similar approach " +"applying :meth:`~deque.rotate` to bring a target element to the left side of " +"the deque. Remove old entries with :meth:`~deque.popleft`, add new entries " +"with :meth:`~deque.extend`, and then reverse the rotation. With minor " +"variations on that approach, it is easy to implement Forth style stack " +"manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, " +"``rot``, and ``roll``." msgstr "" "要實現 :class:`deque` 切片,可使用近似以下方法:使用 :meth:`~deque.rotate` 來" -"將目標元素移動到 deque 最左側,用 :meth:`~deque.popleft` 移除舊元素並用 :" -"meth:`~deque.extend` 加入新元素,最後再反向 rotate。在這個方法上做小小的更動" -"就能簡單地實現 Forth 風格的 stack 操作,例如 ``dup``、``drop``、``swap``、" -"``over``、``pick``、``rot`` 和 ``roll``。" +"將目標元素移動到 deque 最左側,用 :meth:`~deque.popleft` 移除舊元素並" +"用 :meth:`~deque.extend` 加入新元素,最後再反向 rotate。在這個方法上做小小的" +"更動就能簡單地實現 Forth 風格的 stack 操作,例如 ``dup``、``drop``、" +"``swap``、``over``、``pick``、``rot`` 和 ``roll``。" #: ../../library/collections.rst:716 msgid ":class:`defaultdict` objects" @@ -1128,15 +1129,15 @@ msgid "" "the :class:`dict` class and is not documented here." msgstr "" "回傳一個新的類似字典的物件。:class:`defaultdict` 是內建類別 :class:`dict` 的" -"子類別。它覆蓋掉了一個方法並添加了一個可寫入的實例變數。其餘功能與 :class:" -"`dict` 相同,此文件不再複述。" +"子類別。它覆蓋掉了一個方法並添加了一個可寫入的實例變數。其餘功能" +"與 :class:`dict` 相同,此文件不再複述。" #: ../../library/collections.rst:725 msgid "" -"The first argument provides the initial value for the :attr:" -"`default_factory` attribute; it defaults to ``None``. All remaining " -"arguments are treated the same as if they were passed to the :class:`dict` " -"constructor, including keyword arguments." +"The first argument provides the initial value for " +"the :attr:`default_factory` attribute; it defaults to ``None``. All " +"remaining arguments are treated the same as if they were passed to " +"the :class:`dict` constructor, including keyword arguments." msgstr "" "第一個引數為 :attr:`default_factory` 屬性提供了初始值,他被預設為 ``None``," "所有其他的引數(包括關鍵字引數)都會被傳遞給 :class:`dict` 的建構函式 " @@ -1150,8 +1151,8 @@ msgstr ":class:`defaultdict` 物件支援以下 :class:`dict` 所沒有的方法 #: ../../library/collections.rst:736 msgid "" -"If the :attr:`default_factory` attribute is ``None``, this raises a :exc:" -"`KeyError` exception with the *key* as argument." +"If the :attr:`default_factory` attribute is ``None``, this raises " +"a :exc:`KeyError` exception with the *key* as argument." msgstr "" "如果 :attr:`default_factory` 屬性為 ``None``,呼叫此方法會引發一個附帶引數 " "*key* 的 :exc:`KeyError` 例外。" @@ -1175,24 +1176,24 @@ msgstr "" #: ../../library/collections.rst:746 msgid "" -"This method is called by the :meth:`~object.__getitem__` method of the :" -"class:`dict` class when the requested key is not found; whatever it returns " -"or raises is then returned or raised by :meth:`~object.__getitem__`." +"This method is called by the :meth:`~object.__getitem__` method of " +"the :class:`dict` class when the requested key is not found; whatever it " +"returns or raises is then returned or raised by :meth:`~object.__getitem__`." msgstr "" -"在無法找到所要求的鍵時,此方法會被 :class:`dict` 類別的 :meth:`~object." -"__getitem__` 方法呼叫。無論此方法回傳了值還是引發了例外,都會被 :meth:" -"`~object.__getitem__` 所傳遞。" +"在無法找到所要求的鍵時,此方法會被 :class:`dict` 類別" +"的 :meth:`~object.__getitem__` 方法呼叫。無論此方法回傳了值還是引發了例外,都" +"會被 :meth:`~object.__getitem__` 所傳遞。" #: ../../library/collections.rst:750 msgid "" -"Note that :meth:`__missing__` is *not* called for any operations besides :" -"meth:`~object.__getitem__`. This means that :meth:`get` will, like normal " -"dictionaries, return ``None`` as a default rather than using :attr:" -"`default_factory`." +"Note that :meth:`__missing__` is *not* called for any operations " +"besides :meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, " +"like normal dictionaries, return ``None`` as a default rather than " +"using :attr:`default_factory`." msgstr "" "注意,:meth:`__missing__` *不會*\\ 被 :meth:`~object.__getitem__` 以外的其他" -"方法呼叫,這意味著 :meth:`get` 會像一般的 dict 那樣回傳 ``None`` 做為預設值," -"而非使用 :attr:`default_factory`。" +"方法呼叫,這意味著 :meth:`~dict.get` 會像一般的 dict 那樣回傳 ``None`` 做為預" +"設值,而非使用 :attr:`default_factory`。" #: ../../library/collections.rst:756 msgid ":class:`defaultdict` objects support the following instance variable:" @@ -1207,7 +1208,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:765 ../../library/collections.rst:1191 +#: ../../library/collections.rst:765 ../../library/collections.rst:1192 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1227,40 +1228,41 @@ msgstr "" #: ../../library/collections.rst:784 msgid "" "When each key is encountered for the first time, it is not already in the " -"mapping; so an entry is automatically created using the :attr:`~defaultdict." -"default_factory` function which returns an empty :class:`list`. The :meth:" -"`list.append` operation then attaches the value to the new list. When keys " -"are encountered again, the look-up proceeds normally (returning the list for " -"that key) and the :meth:`list.append` operation adds another value to the " -"list. This technique is simpler and faster than an equivalent technique " +"mapping; so an entry is automatically created using " +"the :attr:`~defaultdict.default_factory` function which returns an " +"empty :class:`list`. The :meth:`!list.append` operation then attaches the " +"value to the new list. When keys are encountered again, the look-up " +"proceeds normally (returning the list for that key) and the :meth:`!" +"list.append` operation adds another value to the list. This technique is " +"simpler and faster than an equivalent technique " "using :meth:`dict.setdefault`:" msgstr "" -"當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼叫 :attr:" -"`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建立一個條" -"目,:meth:`list.append` 操作後續會再新增值到這個新的列表裡。當再次存取該鍵" -"時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`list.append` 也會新" -"增另一個值到 list 中。和使用與其等價的 :meth:`dict.setdefault` 相比,這個技巧" -"更加快速和簡單:" +"當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼" +"叫 :attr:`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建" +"立一個條目,:meth:`!list.append` 操作後續會再新增值到這個新的列表裡。當再次存" +"取該鍵時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`!" +"list.append` 也會新增另一個值到 list 中。和使用與其等價" +"的 :meth:`dict.setdefault` 相比,這個技巧更加快速和簡單:" #: ../../library/collections.rst:799 msgid "" -"Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes the :" -"class:`defaultdict` useful for counting (like a bag or multiset in other " -"languages):" +"Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes " +"the :class:`defaultdict` useful for counting (like a bag or multiset in " +"other languages):" msgstr "" -"設定 :attr:`~defaultdict.default_factory` 為 :class:`int` 使得 :class:" -"`defaultdict` 可被用於計數(類似其他語言中的 bag 或 multiset):" +"設定 :attr:`~defaultdict.default_factory` 為 :class:`int` 使" +"得 :class:`defaultdict` 可被用於計數(類似其他語言中的 bag 或 multiset):" #: ../../library/collections.rst:811 msgid "" -"When a letter is first encountered, it is missing from the mapping, so the :" -"attr:`~defaultdict.default_factory` function calls :func:`int` to supply a " -"default count of zero. The increment operation then builds up the count for " -"each letter." +"When a letter is first encountered, it is missing from the mapping, so " +"the :attr:`~defaultdict.default_factory` function calls :func:`int` to " +"supply a default count of zero. The increment operation then builds up the " +"count for each letter." msgstr "" -"當一個字母首次被存取時,它並不存在於對映中,則 :attr:`~defaultdict." -"default_factory` 函式會呼叫 :func:`int` 來提供一個整數 0 作為預設值。後續的增" -"加操作繼續對每個字母做計數。" +"當一個字母首次被存取時,它並不存在於對映中," +"則 :attr:`~defaultdict.default_factory` 函式會呼叫 :func:`int` 來提供一個整" +"數 0 作為預設值。後續的增加操作繼續對每個字母做計數。" #: ../../library/collections.rst:815 msgid "" @@ -1274,11 +1276,11 @@ msgstr "" #: ../../library/collections.rst:828 msgid "" -"Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes the :" -"class:`defaultdict` useful for building a dictionary of sets:" +"Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes " +"the :class:`defaultdict` useful for building a dictionary of sets:" msgstr "" -"將 :attr:`~defaultdict.default_factory` 設為 :class:`set` 使 :class:" -"`defaultdict` 可用於構建一個值為 set 的字典:" +"將 :attr:`~defaultdict.default_factory` 設為 :class:`set` " +"使 :class:`defaultdict` 可用於構建一個值為 set 的字典:" #: ../../library/collections.rst:841 msgid ":func:`namedtuple` Factory Function for Tuples with Named Fields" @@ -1300,16 +1302,17 @@ msgid "" "Returns a new tuple subclass named *typename*. The new subclass is used to " "create tuple-like objects that have fields accessible by attribute lookup as " "well as being indexable and iterable. Instances of the subclass also have a " -"helpful docstring (with typename and field_names) and a helpful :meth:" -"`__repr__` method which lists the tuple contents in a ``name=value`` format." +"helpful docstring (with *typename* and *field_names*) and a " +"helpful :meth:`~object.__repr__` method which lists the tuple contents in a " +"``name=value`` format." msgstr "" "回傳一個名為 *typename* 的新 tuple 子類別。這個新的子類別被用於建立類似 " "tuple 的物件,可以透過屬性名稱來存取欄位,它同時也是可索引 (indexable) 和可疊" -"代的 (iterable)。子類別實例同樣有文件字串 (docstring)(有類別名 typename 和欄" -"位名 field_names)和一個好用的 :meth:`__repr__` 方法,可將 tuple 內容以 " -"``name=value`` 格式列出。" +"代的 (iterable)。子類別實例同樣有文件字串 (docstring)(有類別名稱 *typename* " +"和欄位名 *field_names*)和一個好用的 :meth:`~object.__repr__` 方法,可將 " +"tuple 內容以 ``name=value`` 格式列出。" -#: ../../library/collections.rst:855 +#: ../../library/collections.rst:856 msgid "" "The *field_names* are a sequence of strings such as ``['x', 'y']``. " "Alternatively, *field_names* can be a single string with each fieldname " @@ -1318,19 +1321,20 @@ msgstr "" "*field_names* 是一個像 ``['x', 'y']`` 一樣的字串序列。*field_names* 也可以是" "一個用空白或逗號分隔各個欄位名稱的字串,比如 ``'x y'`` 或者 ``'x, y'``。" -#: ../../library/collections.rst:859 +#: ../../library/collections.rst:860 msgid "" "Any valid Python identifier may be used for a fieldname except for names " "starting with an underscore. Valid identifiers consist of letters, digits, " -"and underscores but do not start with a digit or underscore and cannot be a :" -"mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or *raise*." +"and underscores but do not start with a digit or underscore and cannot be " +"a :mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or " +"*raise*." msgstr "" "除了底線開頭以外的其他任何有效 Python 識別字 (identifier) 都可以作為欄位名" "稱,有效識別字由字母、數字、底線所組成,但不能是數字或底線開頭,也不能是關鍵" "詞 :mod:`keyword`,例如 *class*、*for*、*return*、*global*、*pass* 或 " "*raise*。" -#: ../../library/collections.rst:865 +#: ../../library/collections.rst:866 msgid "" "If *rename* is true, invalid fieldnames are automatically replaced with " "positional names. For example, ``['abc', 'def', 'ghi', 'abc']`` is " @@ -1341,7 +1345,7 @@ msgstr "" "'def', 'ghi', 'abc']`` 會被轉換成 ``['abc', '_1', 'ghi', '_3']``,移除了關鍵" "字 ``def`` 和重複欄位名 ``abc``。" -#: ../../library/collections.rst:870 +#: ../../library/collections.rst:871 msgid "" "*defaults* can be ``None`` or an :term:`iterable` of default values. Since " "fields with a default value must come after any fields without a default, " @@ -1355,7 +1359,7 @@ msgstr "" "如 fieldnames 為 ``['x', 'y', 'z']`` 且 defaults 為 ``(1, 2)``,那麼 ``x`` 就" "必須被給定一個引數,``y`` 被預設為 ``1``,``z`` 則被預設為 ``2``。" -#: ../../library/collections.rst:877 +#: ../../library/collections.rst:878 msgid "" "If *module* is defined, the :attr:`~type.__module__` attribute of the named " "tuple is set to that value." @@ -1363,7 +1367,7 @@ msgstr "" "如果 *module* 值有被定義,named tuple 的 :attr:`~type.__module__` 屬性就被設" "定為該值。" -#: ../../library/collections.rst:880 +#: ../../library/collections.rst:881 msgid "" "Named tuple instances do not have per-instance dictionaries, so they are " "lightweight and require no more memory than regular tuples." @@ -1371,17 +1375,17 @@ msgstr "" "Named tuple 實例中沒有字典,所以它們更加輕量,且和一般 tuple 相比佔用更少記憶" "體。" -#: ../../library/collections.rst:883 +#: ../../library/collections.rst:884 msgid "" "To support pickling, the named tuple class should be assigned to a variable " "that matches *typename*." msgstr "要支援 pickle,應將 named tuple 類別賦值給一個符合 *typename* 的變數。" -#: ../../library/collections.rst:886 +#: ../../library/collections.rst:887 msgid "Added support for *rename*." msgstr "新增對於 *rename* 的支援。" -#: ../../library/collections.rst:889 +#: ../../library/collections.rst:890 msgid "" "The *verbose* and *rename* parameters became :ref:`keyword-only arguments " "`." @@ -1389,20 +1393,21 @@ msgstr "" "*verbose* 和 *rename* 參數成為\\ :ref:`僅限關鍵字引數 `。" -#: ../../library/collections.rst:893 +#: ../../library/collections.rst:894 msgid "Added the *module* parameter." msgstr "新增 *module* 參數。" -#: ../../library/collections.rst:896 -msgid "Removed the *verbose* parameter and the :attr:`_source` attribute." -msgstr "移除 *verbose* 參數和 :attr:`_source` 屬性。" +#: ../../library/collections.rst:897 +msgid "Removed the *verbose* parameter and the :attr:`!_source` attribute." +msgstr "移除 *verbose* 參數和 :attr:`!_source` 屬性。" -#: ../../library/collections.rst:899 +#: ../../library/collections.rst:900 msgid "" -"Added the *defaults* parameter and the :attr:`_field_defaults` attribute." -msgstr "新增 *defaults* 參數和 :attr:`_field_defaults` 屬性。" +"Added the *defaults* parameter and " +"the :attr:`~somenamedtuple._field_defaults` attribute." +msgstr "新增 *defaults* 參數和 :attr:`~somenamedtuple._field_defaults` 屬性。" -#: ../../library/collections.rst:903 +#: ../../library/collections.rst:904 msgid "" ">>> # Basic example\n" ">>> Point = namedtuple('Point', ['x', 'y'])\n" @@ -1419,7 +1424,7 @@ msgid "" "Point(x=11, y=22)" msgstr "" -#: ../../library/collections.rst:919 +#: ../../library/collections.rst:920 msgid "" "Named tuples are especially useful for assigning field names to result " "tuples returned by the :mod:`csv` or :mod:`sqlite3` modules::" @@ -1427,7 +1432,7 @@ msgstr "" "Named tuple 在賦予欄位名稱於 :mod:`csv` 或 :mod:`sqlite3` 模組回傳之 tuple 時" "相當有用: ::" -#: ../../library/collections.rst:922 +#: ../../library/collections.rst:923 msgid "" "EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, " "paygrade')\n" @@ -1461,7 +1466,7 @@ msgstr "" "for emp in map(EmployeeRecord._make, cursor.fetchall()):\n" " print(emp.name, emp.title)" -#: ../../library/collections.rst:935 +#: ../../library/collections.rst:936 msgid "" "In addition to the methods inherited from tuples, named tuples support three " "additional methods and two attributes. To prevent conflicts with field " @@ -1470,12 +1475,12 @@ msgstr "" "除了繼承自 tuple 的方法,named tuple 還支援三個額外的方法和兩個屬性。為了防止" "欄位名稱有衝突,方法和屬性的名稱以底線開頭。" -#: ../../library/collections.rst:941 +#: ../../library/collections.rst:942 msgid "" "Class method that makes a new instance from an existing sequence or iterable." msgstr "從已存在的序列或可疊代物件建立一個新實例的類別方法。" -#: ../../library/collections.rst:943 +#: ../../library/collections.rst:944 msgid "" ">>> t = [11, 22]\n" ">>> Point._make(t)\n" @@ -1485,13 +1490,13 @@ msgstr "" ">>> Point._make(t)\n" "Point(x=11, y=22)" -#: ../../library/collections.rst:951 +#: ../../library/collections.rst:952 msgid "" "Return a new :class:`dict` which maps field names to their corresponding " "values:" msgstr "回傳一個將欄位名稱對映至對應值的 :class:`dict`:" -#: ../../library/collections.rst:954 +#: ../../library/collections.rst:955 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._asdict()\n" @@ -1501,11 +1506,11 @@ msgstr "" ">>> p._asdict()\n" "{'x': 11, 'y': 22}" -#: ../../library/collections.rst:960 +#: ../../library/collections.rst:961 msgid "Returns an :class:`OrderedDict` instead of a regular :class:`dict`." msgstr "回傳一個 :class:`OrderedDict` 而非 :class:`dict`。" -#: ../../library/collections.rst:963 +#: ../../library/collections.rst:964 msgid "" "Returns a regular :class:`dict` instead of an :class:`OrderedDict`. As of " "Python 3.7, regular dicts are guaranteed to be ordered. If the extra " @@ -1516,13 +1521,13 @@ msgstr "" "dict 已經保證有順序性,如果需要 :class:`OrderedDict` 所專屬的特性,推薦的解法" "是將結果專換成所需的類型:``OrderedDict(nt._asdict())``。" -#: ../../library/collections.rst:972 +#: ../../library/collections.rst:973 msgid "" "Return a new instance of the named tuple replacing specified fields with new " "values::" msgstr "回傳一個新的 named tuple 實例,並將指定欄位替換為新的值: ::" -#: ../../library/collections.rst:975 +#: ../../library/collections.rst:976 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._replace(x=33)\n" @@ -1540,18 +1545,18 @@ msgstr "" "... inventory[partnum] = record._replace(price=newprices[partnum], " "timestamp=time.now())" -#: ../../library/collections.rst:982 +#: ../../library/collections.rst:983 msgid "" "Named tuples are also supported by generic function :func:`copy.replace`." msgstr "" -#: ../../library/collections.rst:984 +#: ../../library/collections.rst:985 msgid "" "Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword " "arguments." msgstr "" -#: ../../library/collections.rst:990 +#: ../../library/collections.rst:991 msgid "" "Tuple of strings listing the field names. Useful for introspection and for " "creating new named tuple types from existing named tuples." @@ -1559,7 +1564,7 @@ msgstr "" "列出 tuple 欄位名稱的字串,用於自我檢查或是從現有 named tuple 建立一個新的 " "named tuple 型別。" -#: ../../library/collections.rst:993 +#: ../../library/collections.rst:994 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -1570,11 +1575,11 @@ msgid "" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" -#: ../../library/collections.rst:1005 +#: ../../library/collections.rst:1006 msgid "Dictionary mapping field names to default values." msgstr "將欄位名稱對映至預設值的字典。" -#: ../../library/collections.rst:1007 +#: ../../library/collections.rst:1008 msgid "" ">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" ">>> Account._field_defaults\n" @@ -1588,13 +1593,13 @@ msgstr "" ">>> Account('premium')\n" "Account(type='premium', balance=0)" -#: ../../library/collections.rst:1015 +#: ../../library/collections.rst:1016 msgid "" -"To retrieve a field whose name is stored in a string, use the :func:" -"`getattr` function:" +"To retrieve a field whose name is stored in a string, use " +"the :func:`getattr` function:" msgstr "要取得這個名稱存於字串的欄位,要使用 :func:`getattr` 函式:" -#: ../../library/collections.rst:1021 +#: ../../library/collections.rst:1022 msgid "" "To convert a dictionary to a named tuple, use the double-star-operator (as " "described in :ref:`tut-unpacking-arguments`):" @@ -1602,7 +1607,7 @@ msgstr "" "(如\\ :ref:`tut-unpacking-arguments`\\ 所述)將一個字典轉換成 named tuple," "要使用 \\*\\* 雙星號運算子:" -#: ../../library/collections.rst:1028 +#: ../../library/collections.rst:1029 msgid "" "Since a named tuple is a regular Python class, it is easy to add or change " "functionality with a subclass. Here is how to add a calculated field and a " @@ -1611,7 +1616,7 @@ msgstr "" "因為一個 named tuple 是一個常規的 Python 類別,我們可以很容易的透過子類別來新" "增或更改功能,以下是如何新增一個計算得到的欄位和固定寬度的輸出列印格式:" -#: ../../library/collections.rst:1032 +#: ../../library/collections.rst:1033 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -1641,7 +1646,7 @@ msgstr "" "Point: x= 3.000 y= 4.000 hypot= 5.000\n" "Point: x=14.000 y= 0.714 hypot=14.018" -#: ../../library/collections.rst:1047 +#: ../../library/collections.rst:1048 msgid "" "The subclass shown above sets ``__slots__`` to an empty tuple. This helps " "keep memory requirements low by preventing the creation of instance " @@ -1650,26 +1655,26 @@ msgstr "" "上面的子類別將 ``__slots__`` 設定為空 tuple,這樣一來就防止了字典實例被建立," "因而保持了較低的記憶體用量。" -#: ../../library/collections.rst:1050 +#: ../../library/collections.rst:1051 msgid "" "Subclassing is not useful for adding new, stored fields. Instead, simply " "create a new named tuple type from the :attr:`~somenamedtuple._fields` " "attribute:" msgstr "" -"子類別化無法用於增加新的、已被儲存的欄位,應當透過 :attr:`~somenamedtuple." -"_fields` 屬性以建立一個新的 named tuple 來實現:" +"子類別化無法用於增加新的、已被儲存的欄位,應當透" +"過 :attr:`~somenamedtuple._fields` 屬性以建立一個新的 named tuple 來實現:" -#: ../../library/collections.rst:1055 +#: ../../library/collections.rst:1056 msgid "" "Docstrings can be customized by making direct assignments to the ``__doc__`` " "fields:" msgstr "透過直接賦值給 ``__doc__``,可以自訂說明文件字串:" -#: ../../library/collections.rst:1064 +#: ../../library/collections.rst:1065 msgid "Property docstrings became writeable." msgstr "文件字串屬性變成可寫入。" -#: ../../library/collections.rst:1069 +#: ../../library/collections.rst:1070 msgid "" "See :class:`typing.NamedTuple` for a way to add type hints for named " "tuples. It also provides an elegant notation using the :keyword:`class` " @@ -1678,7 +1683,7 @@ msgstr "" "關於為 named tuple 新增型別提示的方法,請參閱 :class:`typing.NamedTuple`,它" "運用 :keyword:`class` 關鍵字以提供了一個簡潔的表示法: ::" -#: ../../library/collections.rst:1073 +#: ../../library/collections.rst:1074 msgid "" "class Component(NamedTuple):\n" " part_number: int\n" @@ -1690,15 +1695,15 @@ msgstr "" " weight: float\n" " description: Optional[str] = None" -#: ../../library/collections.rst:1078 +#: ../../library/collections.rst:1079 msgid "" "See :meth:`types.SimpleNamespace` for a mutable namespace based on an " "underlying dictionary instead of a tuple." msgstr "" -"關於以 dict 而非 tuple 為底層的可變命名空間,請參考 :meth:`types." -"SimpleNamespace`。" +"關於以 dict 而非 tuple 為底層的可變命名空間,請參" +"考 :meth:`types.SimpleNamespace`。" -#: ../../library/collections.rst:1081 +#: ../../library/collections.rst:1082 msgid "" "The :mod:`dataclasses` module provides a decorator and functions for " "automatically adding generated special methods to user-defined classes." @@ -1706,11 +1711,11 @@ msgstr "" ":mod:`dataclasses` 模組提供了一個裝飾器和一些函式,用於自動將被生成的特殊方法" "新增到使用者定義的類別中。" -#: ../../library/collections.rst:1086 +#: ../../library/collections.rst:1087 msgid ":class:`OrderedDict` objects" msgstr ":class:`OrderedDict` 物件" -#: ../../library/collections.rst:1088 +#: ../../library/collections.rst:1089 msgid "" "Ordered dictionaries are just like regular dictionaries but have some extra " "capabilities relating to ordering operations. They have become less " @@ -1721,11 +1726,11 @@ msgstr "" "功能,但由於內建的 :class:`dict` 類別現在已經有記憶插入順序的能力(Python " "3.7 中確保了這種新行為),它們變得不那麼重要了。" -#: ../../library/collections.rst:1094 +#: ../../library/collections.rst:1095 msgid "Some differences from :class:`dict` still remain:" msgstr "仍存在一些與 :class:`dict` 的不同之處:" -#: ../../library/collections.rst:1096 +#: ../../library/collections.rst:1097 msgid "" "The regular :class:`dict` was designed to be very good at mapping " "operations. Tracking insertion order was secondary." @@ -1733,7 +1738,7 @@ msgstr "" "常規的 :class:`dict` 被設計成非常擅長於對映相關操作,追蹤插入的順序為次要目" "標。" -#: ../../library/collections.rst:1099 +#: ../../library/collections.rst:1100 msgid "" "The :class:`OrderedDict` was designed to be good at reordering operations. " "Space efficiency, iteration speed, and the performance of update operations " @@ -1742,7 +1747,7 @@ msgstr "" ":class:`OrderedDict` 則被設計成擅長於重新排序相關的操作,空間效率、疊代速度和" "更新操作的效能則為次要設計目標。" -#: ../../library/collections.rst:1103 +#: ../../library/collections.rst:1104 msgid "" "The :class:`OrderedDict` algorithm can handle frequent reordering operations " "better than :class:`dict`. As shown in the recipes below, this makes it " @@ -1751,12 +1756,12 @@ msgstr "" ":class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排序操作,如在下" "方用法中所示,這讓它適合用於多種 LRU cache 的實作中。" -#: ../../library/collections.rst:1107 +#: ../../library/collections.rst:1108 msgid "" "The equality operation for :class:`OrderedDict` checks for matching order." msgstr ":class:`OrderedDict` 之相等性運算會檢查順序是否相同。" -#: ../../library/collections.rst:1109 +#: ../../library/collections.rst:1110 msgid "" "A regular :class:`dict` can emulate the order sensitive equality test with " "``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." @@ -1764,23 +1769,24 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``p == q and all(k1 == k2 for k1, k2 in " "zip(p, q))`` 來效仿有檢查順序的相等性運算。" -#: ../../library/collections.rst:1112 +#: ../../library/collections.rst:1113 msgid "" -"The :meth:`popitem` method of :class:`OrderedDict` has a different " -"signature. It accepts an optional argument to specify which item is popped." +"The :meth:`~OrderedDict.popitem` method of :class:`OrderedDict` has a " +"different signature. It accepts an optional argument to specify which item " +"is popped." msgstr "" -":class:`OrderedDict` 類別的 :meth:`popitem` 方法有不同的函式簽名 " -"(signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" +":class:`OrderedDict` 類別的 :meth:`~OrderedDict.popitem` 方法有不同的函式簽" +"名 (signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" -#: ../../library/collections.rst:1115 +#: ../../library/collections.rst:1116 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " "with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." msgstr "" -"一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 ``od." -"popitem(last=True)``,這保證會移除最右邊(最後一個)的元素。" +"一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 " +"``od.popitem(last=True)``,這保證會移除最右邊(最後一個)的元素。" -#: ../../library/collections.rst:1118 +#: ../../library/collections.rst:1119 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " "with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " @@ -1790,15 +1796,15 @@ msgstr "" "OrderedDict 的 ``od.popitem(last=False)``,若最左邊(第一個)的元素存在,則將" "其回傳並移除。" -#: ../../library/collections.rst:1122 +#: ../../library/collections.rst:1123 msgid "" -":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently " -"reposition an element to an endpoint." +":class:`OrderedDict` has a :meth:`~OrderedDict.move_to_end` method to " +"efficiently reposition an element to an endpoint." msgstr "" -":class:`OrderedDict` 有個 :meth:`move_to_end` 方法可有效率地將一個元素重新排" -"列到任一端。" +":class:`OrderedDict` 有個 :meth:`~OrderedDict.move_to_end` 方法可有效率地將一" +"個元素重新排列到任一端。" -#: ../../library/collections.rst:1125 +#: ../../library/collections.rst:1126 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " "last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " @@ -1808,7 +1814,7 @@ msgstr "" "``od.move_to_end(k, last=True)``,這會將該鍵與其對應到的值移動至最右(最後" "面)的位置。" -#: ../../library/collections.rst:1129 +#: ../../library/collections.rst:1130 msgid "" "A regular :class:`dict` does not have an efficient equivalent for " "OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " @@ -1818,18 +1824,20 @@ msgstr "" "last=False)`` 等價的有效方式,這是將鍵與其對應到的值移動至最左(最前面)位置" "的方法。" -#: ../../library/collections.rst:1133 -msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method." -msgstr "在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`__reversed__` 方法。" +#: ../../library/collections.rst:1134 +msgid "" +"Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method." +msgstr "" +"在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`~object.__reversed__` 方法。" -#: ../../library/collections.rst:1138 +#: ../../library/collections.rst:1139 msgid "" "Return an instance of a :class:`dict` subclass that has methods specialized " "for rearranging dictionary order." msgstr "" "回傳一個 :class:`dict` 子類別的實例,它具有專門用於重新排列字典順序的方法。" -#: ../../library/collections.rst:1145 +#: ../../library/collections.rst:1146 msgid "" "The :meth:`popitem` method for ordered dictionaries returns and removes a " "(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" @@ -1841,7 +1849,7 @@ msgstr "" "回傳鍵值對,否則就按 :abbr:`FIFO (first-in, first-out)` 先進先出的順序回傳鍵" "值對。" -#: ../../library/collections.rst:1152 +#: ../../library/collections.rst:1153 msgid "" "Move an existing *key* to either end of an ordered dictionary. The item is " "moved to the right end if *last* is true (the default) or to the beginning " @@ -1851,7 +1859,7 @@ msgstr "" "設值)則將元素移至右端;如果 *last* 為假值則將元素移至左端。如果 *key* 不存在" "則會引發 :exc:`KeyError`:" -#: ../../library/collections.rst:1157 +#: ../../library/collections.rst:1158 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -1869,7 +1877,7 @@ msgstr "" ">>> ''.join(d)\n" "'bacde'" -#: ../../library/collections.rst:1169 +#: ../../library/collections.rst:1170 msgid "" "In addition to the usual mapping methods, ordered dictionaries also support " "reverse iteration using :func:`reversed`." @@ -1877,7 +1885,7 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1174 +#: ../../library/collections.rst:1175 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " "are roughly equivalent to ``list(od1.items())==list(od2.items())``." @@ -1885,38 +1893,39 @@ msgstr "" ":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,大致等價於 " "``list(od1.items())==list(od2.items())``。" -#: ../../library/collections.rst:1177 +#: ../../library/collections.rst:1178 msgid "" -"Equality tests between :class:`OrderedDict` objects and other :class:" -"`~collections.abc.Mapping` objects are order-insensitive like regular " -"dictionaries. This allows :class:`OrderedDict` objects to be substituted " -"anywhere a regular dictionary is used." +"Equality tests between :class:`OrderedDict` objects and " +"other :class:`~collections.abc.Mapping` objects are order-insensitive like " +"regular dictionaries. This allows :class:`OrderedDict` objects to be " +"substituted anywhere a regular dictionary is used." msgstr "" ":class:`OrderedDict` 物件和其他 :class:`~collections.abc.Mapping` 物件間的相" "等性運算則像普通字典一樣不考慮順序性,這使得 :class:`OrderedDict` 可於任何字" "典可使用的時機中被替換掉。" -#: ../../library/collections.rst:1182 +#: ../../library/collections.rst:1183 msgid "" -"The items, keys, and values :term:`views ` of :class:" -"`OrderedDict` now support reverse iteration using :func:`reversed`." +"The items, keys, and values :term:`views ` " +"of :class:`OrderedDict` now support reverse iteration using :func:`reversed`." msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1186 +#: ../../library/collections.rst:1187 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " -"passed to the :class:`OrderedDict` constructor and its :meth:`update` method." +"passed to the :class:`OrderedDict` constructor and its :meth:`~dict.update` " +"method." msgstr "" -"隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" -"`update` 方法的關鍵字引數之順序被保留了下來。" +"隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與" +"其 :meth:`~dict.update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1196 +#: ../../library/collections.rst:1197 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1198 +#: ../../library/collections.rst:1199 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1926,7 +1935,7 @@ msgstr "" "建立一個能夠記住鍵\\ *最後*\\ 插入順序的 ordered dictionary 變體很簡單。如果" "新條目覆蓋了現有條目,則原本插入位置會被更改並移動至末端: ::" -#: ../../library/collections.rst:1203 +#: ../../library/collections.rst:1204 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -1936,15 +1945,15 @@ msgid "" " self.move_to_end(key)" msgstr "" -#: ../../library/collections.rst:1210 +#: ../../library/collections.rst:1211 msgid "" -"An :class:`OrderedDict` would also be useful for implementing variants of :" -"func:`functools.lru_cache`:" +"An :class:`OrderedDict` would also be useful for implementing variants " +"of :func:`functools.lru_cache`:" msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1213 +#: ../../library/collections.rst:1214 msgid "" "from collections import OrderedDict\n" "from time import time\n" @@ -1971,7 +1980,7 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1240 +#: ../../library/collections.rst:1241 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -2009,50 +2018,51 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1309 +#: ../../library/collections.rst:1310 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1311 +#: ../../library/collections.rst:1312 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`dict`; however, this class can be easier to " "work with because the underlying dictionary is accessible as an attribute." msgstr "" -":class:`UserDict` 類別是作為 dict 物件的包裝器。因為已經可以直接自 :class:" -"`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" -"為被包裝的字典可以作為其屬性來存取。" +":class:`UserDict` 類別是作為 dict 物件的包裝器。因為已經可以直接" +"自 :class:`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來" +"更方便,因為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1319 +#: ../../library/collections.rst:1320 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " -"regular dictionary, which is accessible via the :attr:`data` attribute of :" -"class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is " -"initialized with its contents; note that a reference to *initialdata* will " -"not be kept, allowing it to be used for other purposes." +"regular dictionary, which is accessible via the :attr:`data` attribute " +"of :class:`UserDict` instances. If *initialdata* is provided, :attr:`data` " +"is initialized with its contents; note that a reference to *initialdata* " +"will not be kept, allowing it to be used for other purposes." msgstr "" -"模擬字典的類別。實例的內容被存於一個字典,可透過 :class:`UserDict` 的 :attr:" -"`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被初始化為" -"其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" +"模擬字典的類別。實例的內容被存於一個字典,可透過 :class:`UserDict` " +"的 :attr:`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被" +"初始化為其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目" +"的。" -#: ../../library/collections.rst:1325 +#: ../../library/collections.rst:1326 msgid "" -"In addition to supporting the methods and operations of mappings, :class:" -"`UserDict` instances provide the following attribute:" +"In addition to supporting the methods and operations of " +"mappings, :class:`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,:class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1330 +#: ../../library/collections.rst:1331 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1336 +#: ../../library/collections.rst:1337 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1338 +#: ../../library/collections.rst:1339 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -2063,7 +2073,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1343 +#: ../../library/collections.rst:1344 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -2072,33 +2082,33 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1349 +#: ../../library/collections.rst:1350 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " -"list, which is accessible via the :attr:`data` attribute of :class:" -"`UserList` instances. The instance's contents are initially set to a copy " -"of *list*, defaulting to the empty list ``[]``. *list* can be any iterable, " -"for example a real Python list or a :class:`UserList` object." -msgstr "" -"模擬 list 的類別。實例的內容被存於一個 list,可透過 :class:`UserList` 的 :" -"attr:`data` 屬性來做存取。實例內容被初始化為 *list* 的複製,預設為一個空的 " -"list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" +"list, which is accessible via the :attr:`data` attribute " +"of :class:`UserList` instances. The instance's contents are initially set " +"to a copy of *list*, defaulting to the empty list ``[]``. *list* can be any " +"iterable, for example a real Python list or a :class:`UserList` object." +msgstr "" +"模擬 list 的類別。實例的內容被存於一個 list,可透過 :class:`UserList` " +"的 :attr:`data` 屬性來做存取。實例內容被初始化為 *list* 的複製,預設為一個空" +"的 list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1355 +#: ../../library/collections.rst:1356 msgid "" -"In addition to supporting the methods and operations of mutable sequences, :" -"class:`UserList` instances provide the following attribute:" +"In addition to supporting the methods and operations of mutable " +"sequences, :class:`UserList` instances provide the following attribute:" msgstr "除了支援可變序列的方法與操作,:class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1360 +#: ../../library/collections.rst:1361 msgid "" -"A real :class:`list` object used to store the contents of the :class:" -"`UserList` class." +"A real :class:`list` object used to store the contents of " +"the :class:`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1363 +#: ../../library/collections.rst:1364 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -2112,7 +2122,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1370 +#: ../../library/collections.rst:1371 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -2122,11 +2132,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1376 +#: ../../library/collections.rst:1377 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1378 +#: ../../library/collections.rst:1379 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -2137,7 +2147,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1386 +#: ../../library/collections.rst:1387 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -2149,21 +2159,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,*seq* 引數可以" "是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1393 +#: ../../library/collections.rst:1394 msgid "" -"In addition to supporting the methods and operations of strings, :class:" -"`UserString` instances provide the following attribute:" +"In addition to supporting the methods and operations of " +"strings, :class:`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,:class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1398 +#: ../../library/collections.rst:1399 msgid "" -"A real :class:`str` object used to store the contents of the :class:" -"`UserString` class." +"A real :class:`str` object used to store the contents of " +"the :class:`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1401 +#: ../../library/collections.rst:1402 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 8bec6881d5..63fc65b3ab 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -41,10 +41,10 @@ msgstr "" #: ../../library/concurrent.futures.rst:17 msgid "" -"The asynchronous execution can be performed with threads, using :class:" -"`ThreadPoolExecutor`, or separate processes, using :class:" -"`ProcessPoolExecutor`. Both implement the same interface, which is defined " -"by the abstract :class:`Executor` class." +"The asynchronous execution can be performed with threads, " +"using :class:`ThreadPoolExecutor`, or separate processes, " +"using :class:`ProcessPoolExecutor`. Both implement the same interface, " +"which is defined by the abstract :class:`Executor` class." msgstr "" "非同步執行可以透過 :class:`ThreadPoolExecutor` 來使用執行緒 (thread) 執行,或" "透過 :class:`ProcessPoolExecutor` 來使用單獨行程 (process) 執行。兩者都實作了" @@ -81,9 +81,7 @@ msgid "" "callable. ::" msgstr "" "為可呼叫物件 *fn* 排程來以 ``fn(*args, **kwargs)`` 的形式執行並回傳一個表示可" -"呼叫的執行的 :class:`Future` 物件。\n" -"\n" -"::" +"呼叫的執行的 :class:`Future` 物件。 ::" #: ../../library/concurrent.futures.rst:38 msgid "" @@ -111,11 +109,11 @@ msgstr "*fn* 是非同步執行的,並且對 *fn* 的多次呼叫可以並行 #: ../../library/concurrent.futures.rst:51 msgid "" -"The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." -"__next__` is called and the result isn't available after *timeout* seconds " -"from the original call to :meth:`Executor.map`. *timeout* can be an int or a " -"float. If *timeout* is not specified or ``None``, there is no limit to the " -"wait time." +"The returned iterator raises a :exc:`TimeoutError` " +"if :meth:`~iterator.__next__` is called and the result isn't available after " +"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " +"can be an int or a float. If *timeout* is not specified or ``None``, there " +"is no limit to the wait time." msgstr "" "如果 :meth:`~iterator.__next__` 被呼叫,且在原先呼叫 :meth:`Executor.map` 的 " "*timeout* 秒後結果仍不可用,回傳的疊代器就會引發 :exc:`TimeoutError`。" @@ -140,8 +138,8 @@ msgstr "" "使用 :class:`ProcessPoolExecutor` 時,此方法將 *iterables* 分成許多分塊 " "(chunks),並將其作為獨立的任務來提交給池 (pool)。可以透過將 *chunksize* 設定" "為正整數來指定這些分塊的(約略)大小。對於非常長的可疊代物件,*chunksize* 使" -"用較大的值(與預設大小 1 相比)可以顯著提高性能。對於 :class:" -"`ThreadPoolExecutor`,*chunksize* 無效。" +"用較大的值(與預設大小 1 相比)可以顯著提高性能。對" +"於 :class:`ThreadPoolExecutor`,*chunksize* 無效。" #: ../../library/concurrent.futures.rst:68 msgid "Added the *chunksize* argument." @@ -150,13 +148,13 @@ msgstr "新增 *chunksize* 引數。" #: ../../library/concurrent.futures.rst:73 msgid "" "Signal the executor that it should free any resources that it is using when " -"the currently pending futures are done executing. Calls to :meth:`Executor." -"submit` and :meth:`Executor.map` made after shutdown will raise :exc:" -"`RuntimeError`." +"the currently pending futures are done executing. Calls " +"to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will " +"raise :exc:`RuntimeError`." msgstr "" -"向 executor 發出訊號 (signal),表明它應該在當前未定 (pending) 的 future 完成" -"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` 和 :" -"meth:`Executor.map` 將引發 :exc:`RuntimeError`。" +"向 executor 發出訊號 (signal),表明它應該在目前未定 (pending) 的 future 完成" +"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` " +"和 :meth:`Executor.map` 將引發 :exc:`RuntimeError`。" #: ../../library/concurrent.futures.rst:78 msgid "" @@ -195,9 +193,10 @@ msgstr "" #: ../../library/concurrent.futures.rst:95 msgid "" -"You can avoid having to call this method explicitly if you use the :keyword:" -"`with` statement, which will shutdown the :class:`Executor` (waiting as if :" -"meth:`Executor.shutdown` were called with *wait* set to ``True``)::" +"You can avoid having to call this method explicitly if you use " +"the :keyword:`with` statement, which will shutdown the :class:`Executor` " +"(waiting as if :meth:`Executor.shutdown` were called with *wait* set to " +"``True``)::" msgstr "" "如果使用 :keyword:`with` 陳述句,你就可以不用明確地呼叫此方法,這將會自己關" "閉 :class:`Executor`\\(如同呼叫 :meth:`Executor.shutdown` 時 *wait* 被設定" @@ -311,16 +310,16 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作執行緒開始時呼叫; " "*initargs* 是傳遞給 initializer 的引數元組 (tuple)。如果 *initializer* 引發例" -"外,所有當前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引發 :" -"exc:`~concurrent.futures.thread.BrokenThreadPool`。" +"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.thread.BrokenThreadPool`。" #: ../../library/concurrent.futures.rst:166 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " -"processors on the machine, multiplied by ``5``, assuming that :class:" -"`ThreadPoolExecutor` is often used to overlap I/O instead of CPU work and " -"the number of workers should be higher than the number of workers for :class:" -"`ProcessPoolExecutor`." +"processors on the machine, multiplied by ``5``, assuming " +"that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU " +"work and the number of workers should be higher than the number of workers " +"for :class:`ProcessPoolExecutor`." msgstr "" "如果 *max_workers* 為 ``None`` 或未給定,它將預設為機器上的處理器數量乘以 " "``5``,這假定了 :class:`ThreadPoolExecutor` 通常用於 I/O 重疊而非 CPU 密集的" @@ -329,9 +328,9 @@ msgstr "" #: ../../library/concurrent.futures.rst:174 msgid "" -"Added the *thread_name_prefix* parameter to allow users to control the :" -"class:`threading.Thread` names for worker threads created by the pool for " -"easier debugging." +"Added the *thread_name_prefix* parameter to allow users to control " +"the :class:`threading.Thread` names for worker threads created by the pool " +"for easier debugging." msgstr "" "新增 *thread_name_prefix* 參數以允許使用者控制由池所建立的工作執行緒 (worker " "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" @@ -362,8 +361,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:191 msgid "" -"Default value of *max_workers* is changed to ``min(32, (os." -"process_cpu_count() or 1) + 4)``." +"Default value of *max_workers* is changed to ``min(32, " +"(os.process_cpu_count() or 1) + 4)``." msgstr "" #: ../../library/concurrent.futures.rst:199 @@ -408,15 +407,15 @@ msgstr "ProcessPoolExecutor" #: ../../library/concurrent.futures.rst:233 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " -"uses a pool of processes to execute calls asynchronously. :class:" -"`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which allows " -"it to side-step the :term:`Global Interpreter Lock ` but also means that only picklable objects can be executed and " -"returned." +"uses a pool of processes to execute calls " +"asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` " +"module, which allows it to side-step the :term:`Global Interpreter Lock " +"` but also means that only picklable objects can be " +"executed and returned." msgstr "" ":class:`ProcessPoolExecutor` 類別是一個 :class:`Executor` 的子類別,它使用行" -"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用了 :mod:" -"`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " +"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用" +"了 :mod:`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" @@ -426,9 +425,9 @@ msgid "" "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味著 :" -"class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" -"工作。" +"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味" +"著 :class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive " +"interpreter) 中工作。" #: ../../library/concurrent.futures.rst:243 msgid "" @@ -439,7 +438,6 @@ msgstr "" "或 :class:`Future` 方法將導致死鎖。" #: ../../library/concurrent.futures.rst:248 -#, fuzzy msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " @@ -450,18 +448,18 @@ msgid "" "the default chosen will be at most ``61``, even if more processors are " "available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " "It will be used to launch the workers. If *mp_context* is ``None`` or not " -"given, the default :mod:`multiprocessing` context is used. See :ref:" -"`multiprocessing-start-methods`." +"given, the default :mod:`multiprocessing` context is used. " +"See :ref:`multiprocessing-start-methods`." msgstr "" "一個 :class:`Executor` 子類別,它使用了最多有 *max_workers* 個行程的池來非同" -"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設為機器上的處" -"理器數量。如果 *max_workers* 小於或等於 ``0``,則會引發 :exc:`ValueError`。" -"在 Windows 上,*max_workers* 必須小於或等於 ``61``。如果不是,則會引發 :exc:" -"`ValueError`。如果 *max_workers* 為 ``None``,則預設選擇最多為 ``61``,即便有" -"更多處理器可用。*mp_context* 可以是 :mod:`multiprocessing` 情境 (context) 或 " -"``None``。它將用於啟動 worker。如果 *mp_context* 為 ``None`` 或未給定,則使用" -"預設的 :mod:`multiprocessing` 情境。請見 :ref:`multiprocessing-start-" -"methods`。" +"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設" +"為 :func:`os.process_cpu_count`。如果 *max_workers* 小於或等於 ``0``,則會引" +"發 :exc:`ValueError`。在 Windows 上,*max_workers* 必須小於或等於 ``61``。如" +"果不是,則會引發 :exc:`ValueError`。如果 *max_workers* 為 ``None``,則預設選" +"擇最多為 ``61``,即便有更多處理器可用。*mp_context* 可以" +"是 :mod:`multiprocessing` 情境 (context) 或 ``None``。它將用於啟動 worker。如" +"果 *mp_context* 為 ``None`` 或未給定,則使用預設的 :mod:`multiprocessing` 情" +"境。請見 :ref:`multiprocessing-start-methods`。" #: ../../library/concurrent.futures.rst:262 msgid "" @@ -473,8 +471,8 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作行程 (worker process) 開始時" "呼叫;*initargs* 是傳遞給 initializer 的引數元組。如果 *initializer* 引發例" -"外,所有當前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" -"`~concurrent.futures.process.BrokenProcessPool`。" +"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool`。" #: ../../library/concurrent.futures.rst:268 msgid "" @@ -494,14 +492,15 @@ msgstr "" #: ../../library/concurrent.futures.rst:276 msgid "" -"When one of the worker processes terminates abruptly, a :exc:`~concurrent." -"futures.process.BrokenProcessPool` error is now raised. Previously, " -"behaviour was undefined but operations on the executor or its futures would " -"often freeze or deadlock." +"When one of the worker processes terminates abruptly, " +"a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. " +"Previously, behaviour was undefined but operations on the executor or its " +"futures would often freeze or deadlock." msgstr "" -"當其中一個工作行程突然終止時,現在會引發 :exc:`~concurrent.futures.process." -"BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " -"或其 future 的操作經常會發生凍結或死鎖。" +"當其中一個工作行程突然終止時,現在會引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool` 錯誤。在過去,此行為" +"是未定義的 (undefined),但對 executor 或其 future 的操作經常會發生凍結或死" +"鎖。" #: ../../library/concurrent.futures.rst:283 msgid "" @@ -515,13 +514,13 @@ msgid "" "The default :mod:`multiprocessing` start method (see :ref:`multiprocessing-" "start-methods`) will change away from *fork* in Python 3.14. Code that " "requires *fork* be used for their :class:`ProcessPoolExecutor` should " -"explicitly specify that by passing a ``mp_context=multiprocessing." -"get_context(\"fork\")`` parameter." +"explicitly specify that by passing a " +"``mp_context=multiprocessing.get_context(\"fork\")`` parameter." msgstr "" "預設的 :mod:`multiprocessing` 啟動方法(請參閱 :ref:`multiprocessing-start-" -"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於其 :class:" -"`ProcessPoolExecutor` 的程式碼應透過傳遞 ``mp_context=multiprocessing." -"get_context(\"fork\")`` 參數來明確指定。" +"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於" +"其 :class:`ProcessPoolExecutor` 的程式碼應透過傳遞 " +"``mp_context=multiprocessing.get_context(\"fork\")`` 參數來明確指定。" #: ../../library/concurrent.futures.rst:297 msgid "" @@ -532,11 +531,12 @@ msgstr "" #: ../../library/concurrent.futures.rst:301 msgid "" -"On POSIX systems, if your application has multiple threads and the :mod:" -"`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." -"fork` function called internally to spawn workers may raise a :exc:" -"`DeprecationWarning`. Pass a *mp_context* configured to use a different " -"start method. See the :func:`os.fork` documentation for further explanation." +"On POSIX systems, if your application has multiple threads and " +"the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: " +"The :func:`os.fork` function called internally to spawn workers may raise " +"a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a " +"different start method. See the :func:`os.fork` documentation for further " +"explanation." msgstr "" "在 POSIX 系統上,如果你的應用程式有多個執行緒並且 :mod:`multiprocessing` 情境" "使用了 ``\"fork\"`` 啟動方法:內部呼叫以產生 worker 的 :func:`os.fork` 函式可" @@ -545,8 +545,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:309 msgid "" -"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" -"`os.cpu_count`." +"*max_workers* uses :func:`os.process_cpu_count` by default, instead " +"of :func:`os.cpu_count`." msgstr "" #: ../../library/concurrent.futures.rst:316 @@ -630,8 +630,8 @@ msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" -"meth:`Executor.submit` 建立。" +":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例" +"由 :meth:`Executor.submit` 建立。" #: ../../library/concurrent.futures.rst:361 msgid "" @@ -649,7 +649,7 @@ msgid "" "``False``, otherwise the call will be cancelled and the method will return " "``True``." msgstr "" -"嘗試取消呼叫。如果呼叫當前正在執行或已完成運行且無法取消,則該方法將回傳 " +"嘗試取消呼叫。如果呼叫目前正在執行或已完成運行且無法取消,則該方法將回傳 " "``False``,否則呼叫將被取消並且該方法將回傳 ``True``。" #: ../../library/concurrent.futures.rst:374 @@ -736,8 +736,8 @@ msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" #: ../../library/concurrent.futures.rst:429 msgid "" -"The following :class:`Future` methods are meant for use in unit tests and :" -"class:`Executor` implementations." +"The following :class:`Future` methods are meant for use in unit tests " +"and :class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" #: ../../library/concurrent.futures.rst:434 @@ -751,14 +751,14 @@ msgstr "" #: ../../library/concurrent.futures.rst:438 msgid "" -"If the method returns ``False`` then the :class:`Future` was cancelled, i." -"e. :meth:`Future.cancel` was called and returned ``True``. Any threads " +"If the method returns ``False`` then the :class:`Future` was cancelled, " +"i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads " "waiting on the :class:`Future` completing (i.e. through :func:`as_completed` " "or :func:`wait`) will be woken up." msgstr "" -"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消,即 :meth:`Future." -"cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" -"過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" +"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消," +"即 :meth:`Future.cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成" +"的執行緒(即透過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" #: ../../library/concurrent.futures.rst:443 msgid "" @@ -771,11 +771,12 @@ msgstr "" #: ../../library/concurrent.futures.rst:447 msgid "" -"This method can only be called once and cannot be called after :meth:`Future." -"set_result` or :meth:`Future.set_exception` have been called." +"This method can only be called once and cannot be called " +"after :meth:`Future.set_result` or :meth:`Future.set_exception` have been " +"called." msgstr "" -"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." -"set_exception` 之後呼叫。" +"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` " +"或 :meth:`Future.set_exception` 之後呼叫。" #: ../../library/concurrent.futures.rst:453 msgid "" @@ -792,16 +793,16 @@ msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用 #: ../../library/concurrent.futures.rst:459 #: ../../library/concurrent.futures.rst:472 msgid "" -"This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" -"`Future` is already done." +"This method raises :exc:`concurrent.futures.InvalidStateError` if " +"the :class:`Future` is already done." msgstr "" -"如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." -"InvalidStateError`。" +"如果 :class:`Future` 已經完成,此方法會引" +"發 :exc:`concurrent.futures.InvalidStateError`。" #: ../../library/concurrent.futures.rst:466 msgid "" -"Sets the result of the work associated with the :class:`Future` to the :" -"class:`Exception` *exception*." +"Sets the result of the work associated with the :class:`Future` to " +"the :class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" @@ -811,13 +812,13 @@ msgstr "模組函式" #: ../../library/concurrent.futures.rst:482 msgid "" -"Wait for the :class:`Future` instances (possibly created by different :class:" -"`Executor` instances) given by *fs* to complete. Duplicate futures given to " -"*fs* are removed and will be returned only once. Returns a named 2-tuple of " -"sets. The first set, named ``done``, contains the futures that completed " -"(finished or cancelled futures) before the wait completed. The second set, " -"named ``not_done``, contains the futures that did not complete (pending or " -"running futures)." +"Wait for the :class:`Future` instances (possibly created by " +"different :class:`Executor` instances) given by *fs* to complete. Duplicate " +"futures given to *fs* are removed and will be returned only once. Returns a " +"named 2-tuple of sets. The first set, named ``done``, contains the futures " +"that completed (finished or cancelled futures) before the wait completed. " +"The second set, named ``not_done``, contains the futures that did not " +"complete (pending or running futures)." msgstr "" "等待 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例建" "立)完成。提供給 *fs* 的重複 future 將被刪除,並且只會回傳一次。回傳一個集合" @@ -855,8 +856,8 @@ msgstr "當任何 future 完成或被取消時,該函式就會回傳。" #: ../../library/concurrent.futures.rst:507 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent to :const:" -"`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" @@ -880,10 +881,10 @@ msgstr "" "回傳由 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例" "建立)的疊代器,它在完成時產生 future(已完成或被取消的 future)。*fs* 給定的" "任何重複的 future 將只被回傳一次。呼叫 :func:`as_completed` 之前完成的任何 " -"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼叫 :" -"func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引發 :exc:" -"`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " -"``None``,則等待時間就沒有限制。" +"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼" +"叫 :func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引" +"發 :exc:`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或" +"為 ``None``,則等待時間就沒有限制。" #: ../../library/concurrent.futures.rst:529 msgid ":pep:`3148` -- futures - execute computations asynchronously" @@ -927,25 +928,27 @@ msgstr "" msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." -msgstr "當前狀態下不允許的 future 操作被執行時而引發。" +msgstr "目前狀態下不允許的 future 操作被執行時而引發。" #: ../../library/concurrent.futures.rst:572 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " -"is raised when one of the workers of a :class:`~concurrent.futures." -"ThreadPoolExecutor` has failed initializing." +"is raised when one of the workers of " +"a :class:`~concurrent.futures.ThreadPoolExecutor` has failed initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." -"futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`," +"當 :class:`~concurrent.futures.ThreadPoolExecutor` 的其中一個 worker 初始化失" +"敗時會引發此例外類別。" #: ../../library/concurrent.futures.rst:583 msgid "" -"Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" -"`RuntimeError`), this exception class is raised when one of the workers of " -"a :class:`~concurrent.futures.ProcessPoolExecutor` has terminated in a non-" -"clean fashion (for example, if it was killed from the outside)." +"Derived from :exc:`~concurrent.futures.BrokenExecutor` " +"(formerly :exc:`RuntimeError`), this exception class is raised when one of " +"the workers of a :class:`~concurrent.futures.ProcessPoolExecutor` has " +"terminated in a non-clean fashion (for example, if it was killed from the " +"outside)." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前為 :exc:" -"`RuntimeError`),當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中" -"一個 worker 以不乾淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉" -"的)。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前" +"為 :exc:`RuntimeError`)," +"當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中一個 worker 以不乾" +"淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉的)。" diff --git a/library/configparser.po b/library/configparser.po index 1cf79e0a29..4b3a98b31e 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-06 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -183,7 +183,7 @@ msgid "" "'no'\n" ">>> topsecret['Port']\n" "'50022'\n" -">>> for key in config['forge.example']: \n" +">>> for key in config['forge.example']:\n" "... print(key)\n" "user\n" "compressionlevel\n" @@ -213,7 +213,7 @@ msgstr "" "'no'\n" ">>> topsecret['Port']\n" "'50022'\n" -">>> for key in config['forge.example']: \n" +">>> for key in config['forge.example']:\n" "... print(key)\n" "user\n" "compressionlevel\n" @@ -233,12 +233,12 @@ msgstr "" #: ../../library/configparser.rst:148 ../../library/configparser.rst:1003 msgid "" -"It is possible to read several configurations into a single :class:" -"`ConfigParser`, where the most recently added configuration has the highest " -"priority. Any conflicting keys are taken from the more recent configuration " -"while the previously existing keys are retained. The example below reads in " -"an ``override.ini`` file, which will override any conflicting keys from the " -"``example.ini`` file." +"It is possible to read several configurations into a " +"single :class:`ConfigParser`, where the most recently added configuration " +"has the highest priority. Any conflicting keys are taken from the more " +"recent configuration while the previously existing keys are retained. The " +"example below reads in an ``override.ini`` file, which will override any " +"conflicting keys from the ``example.ini`` file." msgstr "" #: ../../library/configparser.rst:155 ../../library/configparser.rst:1010 @@ -384,10 +384,10 @@ msgstr "" #: ../../library/configparser.rst:241 msgid "" -"One more thing to be aware of is that the parser-level :meth:`~ConfigParser." -"get` method provides a custom, more complex interface, maintained for " -"backwards compatibility. When using this method, a fallback value can be " -"provided via the ``fallback`` keyword-only argument:" +"One more thing to be aware of is that the parser-" +"level :meth:`~ConfigParser.get` method provides a custom, more complex " +"interface, maintained for backwards compatibility. When using this method, " +"a fallback value can be provided via the ``fallback`` keyword-only argument:" msgstr "" #: ../../library/configparser.rst:246 @@ -399,9 +399,9 @@ msgstr "" #: ../../library/configparser.rst:252 msgid "" -"The same ``fallback`` argument can be used with the :meth:`~ConfigParser." -"getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` " -"methods, for example:" +"The same ``fallback`` argument can be used with " +"the :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` " +"and :meth:`~ConfigParser.getboolean` methods, for example:" msgstr "" #: ../../library/configparser.rst:256 @@ -587,8 +587,8 @@ msgstr "" #: ../../library/configparser.rst:396 msgid "" -"With ``interpolation`` set to ``None``, the parser would simply return " -"``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" +"With ``interpolation`` set to ``None``, the parser would simply return ``%" +"(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" @@ -597,9 +597,9 @@ msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " "using ``${section:option}`` to denote a value from a foreign section. " -"Interpolation can span multiple levels. For convenience, if the ``section:" -"`` part is omitted, interpolation defaults to the current section (and " -"possibly the default values from the special section)." +"Interpolation can span multiple levels. For convenience, if the " +"``section:`` part is omitted, interpolation defaults to the current section " +"(and possibly the default values from the special section)." msgstr "" #: ../../library/configparser.rst:411 @@ -668,8 +668,8 @@ msgstr "" #: ../../library/configparser.rst:451 msgid "" "Mapping protocol access is a generic name for functionality that enables " -"using custom objects as if they were dictionaries. In case of :mod:" -"`configparser`, the mapping interface implementation is using the " +"using custom objects as if they were dictionaries. In case " +"of :mod:`configparser`, the mapping interface implementation is using the " "``parser['section']['option']`` notation." msgstr "" @@ -685,9 +685,9 @@ msgstr "" #: ../../library/configparser.rst:462 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " -"possible. The mapping interface is complete and adheres to the :class:" -"`~collections.abc.MutableMapping` ABC. However, there are a few differences " -"that should be taken into account:" +"possible. The mapping interface is complete and adheres to " +"the :class:`~collections.abc.MutableMapping` ABC. However, there are a few " +"differences that should be taken into account:" msgstr "" #: ../../library/configparser.rst:467 @@ -709,8 +709,8 @@ msgstr "" #: ../../library/configparser.rst:475 msgid "" -"All sections include ``DEFAULTSECT`` values as well which means that ``." -"clear()`` on a section may not leave the section visibly empty. This is " +"All sections include ``DEFAULTSECT`` values as well which means that " +"``.clear()`` on a section may not leave the section visibly empty. This is " "because default values cannot be deleted from the section (because " "technically they are not there). If they are overridden in the section, " "deleting causes the default value to be visible again. Trying to delete a " @@ -744,10 +744,10 @@ msgstr "" msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " -"However, this method can also be invoked with arguments: ``parser." -"items(section, raw, vars)``. The latter call returns a list of *option*, " -"*value* pairs for a specified ``section``, with all interpolations expanded " -"(unless ``raw=True`` is provided)." +"However, this method can also be invoked with arguments: " +"``parser.items(section, raw, vars)``. The latter call returns a list of " +"*option*, *value* pairs for a specified ``section``, with all interpolations " +"expanded (unless ``raw=True`` is provided)." msgstr "" #: ../../library/configparser.rst:501 @@ -790,8 +790,8 @@ msgstr "" #: ../../library/configparser.rst:525 msgid "" -"Hint: if you want to specify default values for a specific section, use :" -"meth:`~ConfigParser.read_dict` before you read the actual file." +"Hint: if you want to specify default values for a specific section, " +"use :meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" #: ../../library/configparser.rst:528 @@ -909,8 +909,8 @@ msgstr "" #: ../../library/configparser.rst:603 msgid "" -"See also the *space_around_delimiters* argument to :meth:`ConfigParser." -"write`." +"See also the *space_around_delimiters* argument " +"to :meth:`ConfigParser.write`." msgstr "" #: ../../library/configparser.rst:606 @@ -996,9 +996,10 @@ msgstr "" #: ../../library/configparser.rst:669 msgid "" "When set to ``True``, the parser will not allow for any section or option " -"duplicates while reading from a single source (using :meth:`~ConfigParser." -"read_file`, :meth:`~ConfigParser.read_string` or :meth:`~ConfigParser." -"read_dict`). It is recommended to use strict parsers in new applications." +"duplicates while reading from a single source " +"(using :meth:`~ConfigParser.read_file`, :meth:`~ConfigParser.read_string` " +"or :meth:`~ConfigParser.read_dict`). It is recommended to use strict " +"parsers in new applications." msgstr "" #: ../../library/configparser.rst:674 @@ -1054,9 +1055,9 @@ msgid "" "other valid section name. Some typical values include: ``\"general\"`` or " "``\"common\"``. The name provided is used for recognizing default sections " "when reading from any source and is used when writing configuration back to " -"a file. Its current value can be retrieved using the ``parser_instance." -"default_section`` attribute and may be modified at runtime (i.e. to convert " -"files from one format to another)." +"a file. Its current value can be retrieved using the " +"``parser_instance.default_section`` attribute and may be modified at runtime " +"(i.e. to convert files from one format to another)." msgstr "" #: ../../library/configparser.rst:715 @@ -1069,8 +1070,8 @@ msgid "" "through the *interpolation* argument. ``None`` can be used to turn off " "interpolation completely, ``ExtendedInterpolation()`` provides a more " "advanced variant inspired by ``zc.buildout``. More on the subject in the " -"`dedicated documentation section <#interpolation-of-values>`_. :class:" -"`RawConfigParser` has a default value of ``None``." +"`dedicated documentation section <#interpolation-of-" +"values>`_. :class:`RawConfigParser` has a default value of ``None``." msgstr "" #: ../../library/configparser.rst:724 @@ -1084,9 +1085,9 @@ msgid "" "and :meth:`~ConfigParser.getboolean` are implemented. Should other getters " "be desirable, users may define them in a subclass or pass a dictionary where " "each key is a name of the converter and each value is a callable " -"implementing said conversion. For instance, passing ``{'decimal': decimal." -"Decimal}`` would add :meth:`!getdecimal` on both the parser object and all " -"section proxies. In other words, it will be possible to write both " +"implementing said conversion. For instance, passing ``{'decimal': " +"decimal.Decimal}`` would add :meth:`!getdecimal` on both the parser object " +"and all section proxies. In other words, it will be possible to write both " "``parser_instance.getdecimal('section', 'key', fallback=0)`` and " "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" @@ -1404,13 +1405,13 @@ msgstr "" msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " -"string or dictionary), raising :exc:`DuplicateSectionError` or :exc:" -"`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` (default: " -"``True``), each empty line marks the end of an option. Otherwise, internal " -"empty lines of a multiline option are kept as part of the value. When " -"*allow_no_value* is ``True`` (default: ``False``), options without values " -"are accepted; the value held for these is ``None`` and they are serialized " -"without the trailing delimiter." +"string or dictionary), raising :exc:`DuplicateSectionError` " +"or :exc:`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` " +"(default: ``True``), each empty line marks the end of an option. Otherwise, " +"internal empty lines of a multiline option are kept as part of the value. " +"When *allow_no_value* is ``True`` (default: ``False``), options without " +"values are accepted; the value held for these is ``None`` and they are " +"serialized without the trailing delimiter." msgstr "" #: ../../library/configparser.rst:974 @@ -1434,11 +1435,11 @@ msgstr "" #: ../../library/configparser.rst:987 msgid "" -"All option names used in interpolation will be passed through the :meth:" -"`optionxform` method just like any other option name reference. For " -"example, using the default implementation of :meth:`optionxform` (which " -"converts option names to lower case), the values ``foo %(bar)s`` and ``foo " -"%(BAR)s`` are equivalent." +"All option names used in interpolation will be passed through " +"the :meth:`optionxform` method just like any other option name reference. " +"For example, using the default implementation of :meth:`optionxform` (which " +"converts option names to lower case), the values ``foo %(bar)s`` and ``foo %" +"(BAR)s`` are equivalent." msgstr "" #: ../../library/configparser.rst:993 @@ -1528,9 +1529,9 @@ msgstr "" #: ../../library/configparser.rst:1090 msgid "" -"If the given *section* exists, and contains the given *option*, return :" -"const:`True`; otherwise return :const:`False`. If the specified *section* " -"is :const:`None` or an empty string, DEFAULT is assumed." +"If the given *section* exists, and contains the given *option*, " +"return :const:`True`; otherwise return :const:`False`. If the specified " +"*section* is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" #: ../../library/configparser.rst:1097 @@ -1554,8 +1555,8 @@ msgstr "" msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " -"be loaded from a file should load the required file or files using :meth:" -"`read_file` before calling :meth:`read` for any optional files::" +"be loaded from a file should load the required file or files " +"using :meth:`read_file` before calling :meth:`read` for any optional files::" msgstr "" #: ../../library/configparser.rst:1115 @@ -1679,9 +1680,9 @@ msgid "" "``'1'``, ``'yes'``, ``'true'``, and ``'on'``, which cause this method to " "return ``True``, and ``'0'``, ``'no'``, ``'false'``, and ``'off'``, which " "cause it to return ``False``. These string values are checked in a case-" -"insensitive manner. Any other value will cause it to raise :exc:" -"`ValueError`. See :meth:`get` for explanation of *raw*, *vars* and " -"*fallback*." +"insensitive manner. Any other value will cause it to " +"raise :exc:`ValueError`. See :meth:`get` for explanation of *raw*, *vars* " +"and *fallback*." msgstr "" #: ../../library/configparser.rst:1219 @@ -1693,8 +1694,8 @@ msgstr "" #: ../../library/configparser.rst:1222 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " -"given *section*. Optional arguments have the same meaning as for the :meth:" -"`get` method." +"given *section*. Optional arguments have the same meaning as for " +"the :meth:`get` method." msgstr "" #: ../../library/configparser.rst:1226 @@ -1779,9 +1780,9 @@ msgstr "" #: ../../library/configparser.rst:1296 msgid "" -"The maximum depth for recursive interpolation for :meth:`~configparser." -"ConfigParser.get` when the *raw* parameter is false. This is relevant only " -"when the default *interpolation* is used." +"The maximum depth for recursive interpolation " +"for :meth:`~configparser.ConfigParser.get` when the *raw* parameter is " +"false. This is relevant only when the default *interpolation* is used." msgstr "" #: ../../library/configparser.rst:1304 @@ -1819,9 +1820,9 @@ msgstr "" #: ../../library/configparser.rst:1353 msgid "" "If the given section exists, set the given option to the specified value; " -"otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" -"`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters set to " -"true) for *internal* storage of non-string values, full functionality " +"otherwise raise :exc:`NoSectionError`. While it is possible to " +"use :class:`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters " +"set to true) for *internal* storage of non-string values, full functionality " "(including interpolation and output to files) can only be achieved using " "string values." msgstr "" @@ -1855,8 +1856,8 @@ msgstr "" #: ../../library/configparser.rst:1385 msgid "" -"Added the optional *source* and *lineno* attributes and parameters to :meth:" -"`!__init__`." +"Added the optional *source* and *lineno* attributes and parameters " +"to :meth:`!__init__`." msgstr "" #: ../../library/configparser.rst:1392 @@ -1882,8 +1883,8 @@ msgstr "" #: ../../library/configparser.rst:1412 msgid "" "Exception raised when string interpolation cannot be completed because the " -"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" -"exc:`InterpolationError`." +"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass " +"of :exc:`InterpolationError`." msgstr "" #: ../../library/configparser.rst:1419 @@ -1922,7 +1923,7 @@ msgstr "" #: ../../library/configparser.rst:1451 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/configparser.rst:1452 msgid "" diff --git a/library/constants.po b/library/constants.po index 9fd1624475..2650c50799 100644 --- a/library/constants.po +++ b/library/constants.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,21 +59,22 @@ msgstr "" #: ../../library/constants.rst:30 msgid "" -"A special value which should be returned by the binary special methods (e." -"g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :" -"meth:`~object.__rsub__`, etc.) to indicate that the operation is not " -"implemented with respect to the other type; may be returned by the in-place " -"binary special methods (e.g. :meth:`~object.__imul__`, :meth:`~object." -"__iand__`, etc.) for the same purpose. It should not be evaluated in a " -"boolean context. :data:`!NotImplemented` is the sole instance of the :data:" -"`types.NotImplementedType` type." +"A special value which should be returned by the binary special methods " +"(e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, " +"etc.) to indicate that the operation is not implemented with respect to the " +"other type; may be returned by the in-place binary special methods " +"(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same " +"purpose. It should not be evaluated in a boolean context. :data:`!" +"NotImplemented` is the sole instance of the :data:`types.NotImplementedType` " +"type." msgstr "" -"會被二元特殊方法 (binary special methods)(如::meth:`~object.__eq__`、:meth:" -"`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` 等)所回" -"傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元特殊方法 " -"(in-place binary special methods) (如::meth:`~object.__imul__`、:meth:" -"`~object.__iand__` 等)回傳。它不應該被作為 boolean(布林)來解讀。:data:`!" -"NotImplemented` 是型別 :data:`types.NotImplementedType` 的唯一實例。" +"會被二元特殊方法 (binary special methods)" +"(如::meth:`~object.__eq__`、:meth:`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` " +"等)所回傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元" +"特殊方法 (in-place binary special methods) " +"(如::meth:`~object.__imul__`、:meth:`~object.__iand__` 等)回傳。它不應該被" +"作為 boolean(布林)來解讀。:data:`!NotImplemented` 是型" +"別 :data:`types.NotImplementedType` 的唯一實例。" #: ../../library/constants.rst:40 msgid "" @@ -97,15 +98,15 @@ msgstr "請參見 :ref:`implementing-the-arithmetic-operations` 以找到更多 #: ../../library/constants.rst:51 msgid "" -"``NotImplementedError`` and :data:`!NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :exc:" -"`NotImplementedError` for details on when to use it." +":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " +"interchangeable. This constant should only be used as described above; " +"see :exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" -"``NotImplementedError`` 與 :data:`!NotImplemented` 並不一樣且不可互換。即使它" -"們有相似的名稱與用途。欲知更多如何使用它們的細節,請參見 :exc:" -"`NotImplementedError`。" +":data:`!NotImplemented` 與 :exc:`!NotImplementedError` 並不一樣且不可互換。這" +"個常數只能用於上述的情況;欲知更多如何正確使用它們的細節,請參" +"見 :exc:`NotImplementedError`。" -#: ../../library/constants.rst:55 +#: ../../library/constants.rst:56 msgid "" "Evaluating :data:`!NotImplemented` in a boolean context is deprecated. While " "it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " @@ -115,7 +116,7 @@ msgstr "" "被解讀成 true,但會發出一個 :exc:`DeprecationWarning`。在未來版本的 Python 將" "會拋出 :exc:`TypeError`。" -#: ../../library/constants.rst:64 +#: ../../library/constants.rst:65 msgid "" "The same as the ellipsis literal \"``...``\". Special value used mostly in " "conjunction with extended slicing syntax for user-defined container data " @@ -123,32 +124,32 @@ msgid "" "type." msgstr "" "與刪節號 \"``...``\" 字面相同。為一特殊值,大多用於結合使用者定義資料型別的延" -"伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型別 :data:`types." -"EllipsisType` 的唯一實例。" +"伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型" +"別 :data:`types.EllipsisType` 的唯一實例。" -#: ../../library/constants.rst:71 +#: ../../library/constants.rst:72 msgid "" "This constant is true if Python was not started with an :option:`-O` option. " "See also the :keyword:`assert` statement." msgstr "" -"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參見 :keyword:" -"`assert` 陳述式。" +"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參" +"見 :keyword:`assert` 陳述式。" -#: ../../library/constants.rst:77 +#: ../../library/constants.rst:78 msgid "" "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " -"cannot be reassigned (assignments to them, even as an attribute name, raise :" -"exc:`SyntaxError`), so they can be considered \"true\" constants." +"cannot be reassigned (assignments to them, even as an attribute name, " +"raise :exc:`SyntaxError`), so they can be considered \"true\" constants." msgstr "" ":data:`None`,:data:`False`,:data:`True`,以及 :data:`__debug__` 都是不能被" -"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋出 :exc:" -"`SyntaxError`)。因此,它們可以被視為”真正的”常數。" +"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋" +"出 :exc:`SyntaxError`)。因此,它們可以被視為”真正的”常數。" -#: ../../library/constants.rst:85 +#: ../../library/constants.rst:86 msgid "Constants added by the :mod:`site` module" msgstr "由 :mod:`site` module(模組)所添增的常數" -#: ../../library/constants.rst:87 +#: ../../library/constants.rst:88 msgid "" "The :mod:`site` module (which is imported automatically during startup, " "except if the :option:`-S` command-line option is given) adds several " @@ -159,7 +160,7 @@ msgstr "" "指令行選項)會添增一些常數到內建命名空間 (built-in namespace) 中。它們在互動" "式直譯器中是很有幫助的,但不應該在程式 (programs) 中被使用。" -#: ../../library/constants.rst:95 +#: ../../library/constants.rst:96 msgid "" "Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. " "EOF) to exit\", and when called, raise :exc:`SystemExit` with the specified " @@ -168,23 +169,23 @@ msgstr "" "當印出物件時,會印出一個訊息: \"Use quit() or Ctrl-D (i.e. EOF) to exit\" 。" "當被呼叫時,則會拋出 :exc:`SystemExit` 並帶有指定的返回碼(exit code)。" -#: ../../library/constants.rst:102 +#: ../../library/constants.rst:103 msgid "" "Object that when printed, prints the message \"Type help() for interactive " "help, or help(object) for help about object.\", and when called, acts as " "described :func:`elsewhere `." msgstr "" "當印出此物件時,會印出訊息 \"Type help() for interactive help, or " -"help(object) for help about object.\",並在呼叫時按所述的方式操作 :func:" -"`elsewhere `。" +"help(object) for help about object.\",並在呼叫時按所述的方式操" +"作 :func:`elsewhere `。" -#: ../../library/constants.rst:109 +#: ../../library/constants.rst:110 msgid "" "Objects that when printed or called, print the text of copyright or credits, " "respectively." msgstr "當印出或是呼叫此物件時,分別會印出版權與致謝的文字。" -#: ../../library/constants.rst:114 +#: ../../library/constants.rst:115 msgid "" "Object that when printed, prints the message \"Type license() to see the " "full license text\", and when called, displays the full license text in a " @@ -193,10 +194,10 @@ msgstr "" "當印出此物件時,會印出訊息 \"Type license() to see the full license text\"," "並在呼叫時以分頁形式印出完整的許可證文字(一次一整個畫面)。" -#: ../../library/constants.rst:61 +#: ../../library/constants.rst:62 msgid "..." msgstr "..." -#: ../../library/constants.rst:61 +#: ../../library/constants.rst:62 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/contextlib.po b/library/contextlib.po index 5785f5506e..a7be4735e6 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -21,7 +21,7 @@ msgstr "" #: ../../library/contextlib.rst:2 msgid "" ":mod:`!contextlib` --- Utilities for :keyword:`!with`\\ -statement contexts" -msgstr "" +msgstr ":mod:`!contextlib` --- :keyword:`!with` 陳述式工具程式" #: ../../library/contextlib.rst:7 msgid "**Source code:** :source:`Lib/contextlib.py`" @@ -29,9 +29,9 @@ msgstr "**原始碼:**\\ :source:`Lib/contextlib.py`" #: ../../library/contextlib.rst:11 msgid "" -"This module provides utilities for common tasks involving the :keyword:" -"`with` statement. For more information see also :ref:`typecontextmanager` " -"and :ref:`context-managers`." +"This module provides utilities for common tasks involving " +"the :keyword:`with` statement. For more information see " +"also :ref:`typecontextmanager` and :ref:`context-managers`." msgstr "" #: ../../library/contextlib.rst:17 @@ -44,36 +44,38 @@ msgstr "" #: ../../library/contextlib.rst:23 msgid "" -"An :term:`abstract base class` for classes that implement :meth:`object." -"__enter__` and :meth:`object.__exit__`. A default implementation for :meth:" -"`object.__enter__` is provided which returns ``self`` while :meth:`object." -"__exit__` is an abstract method which by default returns ``None``. See also " -"the definition of :ref:`typecontextmanager`." +"An :term:`abstract base class` for classes that " +"implement :meth:`object.__enter__` and :meth:`object.__exit__`. A default " +"implementation for :meth:`object.__enter__` is provided which returns " +"``self`` while :meth:`object.__exit__` is an abstract method which by " +"default returns ``None``. See also the definition " +"of :ref:`typecontextmanager`." msgstr "" #: ../../library/contextlib.rst:34 msgid "" -"An :term:`abstract base class` for classes that implement :meth:`object." -"__aenter__` and :meth:`object.__aexit__`. A default implementation for :meth:" -"`object.__aenter__` is provided which returns ``self`` while :meth:`object." -"__aexit__` is an abstract method which by default returns ``None``. See also " -"the definition of :ref:`async-context-managers`." +"An :term:`abstract base class` for classes that " +"implement :meth:`object.__aenter__` and :meth:`object.__aexit__`. A default " +"implementation for :meth:`object.__aenter__` is provided which returns " +"``self`` while :meth:`object.__aexit__` is an abstract method which by " +"default returns ``None``. See also the definition of :ref:`async-context-" +"managers`." msgstr "" #: ../../library/contextlib.rst:46 msgid "" "This function is a :term:`decorator` that can be used to define a factory " "function for :keyword:`with` statement context managers, without needing to " -"create a class or separate :meth:`~object.__enter__` and :meth:`~object." -"__exit__` methods." +"create a class or separate :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" #: ../../library/contextlib.rst:50 msgid "" "While many objects natively support use in with statements, sometimes a " "resource needs to be managed that isn't a context manager in its own right, " -"and doesn't implement a ``close()`` method for use with ``contextlib." -"closing``" +"and doesn't implement a ``close()`` method for use with " +"``contextlib.closing``." msgstr "" #: ../../library/contextlib.rst:54 @@ -117,18 +119,18 @@ msgstr "" #: ../../library/contextlib.rst:79 msgid "" -"At the point where the generator yields, the block nested in the :keyword:" -"`with` statement is executed. The generator is then resumed after the block " -"is exited. If an unhandled exception occurs in the block, it is reraised " -"inside the generator at the point where the yield occurred. Thus, you can " -"use a :keyword:`try`...\\ :keyword:`except`...\\ :keyword:`finally` " -"statement to trap the error (if any), or ensure that some cleanup takes " -"place. If an exception is trapped merely in order to log it or to perform " -"some action (rather than to suppress it entirely), the generator must " -"reraise that exception. Otherwise the generator context manager will " -"indicate to the :keyword:`!with` statement that the exception has been " -"handled, and execution will resume with the statement immediately following " -"the :keyword:`!with` statement." +"At the point where the generator yields, the block nested in " +"the :keyword:`with` statement is executed. The generator is then resumed " +"after the block is exited. If an unhandled exception occurs in the block, it " +"is reraised inside the generator at the point where the yield occurred. " +"Thus, you can use a :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` statement to trap the error (if any), or ensure that " +"some cleanup takes place. If an exception is trapped merely in order to log " +"it or to perform some action (rather than to suppress it entirely), the " +"generator must reraise that exception. Otherwise the generator context " +"manager will indicate to the :keyword:`!with` statement that the exception " +"has been handled, and execution will resume with the statement immediately " +"following the :keyword:`!with` statement." msgstr "" #: ../../library/contextlib.rst:91 @@ -148,8 +150,8 @@ msgstr "" #: ../../library/contextlib.rst:104 msgid "" -"Similar to :func:`~contextlib.contextmanager`, but creates an :ref:" -"`asynchronous context manager `." +"Similar to :func:`~contextlib.contextmanager`, but creates " +"an :ref:`asynchronous context manager `." msgstr "" #: ../../library/contextlib.rst:107 @@ -157,8 +159,8 @@ msgid "" "This function is a :term:`decorator` that can be used to define a factory " "function for :keyword:`async with` statement asynchronous context managers, " "without needing to create a class or separate :meth:`~object.__aenter__` " -"and :meth:`~object.__aexit__` methods. It must be applied to an :term:" -"`asynchronous generator` function." +"and :meth:`~object.__aexit__` methods. It must be applied to " +"an :term:`asynchronous generator` function." msgstr "" #: ../../library/contextlib.rst:113 @@ -288,10 +290,11 @@ msgstr "" #: ../../library/contextlib.rst:187 msgid "" "Most types managing resources support the :term:`context manager` protocol, " -"which closes *thing* on leaving the :keyword:`with` statement. As such, :" -"func:`!closing` is most useful for third party types that don't support " -"context managers. This example is purely for illustration purposes, as :func:" -"`~urllib.request.urlopen` would normally be used in a context manager." +"which closes *thing* on leaving the :keyword:`with` statement. As " +"such, :func:`!closing` is most useful for third party types that don't " +"support context managers. This example is purely for illustration purposes, " +"as :func:`~urllib.request.urlopen` would normally be used in a context " +"manager." msgstr "" #: ../../library/contextlib.rst:196 @@ -484,17 +487,17 @@ msgstr "" #: ../../library/contextlib.rst:315 msgid "" -"If the code within the :keyword:`!with` block raises a :exc:" -"`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any " -"exceptions of the group which are not suppressed are re-raised in a new " -"group which is created using the original group's :meth:`~BaseExceptionGroup." -"derive` method." +"If the code within the :keyword:`!with` block raises " +"a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the " +"group. Any exceptions of the group which are not suppressed are re-raised " +"in a new group which is created using the original " +"group's :meth:`~BaseExceptionGroup.derive` method." msgstr "" #: ../../library/contextlib.rst:323 msgid "" -"``suppress`` now supports suppressing exceptions raised as part of a :exc:" -"`BaseExceptionGroup`." +"``suppress`` now supports suppressing exceptions raised as part of " +"a :exc:`BaseExceptionGroup`." msgstr "" #: ../../library/contextlib.rst:329 @@ -512,10 +515,10 @@ msgstr "" #: ../../library/contextlib.rst:335 msgid "" "For example, the output of :func:`help` normally is sent to *sys.stdout*. " -"You can capture that output in a string by redirecting the output to an :" -"class:`io.StringIO` object. The replacement stream is returned from the " -"``__enter__`` method and so is available as the target of the :keyword:" -"`with` statement::" +"You can capture that output in a string by redirecting the output to " +"an :class:`io.StringIO` object. The replacement stream is returned from the " +"``__enter__`` method and so is available as the target of " +"the :keyword:`with` statement::" msgstr "" #: ../../library/contextlib.rst:341 @@ -566,8 +569,8 @@ msgstr "" #: ../../library/contextlib.rst:369 msgid "" -"Similar to :func:`~contextlib.redirect_stdout` but redirecting :data:`sys." -"stderr` to another file or file-like object." +"Similar to :func:`~contextlib.redirect_stdout` but " +"redirecting :data:`sys.stderr` to another file or file-like object." msgstr "" #: ../../library/contextlib.rst:379 @@ -895,15 +898,16 @@ msgstr "" #: ../../library/contextlib.rst:571 msgid "" "As ``__enter__`` is *not* invoked, this method can be used to cover part of " -"an :meth:`~object.__enter__` implementation with a context manager's own :" -"meth:`~object.__exit__` method." +"an :meth:`~object.__enter__` implementation with a context manager's " +"own :meth:`~object.__exit__` method." msgstr "" #: ../../library/contextlib.rst:575 msgid "" "If passed an object that is not a context manager, this method assumes it is " -"a callback with the same signature as a context manager's :meth:`~object." -"__exit__` method and adds it directly to the callback stack." +"a callback with the same signature as a context " +"manager's :meth:`~object.__exit__` method and adds it directly to the " +"callback stack." msgstr "" #: ../../library/contextlib.rst:579 @@ -971,9 +975,10 @@ msgstr "" #: ../../library/contextlib.rst:624 msgid "" -"An :ref:`asynchronous context manager `, similar to :" -"class:`ExitStack`, that supports combining both synchronous and asynchronous " -"context managers, as well as having coroutines for cleanup logic." +"An :ref:`asynchronous context manager `, similar " +"to :class:`ExitStack`, that supports combining both synchronous and " +"asynchronous context managers, as well as having coroutines for cleanup " +"logic." msgstr "" #: ../../library/contextlib.rst:629 @@ -982,37 +987,37 @@ msgid "" "be used instead." msgstr "" -#: ../../library/contextlib.rst:634 +#: ../../library/contextlib.rst:635 msgid "" "Similar to :meth:`ExitStack.enter_context` but expects an asynchronous " "context manager." msgstr "" -#: ../../library/contextlib.rst:637 +#: ../../library/contextlib.rst:638 msgid "" "Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not an " "asynchronous context manager." msgstr "" -#: ../../library/contextlib.rst:643 +#: ../../library/contextlib.rst:644 msgid "" "Similar to :meth:`ExitStack.push` but expects either an asynchronous context " "manager or a coroutine function." msgstr "" -#: ../../library/contextlib.rst:648 +#: ../../library/contextlib.rst:649 msgid "Similar to :meth:`ExitStack.callback` but expects a coroutine function." msgstr "" -#: ../../library/contextlib.rst:652 +#: ../../library/contextlib.rst:654 msgid "Similar to :meth:`ExitStack.close` but properly handles awaitables." msgstr "" -#: ../../library/contextlib.rst:654 +#: ../../library/contextlib.rst:656 msgid "Continuing the example for :func:`asynccontextmanager`::" msgstr "" -#: ../../library/contextlib.rst:656 +#: ../../library/contextlib.rst:658 msgid "" "async with AsyncExitStack() as stack:\n" " connections = [await stack.enter_async_context(get_connection())\n" @@ -1022,21 +1027,21 @@ msgid "" " # later in the list raise an exception." msgstr "" -#: ../../library/contextlib.rst:666 +#: ../../library/contextlib.rst:668 msgid "Examples and Recipes" msgstr "" -#: ../../library/contextlib.rst:668 +#: ../../library/contextlib.rst:670 msgid "" "This section describes some examples and recipes for making effective use of " "the tools provided by :mod:`contextlib`." msgstr "" -#: ../../library/contextlib.rst:673 +#: ../../library/contextlib.rst:675 msgid "Supporting a variable number of context managers" msgstr "" -#: ../../library/contextlib.rst:675 +#: ../../library/contextlib.rst:677 msgid "" "The primary use case for :class:`ExitStack` is the one given in the class " "documentation: supporting a variable number of context managers and other " @@ -1046,7 +1051,7 @@ msgid "" "of the context managers being optional::" msgstr "" -#: ../../library/contextlib.rst:682 +#: ../../library/contextlib.rst:684 msgid "" "with ExitStack() as stack:\n" " for resource in resources:\n" @@ -1057,27 +1062,27 @@ msgid "" " # Perform operations that use the acquired resources" msgstr "" -#: ../../library/contextlib.rst:690 +#: ../../library/contextlib.rst:692 msgid "" "As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` " "statements to manage arbitrary resources that don't natively support the " "context management protocol." msgstr "" -#: ../../library/contextlib.rst:696 +#: ../../library/contextlib.rst:698 msgid "Catching exceptions from ``__enter__`` methods" msgstr "" -#: ../../library/contextlib.rst:698 +#: ../../library/contextlib.rst:700 msgid "" "It is occasionally desirable to catch exceptions from an ``__enter__`` " -"method implementation, *without* inadvertently catching exceptions from the :" -"keyword:`with` statement body or the context manager's ``__exit__`` method. " -"By using :class:`ExitStack` the steps in the context management protocol can " -"be separated slightly in order to allow this::" +"method implementation, *without* inadvertently catching exceptions from " +"the :keyword:`with` statement body or the context manager's ``__exit__`` " +"method. By using :class:`ExitStack` the steps in the context management " +"protocol can be separated slightly in order to allow this::" msgstr "" -#: ../../library/contextlib.rst:704 +#: ../../library/contextlib.rst:706 msgid "" "stack = ExitStack()\n" "try:\n" @@ -1089,36 +1094,36 @@ msgid "" " # Handle normal case" msgstr "" -#: ../../library/contextlib.rst:713 +#: ../../library/contextlib.rst:715 msgid "" "Actually needing to do this is likely to indicate that the underlying API " -"should be providing a direct resource management interface for use with :" -"keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not all " -"APIs are well designed in that regard. When a context manager is the only " -"resource management API provided, then :class:`ExitStack` can make it easier " -"to handle various situations that can't be handled directly in a :keyword:" -"`with` statement." +"should be providing a direct resource management interface for use " +"with :keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not " +"all APIs are well designed in that regard. When a context manager is the " +"only resource management API provided, then :class:`ExitStack` can make it " +"easier to handle various situations that can't be handled directly in " +"a :keyword:`with` statement." msgstr "" -#: ../../library/contextlib.rst:723 +#: ../../library/contextlib.rst:725 msgid "Cleaning up in an ``__enter__`` implementation" msgstr "" -#: ../../library/contextlib.rst:725 +#: ../../library/contextlib.rst:727 msgid "" "As noted in the documentation of :meth:`ExitStack.push`, this method can be " -"useful in cleaning up an already allocated resource if later steps in the :" -"meth:`~object.__enter__` implementation fail." +"useful in cleaning up an already allocated resource if later steps in " +"the :meth:`~object.__enter__` implementation fail." msgstr "" -#: ../../library/contextlib.rst:729 +#: ../../library/contextlib.rst:731 msgid "" "Here's an example of doing this for a context manager that accepts resource " "acquisition and release functions, along with an optional validation " "function, and maps them to the context management protocol::" msgstr "" -#: ../../library/contextlib.rst:733 +#: ../../library/contextlib.rst:735 msgid "" "from contextlib import contextmanager, AbstractContextManager, ExitStack\n" "\n" @@ -1156,11 +1161,11 @@ msgid "" " self.release_resource()" msgstr "" -#: ../../library/contextlib.rst:769 +#: ../../library/contextlib.rst:771 msgid "Replacing any use of ``try-finally`` and flag variables" msgstr "" -#: ../../library/contextlib.rst:771 +#: ../../library/contextlib.rst:773 msgid "" "A pattern you will sometimes see is a ``try-finally`` statement with a flag " "variable to indicate whether or not the body of the ``finally`` clause " @@ -1168,7 +1173,7 @@ msgid "" "by using an ``except`` clause instead), it looks something like this::" msgstr "" -#: ../../library/contextlib.rst:776 +#: ../../library/contextlib.rst:778 msgid "" "cleanup_needed = True\n" "try:\n" @@ -1188,21 +1193,21 @@ msgstr "" " if cleanup_needed:\n" " cleanup_resources()" -#: ../../library/contextlib.rst:785 +#: ../../library/contextlib.rst:787 msgid "" "As with any ``try`` statement based code, this can cause problems for " "development and review, because the setup code and the cleanup code can end " "up being separated by arbitrarily long sections of code." msgstr "" -#: ../../library/contextlib.rst:789 +#: ../../library/contextlib.rst:791 msgid "" ":class:`ExitStack` makes it possible to instead register a callback for " "execution at the end of a ``with`` statement, and then later decide to skip " "executing that callback::" msgstr "" -#: ../../library/contextlib.rst:793 +#: ../../library/contextlib.rst:795 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1220,19 +1225,19 @@ msgstr "" " if result:\n" " stack.pop_all()" -#: ../../library/contextlib.rst:801 +#: ../../library/contextlib.rst:803 msgid "" "This allows the intended cleanup behaviour to be made explicit up front, " "rather than requiring a separate flag variable." msgstr "" -#: ../../library/contextlib.rst:804 +#: ../../library/contextlib.rst:806 msgid "" "If a particular application uses this pattern a lot, it can be simplified " "even further by means of a small helper class::" msgstr "" -#: ../../library/contextlib.rst:807 +#: ../../library/contextlib.rst:809 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1264,14 +1269,14 @@ msgstr "" " if result:\n" " cb.cancel()" -#: ../../library/contextlib.rst:822 +#: ../../library/contextlib.rst:824 msgid "" "If the resource cleanup isn't already neatly bundled into a standalone " -"function, then it is still possible to use the decorator form of :meth:" -"`ExitStack.callback` to declare the resource cleanup in advance::" +"function, then it is still possible to use the decorator form " +"of :meth:`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" -#: ../../library/contextlib.rst:827 +#: ../../library/contextlib.rst:829 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1293,24 +1298,24 @@ msgstr "" " if result:\n" " stack.pop_all()" -#: ../../library/contextlib.rst:837 +#: ../../library/contextlib.rst:839 msgid "" "Due to the way the decorator protocol works, a callback function declared " "this way cannot take any parameters. Instead, any resources to be released " "must be accessed as closure variables." msgstr "" -#: ../../library/contextlib.rst:843 +#: ../../library/contextlib.rst:845 msgid "Using a context manager as a function decorator" msgstr "" -#: ../../library/contextlib.rst:845 +#: ../../library/contextlib.rst:847 msgid "" ":class:`ContextDecorator` makes it possible to use a context manager in both " "an ordinary ``with`` statement and also as a function decorator." msgstr "" -#: ../../library/contextlib.rst:848 +#: ../../library/contextlib.rst:850 msgid "" "For example, it is sometimes useful to wrap functions or groups of " "statements with a logger that can track the time of entry and time of exit. " @@ -1319,7 +1324,7 @@ msgid "" "in a single definition::" msgstr "" -#: ../../library/contextlib.rst:854 +#: ../../library/contextlib.rst:856 msgid "" "from contextlib import ContextDecorator\n" "import logging\n" @@ -1351,11 +1356,11 @@ msgstr "" " def __exit__(self, exc_type, exc, exc_tb):\n" " logging.info('Exiting: %s', self.name)" -#: ../../library/contextlib.rst:869 +#: ../../library/contextlib.rst:871 msgid "Instances of this class can be used as both a context manager::" msgstr "" -#: ../../library/contextlib.rst:871 +#: ../../library/contextlib.rst:873 msgid "" "with track_entry_and_exit('widget loader'):\n" " print('Some time consuming activity goes here')\n" @@ -1365,11 +1370,11 @@ msgstr "" " print('Some time consuming activity goes here')\n" " load_widget()" -#: ../../library/contextlib.rst:875 +#: ../../library/contextlib.rst:877 msgid "And also as a function decorator::" msgstr "" -#: ../../library/contextlib.rst:877 +#: ../../library/contextlib.rst:879 msgid "" "@track_entry_and_exit('widget loader')\n" "def activity():\n" @@ -1381,29 +1386,29 @@ msgstr "" " print('Some time consuming activity goes here')\n" " load_widget()" -#: ../../library/contextlib.rst:882 +#: ../../library/contextlib.rst:884 msgid "" "Note that there is one additional limitation when using context managers as " -"function decorators: there's no way to access the return value of :meth:" -"`~object.__enter__`. If that value is needed, then it is still necessary to " -"use an explicit ``with`` statement." +"function decorators: there's no way to access the return value " +"of :meth:`~object.__enter__`. If that value is needed, then it is still " +"necessary to use an explicit ``with`` statement." msgstr "" -#: ../../library/contextlib.rst:889 +#: ../../library/contextlib.rst:891 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../library/contextlib.rst:890 +#: ../../library/contextlib.rst:892 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../library/contextlib.rst:896 +#: ../../library/contextlib.rst:898 msgid "Single use, reusable and reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:898 +#: ../../library/contextlib.rst:900 msgid "" "Most context managers are written in a way that means they can only be used " "effectively in a :keyword:`with` statement once. These single use context " @@ -1411,28 +1416,28 @@ msgid "" "them a second time will trigger an exception or otherwise not work correctly." msgstr "" -#: ../../library/contextlib.rst:904 +#: ../../library/contextlib.rst:906 msgid "" "This common limitation means that it is generally advisable to create " "context managers directly in the header of the :keyword:`with` statement " "where they are used (as shown in all of the usage examples above)." msgstr "" -#: ../../library/contextlib.rst:908 +#: ../../library/contextlib.rst:910 msgid "" "Files are an example of effectively single use context managers, since the " "first :keyword:`with` statement will close the file, preventing any further " "IO operations using that file object." msgstr "" -#: ../../library/contextlib.rst:912 +#: ../../library/contextlib.rst:914 msgid "" "Context managers created using :func:`contextmanager` are also single use " "context managers, and will complain about the underlying generator failing " "to yield if an attempt is made to use them a second time::" msgstr "" -#: ../../library/contextlib.rst:916 +#: ../../library/contextlib.rst:918 msgid "" ">>> from contextlib import contextmanager\n" ">>> @contextmanager\n" @@ -1474,11 +1479,11 @@ msgstr "" " ...\n" "RuntimeError: generator didn't yield" -#: ../../library/contextlib.rst:940 +#: ../../library/contextlib.rst:942 msgid "Reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:942 +#: ../../library/contextlib.rst:944 msgid "" "More sophisticated context managers may be \"reentrant\". These context " "managers can not only be used in multiple :keyword:`with` statements, but " @@ -1486,14 +1491,14 @@ msgid "" "the same context manager." msgstr "" -#: ../../library/contextlib.rst:947 +#: ../../library/contextlib.rst:949 msgid "" ":class:`threading.RLock` is an example of a reentrant context manager, as " "are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a " "very simple example of reentrant use::" msgstr "" -#: ../../library/contextlib.rst:951 +#: ../../library/contextlib.rst:953 msgid "" ">>> from contextlib import redirect_stdout\n" ">>> from io import StringIO\n" @@ -1525,26 +1530,26 @@ msgstr "" "This is written to the stream rather than stdout\n" "This is also written to the stream" -#: ../../library/contextlib.rst:966 +#: ../../library/contextlib.rst:968 msgid "" "Real world examples of reentrancy are more likely to involve multiple " "functions calling each other and hence be far more complicated than this " "example." msgstr "" -#: ../../library/contextlib.rst:970 +#: ../../library/contextlib.rst:972 msgid "" "Note also that being reentrant is *not* the same thing as being thread " "safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " -"as it makes a global modification to the system state by binding :data:`sys." -"stdout` to a different stream." +"as it makes a global modification to the system state by " +"binding :data:`sys.stdout` to a different stream." msgstr "" -#: ../../library/contextlib.rst:979 +#: ../../library/contextlib.rst:981 msgid "Reusable context managers" msgstr "" -#: ../../library/contextlib.rst:981 +#: ../../library/contextlib.rst:983 msgid "" "Distinct from both single use and reentrant context managers are " "\"reusable\" context managers (or, to be completely explicit, \"reusable, " @@ -1554,21 +1559,22 @@ msgid "" "manager instance has already been used in a containing with statement." msgstr "" -#: ../../library/contextlib.rst:988 +#: ../../library/contextlib.rst:990 msgid "" ":class:`threading.Lock` is an example of a reusable, but not reentrant, " -"context manager (for a reentrant lock, it is necessary to use :class:" -"`threading.RLock` instead)." +"context manager (for a reentrant lock, it is necessary to " +"use :class:`threading.RLock` instead)." msgstr "" -#: ../../library/contextlib.rst:992 +#: ../../library/contextlib.rst:994 msgid "" -"Another example of a reusable, but not reentrant, context manager is :class:" -"`ExitStack`, as it invokes *all* currently registered callbacks when leaving " -"any with statement, regardless of where those callbacks were added::" +"Another example of a reusable, but not reentrant, context manager " +"is :class:`ExitStack`, as it invokes *all* currently registered callbacks " +"when leaving any with statement, regardless of where those callbacks were " +"added::" msgstr "" -#: ../../library/contextlib.rst:997 +#: ../../library/contextlib.rst:999 msgid "" ">>> from contextlib import ExitStack\n" ">>> stack = ExitStack()\n" @@ -1622,7 +1628,7 @@ msgstr "" "Callback: from outer context\n" "Leaving outer context" -#: ../../library/contextlib.rst:1023 +#: ../../library/contextlib.rst:1025 msgid "" "As the output from the example shows, reusing a single stack object across " "multiple with statements works correctly, but attempting to nest them will " @@ -1630,13 +1636,13 @@ msgid "" "which is unlikely to be desirable behaviour." msgstr "" -#: ../../library/contextlib.rst:1028 +#: ../../library/contextlib.rst:1030 msgid "" "Using separate :class:`ExitStack` instances instead of reusing a single " "instance avoids that problem::" msgstr "" -#: ../../library/contextlib.rst:1031 +#: ../../library/contextlib.rst:1033 msgid "" ">>> from contextlib import ExitStack\n" ">>> with ExitStack() as outer_stack:\n" diff --git a/library/copy.po b/library/copy.po index 71812c86b4..b0b7a3ac26 100644 --- a/library/copy.po +++ b/library/copy.po @@ -46,14 +46,12 @@ msgid "Interface summary:" msgstr "介面摘要:" #: ../../library/copy.rst:22 -#, fuzzy msgid "Return a shallow copy of *obj*." -msgstr "回傳 *x* 的淺層複製。" +msgstr "回傳 *obj* 的淺層複製。" #: ../../library/copy.rst:27 -#, fuzzy msgid "Return a deep copy of *obj*." -msgstr "回傳 *x* 的深層複製。" +msgstr "回傳 *obj* 的深層複製。" #: ../../library/copy.rst:32 msgid "" @@ -118,7 +116,7 @@ msgstr ":func:`deepcopy` 函式用以下方式避免了這些問題:" msgid "" "keeping a ``memo`` dictionary of objects already copied during the current " "copying pass; and" -msgstr "保留在當前複製過程中已複製的物件的 ``memo`` 字典;以及" +msgstr "保留在目前複製過程中已複製的物件的 ``memo`` 字典;以及" #: ../../library/copy.rst:67 msgid "" @@ -131,8 +129,8 @@ msgid "" "This module does not copy types like module, method, stack trace, stack " "frame, file, socket, window, or any similar types. It does \"copy\" " "functions and classes (shallow and deeply), by returning the original object " -"unchanged; this is compatible with the way these are treated by the :mod:" -"`pickle` module." +"unchanged; this is compatible with the way these are treated by " +"the :mod:`pickle` module." msgstr "" "該模組不複製模組、方法、堆疊追蹤(stack trace)、堆疊框(stack frame)、檔" "案、socket、視窗、陣列以及任何類似的型別。它透過不變更原始物件並將其回傳來" @@ -180,19 +178,19 @@ msgid "" "with the component as first argument and the *memo* dictionary as second " "argument. The *memo* dictionary should be treated as an opaque object." msgstr "" -"想要為一個類別定義它自己的複製操作實作,可以透過定義特殊方法 :meth:" -"`__copy__` 和 :meth:`__deepcopy__`。呼叫前者以實現淺層複製操作;不必傳入額外" -"引數。呼叫後者以實現深層複製操作;它應傳入一個引數,即 ``memo`` 字典。如果 :" -"meth:`__deepcopy__` 實現需要建立一個元件的深層複製,它應當呼叫 :func:" -"`deepcopy` 函式並以該元件作為第一個引數、以該 memo 字典作為第二個引數。memo " -"字典應當被當作不透明物件 (opaque object) 來處理。" +"想要為一個類別定義它自己的複製操作實作,可以透過定義特殊方" +"法 :meth:`__copy__` 和 :meth:`__deepcopy__`。呼叫前者以實現淺層複製操作;不必" +"傳入額外引數。呼叫後者以實現深層複製操作;它應傳入一個引數,即 ``memo`` 字" +"典。如果 :meth:`__deepcopy__` 實現需要建立一個元件的深層複製,它應當呼" +"叫 :func:`~copy.deepcopy` 函式並以該元件作為第一個引數、以該 *memo* 字典作為" +"第二個引數。*memo* 字典應當被當作不透明物件 (opaque object) 來處理。" #: ../../library/copy.rst:114 msgid "" -"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` and :" -"func:`~copy.deepcopy`, and only supports named tuples created by :func:" -"`~collections.namedtuple`, :mod:`dataclasses`, and other classes which " -"define method :meth:`~object.__replace__`." +"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` " +"and :func:`~copy.deepcopy`, and only supports named tuples created " +"by :func:`~collections.namedtuple`, :mod:`dataclasses`, and other classes " +"which define method :meth:`~object.__replace__`." msgstr "" #: ../../library/copy.rst:122 @@ -230,6 +228,5 @@ msgid "__deepcopy__() (copy protocol)" msgstr "__deepcopy__() (複製協定)" #: ../../library/copy.rst:111 -#, fuzzy msgid "__replace__() (replace protocol)" -msgstr "__deepcopy__() (複製協定)" +msgstr "__replace__() (取代協定)" diff --git a/library/csv.po b/library/csv.po index 05f0cd536c..106f364d77 100644 --- a/library/csv.po +++ b/library/csv.po @@ -233,7 +233,7 @@ msgid "" "Returns the current maximum field size allowed by the parser. If *new_limit* " "is given, this becomes the new limit." msgstr "" -"回傳當前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" +"回傳目前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" "成新的最大字串大小。" #: ../../library/csv.rst:148 @@ -486,7 +486,7 @@ msgid "" "Twenty rows after the first row are sampled; if more than half of columns + " "rows meet the criteria, :const:`True` is returned." msgstr "" -"對第一列之後的二十個列進行採樣;如果超過一半的行及列滿足條件,則返回 :const:" +"對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返回 :const:" "`True`。" #: ../../library/csv.rst:302 @@ -549,8 +549,8 @@ msgid "" "character. If *escapechar* is not set, the writer will raise :exc:`Error` " "if any characters that require escaping are encountered." msgstr "" -"引導 :class:`writer` 物件不得引用欄位。當前的 *分隔符號* 出現在輸出資料時,在" -"他之前的字元是當前的\\*逸出字元 (escape character)*。如果沒有設定\\*逸出字元" +"引導 :class:`writer` 物件不得引用欄位。目前的 *分隔符號* 出現在輸出資料時,在" +"他之前的字元是目前的\\*逸出字元 (escape character)*。如果沒有設定\\*逸出字元" "*\\,若遇到任何字元需要逸出,寫入器則會引發 :exc:`Error` 。" #: ../../library/csv.rst:344 @@ -742,7 +742,7 @@ msgid "" "should call this as ``next(reader)``." msgstr "" "回傳一個列表為讀入器的可疊代物件的下一列內容(若該物件是由 :func:`reader` 回" -"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據當前的 :class:" +"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前的 :class:" "`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" #: ../../library/csv.rst:474 @@ -799,7 +799,7 @@ msgid "" "to the current :class:`Dialect`. Return the return value of the call to the " "*write* method of the underlying file object." msgstr "" -"將參數 *row* 寫入至寫入器的檔案物件中,並依照當前的 :class:`Dialect` 進行格式" +"將參數 *row* 寫入至寫入器的檔案物件中,並依照目前的 :class:`Dialect` 進行格式" "化。回傳下層檔案物件 *write* 方法的回傳值。" #: ../../library/csv.rst:515 @@ -813,7 +813,7 @@ msgid "" "dialect." msgstr "" "將 *rows* 中所有元素(為上述的一個可疊代的 *row* 物件)寫入至寫入器的檔案物件" -"中,並依照當前的 dialect 進行格式化。" +"中,並依照目前的 dialect 進行格式化。" #: ../../library/csv.rst:524 msgid "Writer objects have the following public attribute:" @@ -834,7 +834,7 @@ msgid "" "return value of the :meth:`csvwriter.writerow` call used internally." msgstr "" "將具欄位標題的一列(於建構函式 (constructor) 中指定的)寫入至寫入器的檔案物件" -"中,並依照當前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " +"中,並依照目前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " "的回傳值。" #: ../../library/csv.rst:542 diff --git a/library/ctypes.po b/library/ctypes.po index 233c1e14ac..86164ffb4f 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,9 +47,10 @@ msgstr "" #: ../../library/ctypes.rst:27 msgid "" "Note: Some code samples reference the ctypes :class:`c_int` type. On " -"platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:" -"`c_long`. So, you should not be confused if :class:`c_long` is printed if " -"you would expect :class:`c_int` --- they are actually the same type." +"platforms where ``sizeof(long) == sizeof(int)`` it is an alias " +"to :class:`c_long`. So, you should not be confused if :class:`c_long` is " +"printed if you would expect :class:`c_int` --- they are actually the same " +"type." msgstr "" #: ../../library/ctypes.rst:35 @@ -76,8 +76,8 @@ msgstr "" #: ../../library/ctypes.rst:48 msgid "" -"Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" -"exc:`OSError`." +"Windows errors used to raise :exc:`WindowsError`, which is now an alias " +"of :exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:53 @@ -90,19 +90,19 @@ msgstr "" #: ../../library/ctypes.rst:57 msgid "" ">>> from ctypes import *\n" -">>> print(windll.kernel32) \n" +">>> print(windll.kernel32)\n" "\n" -">>> print(cdll.msvcrt) \n" +">>> print(cdll.msvcrt)\n" "\n" -">>> libc = cdll.msvcrt \n" +">>> libc = cdll.msvcrt\n" ">>>" msgstr "" ">>> from ctypes import *\n" -">>> print(windll.kernel32) \n" +">>> print(windll.kernel32)\n" "\n" -">>> print(cdll.msvcrt) \n" +">>> print(cdll.msvcrt)\n" "\n" -">>> libc = cdll.msvcrt \n" +">>> libc = cdll.msvcrt\n" ">>>" #: ../../library/ctypes.rst:65 @@ -128,17 +128,17 @@ msgstr "" #: ../../library/ctypes.rst:79 msgid "" -">>> cdll.LoadLibrary(\"libc.so.6\") \n" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" -">>> libc = CDLL(\"libc.so.6\") \n" -">>> libc \n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" "\n" ">>>" msgstr "" -">>> cdll.LoadLibrary(\"libc.so.6\") \n" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" -">>> libc = CDLL(\"libc.so.6\") \n" -">>> libc \n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" "\n" ">>>" @@ -154,9 +154,9 @@ msgstr "" msgid "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.GetModuleHandleA) \n" +">>> print(windll.kernel32.GetModuleHandleA)\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.MyOwnFunction) \n" +">>> print(windll.kernel32.MyOwnFunction)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 239, in __getattr__\n" @@ -166,9 +166,9 @@ msgid "" msgstr "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.GetModuleHandleA) \n" +">>> print(windll.kernel32.GetModuleHandleA)\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.MyOwnFunction) \n" +">>> print(windll.kernel32.MyOwnFunction)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 239, in __getattr__\n" @@ -209,17 +209,17 @@ msgstr "" #: ../../library/ctypes.rst:125 msgid "" "Sometimes, dlls export functions with names which aren't valid Python " -"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" -"`getattr` to retrieve the function::" +"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to " +"use :func:`getattr` to retrieve the function::" msgstr "" #: ../../library/ctypes.rst:129 msgid "" -">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\") \n" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" msgstr "" -">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\") \n" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" @@ -232,9 +232,9 @@ msgstr "" #: ../../library/ctypes.rst:136 msgid "" -">>> cdll.kernel32[1] \n" +">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" -">>> cdll.kernel32[0] \n" +">>> cdll.kernel32[0]\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 310, in __getitem__\n" @@ -242,9 +242,9 @@ msgid "" "AttributeError: function ordinal 0 not found\n" ">>>" msgstr "" -">>> cdll.kernel32[1] \n" +">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" -">>> cdll.kernel32[0] \n" +">>> cdll.kernel32[0]\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 310, in __getitem__\n" @@ -265,10 +265,10 @@ msgstr "" #: ../../library/ctypes.rst:155 msgid "" -">>> print(libc.rand()) \n" +">>> print(libc.rand())\n" "1804289383" msgstr "" -">>> print(libc.rand()) \n" +">>> print(libc.rand())\n" "1804289383" #: ../../library/ctypes.rst:158 @@ -280,11 +280,11 @@ msgstr "" #: ../../library/ctypes.rst:161 msgid "" -">>> print(hex(windll.kernel32.GetModuleHandleA(None))) \n" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" msgstr "" -">>> print(hex(windll.kernel32.GetModuleHandleA(None))) \n" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" @@ -296,28 +296,28 @@ msgstr "" #: ../../library/ctypes.rst:168 msgid "" -">>> cdll.kernel32.GetModuleHandleA(None) \n" +">>> cdll.kernel32.GetModuleHandleA(None)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with not enough arguments (4 bytes " "missing)\n" ">>>\n" "\n" -">>> windll.msvcrt.printf(b\"spam\") \n" +">>> windll.msvcrt.printf(b\"spam\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with too many arguments (4 bytes in " "excess)\n" ">>>" msgstr "" -">>> cdll.kernel32.GetModuleHandleA(None) \n" +">>> cdll.kernel32.GetModuleHandleA(None)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with not enough arguments (4 bytes " "missing)\n" ">>>\n" "\n" -">>> windll.msvcrt.printf(b\"spam\") \n" +">>> windll.msvcrt.printf(b\"spam\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with too many arguments (4 bytes in " @@ -339,13 +339,13 @@ msgstr "" #: ../../library/ctypes.rst:187 msgid "" -">>> windll.kernel32.GetModuleHandleA(32) \n" +">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "OSError: exception: access violation reading 0x00000020\n" ">>>" msgstr "" -">>> windll.kernel32.GetModuleHandleA(32) \n" +">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "OSError: exception: access violation reading 0x00000020\n" @@ -364,10 +364,10 @@ msgid "" "``None``, integers, bytes objects and (unicode) strings are the only native " "Python objects that can directly be used as parameters in these function " "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " -"are passed as pointer to the memory block that contains their data (:c:expr:" -"`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platform's default C :c:expr:`int` type, their value is masked to fit into " -"the C type." +"are passed as pointer to the memory block that contains their data " +"(:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as " +"the platform's default C :c:expr:`int` type, their value is masked to fit " +"into the C type." msgstr "" #: ../../library/ctypes.rst:205 @@ -664,10 +664,10 @@ msgstr "" #: ../../library/ctypes.rst:292 msgid "" -"Assigning a new value to instances of the pointer types :class:`c_char_p`, :" -"class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they " -"point to, *not the contents* of the memory block (of course not, because " -"Python bytes objects are immutable)::" +"Assigning a new value to instances of the pointer " +"types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes " +"the *memory location* they point to, *not the contents* of the memory block " +"(of course not, because Python string objects are immutable)::" msgstr "" #: ../../library/ctypes.rst:297 @@ -691,11 +691,11 @@ msgstr "" #: ../../library/ctypes.rst:312 msgid "" "You should be careful, however, not to pass them to functions expecting " -"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :" -"func:`create_string_buffer` function which creates these in various ways. " -"The current memory block contents can be accessed (or changed) with the " -"``raw`` property; if you want to access it as NUL terminated string, use the " -"``value`` property::" +"pointers to mutable memory. If you need mutable memory blocks, ctypes has " +"a :func:`create_string_buffer` function which creates these in various " +"ways. The current memory block contents can be accessed (or changed) with " +"the ``raw`` property; if you want to access it as NUL terminated string, use " +"the ``value`` property::" msgstr "" #: ../../library/ctypes.rst:319 @@ -734,9 +734,9 @@ msgstr "" #: ../../library/ctypes.rst:347 msgid "" -"Note that printf prints to the real standard output channel, *not* to :data:" -"`sys.stdout`, so these examples will only work at the console prompt, not " -"from within *IDLE* or *PythonWin*::" +"Note that printf prints to the real standard output channel, *not* " +"to :data:`sys.stdout`, so these examples will only work at the console " +"prompt, not from within *IDLE* or *PythonWin*::" msgstr "" #: ../../library/ctypes.rst:351 @@ -931,13 +931,13 @@ msgstr "" msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" -"`~_CData.from_param` class method receives the Python object passed to the " -"function call, it should do a typecheck or whatever is needed to make sure " -"this object is acceptable, and then return the object itself, its :attr:`!" -"_as_parameter_` attribute, or whatever you want to pass as the C function " -"argument in this case. Again, the result should be an integer, string, " -"bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. " +"The :meth:`~_CData.from_param` class method receives the Python object " +"passed to the function call, it should do a typecheck or whatever is needed " +"to make sure this object is acceptable, and then return the object itself, " +"its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C " +"function argument in this case. Again, the result should be an integer, " +"string, bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" "_as_parameter_` attribute." msgstr "" @@ -954,9 +954,10 @@ msgstr "" #: ../../library/ctypes.rst:482 msgid "" -"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:" -"type:`time_t` might be of a different type than the default return type :c:" -"expr:`int`, you should specify the :attr:`!restype` attribute::" +"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. " +"Because :c:type:`time_t` might be of a different type than the default " +"return type :c:expr:`int`, you should specify the :attr:`!restype` " +"attribute::" msgstr "" #: ../../library/ctypes.rst:486 @@ -979,10 +980,10 @@ msgstr "" #: ../../library/ctypes.rst:494 msgid "" -">>> print(libc.time(None)) \n" +">>> print(libc.time(None))\n" "1150640792" msgstr "" -">>> print(libc.time(None)) \n" +">>> print(libc.time(None))\n" "1150640792" #: ../../library/ctypes.rst:497 @@ -994,7 +995,7 @@ msgstr "" #: ../../library/ctypes.rst:500 msgid "" ">>> strchr = libc.strchr\n" -">>> strchr(b\"abcdef\", ord(\"d\")) \n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" "8059983\n" ">>> strchr.restype = c_char_p # c_char_p is a pointer to a string\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -1004,7 +1005,7 @@ msgid "" ">>>" msgstr "" ">>> strchr = libc.strchr\n" -">>> strchr(b\"abcdef\", ord(\"d\")) \n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" "8059983\n" ">>> strchr.restype = c_char_p # c_char_p 一個字串的指標\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -1062,34 +1063,34 @@ msgstr "" #: ../../library/ctypes.rst:535 msgid "" -">>> GetModuleHandle = windll.kernel32.GetModuleHandleA \n" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" "... if value == 0:\n" "... raise WinError()\n" "... return value\n" "...\n" ">>>\n" -">>> GetModuleHandle.restype = ValidHandle \n" -">>> GetModuleHandle(None) \n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" "486539264\n" -">>> GetModuleHandle(\"something silly\") \n" +">>> GetModuleHandle(\"something silly\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"\", line 3, in ValidHandle\n" "OSError: [Errno 126] The specified module could not be found.\n" ">>>" msgstr "" -">>> GetModuleHandle = windll.kernel32.GetModuleHandleA \n" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" "... if value == 0:\n" "... raise WinError()\n" "... return value\n" "...\n" ">>>\n" -">>> GetModuleHandle.restype = ValidHandle \n" -">>> GetModuleHandle(None) \n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" "486539264\n" -">>> GetModuleHandle(\"something silly\") \n" +">>> GetModuleHandle(\"something silly\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"\", line 3, in ValidHandle\n" @@ -1126,10 +1127,10 @@ msgstr "" #: ../../library/ctypes.rst:571 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " -"parameters by reference. The same effect can be achieved with the :func:" -"`pointer` function, although :func:`pointer` does a lot more work since it " -"constructs a real pointer object, so it is faster to use :func:`byref` if " -"you don't need the pointer object in Python itself::" +"parameters by reference. The same effect can be achieved with " +"the :func:`pointer` function, although :func:`pointer` does a lot more work " +"since it constructs a real pointer object, so it is faster to " +"use :func:`byref` if you don't need the pointer object in Python itself::" msgstr "" #: ../../library/ctypes.rst:577 @@ -1164,11 +1165,11 @@ msgstr "" #: ../../library/ctypes.rst:595 msgid "" -"Structures and unions must derive from the :class:`Structure` and :class:" -"`Union` base classes which are defined in the :mod:`ctypes` module. Each " -"subclass must define a :attr:`~Structure._fields_` attribute. :attr:`!" -"_fields_` must be a list of *2-tuples*, containing a *field name* and a " -"*field type*." +"Structures and unions must derive from the :class:`Structure` " +"and :class:`Union` base classes which are defined in the :mod:`ctypes` " +"module. Each subclass must define a :attr:`~Structure._fields_` " +"attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a " +"*field name* and a *field type*." msgstr "" #: ../../library/ctypes.rst:600 @@ -1305,23 +1306,23 @@ msgstr "" #: ../../library/ctypes.rst:667 msgid "" "By default, Structure and Union fields are aligned in the same way the C " -"compiler does it. It is possible to override this behavior by specifying a :" -"attr:`~Structure._pack_` class attribute in the subclass definition. This " +"compiler does it. It is possible to override this behavior by specifying " +"a :attr:`~Structure._pack_` class attribute in the subclass definition. This " "must be set to a positive integer and specifies the maximum alignment for " "the fields. This is what ``#pragma pack(n)`` also does in MSVC. It is also " "possible to set a minimum alignment for how the subclass itself is packed in " "the same way ``#pragma align(n)`` works in MSVC. This can be achieved by " -"specifying a ::attr:`~Structure._align_` class attribute in the subclass " +"specifying a :attr:`~Structure._align_` class attribute in the subclass " "definition." msgstr "" #: ../../library/ctypes.rst:677 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " -"build structures with non-native byte order, you can use one of the :class:" -"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:" -"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These " -"classes cannot contain pointer fields." +"build structures with non-native byte order, you can use one of " +"the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, " +"and :class:`LittleEndianUnion` base classes. These classes cannot contain " +"pointer fields." msgstr "" #: ../../library/ctypes.rst:687 @@ -1460,8 +1461,8 @@ msgstr "" #: ../../library/ctypes.rst:759 msgid "" -"Pointer instances are created by calling the :func:`pointer` function on a :" -"mod:`ctypes` type::" +"Pointer instances are created by calling the :func:`pointer` function on " +"a :mod:`ctypes` type::" msgstr "" #: ../../library/ctypes.rst:762 @@ -1846,8 +1847,8 @@ msgstr "" #: ../../library/ctypes.rst:958 msgid "" "because the new ``class cell`` is not available in the class statement " -"itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" -"`~Structure._fields_` attribute later, after the class statement::" +"itself. In :mod:`ctypes`, we can define the ``cell`` class and set " +"the :attr:`~Structure._fields_` attribute later, after the class statement::" msgstr "" #: ../../library/ctypes.rst:962 @@ -2009,7 +2010,7 @@ msgstr "結果為: ::" #: ../../library/ctypes.rst:1043 msgid "" -">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2017,7 +2018,7 @@ msgid "" "py_cmp_func 1 7\n" ">>>" msgstr "" -">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2036,7 +2037,7 @@ msgid "" "... return a[0] - b[0]\n" "...\n" ">>>\n" -">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) \n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2049,7 +2050,7 @@ msgstr "" "... return a[0] - b[0]\n" "...\n" ">>>\n" -">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) \n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2606,13 +2607,14 @@ msgstr "" #: ../../library/ctypes.rst:1376 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " -"exists. When a dependent DLL of the loaded DLL is not found, a :exc:" -"`OSError` error is raised with the message *\"[WinError 126] The specified " -"module could not be found\".* This error message does not contain the name " -"of the missing DLL because the Windows API does not return this information " -"making this error hard to diagnose. To resolve this error and determine " -"which DLL is not found, you need to find the list of dependent DLLs and " -"determine which one is not found using Windows debugging and tracing tools." +"exists. When a dependent DLL of the loaded DLL is not found, " +"a :exc:`OSError` error is raised with the message *\"[WinError 126] The " +"specified module could not be found\".* This error message does not contain " +"the name of the missing DLL because the Windows API does not return this " +"information making this error hard to diagnose. To resolve this error and " +"determine which DLL is not found, you need to find the list of dependent " +"DLLs and determine which one is not found using Windows debugging and " +"tracing tools." msgstr "" #: ../../library/ctypes.rst:1388 ../../library/ctypes.rst:1413 @@ -2648,8 +2650,8 @@ msgstr "" #: ../../library/ctypes.rst:1407 msgid "" -":exc:`WindowsError` used to be raised, which is now an alias of :exc:" -"`OSError`." +":exc:`WindowsError` used to be raised, which is now an alias " +"of :exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:1418 @@ -2698,11 +2700,12 @@ msgstr "" #: ../../library/ctypes.rst:1458 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " -"allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the system's :data:`errno` " -"variable; if you call foreign functions created with ``use_errno=True`` then " -"the :data:`errno` value before the function call is swapped with the ctypes " -"private copy, the same happens immediately after the function call." +"allows accessing the system :data:`errno` error number in a safe " +"way. :mod:`ctypes` maintains a thread-local copy of the " +"system's :data:`errno` variable; if you call foreign functions created with " +"``use_errno=True`` then the :data:`errno` value before the function call is " +"swapped with the ctypes private copy, the same happens immediately after the " +"function call." msgstr "" #: ../../library/ctypes.rst:1465 @@ -2715,10 +2718,11 @@ msgstr "" #: ../../library/ctypes.rst:1469 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " -"for the Windows error code which is managed by the :func:`GetLastError` and :" -"func:`!SetLastError` Windows API functions; :func:`ctypes.get_last_error` " -"and :func:`ctypes.set_last_error` are used to request and change the ctypes " -"private copy of the windows error code." +"for the Windows error code which is managed by the :func:`GetLastError` " +"and :func:`!SetLastError` Windows API " +"functions; :func:`ctypes.get_last_error` and :func:`ctypes.set_last_error` " +"are used to request and change the ctypes private copy of the windows error " +"code." msgstr "" #: ../../library/ctypes.rst:1475 @@ -2802,8 +2806,8 @@ msgstr "" #: ../../library/ctypes.rst:1540 msgid "" -"Class which loads shared libraries. *dlltype* should be one of the :class:" -"`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." +"Class which loads shared libraries. *dlltype* should be one of " +"the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" #: ../../library/ctypes.rst:1543 @@ -2849,9 +2853,9 @@ msgstr "" #: ../../library/ctypes.rst:1589 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " -"attributes. Note that all these functions are assumed to return C :c:expr:" -"`int`, which is of course not always the truth, so you have to assign the " -"correct :attr:`!restype` attribute to use these functions." +"attributes. Note that all these functions are assumed to return " +"C :c:expr:`int`, which is of course not always the truth, so you have to " +"assign the correct :attr:`!restype` attribute to use these functions." msgstr "" #: ../../library/ctypes.rst:1594 ../../library/ctypes.rst:1596 @@ -2863,9 +2867,9 @@ msgstr "" #: ../../library/ctypes.rst:1600 ../../library/ctypes.rst:1602 msgid "" -"Accessing a function on a loaded library raises an auditing event ``ctypes." -"dlsym`` with arguments ``library`` (the library object) and ``name`` (the " -"symbol's name as a string or integer)." +"Accessing a function on a loaded library raises an auditing event " +"``ctypes.dlsym`` with arguments ``library`` (the library object) and " +"``name`` (the symbol's name as a string or integer)." msgstr "" #: ../../library/ctypes.rst:1606 ../../library/ctypes.rst:1608 @@ -2947,12 +2951,12 @@ msgstr "" #: ../../library/ctypes.rst:1664 msgid "" -"When a foreign function is called, each actual argument is passed to the :" -"meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " -"tuple, this method allows adapting the actual argument to an object that the " -"foreign function accepts. For example, a :class:`c_char_p` item in the :" -"attr:`argtypes` tuple will convert a string passed as argument into a bytes " -"object using ctypes conversion rules." +"When a foreign function is called, each actual argument is passed to " +"the :meth:`~_CData.from_param` class method of the items in " +"the :attr:`argtypes` tuple, this method allows adapting the actual argument " +"to an object that the foreign function accepts. For example, " +"a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string " +"passed as argument into a bytes object using ctypes conversion rules." msgstr "" #: ../../library/ctypes.rst:1671 @@ -3004,9 +3008,9 @@ msgstr "" msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " -"a suitable Python exception. Further, an auditing event ``ctypes." -"set_exception`` with argument ``code`` will be raised, allowing an audit " -"hook to replace the exception with its own." +"a suitable Python exception. Further, an auditing event " +"``ctypes.set_exception`` with argument ``code`` will be raised, allowing an " +"audit hook to replace the exception with its own." msgstr "" #: ../../library/ctypes.rst:1715 ../../library/ctypes.rst:1717 @@ -3035,9 +3039,10 @@ msgstr "" msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " -"*use_errno* is set to true, the ctypes private copy of the system :data:" -"`errno` variable is exchanged with the real :data:`errno` value before and " -"after the call; *use_last_error* does the same for the Windows error code." +"*use_errno* is set to true, the ctypes private copy of the " +"system :data:`errno` variable is exchanged with the real :data:`errno` value " +"before and after the call; *use_last_error* does the same for the Windows " +"error code." msgstr "" #: ../../library/ctypes.rst:1746 @@ -3101,8 +3106,8 @@ msgstr "" #: ../../library/ctypes.rst:1802 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." -"argtypes`." +"*paramflags* must be a tuple of the same length " +"as :attr:`~_CFuncPtr.argtypes`." msgstr "" #: ../../library/ctypes.rst:1804 @@ -3325,8 +3330,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." -"addressof``。" +"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` " +"``ctypes.addressof``。" #: ../../library/ctypes.rst:1917 msgid "" @@ -3473,8 +3478,8 @@ msgstr "" #: ../../library/ctypes.rst:2039 msgid "" -"Returns the current value of the ctypes-private copy of the system :data:" -"`errno` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the " +"system :data:`errno` variable in the calling thread." msgstr "" #: ../../library/ctypes.rst:2042 @@ -3549,8 +3554,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" -"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_errno``。" +"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_errno``。" #: ../../library/ctypes.rst:2102 msgid "" @@ -3564,8 +3569,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" -"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_last_error``。" +"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_last_error``。" #: ../../library/ctypes.rst:2113 msgid "" @@ -3584,15 +3589,16 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"string_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.string_at``。" #: ../../library/ctypes.rst:2128 msgid "" "This function is probably the worst-named thing in ctypes. It creates an " "instance of :exc:`OSError`. If *code* is not specified, ``GetLastError`` is " -"called to determine the error code. If *descr* is not specified, :func:" -"`FormatError` is called to get a textual description of the error." +"called to determine the error code. If *descr* is not " +"specified, :func:`FormatError` is called to get a textual description of the " +"error." msgstr "" #: ../../library/ctypes.rst:2136 @@ -3613,8 +3619,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"wstring_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.wstring_at``。" #: ../../library/ctypes.rst:2154 msgid "Data types" @@ -3624,9 +3630,9 @@ msgstr "" msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " -"hold C compatible data; the address of the memory block is returned by the :" -"func:`addressof` helper function. Another instance variable is exposed as :" -"attr:`_objects`; this contains other Python objects that need to be kept " +"hold C compatible data; the address of the memory block is returned by " +"the :func:`addressof` helper function. Another instance variable is exposed " +"as :attr:`_objects`; this contains other Python objects that need to be kept " "alive in case the memory block contains pointers." msgstr "" @@ -3641,8 +3647,8 @@ msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " "The optional *offset* parameter specifies an offset into the source buffer " -"in bytes; the default is zero. If the source buffer is not large enough a :" -"exc:`ValueError` is raised." +"in bytes; the default is zero. If the source buffer is not large enough " +"a :exc:`ValueError` is raised." msgstr "" #: ../../library/ctypes.rst:2177 ../../library/ctypes.rst:2187 @@ -3669,8 +3675,9 @@ msgstr "" #: ../../library/ctypes.rst:2194 ../../library/ctypes.rst:2196 msgid "" -"This method, and others that indirectly call this method, raises an :ref:" -"`auditing event ` ``ctypes.cdata`` with argument ``address``." +"This method, and others that indirectly call this method, raises " +"an :ref:`auditing event ` ``ctypes.cdata`` with argument " +"``address``." msgstr "" #: ../../library/ctypes.rst:2202 @@ -3702,9 +3709,9 @@ msgstr "" #: ../../library/ctypes.rst:2221 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " -"instead they share part of the memory block of a base object. The :attr:" -"`_b_base_` read-only member is the root ctypes object that owns the memory " -"block." +"instead they share part of the memory block of a base object. " +"The :attr:`_b_base_` read-only member is the root ctypes object that owns " +"the memory block." msgstr "" #: ../../library/ctypes.rst:2228 @@ -3725,8 +3732,8 @@ msgstr "" msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " -"fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :" -"class:`_CData`, so it inherits their methods and attributes. ctypes data " +"fundamental ctypes data types. :class:`_SimpleCData` is a subclass " +"of :class:`_CData`, so it inherits their methods and attributes. ctypes data " "types that are not and do not contain pointers can now be pickled." msgstr "" @@ -3822,8 +3829,8 @@ msgstr "" #: ../../library/ctypes.rst:2331 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" -"class:`c_byte`." +"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias " +"for :class:`c_byte`." msgstr "" #: ../../library/ctypes.rst:2337 @@ -3972,9 +3979,9 @@ msgstr "" #: ../../library/ctypes.rst:2486 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " -"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" -"type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` " -"are also defined." +"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, " +"or :c:type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!" +"RECT` are also defined." msgstr "" #: ../../library/ctypes.rst:2494 @@ -4014,9 +4021,9 @@ msgstr "" #: ../../library/ctypes.rst:2531 msgid "" "Concrete structure and union types must be created by subclassing one of " -"these types, and at least define a :attr:`_fields_` class variable. :mod:" -"`ctypes` will create :term:`descriptor`\\s which allow reading and writing " -"the fields by direct attribute accesses. These are the" +"these types, and at least define a :attr:`_fields_` class " +"variable. :mod:`ctypes` will create :term:`descriptor`\\s which allow " +"reading and writing the fields by direct attribute accesses. These are the" msgstr "" #: ../../library/ctypes.rst:2539 @@ -4078,9 +4085,9 @@ msgstr "" #: ../../library/ctypes.rst:2572 msgid "" "An optional small integer that allows overriding the alignment of structure " -"fields in the instance. :attr:`_pack_` must already be defined when :attr:" -"`_fields_` is assigned, otherwise it will have no effect. Setting this " -"attribute to 0 is the same as not setting it at all." +"fields in the instance. :attr:`_pack_` must already be defined " +"when :attr:`_fields_` is assigned, otherwise it will have no effect. Setting " +"this attribute to 0 is the same as not setting it at all." msgstr "" #: ../../library/ctypes.rst:2580 @@ -4092,16 +4099,16 @@ msgstr "" #: ../../library/ctypes.rst:2588 msgid "" -"An optional sequence that lists the names of unnamed (anonymous) fields. :" -"attr:`_anonymous_` must be already defined when :attr:`_fields_` is " +"An optional sequence that lists the names of unnamed (anonymous) " +"fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" #: ../../library/ctypes.rst:2592 msgid "" -"The fields listed in this variable must be structure or union type fields. :" -"mod:`ctypes` will create descriptors in the structure type that allows " -"accessing the nested fields directly, without the need to create the " +"The fields listed in this variable must be structure or union type " +"fields. :mod:`ctypes` will create descriptors in the structure type that " +"allows accessing the nested fields directly, without the need to create the " "structure or union field." msgstr "" @@ -4156,9 +4163,9 @@ msgstr "" #: ../../library/ctypes.rst:2622 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " -"fields of the base class. If the subclass definition has a separate :attr:" -"`_fields_` variable, the fields specified in this are appended to the fields " -"of the base class." +"fields of the base class. If the subclass definition has a " +"separate :attr:`_fields_` variable, the fields specified in this are " +"appended to the fields of the base class." msgstr "" #: ../../library/ctypes.rst:2627 @@ -4181,9 +4188,9 @@ msgstr "" #: ../../library/ctypes.rst:2644 msgid "" -"The recommended way to create concrete array types is by multiplying any :" -"mod:`ctypes` data type with a non-negative integer. Alternatively, you can " -"subclass this type and define :attr:`_length_` and :attr:`_type_` class " +"The recommended way to create concrete array types is by multiplying " +"any :mod:`ctypes` data type with a non-negative integer. Alternatively, you " +"can subclass this type and define :attr:`_length_` and :attr:`_type_` class " "variables. Array elements can be read and written using standard subscript " "and slice accesses; for slice reads, the resulting object is *not* itself " "an :class:`Array`." @@ -4192,8 +4199,8 @@ msgstr "" #: ../../library/ctypes.rst:2654 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" -"range subscripts result in an :exc:`IndexError`. Will be returned by :func:" -"`len`." +"range subscripts result in an :exc:`IndexError`. Will be returned " +"by :func:`len`." msgstr "" #: ../../library/ctypes.rst:2661 @@ -4208,8 +4215,8 @@ msgstr "" #: ../../library/ctypes.rst:2669 msgid "" -"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" -"`ctypes` data type and *length* an integer." +"Create an array. Equivalent to ``type * length``, where *type* is " +"a :mod:`ctypes` data type and *length* an integer." msgstr "" #: ../../library/ctypes.rst:2673 @@ -4231,10 +4238,10 @@ msgstr "" #: ../../library/ctypes.rst:2685 msgid "" "If a pointer points to an array, its elements can be read and written using " -"standard subscript and slice accesses. Pointer objects have no size, so :" -"func:`len` will raise :exc:`TypeError`. Negative subscripts will read from " -"the memory *before* the pointer (as in C), and out-of-range subscripts will " -"probably crash with an access violation (if you're lucky)." +"standard subscript and slice accesses. Pointer objects have no size, " +"so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read " +"from the memory *before* the pointer (as in C), and out-of-range subscripts " +"will probably crash with an access violation (if you're lucky)." msgstr "" #: ../../library/ctypes.rst:2695 diff --git a/library/dataclasses.po b/library/dataclasses.po index f6f692492e..4cf5400e32 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,7 +33,7 @@ msgid "" msgstr "" "該模組提供了一個裝飾器和函式,用於自動新增生成的\\ :term:`特殊方法 `,例如 :meth:`~object.__init__` 和 :meth:`~object.__repr__` 到使用者" -"定義的類。它最初在 :pep:`557` 中描述。" +"定義的類別。它最初在 :pep:`557` 中描述。" #: ../../library/dataclasses.rst:19 #, fuzzy @@ -79,8 +79,8 @@ msgid "" "Note that this method is automatically added to the class: it is not " "directly specified in the :class:`!InventoryItem` definition shown above." msgstr "" -"請注意,此方法會自動新增到類中:它不會在上面顯示的“InventoryItem”定義中直接指" -"定。" +"請注意,此方法會自動新增到類別中:它不會在上面顯示的 :class:`!InventoryItem` " +"定義中直接指定。" #: ../../library/dataclasses.rst:47 msgid "Module contents" @@ -103,8 +103,8 @@ msgid "" "`. With two exceptions described below, nothing in " "``@dataclass`` examines the type specified in the variable annotation." msgstr "" -"``@dataclass`` 裝飾器檢查類以找到 ``field``\\s。 ``field`` 被定義為具有 :" -"term:`type annotation ` 的類變數。除了下面描述的兩個例" +"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具有 :" +"term:`type annotation ` 的類別變數。除了下面描述的兩個例" "外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" #: ../../library/dataclasses.rst:60 @@ -112,10 +112,9 @@ msgstr "" msgid "" "The order of the fields in all of the generated methods is the order in " "which they appear in the class definition." -msgstr "所有生成的方法中欄位的順序是它們在類定義中出現的順序。" +msgstr "所有生成的方法中欄位的順序是它們在類別定義中出現的順序。" #: ../../library/dataclasses.rst:63 -#, fuzzy msgid "" "The ``@dataclass`` decorator will add various \"dunder\" methods to the " "class, described below. If any of the added methods already exist in the " @@ -123,9 +122,9 @@ msgid "" "decorator returns the same class that it is called on; no new class is " "created." msgstr "" -"``@dataclass`` 裝飾器將向類新增各種“dunder”方法,如下所述。如果類中已存在任何" -"新增的方法,則行為取決於參數,如下所述。裝飾器回傳呼叫它的同一個類;沒有建立" -"新類。" +"如下所述,``@dataclass`` 裝飾器會向類別新增各種 \"dunder\" 方法。如果類別中已" +"存在任何新增的方法,則行為會取決於參數,如下方文件所述。裝飾器會回傳呼叫它的" +"同一個類別;不會建立新類別。" #: ../../library/dataclasses.rst:69 #, fuzzy @@ -153,6 +152,19 @@ msgid "" "class C:\n" " ..." msgstr "" +"@dataclass\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass()\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, " +"frozen=False,\n" +" match_args=True, kw_only=False, slots=False, weakref_slot=False)\n" +"class C:\n" +" ..." #: ../../library/dataclasses.rst:87 msgid "The parameters to ``@dataclass`` are:" @@ -169,7 +181,7 @@ msgstr "*init*:如果為真(預設值),將生成一個 :meth:`~object.__ #, fuzzy msgid "" "If the class already defines :meth:`!__init__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__init__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__init__`,則忽略此參數。" #: ../../library/dataclasses.rst:95 #, fuzzy @@ -182,15 +194,14 @@ msgid "" "quantity_on_hand=10)``." msgstr "" "*repr*:如果為真(預設值),將生成一個 :meth:`__repr__` 方法。生成的 repr 字" -"串將包含類名以及每個欄位的名稱和 repr,按照它們在類中定義的順序排列。不包括標" -"記為從 repr 中排除的欄位。例如:``InventoryItem(name='widget', " +"串將包含類別名稱以及每個欄位的名稱和 repr,按照它們在類別中定義的順序排列。不" +"包括標記為從 repr 中排除的欄位。例如:``InventoryItem(name='widget', " "unit_price=3.0, quantity_on_hand=10)``。" #: ../../library/dataclasses.rst:102 -#, fuzzy msgid "" "If the class already defines :meth:`!__repr__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__repr__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__repr__`,則此參數會被忽略。" #: ../../library/dataclasses.rst:105 #, fuzzy @@ -201,13 +212,12 @@ msgid "" "type." msgstr "" "*eq*:如果為真(預設值),將生成一個 :meth:`~object.__eq__` 方法。此方法按順" -"序比較類,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同一型別。" +"序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同一型別。" #: ../../library/dataclasses.rst:110 -#, fuzzy msgid "" "If the class already defines :meth:`!__eq__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__eq__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__eq__`,則此參數會被忽略。" #: ../../library/dataclasses.rst:113 #, fuzzy @@ -220,16 +230,15 @@ msgid "" msgstr "" "*order*:如果為真(預設為 ``False``),:meth:`~object.__lt__`、:meth:" "`~object.__le__`、:meth:`~object.__gt__` 和 :meth:`~object.__ge__` 方法將是產" -"生。它們按順序比較類,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同" -"一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" +"生。它們按順序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於" +"同一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" #: ../../library/dataclasses.rst:120 -#, fuzzy msgid "" "If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:" "`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." msgstr "" -"如果該類已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" +"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" "meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" #: ../../library/dataclasses.rst:124 @@ -252,9 +261,9 @@ msgid "" "flags in the ``@dataclass`` decorator." msgstr "" ":meth:`!__hash__` 由內建的 :meth:`hash` 使用,當對像被新增到散列集合(如字典" -"和集合)時。擁有 :meth:`!__hash__` 意味著該類的實例是不可變的。可變性是一個複" -"雜的屬性,它取決於程序員的意圖 :meth:`!__eq__` 的存在和行為,以及 dataclass " -"裝飾器中的 *eq* 和 *frozen* 旗標的值." +"和集合)時。擁有 :meth:`!__hash__` 意味著該類別的實例是不可變的。可變性是一個" +"複雜的屬性,它取決於程序員的意圖 :meth:`!__eq__` 的存在和行為,以及 " +"dataclass 裝飾器中的 *eq* 和 *frozen* 旗標的值." #: ../../library/dataclasses.rst:134 #, fuzzy @@ -267,8 +276,8 @@ msgid "" msgstr "" "預設情況下,``@dataclass`` 不會隱式新增 :meth:`~object.__hash__` 方法,除非這" "樣做是安全的。它也不會新增或更改現有的明確定義的 :meth:`!__hash__` 方法。設定" -"類屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文檔" -"中所述。" +"類別屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文" +"件中所述。" #: ../../library/dataclasses.rst:140 #, fuzzy @@ -283,8 +292,8 @@ msgstr "" "如果 :meth:`!__hash__` 沒有明確定義,或者如果它被設定為 ``None``,那麼 " "``@dataclass`` *可能* 新增一個隱式的 :meth:`!__hash__` 方法。雖然不推薦,但你" "可以強制 ``@dataclass`` 使用 ``unsafe_hash=True`` 建立一個 :meth:`!__hash__` " -"方法。如果你的類在邏輯上是不可變的但仍然可以改變,則可能是這種情況。這是一個" -"特殊的用例,應該仔細考慮。" +"方法。如果你的類別在邏輯上是不可變的但仍然可以改變,則可能是這種情況。這是一" +"個特殊的用例,應該仔細考慮。" #: ../../library/dataclasses.rst:147 #, fuzzy @@ -312,8 +321,8 @@ msgstr "" "如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一個:meth:" "`!__hash__` 方法。如果 ``eq`` 為真且 ``frozen`` 為假,:meth:`!__hash__` 將被" "設定為 ``None``,將其標記為不可散列(它是不可散列的,因為它是可變的)。如果 " -"``eq`` 為假,:meth:`!__hash__` 將保持不變,這意味著將使用超類的 :meth:`!" -"__hash__` 方法(如果超類是 :class:`object`,這意味著它將回退到基於 id 的散" +"``eq`` 為假,:meth:`!__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!" +"__hash__` 方法(如果超類別是 :class:`object`,這意味著它將回退到基於 id 的散" "列)。" #: ../../library/dataclasses.rst:160 @@ -326,21 +335,22 @@ msgid "" msgstr "" "*frozen*:如果為真(預設為 ``False``),分配給欄位將產生例外。這模擬了只讀的" "凍結實例。如果 :meth:`~object.__setattr__` 或 :meth:`~object.__delattr__` 在" -"類中定義,則 :exc:`TypeError` 被引發。請參閱下面的討論。" +"類別中定義,則 :exc:`TypeError` 被引發。請參閱下面的討論。" #: ../../library/dataclasses.rst:165 #, fuzzy msgid "" "*match_args*: If true (the default is ``True``), the :attr:`~object." -"__match_args__` tuple will be created from the list of parameters to the " -"generated :meth:`~object.__init__` method (even if :meth:`!__init__` is not " -"generated, see above). If false, or if :attr:`!__match_args__` is already " -"defined in the class, then :attr:`!__match_args__` will not be generated." +"__match_args__` tuple will be created from the list of non keyword-only " +"parameters to the generated :meth:`~object.__init__` method (even if :meth:`!" +"__init__` is not generated, see above). If false, or if :attr:`!" +"__match_args__` is already defined in the class, then :attr:`!" +"__match_args__` will not be generated." msgstr "" "*match_args*:如果為真(預設為 ``True``),``__match_args__`` 元組將從參數列" "表建立到生成的 :meth:`~object.__init__` 方法(即使 :meth: `!__init__` 未生" -"成,見上文)。如果為 false,或者類中已經定義了 :attr:`!__match_args__`,則不" -"會生成 :attr:`!__match_args__`。" +"成,見上文)。如果為 false,或者類別中已經定義了 :attr:`!__match_args__`,則" +"不會生成 :attr:`!__match_args__`。" #: ../../library/dataclasses.rst:174 #, fuzzy @@ -349,9 +359,8 @@ msgid "" "marked as keyword-only. If a field is marked as keyword-only, then the only " "effect is that the :meth:`~object.__init__` parameter generated from a " "keyword-only field must be specified with a keyword when :meth:`!__init__` " -"is called. There is no effect on any other aspect of dataclasses. See the :" -"term:`parameter` glossary entry for details. Also see the :const:`KW_ONLY` " -"section." +"is called. See the :term:`parameter` glossary entry for details. Also see " +"the :const:`KW_ONLY` section." msgstr "" "``kw_only``:如果為 true(預設值為 ``False``),則所有欄位將被標記為僅限關鍵" "字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成的 :" @@ -359,7 +368,11 @@ msgstr "" "類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙表條" "目。另請參閱 :const:`KW_ONLY` 部分。" -#: ../../library/dataclasses.rst:185 +#: ../../library/dataclasses.rst:182 +msgid "Keyword-only fields are not included in :attr:`!__match_args__`." +msgstr "" + +#: ../../library/dataclasses.rst:186 #, fuzzy msgid "" "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " @@ -368,10 +381,10 @@ msgid "" "exc:`TypeError` is raised." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " -"屬性並回傳新類而不是原始類。如果 :attr:`!__slots__` 已經在類中定義,則 :exc:" -"`TypeError` 被引發。" +"屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," +"則 :exc:`TypeError` 被引發。" -#: ../../library/dataclasses.rst:191 +#: ../../library/dataclasses.rst:192 #, fuzzy msgid "" "Calling no-arg :func:`super` in dataclasses using ``slots=True`` will result " @@ -380,10 +393,10 @@ msgid "" "valid workaround. See :gh:`90562` for full details." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " -"屬性並回傳新類而不是原始類。如果 :attr:`!__slots__` 已經在類中定義,則 :exc:" -"`TypeError` 被引發。" +"屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," +"則 :exc:`TypeError` 被引發。" -#: ../../library/dataclasses.rst:198 +#: ../../library/dataclasses.rst:199 msgid "" "Passing parameters to a base class :meth:`~object.__init_subclass__` when " "using ``slots=True`` will result in a :exc:`TypeError`. Either use " @@ -391,7 +404,7 @@ msgid "" "workaround. See :gh:`91126` for full details." msgstr "" -#: ../../library/dataclasses.rst:206 +#: ../../library/dataclasses.rst:207 #, fuzzy msgid "" "If a field name is already included in the :attr:`!__slots__` of a base " @@ -407,7 +420,7 @@ msgstr "" "夠確定繼承的插槽,基底類別 :attr:`!__slots__` 可以是任何可疊代的,但*不是*疊" "代器。" -#: ../../library/dataclasses.rst:216 +#: ../../library/dataclasses.rst:217 #, fuzzy msgid "" "*weakref_slot*: If true (the default is ``False``), add a slot named " @@ -419,14 +432,14 @@ msgstr "" "插槽,這是使實例可弱引用所必需的。在沒有指定 ``slots=True`` 的情況下指定 " "``weakref_slot=True`` 是錯誤的。" -#: ../../library/dataclasses.rst:224 +#: ../../library/dataclasses.rst:225 #, fuzzy msgid "" "``field``\\s may optionally specify a default value, using normal Python " "syntax::" msgstr "``field``\\s 可以選擇指定一個預設值,使用普通的 Python 語法: ::" -#: ../../library/dataclasses.rst:227 +#: ../../library/dataclasses.rst:228 msgid "" "@dataclass\n" "class C:\n" @@ -434,7 +447,7 @@ msgid "" " b: int = 0 # assign a default value for 'b'" msgstr "" -#: ../../library/dataclasses.rst:232 +#: ../../library/dataclasses.rst:233 #, fuzzy msgid "" "In this example, both :attr:`!a` and :attr:`!b` will be included in the " @@ -443,11 +456,11 @@ msgstr "" "在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增的 :meth:`~object." "__init__` 方法中,該方法將定義為: ::" -#: ../../library/dataclasses.rst:235 +#: ../../library/dataclasses.rst:236 msgid "def __init__(self, a: int, b: int = 0):" -msgstr "" +msgstr "def __init__(self, a: int, b: int = 0):" -#: ../../library/dataclasses.rst:237 +#: ../../library/dataclasses.rst:238 #, fuzzy msgid "" ":exc:`TypeError` will be raised if a field without a default value follows a " @@ -455,9 +468,9 @@ msgid "" "class, or as a result of class inheritance." msgstr "" ":exc:`TypeError` 如果沒有預設值的欄位跟在具有預設值的欄位之後,將引發。無論這" -"發生在單個類中還是作為類繼承的結果,都是如此。" +"發生在單個類別中還是作為類別繼承的結果,都是如此。" -#: ../../library/dataclasses.rst:243 +#: ../../library/dataclasses.rst:244 #, fuzzy msgid "" "For common and simple use cases, no other functionality is required. There " @@ -470,7 +483,7 @@ msgstr "" "位資訊。為了滿足這種對附加資訊的需求,你可以通過呼叫提供的 :func:`!field` 函" "式來替換預設欄位值。例如: ::" -#: ../../library/dataclasses.rst:249 +#: ../../library/dataclasses.rst:250 msgid "" "@dataclass\n" "class C:\n" @@ -479,8 +492,14 @@ msgid "" "c = C()\n" "c.mylist += [1, 2, 3]" msgstr "" +"@dataclass\n" +"class C:\n" +" mylist: list[int] = field(default_factory=list)\n" +"\n" +"c = C()\n" +"c.mylist += [1, 2, 3]" -#: ../../library/dataclasses.rst:256 +#: ../../library/dataclasses.rst:257 #, fuzzy msgid "" "As shown above, the :const:`MISSING` value is a sentinel object used to " @@ -489,14 +508,14 @@ msgid "" "meaning. No code should directly use the :const:`MISSING` value." msgstr "" "如上所示,:const:`MISSING` 值是一個哨兵物件,用於檢測某些參數是否由使用者提" -"供。使用此標記是因為“None”對於某些具有不同含義的參數是有效值。任何程式碼都不" -"應直接使用 :const:`MISSING` 值。" +"供。使用此標記是因為 ``None`` 對於某些具有不同含義的參數是有效值。任何程式碼" +"都不應直接使用 :const:`MISSING` 值。" -#: ../../library/dataclasses.rst:261 +#: ../../library/dataclasses.rst:262 msgid "The parameters to :func:`!field` are:" msgstr ":func:`!field` 的參數是:" -#: ../../library/dataclasses.rst:263 +#: ../../library/dataclasses.rst:264 #, fuzzy msgid "" "*default*: If provided, this will be the default value for this field. This " @@ -506,7 +525,7 @@ msgstr "" "*default*:如果提供,這將是該欄位的預設值。這是必需的,因為 :meth:`!field` 呼" "叫本身會替換預設值的正常位置。" -#: ../../library/dataclasses.rst:267 +#: ../../library/dataclasses.rst:268 #, fuzzy msgid "" "*default_factory*: If provided, it must be a zero-argument callable that " @@ -519,7 +538,7 @@ msgstr "" "時將被呼叫。除其他用途外,這可用於指定具有可變預設值的欄位,如下所述。同時指" "定 *default* 和 *default_factory* 是錯誤的。" -#: ../../library/dataclasses.rst:273 +#: ../../library/dataclasses.rst:274 #, fuzzy msgid "" "*init*: If true (the default), this field is included as a parameter to the " @@ -528,7 +547,7 @@ msgstr "" "*init*:如果為 true(預設值),則此欄位將作為生成的 :meth:`~object.__init__` " "方法的參數包含在內。" -#: ../../library/dataclasses.rst:276 +#: ../../library/dataclasses.rst:277 #, fuzzy msgid "" "*repr*: If true (the default), this field is included in the string returned " @@ -537,21 +556,23 @@ msgstr "" "*repr*:如果為真(預設值),則此欄位包含在生成的 :meth:`~object.__repr__` 方" "法回傳的字串中。" -#: ../../library/dataclasses.rst:279 +#: ../../library/dataclasses.rst:280 #, fuzzy msgid "" "*hash*: This can be a bool or ``None``. If true, this field is included in " -"the generated :meth:`~object.__hash__` method. If ``None`` (the default), " -"use the value of *compare*: this would normally be the expected behavior. A " -"field should be considered in the hash if it's used for comparisons. " -"Setting this value to anything other than ``None`` is discouraged." +"the generated :meth:`~object.__hash__` method. If false, this field is " +"excluded from the generated :meth:`~object.__hash__`. If ``None`` (the " +"default), use the value of *compare*: this would normally be the expected " +"behavior, since a field should be included in the hash if it's used for " +"comparisons. Setting this value to anything other than ``None`` is " +"discouraged." msgstr "" "*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成的 :meth:" -"`__hash__` 方法中。如果“無”(預設值),則使用“比較”的值:這通常是預期的行為。" -"如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定為“無”以外的任" -"何值。" +"`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的值:這通常" +"是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定" +"為 ``None`` 以外的任何值。" -#: ../../library/dataclasses.rst:286 +#: ../../library/dataclasses.rst:288 #, fuzzy msgid "" "One possible reason to set ``hash=False`` but ``compare=True`` would be if a " @@ -564,7 +585,7 @@ msgstr "" "湊值的成本很高,則需要該欄位進行相等性測試,並且還有其他欄位有助於型別的雜湊" "值。即使一個欄位被排除在雜湊之外,它仍然會被用於比較。" -#: ../../library/dataclasses.rst:292 +#: ../../library/dataclasses.rst:294 #, fuzzy msgid "" "*compare*: If true (the default), this field is included in the generated " @@ -574,7 +595,7 @@ msgstr "" "*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中(:meth:" "`~object.__eq__`、:meth:`~object.__gt__` 等)。" -#: ../../library/dataclasses.rst:296 +#: ../../library/dataclasses.rst:298 #, fuzzy msgid "" "*metadata*: This can be a mapping or ``None``. ``None`` is treated as an " @@ -589,7 +610,7 @@ msgstr "" "不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" "密鑰,用作元資料中的命名空間。" -#: ../../library/dataclasses.rst:304 +#: ../../library/dataclasses.rst:306 #, fuzzy msgid "" "*kw_only*: If true, this field will be marked as keyword-only. This is used " @@ -599,6 +620,10 @@ msgstr "" "`~object.__init__` 方法的參數時使用。" #: ../../library/dataclasses.rst:310 +msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." +msgstr "" + +#: ../../library/dataclasses.rst:314 #, fuzzy msgid "" "If the default value of a field is specified by a call to :func:`!field`, " @@ -614,7 +639,7 @@ msgstr "" "在 :func:`@dataclass ` 裝飾器運行後,類別屬性將全部包含欄位的預設" "值,就像預設值本身已指定一樣。例如,在: ::" -#: ../../library/dataclasses.rst:319 +#: ../../library/dataclasses.rst:323 msgid "" "@dataclass\n" "class C:\n" @@ -623,8 +648,14 @@ msgid "" " z: int = field(repr=False, default=10)\n" " t: int = 20" msgstr "" +"@dataclass\n" +"class C:\n" +" x: int\n" +" y: int = field(repr=False)\n" +" z: int = field(repr=False, default=10)\n" +" t: int = 20" -#: ../../library/dataclasses.rst:326 +#: ../../library/dataclasses.rst:330 #, fuzzy msgid "" "The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!" @@ -634,7 +665,7 @@ msgstr "" "類別屬性 :attr:`!C.z` 將為 ``10``,類別屬性 :attr:`!C.t` 將為 ``20``,類別屬" "性 :attr:`!C.x` 和 :attr:`!C.y` 將不會放。" -#: ../../library/dataclasses.rst:332 +#: ../../library/dataclasses.rst:336 #, fuzzy msgid "" ":class:`!Field` objects describe each defined field. These objects are " @@ -646,15 +677,15 @@ msgstr "" "`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!Field` 物" "件。它記錄的屬性是:" -#: ../../library/dataclasses.rst:337 +#: ../../library/dataclasses.rst:341 msgid ":attr:`!name`: The name of the field." msgstr ":attr:`!name`:欄位的名稱。" -#: ../../library/dataclasses.rst:338 +#: ../../library/dataclasses.rst:342 msgid ":attr:`!type`: The type of the field." msgstr ":attr:`!type`:欄位的型別。" -#: ../../library/dataclasses.rst:339 +#: ../../library/dataclasses.rst:343 #, fuzzy msgid "" ":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" @@ -665,14 +696,23 @@ msgstr "" "attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!kw_only` 有與它" "們在 :func:`field` 函式中的含義和值相同。" -#: ../../library/dataclasses.rst:343 +#: ../../library/dataclasses.rst:347 #, fuzzy msgid "" "Other attributes may exist, but they are private and must not be inspected " "or relied on." msgstr "可能存在其他屬性,但它們是私有的,不得檢查或依賴。" -#: ../../library/dataclasses.rst:348 +#: ../../library/dataclasses.rst:352 +msgid "" +"``InitVar[T]`` type annotations describe variables that are :ref:`init-only " +"`. Fields annotated with :class:`!InitVar` " +"are considered pseudo-fields, and thus are neither returned by the :func:" +"`fields` function nor used in any way except adding them as parameters to :" +"meth:`~object.__init__` and an optional :meth:`__post_init__`." +msgstr "" + +#: ../../library/dataclasses.rst:361 #, fuzzy msgid "" "Returns a tuple of :class:`Field` objects that define the fields for this " @@ -684,7 +724,7 @@ msgstr "" "實例。如果未傳遞資料類別或其中一個實例,則引發 :exc:`TypeError`。不回傳 " "``ClassVar`` 或 ``InitVar`` 的偽欄位。" -#: ../../library/dataclasses.rst:355 +#: ../../library/dataclasses.rst:368 #, fuzzy msgid "" "Converts the dataclass *obj* to a dict (by using the factory function " @@ -696,12 +736,12 @@ msgstr "" "都被轉換為其欄位的字典,作為 ``name: value`` 對。資料類別、字典、列表和元組被" "遞迴到。其他物件使用 :func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:361 +#: ../../library/dataclasses.rst:374 #, fuzzy msgid "Example of using :func:`!asdict` on nested dataclasses::" msgstr "在嵌套資料類別上使用 :func:`!asdict` 的範例: ::" -#: ../../library/dataclasses.rst:363 +#: ../../library/dataclasses.rst:376 msgid "" "@dataclass\n" "class Point:\n" @@ -718,23 +758,37 @@ msgid "" "c = C([Point(0, 0), Point(10, 4)])\n" "assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: int\n" +" y: int\n" +"\n" +"@dataclass\n" +"class C:\n" +" mylist: list[Point]\n" +"\n" +"p = Point(10, 20)\n" +"assert asdict(p) == {'x': 10, 'y': 20}\n" +"\n" +"c = C([Point(0, 0), Point(10, 4)])\n" +"assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" -#: ../../library/dataclasses.rst:378 ../../library/dataclasses.rst:398 +#: ../../library/dataclasses.rst:391 ../../library/dataclasses.rst:411 #, fuzzy msgid "To create a shallow copy, the following workaround may be used::" msgstr "要建立淺複製,可以使用以下解決方法:" -#: ../../library/dataclasses.rst:380 +#: ../../library/dataclasses.rst:393 msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" msgstr "" -#: ../../library/dataclasses.rst:382 +#: ../../library/dataclasses.rst:395 #, fuzzy msgid "" ":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." msgstr ":func:`!asdict` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:387 +#: ../../library/dataclasses.rst:400 #, fuzzy msgid "" "Converts the dataclass *obj* to a tuple (by using the factory function " @@ -746,21 +800,23 @@ msgstr "" "都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使用 :" "func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:393 +#: ../../library/dataclasses.rst:406 msgid "Continuing from the previous example::" msgstr "從前面的例子繼續: ::" -#: ../../library/dataclasses.rst:395 +#: ../../library/dataclasses.rst:408 msgid "" "assert astuple(p) == (10, 20)\n" "assert astuple(c) == ([(0, 0), (10, 4)],)" msgstr "" +"assert astuple(p) == (10, 20)\n" +"assert astuple(c) == ([(0, 0), (10, 4)],)" -#: ../../library/dataclasses.rst:400 +#: ../../library/dataclasses.rst:413 msgid "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -msgstr "" +msgstr "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -#: ../../library/dataclasses.rst:402 +#: ../../library/dataclasses.rst:415 #, fuzzy msgid "" ":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass " @@ -768,7 +824,7 @@ msgid "" msgstr "" ":func:`!astuple` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:407 +#: ../../library/dataclasses.rst:420 #, fuzzy msgid "" "Creates a new dataclass with name *cls_name*, fields as defined in *fields*, " @@ -788,13 +844,13 @@ msgstr "" "``kw_only`` 的值, ``slots`` 和 ``weakref_slot`` 與它們在 :func:`dataclass` 中" "的含義相同。" -#: ../../library/dataclasses.rst:417 +#: ../../library/dataclasses.rst:430 msgid "" "If *module* is defined, the :attr:`!__module__` attribute of the dataclass " "is set to that value. By default, it is set to the module name of the caller." msgstr "" -#: ../../library/dataclasses.rst:421 +#: ../../library/dataclasses.rst:434 #, fuzzy msgid "" "This function is not strictly required, because any Python mechanism for " @@ -802,11 +858,11 @@ msgid "" "`@dataclass ` function to convert that class to a dataclass. " "This function is provided as a convenience. For example::" msgstr "" -"這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類的 Python 機" -"制都可以應用 :func:`dataclass` 函式將該類轉換為資料類別。提供此功能是為了方" -"便。例如: ::" +"這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類別的 Python " +"機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供此功能是為了" +"方便。例如: ::" -#: ../../library/dataclasses.rst:427 +#: ../../library/dataclasses.rst:440 msgid "" "C = make_dataclass('C',\n" " [('x', int),\n" @@ -814,12 +870,17 @@ msgid "" " ('z', int, field(default=5))],\n" " namespace={'add_one': lambda self: self.x + 1})" msgstr "" +"C = make_dataclass('C',\n" +" [('x', int),\n" +" 'y',\n" +" ('z', int, field(default=5))],\n" +" namespace={'add_one': lambda self: self.x + 1})" -#: ../../library/dataclasses.rst:433 +#: ../../library/dataclasses.rst:446 msgid "Is equivalent to::" msgstr "相當於: ::" -#: ../../library/dataclasses.rst:435 +#: ../../library/dataclasses.rst:448 msgid "" "@dataclass\n" "class C:\n" @@ -831,7 +892,7 @@ msgid "" " return self.x + 1" msgstr "" -#: ../../library/dataclasses.rst:446 +#: ../../library/dataclasses.rst:459 #, fuzzy msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " @@ -843,7 +904,7 @@ msgstr "" "``obj`` 不是資料類別,則引發 :exc:`TypeError`。如果 ``changes`` 中的值未指定" "欄位,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:451 +#: ../../library/dataclasses.rst:464 #, fuzzy msgid "" "The newly returned object is created by calling the :meth:`~object.__init__` " @@ -853,7 +914,7 @@ msgstr "" "新回傳的對像是通過呼叫資料類別的 :meth:`~object.__init__` 方法建立的。這確" "保 :meth:`__post_init__`(如果存在)也被呼叫。" -#: ../../library/dataclasses.rst:455 +#: ../../library/dataclasses.rst:468 #, fuzzy msgid "" "Init-only variables without default values, if any exist, must be specified " @@ -863,7 +924,7 @@ msgstr "" "沒有預設值的僅初始化變數(如果存在)必須在呼叫 :func:`replace` 時指定,以便它" "們可以傳遞給 :meth:`__init__` 和 :meth:`__post_init__`。" -#: ../../library/dataclasses.rst:459 +#: ../../library/dataclasses.rst:472 #, fuzzy msgid "" "It is an error for *changes* to contain any fields that are defined as " @@ -872,7 +933,7 @@ msgstr "" "*changes* 包含任何定義為具有 ``init=False`` 的欄位是錯誤的。在這種情況下將引" "發 :exc:`ValueError`。" -#: ../../library/dataclasses.rst:463 +#: ../../library/dataclasses.rst:476 #, fuzzy msgid "" "Be forewarned about how ``init=False`` fields work during a call to :func:`!" @@ -885,17 +946,17 @@ msgid "" msgstr "" "預先警告 ``init=False`` 欄位在呼叫 :func:`!replace` 期間是如何工作的。它們不" "是從源物件複製的,而是在 :meth:`__post_init__` 中初始化的,如果它們被初始化的" -"話。預計 ``init=False`` 欄位將很少被明智地使用。如果使用它們,使用替代的類構" -"造函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似命" -"名的)方法。" +"話。預計 ``init=False`` 欄位將很少被明智地使用。如果使用它們,使用替代的類別" +"建構函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似" +"命名的)方法。" -#: ../../library/dataclasses.rst:472 +#: ../../library/dataclasses.rst:485 msgid "" "Dataclass instances are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/dataclasses.rst:476 +#: ../../library/dataclasses.rst:489 #, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " @@ -903,28 +964,28 @@ msgid "" msgstr "" "如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/dataclasses.rst:479 +#: ../../library/dataclasses.rst:492 #, fuzzy msgid "" "If you need to know if a class is an instance of a dataclass (and not a " "dataclass itself), then add a further check for ``not isinstance(obj, " "type)``::" msgstr "" -"如果你需要知道一個類是否是資料類別的實例(而不是資料類別本身),那麼新增一個" -"進一步的檢查 ``not isinstance(obj, type)``: ::" +"如果你需要知道一個類別是否是資料類別的實例(而不是資料類別本身),那麼新增一" +"個進一步的檢查 ``not isinstance(obj, type)``: ::" -#: ../../library/dataclasses.rst:483 +#: ../../library/dataclasses.rst:496 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" -#: ../../library/dataclasses.rst:488 +#: ../../library/dataclasses.rst:501 #, fuzzy msgid "A sentinel value signifying a missing default or default_factory." msgstr "表示缺少 default 或 default_factory 的標記值。" -#: ../../library/dataclasses.rst:492 +#: ../../library/dataclasses.rst:505 #, fuzzy msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " @@ -938,16 +999,16 @@ msgstr "" "用作型別註釋的標記值。型別為 :const:`!KW_ONLY` 的偽欄位之後的任何欄位都被標記" "為僅關鍵字欄位。請注意,:const:`!KW_ONLY` 型別的偽欄位將被完全忽略。這包括此" "類欄位的名稱。按照慣例,名稱 ``_`` 用於 :const:`!KW_ONLY` 欄位。僅關鍵字欄位" -"表示 :meth:`~object.__init__` 參數,在實例化類時必須將其指定為關鍵字。" +"表示 :meth:`~object.__init__` 參數,在實例化類別時必須將其指定為關鍵字。" -#: ../../library/dataclasses.rst:501 +#: ../../library/dataclasses.rst:514 #, fuzzy msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "在此示例中,欄位 ``y`` 和 ``z`` 將被標記為僅關鍵字欄位: ::" -#: ../../library/dataclasses.rst:503 +#: ../../library/dataclasses.rst:516 msgid "" "@dataclass\n" "class Point:\n" @@ -958,15 +1019,23 @@ msgid "" "\n" "p = Point(0, y=1.5, z=2.0)" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" _: KW_ONLY\n" +" y: float\n" +" z: float\n" +"\n" +"p = Point(0, y=1.5, z=2.0)" -#: ../../library/dataclasses.rst:512 +#: ../../library/dataclasses.rst:525 #, fuzzy msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`!KW_ONLY`." msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的欄位是錯誤的。" -#: ../../library/dataclasses.rst:519 +#: ../../library/dataclasses.rst:532 #, fuzzy msgid "" "Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" @@ -976,12 +1045,12 @@ msgstr "" "當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" "meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" -#: ../../library/dataclasses.rst:526 +#: ../../library/dataclasses.rst:539 #, fuzzy msgid "Post-init processing" msgstr "初始化後處理" -#: ../../library/dataclasses.rst:530 +#: ../../library/dataclasses.rst:543 #, fuzzy msgid "" "When defined on the class, it will be called by the generated :meth:`~object." @@ -992,19 +1061,19 @@ msgid "" "automatically be called." msgstr "" "生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!self." -"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類上定義的。它通常被稱" -"為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也將" -"按照它們在類中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :meth:`!" -"__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" +"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它通常被" +"稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也" +"將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :" +"meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" -#: ../../library/dataclasses.rst:537 +#: ../../library/dataclasses.rst:550 #, fuzzy msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "在其他用途中,這允許初始化依賴於一個或多個其他欄位的欄位值。例如: ::" -#: ../../library/dataclasses.rst:540 +#: ../../library/dataclasses.rst:553 msgid "" "@dataclass\n" "class C:\n" @@ -1015,8 +1084,16 @@ msgid "" " def __post_init__(self):\n" " self.c = self.a + self.b" msgstr "" +"@dataclass\n" +"class C:\n" +" a: float\n" +" b: float\n" +" c: float = field(init=False)\n" +"\n" +" def __post_init__(self):\n" +" self.c = self.a + self.b" -#: ../../library/dataclasses.rst:549 +#: ../../library/dataclasses.rst:562 #, fuzzy msgid "" "The :meth:`~object.__init__` method generated by :func:`@dataclass " @@ -1028,7 +1105,7 @@ msgstr "" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " "方法,通常在 :meth:`__post_init__` 方法中呼叫此方法: ::" -#: ../../library/dataclasses.rst:554 +#: ../../library/dataclasses.rst:567 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" @@ -1042,18 +1119,29 @@ msgid "" " def __post_init__(self):\n" " super().__init__(self.side, self.side)" msgstr "" +"class Rectangle:\n" +" def __init__(self, height, width):\n" +" self.height = height\n" +" self.width = width\n" +"\n" +"@dataclass\n" +"class Square(Rectangle):\n" +" side: float\n" +"\n" +" def __post_init__(self):\n" +" super().__init__(self.side, self.side)" -#: ../../library/dataclasses.rst:566 +#: ../../library/dataclasses.rst:579 #, fuzzy msgid "" "Note, however, that in general the dataclass-generated :meth:`!__init__` " "methods don't need to be called, since the derived dataclass will take care " "of initializing all fields of any base class that is a dataclass itself." msgstr "" -"但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為派生資料" +"但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為衍生資料" "類別將負責初始化作為資料類別本身的任何基底類別的所有欄位。" -#: ../../library/dataclasses.rst:570 +#: ../../library/dataclasses.rst:583 #, fuzzy msgid "" "See the section below on init-only variables for ways to pass parameters to :" @@ -1063,11 +1151,11 @@ msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" "方法。另請參閱有關 :func:`replace` 如何處理 ``init=False`` 欄位的警告。" -#: ../../library/dataclasses.rst:577 +#: ../../library/dataclasses.rst:590 msgid "Class variables" msgstr "類別變數" -#: ../../library/dataclasses.rst:579 +#: ../../library/dataclasses.rst:592 #, fuzzy msgid "" "One of the few places where :func:`@dataclass ` actually inspects " @@ -1079,23 +1167,23 @@ msgid "" "`fields` function." msgstr "" ":func:`@dataclass ` 實際檢查欄位型別的少數地方之一是確定欄位是否" -"是 :pep:`526` 中定義的類變數。它通過檢查欄位的型別是否為 :data:`typing." +"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否為 :data:`typing." "ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它就被排除在考慮之" "外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " "``ClassVar`` 偽欄位。" -#: ../../library/dataclasses.rst:590 +#: ../../library/dataclasses.rst:603 #, fuzzy msgid "Init-only variables" msgstr "僅初始化變數" -#: ../../library/dataclasses.rst:592 +#: ../../library/dataclasses.rst:605 #, fuzzy msgid "" "Another place where :func:`@dataclass ` inspects a type " "annotation is to determine if a field is an init-only variable. It does " -"this by seeing if the type of a field is of type ``dataclasses.InitVar``. " -"If a field is an ``InitVar``, it is considered a pseudo-field called an init-" +"this by seeing if the type of a field is of type :class:`InitVar`. If a " +"field is an :class:`InitVar`, it is considered a pseudo-field called an init-" "only field. As it is not a true field, it is not returned by the module-" "level :func:`fields` function. Init-only fields are added as parameters to " "the generated :meth:`~object.__init__` method, and are passed to the " @@ -1107,16 +1195,16 @@ msgstr "" "是一個 ``InitVar``,它被認為是一個偽欄位,稱為 init-only 欄位。由於它不是真正" "的欄位,因此它不會由模組級 fields 函式回傳。 Init-only 欄位作為參數新增到生成" "的 :meth:`~object.__init__` 方法,並傳遞給可選的 :meth:`__post_init__` 方法。" -"它們不被資料類使用。" +"它們不被資料類別使用。" -#: ../../library/dataclasses.rst:602 +#: ../../library/dataclasses.rst:615 #, fuzzy msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" -msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類時沒有提供值: ::" +msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類別時沒有提供值: ::" -#: ../../library/dataclasses.rst:605 +#: ../../library/dataclasses.rst:618 msgid "" "@dataclass\n" "class C:\n" @@ -1130,8 +1218,19 @@ msgid "" "\n" "c = C(10, database=my_database)" msgstr "" +"@dataclass\n" +"class C:\n" +" i: int\n" +" j: int | None = None\n" +" database: InitVar[DatabaseType | None] = None\n" +"\n" +" def __post_init__(self, database):\n" +" if self.j is None and database is not None:\n" +" self.j = database.lookup('j')\n" +"\n" +"c = C(10, database=my_database)" -#: ../../library/dataclasses.rst:617 +#: ../../library/dataclasses.rst:630 #, fuzzy msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" @@ -1140,11 +1239,11 @@ msgstr "" "在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" "`Field` 物件,但不會為 :attr:`!database` 回傳。" -#: ../../library/dataclasses.rst:623 +#: ../../library/dataclasses.rst:636 msgid "Frozen instances" msgstr "凍結實例" -#: ../../library/dataclasses.rst:625 +#: ../../library/dataclasses.rst:638 #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " @@ -1155,10 +1254,10 @@ msgid "" msgstr "" "不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞給 :" "func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資料類" -"別將向類新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" -"法。這些方法在呼叫時會引發 :exc:`FrozenInstanceError`。" +"別將向類別新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" +"法。這些方法在叫用時會引發 :exc:`FrozenInstanceError`。" -#: ../../library/dataclasses.rst:631 +#: ../../library/dataclasses.rst:644 #, fuzzy msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" @@ -1168,11 +1267,11 @@ msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" -#: ../../library/dataclasses.rst:640 +#: ../../library/dataclasses.rst:653 msgid "Inheritance" msgstr "繼承" -#: ../../library/dataclasses.rst:642 +#: ../../library/dataclasses.rst:655 #, fuzzy msgid "" "When the dataclass is being created by the :func:`@dataclass ` " @@ -1185,12 +1284,12 @@ msgid "" "order, derived classes override base classes. An example::" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" -"從 :class:`object` 開始)查看該類的所有基底類別,並且對於它找到的每個資料類" +"從 :class:`object` 開始)查看該類別的所有基底類別,並且對於它找到的每個資料類" "別,將該基底類別中的欄位新增到欄位的有序對映中。新增所有基底類別欄位後,它會" "將自己的欄位新增到有序對映中。所有生成的方法都將使用這種組合的、計算的有序欄" -"位對映。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" +"位對映。因為欄位是按插入順序排列的,所以衍生類別會覆蓋基底類別。一個例子: ::" -#: ../../library/dataclasses.rst:652 +#: ../../library/dataclasses.rst:665 msgid "" "@dataclass\n" "class Base:\n" @@ -1202,8 +1301,17 @@ msgid "" " z: int = 10\n" " x: int = 15" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" y: int = 0\n" +"\n" +"@dataclass\n" +"class C(Base):\n" +" z: int = 10\n" +" x: int = 15" -#: ../../library/dataclasses.rst:662 +#: ../../library/dataclasses.rst:675 #, fuzzy msgid "" "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " @@ -1213,23 +1321,23 @@ msgstr "" "最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終" "型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。" -#: ../../library/dataclasses.rst:665 +#: ../../library/dataclasses.rst:678 #, fuzzy msgid "" "The generated :meth:`~object.__init__` method for :class:`!C` will look " "like::" msgstr "為 :class:`!C` 生成的 :meth:`~object.__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:667 +#: ../../library/dataclasses.rst:680 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -msgstr "" +msgstr "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -#: ../../library/dataclasses.rst:670 +#: ../../library/dataclasses.rst:683 #, fuzzy msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr ":meth:`!__init__` 中僅關鍵字參數的重新排序" -#: ../../library/dataclasses.rst:672 +#: ../../library/dataclasses.rst:685 #, fuzzy msgid "" "After the parameters needed for :meth:`~object.__init__` are computed, any " @@ -1241,7 +1349,7 @@ msgstr "" "僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於" "非僅關鍵字參數之後。" -#: ../../library/dataclasses.rst:678 +#: ../../library/dataclasses.rst:691 #, fuzzy msgid "" "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " @@ -1251,7 +1359,7 @@ msgstr "" "在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄" "位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::" -#: ../../library/dataclasses.rst:681 +#: ../../library/dataclasses.rst:694 msgid "" "@dataclass\n" "class Base:\n" @@ -1265,40 +1373,53 @@ msgid "" " z: int = 10\n" " t: int = field(kw_only=True, default=0)" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" _: KW_ONLY\n" +" y: int = 0\n" +" w: int = 1\n" +"\n" +"@dataclass\n" +"class D(Base):\n" +" z: int = 10\n" +" t: int = field(kw_only=True, default=0)" -#: ../../library/dataclasses.rst:693 +#: ../../library/dataclasses.rst:706 #, fuzzy msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:695 +#: ../../library/dataclasses.rst:708 msgid "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" msgstr "" +"def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " +"int = 0):" -#: ../../library/dataclasses.rst:697 +#: ../../library/dataclasses.rst:710 #, fuzzy msgid "" "Note that the parameters have been re-ordered from how they appear in the " "list of fields: parameters derived from regular fields are followed by " "parameters derived from keyword-only fields." msgstr "" -"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位派生的參數後" -"跟從僅關鍵字欄位派生的參數。" +"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位衍生的參數後" +"跟從僅關鍵字欄位衍生的參數。" -#: ../../library/dataclasses.rst:701 +#: ../../library/dataclasses.rst:714 #, fuzzy msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`!__init__` parameter list." msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。" -#: ../../library/dataclasses.rst:706 +#: ../../library/dataclasses.rst:719 msgid "Default factory functions" msgstr "預設工廠函式" -#: ../../library/dataclasses.rst:708 +#: ../../library/dataclasses.rst:721 #, fuzzy msgid "" "If a :func:`field` specifies a *default_factory*, it is called with zero " @@ -1308,11 +1429,11 @@ msgstr "" "如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零" "引數呼叫。例如,要建立列表的新實例,請使用: ::" -#: ../../library/dataclasses.rst:712 +#: ../../library/dataclasses.rst:725 msgid "mylist: list = field(default_factory=list)" -msgstr "" +msgstr "mylist: list = field(default_factory=list)" -#: ../../library/dataclasses.rst:714 +#: ../../library/dataclasses.rst:727 #, fuzzy msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " @@ -1325,11 +1446,11 @@ msgstr "" "位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" "`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" -#: ../../library/dataclasses.rst:721 +#: ../../library/dataclasses.rst:734 msgid "Mutable default values" msgstr "可變預設值" -#: ../../library/dataclasses.rst:723 +#: ../../library/dataclasses.rst:736 #, fuzzy msgid "" "Python stores default member variable values in class attributes. Consider " @@ -1337,7 +1458,7 @@ msgid "" msgstr "" "Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別: ::" -#: ../../library/dataclasses.rst:726 +#: ../../library/dataclasses.rst:739 msgid "" "class C:\n" " x = []\n" @@ -1351,8 +1472,19 @@ msgid "" "assert o1.x == [1, 2]\n" "assert o1.x is o2.x" msgstr "" +"class C:\n" +" x = []\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"o1 = C()\n" +"o2 = C()\n" +"o1.add(1)\n" +"o2.add(2)\n" +"assert o1.x == [1, 2]\n" +"assert o1.x is o2.x" -#: ../../library/dataclasses.rst:738 +#: ../../library/dataclasses.rst:751 #, fuzzy msgid "" "Note that the two instances of class :class:`!C` share the same class " @@ -1361,12 +1493,12 @@ msgstr "" "請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的" "那樣。" -#: ../../library/dataclasses.rst:741 +#: ../../library/dataclasses.rst:754 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" msgstr "使用資料類別,*如果*此程式碼有效: ::" -#: ../../library/dataclasses.rst:743 +#: ../../library/dataclasses.rst:756 msgid "" "@dataclass\n" "class D:\n" @@ -1374,12 +1506,17 @@ msgid "" " def add(self, element):\n" " self.x.append(element)" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = [] # 這段程式碼會引發 ValueError\n" +" def add(self, element):\n" +" self.x.append(element)" -#: ../../library/dataclasses.rst:749 +#: ../../library/dataclasses.rst:762 msgid "it would generate code similar to::" msgstr "它會生成類似的程式碼: ::" -#: ../../library/dataclasses.rst:751 +#: ../../library/dataclasses.rst:764 msgid "" "class D:\n" " x = []\n" @@ -1390,8 +1527,16 @@ msgid "" "\n" "assert D().x is D().x" msgstr "" +"class D:\n" +" x = []\n" +" def __init__(self, x=x):\n" +" self.x = x\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"assert D().x is D().x" -#: ../../library/dataclasses.rst:760 +#: ../../library/dataclasses.rst:773 #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " @@ -1405,20 +1550,20 @@ msgid "" "partial solution, but it does protect against many common errors." msgstr "" "這與使用類別 :class:`!C` 的原始示例存在相同的問題。也就是說,類別 :class:`!" -"D` 的兩個實例在建立類實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` 的" -"同一個副本。因為資料類別只是使用普通的 Python 類建立,所以它們也有這種行為。" -"資料類別沒有通用的方法來檢測這種情況。相反,如果 :func:`dataclass` 裝飾器檢測" -"到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散列" -"的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" +"D` 的兩個實例在建立類別實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` " +"的同一個副本。因為資料類別只是使用普通的 Python 類別建立,所以它們也有這種行" +"為。資料類別沒有通用的方法來檢測這種情況。相反,如果 :func:`dataclass` 裝飾器" +"檢測到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散" +"列的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" -#: ../../library/dataclasses.rst:771 +#: ../../library/dataclasses.rst:784 #, fuzzy msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法: ::" -#: ../../library/dataclasses.rst:774 +#: ../../library/dataclasses.rst:787 msgid "" "@dataclass\n" "class D:\n" @@ -1426,8 +1571,13 @@ msgid "" "\n" "assert D().x is not D().x" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = field(default_factory=list)\n" +"\n" +"assert D().x is not D().x" -#: ../../library/dataclasses.rst:780 +#: ../../library/dataclasses.rst:793 #, fuzzy msgid "" "Instead of looking for and disallowing objects of type :class:`list`, :class:" @@ -1437,12 +1587,12 @@ msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" -#: ../../library/dataclasses.rst:787 +#: ../../library/dataclasses.rst:800 #, fuzzy msgid "Descriptor-typed fields" msgstr "描述器型別的欄位" -#: ../../library/dataclasses.rst:789 +#: ../../library/dataclasses.rst:802 #, fuzzy msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " @@ -1450,7 +1600,7 @@ msgid "" msgstr "" "指定為\\ :ref:`描述器物件 `\\ 作為預設值的欄位具有以下特殊行為:" -#: ../../library/dataclasses.rst:792 +#: ../../library/dataclasses.rst:805 #, fuzzy msgid "" "The value for the field passed to the dataclass's :meth:`~object.__init__` " @@ -1460,17 +1610,17 @@ msgstr "" "傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" "`~object.__set__` 方法,而不是覆蓋描述器物件。" -#: ../../library/dataclasses.rst:796 +#: ../../library/dataclasses.rst:809 #, fuzzy msgid "" "Similarly, when getting or setting the field, the descriptor's :meth:" "`~object.__get__` or :meth:`!__set__` method is called rather than returning " "or overwriting the descriptor object." msgstr "" -"同樣,在獲取或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" +"同樣,在取得或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" -#: ../../library/dataclasses.rst:800 +#: ../../library/dataclasses.rst:813 #, fuzzy msgid "" "To determine whether a field contains a default value, :func:`@dataclass " @@ -1480,13 +1630,13 @@ msgid "" "default. On the other hand, if the descriptor raises :exc:`AttributeError` " "in this situation, no default value will be provided for the field." msgstr "" -"為了確定一個欄位是否包含預設值,:func:`@dataclass ` 將使用其類訪問" -"形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " +"為了確定一個欄位是否包含預設值,:func:`@dataclass ` 將使用其類別存" +"取形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " "type=cls)``。如果在這種情況下,描述器回傳一個值,它將用作欄位的預設值。另一方" "面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設" "值。" -#: ../../library/dataclasses.rst:810 +#: ../../library/dataclasses.rst:823 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -1514,8 +1664,33 @@ msgid "" "i.quantity_on_hand = 2.5 # calls __set__ with 2.5\n" "print(i.quantity_on_hand) # 2" msgstr "" +"class IntConversionDescriptor:\n" +" def __init__(self, *, default):\n" +" self._default = default\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self._name = \"_\" + name\n" +"\n" +" def __get__(self, obj, type):\n" +" if obj is None:\n" +" return self._default\n" +"\n" +" return getattr(obj, self._name, self._default)\n" +"\n" +" def __set__(self, obj, value):\n" +" setattr(obj, self._name, int(value))\n" +"\n" +"@dataclass\n" +"class InventoryItem:\n" +" quantity_on_hand: IntConversionDescriptor = " +"IntConversionDescriptor(default=100)\n" +"\n" +"i = InventoryItem()\n" +"print(i.quantity_on_hand) # 100\n" +"i.quantity_on_hand = 2.5 # 以 2.5 呼叫 __set__\n" +"print(i.quantity_on_hand) # 2" -#: ../../library/dataclasses.rst:835 +#: ../../library/dataclasses.rst:848 #, fuzzy msgid "" "Note that if a field is annotated with a descriptor type, but is not " diff --git a/library/datetime.po b/library/datetime.po index 5fcda8bc81..1bec6171ca 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1078,8 +1078,8 @@ msgstr "" #: ../../library/datetime.rst:669 msgid "" -"Return a date with the same value, except for those parameters given new " -"values by whichever keyword arguments are specified." +"Return a new :class:`date` object with the same values, but with specified " +"parameters updated." msgstr "" #: ../../library/datetime.rst:672 ../../library/datetime.rst:1937 @@ -1100,8 +1100,8 @@ msgstr "" #: ../../library/datetime.rst:679 msgid "" -":class:`date` objects are also supported by generic function :func:`copy." -"replace`." +"The generic function :func:`copy.replace` also supports :class:`date` " +"objects." msgstr "" #: ../../library/datetime.rst:685 ../../library/datetime.rst:1405 @@ -1331,7 +1331,7 @@ msgid "" "\n" ">>> # Methods for to extracting 'components' under different calendars\n" ">>> t = d.timetuple()\n" -">>> for i in t: \n" +">>> for i in t:\n" "... print(i)\n" "2002 # year\n" "3 # month\n" @@ -1343,7 +1343,7 @@ msgid "" "70 # 70th day in the year\n" "-1\n" ">>> ic = d.isocalendar()\n" -">>> for i in ic: \n" +">>> for i in ic:\n" "... print(i)\n" "2002 # ISO year\n" "11 # ISO week number\n" @@ -1493,7 +1493,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:940 -msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." +msgid "Use :meth:`datetime.now` with :const:`UTC` instead." msgstr "" #: ../../library/datetime.rst:945 @@ -1593,7 +1593,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:1012 -msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." +msgid "Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead." msgstr "" #: ../../library/datetime.rst:1017 @@ -1664,7 +1664,7 @@ msgid "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." "utc)\n" -">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00') \n" +">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" msgstr "" @@ -1686,7 +1686,7 @@ msgstr "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." "utc)\n" -">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00') \n" +">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" @@ -1745,7 +1745,7 @@ msgid "" ">>> date_string = \"02/29\"\n" ">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " "Avoids leap year bug.\n" -">>> when.strftime(\"%B %d\") \n" +">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" @@ -1957,10 +1957,10 @@ msgstr "" #: ../../library/datetime.rst:1318 msgid "" -"Return a datetime with the same attributes, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive datetime from an aware " -"datetime with no conversion of date and time data." +"Return a new :class:`datetime` object with the same attributes, but with " +"specified parameters updated. Note that ``tzinfo=None`` can be specified to " +"create a naive datetime from an aware datetime with no conversion of date " +"and time data." msgstr "" #: ../../library/datetime.rst:1323 @@ -2310,14 +2310,14 @@ msgstr "" #: ../../library/datetime.rst:1563 msgid "" ">>> from datetime import datetime\n" -">>> datetime.now().isoformat(timespec='minutes') \n" +">>> datetime.now().isoformat(timespec='minutes')\n" "'2002-12-25T00:00'\n" ">>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)\n" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" msgstr "" ">>> from datetime import datetime\n" -">>> datetime.now().isoformat(timespec='minutes') \n" +">>> datetime.now().isoformat(timespec='minutes')\n" "'2002-12-25T00:00'\n" ">>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)\n" ">>> dt.isoformat(timespec='microseconds')\n" @@ -2394,9 +2394,9 @@ msgid "" "datetime.datetime(2005, 7, 14, 12, 30)\n" "\n" ">>> # Using datetime.now()\n" -">>> datetime.now() \n" +">>> datetime.now()\n" "datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1\n" -">>> datetime.now(timezone.utc) \n" +">>> datetime.now(timezone.utc)\n" "datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone." "utc)\n" "\n" @@ -2407,7 +2407,7 @@ msgid "" "\n" ">>> # Using datetime.timetuple() to get tuple of all attributes\n" ">>> tt = dt.timetuple()\n" -">>> for it in tt: \n" +">>> for it in tt:\n" "... print(it)\n" "...\n" "2006 # year\n" @@ -2422,7 +2422,7 @@ msgid "" "\n" ">>> # Date in ISO format\n" ">>> ic = dt.isocalendar()\n" -">>> for it in ic: \n" +">>> for it in ic:\n" "... print(it)\n" "...\n" "2006 # ISO year\n" @@ -2677,10 +2677,10 @@ msgstr "" #: ../../library/datetime.rst:1896 msgid "" -"Return a :class:`.time` with the same value, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive :class:`.time` from an " -"aware :class:`.time`, without conversion of the time data." +"Return a new :class:`.time` with the same values, but with specified " +"parameters updated. Note that ``tzinfo=None`` can be specified to create a " +"naive :class:`.time` from an aware :class:`.time`, without conversion of the " +"time data." msgstr "" #: ../../library/datetime.rst:1901 diff --git a/library/dbm.po b/library/dbm.po index a3a5e9c26d..473658aa90 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -599,7 +599,7 @@ msgstr "" #: ../../library/dbm.rst:457 msgid "" "Synchronize the on-disk directory and data files. This method is called by " -"the :meth:`Shelve.sync` method." +"the :meth:`shelve.Shelf.sync` method." msgstr "" #: ../../library/dbm.rst:462 diff --git a/library/decimal.po b/library/decimal.po index 0ab719a400..b2f4740813 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -542,10 +542,12 @@ msgid "" "Other Unicode decimal digits are also permitted where ``digit`` appears " "above. These include decimal digits from various other alphabets (for " "example, Arabic-Indic and Devanāgarī digits) along with the fullwidth digits " -"``'\\uff10'`` through ``'\\uff19'``." +"``'\\uff10'`` through ``'\\uff19'``. Case is not significant, so, for " +"example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable " +"spellings for positive infinity." msgstr "" -#: ../../library/decimal.rst:371 +#: ../../library/decimal.rst:373 msgid "" "If *value* is a :class:`tuple`, it should have three components, a sign " "(``0`` for positive or ``1`` for negative), a :class:`tuple` of digits, and " @@ -553,7 +555,7 @@ msgid "" "``Decimal('1.414')``." msgstr "" -#: ../../library/decimal.rst:376 +#: ../../library/decimal.rst:378 msgid "" "If *value* is a :class:`float`, the binary floating-point value is " "losslessly converted to its exact decimal equivalent. This conversion can " @@ -562,7 +564,7 @@ msgid "" "``Decimal('1.100000000000000088817841970012523233890533447265625')``." msgstr "" -#: ../../library/decimal.rst:382 +#: ../../library/decimal.rst:384 msgid "" "The *context* precision does not affect how many digits are stored. That is " "determined exclusively by the number of digits in *value*. For example, " @@ -570,7 +572,7 @@ msgid "" "is only three." msgstr "" -#: ../../library/decimal.rst:387 +#: ../../library/decimal.rst:389 msgid "" "The purpose of the *context* argument is determining what to do if *value* " "is a malformed string. If the context traps :const:`InvalidOperation`, an " @@ -578,29 +580,29 @@ msgid "" "the value of ``NaN``." msgstr "" -#: ../../library/decimal.rst:392 +#: ../../library/decimal.rst:394 msgid "Once constructed, :class:`Decimal` objects are immutable." msgstr "" -#: ../../library/decimal.rst:394 +#: ../../library/decimal.rst:396 msgid "" "The argument to the constructor is now permitted to be a :class:`float` " "instance." msgstr "" -#: ../../library/decimal.rst:398 +#: ../../library/decimal.rst:400 msgid "" ":class:`float` arguments raise an exception if the :exc:`FloatOperation` " "trap is set. By default the trap is off." msgstr "" -#: ../../library/decimal.rst:402 +#: ../../library/decimal.rst:404 msgid "" "Underscores are allowed for grouping, as with integral and floating-point " "literals in code." msgstr "" -#: ../../library/decimal.rst:406 +#: ../../library/decimal.rst:408 msgid "" "Decimal floating-point objects share many properties with the other built-in " "numeric types such as :class:`float` and :class:`int`. All of the usual " @@ -610,7 +612,7 @@ msgid "" "class:`int`)." msgstr "" -#: ../../library/decimal.rst:413 +#: ../../library/decimal.rst:415 msgid "" "There are some small differences between arithmetic on Decimal objects and " "arithmetic on integers and floats. When the remainder operator ``%`` is " @@ -618,7 +620,7 @@ msgid "" "*dividend* rather than the sign of the divisor::" msgstr "" -#: ../../library/decimal.rst:418 +#: ../../library/decimal.rst:420 msgid "" ">>> (-7) % 4\n" "1\n" @@ -630,14 +632,14 @@ msgstr "" ">>> Decimal(-7) % Decimal(4)\n" "Decimal('-3')" -#: ../../library/decimal.rst:423 +#: ../../library/decimal.rst:425 msgid "" "The integer division operator ``//`` behaves analogously, returning the " "integer part of the true quotient (truncating towards zero) rather than its " "floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::" msgstr "" -#: ../../library/decimal.rst:427 +#: ../../library/decimal.rst:429 msgid "" ">>> -7 // 4\n" "-2\n" @@ -649,13 +651,13 @@ msgstr "" ">>> Decimal(-7) // Decimal(4)\n" "Decimal('-1')" -#: ../../library/decimal.rst:432 +#: ../../library/decimal.rst:434 msgid "" "The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-" "integer`` operations (respectively) as described in the specification." msgstr "" -#: ../../library/decimal.rst:436 +#: ../../library/decimal.rst:438 msgid "" "Decimal objects cannot generally be combined with floats or instances of :" "class:`fractions.Fraction` in arithmetic operations: an attempt to add a :" @@ -666,19 +668,19 @@ msgid "" "numbers of different types." msgstr "" -#: ../../library/decimal.rst:444 +#: ../../library/decimal.rst:446 msgid "" "Mixed-type comparisons between :class:`Decimal` instances and other numeric " "types are now fully supported." msgstr "" -#: ../../library/decimal.rst:448 +#: ../../library/decimal.rst:450 msgid "" "In addition to the standard numeric properties, decimal floating-point " "objects also have a number of specialized methods:" msgstr "" -#: ../../library/decimal.rst:454 +#: ../../library/decimal.rst:456 msgid "" "Return the adjusted exponent after shifting out the coefficient's rightmost " "digits until only the lead digit remains: ``Decimal('321e+5').adjusted()`` " @@ -686,14 +688,14 @@ msgid "" "digit with respect to the decimal point." msgstr "" -#: ../../library/decimal.rst:461 +#: ../../library/decimal.rst:463 msgid "" "Return a pair ``(n, d)`` of integers that represent the given :class:" "`Decimal` instance as a fraction, in lowest terms and with a positive " "denominator::" msgstr "" -#: ../../library/decimal.rst:465 +#: ../../library/decimal.rst:467 msgid "" ">>> Decimal('-3.14').as_integer_ratio()\n" "(-157, 50)" @@ -701,32 +703,32 @@ msgstr "" ">>> Decimal('-3.14').as_integer_ratio()\n" "(-157, 50)" -#: ../../library/decimal.rst:468 +#: ../../library/decimal.rst:470 msgid "" "The conversion is exact. Raise OverflowError on infinities and ValueError " "on NaNs." msgstr "" -#: ../../library/decimal.rst:475 +#: ../../library/decimal.rst:477 msgid "" "Return a :term:`named tuple` representation of the number: " "``DecimalTuple(sign, digits, exponent)``." msgstr "" -#: ../../library/decimal.rst:481 +#: ../../library/decimal.rst:483 msgid "" "Return the canonical encoding of the argument. Currently, the encoding of " "a :class:`Decimal` instance is always canonical, so this operation returns " "its argument unchanged." msgstr "" -#: ../../library/decimal.rst:487 +#: ../../library/decimal.rst:489 msgid "" "Compare the values of two Decimal instances. :meth:`compare` returns a " "Decimal instance, and if either operand is a NaN then the result is a NaN::" msgstr "" -#: ../../library/decimal.rst:491 +#: ../../library/decimal.rst:493 msgid "" "a or b is a NaN ==> Decimal('NaN')\n" "a < b ==> Decimal('-1')\n" @@ -738,14 +740,14 @@ msgstr "" "a == b ==> Decimal('0')\n" "a > b ==> Decimal('1')" -#: ../../library/decimal.rst:498 +#: ../../library/decimal.rst:500 msgid "" "This operation is identical to the :meth:`compare` method, except that all " "NaNs signal. That is, if neither operand is a signaling NaN then any quiet " "NaN operand is treated as though it were a signaling NaN." msgstr "" -#: ../../library/decimal.rst:504 +#: ../../library/decimal.rst:506 msgid "" "Compare two operands using their abstract representation rather than their " "numerical value. Similar to the :meth:`compare` method, but the result " @@ -754,7 +756,7 @@ msgid "" "unequal in this ordering:" msgstr "" -#: ../../library/decimal.rst:513 +#: ../../library/decimal.rst:515 msgid "" "Quiet and signaling NaNs are also included in the total ordering. The " "result of this function is ``Decimal('0')`` if both operands have the same " @@ -764,15 +766,15 @@ msgid "" "details of the total order." msgstr "" -#: ../../library/decimal.rst:520 ../../library/decimal.rst:531 -#: ../../library/decimal.rst:559 ../../library/decimal.rst:846 +#: ../../library/decimal.rst:522 ../../library/decimal.rst:533 +#: ../../library/decimal.rst:561 ../../library/decimal.rst:848 msgid "" "This operation is unaffected by context and is quiet: no flags are changed " "and no rounding is performed. As an exception, the C version may raise " "InvalidOperation if the second operand cannot be converted exactly." msgstr "" -#: ../../library/decimal.rst:526 +#: ../../library/decimal.rst:528 msgid "" "Compare two operands using their abstract representation rather than their " "value as in :meth:`compare_total`, but ignoring the sign of each operand. " @@ -780,44 +782,44 @@ msgid "" "copy_abs())``." msgstr "" -#: ../../library/decimal.rst:537 +#: ../../library/decimal.rst:539 msgid "" "Just returns self, this method is only to comply with the Decimal " "Specification." msgstr "" -#: ../../library/decimal.rst:542 +#: ../../library/decimal.rst:544 msgid "" "Return the absolute value of the argument. This operation is unaffected by " "the context and is quiet: no flags are changed and no rounding is performed." msgstr "" -#: ../../library/decimal.rst:548 +#: ../../library/decimal.rst:550 msgid "" "Return the negation of the argument. This operation is unaffected by the " "context and is quiet: no flags are changed and no rounding is performed." msgstr "" -#: ../../library/decimal.rst:553 +#: ../../library/decimal.rst:555 msgid "" "Return a copy of the first operand with the sign set to be the same as the " "sign of the second operand. For example:" msgstr "" -#: ../../library/decimal.rst:565 +#: ../../library/decimal.rst:567 msgid "" "Return the value of the (natural) exponential function ``e**x`` at the given " "number. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` " "rounding mode." msgstr "" -#: ../../library/decimal.rst:576 +#: ../../library/decimal.rst:578 msgid "" "Alternative constructor that only accepts instances of :class:`float` or :" "class:`int`." msgstr "" -#: ../../library/decimal.rst:579 +#: ../../library/decimal.rst:581 msgid "" "Note ``Decimal.from_float(0.1)`` is not the same as ``Decimal('0.1')``. " "Since 0.1 is not exactly representable in binary floating point, the value " @@ -826,13 +828,13 @@ msgid "" "``0.1000000000000000055511151231257827021181583404541015625``." msgstr "" -#: ../../library/decimal.rst:585 +#: ../../library/decimal.rst:587 msgid "" "From Python 3.2 onwards, a :class:`Decimal` instance can also be constructed " "directly from a :class:`float`." msgstr "" -#: ../../library/decimal.rst:588 +#: ../../library/decimal.rst:590 msgid "" ">>> Decimal.from_float(0.1)\n" "Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" @@ -852,86 +854,86 @@ msgstr "" ">>> Decimal.from_float(float('-inf'))\n" "Decimal('-Infinity')" -#: ../../library/decimal.rst:603 +#: ../../library/decimal.rst:605 msgid "" "Fused multiply-add. Return self*other+third with no rounding of the " "intermediate product self*other." msgstr "" -#: ../../library/decimal.rst:611 +#: ../../library/decimal.rst:613 msgid "" "Return :const:`True` if the argument is canonical and :const:`False` " "otherwise. Currently, a :class:`Decimal` instance is always canonical, so " "this operation always returns :const:`True`." msgstr "" -#: ../../library/decimal.rst:617 +#: ../../library/decimal.rst:619 msgid "" "Return :const:`True` if the argument is a finite number, and :const:`False` " "if the argument is an infinity or a NaN." msgstr "" -#: ../../library/decimal.rst:622 +#: ../../library/decimal.rst:624 msgid "" "Return :const:`True` if the argument is either positive or negative infinity " "and :const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:627 +#: ../../library/decimal.rst:629 msgid "" "Return :const:`True` if the argument is a (quiet or signaling) NaN and :" "const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:632 +#: ../../library/decimal.rst:634 msgid "" "Return :const:`True` if the argument is a *normal* finite number. Return :" "const:`False` if the argument is zero, subnormal, infinite or a NaN." msgstr "" -#: ../../library/decimal.rst:637 +#: ../../library/decimal.rst:639 msgid "" "Return :const:`True` if the argument is a quiet NaN, and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:642 +#: ../../library/decimal.rst:644 msgid "" "Return :const:`True` if the argument has a negative sign and :const:`False` " "otherwise. Note that zeros and NaNs can both carry signs." msgstr "" -#: ../../library/decimal.rst:647 +#: ../../library/decimal.rst:649 msgid "" "Return :const:`True` if the argument is a signaling NaN and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:652 +#: ../../library/decimal.rst:654 msgid "" "Return :const:`True` if the argument is subnormal, and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:657 +#: ../../library/decimal.rst:659 msgid "" "Return :const:`True` if the argument is a (positive or negative) zero and :" "const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:662 +#: ../../library/decimal.rst:664 msgid "" "Return the natural (base e) logarithm of the operand. The result is " "correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: ../../library/decimal.rst:667 +#: ../../library/decimal.rst:669 msgid "" "Return the base ten logarithm of the operand. The result is correctly " "rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: ../../library/decimal.rst:672 +#: ../../library/decimal.rst:674 msgid "" "For a nonzero number, return the adjusted exponent of its operand as a :" "class:`Decimal` instance. If the operand is a zero then ``Decimal('-" @@ -939,74 +941,74 @@ msgid "" "the operand is an infinity then ``Decimal('Infinity')`` is returned." msgstr "" -#: ../../library/decimal.rst:680 +#: ../../library/decimal.rst:682 msgid "" ":meth:`logical_and` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "``and`` of the two operands." msgstr "" -#: ../../library/decimal.rst:686 +#: ../../library/decimal.rst:688 msgid "" ":meth:`logical_invert` is a logical operation. The result is the digit-wise " "inversion of the operand." msgstr "" -#: ../../library/decimal.rst:691 +#: ../../library/decimal.rst:693 msgid "" ":meth:`logical_or` is a logical operation which takes two *logical operands* " "(see :ref:`logical_operands_label`). The result is the digit-wise ``or`` of " "the two operands." msgstr "" -#: ../../library/decimal.rst:697 +#: ../../library/decimal.rst:699 msgid "" ":meth:`logical_xor` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "exclusive or of the two operands." msgstr "" -#: ../../library/decimal.rst:703 +#: ../../library/decimal.rst:705 msgid "" "Like ``max(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: ../../library/decimal.rst:710 +#: ../../library/decimal.rst:712 msgid "" "Similar to the :meth:`.max` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: ../../library/decimal.rst:715 +#: ../../library/decimal.rst:717 msgid "" "Like ``min(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: ../../library/decimal.rst:722 +#: ../../library/decimal.rst:724 msgid "" "Similar to the :meth:`.min` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: ../../library/decimal.rst:727 +#: ../../library/decimal.rst:729 msgid "" "Return the largest number representable in the given context (or in the " "current thread's context if no context is given) that is smaller than the " "given operand." msgstr "" -#: ../../library/decimal.rst:733 +#: ../../library/decimal.rst:735 msgid "" "Return the smallest number representable in the given context (or in the " "current thread's context if no context is given) that is larger than the " "given operand." msgstr "" -#: ../../library/decimal.rst:739 +#: ../../library/decimal.rst:741 msgid "" "If the two operands are unequal, return the number closest to the first " "operand in the direction of the second operand. If both operands are " @@ -1014,13 +1016,13 @@ msgid "" "be the same as the sign of the second operand." msgstr "" -#: ../../library/decimal.rst:746 +#: ../../library/decimal.rst:748 msgid "" "Used for producing canonical values of an equivalence class within either " "the current context or the specified context." msgstr "" -#: ../../library/decimal.rst:749 +#: ../../library/decimal.rst:751 msgid "" "This has the same semantics as the unary plus operation, except that if the " "final result is finite it is reduced to its simplest form, with all trailing " @@ -1030,79 +1032,79 @@ msgid "" "exponent is set to 0. In all cases the sign is unchanged." msgstr "" -#: ../../library/decimal.rst:756 +#: ../../library/decimal.rst:758 msgid "" "For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both " "normalize to the equivalent value ``Decimal('32.1')``." msgstr "" -#: ../../library/decimal.rst:759 +#: ../../library/decimal.rst:761 msgid "Note that rounding is applied *before* reducing to simplest form." msgstr "" -#: ../../library/decimal.rst:761 +#: ../../library/decimal.rst:763 msgid "" "In the latest versions of the specification, this operation is also known as " "``reduce``." msgstr "" -#: ../../library/decimal.rst:766 +#: ../../library/decimal.rst:768 msgid "" "Return a string describing the *class* of the operand. The returned value " "is one of the following ten strings." msgstr "" -#: ../../library/decimal.rst:769 +#: ../../library/decimal.rst:771 msgid "``\"-Infinity\"``, indicating that the operand is negative infinity." msgstr "" -#: ../../library/decimal.rst:770 +#: ../../library/decimal.rst:772 msgid "" "``\"-Normal\"``, indicating that the operand is a negative normal number." msgstr "" -#: ../../library/decimal.rst:771 +#: ../../library/decimal.rst:773 msgid "" "``\"-Subnormal\"``, indicating that the operand is negative and subnormal." msgstr "" -#: ../../library/decimal.rst:772 +#: ../../library/decimal.rst:774 msgid "``\"-Zero\"``, indicating that the operand is a negative zero." msgstr "" -#: ../../library/decimal.rst:773 +#: ../../library/decimal.rst:775 msgid "``\"+Zero\"``, indicating that the operand is a positive zero." msgstr "" -#: ../../library/decimal.rst:774 +#: ../../library/decimal.rst:776 msgid "" "``\"+Subnormal\"``, indicating that the operand is positive and subnormal." msgstr "" -#: ../../library/decimal.rst:775 +#: ../../library/decimal.rst:777 msgid "" "``\"+Normal\"``, indicating that the operand is a positive normal number." msgstr "" -#: ../../library/decimal.rst:776 +#: ../../library/decimal.rst:778 msgid "``\"+Infinity\"``, indicating that the operand is positive infinity." msgstr "" -#: ../../library/decimal.rst:777 +#: ../../library/decimal.rst:779 msgid "``\"NaN\"``, indicating that the operand is a quiet NaN (Not a Number)." msgstr "" -#: ../../library/decimal.rst:778 +#: ../../library/decimal.rst:780 msgid "``\"sNaN\"``, indicating that the operand is a signaling NaN." msgstr "" -#: ../../library/decimal.rst:782 +#: ../../library/decimal.rst:784 msgid "" "Return a value equal to the first operand after rounding and having the " "exponent of the second operand." msgstr "" -#: ../../library/decimal.rst:788 +#: ../../library/decimal.rst:790 msgid "" "Unlike other operations, if the length of the coefficient after the quantize " "operation would be greater than precision, then an :const:`InvalidOperation` " @@ -1110,13 +1112,13 @@ msgid "" "quantized exponent is always equal to that of the right-hand operand." msgstr "" -#: ../../library/decimal.rst:794 +#: ../../library/decimal.rst:796 msgid "" "Also unlike other operations, quantize never signals Underflow, even if the " "result is subnormal and inexact." msgstr "" -#: ../../library/decimal.rst:797 +#: ../../library/decimal.rst:799 msgid "" "If the exponent of the second operand is larger than that of the first then " "rounding may be necessary. In this case, the rounding mode is determined by " @@ -1125,19 +1127,19 @@ msgid "" "context is used." msgstr "" -#: ../../library/decimal.rst:803 +#: ../../library/decimal.rst:805 msgid "" "An error is returned whenever the resulting exponent is greater than :attr:" "`~Context.Emax` or less than :meth:`~Context.Etiny`." msgstr "" -#: ../../library/decimal.rst:808 +#: ../../library/decimal.rst:810 msgid "" "Return ``Decimal(10)``, the radix (base) in which the :class:`Decimal` class " "does all its arithmetic. Included for compatibility with the specification." msgstr "" -#: ../../library/decimal.rst:814 +#: ../../library/decimal.rst:816 msgid "" "Return the remainder from dividing *self* by *other*. This differs from " "``self % other`` in that the sign of the remainder is chosen so as to " @@ -1146,11 +1148,11 @@ msgid "" "other``, and if two integers are equally near then the even one is chosen." msgstr "" -#: ../../library/decimal.rst:821 +#: ../../library/decimal.rst:823 msgid "If the result is zero then its sign will be the sign of *self*." msgstr "" -#: ../../library/decimal.rst:832 +#: ../../library/decimal.rst:834 msgid "" "Return the result of rotating the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1162,20 +1164,20 @@ msgid "" "are unchanged." msgstr "" -#: ../../library/decimal.rst:843 +#: ../../library/decimal.rst:845 msgid "" "Test whether self and other have the same exponent or whether both are " "``NaN``." msgstr "" -#: ../../library/decimal.rst:852 +#: ../../library/decimal.rst:854 msgid "" "Return the first operand with exponent adjusted by the second. Equivalently, " "return the first operand multiplied by ``10**other``. The second operand " "must be an integer." msgstr "" -#: ../../library/decimal.rst:858 +#: ../../library/decimal.rst:860 msgid "" "Return the result of shifting the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1186,34 +1188,34 @@ msgid "" "exponent of the first operand are unchanged." msgstr "" -#: ../../library/decimal.rst:868 +#: ../../library/decimal.rst:870 msgid "Return the square root of the argument to full precision." msgstr "" -#: ../../library/decimal.rst:873 ../../library/decimal.rst:1510 +#: ../../library/decimal.rst:875 ../../library/decimal.rst:1512 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: ../../library/decimal.rst:875 ../../library/decimal.rst:1512 +#: ../../library/decimal.rst:877 ../../library/decimal.rst:1514 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " "addition of either one or two trailing zeros." msgstr "" -#: ../../library/decimal.rst:879 +#: ../../library/decimal.rst:881 msgid "" "For example, this converts ``Decimal('123E+1')`` to ``Decimal('1.23E+3')``." msgstr "" -#: ../../library/decimal.rst:883 +#: ../../library/decimal.rst:885 msgid "" "Identical to the :meth:`to_integral_value` method. The ``to_integral`` name " "has been kept for compatibility with older versions." msgstr "" -#: ../../library/decimal.rst:888 +#: ../../library/decimal.rst:890 msgid "" "Round to the nearest integer, signaling :const:`Inexact` or :const:`Rounded` " "as appropriate if rounding occurs. The rounding mode is determined by the " @@ -1221,18 +1223,18 @@ msgid "" "parameter is given then the rounding mode of the current context is used." msgstr "" -#: ../../library/decimal.rst:896 +#: ../../library/decimal.rst:898 msgid "" "Round to the nearest integer without signaling :const:`Inexact` or :const:" "`Rounded`. If given, applies *rounding*; otherwise, uses the rounding " "method in either the supplied *context* or the current context." msgstr "" -#: ../../library/decimal.rst:900 +#: ../../library/decimal.rst:902 msgid "Decimal numbers can be rounded using the :func:`.round` function:" msgstr "" -#: ../../library/decimal.rst:905 +#: ../../library/decimal.rst:907 msgid "" "If *ndigits* is not given or ``None``, returns the nearest :class:`int` to " "*number*, rounding ties to even, and ignoring the rounding mode of the :" @@ -1240,7 +1242,7 @@ msgid "" "infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." msgstr "" -#: ../../library/decimal.rst:911 +#: ../../library/decimal.rst:913 msgid "" "If *ndigits* is an :class:`int`, the context's rounding mode is respected " "and a :class:`Decimal` representing *number* rounded to the nearest multiple " @@ -1252,27 +1254,27 @@ msgid "" "the current context's precision. In other words, for the non-corner cases:" msgstr "" -#: ../../library/decimal.rst:921 +#: ../../library/decimal.rst:923 msgid "" "if *ndigits* is positive, return *number* rounded to *ndigits* decimal " "places;" msgstr "" -#: ../../library/decimal.rst:923 +#: ../../library/decimal.rst:925 msgid "if *ndigits* is zero, return *number* rounded to the nearest integer;" msgstr "" -#: ../../library/decimal.rst:924 +#: ../../library/decimal.rst:926 msgid "" "if *ndigits* is negative, return *number* rounded to the nearest multiple of " "``10**abs(ndigits)``." msgstr "" -#: ../../library/decimal.rst:927 +#: ../../library/decimal.rst:929 msgid "For example::" msgstr "" -#: ../../library/decimal.rst:929 +#: ../../library/decimal.rst:931 msgid "" ">>> from decimal import Decimal, getcontext, ROUND_DOWN\n" ">>> getcontext().rounding = ROUND_DOWN\n" @@ -1288,11 +1290,11 @@ msgid "" "Decimal('0E+1')" msgstr "" -#: ../../library/decimal.rst:946 +#: ../../library/decimal.rst:948 msgid "Logical operands" msgstr "" -#: ../../library/decimal.rst:948 +#: ../../library/decimal.rst:950 msgid "" "The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" "`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their " @@ -1301,38 +1303,38 @@ msgid "" "are all either ``0`` or ``1``." msgstr "" -#: ../../library/decimal.rst:960 +#: ../../library/decimal.rst:962 msgid "Context objects" msgstr "" -#: ../../library/decimal.rst:962 +#: ../../library/decimal.rst:964 msgid "" "Contexts are environments for arithmetic operations. They govern precision, " "set rules for rounding, determine which signals are treated as exceptions, " "and limit the range for exponents." msgstr "" -#: ../../library/decimal.rst:966 +#: ../../library/decimal.rst:968 msgid "" "Each thread has its own current context which is accessed or changed using " "the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" -#: ../../library/decimal.rst:972 +#: ../../library/decimal.rst:974 msgid "Return the current context for the active thread." msgstr "" -#: ../../library/decimal.rst:977 +#: ../../library/decimal.rst:979 msgid "Set the current context for the active thread to *c*." msgstr "" -#: ../../library/decimal.rst:979 +#: ../../library/decimal.rst:981 msgid "" "You can also use the :keyword:`with` statement and the :func:`localcontext` " "function to temporarily change the active context." msgstr "" -#: ../../library/decimal.rst:984 +#: ../../library/decimal.rst:986 msgid "" "Return a context manager that will set the current context for the active " "thread to a copy of *ctx* on entry to the with-statement and restore the " @@ -1341,14 +1343,14 @@ msgid "" "used to set the attributes of the new context." msgstr "" -#: ../../library/decimal.rst:990 +#: ../../library/decimal.rst:992 msgid "" "For example, the following code sets the current decimal precision to 42 " "places, performs a calculation, and then automatically restores the previous " "context::" msgstr "" -#: ../../library/decimal.rst:993 +#: ../../library/decimal.rst:995 msgid "" "from decimal import localcontext\n" "\n" @@ -1358,11 +1360,11 @@ msgid "" "s = +s # Round the final result back to the default precision" msgstr "" -#: ../../library/decimal.rst:1000 +#: ../../library/decimal.rst:1002 msgid "Using keyword arguments, the code would be the following::" msgstr "" -#: ../../library/decimal.rst:1002 +#: ../../library/decimal.rst:1004 msgid "" "from decimal import localcontext\n" "\n" @@ -1376,26 +1378,26 @@ msgstr "" " s = calculate_something()\n" "s = +s" -#: ../../library/decimal.rst:1008 +#: ../../library/decimal.rst:1010 msgid "" "Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" "`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" "`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" -#: ../../library/decimal.rst:1012 +#: ../../library/decimal.rst:1014 msgid "" ":meth:`localcontext` now supports setting context attributes through the use " "of keyword arguments." msgstr "" -#: ../../library/decimal.rst:1015 +#: ../../library/decimal.rst:1017 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" -#: ../../library/decimal.rst:1021 +#: ../../library/decimal.rst:1023 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -1404,12 +1406,12 @@ msgid "" "`Subnormal`." msgstr "" -#: ../../library/decimal.rst:1027 +#: ../../library/decimal.rst:1029 msgid "" "Because many of the traps are enabled, this context is useful for debugging." msgstr "" -#: ../../library/decimal.rst:1032 +#: ../../library/decimal.rst:1034 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -1417,7 +1419,7 @@ msgid "" "exceptions are not raised during computations)." msgstr "" -#: ../../library/decimal.rst:1037 +#: ../../library/decimal.rst:1039 msgid "" "Because the traps are disabled, this context is useful for applications that " "prefer to have result value of ``NaN`` or ``Infinity`` instead of raising " @@ -1425,7 +1427,7 @@ msgid "" "conditions that would otherwise halt the program." msgstr "" -#: ../../library/decimal.rst:1045 +#: ../../library/decimal.rst:1047 msgid "" "This context is used by the :class:`Context` constructor as a prototype for " "new contexts. Changing a field (such a precision) has the effect of " @@ -1433,7 +1435,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/decimal.rst:1049 +#: ../../library/decimal.rst:1051 msgid "" "This context is most useful in multi-threaded environments. Changing one of " "the fields before threads are started has the effect of setting system-wide " @@ -1441,65 +1443,65 @@ msgid "" "as it would require thread synchronization to prevent race conditions." msgstr "" -#: ../../library/decimal.rst:1054 +#: ../../library/decimal.rst:1056 msgid "" "In single threaded environments, it is preferable to not use this context at " "all. Instead, simply create contexts explicitly as described below." msgstr "" -#: ../../library/decimal.rst:1057 +#: ../../library/decimal.rst:1059 msgid "" "The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." "rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:" "`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." msgstr "" -#: ../../library/decimal.rst:1062 +#: ../../library/decimal.rst:1064 msgid "" "In addition to the three supplied contexts, new contexts can be created with " "the :class:`Context` constructor." msgstr "" -#: ../../library/decimal.rst:1068 +#: ../../library/decimal.rst:1070 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: ../../library/decimal.rst:1072 +#: ../../library/decimal.rst:1074 msgid "" "*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets the " "precision for arithmetic operations in the context." msgstr "" -#: ../../library/decimal.rst:1075 +#: ../../library/decimal.rst:1077 msgid "" "The *rounding* option is one of the constants listed in the section " "`Rounding Modes`_." msgstr "" -#: ../../library/decimal.rst:1078 +#: ../../library/decimal.rst:1080 msgid "" "The *traps* and *flags* fields list any signals to be set. Generally, new " "contexts should only set traps and leave the flags clear." msgstr "" -#: ../../library/decimal.rst:1081 +#: ../../library/decimal.rst:1083 msgid "" "The *Emin* and *Emax* fields are integers specifying the outer limits " "allowable for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, " "``0``], *Emax* in the range [``0``, :const:`MAX_EMAX`]." msgstr "" -#: ../../library/decimal.rst:1085 +#: ../../library/decimal.rst:1087 msgid "" "The *capitals* field is either ``0`` or ``1`` (the default). If set to " "``1``, exponents are printed with a capital ``E``; otherwise, a lowercase " "``e`` is used: ``Decimal('6.02e+23')``." msgstr "" -#: ../../library/decimal.rst:1089 +#: ../../library/decimal.rst:1091 msgid "" "The *clamp* field is either ``0`` (the default) or ``1``. If set to ``1``, " "the exponent ``e`` of a :class:`Decimal` instance representable in this " @@ -1513,7 +1515,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/decimal.rst:1101 +#: ../../library/decimal.rst:1103 msgid "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" @@ -1521,13 +1523,13 @@ msgstr "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" -#: ../../library/decimal.rst:1104 +#: ../../library/decimal.rst:1106 msgid "" "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " "interchange formats specified in IEEE 754." msgstr "" -#: ../../library/decimal.rst:1107 +#: ../../library/decimal.rst:1109 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " @@ -1540,30 +1542,30 @@ msgid "" "instance of :class:`int`) anywhere that a Decimal instance is accepted." msgstr "" -#: ../../library/decimal.rst:1120 +#: ../../library/decimal.rst:1122 msgid "Resets all of the flags to ``0``." msgstr "" -#: ../../library/decimal.rst:1124 +#: ../../library/decimal.rst:1126 msgid "Resets all of the traps to ``0``." msgstr "" -#: ../../library/decimal.rst:1130 +#: ../../library/decimal.rst:1132 msgid "Return a duplicate of the context." msgstr "" -#: ../../library/decimal.rst:1134 +#: ../../library/decimal.rst:1136 msgid "Return a copy of the Decimal instance num." msgstr "" -#: ../../library/decimal.rst:1138 +#: ../../library/decimal.rst:1140 msgid "" "Creates a new Decimal instance from *num* but using *self* as context. " "Unlike the :class:`Decimal` constructor, the context precision, rounding " "method, flags, and traps are applied to the conversion." msgstr "" -#: ../../library/decimal.rst:1142 +#: ../../library/decimal.rst:1144 msgid "" "This is useful because constants are often given to a greater precision than " "is needed by the application. Another benefit is that rounding immediately " @@ -1572,7 +1574,7 @@ msgid "" "sum can change the result:" msgstr "" -#: ../../library/decimal.rst:1148 +#: ../../library/decimal.rst:1150 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.4445') + Decimal('1.0023')\n" @@ -1586,14 +1588,14 @@ msgstr "" ">>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\n" "Decimal('4.44')" -#: ../../library/decimal.rst:1156 +#: ../../library/decimal.rst:1158 msgid "" "This method implements the to-number operation of the IBM specification. If " "the argument is a string, no leading or trailing whitespace or underscores " "are permitted." msgstr "" -#: ../../library/decimal.rst:1162 +#: ../../library/decimal.rst:1164 msgid "" "Creates a new Decimal instance from a float *f* but rounding using *self* as " "the context. Unlike the :meth:`Decimal.from_float` class method, the " @@ -1601,7 +1603,7 @@ msgid "" "conversion." msgstr "" -#: ../../library/decimal.rst:1167 +#: ../../library/decimal.rst:1169 msgid "" ">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" ">>> context.create_decimal_from_float(math.pi)\n" @@ -1621,18 +1623,18 @@ msgstr "" " ...\n" "decimal.Inexact: None" -#: ../../library/decimal.rst:1182 +#: ../../library/decimal.rst:1184 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " "value for subnormal results. When underflow occurs, the exponent is set to :" "const:`Etiny`." msgstr "" -#: ../../library/decimal.rst:1188 +#: ../../library/decimal.rst:1190 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: ../../library/decimal.rst:1190 +#: ../../library/decimal.rst:1192 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1642,189 +1644,189 @@ msgid "" "recounted here." msgstr "" -#: ../../library/decimal.rst:1200 +#: ../../library/decimal.rst:1202 msgid "Returns the absolute value of *x*." msgstr "" -#: ../../library/decimal.rst:1205 +#: ../../library/decimal.rst:1207 msgid "Return the sum of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1210 +#: ../../library/decimal.rst:1212 msgid "Returns the same Decimal object *x*." msgstr "" -#: ../../library/decimal.rst:1215 +#: ../../library/decimal.rst:1217 msgid "Compares *x* and *y* numerically." msgstr "" -#: ../../library/decimal.rst:1220 +#: ../../library/decimal.rst:1222 msgid "Compares the values of the two operands numerically." msgstr "" -#: ../../library/decimal.rst:1225 +#: ../../library/decimal.rst:1227 msgid "Compares two operands using their abstract representation." msgstr "" -#: ../../library/decimal.rst:1230 +#: ../../library/decimal.rst:1232 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: ../../library/decimal.rst:1235 +#: ../../library/decimal.rst:1237 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: ../../library/decimal.rst:1240 +#: ../../library/decimal.rst:1242 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: ../../library/decimal.rst:1245 +#: ../../library/decimal.rst:1247 msgid "Copies the sign from *y* to *x*." msgstr "" -#: ../../library/decimal.rst:1250 +#: ../../library/decimal.rst:1252 msgid "Return *x* divided by *y*." msgstr "" -#: ../../library/decimal.rst:1255 +#: ../../library/decimal.rst:1257 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: ../../library/decimal.rst:1260 +#: ../../library/decimal.rst:1262 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: ../../library/decimal.rst:1265 +#: ../../library/decimal.rst:1267 msgid "Returns ``e ** x``." msgstr "" -#: ../../library/decimal.rst:1270 +#: ../../library/decimal.rst:1272 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: ../../library/decimal.rst:1275 +#: ../../library/decimal.rst:1277 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1280 +#: ../../library/decimal.rst:1282 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1285 +#: ../../library/decimal.rst:1287 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1290 +#: ../../library/decimal.rst:1292 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1295 +#: ../../library/decimal.rst:1297 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1300 +#: ../../library/decimal.rst:1302 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1305 +#: ../../library/decimal.rst:1307 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1310 +#: ../../library/decimal.rst:1312 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1315 +#: ../../library/decimal.rst:1317 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1320 +#: ../../library/decimal.rst:1322 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1325 +#: ../../library/decimal.rst:1327 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1330 +#: ../../library/decimal.rst:1332 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1335 +#: ../../library/decimal.rst:1337 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: ../../library/decimal.rst:1340 +#: ../../library/decimal.rst:1342 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1345 +#: ../../library/decimal.rst:1347 msgid "Invert all the digits in *x*." msgstr "" -#: ../../library/decimal.rst:1350 +#: ../../library/decimal.rst:1352 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1355 +#: ../../library/decimal.rst:1357 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1360 +#: ../../library/decimal.rst:1362 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: ../../library/decimal.rst:1365 ../../library/decimal.rst:1375 +#: ../../library/decimal.rst:1367 ../../library/decimal.rst:1377 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: ../../library/decimal.rst:1370 +#: ../../library/decimal.rst:1372 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: ../../library/decimal.rst:1380 +#: ../../library/decimal.rst:1382 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: ../../library/decimal.rst:1385 +#: ../../library/decimal.rst:1387 msgid "Return the product of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1390 +#: ../../library/decimal.rst:1392 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: ../../library/decimal.rst:1395 +#: ../../library/decimal.rst:1397 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: ../../library/decimal.rst:1400 +#: ../../library/decimal.rst:1402 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: ../../library/decimal.rst:1405 +#: ../../library/decimal.rst:1407 msgid "Reduces *x* to its simplest form." msgstr "" -#: ../../library/decimal.rst:1410 +#: ../../library/decimal.rst:1412 msgid "Returns an indication of the class of *x*." msgstr "" -#: ../../library/decimal.rst:1415 +#: ../../library/decimal.rst:1417 msgid "" "Plus corresponds to the unary prefix plus operator in Python. This " "operation applies the context precision and rounding, so it is *not* an " "identity operation." msgstr "" -#: ../../library/decimal.rst:1422 +#: ../../library/decimal.rst:1424 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: ../../library/decimal.rst:1424 +#: ../../library/decimal.rst:1426 msgid "" "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " "be integral. The result will be inexact unless ``y`` is integral and the " @@ -1833,42 +1835,42 @@ msgid "" "in the Python version." msgstr "" -#: ../../library/decimal.rst:1430 +#: ../../library/decimal.rst:1432 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: ../../library/decimal.rst:1433 +#: ../../library/decimal.rst:1435 msgid "" "The C module computes :meth:`power` in terms of the correctly rounded :meth:" "`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " "always correctly rounded\"." msgstr "" -#: ../../library/decimal.rst:1438 +#: ../../library/decimal.rst:1440 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: ../../library/decimal.rst:1441 +#: ../../library/decimal.rst:1443 msgid "all three arguments must be integral" msgstr "" -#: ../../library/decimal.rst:1442 +#: ../../library/decimal.rst:1444 msgid "``y`` must be nonnegative" msgstr "" -#: ../../library/decimal.rst:1443 +#: ../../library/decimal.rst:1445 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: ../../library/decimal.rst:1444 +#: ../../library/decimal.rst:1446 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: ../../library/decimal.rst:1446 +#: ../../library/decimal.rst:1448 msgid "" "The value resulting from ``Context.power(x, y, modulo)`` is equal to the " "value that would be obtained by computing ``(x**y) % modulo`` with unbounded " @@ -1877,110 +1879,110 @@ msgid "" "result is always exact." msgstr "" -#: ../../library/decimal.rst:1456 +#: ../../library/decimal.rst:1458 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: ../../library/decimal.rst:1461 +#: ../../library/decimal.rst:1463 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: ../../library/decimal.rst:1466 +#: ../../library/decimal.rst:1468 msgid "Returns the remainder from integer division." msgstr "" -#: ../../library/decimal.rst:1468 +#: ../../library/decimal.rst:1470 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: ../../library/decimal.rst:1474 +#: ../../library/decimal.rst:1476 msgid "" "Returns ``x - y * n``, where *n* is the integer nearest the exact value of " "``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" -#: ../../library/decimal.rst:1480 +#: ../../library/decimal.rst:1482 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1485 +#: ../../library/decimal.rst:1487 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: ../../library/decimal.rst:1490 +#: ../../library/decimal.rst:1492 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: ../../library/decimal.rst:1495 +#: ../../library/decimal.rst:1497 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1500 +#: ../../library/decimal.rst:1502 msgid "Square root of a non-negative number to context precision." msgstr "" -#: ../../library/decimal.rst:1505 +#: ../../library/decimal.rst:1507 msgid "Return the difference between *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1519 +#: ../../library/decimal.rst:1521 msgid "Rounds to an integer." msgstr "" -#: ../../library/decimal.rst:1524 +#: ../../library/decimal.rst:1526 msgid "Converts a number to a string using scientific notation." msgstr "" -#: ../../library/decimal.rst:1531 +#: ../../library/decimal.rst:1533 msgid "Constants" msgstr "常數" -#: ../../library/decimal.rst:1533 +#: ../../library/decimal.rst:1535 msgid "" "The constants in this section are only relevant for the C module. They are " "also included in the pure Python version for compatibility." msgstr "" -#: ../../library/decimal.rst:1537 +#: ../../library/decimal.rst:1539 msgid "32-bit" msgstr "32 位元" -#: ../../library/decimal.rst:1537 +#: ../../library/decimal.rst:1539 msgid "64-bit" msgstr "64 位元" -#: ../../library/decimal.rst:1539 ../../library/decimal.rst:1541 +#: ../../library/decimal.rst:1541 ../../library/decimal.rst:1543 msgid "``425000000``" msgstr "``425000000``" -#: ../../library/decimal.rst:1539 ../../library/decimal.rst:1541 +#: ../../library/decimal.rst:1541 ../../library/decimal.rst:1543 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../library/decimal.rst:1543 +#: ../../library/decimal.rst:1545 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../library/decimal.rst:1543 +#: ../../library/decimal.rst:1545 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1547 msgid "``-849999999``" msgstr "``-849999999``" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1547 msgid "``-1999999999999999997``" msgstr "``-1999999999999999997``" -#: ../../library/decimal.rst:1551 +#: ../../library/decimal.rst:1553 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: ../../library/decimal.rst:1557 +#: ../../library/decimal.rst:1559 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1989,55 +1991,55 @@ msgid "" "scenarios." msgstr "" -#: ../../library/decimal.rst:1566 +#: ../../library/decimal.rst:1568 msgid "Rounding modes" msgstr "" -#: ../../library/decimal.rst:1570 +#: ../../library/decimal.rst:1572 msgid "Round towards ``Infinity``." msgstr "" -#: ../../library/decimal.rst:1574 +#: ../../library/decimal.rst:1576 msgid "Round towards zero." msgstr "" -#: ../../library/decimal.rst:1578 +#: ../../library/decimal.rst:1580 msgid "Round towards ``-Infinity``." msgstr "" -#: ../../library/decimal.rst:1582 +#: ../../library/decimal.rst:1584 msgid "Round to nearest with ties going towards zero." msgstr "" -#: ../../library/decimal.rst:1586 +#: ../../library/decimal.rst:1588 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: ../../library/decimal.rst:1590 +#: ../../library/decimal.rst:1592 msgid "Round to nearest with ties going away from zero." msgstr "" -#: ../../library/decimal.rst:1594 +#: ../../library/decimal.rst:1596 msgid "Round away from zero." msgstr "" -#: ../../library/decimal.rst:1598 +#: ../../library/decimal.rst:1600 msgid "" "Round away from zero if last digit after rounding towards zero would have " "been 0 or 5; otherwise round towards zero." msgstr "" -#: ../../library/decimal.rst:1605 +#: ../../library/decimal.rst:1607 msgid "Signals" msgstr "" -#: ../../library/decimal.rst:1607 +#: ../../library/decimal.rst:1609 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: ../../library/decimal.rst:1610 +#: ../../library/decimal.rst:1612 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -2045,7 +2047,7 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: ../../library/decimal.rst:1615 +#: ../../library/decimal.rst:1617 msgid "" "If the context's trap enabler is set for the signal, then the condition " "causes a Python exception to be raised. For example, if the :class:" @@ -2053,54 +2055,54 @@ msgid "" "raised upon encountering the condition." msgstr "" -#: ../../library/decimal.rst:1623 +#: ../../library/decimal.rst:1625 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: ../../library/decimal.rst:1625 +#: ../../library/decimal.rst:1627 msgid "" "Typically, clamping occurs when an exponent falls outside the context's :" "attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the " "exponent is reduced to fit by adding zeros to the coefficient." msgstr "" -#: ../../library/decimal.rst:1632 +#: ../../library/decimal.rst:1634 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: ../../library/decimal.rst:1637 +#: ../../library/decimal.rst:1639 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: ../../library/decimal.rst:1639 +#: ../../library/decimal.rst:1641 msgid "" "Can occur with division, modulo division, or when raising a number to a " "negative power. If this signal is not trapped, returns ``Infinity`` or ``-" "Infinity`` with the sign determined by the inputs to the calculation." msgstr "" -#: ../../library/decimal.rst:1646 +#: ../../library/decimal.rst:1648 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: ../../library/decimal.rst:1648 +#: ../../library/decimal.rst:1650 msgid "" "Signals when non-zero digits were discarded during rounding. The rounded " "result is returned. The signal flag or trap is used to detect when results " "are inexact." msgstr "" -#: ../../library/decimal.rst:1655 +#: ../../library/decimal.rst:1657 msgid "An invalid operation was performed." msgstr "" -#: ../../library/decimal.rst:1657 +#: ../../library/decimal.rst:1659 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns ``NaN``. Possible causes include::" msgstr "" -#: ../../library/decimal.rst:1660 +#: ../../library/decimal.rst:1662 msgid "" "Infinity - Infinity\n" "0 * Infinity\n" @@ -2122,11 +2124,11 @@ msgstr "" "x ** (non-integer)\n" "x ** Infinity" -#: ../../library/decimal.rst:1673 +#: ../../library/decimal.rst:1675 msgid "Numerical overflow." msgstr "" -#: ../../library/decimal.rst:1675 +#: ../../library/decimal.rst:1677 msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " @@ -2135,42 +2137,42 @@ msgid "" "`Rounded` are also signaled." msgstr "" -#: ../../library/decimal.rst:1684 +#: ../../library/decimal.rst:1686 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: ../../library/decimal.rst:1686 +#: ../../library/decimal.rst:1688 msgid "" "Signaled whenever rounding discards digits; even if those digits are zero " "(such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result " "unchanged. This signal is used to detect loss of significant digits." msgstr "" -#: ../../library/decimal.rst:1694 +#: ../../library/decimal.rst:1696 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -#: ../../library/decimal.rst:1696 +#: ../../library/decimal.rst:1698 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: ../../library/decimal.rst:1702 +#: ../../library/decimal.rst:1704 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: ../../library/decimal.rst:1704 +#: ../../library/decimal.rst:1706 msgid "" "Occurs when a subnormal result is pushed to zero by rounding. :class:" "`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: ../../library/decimal.rst:1710 +#: ../../library/decimal.rst:1712 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: ../../library/decimal.rst:1712 +#: ../../library/decimal.rst:1714 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " "permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." @@ -2181,18 +2183,18 @@ msgid "" "Context.create_decimal_from_float` do not set the flag." msgstr "" -#: ../../library/decimal.rst:1720 +#: ../../library/decimal.rst:1722 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " "conversions are silent. All other mixed operations raise :exc:" "`FloatOperation`." msgstr "" -#: ../../library/decimal.rst:1724 +#: ../../library/decimal.rst:1726 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: ../../library/decimal.rst:1726 +#: ../../library/decimal.rst:1728 msgid "" "exceptions.ArithmeticError(exceptions.Exception)\n" " DecimalException\n" @@ -2218,15 +2220,15 @@ msgstr "" " Subnormal\n" " FloatOperation(DecimalException, exceptions.TypeError)" -#: ../../library/decimal.rst:1745 +#: ../../library/decimal.rst:1747 msgid "Floating-Point Notes" msgstr "" -#: ../../library/decimal.rst:1749 +#: ../../library/decimal.rst:1751 msgid "Mitigating round-off error with increased precision" msgstr "" -#: ../../library/decimal.rst:1751 +#: ../../library/decimal.rst:1753 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent ``0.1`` exactly); however, some operations " @@ -2234,7 +2236,7 @@ msgid "" "precision." msgstr "" -#: ../../library/decimal.rst:1755 +#: ../../library/decimal.rst:1757 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -2243,7 +2245,7 @@ msgid "" "of the associative and distributive properties of addition:" msgstr "" -#: ../../library/decimal.rst:1761 +#: ../../library/decimal.rst:1763 msgid "" "# Examples from Seminumerical Algorithms, Section 4.2.2.\n" ">>> from decimal import Decimal, getcontext\n" @@ -2262,13 +2264,13 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1779 +#: ../../library/decimal.rst:1781 msgid "" "The :mod:`decimal` module makes it possible to restore the identities by " "expanding the precision sufficiently to avoid loss of significance:" msgstr "" -#: ../../library/decimal.rst:1782 +#: ../../library/decimal.rst:1784 msgid "" ">>> getcontext().prec = 20\n" ">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" @@ -2284,18 +2286,18 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1799 +#: ../../library/decimal.rst:1801 msgid "Special values" msgstr "特殊值" -#: ../../library/decimal.rst:1801 +#: ../../library/decimal.rst:1803 msgid "" "The number system for the :mod:`decimal` module provides special values " "including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, " "``+0`` and ``-0``." msgstr "" -#: ../../library/decimal.rst:1805 +#: ../../library/decimal.rst:1807 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -2304,14 +2306,14 @@ msgid "" "representable number." msgstr "" -#: ../../library/decimal.rst:1810 +#: ../../library/decimal.rst:1812 msgid "" "The infinities are signed (affine) and can be used in arithmetic operations " "where they get treated as very large, indeterminate numbers. For instance, " "adding a constant to infinity gives another infinite result." msgstr "" -#: ../../library/decimal.rst:1814 +#: ../../library/decimal.rst:1816 msgid "" "Some operations are indeterminate and return ``NaN``, or if the :exc:" "`InvalidOperation` signal is trapped, raise an exception. For example, " @@ -2322,14 +2324,14 @@ msgid "" "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: ../../library/decimal.rst:1822 +#: ../../library/decimal.rst:1824 msgid "" "A variant is ``sNaN`` which signals rather than remaining quiet after every " "operation. This is a useful return value when an invalid result needs to " "interrupt a calculation for special handling." msgstr "" -#: ../../library/decimal.rst:1826 +#: ../../library/decimal.rst:1828 msgid "" "The behavior of Python's comparison operators can be a little surprising " "where a ``NaN`` is involved. A test for equality where one of the operands " @@ -2346,7 +2348,7 @@ msgid "" "compare_signal` methods instead." msgstr "" -#: ../../library/decimal.rst:1839 +#: ../../library/decimal.rst:1841 msgid "" "The signed zeros can result from calculations that underflow. They keep the " "sign that would have resulted if the calculation had been carried out to " @@ -2354,7 +2356,7 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: ../../library/decimal.rst:1844 +#: ../../library/decimal.rst:1846 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " @@ -2363,11 +2365,11 @@ msgid "" "that the following calculation returns a value equal to zero:" msgstr "" -#: ../../library/decimal.rst:1859 +#: ../../library/decimal.rst:1861 msgid "Working with threads" msgstr "" -#: ../../library/decimal.rst:1861 +#: ../../library/decimal.rst:1863 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -2375,20 +2377,20 @@ msgid "" "other threads." msgstr "" -#: ../../library/decimal.rst:1865 +#: ../../library/decimal.rst:1867 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: ../../library/decimal.rst:1868 +#: ../../library/decimal.rst:1870 msgid "" "If :func:`setcontext` has not been called before :func:`getcontext`, then :" "func:`getcontext` will automatically create a new context for use in the " "current thread." msgstr "" -#: ../../library/decimal.rst:1872 +#: ../../library/decimal.rst:1874 msgid "" "The new context is copied from a prototype context called *DefaultContext*. " "To control the defaults so that each thread will use the same values " @@ -2397,7 +2399,7 @@ msgid "" "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: ../../library/decimal.rst:1878 +#: ../../library/decimal.rst:1880 msgid "" "# Set applicationwide defaults for all threads about to be launched\n" "DefaultContext.prec = 12\n" @@ -2413,17 +2415,17 @@ msgid "" " . . ." msgstr "" -#: ../../library/decimal.rst:1897 +#: ../../library/decimal.rst:1899 msgid "Recipes" msgstr "" -#: ../../library/decimal.rst:1899 +#: ../../library/decimal.rst:1901 msgid "" "Here are a few recipes that serve as utility functions and that demonstrate " "ways to work with the :class:`Decimal` class::" msgstr "" -#: ../../library/decimal.rst:1902 +#: ../../library/decimal.rst:1904 msgid "" "def moneyfmt(value, places=2, curr='', sep=',', dp='.',\n" " pos='', neg='-', trailneg=''):\n" @@ -2572,41 +2574,41 @@ msgid "" " return +s" msgstr "" -#: ../../library/decimal.rst:2054 +#: ../../library/decimal.rst:2056 msgid "Decimal FAQ" msgstr "" -#: ../../library/decimal.rst:2056 +#: ../../library/decimal.rst:2058 msgid "" "Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " "to minimize typing when using the interactive interpreter?" msgstr "" -#: ../../library/decimal.rst:2059 +#: ../../library/decimal.rst:2061 msgid "A. Some users abbreviate the constructor to just a single letter:" msgstr "" -#: ../../library/decimal.rst:2065 +#: ../../library/decimal.rst:2067 msgid "" "Q. In a fixed-point application with two decimal places, some inputs have " "many places and need to be rounded. Others are not supposed to have excess " "digits and need to be validated. What methods should be used?" msgstr "" -#: ../../library/decimal.rst:2069 +#: ../../library/decimal.rst:2071 msgid "" "A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " "places. If the :const:`Inexact` trap is set, it is also useful for " "validation:" msgstr "" -#: ../../library/decimal.rst:2087 +#: ../../library/decimal.rst:2089 msgid "" "Q. Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: ../../library/decimal.rst:2090 +#: ../../library/decimal.rst:2092 msgid "" "A. Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " @@ -2614,13 +2616,13 @@ msgid "" "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2108 +#: ../../library/decimal.rst:2110 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2122 +#: ../../library/decimal.rst:2124 msgid "" "Q. There are many ways to express the same value. The numbers ``200``, " "``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various " @@ -2628,17 +2630,17 @@ msgid "" "canonical value?" msgstr "" -#: ../../library/decimal.rst:2127 +#: ../../library/decimal.rst:2129 msgid "" "A. The :meth:`~Decimal.normalize` method maps all equivalent values to a " "single representative:" msgstr "" -#: ../../library/decimal.rst:2134 +#: ../../library/decimal.rst:2136 msgid "Q. When does rounding occur in a computation?" msgstr "" -#: ../../library/decimal.rst:2136 +#: ../../library/decimal.rst:2138 msgid "" "A. It occurs *after* the computation. The philosophy of the decimal " "specification is that numbers are considered exact and are created " @@ -2648,7 +2650,7 @@ msgid "" "computation::" msgstr "" -#: ../../library/decimal.rst:2143 +#: ../../library/decimal.rst:2145 msgid "" ">>> getcontext().prec = 5\n" ">>> pi = Decimal('3.1415926535') # More than 5 digits\n" @@ -2662,13 +2664,13 @@ msgid "" "Decimal('3.1416')" msgstr "" -#: ../../library/decimal.rst:2154 +#: ../../library/decimal.rst:2156 msgid "" "Q. Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: ../../library/decimal.rst:2157 +#: ../../library/decimal.rst:2159 msgid "" "A. For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing " @@ -2676,25 +2678,25 @@ msgid "" "original's two-place significance." msgstr "" -#: ../../library/decimal.rst:2162 +#: ../../library/decimal.rst:2164 msgid "" "If an application does not care about tracking significance, it is easy to " "remove the exponent and trailing zeroes, losing significance, but keeping " "the value unchanged:" msgstr "" -#: ../../library/decimal.rst:2172 +#: ../../library/decimal.rst:2174 msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: ../../library/decimal.rst:2174 +#: ../../library/decimal.rst:2176 msgid "" "A. Yes, any binary floating-point number can be exactly expressed as a " "Decimal though an exact conversion may take more precision than intuition " "would suggest:" msgstr "" -#: ../../library/decimal.rst:2178 +#: ../../library/decimal.rst:2180 msgid "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" @@ -2702,13 +2704,13 @@ msgstr "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" -#: ../../library/decimal.rst:2183 +#: ../../library/decimal.rst:2185 msgid "" "Q. Within a complex calculation, how can I make sure that I haven't gotten a " "spurious result because of insufficient precision or rounding anomalies." msgstr "" -#: ../../library/decimal.rst:2186 +#: ../../library/decimal.rst:2188 msgid "" "A. The decimal module makes it easy to test results. A best practice is to " "re-run calculations using greater precision and with various rounding modes. " @@ -2716,14 +2718,14 @@ msgid "" "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: ../../library/decimal.rst:2191 +#: ../../library/decimal.rst:2193 msgid "" "Q. I noticed that context precision is applied to the results of operations " "but not to the inputs. Is there anything to watch out for when mixing " "values of different precisions?" msgstr "" -#: ../../library/decimal.rst:2195 +#: ../../library/decimal.rst:2197 msgid "" "A. Yes. The principle is that all values are considered to be exact and so " "is the arithmetic on those values. Only the results are rounded. The " @@ -2732,7 +2734,7 @@ msgid "" "haven't been rounded:" msgstr "" -#: ../../library/decimal.rst:2200 +#: ../../library/decimal.rst:2202 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.104') + Decimal('2.104')\n" @@ -2746,30 +2748,30 @@ msgstr "" ">>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\n" "Decimal('5.20')" -#: ../../library/decimal.rst:2208 +#: ../../library/decimal.rst:2210 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: ../../library/decimal.rst:2211 +#: ../../library/decimal.rst:2213 msgid "" ">>> getcontext().prec = 3\n" ">>> +Decimal('1.23456789') # unary plus triggers rounding\n" "Decimal('1.23')" msgstr "" -#: ../../library/decimal.rst:2217 +#: ../../library/decimal.rst:2219 msgid "" "Alternatively, inputs can be rounded upon creation using the :meth:`Context." "create_decimal` method:" msgstr "" -#: ../../library/decimal.rst:2223 +#: ../../library/decimal.rst:2225 msgid "Q. Is the CPython implementation fast for large numbers?" msgstr "" -#: ../../library/decimal.rst:2225 +#: ../../library/decimal.rst:2227 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " "the decimal module integrate the high speed `libmpdec >> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" ">>> x = Decimal(2) ** 256\n" @@ -2808,13 +2810,13 @@ msgstr "" ">>> x / 128\n" "Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" -#: ../../library/decimal.rst:2248 +#: ../../library/decimal.rst:2250 msgid "" -"For inexact results, :attr:`MAX_PREC` is far too large on 64-bit platforms " +"For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " "and the available memory will be insufficient::" msgstr "" -#: ../../library/decimal.rst:2251 +#: ../../library/decimal.rst:2253 msgid "" ">>> Decimal(1) / 3\n" "Traceback (most recent call last):\n" @@ -2826,7 +2828,7 @@ msgstr "" " File \"\", line 1, in \n" "MemoryError" -#: ../../library/decimal.rst:2256 +#: ../../library/decimal.rst:2258 msgid "" "On systems with overallocation (e.g. Linux), a more sophisticated approach " "is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose " @@ -2834,7 +2836,7 @@ msgid "" "of 500MB each::" msgstr "" -#: ../../library/decimal.rst:2260 +#: ../../library/decimal.rst:2262 msgid "" ">>> import sys\n" ">>>\n" @@ -2858,14 +2860,14 @@ msgid "" " decimal.Inexact: []" msgstr "" -#: ../../library/decimal.rst:2280 +#: ../../library/decimal.rst:2282 msgid "" "In general (and especially on systems without overallocation), it is " "recommended to estimate even tighter bounds and set the :attr:`Inexact` trap " "if all calculations are expected to be exact." msgstr "" -#: ../../library/decimal.rst:2289 +#: ../../library/decimal.rst:2291 msgid "" "This approach now works for all exact results except for non-integer powers." msgstr "" diff --git a/library/dis.po b/library/dis.po index 6cf423905f..e1585fde13 100644 --- a/library/dis.po +++ b/library/dis.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,17 +61,17 @@ msgstr "" msgid "" "Some instructions are accompanied by one or more inline cache entries, which " "take the form of :opcode:`CACHE` instructions. These instructions are hidden " -"by default, but can be shown by passing ``show_caches=True`` to any :mod:" -"`dis` utility. Furthermore, the interpreter now adapts the bytecode to " -"specialize it for different runtime conditions. The adaptive bytecode can be " -"shown by passing ``adaptive=True``." +"by default, but can be shown by passing ``show_caches=True`` to " +"any :mod:`dis` utility. Furthermore, the interpreter now adapts the bytecode " +"to specialize it for different runtime conditions. The adaptive bytecode can " +"be shown by passing ``adaptive=True``." msgstr "" #: ../../library/dis.rst:45 msgid "" "The argument of a jump is the offset of the target instruction relative to " -"the instruction that appears immediately after the jump instruction's :" -"opcode:`CACHE` entries." +"the instruction that appears immediately after the jump " +"instruction's :opcode:`CACHE` entries." msgstr "" #: ../../library/dis.rst:50 @@ -130,7 +130,7 @@ msgstr "" #: ../../library/dis.rst:82 msgid "Command-line interface" -msgstr "" +msgstr "命令列介面" #: ../../library/dis.rst:84 msgid "The :mod:`dis` module can be invoked as a script from the command line:" @@ -142,7 +142,7 @@ msgstr "python -m dis [-h] [-C] [-O] [infile]" #: ../../library/dis.rst:90 msgid "The following options are accepted:" -msgstr "" +msgstr "可接受以下選項:" #: ../../library/dis.rst:96 msgid "Display usage and exit." @@ -152,43 +152,43 @@ msgstr "" msgid "Show inline caches." msgstr "" -#: ../../library/dis.rst:104 +#: ../../library/dis.rst:106 msgid "Show offsets of instructions." msgstr "" -#: ../../library/dis.rst:106 +#: ../../library/dis.rst:110 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " "stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" -#: ../../library/dis.rst:110 +#: ../../library/dis.rst:114 msgid "Bytecode analysis" msgstr "" -#: ../../library/dis.rst:114 +#: ../../library/dis.rst:118 msgid "" -"The bytecode analysis API allows pieces of Python code to be wrapped in a :" -"class:`Bytecode` object that provides easy access to details of the compiled " -"code." +"The bytecode analysis API allows pieces of Python code to be wrapped in " +"a :class:`Bytecode` object that provides easy access to details of the " +"compiled code." msgstr "" -#: ../../library/dis.rst:121 +#: ../../library/dis.rst:125 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: ../../library/dis.rst:125 +#: ../../library/dis.rst:129 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: ../../library/dis.rst:129 ../../library/dis.rst:326 +#: ../../library/dis.rst:133 ../../library/dis.rst:330 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -196,73 +196,73 @@ msgid "" "code object." msgstr "" -#: ../../library/dis.rst:134 +#: ../../library/dis.rst:138 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: ../../library/dis.rst:138 +#: ../../library/dis.rst:142 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:141 +#: ../../library/dis.rst:145 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:144 +#: ../../library/dis.rst:148 msgid "" "If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " "in the output." msgstr "" -#: ../../library/dis.rst:149 +#: ../../library/dis.rst:153 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: ../../library/dis.rst:154 +#: ../../library/dis.rst:158 msgid "The compiled code object." msgstr "" -#: ../../library/dis.rst:158 +#: ../../library/dis.rst:162 msgid "The first source line of the code object (if available)" msgstr "" -#: ../../library/dis.rst:162 +#: ../../library/dis.rst:166 msgid "" -"Return a formatted view of the bytecode operations (the same as printed by :" -"func:`dis.dis`, but returned as a multi-line string)." +"Return a formatted view of the bytecode operations (the same as printed " +"by :func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: ../../library/dis.rst:167 +#: ../../library/dis.rst:171 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: ../../library/dis.rst:170 ../../library/dis.rst:210 -#: ../../library/dis.rst:262 +#: ../../library/dis.rst:174 ../../library/dis.rst:214 +#: ../../library/dis.rst:266 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: ../../library/dis.rst:173 ../../library/dis.rst:265 -#: ../../library/dis.rst:282 ../../library/dis.rst:312 -#: ../../library/dis.rst:335 +#: ../../library/dis.rst:177 ../../library/dis.rst:269 +#: ../../library/dis.rst:286 ../../library/dis.rst:316 +#: ../../library/dis.rst:339 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "新增 *show_caches* 與 *adaptive* 參數。" -#: ../../library/dis.rst:176 +#: ../../library/dis.rst:180 msgid "Example:" msgstr "範例:" -#: ../../library/dis.rst:178 +#: ../../library/dis.rst:182 msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -284,11 +284,11 @@ msgstr "" "CALL\n" "RETURN_VALUE" -#: ../../library/dis.rst:192 +#: ../../library/dis.rst:196 msgid "Analysis functions" msgstr "" -#: ../../library/dis.rst:194 +#: ../../library/dis.rst:198 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -296,39 +296,39 @@ msgid "" "isn't useful:" msgstr "" -#: ../../library/dis.rst:200 +#: ../../library/dis.rst:204 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: ../../library/dis.rst:204 +#: ../../library/dis.rst:208 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: ../../library/dis.rst:216 +#: ../../library/dis.rst:220 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: ../../library/dis.rst:220 +#: ../../library/dis.rst:224 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: ../../library/dis.rst:225 ../../library/dis.rst:256 -#: ../../library/dis.rst:279 ../../library/dis.rst:309 +#: ../../library/dis.rst:229 ../../library/dis.rst:260 +#: ../../library/dis.rst:283 ../../library/dis.rst:313 msgid "Added *file* parameter." msgstr "新增 *file* 參數。" -#: ../../library/dis.rst:231 +#: ../../library/dis.rst:235 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -344,103 +344,103 @@ msgid "" "disassembles the last traceback." msgstr "" -#: ../../library/dis.rst:244 ../../library/dis.rst:276 -#: ../../library/dis.rst:306 +#: ../../library/dis.rst:248 ../../library/dis.rst:280 +#: ../../library/dis.rst:310 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: ../../library/dis.rst:247 +#: ../../library/dis.rst:251 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: ../../library/dis.rst:250 +#: ../../library/dis.rst:254 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:253 +#: ../../library/dis.rst:257 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:259 +#: ../../library/dis.rst:263 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: ../../library/dis.rst:272 +#: ../../library/dis.rst:276 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: ../../library/dis.rst:285 ../../library/dis.rst:315 +#: ../../library/dis.rst:289 ../../library/dis.rst:319 msgid "Added the *show_offsets* parameter." msgstr "新增 *show_offsets* 參數。" -#: ../../library/dis.rst:292 +#: ../../library/dis.rst:296 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: ../../library/dis.rst:295 +#: ../../library/dis.rst:299 msgid "the line number, for the first instruction of each line" msgstr "" -#: ../../library/dis.rst:296 +#: ../../library/dis.rst:300 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: ../../library/dis.rst:297 +#: ../../library/dis.rst:301 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: ../../library/dis.rst:298 +#: ../../library/dis.rst:302 msgid "the address of the instruction," msgstr "" -#: ../../library/dis.rst:299 +#: ../../library/dis.rst:303 msgid "the operation code name," msgstr "" -#: ../../library/dis.rst:300 +#: ../../library/dis.rst:304 msgid "operation parameters, and" msgstr "" -#: ../../library/dis.rst:301 +#: ../../library/dis.rst:305 msgid "interpretation of the parameters in parentheses." msgstr "" -#: ../../library/dis.rst:303 +#: ../../library/dis.rst:307 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: ../../library/dis.rst:320 +#: ../../library/dis.rst:324 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: ../../library/dis.rst:323 +#: ../../library/dis.rst:327 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: ../../library/dis.rst:331 +#: ../../library/dis.rst:335 msgid "The *adaptive* parameter works as it does in :func:`dis`." msgstr "" -#: ../../library/dis.rst:338 +#: ../../library/dis.rst:342 msgid "" "The *show_caches* parameter is deprecated and has no effect. The iterator " "generates the :class:`Instruction` instances with the *cache_info* field " @@ -448,41 +448,41 @@ msgid "" "generates separate items for the cache entries." msgstr "" -#: ../../library/dis.rst:346 +#: ../../library/dis.rst:350 msgid "" -"This generator function uses the :meth:`~codeobject.co_lines` method of the :" -"ref:`code object ` *code* to find the offsets which are starts " -"of lines in the source code. They are generated as ``(offset, lineno)`` " -"pairs." +"This generator function uses the :meth:`~codeobject.co_lines` method of " +"the :ref:`code object ` *code* to find the offsets which are " +"starts of lines in the source code. They are generated as ``(offset, " +"lineno)`` pairs." msgstr "" -#: ../../library/dis.rst:351 +#: ../../library/dis.rst:355 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: ../../library/dis.rst:354 +#: ../../library/dis.rst:358 msgid "" -"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" -"attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " +"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of " +"the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:359 +#: ../../library/dis.rst:363 msgid "" "Line numbers can be ``None`` for bytecode that does not map to source lines." msgstr "" -#: ../../library/dis.rst:365 +#: ../../library/dis.rst:369 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: ../../library/dis.rst:371 +#: ../../library/dis.rst:375 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: ../../library/dis.rst:373 +#: ../../library/dis.rst:377 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -490,11 +490,11 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: ../../library/dis.rst:380 +#: ../../library/dis.rst:384 msgid "Added *jump* parameter." msgstr "新增 *jump* 參數。" -#: ../../library/dis.rst:383 +#: ../../library/dis.rst:387 msgid "" "If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " "``oparg=0``. Previously this was an error for opcodes that use their arg. It " @@ -502,170 +502,178 @@ msgid "" "does not use it; the ``oparg`` in this case is ignored." msgstr "" -#: ../../library/dis.rst:393 +#: ../../library/dis.rst:397 msgid "Python Bytecode Instructions" msgstr "" -#: ../../library/dis.rst:395 +#: ../../library/dis.rst:399 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: ../../library/dis.rst:400 +#: ../../library/dis.rst:404 msgid "Details for a bytecode operation" msgstr "" -#: ../../library/dis.rst:404 +#: ../../library/dis.rst:408 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: ../../library/dis.rst:410 +#: ../../library/dis.rst:414 msgid "human readable name for operation" msgstr "" -#: ../../library/dis.rst:415 +#: ../../library/dis.rst:419 msgid "" "numeric code for the base operation if operation is specialized; otherwise " "equal to :data:`opcode`" msgstr "" -#: ../../library/dis.rst:421 +#: ../../library/dis.rst:425 msgid "" "human readable name for the base operation if operation is specialized; " "otherwise equal to :data:`opname`" msgstr "" -#: ../../library/dis.rst:427 +#: ../../library/dis.rst:431 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:431 +#: ../../library/dis.rst:435 msgid "alias for :data:`arg`" msgstr "" -#: ../../library/dis.rst:435 +#: ../../library/dis.rst:439 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:440 +#: ../../library/dis.rst:444 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" -#: ../../library/dis.rst:446 +#: ../../library/dis.rst:450 msgid "start index of operation within bytecode sequence" msgstr "" -#: ../../library/dis.rst:451 +#: ../../library/dis.rst:455 msgid "" "start index of operation within bytecode sequence, including prefixed " "``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" msgstr "" -#: ../../library/dis.rst:457 +#: ../../library/dis.rst:461 msgid "start index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:462 +#: ../../library/dis.rst:466 msgid "end index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:467 +#: ../../library/dis.rst:471 msgid "``True`` if this opcode starts a source line, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:472 +#: ../../library/dis.rst:476 msgid "" "source line number associated with this opcode (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:477 +#: ../../library/dis.rst:481 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:482 +#: ../../library/dis.rst:486 msgid "" "bytecode index of the jump target if this is a jump operation, otherwise " "``None``" msgstr "" -#: ../../library/dis.rst:488 +#: ../../library/dis.rst:492 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" -#: ../../library/dis.rst:503 -msgid "Field ``positions`` is added." +#: ../../library/dis.rst:497 +msgid "" +"Information about the cache entries of this instruction, as triplets of the " +"form ``(name, size, data)``, where the ``name`` and ``size`` describe the " +"cache format and data is the contents of the cache. ``cache_info`` is " +"``None`` if the instruction does not have caches." msgstr "" #: ../../library/dis.rst:507 +msgid "Field ``positions`` is added." +msgstr "" + +#: ../../library/dis.rst:511 msgid "Changed field ``starts_line``." msgstr "" -#: ../../library/dis.rst:509 +#: ../../library/dis.rst:513 msgid "" "Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " "``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " "and ``cache_info``." msgstr "" -#: ../../library/dis.rst:516 +#: ../../library/dis.rst:520 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" -#: ../../library/dis.rst:526 +#: ../../library/dis.rst:530 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: ../../library/dis.rst:529 +#: ../../library/dis.rst:533 msgid "**General instructions**" msgstr "" -#: ../../library/dis.rst:531 +#: ../../library/dis.rst:535 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" -#: ../../library/dis.rst:537 +#: ../../library/dis.rst:541 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" -#: ../../library/dis.rst:543 +#: ../../library/dis.rst:547 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:545 +#: ../../library/dis.rst:549 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:550 +#: ../../library/dis.rst:554 msgid "" "Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " "at the end of loops, hence the name." msgstr "" -#: ../../library/dis.rst:559 +#: ../../library/dis.rst:563 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:567 +#: ../../library/dis.rst:571 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:570 +#: ../../library/dis.rst:574 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -673,15 +681,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:578 +#: ../../library/dis.rst:582 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:580 +#: ../../library/dis.rst:584 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:587 +#: ../../library/dis.rst:591 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -689,86 +697,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:592 +#: ../../library/dis.rst:596 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:596 +#: ../../library/dis.rst:600 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: ../../library/dis.rst:603 +#: ../../library/dis.rst:607 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:605 +#: ../../library/dis.rst:609 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:611 +#: ../../library/dis.rst:615 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "" -#: ../../library/dis.rst:616 +#: ../../library/dis.rst:620 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" -#: ../../library/dis.rst:618 ../../library/dis.rst:1314 -#: ../../library/dis.rst:1330 +#: ../../library/dis.rst:622 ../../library/dis.rst:1318 +#: ../../library/dis.rst:1334 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" -#: ../../library/dis.rst:624 +#: ../../library/dis.rst:628 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "" -#: ../../library/dis.rst:629 +#: ../../library/dis.rst:633 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:634 +#: ../../library/dis.rst:638 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:642 +#: ../../library/dis.rst:646 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:647 +#: ../../library/dis.rst:651 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:649 +#: ../../library/dis.rst:653 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: ../../library/dis.rst:652 +#: ../../library/dis.rst:656 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:659 +#: ../../library/dis.rst:663 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:662 +#: ../../library/dis.rst:666 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -778,17 +786,17 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:671 ../../library/dis.rst:680 -#: ../../library/dis.rst:690 ../../library/dis.rst:698 -#: ../../library/dis.rst:710 ../../library/dis.rst:798 -#: ../../library/dis.rst:808 ../../library/dis.rst:818 -#: ../../library/dis.rst:1042 ../../library/dis.rst:1053 -#: ../../library/dis.rst:1157 ../../library/dis.rst:1169 -#: ../../library/dis.rst:1181 +#: ../../library/dis.rst:675 ../../library/dis.rst:684 +#: ../../library/dis.rst:694 ../../library/dis.rst:702 +#: ../../library/dis.rst:714 ../../library/dis.rst:802 +#: ../../library/dis.rst:812 ../../library/dis.rst:822 +#: ../../library/dis.rst:1046 ../../library/dis.rst:1057 +#: ../../library/dis.rst:1161 ../../library/dis.rst:1173 +#: ../../library/dis.rst:1185 msgid "Implements::" msgstr "" -#: ../../library/dis.rst:673 +#: ../../library/dis.rst:677 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -798,7 +806,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[key])" -#: ../../library/dis.rst:682 +#: ../../library/dis.rst:686 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -810,7 +818,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:692 +#: ../../library/dis.rst:696 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -820,7 +828,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:700 +#: ../../library/dis.rst:704 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -832,7 +840,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:712 +#: ../../library/dis.rst:716 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -846,11 +854,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:721 +#: ../../library/dis.rst:725 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:725 +#: ../../library/dis.rst:729 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -858,39 +866,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:730 +#: ../../library/dis.rst:734 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:733 +#: ../../library/dis.rst:737 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:734 +#: ../../library/dis.rst:738 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:738 +#: ../../library/dis.rst:742 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:744 +#: ../../library/dis.rst:748 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:747 +#: ../../library/dis.rst:751 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:754 +#: ../../library/dis.rst:758 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:762 +#: ../../library/dis.rst:766 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -898,35 +906,35 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:769 ../../library/dis.rst:877 -#: ../../library/dis.rst:888 +#: ../../library/dis.rst:773 ../../library/dis.rst:881 +#: ../../library/dis.rst:892 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:775 +#: ../../library/dis.rst:779 msgid "" -"Handles an exception raised during a :meth:`~generator.throw` or :meth:" -"`~generator.close` call through the current frame. If ``STACK[-1]`` is an " -"instance of :exc:`StopIteration`, pop three values from the stack and push " -"its ``value`` member. Otherwise, re-raise ``STACK[-1]``." +"Handles an exception raised during a :meth:`~generator.throw` " +"or :meth:`~generator.close` call through the current frame. If " +"``STACK[-1]`` is an instance of :exc:`StopIteration`, pop three values from " +"the stack and push its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:785 +#: ../../library/dis.rst:789 msgid "" "Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``. Pushes " "``__aexit__`` and result of ``__aenter__()`` to the stack::" msgstr "" -#: ../../library/dis.rst:788 +#: ../../library/dis.rst:792 msgid "STACK.extend((__aexit__, __aenter__())" msgstr "STACK.extend((__aexit__, __aenter__())" -#: ../../library/dis.rst:794 +#: ../../library/dis.rst:798 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:800 +#: ../../library/dis.rst:804 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -934,11 +942,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:803 +#: ../../library/dis.rst:807 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:810 +#: ../../library/dis.rst:814 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -946,11 +954,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:813 +#: ../../library/dis.rst:817 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:820 +#: ../../library/dis.rst:824 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -960,53 +968,53 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:824 +#: ../../library/dis.rst:828 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:827 +#: ../../library/dis.rst:831 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:831 +#: ../../library/dis.rst:835 msgid "" -"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" -"`MAP_ADD` instructions, while the added value or key/value pair is popped " -"off, the container object remains on the stack so that it is available for " -"further iterations of the loop." +"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` " +"and :opcode:`MAP_ADD` instructions, while the added value or key/value pair " +"is popped off, the container object remains on the stack so that it is " +"available for further iterations of the loop." msgstr "" -#: ../../library/dis.rst:839 +#: ../../library/dis.rst:843 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:844 +#: ../../library/dis.rst:848 msgid "Returns with ``co_consts[consti]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:851 +#: ../../library/dis.rst:855 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:853 +#: ../../library/dis.rst:857 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:856 +#: ../../library/dis.rst:860 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:859 +#: ../../library/dis.rst:863 msgid "" "oparg is ``1`` if this instruction is part of a yield-from or await, and " "``0`` otherwise." msgstr "" -#: ../../library/dis.rst:865 +#: ../../library/dis.rst:869 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -1014,39 +1022,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:875 +#: ../../library/dis.rst:879 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:882 +#: ../../library/dis.rst:886 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " -"pops an additional value from the stack which is used to set :attr:`~frame." -"f_lasti` of the current frame." +"pops an additional value from the stack which is used to " +"set :attr:`~frame.f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:893 +#: ../../library/dis.rst:897 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: ../../library/dis.rst:901 +#: ../../library/dis.rst:905 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: ../../library/dis.rst:909 +#: ../../library/dis.rst:913 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:912 +#: ../../library/dis.rst:916 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -1054,7 +1062,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:921 +#: ../../library/dis.rst:925 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -1062,40 +1070,40 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:928 +#: ../../library/dis.rst:932 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:935 +#: ../../library/dis.rst:939 msgid "" "Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " "statement." msgstr "" -#: ../../library/dis.rst:943 +#: ../../library/dis.rst:947 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:949 +#: ../../library/dis.rst:953 msgid "" "This opcode performs several operations before a with block starts. First, " "it loads :meth:`~object.__exit__` from the context manager and pushes it " -"onto the stack for later use by :opcode:`WITH_EXCEPT_START`. Then, :meth:" -"`~object.__enter__` is called. Finally, the result of calling the " -"``__enter__()`` method is pushed onto the stack." +"onto the stack for later use by :opcode:`WITH_EXCEPT_START`. " +"Then, :meth:`~object.__enter__` is called. Finally, the result of calling " +"the ``__enter__()`` method is pushed onto the stack." msgstr "" -#: ../../library/dis.rst:960 +#: ../../library/dis.rst:964 msgid "" "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " "statements where comparison with structure of pattern is needed." msgstr "" -#: ../../library/dis.rst:968 +#: ../../library/dis.rst:972 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -1103,7 +1111,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:978 +#: ../../library/dis.rst:982 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -1112,40 +1120,42 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:988 +#: ../../library/dis.rst:992 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " -"subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" -"class:`tuple` containing the corresponding values. Otherwise, push ``None``." +"subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push " +"a :class:`tuple` containing the corresponding values. Otherwise, push " +"``None``." msgstr "" -#: ../../library/dis.rst:994 ../../library/dis.rst:1665 +#: ../../library/dis.rst:998 ../../library/dis.rst:1684 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:1001 +#: ../../library/dis.rst:1005 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `. The compiler tries to use :opcode:`STORE_FAST` or :opcode:" -"`STORE_GLOBAL` if possible." +"objects>`. The compiler tries to use :opcode:`STORE_FAST` " +"or :opcode:`STORE_GLOBAL` if possible." msgstr "" -#: ../../library/dis.rst:1008 +#: ../../library/dis.rst:1012 msgid "" -"Implements ``del name``, where *namei* is the index into :attr:`~codeobject." -"co_names` attribute of the :ref:`code object `." +"Implements ``del name``, where *namei* is the index " +"into :attr:`~codeobject.co_names` attribute of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1014 +#: ../../library/dis.rst:1018 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:1017 +#: ../../library/dis.rst:1021 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1153,7 +1163,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1023 +#: ../../library/dis.rst:1027 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1161,11 +1171,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:1028 +#: ../../library/dis.rst:1032 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:1030 +#: ../../library/dis.rst:1034 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1174,13 +1184,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:1036 +#: ../../library/dis.rst:1040 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:1044 +#: ../../library/dis.rst:1048 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1190,13 +1200,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:1048 +#: ../../library/dis.rst:1052 msgid "" -"where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" -"ref:`code object `." +"where *namei* is the index of name in :attr:`~codeobject.co_names` of " +"the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1055 +#: ../../library/dis.rst:1059 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1204,38 +1214,38 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:1058 +#: ../../library/dis.rst:1062 msgid "" -"where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" -"ref:`code object `." +"where *namei* is the index of name into :attr:`~codeobject.co_names` of " +"the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1064 +#: ../../library/dis.rst:1068 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:1069 +#: ../../library/dis.rst:1073 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:1074 +#: ../../library/dis.rst:1078 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1079 +#: ../../library/dis.rst:1083 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:1085 +#: ../../library/dis.rst:1089 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " -"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" -"opcode:`LOAD_FROM_DICT_OR_GLOBALS`." +"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` " +"and :opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1094 +#: ../../library/dis.rst:1098 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1244,13 +1254,13 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1105 +#: ../../library/dis.rst:1109 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1108 +#: ../../library/dis.rst:1112 msgid "" "if count == 0:\n" " value = ()\n" @@ -1268,41 +1278,41 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1119 +#: ../../library/dis.rst:1123 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1124 +#: ../../library/dis.rst:1128 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1129 +#: ../../library/dis.rst:1133 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1133 +#: ../../library/dis.rst:1137 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1140 +#: ../../library/dis.rst:1144 msgid "" "The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " "top element on the stack which contains a tuple of keys, then starting from " "``STACK[-2]``, pops *count* values to form values in the built dictionary." msgstr "" -#: ../../library/dis.rst:1149 +#: ../../library/dis.rst:1153 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1159 +#: ../../library/dis.rst:1163 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1310,11 +1320,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1162 +#: ../../library/dis.rst:1166 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1171 +#: ../../library/dis.rst:1175 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1322,11 +1332,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1174 +#: ../../library/dis.rst:1178 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1183 +#: ../../library/dis.rst:1187 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1334,21 +1344,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1186 +#: ../../library/dis.rst:1190 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1193 +#: ../../library/dis.rst:1197 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1200 +#: ../../library/dis.rst:1204 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1203 +#: ../../library/dis.rst:1207 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " @@ -1360,146 +1370,140 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1212 +#: ../../library/dis.rst:1216 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1219 +#: ../../library/dis.rst:1223 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1223 +#: ../../library/dis.rst:1227 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1225 +#: ../../library/dis.rst:1229 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1226 +#: ../../library/dis.rst:1230 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1227 +#: ../../library/dis.rst:1231 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1229 +#: ../../library/dis.rst:1233 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1232 +#: ../../library/dis.rst:1236 msgid "" -"The low bit of ``namei`` signals to attempt a method load, as with :opcode:" -"`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " -"it is unset a single value is pushed to the stack." +"The low bit of ``namei`` signals to attempt a method load, as " +"with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded " +"method. When it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1236 +#: ../../library/dis.rst:1240 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1244 +#: ../../library/dis.rst:1248 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1248 +#: ../../library/dis.rst:1252 msgid "" -"The fifth-lowest bit of the oparg now indicates a forced conversion to :" -"class:`bool`." +"The fifth-lowest bit of the oparg now indicates a forced conversion " +"to :class:`bool`." msgstr "" -#: ../../library/dis.rst:1255 +#: ../../library/dis.rst:1259 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1262 +#: ../../library/dis.rst:1266 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1269 +#: ../../library/dis.rst:1273 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " -"popped and provide the *fromlist* and *level* arguments of :func:" -"`__import__`. The module object is pushed onto the stack. The current " -"namespace is not affected: for a proper import statement, a subsequent :" -"opcode:`STORE_FAST` instruction modifies the namespace." +"popped and provide the *fromlist* and *level* arguments " +"of :func:`__import__`. The module object is pushed onto the stack. The " +"current namespace is not affected: for a proper import statement, a " +"subsequent :opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1277 +#: ../../library/dis.rst:1281 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1284 +#: ../../library/dis.rst:1288 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1289 +#: ../../library/dis.rst:1293 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1296 +#: ../../library/dis.rst:1300 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1303 +#: ../../library/dis.rst:1307 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1306 ../../library/dis.rst:1322 +#: ../../library/dis.rst:1310 ../../library/dis.rst:1326 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1311 ../../library/dis.rst:1327 -#: ../../library/dis.rst:1343 ../../library/dis.rst:1357 +#: ../../library/dis.rst:1315 ../../library/dis.rst:1331 +#: ../../library/dis.rst:1344 ../../library/dis.rst:1355 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1319 +#: ../../library/dis.rst:1323 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1335 +#: ../../library/dis.rst:1339 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1338 ../../library/dis.rst:1352 -msgid "" -"This opcode is a pseudo-instruction, replaced in final bytecode by the " -"directed versions (forward/backward)." -msgstr "" - -#: ../../library/dis.rst:1349 +#: ../../library/dis.rst:1350 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1362 +#: ../../library/dis.rst:1360 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1507,188 +1511,207 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1367 +#: ../../library/dis.rst:1365 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1372 +#: ../../library/dis.rst:1370 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1374 +#: ../../library/dis.rst:1372 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1380 +#: ../../library/dis.rst:1378 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1382 +#: ../../library/dis.rst:1380 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1388 +#: ../../library/dis.rst:1386 +msgid "" +"Pushes references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." +msgstr "" + +#: ../../library/dis.rst:1393 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1396 +#: ../../library/dis.rst:1401 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1404 +#: ../../library/dis.rst:1409 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1409 +#: ../../library/dis.rst:1413 +msgid "" +"Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " +"into ``co_varnames[var_nums & 15]``." +msgstr "" + +#: ../../library/dis.rst:1420 +msgid "" +"Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " +"pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " +"stack." +msgstr "" + +#: ../../library/dis.rst:1428 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1414 +#: ../../library/dis.rst:1433 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1422 +#: ../../library/dis.rst:1441 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1425 ../../library/dis.rst:1447 -#: ../../library/dis.rst:1458 +#: ../../library/dis.rst:1444 ../../library/dis.rst:1466 +#: ../../library/dis.rst:1477 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1431 +#: ../../library/dis.rst:1450 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " -"found there, loads it from the cell contained in slot ``i``, similar to :" -"opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"found there, loads it from the cell contained in slot ``i``, similar " +"to :opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " "` in class bodies (which previously used :opcode:`!" "LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " "class bodies." msgstr "" -#: ../../library/dis.rst:1444 +#: ../../library/dis.rst:1463 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1453 +#: ../../library/dis.rst:1472 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1464 +#: ../../library/dis.rst:1483 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1473 +#: ../../library/dis.rst:1492 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1476 +#: ../../library/dis.rst:1495 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1477 +#: ../../library/dis.rst:1496 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1478 +#: ../../library/dis.rst:1497 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1484 +#: ../../library/dis.rst:1503 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1487 ../../library/dis.rst:1511 +#: ../../library/dis.rst:1506 ../../library/dis.rst:1530 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1488 ../../library/dis.rst:1512 +#: ../../library/dis.rst:1507 ../../library/dis.rst:1531 msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1489 ../../library/dis.rst:1513 +#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1491 +#: ../../library/dis.rst:1510 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1493 +#: ../../library/dis.rst:1512 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1499 +#: ../../library/dis.rst:1518 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1502 +#: ../../library/dis.rst:1521 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1508 +#: ../../library/dis.rst:1527 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1514 +#: ../../library/dis.rst:1533 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1515 +#: ../../library/dis.rst:1534 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1517 +#: ../../library/dis.rst:1536 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1520 +#: ../../library/dis.rst:1539 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1529 +#: ../../library/dis.rst:1548 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1700,33 +1723,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1544 +#: ../../library/dis.rst:1563 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1553 +#: ../../library/dis.rst:1572 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1555 +#: ../../library/dis.rst:1574 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1558 +#: ../../library/dis.rst:1577 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1561 +#: ../../library/dis.rst:1580 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1568 +#: ../../library/dis.rst:1587 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1734,42 +1757,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1572 +#: ../../library/dis.rst:1591 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1593 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1575 +#: ../../library/dis.rst:1594 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1576 +#: ../../library/dis.rst:1595 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1585 +#: ../../library/dis.rst:1604 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1587 +#: ../../library/dis.rst:1606 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1591 +#: ../../library/dis.rst:1610 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1612 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1781,11 +1804,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1598 +#: ../../library/dis.rst:1617 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1603 +#: ../../library/dis.rst:1622 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1793,11 +1816,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1611 +#: ../../library/dis.rst:1630 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1613 +#: ../../library/dis.rst:1632 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1807,28 +1830,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1636 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1618 +#: ../../library/dis.rst:1637 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1619 +#: ../../library/dis.rst:1638 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1621 ../../library/dis.rst:1634 -#: ../../library/dis.rst:1647 -msgid "Used for implementing formatted literal strings (f-strings)." +#: ../../library/dis.rst:1640 ../../library/dis.rst:1653 +#: ../../library/dis.rst:1666 +msgid "Used for implementing formatted string literals (f-strings)." msgstr "" -#: ../../library/dis.rst:1628 +#: ../../library/dis.rst:1647 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1630 +#: ../../library/dis.rst:1649 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1838,11 +1861,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1640 +#: ../../library/dis.rst:1659 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1642 +#: ../../library/dis.rst:1661 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1854,14 +1877,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1654 +#: ../../library/dis.rst:1673 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1677 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1869,219 +1892,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1672 +#: ../../library/dis.rst:1691 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1674 +#: ../../library/dis.rst:1693 msgid "" "The ``context`` oparand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1677 +#: ../../library/dis.rst:1696 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1698 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1680 +#: ../../library/dis.rst:1699 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1681 +#: ../../library/dis.rst:1700 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1683 +#: ../../library/dis.rst:1702 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1688 +#: ../../library/dis.rst:1707 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1694 +#: ../../library/dis.rst:1713 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1703 +#: ../../library/dis.rst:1722 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1706 +#: ../../library/dis.rst:1725 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1715 +#: ../../library/dis.rst:1734 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1719 +#: ../../library/dis.rst:1738 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1722 +#: ../../library/dis.rst:1741 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1726 +#: ../../library/dis.rst:1745 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1731 +#: ../../library/dis.rst:1750 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1736 +#: ../../library/dis.rst:1755 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1740 ../../library/dis.rst:1794 +#: ../../library/dis.rst:1759 ../../library/dis.rst:1813 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 +#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 +#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1745 +#: ../../library/dis.rst:1764 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1745 ../../library/dis.rst:1799 +#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1766 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1766 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1750 +#: ../../library/dis.rst:1769 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1750 +#: ../../library/dis.rst:1769 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1753 +#: ../../library/dis.rst:1772 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1753 +#: ../../library/dis.rst:1772 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1775 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1775 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1758 +#: ../../library/dis.rst:1777 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1758 +#: ../../library/dis.rst:1777 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1761 +#: ../../library/dis.rst:1780 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1761 +#: ../../library/dis.rst:1780 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1763 +#: ../../library/dis.rst:1782 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1763 +#: ../../library/dis.rst:1782 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1784 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1784 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1787 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1787 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1790 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1790 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1793 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1793 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1805 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1808 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2093,61 +2116,61 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1799 +#: ../../library/dis.rst:1818 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1801 +#: ../../library/dis.rst:1820 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1801 +#: ../../library/dis.rst:1820 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1824 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1824 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1808 +#: ../../library/dis.rst:1827 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1808 +#: ../../library/dis.rst:1827 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1812 +#: ../../library/dis.rst:1831 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1812 +#: ../../library/dis.rst:1831 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1819 +#: ../../library/dis.rst:1838 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1821 +#: ../../library/dis.rst:1840 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1826 +#: ../../library/dis.rst:1845 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1852 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2156,91 +2179,92 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1842 +#: ../../library/dis.rst:1861 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1865 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " -"constructs, which push the return value of the context manager's :meth:" -"`~object.__enter__` or :meth:`~object.__aenter__` to the stack." +"constructs, which push the return value of the context " +"manager's :meth:`~object.__enter__` or :meth:`~object.__aenter__` to the " +"stack." msgstr "" -#: ../../library/dis.rst:1853 +#: ../../library/dis.rst:1872 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1859 +#: ../../library/dis.rst:1878 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1864 +#: ../../library/dis.rst:1883 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1867 +#: ../../library/dis.rst:1886 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1869 +#: ../../library/dis.rst:1888 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1875 +#: ../../library/dis.rst:1894 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1882 +#: ../../library/dis.rst:1901 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1884 +#: ../../library/dis.rst:1903 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1887 +#: ../../library/dis.rst:1906 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1894 +#: ../../library/dis.rst:1913 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1899 +#: ../../library/dis.rst:1918 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1904 +#: ../../library/dis.rst:1923 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1909 +#: ../../library/dis.rst:1928 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1916 +#: ../../library/dis.rst:1935 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1921 +#: ../../library/dis.rst:1940 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2249,47 +2273,47 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:1929 +#: ../../library/dis.rst:1948 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1934 +#: ../../library/dis.rst:1953 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1941 +#: ../../library/dis.rst:1960 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1946 +#: ../../library/dis.rst:1965 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1950 +#: ../../library/dis.rst:1969 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1957 +#: ../../library/dis.rst:1976 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1959 +#: ../../library/dis.rst:1978 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:1965 +#: ../../library/dis.rst:1984 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1967 +#: ../../library/dis.rst:1986 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1583 +#: ../../library/dis.rst:1602 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1583 +#: ../../library/dis.rst:1602 msgid "slice" msgstr "slice(切片)" diff --git a/library/doctest.po b/library/doctest.po index fda2f389c6..fb18a89516 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-17 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "" "To perform regression testing by verifying that interactive examples from a " "test file or a test object work as expected." -msgstr "" +msgstr "透過驗證測試檔案或測試物件中的互動式範例是否按預期運作來執行迴歸測試。" #: ../../library/doctest.rst:26 msgid "" @@ -166,7 +166,6 @@ msgid "And so on, eventually ending with:" msgstr "" #: ../../library/doctest.rst:116 -#, fuzzy msgid "" "Trying:\n" " factorial(1e100)\n" @@ -191,10 +190,10 @@ msgstr "" " OverflowError: n too large\n" "ok\n" "2 items passed all tests:\n" -" 1 tests in __main__\n" -" 8 tests in __main__.factorial\n" -"9 tests in 2 items.\n" -"9 passed and 0 failed.\n" +" 1 test in __main__\n" +" 6 tests in __main__.factorial\n" +"7 tests in 2 items.\n" +"7 passed.\n" "Test passed.\n" "$" @@ -273,39 +272,27 @@ msgstr "" #: ../../library/doctest.rst:176 msgid "" -"There is also a command line shortcut for running :func:`testmod`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the module name(s) on the command line::" +"There is also a command line shortcut for running :func:`testmod`, see " +"section :ref:`doctest-cli`." msgstr "" -#: ../../library/doctest.rst:180 -msgid "python -m doctest -v example.py" -msgstr "python -m doctest -v example.py" - -#: ../../library/doctest.rst:182 -msgid "" -"This will import :file:`example.py` as a standalone module and run :func:" -"`testmod` on it. Note that this may not work correctly if the file is part " -"of a package and imports other submodules from that package." -msgstr "" - -#: ../../library/doctest.rst:186 +#: ../../library/doctest.rst:179 msgid "" "For more information on :func:`testmod`, see section :ref:`doctest-basic-" "api`." msgstr "" -#: ../../library/doctest.rst:192 +#: ../../library/doctest.rst:185 msgid "Simple Usage: Checking Examples in a Text File" msgstr "" -#: ../../library/doctest.rst:194 +#: ../../library/doctest.rst:187 msgid "" "Another simple application of doctest is testing interactive examples in a " "text file. This can be done with the :func:`testfile` function::" msgstr "" -#: ../../library/doctest.rst:197 +#: ../../library/doctest.rst:190 msgid "" "import doctest\n" "doctest.testfile(\"example.txt\")" @@ -313,7 +300,7 @@ msgstr "" "import doctest\n" "doctest.testfile(\"example.txt\")" -#: ../../library/doctest.rst:200 +#: ../../library/doctest.rst:193 msgid "" "That short script executes and verifies any interactive Python examples " "contained in the file :file:`example.txt`. The file content is treated as " @@ -321,7 +308,7 @@ msgid "" "Python program! For example, perhaps :file:`example.txt` contains this:" msgstr "" -#: ../../library/doctest.rst:205 +#: ../../library/doctest.rst:198 msgid "" "The ``example`` module\n" "======================\n" @@ -355,13 +342,13 @@ msgstr "" " >>> factorial(6)\n" " 120" -#: ../../library/doctest.rst:223 +#: ../../library/doctest.rst:216 msgid "" "Running ``doctest.testfile(\"example.txt\")`` then finds the error in this " "documentation::" msgstr "" -#: ../../library/doctest.rst:226 +#: ../../library/doctest.rst:219 msgid "" "File \"./example.txt\", line 14, in example.txt\n" "Failed example:\n" @@ -379,7 +366,7 @@ msgstr "" "Got:\n" " 720" -#: ../../library/doctest.rst:234 +#: ../../library/doctest.rst:227 msgid "" "As with :func:`testmod`, :func:`testfile` won't display anything unless an " "example fails. If an example does fail, then the failing example(s) and the " @@ -387,7 +374,7 @@ msgid "" "func:`testmod`." msgstr "" -#: ../../library/doctest.rst:239 +#: ../../library/doctest.rst:232 msgid "" "By default, :func:`testfile` looks for files in the calling module's " "directory. See section :ref:`doctest-basic-api` for a description of the " @@ -395,40 +382,79 @@ msgid "" "locations." msgstr "" -#: ../../library/doctest.rst:243 +#: ../../library/doctest.rst:236 msgid "" "Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-" "v`` command-line switch or with the optional keyword argument *verbose*." msgstr "" -#: ../../library/doctest.rst:247 +#: ../../library/doctest.rst:240 msgid "" -"There is also a command line shortcut for running :func:`testfile`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the file name(s) on the command line::" +"There is also a command line shortcut for running :func:`testfile`, see " +"section :ref:`doctest-cli`." +msgstr "" + +#: ../../library/doctest.rst:243 +msgid "" +"For more information on :func:`testfile`, see section :ref:`doctest-basic-" +"api`." +msgstr "" + +#: ../../library/doctest.rst:249 +msgid "Command-line Usage" msgstr "" #: ../../library/doctest.rst:251 -msgid "python -m doctest -v example.txt" -msgstr "python -m doctest -v example.txt" +msgid "" +"The :mod:`doctest` module can be invoked as a script from the command line:" +msgstr "" #: ../../library/doctest.rst:253 +msgid "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" +msgstr "" + +#: ../../library/doctest.rst:261 msgid "" -"Because the file name does not end with :file:`.py`, :mod:`doctest` infers " -"that it must be run with :func:`testfile`, not :func:`testmod`." +"Detailed report of all examples tried is printed to standard output, along " +"with assorted summaries at the end::" msgstr "" -#: ../../library/doctest.rst:256 +#: ../../library/doctest.rst:264 +msgid "python -m doctest -v example.py" +msgstr "python -m doctest -v example.py" + +#: ../../library/doctest.rst:266 msgid "" -"For more information on :func:`testfile`, see section :ref:`doctest-basic-" -"api`." +"This will import :file:`example.py` as a standalone module and run :func:" +"`testmod` on it. Note that this may not work correctly if the file is part " +"of a package and imports other submodules from that package." +msgstr "" + +#: ../../library/doctest.rst:270 +msgid "" +"If the file name does not end with :file:`.py`, :mod:`!doctest` infers that " +"it must be run with :func:`testfile` instead::" +msgstr "" + +#: ../../library/doctest.rst:273 +msgid "python -m doctest -v example.txt" +msgstr "python -m doctest -v example.txt" + +#: ../../library/doctest.rst:277 +msgid "" +"Option flags control various aspects of doctest's behavior, see section :ref:" +"`doctest-options`." +msgstr "" + +#: ../../library/doctest.rst:284 +msgid "This is shorthand for ``-o FAIL_FAST``." msgstr "" -#: ../../library/doctest.rst:262 +#: ../../library/doctest.rst:292 msgid "How It Works" msgstr "" -#: ../../library/doctest.rst:264 +#: ../../library/doctest.rst:294 msgid "" "This section examines in detail how doctest works: which docstrings it looks " "at, how it finds interactive examples, what execution context it uses, how " @@ -438,17 +464,17 @@ msgid "" "see the following sections." msgstr "" -#: ../../library/doctest.rst:275 +#: ../../library/doctest.rst:305 msgid "Which Docstrings Are Examined?" msgstr "" -#: ../../library/doctest.rst:277 +#: ../../library/doctest.rst:307 msgid "" "The module docstring, and all function, class and method docstrings are " "searched. Objects imported into the module are not searched." msgstr "" -#: ../../library/doctest.rst:280 +#: ../../library/doctest.rst:310 msgid "" "In addition, there are cases when you want tests to be part of a module but " "not part of the help text, which requires that the tests not be included in " @@ -461,11 +487,11 @@ msgid "" "__test__.K``." msgstr "" -#: ../../library/doctest.rst:289 +#: ../../library/doctest.rst:319 msgid "For example, place this block of code at the top of :file:`example.py`:" msgstr "" -#: ../../library/doctest.rst:291 +#: ../../library/doctest.rst:321 msgid "" "__test__ = {\n" " 'numbers': \"\"\"\n" @@ -487,7 +513,7 @@ msgstr "" "\"\"\"\n" "}" -#: ../../library/doctest.rst:303 +#: ../../library/doctest.rst:333 msgid "" "The value of ``example.__test__[\"numbers\"]`` will be treated as a " "docstring and all the tests inside it will be run. It is important to note " @@ -496,24 +522,24 @@ msgid "" "scanned for tests." msgstr "" -#: ../../library/doctest.rst:309 +#: ../../library/doctest.rst:339 msgid "" "Any classes found are recursively searched similarly, to test docstrings in " "their contained methods and nested classes." msgstr "" -#: ../../library/doctest.rst:316 +#: ../../library/doctest.rst:346 msgid "How are Docstring Examples Recognized?" msgstr "" -#: ../../library/doctest.rst:318 +#: ../../library/doctest.rst:348 msgid "" "In most cases a copy-and-paste of an interactive console session works fine, " "but doctest isn't trying to do an exact emulation of any specific Python " "shell." msgstr "" -#: ../../library/doctest.rst:323 +#: ../../library/doctest.rst:353 msgid "" ">>> # comments are ignored\n" ">>> x = 12\n" @@ -547,18 +573,18 @@ msgstr "" "NO!!!\n" ">>>" -#: ../../library/doctest.rst:343 +#: ../../library/doctest.rst:373 msgid "" "Any expected output must immediately follow the final ``'>>> '`` or ``'... " "'`` line containing the code, and the expected output (if any) extends to " "the next ``'>>> '`` or all-whitespace line." msgstr "" -#: ../../library/doctest.rst:347 +#: ../../library/doctest.rst:377 msgid "The fine print:" msgstr "" -#: ../../library/doctest.rst:349 +#: ../../library/doctest.rst:379 msgid "" "Expected output cannot contain an all-whitespace line, since such a line is " "taken to signal the end of expected output. If expected output does contain " @@ -566,7 +592,7 @@ msgid "" "line is expected." msgstr "" -#: ../../library/doctest.rst:354 +#: ../../library/doctest.rst:384 msgid "" "All hard tab characters are expanded to spaces, using 8-column tab stops. " "Tabs in output generated by the tested code are not modified. Because any " @@ -581,20 +607,20 @@ msgid "" "`DocTestParser` class." msgstr "" -#: ../../library/doctest.rst:366 +#: ../../library/doctest.rst:396 msgid "" "Output to stdout is captured, but not output to stderr (exception tracebacks " "are captured via a different means)." msgstr "" -#: ../../library/doctest.rst:369 +#: ../../library/doctest.rst:399 msgid "" "If you continue a line via backslashing in an interactive session, or for " "any other reason use a backslash, you should use a raw docstring, which will " "preserve your backslashes exactly as you type them::" msgstr "" -#: ../../library/doctest.rst:373 +#: ../../library/doctest.rst:403 msgid "" ">>> def f(x):\n" "... r'''Backslashes in a raw docstring: m\\n'''\n" @@ -603,7 +629,7 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:379 +#: ../../library/doctest.rst:409 msgid "" "Otherwise, the backslash will be interpreted as part of the string. For " "example, the ``\\n`` above would be interpreted as a newline character. " @@ -611,7 +637,7 @@ msgid "" "use a raw string)::" msgstr "" -#: ../../library/doctest.rst:383 +#: ../../library/doctest.rst:413 msgid "" ">>> def f(x):\n" "... '''Backslashes in a raw docstring: m\\\\n'''\n" @@ -620,11 +646,11 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:389 +#: ../../library/doctest.rst:419 msgid "The starting column doesn't matter::" msgstr "" -#: ../../library/doctest.rst:391 +#: ../../library/doctest.rst:421 msgid "" ">>> assert \"Easy!\"\n" " >>> import math\n" @@ -636,17 +662,17 @@ msgstr "" " >>> math.floor(1.9)\n" " 1" -#: ../../library/doctest.rst:396 +#: ../../library/doctest.rst:426 msgid "" "and as many leading whitespace characters are stripped from the expected " "output as appeared in the initial ``'>>> '`` line that started the example." msgstr "" -#: ../../library/doctest.rst:403 +#: ../../library/doctest.rst:433 msgid "What's the Execution Context?" msgstr "" -#: ../../library/doctest.rst:405 +#: ../../library/doctest.rst:435 msgid "" "By default, each time :mod:`doctest` finds a docstring to test, it uses a " "*shallow copy* of :mod:`!M`'s globals, so that running tests doesn't change " @@ -657,17 +683,17 @@ msgid "" "defined in other docstrings." msgstr "" -#: ../../library/doctest.rst:413 +#: ../../library/doctest.rst:443 msgid "" "You can force use of your own dict as the execution context by passing " "``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." msgstr "" -#: ../../library/doctest.rst:420 +#: ../../library/doctest.rst:450 msgid "What About Exceptions?" msgstr "" -#: ../../library/doctest.rst:422 +#: ../../library/doctest.rst:452 msgid "" "No problem, provided that the traceback is the only output produced by the " "example: just paste in the traceback. [#]_ Since tracebacks contain details " @@ -676,11 +702,11 @@ msgid "" "it accepts." msgstr "" -#: ../../library/doctest.rst:428 +#: ../../library/doctest.rst:458 msgid "Simple example::" msgstr "簡單範例: ::" -#: ../../library/doctest.rst:430 +#: ../../library/doctest.rst:460 msgid "" ">>> [1, 2, 3].remove(42)\n" "Traceback (most recent call last):\n" @@ -692,20 +718,20 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: list.remove(x): x not in list" -#: ../../library/doctest.rst:435 +#: ../../library/doctest.rst:465 msgid "" "That doctest succeeds if :exc:`ValueError` is raised, with the ``list." "remove(x): x not in list`` detail as shown." msgstr "" -#: ../../library/doctest.rst:438 +#: ../../library/doctest.rst:468 msgid "" "The expected output for an exception must start with a traceback header, " "which may be either of the following two lines, indented the same as the " "first line of the example::" msgstr "" -#: ../../library/doctest.rst:442 +#: ../../library/doctest.rst:472 msgid "" "Traceback (most recent call last):\n" "Traceback (innermost last):" @@ -713,14 +739,14 @@ msgstr "" "Traceback (most recent call last):\n" "Traceback (innermost last):" -#: ../../library/doctest.rst:445 +#: ../../library/doctest.rst:475 msgid "" "The traceback header is followed by an optional traceback stack, whose " "contents are ignored by doctest. The traceback stack is typically omitted, " "or copied verbatim from an interactive session." msgstr "" -#: ../../library/doctest.rst:449 +#: ../../library/doctest.rst:479 msgid "" "The traceback stack is followed by the most interesting part: the line(s) " "containing the exception type and detail. This is usually the last line of " @@ -728,7 +754,7 @@ msgid "" "multi-line detail::" msgstr "" -#: ../../library/doctest.rst:454 +#: ../../library/doctest.rst:484 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -737,21 +763,27 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: multi\n" +" line\n" +"detail" -#: ../../library/doctest.rst:461 +#: ../../library/doctest.rst:491 msgid "" "The last three lines (starting with :exc:`ValueError`) are compared against " "the exception's type and detail, and the rest are ignored." msgstr "" -#: ../../library/doctest.rst:464 +#: ../../library/doctest.rst:494 msgid "" "Best practice is to omit the traceback stack, unless it adds significant " "documentation value to the example. So the last example is probably better " "as::" msgstr "" -#: ../../library/doctest.rst:467 +#: ../../library/doctest.rst:497 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -760,8 +792,14 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: multi\n" +" line\n" +"detail" -#: ../../library/doctest.rst:474 +#: ../../library/doctest.rst:504 msgid "" "Note that tracebacks are treated very specially. In particular, in the " "rewritten example, the use of ``...`` is independent of doctest's :const:" @@ -770,11 +808,11 @@ msgid "" "transcript of a Monty Python skit." msgstr "" -#: ../../library/doctest.rst:480 +#: ../../library/doctest.rst:510 msgid "Some details you should read once, but won't need to remember:" msgstr "" -#: ../../library/doctest.rst:482 +#: ../../library/doctest.rst:512 msgid "" "Doctest can't guess whether your expected output came from an exception " "traceback or from ordinary printing. So, e.g., an example that expects " @@ -784,7 +822,7 @@ msgid "" "create real problems." msgstr "" -#: ../../library/doctest.rst:489 +#: ../../library/doctest.rst:519 msgid "" "Each line of the traceback stack (if present) must be indented further than " "the first line of the example, *or* start with a non-alphanumeric character. " @@ -793,14 +831,14 @@ msgid "" "course this does the right thing for genuine tracebacks." msgstr "" -#: ../../library/doctest.rst:495 +#: ../../library/doctest.rst:525 msgid "" "When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, " "everything following the leftmost colon and any module information in the " "exception name is ignored." msgstr "" -#: ../../library/doctest.rst:499 +#: ../../library/doctest.rst:529 msgid "" "The interactive shell omits the traceback header line for some :exc:" "`SyntaxError`\\ s. But doctest uses the traceback header line to " @@ -809,13 +847,13 @@ msgid "" "need to manually add the traceback header line to your test example." msgstr "" -#: ../../library/doctest.rst:507 +#: ../../library/doctest.rst:537 msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" -#: ../../library/doctest.rst:510 +#: ../../library/doctest.rst:540 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -829,7 +867,7 @@ msgstr "" " ~~^~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:516 +#: ../../library/doctest.rst:546 msgid "" "Since the lines showing the position of the error come before the exception " "type and detail, they are not checked by doctest. For example, the " @@ -837,7 +875,7 @@ msgid "" "location::" msgstr "" -#: ../../library/doctest.rst:520 +#: ../../library/doctest.rst:550 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -851,11 +889,11 @@ msgstr "" " ^~~~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:531 +#: ../../library/doctest.rst:561 msgid "Option Flags" msgstr "可選旗標" -#: ../../library/doctest.rst:533 +#: ../../library/doctest.rst:563 msgid "" "A number of option flags control various aspects of doctest's behavior. " "Symbolic names for the flags are supplied as module constants, which can be :" @@ -865,17 +903,13 @@ msgid "" "option." msgstr "" -#: ../../library/doctest.rst:539 -msgid "The ``-o`` command line option." -msgstr "" - -#: ../../library/doctest.rst:542 +#: ../../library/doctest.rst:569 msgid "" "The first group of options define test semantics, controlling aspects of how " "doctest decides whether actual output matches an example's expected output:" msgstr "" -#: ../../library/doctest.rst:548 +#: ../../library/doctest.rst:575 msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " @@ -887,7 +921,7 @@ msgid "" "not for several years." msgstr "" -#: ../../library/doctest.rst:560 +#: ../../library/doctest.rst:587 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " @@ -896,7 +930,7 @@ msgid "" "`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." msgstr "" -#: ../../library/doctest.rst:569 +#: ../../library/doctest.rst:596 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " @@ -906,7 +940,7 @@ msgid "" "across multiple lines in your source." msgstr "" -#: ../../library/doctest.rst:580 +#: ../../library/doctest.rst:607 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " @@ -915,14 +949,14 @@ msgid "" "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -#: ../../library/doctest.rst:589 +#: ../../library/doctest.rst:616 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" -#: ../../library/doctest.rst:593 +#: ../../library/doctest.rst:620 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" @@ -932,7 +966,7 @@ msgid "" "these variations will work with the flag specified:" msgstr "" -#: ../../library/doctest.rst:601 +#: ../../library/doctest.rst:628 msgid "" ">>> raise Exception('message')\n" "Traceback (most recent call last):\n" @@ -958,20 +992,20 @@ msgstr "" "Traceback (most recent call last):\n" "__main__.Exception: message" -#: ../../library/doctest.rst:615 +#: ../../library/doctest.rst:642 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" -#: ../../library/doctest.rst:619 +#: ../../library/doctest.rst:646 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -#: ../../library/doctest.rst:626 +#: ../../library/doctest.rst:653 msgid "" "When specified, do not run the example at all. This can be useful in " "contexts where doctest examples serve as both documentation and test cases, " @@ -980,32 +1014,32 @@ msgid "" "might depend on resources which would be unavailable to the test driver." msgstr "" -#: ../../library/doctest.rst:632 +#: ../../library/doctest.rst:659 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" -#: ../../library/doctest.rst:637 +#: ../../library/doctest.rst:664 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" -#: ../../library/doctest.rst:639 +#: ../../library/doctest.rst:666 msgid "The second group of options controls how test failures are reported:" msgstr "" -#: ../../library/doctest.rst:644 +#: ../../library/doctest.rst:671 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" -#: ../../library/doctest.rst:650 +#: ../../library/doctest.rst:677 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" -#: ../../library/doctest.rst:656 +#: ../../library/doctest.rst:683 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " @@ -1015,7 +1049,7 @@ msgid "" "mismatching column positions." msgstr "" -#: ../../library/doctest.rst:665 +#: ../../library/doctest.rst:692 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " @@ -1026,7 +1060,7 @@ msgid "" "of failures reported; only the output is suppressed." msgstr "" -#: ../../library/doctest.rst:676 +#: ../../library/doctest.rst:703 msgid "" "When specified, exit after the first failing example and don't attempt to " "run the remaining examples. Thus, the number of failures reported will be at " @@ -1034,23 +1068,17 @@ msgid "" "first failure won't even produce debugging output." msgstr "" -#: ../../library/doctest.rst:681 -msgid "" -"The doctest command line accepts the option ``-f`` as a shorthand for ``-o " -"FAIL_FAST``." -msgstr "" - -#: ../../library/doctest.rst:689 +#: ../../library/doctest.rst:711 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -#: ../../library/doctest.rst:692 +#: ../../library/doctest.rst:714 msgid "" "There is also a way to register new option flag names, though this isn't " "useful unless you intend to extend :mod:`doctest` internals via subclassing:" msgstr "" -#: ../../library/doctest.rst:698 +#: ../../library/doctest.rst:720 msgid "" "Create a new option flag with a given name, and return the new flag's " "integer value. :func:`register_optionflag` can be used when subclassing :" @@ -1059,39 +1087,39 @@ msgid "" "be called using the following idiom::" msgstr "" -#: ../../library/doctest.rst:704 +#: ../../library/doctest.rst:726 msgid "MY_FLAG = register_optionflag('MY_FLAG')" msgstr "MY_FLAG = register_optionflag('MY_FLAG')" -#: ../../library/doctest.rst:714 +#: ../../library/doctest.rst:736 msgid "Directives" msgstr "" -#: ../../library/doctest.rst:716 +#: ../../library/doctest.rst:738 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" -#: ../../library/doctest.rst:727 +#: ../../library/doctest.rst:749 msgid "" "Whitespace is not allowed between the ``+`` or ``-`` and the directive " "option name. The directive option name can be any of the option flag names " "explained above." msgstr "" -#: ../../library/doctest.rst:731 +#: ../../library/doctest.rst:753 msgid "" "An example's doctest directives modify doctest's behavior for that single " "example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" -#: ../../library/doctest.rst:734 +#: ../../library/doctest.rst:756 msgid "For example, this test passes:" msgstr "" -#: ../../library/doctest.rst:736 +#: ../../library/doctest.rst:758 msgid "" ">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" @@ -1101,7 +1129,7 @@ msgstr "" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" "10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" -#: ../../library/doctest.rst:743 +#: ../../library/doctest.rst:765 msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " @@ -1109,7 +1137,7 @@ msgid "" "a directive to do so:" msgstr "" -#: ../../library/doctest.rst:748 +#: ../../library/doctest.rst:770 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" @@ -1117,13 +1145,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:754 +#: ../../library/doctest.rst:776 msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" -#: ../../library/doctest.rst:757 +#: ../../library/doctest.rst:779 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" @@ -1131,13 +1159,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:763 +#: ../../library/doctest.rst:785 msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" -#: ../../library/doctest.rst:766 +#: ../../library/doctest.rst:788 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "... # doctest: +NORMALIZE_WHITESPACE\n" @@ -1147,14 +1175,14 @@ msgstr "" "... # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:773 +#: ../../library/doctest.rst:795 msgid "" "As the previous example shows, you can add ``...`` lines to your example " "containing only directives. This can be useful when an example is too long " "for a directive to comfortably fit on the same line:" msgstr "" -#: ../../library/doctest.rst:777 +#: ../../library/doctest.rst:799 msgid "" ">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" "... # doctest: +ELLIPSIS\n" @@ -1164,7 +1192,7 @@ msgstr "" "... # doctest: +ELLIPSIS\n" "[0, ..., 4, 10, ..., 19, 30, ..., 39]" -#: ../../library/doctest.rst:784 +#: ../../library/doctest.rst:806 msgid "" "Note that since all options are disabled by default, and directives apply " "only to the example they appear in, enabling options (via ``+`` in a " @@ -1174,11 +1202,11 @@ msgid "" "be useful." msgstr "" -#: ../../library/doctest.rst:794 +#: ../../library/doctest.rst:816 msgid "Warnings" msgstr "警告" -#: ../../library/doctest.rst:796 +#: ../../library/doctest.rst:818 msgid "" ":mod:`doctest` is serious about requiring exact matches in expected output. " "If even a single character doesn't match, the test fails. This will " @@ -1188,7 +1216,7 @@ msgid "" "test like ::" msgstr "" -#: ../../library/doctest.rst:802 +#: ../../library/doctest.rst:824 msgid "" ">>> foo()\n" "{\"spam\", \"eggs\"}" @@ -1196,11 +1224,11 @@ msgstr "" ">>> foo()\n" "{\"spam\", \"eggs\"}" -#: ../../library/doctest.rst:805 +#: ../../library/doctest.rst:827 msgid "is vulnerable! One workaround is to do ::" msgstr "" -#: ../../library/doctest.rst:807 +#: ../../library/doctest.rst:829 msgid "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" @@ -1208,11 +1236,11 @@ msgstr "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" -#: ../../library/doctest.rst:810 +#: ../../library/doctest.rst:832 msgid "instead. Another is to do ::" msgstr "" -#: ../../library/doctest.rst:812 +#: ../../library/doctest.rst:834 msgid "" ">>> d = sorted(foo())\n" ">>> d\n" @@ -1222,29 +1250,29 @@ msgstr "" ">>> d\n" "['eggs', 'spam']" -#: ../../library/doctest.rst:816 +#: ../../library/doctest.rst:838 msgid "There are others, but you get the idea." msgstr "" -#: ../../library/doctest.rst:818 +#: ../../library/doctest.rst:840 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" -#: ../../library/doctest.rst:820 +#: ../../library/doctest.rst:842 msgid "" -">>> id(1.0) # certain to fail some of the time \n" +">>> id(1.0) # certain to fail some of the time\n" "7948648\n" ">>> class C: pass\n" -">>> C() # the default repr() for instances embeds an address \n" +">>> C() # the default repr() for instances embeds an address\n" "" msgstr "" -#: ../../library/doctest.rst:828 +#: ../../library/doctest.rst:850 msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" -#: ../../library/doctest.rst:830 +#: ../../library/doctest.rst:852 msgid "" ">>> C() # doctest: +ELLIPSIS\n" "" @@ -1252,14 +1280,14 @@ msgstr "" ">>> C() # doctest: +ELLIPSIS\n" "" -#: ../../library/doctest.rst:836 +#: ../../library/doctest.rst:858 msgid "" "Floating-point numbers are also subject to small output variations across " "platforms, because Python defers to the platform C library for float " "formatting, and C libraries vary widely in quality here. ::" msgstr "" -#: ../../library/doctest.rst:840 +#: ../../library/doctest.rst:862 msgid "" ">>> 1./7 # risky\n" "0.14285714285714285\n" @@ -1269,29 +1297,29 @@ msgid "" "0.142857" msgstr "" -#: ../../library/doctest.rst:847 +#: ../../library/doctest.rst:869 msgid "" "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " "contrive doctest examples to produce numbers of that form::" msgstr "" -#: ../../library/doctest.rst:850 +#: ../../library/doctest.rst:872 msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" -#: ../../library/doctest.rst:853 +#: ../../library/doctest.rst:875 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" -#: ../../library/doctest.rst:860 +#: ../../library/doctest.rst:882 msgid "Basic API" msgstr "基礎 API" -#: ../../library/doctest.rst:862 +#: ../../library/doctest.rst:884 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " @@ -1299,25 +1327,25 @@ msgid "" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -#: ../../library/doctest.rst:870 +#: ../../library/doctest.rst:892 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:873 +#: ../../library/doctest.rst:895 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" -#: ../../library/doctest.rst:876 +#: ../../library/doctest.rst:898 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" -#: ../../library/doctest.rst:879 +#: ../../library/doctest.rst:901 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " @@ -1327,20 +1355,20 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" -#: ../../library/doctest.rst:886 +#: ../../library/doctest.rst:908 msgid "" "If *module_relative* is ``False``, then *filename* specifies an OS-specific " "path. The path may be absolute or relative; relative paths are resolved " "with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:890 +#: ../../library/doctest.rst:912 msgid "" "Optional argument *name* gives the name of the test; by default, or if " "``None``, ``os.path.basename(filename)`` is used." msgstr "" -#: ../../library/doctest.rst:893 +#: ../../library/doctest.rst:915 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for a module-" @@ -1349,7 +1377,7 @@ msgid "" "is an error to specify *package* if *module_relative* is ``False``." msgstr "" -#: ../../library/doctest.rst:899 +#: ../../library/doctest.rst:921 msgid "" "Optional argument *globs* gives a dict to be used as the globals when " "executing examples. A new shallow copy of this dict is created for the " @@ -1357,7 +1385,7 @@ msgid "" "``None``, a new empty dict is used." msgstr "" -#: ../../library/doctest.rst:904 +#: ../../library/doctest.rst:926 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " @@ -1370,27 +1398,27 @@ msgid "" "tested." msgstr "" -#: ../../library/doctest.rst:913 +#: ../../library/doctest.rst:935 msgid "" "Optional argument *verbose* prints lots of stuff if true, and prints only " "failures if false; by default, or if ``None``, it's true if and only if ``'-" "v'`` is in ``sys.argv``." msgstr "" -#: ../../library/doctest.rst:917 +#: ../../library/doctest.rst:939 msgid "" "Optional argument *report* prints a summary at the end when true, else " "prints nothing at the end. In verbose mode, the summary is detailed, else " "the summary is very brief (in fact, empty if all tests passed)." msgstr "" -#: ../../library/doctest.rst:921 +#: ../../library/doctest.rst:943 msgid "" "Optional argument *optionflags* (default value 0) takes the :ref:`bitwise OR " "` of option flags. See section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:925 +#: ../../library/doctest.rst:947 msgid "" "Optional argument *raise_on_error* defaults to false. If true, an exception " "is raised upon the first failure or unexpected exception in an example. " @@ -1398,33 +1426,33 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:930 ../../library/doctest.rst:1072 +#: ../../library/doctest.rst:952 ../../library/doctest.rst:1094 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: ../../library/doctest.rst:934 ../../library/doctest.rst:1076 +#: ../../library/doctest.rst:956 ../../library/doctest.rst:1098 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" -#: ../../library/doctest.rst:940 +#: ../../library/doctest.rst:962 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:943 +#: ../../library/doctest.rst:965 msgid "" "Test examples in docstrings in functions and classes reachable from module " "*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " "starting with ``m.__doc__``." msgstr "" -#: ../../library/doctest.rst:947 +#: ../../library/doctest.rst:969 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists. ``m." "__test__`` maps names (strings) to functions, classes and strings; function " @@ -1432,22 +1460,22 @@ msgid "" "directly, as if they were docstrings." msgstr "" -#: ../../library/doctest.rst:952 +#: ../../library/doctest.rst:974 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" -#: ../../library/doctest.rst:954 +#: ../../library/doctest.rst:976 msgid "Return ``(failure_count, test_count)``." msgstr "" -#: ../../library/doctest.rst:956 +#: ../../library/doctest.rst:978 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:959 +#: ../../library/doctest.rst:981 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " @@ -1458,39 +1486,39 @@ msgid "" "defaults to true." msgstr "" -#: ../../library/doctest.rst:967 +#: ../../library/doctest.rst:989 msgid "" "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, and *globs* are the same as for function :func:`testfile` " "above, except that *globs* defaults to ``m.__dict__``." msgstr "" -#: ../../library/doctest.rst:974 +#: ../../library/doctest.rst:996 msgid "" "Test examples associated with object *f*; for example, *f* may be a string, " "a module, a function, or a class object." msgstr "" -#: ../../library/doctest.rst:977 +#: ../../library/doctest.rst:999 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" -#: ../../library/doctest.rst:979 +#: ../../library/doctest.rst:1001 msgid "" "Optional argument *name* is used in failure messages, and defaults to " "``\"NoName\"``." msgstr "" -#: ../../library/doctest.rst:982 +#: ../../library/doctest.rst:1004 msgid "" "If optional argument *verbose* is true, output is generated even if there " "are no failures. By default, output is generated only in case of an example " "failure." msgstr "" -#: ../../library/doctest.rst:985 +#: ../../library/doctest.rst:1007 msgid "" "Optional argument *compileflags* gives the set of flags that should be used " "by the Python compiler when running the examples. By default, or if " @@ -1498,16 +1526,16 @@ msgid "" "found in *globs*." msgstr "" -#: ../../library/doctest.rst:989 +#: ../../library/doctest.rst:1011 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" -#: ../../library/doctest.rst:995 +#: ../../library/doctest.rst:1017 msgid "Unittest API" msgstr "" -#: ../../library/doctest.rst:997 +#: ../../library/doctest.rst:1019 msgid "" "As your collection of doctest'ed modules grows, you'll want a way to run all " "their doctests systematically. :mod:`doctest` provides two functions that " @@ -1517,7 +1545,7 @@ msgid "" "your test module::" msgstr "" -#: ../../library/doctest.rst:1003 +#: ../../library/doctest.rst:1025 msgid "" "import unittest\n" "import doctest\n" @@ -1535,19 +1563,19 @@ msgstr "" " tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" " return tests" -#: ../../library/doctest.rst:1011 +#: ../../library/doctest.rst:1033 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" -#: ../../library/doctest.rst:1017 +#: ../../library/doctest.rst:1039 msgid "" "Convert doctest tests from one or more text files to a :class:`unittest." "TestSuite`." msgstr "" -#: ../../library/doctest.rst:1020 +#: ../../library/doctest.rst:1042 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " @@ -1558,21 +1586,21 @@ msgid "" "marked as skipped." msgstr "" -#: ../../library/doctest.rst:1027 +#: ../../library/doctest.rst:1049 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1029 +#: ../../library/doctest.rst:1051 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1031 +#: ../../library/doctest.rst:1053 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1034 +#: ../../library/doctest.rst:1056 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1583,14 +1611,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1042 +#: ../../library/doctest.rst:1064 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:1046 +#: ../../library/doctest.rst:1068 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1600,7 +1628,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1053 +#: ../../library/doctest.rst:1075 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " @@ -1608,7 +1636,7 @@ msgid "" "test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1058 +#: ../../library/doctest.rst:1080 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " @@ -1616,14 +1644,14 @@ msgid "" "access the test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1063 ../../library/doctest.rst:1098 +#: ../../library/doctest.rst:1085 ../../library/doctest.rst:1120 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: ../../library/doctest.rst:1067 +#: ../../library/doctest.rst:1089 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1631,17 +1659,17 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: ../../library/doctest.rst:1079 +#: ../../library/doctest.rst:1101 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1085 +#: ../../library/doctest.rst:1107 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1087 +#: ../../library/doctest.rst:1109 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. If any of the doctests fail, " @@ -1651,42 +1679,42 @@ msgid "" "skipped, then the synthesized unit test is also marked as skipped." msgstr "" -#: ../../library/doctest.rst:1094 +#: ../../library/doctest.rst:1116 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: ../../library/doctest.rst:1102 +#: ../../library/doctest.rst:1124 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: ../../library/doctest.rst:1105 +#: ../../library/doctest.rst:1127 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: ../../library/doctest.rst:1108 +#: ../../library/doctest.rst:1130 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" -#: ../../library/doctest.rst:1111 +#: ../../library/doctest.rst:1133 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1113 +#: ../../library/doctest.rst:1135 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1119 +#: ../../library/doctest.rst:1141 msgid "" "When doctests which have been converted to unit tests by :func:" "`DocFileSuite` or :func:`DocTestSuite` fail, this exception is raised " @@ -1694,7 +1722,7 @@ msgid "" "approximate) line number." msgstr "" -#: ../../library/doctest.rst:1123 +#: ../../library/doctest.rst:1145 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1703,14 +1731,14 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1129 +#: ../../library/doctest.rst:1151 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" -#: ../../library/doctest.rst:1133 +#: ../../library/doctest.rst:1155 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`!DocTestCase`. This is important for a subtle reason: when you run :" @@ -1723,23 +1751,23 @@ msgid "" "through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1143 +#: ../../library/doctest.rst:1165 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: ../../library/doctest.rst:1149 +#: ../../library/doctest.rst:1171 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1151 +#: ../../library/doctest.rst:1173 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: ../../library/doctest.rst:1154 +#: ../../library/doctest.rst:1176 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" @@ -1753,17 +1781,17 @@ msgid "" "`!doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" -#: ../../library/doctest.rst:1165 +#: ../../library/doctest.rst:1187 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: ../../library/doctest.rst:1172 +#: ../../library/doctest.rst:1194 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1174 +#: ../../library/doctest.rst:1196 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1771,62 +1799,62 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1179 +#: ../../library/doctest.rst:1201 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: ../../library/doctest.rst:1182 +#: ../../library/doctest.rst:1204 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1185 +#: ../../library/doctest.rst:1207 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1188 +#: ../../library/doctest.rst:1210 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1191 +#: ../../library/doctest.rst:1213 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: ../../library/doctest.rst:1195 +#: ../../library/doctest.rst:1217 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1198 +#: ../../library/doctest.rst:1220 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1201 +#: ../../library/doctest.rst:1223 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1204 +#: ../../library/doctest.rst:1226 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1207 +#: ../../library/doctest.rst:1229 msgid "" " list of:\n" "+------+ +---------+\n" @@ -1846,30 +1874,30 @@ msgstr "" " DocTestParser | Example | OutputChecker\n" " +---------+" -#: ../../library/doctest.rst:1220 +#: ../../library/doctest.rst:1242 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1225 +#: ../../library/doctest.rst:1247 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: ../../library/doctest.rst:1229 +#: ../../library/doctest.rst:1251 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1235 +#: ../../library/doctest.rst:1257 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1241 +#: ../../library/doctest.rst:1263 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1877,57 +1905,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1249 +#: ../../library/doctest.rst:1271 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: ../../library/doctest.rst:1255 +#: ../../library/doctest.rst:1277 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" -#: ../../library/doctest.rst:1262 +#: ../../library/doctest.rst:1284 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: ../../library/doctest.rst:1269 +#: ../../library/doctest.rst:1291 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: ../../library/doctest.rst:1276 +#: ../../library/doctest.rst:1298 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1281 +#: ../../library/doctest.rst:1303 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1286 +#: ../../library/doctest.rst:1308 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1292 +#: ../../library/doctest.rst:1314 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1299 +#: ../../library/doctest.rst:1321 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1935,7 +1963,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1307 +#: ../../library/doctest.rst:1329 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1944,20 +1972,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1316 +#: ../../library/doctest.rst:1338 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: ../../library/doctest.rst:1323 +#: ../../library/doctest.rst:1345 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: ../../library/doctest.rst:1329 +#: ../../library/doctest.rst:1351 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1966,11 +1994,11 @@ msgid "" "default, no options are set." msgstr "" -#: ../../library/doctest.rst:1339 +#: ../../library/doctest.rst:1361 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1344 +#: ../../library/doctest.rst:1366 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -1978,48 +2006,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1349 +#: ../../library/doctest.rst:1371 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: ../../library/doctest.rst:1352 +#: ../../library/doctest.rst:1374 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: ../../library/doctest.rst:1355 +#: ../../library/doctest.rst:1377 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: ../../library/doctest.rst:1358 +#: ../../library/doctest.rst:1380 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: ../../library/doctest.rst:1362 +#: ../../library/doctest.rst:1384 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -#: ../../library/doctest.rst:1367 +#: ../../library/doctest.rst:1389 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: ../../library/doctest.rst:1370 +#: ../../library/doctest.rst:1392 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:1374 +#: ../../library/doctest.rst:1396 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -2027,26 +2055,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1378 +#: ../../library/doctest.rst:1400 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1380 +#: ../../library/doctest.rst:1402 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: ../../library/doctest.rst:1384 +#: ../../library/doctest.rst:1406 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1386 +#: ../../library/doctest.rst:1408 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1388 +#: ../../library/doctest.rst:1410 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -2055,7 +2083,7 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1394 +#: ../../library/doctest.rst:1416 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " @@ -2065,34 +2093,34 @@ msgid "" "defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1405 +#: ../../library/doctest.rst:1427 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1410 +#: ../../library/doctest.rst:1432 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1414 +#: ../../library/doctest.rst:1436 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1419 +#: ../../library/doctest.rst:1441 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1422 +#: ../../library/doctest.rst:1444 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: ../../library/doctest.rst:1429 +#: ../../library/doctest.rst:1451 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -2100,7 +2128,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1436 +#: ../../library/doctest.rst:1458 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " @@ -2108,34 +2136,33 @@ msgid "" "name identifying this string, and is only used for error messages." msgstr "" -#: ../../library/doctest.rst:1443 -#, fuzzy +#: ../../library/doctest.rst:1465 msgid "TestResults objects" -msgstr "DocTestRunner 物件" +msgstr "TestResults 物件" -#: ../../library/doctest.rst:1450 +#: ../../library/doctest.rst:1472 msgid "Number of failed tests." msgstr "" -#: ../../library/doctest.rst:1454 +#: ../../library/doctest.rst:1476 msgid "Number of attempted tests." msgstr "" -#: ../../library/doctest.rst:1458 +#: ../../library/doctest.rst:1480 msgid "Number of skipped tests." msgstr "" -#: ../../library/doctest.rst:1466 +#: ../../library/doctest.rst:1488 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1471 +#: ../../library/doctest.rst:1493 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1474 +#: ../../library/doctest.rst:1496 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " @@ -2145,7 +2172,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/doctest.rst:1480 +#: ../../library/doctest.rst:1502 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " @@ -2156,14 +2183,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1488 +#: ../../library/doctest.rst:1510 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: ../../library/doctest.rst:1492 +#: ../../library/doctest.rst:1514 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -2172,14 +2199,14 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: ../../library/doctest.rst:1498 +#: ../../library/doctest.rst:1520 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:1502 +#: ../../library/doctest.rst:1524 msgid "" "The test runner accumulates statistics. The aggregated number of attempted, " "failed and skipped examples is also available via the :attr:`tries`, :attr:" @@ -2187,53 +2214,53 @@ msgid "" "`summarize` methods return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1507 +#: ../../library/doctest.rst:1529 msgid ":class:`DocTestRunner` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1512 +#: ../../library/doctest.rst:1534 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1516 +#: ../../library/doctest.rst:1538 msgid "" "*example* is the example about to be processed. *test* is the test " "*containing example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1523 +#: ../../library/doctest.rst:1545 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: ../../library/doctest.rst:1527 ../../library/doctest.rst:1538 +#: ../../library/doctest.rst:1549 ../../library/doctest.rst:1560 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1534 +#: ../../library/doctest.rst:1556 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: ../../library/doctest.rst:1545 +#: ../../library/doctest.rst:1567 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1549 +#: ../../library/doctest.rst:1571 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -2241,14 +2268,14 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1557 +#: ../../library/doctest.rst:1579 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " "results using the writer function *out*. Return a :class:`TestResults` " "instance." msgstr "" -#: ../../library/doctest.rst:1561 +#: ../../library/doctest.rst:1583 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -2256,55 +2283,54 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1566 +#: ../../library/doctest.rst:1588 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: ../../library/doctest.rst:1570 +#: ../../library/doctest.rst:1592 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1577 +#: ../../library/doctest.rst:1599 msgid "" "Print a summary of all the test cases that have been run by this " "DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1580 +#: ../../library/doctest.rst:1602 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: ../../library/doctest.rst:1584 -#, fuzzy +#: ../../library/doctest.rst:1606 msgid ":class:`DocTestParser` has the following attributes:" -msgstr ":exc:`DocTestFailure` 定義了以下屬性:" +msgstr ":class:`DocTestParser` 有以下屬性:" -#: ../../library/doctest.rst:1588 +#: ../../library/doctest.rst:1610 msgid "Number of attempted examples." msgstr "" -#: ../../library/doctest.rst:1592 +#: ../../library/doctest.rst:1614 msgid "Number of failed examples." msgstr "" -#: ../../library/doctest.rst:1596 +#: ../../library/doctest.rst:1618 msgid "Number of skipped examples." msgstr "" -#: ../../library/doctest.rst:1604 +#: ../../library/doctest.rst:1626 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1609 +#: ../../library/doctest.rst:1631 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -2313,11 +2339,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1616 +#: ../../library/doctest.rst:1638 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1620 +#: ../../library/doctest.rst:1642 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -2326,28 +2352,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1629 +#: ../../library/doctest.rst:1651 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: ../../library/doctest.rst:1637 +#: ../../library/doctest.rst:1659 msgid "Debugging" msgstr "" -#: ../../library/doctest.rst:1639 +#: ../../library/doctest.rst:1661 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: ../../library/doctest.rst:1641 +#: ../../library/doctest.rst:1663 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1644 +#: ../../library/doctest.rst:1666 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -2355,13 +2381,13 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1649 +#: ../../library/doctest.rst:1671 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1652 +#: ../../library/doctest.rst:1674 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -2369,7 +2395,7 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1657 +#: ../../library/doctest.rst:1679 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2391,11 +2417,11 @@ msgstr "" "9\n" "\"\"\"" -#: ../../library/doctest.rst:1667 +#: ../../library/doctest.rst:1689 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1669 +#: ../../library/doctest.rst:1691 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2457,17 +2483,17 @@ msgstr "" "(0, 3)\n" ">>>" -#: ../../library/doctest.rst:1700 +#: ../../library/doctest.rst:1722 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1706 +#: ../../library/doctest.rst:1728 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1708 +#: ../../library/doctest.rst:1730 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -2475,7 +2501,7 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1713 +#: ../../library/doctest.rst:1735 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2488,11 +2514,11 @@ msgid "" "\"\"\"))" msgstr "" -#: ../../library/doctest.rst:1723 +#: ../../library/doctest.rst:1745 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1725 +#: ../../library/doctest.rst:1747 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2503,18 +2529,18 @@ msgid "" "## 3" msgstr "" -#: ../../library/doctest.rst:1733 +#: ../../library/doctest.rst:1755 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: ../../library/doctest.rst:1740 +#: ../../library/doctest.rst:1762 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1742 +#: ../../library/doctest.rst:1764 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -2524,7 +2550,7 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: ../../library/doctest.rst:1749 +#: ../../library/doctest.rst:1771 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" @@ -2532,17 +2558,17 @@ msgstr "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1752 +#: ../../library/doctest.rst:1774 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: ../../library/doctest.rst:1758 +#: ../../library/doctest.rst:1780 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1760 +#: ../../library/doctest.rst:1782 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -2550,13 +2576,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1765 +#: ../../library/doctest.rst:1787 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1768 +#: ../../library/doctest.rst:1790 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -2568,30 +2594,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1779 +#: ../../library/doctest.rst:1801 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1781 +#: ../../library/doctest.rst:1803 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: ../../library/doctest.rst:1784 +#: ../../library/doctest.rst:1806 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1786 +#: ../../library/doctest.rst:1808 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: ../../library/doctest.rst:1791 +#: ../../library/doctest.rst:1813 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -2599,7 +2625,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1799 +#: ../../library/doctest.rst:1821 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -2609,89 +2635,89 @@ msgid "" "the actual output." msgstr "" -#: ../../library/doctest.rst:1806 +#: ../../library/doctest.rst:1828 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: ../../library/doctest.rst:1809 +#: ../../library/doctest.rst:1831 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1814 +#: ../../library/doctest.rst:1836 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1818 +#: ../../library/doctest.rst:1840 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` 定義了以下屬性:" -#: ../../library/doctest.rst:1823 ../../library/doctest.rst:1847 +#: ../../library/doctest.rst:1845 ../../library/doctest.rst:1869 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1828 ../../library/doctest.rst:1852 +#: ../../library/doctest.rst:1850 ../../library/doctest.rst:1874 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1833 +#: ../../library/doctest.rst:1855 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1838 +#: ../../library/doctest.rst:1860 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1842 +#: ../../library/doctest.rst:1864 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -#: ../../library/doctest.rst:1857 +#: ../../library/doctest.rst:1879 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1864 +#: ../../library/doctest.rst:1886 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1866 +#: ../../library/doctest.rst:1888 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1869 +#: ../../library/doctest.rst:1891 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1871 +#: ../../library/doctest.rst:1893 msgid "Regression testing." msgstr "" -#: ../../library/doctest.rst:1873 +#: ../../library/doctest.rst:1895 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1875 +#: ../../library/doctest.rst:1897 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: ../../library/doctest.rst:1879 +#: ../../library/doctest.rst:1901 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -2703,7 +2729,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1887 +#: ../../library/doctest.rst:1909 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -2724,13 +2750,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1905 +#: ../../library/doctest.rst:1927 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1908 +#: ../../library/doctest.rst:1930 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2738,7 +2764,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1913 +#: ../../library/doctest.rst:1935 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2746,13 +2772,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1917 +#: ../../library/doctest.rst:1939 msgid "" "Define a ``__test__`` dictionary mapping from regression test topics to " "docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1920 +#: ../../library/doctest.rst:1942 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2760,8 +2786,7 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1925 -#, fuzzy +#: ../../library/doctest.rst:1947 msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2791,55 +2816,58 @@ msgstr "" " optionflags=flags)\n" " else:\n" " fail, total = doctest.testmod(optionflags=flags)\n" -" print(\"{} failures out of {} tests\".format(fail, total))" +" print(f\"{fail} failures out of {total} tests\")" -#: ../../library/doctest.rst:1942 +#: ../../library/doctest.rst:1964 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" -#: ../../library/doctest.rst:1943 +#: ../../library/doctest.rst:1965 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " "that also makes for a confusing test." msgstr "" -#: ../../library/doctest.rst:339 +#: ../../library/doctest.rst:369 msgid ">>>" msgstr ">>>" -#: ../../library/doctest.rst:339 +#: ../../library/doctest.rst:369 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/doctest.rst:339 ../../library/doctest.rst:577 +#: ../../library/doctest.rst:369 ../../library/doctest.rst:604 msgid "..." msgstr "..." -#: ../../library/doctest.rst:505 +#: ../../library/doctest.rst:535 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/doctest.rst:505 +#: ../../library/doctest.rst:535 msgid "marker" msgstr "marker(標記)" -#: ../../library/doctest.rst:557 +#: ../../library/doctest.rst:584 msgid "" msgstr "" -#: ../../library/doctest.rst:577 ../../library/doctest.rst:707 +#: ../../library/doctest.rst:604 ../../library/doctest.rst:729 msgid "in doctests" msgstr "於 doctests 中" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "- (minus)" msgstr "- (減號)" + +#~ msgid "The ``-o`` command line option." +#~ msgstr " ``-o`` 命令列選項。" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index a03eead9b1..3ecae14486 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-19 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -218,10 +218,19 @@ msgstr "" #: ../../library/email.contentmanager.rst:159 msgid "" "For ``str`` objects, if *cte* is not set use heuristics to determine the " -"most compact encoding." +"most compact encoding. Prior to encoding, :meth:`str.splitlines` is used to " +"normalize all line boundaries, ensuring that each line of the payload is " +"terminated by the current policy's :data:`~email.policy.Policy.linesep` " +"property (even if the original string did not end with one)." msgstr "" -#: ../../library/email.contentmanager.rst:161 +#: ../../library/email.contentmanager.rst:165 +msgid "" +"For ``bytes`` objects, *cte* is taken to be base64 if not set, and the " +"aforementioned newline translation is not performed." +msgstr "" + +#: ../../library/email.contentmanager.rst:167 msgid "" "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " "a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " @@ -230,14 +239,14 @@ msgid "" "For all other values of *subtype*, use ``7bit``." msgstr "" -#: ../../library/email.contentmanager.rst:168 +#: ../../library/email.contentmanager.rst:174 msgid "" "A *cte* of ``binary`` does not actually work correctly yet. The " "``EmailMessage`` object as modified by ``set_content`` is correct, but :" "class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" -#: ../../library/email.contentmanager.rst:173 +#: ../../library/email.contentmanager.rst:179 msgid "" "If *disposition* is set, use it as the value of the :mailheader:`Content-" "Disposition` header. If not specified, and *filename* is specified, add the " @@ -246,37 +255,37 @@ msgid "" "values for *disposition* are ``attachment`` and ``inline``." msgstr "" -#: ../../library/email.contentmanager.rst:180 +#: ../../library/email.contentmanager.rst:186 msgid "" "If *filename* is specified, use it as the value of the ``filename`` " "parameter of the :mailheader:`Content-Disposition` header." msgstr "" -#: ../../library/email.contentmanager.rst:183 +#: ../../library/email.contentmanager.rst:189 msgid "" "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " "its value." msgstr "" -#: ../../library/email.contentmanager.rst:186 +#: ../../library/email.contentmanager.rst:192 msgid "" "If *params* is specified, iterate its ``items`` method and use the resulting " "``(key, value)`` pairs to set additional parameters on the :mailheader:" "`Content-Type` header." msgstr "" -#: ../../library/email.contentmanager.rst:190 +#: ../../library/email.contentmanager.rst:196 msgid "" "If *headers* is specified and is a list of strings of the form ``headername: " "headervalue`` or a list of ``header`` objects (distinguished from strings by " "having a ``name`` attribute), add the headers to *msg*." msgstr "" -#: ../../library/email.contentmanager.rst:197 +#: ../../library/email.contentmanager.rst:203 msgid "Footnotes" msgstr "註解" -#: ../../library/email.contentmanager.rst:198 +#: ../../library/email.contentmanager.rst:204 msgid "" "Originally added in 3.4 as a :term:`provisional module `" msgstr "" diff --git a/library/email.errors.po b/library/email.errors.po index 4e9e91bc1f..2709c6bc47 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-07 00:03+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,40 +64,31 @@ msgstr "" #: ../../library/email.errors.rst:48 msgid "" -"Raised when a payload is added to a :class:`~email.message.Message` object " -"using :meth:`add_payload`, but the payload is already a scalar and the " -"message's :mailheader:`Content-Type` main type is not either :mimetype:" -"`multipart` or missing. :exc:`MultipartConversionError` multiply inherits " -"from :exc:`MessageError` and the built-in :exc:`TypeError`." +"Raised if the :meth:`~email.message.Message.attach` method is called on an " +"instance of a class derived from :class:`~email.mime.nonmultipart." +"MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). :exc:" +"`MultipartConversionError` multiply inherits from :exc:`MessageError` and " +"the built-in :exc:`TypeError`." msgstr "" -#: ../../library/email.errors.rst:54 -msgid "" -"Since :meth:`Message.add_payload` is deprecated, this exception is rarely " -"raised in practice. However the exception may also be raised if the :meth:" -"`~email.message.Message.attach` method is called on an instance of a class " -"derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. :class:" -"`~email.mime.image.MIMEImage`)." -msgstr "" - -#: ../../library/email.errors.rst:64 +#: ../../library/email.errors.rst:58 msgid "" "Raised when an error occurs when the :mod:`~email.generator` outputs headers." msgstr "" -#: ../../library/email.errors.rst:70 +#: ../../library/email.errors.rst:64 msgid "" "This is the base class for all defects found when parsing email messages. It " "is derived from :exc:`ValueError`." msgstr "" -#: ../../library/email.errors.rst:75 +#: ../../library/email.errors.rst:69 msgid "" "This is the base class for all defects found when parsing email headers. It " "is derived from :exc:`MessageDefect`." msgstr "" -#: ../../library/email.errors.rst:78 +#: ../../library/email.errors.rst:72 msgid "" "Here is the list of the defects that the :class:`~email.parser.FeedParser` " "can find while parsing messages. Note that the defects are added to the " @@ -107,90 +98,84 @@ msgid "" "not." msgstr "" -#: ../../library/email.errors.rst:84 +#: ../../library/email.errors.rst:78 msgid "" "All defect classes are subclassed from :class:`email.errors.MessageDefect`." msgstr "" -#: ../../library/email.errors.rst:86 +#: ../../library/email.errors.rst:82 msgid "" -":class:`NoBoundaryInMultipartDefect` -- A message claimed to be a multipart, " -"but had no :mimetype:`boundary` parameter." +"A message claimed to be a multipart, but had no :mimetype:`boundary` " +"parameter." msgstr "" -#: ../../library/email.errors.rst:89 +#: ../../library/email.errors.rst:87 msgid "" -":class:`StartBoundaryNotFoundDefect` -- The start boundary claimed in the :" -"mailheader:`Content-Type` header was never found." +"The start boundary claimed in the :mailheader:`Content-Type` header was " +"never found." msgstr "" #: ../../library/email.errors.rst:92 msgid "" -":class:`CloseBoundaryNotFoundDefect` -- A start boundary was found, but no " -"corresponding close boundary was ever found." +"A start boundary was found, but no corresponding close boundary was ever " +"found." msgstr "" -#: ../../library/email.errors.rst:97 -msgid "" -":class:`FirstHeaderLineIsContinuationDefect` -- The message had a " -"continuation line as its first header line." +#: ../../library/email.errors.rst:99 +msgid "The message had a continuation line as its first header line." msgstr "" -#: ../../library/email.errors.rst:100 -msgid "" -":class:`MisplacedEnvelopeHeaderDefect` - A \"Unix From\" header was found in " -"the middle of a header block." +#: ../../library/email.errors.rst:103 +msgid "A \"Unix From\" header was found in the middle of a header block." msgstr "" -#: ../../library/email.errors.rst:103 +#: ../../library/email.errors.rst:107 msgid "" -":class:`MissingHeaderBodySeparatorDefect` - A line was found while parsing " -"headers that had no leading white space but contained no ':'. Parsing " -"continues assuming that the line represents the first line of the body." +"A line was found while parsing headers that had no leading white space but " +"contained no ':'. Parsing continues assuming that the line represents the " +"first line of the body." msgstr "" -#: ../../library/email.errors.rst:109 +#: ../../library/email.errors.rst:115 msgid "" -":class:`MalformedHeaderDefect` -- A header was found that was missing a " -"colon, or was otherwise malformed." +"A header was found that was missing a colon, or was otherwise malformed." msgstr "" -#: ../../library/email.errors.rst:112 +#: ../../library/email.errors.rst:117 msgid "This defect has not been used for several Python versions." msgstr "" -#: ../../library/email.errors.rst:115 +#: ../../library/email.errors.rst:122 msgid "" -":class:`MultipartInvariantViolationDefect` -- A message claimed to be a :" -"mimetype:`multipart`, but no subparts were found. Note that when a message " -"has this defect, its :meth:`~email.message.Message.is_multipart` method may " -"return ``False`` even though its content type claims to be :mimetype:" -"`multipart`." +"A message claimed to be a :mimetype:`multipart`, but no subparts were found. " +"Note that when a message has this defect, its :meth:`~email.message.Message." +"is_multipart` method may return ``False`` even though its content type " +"claims to be :mimetype:`multipart`." msgstr "" -#: ../../library/email.errors.rst:120 +#: ../../library/email.errors.rst:129 msgid "" -":class:`InvalidBase64PaddingDefect` -- When decoding a block of base64 " -"encoded bytes, the padding was not correct. Enough padding is added to " -"perform the decode, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, the padding was not correct. " +"Enough padding is added to perform the decode, but the resulting decoded " +"bytes may be invalid." msgstr "" -#: ../../library/email.errors.rst:124 +#: ../../library/email.errors.rst:135 msgid "" -":class:`InvalidBase64CharactersDefect` -- When decoding a block of base64 " -"encoded bytes, characters outside the base64 alphabet were encountered. The " -"characters are ignored, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, characters outside the base64 " +"alphabet were encountered. The characters are ignored, but the resulting " +"decoded bytes may be invalid." msgstr "" -#: ../../library/email.errors.rst:128 +#: ../../library/email.errors.rst:141 msgid "" -":class:`InvalidBase64LengthDefect` -- When decoding a block of base64 " -"encoded bytes, the number of non-padding base64 characters was invalid (1 " -"more than a multiple of 4). The encoded block was kept as-is." +"When decoding a block of base64 encoded bytes, the number of non-padding " +"base64 characters was invalid (1 more than a multiple of 4). The encoded " +"block was kept as-is." msgstr "" -#: ../../library/email.errors.rst:132 +#: ../../library/email.errors.rst:147 msgid "" -":class:`InvalidDateDefect` -- When decoding an invalid or unparsable date " -"field. The original value is kept as-is." +"When decoding an invalid or unparsable date field. The original value is " +"kept as-is." msgstr "" diff --git a/library/email.examples.po b/library/email.examples.po index fe74e43133..f027517443 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-08 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -337,7 +337,7 @@ msgid "" " recette\n" " sera sûrement un très bon repas.\n" "

\n" -" \n" +" \n" " \n" "\n" "\"\"\".format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')\n" diff --git a/library/email.parser.po b/library/email.parser.po index 69565e928d..770ac9a254 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,35 +43,35 @@ msgid "" "root :class:`~email.message.EmailMessage` instance of the object structure. " "For simple, non-MIME messages the payload of this root object will likely be " "a string containing the text of the message. For MIME messages, the root " -"object will return ``True`` from its :meth:`~email.message.EmailMessage." -"is_multipart` method, and the subparts can be accessed via the payload " -"manipulation methods, such as :meth:`~email.message.EmailMessage.get_body`, :" -"meth:`~email.message.EmailMessage.iter_parts`, and :meth:`~email.message." -"EmailMessage.walk`." +"object will return ``True`` from " +"its :meth:`~email.message.EmailMessage.is_multipart` method, and the " +"subparts can be accessed via the payload manipulation methods, such " +"as :meth:`~email.message.EmailMessage.get_body`, :meth:`~email.message.EmailMessage.iter_parts`, " +"and :meth:`~email.message.EmailMessage.walk`." msgstr "" #: ../../library/email.parser.rst:30 msgid "" -"There are actually two parser interfaces available for use, the :class:" -"`Parser` API and the incremental :class:`FeedParser` API. The :class:" -"`Parser` API is most useful if you have the entire text of the message in " -"memory, or if the entire message lives in a file on the file system. :class:" -"`FeedParser` is more appropriate when you are reading the message from a " -"stream which might block waiting for more input (such as reading an email " -"message from a socket). The :class:`FeedParser` can consume and parse the " -"message incrementally, and only returns the root object when you close the " -"parser." +"There are actually two parser interfaces available for use, " +"the :class:`Parser` API and the incremental :class:`FeedParser` API. " +"The :class:`Parser` API is most useful if you have the entire text of the " +"message in memory, or if the entire message lives in a file on the file " +"system. :class:`FeedParser` is more appropriate when you are reading the " +"message from a stream which might block waiting for more input (such as " +"reading an email message from a socket). The :class:`FeedParser` can " +"consume and parse the message incrementally, and only returns the root " +"object when you close the parser." msgstr "" #: ../../library/email.parser.rst:39 msgid "" "Note that the parser can be extended in limited ways, and of course you can " "implement your own parser completely from scratch. All of the logic that " -"connects the :mod:`email` package's bundled parser and the :class:`~email." -"message.EmailMessage` class is embodied in the :class:`~email.policy.Policy` " -"class, so a custom parser can create message object trees any way it finds " -"necessary by implementing custom versions of the appropriate :class:`!" -"Policy` methods." +"connects the :mod:`email` package's bundled parser and " +"the :class:`~email.message.EmailMessage` class is embodied in " +"the :class:`~email.policy.Policy` class, so a custom parser can create " +"message object trees any way it finds necessary by implementing custom " +"versions of the appropriate :class:`!Policy` methods." msgstr "" #: ../../library/email.parser.rst:49 @@ -84,11 +83,11 @@ msgid "" "The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` " "module, provides an API that is conducive to incremental parsing of email " "messages, such as would be necessary when reading the text of an email " -"message from a source that can block (such as a socket). The :class:" -"`BytesFeedParser` can of course be used to parse an email message fully " -"contained in a :term:`bytes-like object`, string, or file, but the :class:" -"`BytesParser` API may be more convenient for such use cases. The semantics " -"and results of the two parser APIs are identical." +"message from a source that can block (such as a socket). " +"The :class:`BytesFeedParser` can of course be used to parse an email message " +"fully contained in a :term:`bytes-like object`, string, or file, but " +"the :class:`BytesParser` API may be more convenient for such use cases. The " +"semantics and results of the two parser APIs are identical." msgstr "" #: ../../library/email.parser.rst:60 @@ -98,10 +97,10 @@ msgid "" "to retrieve the root message object. The :class:`BytesFeedParser` is " "extremely accurate when parsing standards-compliant messages, and it does a " "very good job of parsing non-compliant messages, providing information about " -"how a message was deemed broken. It will populate a message object's :attr:" -"`~email.message.EmailMessage.defects` attribute with a list of any problems " -"it found in a message. See the :mod:`email.errors` module for the list of " -"defects that it can find." +"how a message was deemed broken. It will populate a message " +"object's :attr:`~email.message.EmailMessage.defects` attribute with a list " +"of any problems it found in a message. See the :mod:`email.errors` module " +"for the list of defects that it can find." msgstr "" #: ../../library/email.parser.rst:70 @@ -111,21 +110,21 @@ msgstr "" #: ../../library/email.parser.rst:75 msgid "" "Create a :class:`BytesFeedParser` instance. Optional *_factory* is a no-" -"argument callable; if not specified use the :attr:`~email.policy.Policy." -"message_factory` from the *policy*. Call *_factory* whenever a new message " -"object is needed." +"argument callable; if not specified use " +"the :attr:`~email.policy.Policy.message_factory` from the *policy*. Call " +"*_factory* whenever a new message object is needed." msgstr "" #: ../../library/email.parser.rst:80 msgid "" "If *policy* is specified use the rules it specifies to update the " -"representation of the message. If *policy* is not set, use the :class:" -"`compat32 ` policy, which maintains backward " -"compatibility with the Python 3.2 version of the email package and provides :" -"class:`~email.message.Message` as the default factory. All other policies " -"provide :class:`~email.message.EmailMessage` as the default *_factory*. For " -"more information on what else *policy* controls, see the :mod:`~email." -"policy` documentation." +"representation of the message. If *policy* is not set, use " +"the :class:`compat32 ` policy, which maintains " +"backward compatibility with the Python 3.2 version of the email package and " +"provides :class:`~email.message.Message` as the default factory. All other " +"policies provide :class:`~email.message.EmailMessage` as the default " +"*_factory*. For more information on what else *policy* controls, see " +"the :mod:`~email.policy` documentation." msgstr "" #: ../../library/email.parser.rst:89 ../../library/email.parser.rst:145 @@ -160,10 +159,10 @@ msgstr "" #: ../../library/email.parser.rst:116 msgid "" -"Works like :class:`BytesFeedParser` except that the input to the :meth:" -"`~BytesFeedParser.feed` method must be a string. This is of limited " -"utility, since the only way for such a message to be valid is for it to " -"contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " +"Works like :class:`BytesFeedParser` except that the input to " +"the :meth:`~BytesFeedParser.feed` method must be a string. This is of " +"limited utility, since the only way for such a message to be valid is for it " +"to contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " "``True``, no binary attachments." msgstr "" @@ -176,13 +175,13 @@ msgid "" "The :class:`BytesParser` class, imported from the :mod:`email.parser` " "module, provides an API that can be used to parse a message when the " "complete contents of the message are available in a :term:`bytes-like " -"object` or file. The :mod:`email.parser` module also provides :class:" -"`Parser` for parsing strings, and header-only parsers, :class:" -"`BytesHeaderParser` and :class:`HeaderParser`, which can be used if you're " -"only interested in the headers of the message. :class:`BytesHeaderParser` " -"and :class:`HeaderParser` can be much faster in these situations, since they " -"do not attempt to parse the message body, instead setting the payload to the " -"raw body." +"object` or file. The :mod:`email.parser` module also " +"provides :class:`Parser` for parsing strings, and header-only " +"parsers, :class:`BytesHeaderParser` and :class:`HeaderParser`, which can be " +"used if you're only interested in the headers of the " +"message. :class:`BytesHeaderParser` and :class:`HeaderParser` can be much " +"faster in these situations, since they do not attempt to parse the message " +"body, instead setting the payload to the raw body." msgstr "" #: ../../library/email.parser.rst:141 @@ -206,8 +205,8 @@ msgstr "" #: ../../library/email.parser.rst:156 msgid "" "Read all the data from the binary file-like object *fp*, parse the resulting " -"bytes, and return the message object. *fp* must support both the :meth:`~io." -"IOBase.readline` and the :meth:`~io.IOBase.read` methods." +"bytes, and return the message object. *fp* must support both " +"the :meth:`~io.IOBase.readline` and the :meth:`~io.IOBase.read` methods." msgstr "" #: ../../library/email.parser.rst:161 @@ -217,8 +216,8 @@ msgid "" "and header continuation lines, optionally preceded by an envelope header. " "The header block is terminated either by the end of the data or by a blank " "line. Following the header block is the body of the message (which may " -"contain MIME-encoded subparts, including subparts with a :mailheader:" -"`Content-Transfer-Encoding` of ``8bit``)." +"contain MIME-encoded subparts, including subparts with " +"a :mailheader:`Content-Transfer-Encoding` of ``8bit``)." msgstr "" #: ../../library/email.parser.rst:169 @@ -231,9 +230,9 @@ msgstr "" #: ../../library/email.parser.rst:176 msgid "" "Similar to the :meth:`parse` method, except it takes a :term:`bytes-like " -"object` instead of a file-like object. Calling this method on a :term:" -"`bytes-like object` is equivalent to wrapping *bytes* in a :class:`~io." -"BytesIO` instance first and calling :meth:`parse`." +"object` instead of a file-like object. Calling this method on " +"a :term:`bytes-like object` is equivalent to wrapping *bytes* in " +"a :class:`~io.BytesIO` instance first and calling :meth:`parse`." msgstr "" #: ../../library/email.parser.rst:181 ../../library/email.parser.rst:221 @@ -267,16 +266,16 @@ msgstr "" #: ../../library/email.parser.rst:210 msgid "" -"Other than the text mode requirement, this method operates like :meth:" -"`BytesParser.parse`." +"Other than the text mode requirement, this method operates " +"like :meth:`BytesParser.parse`." msgstr "" #: ../../library/email.parser.rst:216 msgid "" "Similar to the :meth:`parse` method, except it takes a string object instead " "of a file-like object. Calling this method on a string is equivalent to " -"wrapping *text* in a :class:`~io.StringIO` instance first and calling :meth:" -"`parse`." +"wrapping *text* in a :class:`~io.StringIO` instance first and " +"calling :meth:`parse`." msgstr "" #: ../../library/email.parser.rst:226 @@ -330,10 +329,10 @@ msgstr "" #: ../../library/email.parser.rst:286 msgid "" ">>> import email\n" -">>> msg = email.message_from_bytes(myBytes) " +">>> msg = email.message_from_bytes(myBytes)" msgstr "" ">>> import email\n" -">>> msg = email.message_from_bytes(myBytes) " +">>> msg = email.message_from_bytes(myBytes)" #: ../../library/email.parser.rst:291 msgid "Additional notes" @@ -347,37 +346,39 @@ msgstr "" msgid "" "Most non-\\ :mimetype:`multipart` type messages are parsed as a single " "message object with a string payload. These objects will return ``False`` " -"for :meth:`~email.message.EmailMessage.is_multipart`, and :meth:`~email." -"message.EmailMessage.iter_parts` will yield an empty list." +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield an empty list." msgstr "" #: ../../library/email.parser.rst:300 msgid "" "All :mimetype:`multipart` type messages will be parsed as a container " "message object with a list of sub-message objects for their payload. The " -"outer container message will return ``True`` for :meth:`~email.message." -"EmailMessage.is_multipart`, and :meth:`~email.message.EmailMessage." -"iter_parts` will yield a list of subparts." +"outer container message will return ``True`` " +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield a list of " +"subparts." msgstr "" #: ../../library/email.parser.rst:306 msgid "" -"Most messages with a content type of :mimetype:`message/\\*` (such as :" -"mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will also " -"be parsed as container object containing a list payload of length 1. Their :" -"meth:`~email.message.EmailMessage.is_multipart` method will return ``True``. " -"The single element yielded by :meth:`~email.message.EmailMessage.iter_parts` " -"will be a sub-message object." +"Most messages with a content type of :mimetype:`message/\\*` (such " +"as :mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will " +"also be parsed as container object containing a list payload of length 1. " +"Their :meth:`~email.message.EmailMessage.is_multipart` method will return " +"``True``. The single element yielded " +"by :meth:`~email.message.EmailMessage.iter_parts` will be a sub-message " +"object." msgstr "" #: ../../library/email.parser.rst:313 msgid "" "Some non-standards-compliant messages may not be internally consistent about " -"their :mimetype:`multipart`\\ -edness. Such messages may have a :mailheader:" -"`Content-Type` header of type :mimetype:`multipart`, but their :meth:`~email." -"message.EmailMessage.is_multipart` method may return ``False``. If such " -"messages were parsed with the :class:`~email.parser.FeedParser`, they will " -"have an instance of the :class:`~email.errors." -"MultipartInvariantViolationDefect` class in their *defects* attribute list. " -"See :mod:`email.errors` for details." +"their :mimetype:`multipart`\\ -edness. Such messages may have " +"a :mailheader:`Content-Type` header of type :mimetype:`multipart`, but " +"their :meth:`~email.message.EmailMessage.is_multipart` method may return " +"``False``. If such messages were parsed with " +"the :class:`~email.parser.FeedParser`, they will have an instance of " +"the :class:`~email.errors.MultipartInvariantViolationDefect` class in their " +"*defects* attribute list. See :mod:`email.errors` for details." msgstr "" diff --git a/library/email.policy.po b/library/email.policy.po index 20f6c5e82b..526811754f 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-01-06 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -355,7 +355,7 @@ msgstr "" #: ../../library/email.policy.rst:268 msgid "" "Handle a *defect* found on *obj*. When the email package calls this method, " -"*defect* will always be a subclass of :class:`~email.errors.Defect`." +"*defect* will always be a subclass of :class:`~email.errors.MessageDefect`." msgstr "" #: ../../library/email.policy.rst:272 @@ -368,7 +368,7 @@ msgstr "" #: ../../library/email.policy.rst:279 msgid "" "Register a *defect* on *obj*. In the email package, *defect* will always be " -"a subclass of :class:`~email.errors.Defect`." +"a subclass of :class:`~email.errors.MessageDefect`." msgstr "" #: ../../library/email.policy.rst:282 diff --git a/library/ensurepip.po b/library/ensurepip.po index ada8cd86dc..a3793b5fd2 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,7 +47,7 @@ msgid "" "needed if installing ``pip`` was skipped when installing Python (or when " "creating a virtual environment) or after explicitly uninstalling ``pip``." msgstr "" -"大多數情況下,Python 的終端使用者不需要直接調用此模組(因為 ``pip`` 預設應為" +"大多數情況下,Python 的終端使用者不需要直接叫用此模組(因為 ``pip`` 預設應為" "初始建置),但若安裝 Python 時 ``pip`` 被省略(或建立一虛擬環境時),又或是 " "``pip`` 被明確解除安裝時,則此模組的初始建置仍有可能用上。" @@ -91,176 +91,173 @@ msgstr "" msgid "Command line interface" msgstr "命令列介面" -#: ../../library/ensurepip.rst:46 +#: ../../library/ensurepip.rst:48 msgid "" "The command line interface is invoked using the interpreter's ``-m`` switch." -msgstr "使用直譯器 (interpreter) 的 ``-m`` 來調用命令列介面" +msgstr "使用直譯器 (interpreter) 的 ``-m`` 來叫用命令列介面" -#: ../../library/ensurepip.rst:48 +#: ../../library/ensurepip.rst:50 msgid "The simplest possible invocation is::" -msgstr "最簡單可行的調用: ::" +msgstr "最簡單可行的呼叫: ::" -#: ../../library/ensurepip.rst:50 +#: ../../library/ensurepip.rst:52 msgid "python -m ensurepip" msgstr "python -m ensurepip" -#: ../../library/ensurepip.rst:52 +#: ../../library/ensurepip.rst:54 msgid "" "This invocation will install ``pip`` if it is not already installed, but " "otherwise does nothing. To ensure the installed version of ``pip`` is at " "least as recent as the one available in ``ensurepip``, pass the ``--" "upgrade`` option::" msgstr "" -"若 ``pip`` 未安裝,此調用會將其安裝;否則甚麼也不做。可透過傳入 ``--" -"upgrade`` 參數來確保 ``pip`` 的安裝版本至少為當前 ``ensurepip`` 中最新可用的" +"若 ``pip`` 未安裝,此呼叫會將其安裝;否則甚麼也不做。可透過傳入 ``--" +"upgrade`` 參數來確保 ``pip`` 的安裝版本至少為目前 ``ensurepip`` 中最新可用的" "版本: ::" -#: ../../library/ensurepip.rst:57 +#: ../../library/ensurepip.rst:59 msgid "python -m ensurepip --upgrade" msgstr "python -m ensurepip --upgrade" -#: ../../library/ensurepip.rst:59 +#: ../../library/ensurepip.rst:61 msgid "" "By default, ``pip`` is installed into the current virtual environment (if " "one is active) or into the system site packages (if there is no active " "virtual environment). The installation location can be controlled through " "two additional command line options:" msgstr "" -"預設上,``pip`` 會被安裝至當前虛擬環境(若已啟動虛擬環境)或系統端的套件(若" +"預設上,``pip`` 會被安裝至目前虛擬環境(若已啟動虛擬環境)或系統端的套件(若" "沒有啟動的虛擬環境)。安裝位置可透過兩個額外的命令列選項來控制:" -#: ../../library/ensurepip.rst:64 +#: ../../library/ensurepip.rst:68 msgid "" -":samp:`--root {dir}`: Installs ``pip`` relative to the given root directory " -"rather than the root of the currently active virtual environment (if any) or " -"the default root for the current Python installation." +"Installs ``pip`` relative to the given root directory rather than the root " +"of the currently active virtual environment (if any) or the default root for " +"the current Python installation." msgstr "" -"``--root ``:安裝 ``pip`` 到給定的根目錄 (root directory) 的相對路徑,而" -"不是當前虛擬環境(若存在)的根目錄,或當前 Python 安裝版所預設的根目錄。" +"安裝 ``pip`` 到給定的根目錄 (root directory) 的相對路徑,而不是目前虛擬環境" +"(若存在)的根目錄,或目前 Python 安裝版所預設的根目錄。" -#: ../../library/ensurepip.rst:67 +#: ../../library/ensurepip.rst:74 msgid "" -"``--user``: Installs ``pip`` into the user site packages directory rather " -"than globally for the current Python installation (this option is not " -"permitted inside an active virtual environment)." +"Installs ``pip`` into the user site packages directory rather than globally " +"for the current Python installation (this option is not permitted inside an " +"active virtual environment)." msgstr "" -"``--user`` :安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到當前的 " -"Python 安裝版(此選項不允許在一啟動的虛擬環境中使用)。" +"安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到目前的 Python 安裝版(此選" +"項不允許在一啟動的虛擬環境中使用)。" -#: ../../library/ensurepip.rst:71 +#: ../../library/ensurepip.rst:78 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the version of Python used to invoke ``ensurepip``). The scripts " "installed can be controlled through two additional command line options:" msgstr "" -"預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表用來調用 ``ensurepip`` 的 " +"預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表用來叫用 ``ensurepip`` 的 " "Python 之版本)。安裝的腳本可透過兩個額外的命令列選項來控制:" -#: ../../library/ensurepip.rst:76 +#: ../../library/ensurepip.rst:85 msgid "" -"``--altinstall``: if an alternate installation is requested, the ``pipX`` " -"script will *not* be installed." -msgstr "" -"``--altinstall``:若要求一個替代安裝版,則\\ *不會*\\ 安裝 ``pipX`` 腳本。" +"If an alternate installation is requested, the ``pipX`` script will *not* be " +"installed." +msgstr "若要求一個替代安裝版,則\\ *不會*\\ 安裝 ``pipX`` 腳本。" -#: ../../library/ensurepip.rst:79 +#: ../../library/ensurepip.rst:90 msgid "" -"``--default-pip``: if a \"default pip\" installation is requested, the " -"``pip`` script will be installed in addition to the two regular scripts." -msgstr "" -"``--default-pip``: 若要求安裝「預設 pip」,則會安裝 ``pip`` 腳本,及 2 個常" -"規腳本。" +"If a \"default pip\" installation is requested, the ``pip`` script will be " +"installed in addition to the two regular scripts." +msgstr "若要求安裝「預設 pip」,則會安裝 ``pip`` 腳本,及 2 個常規腳本。" -#: ../../library/ensurepip.rst:82 +#: ../../library/ensurepip.rst:93 msgid "" "Providing both of the script selection options will trigger an exception." msgstr "提供兩種指令選項將會導致例外 (exception) 。" -#: ../../library/ensurepip.rst:86 +#: ../../library/ensurepip.rst:96 msgid "Module API" msgstr "模組 API" -#: ../../library/ensurepip.rst:88 +#: ../../library/ensurepip.rst:98 msgid ":mod:`ensurepip` exposes two functions for programmatic use:" msgstr ":mod:`ensurepip` 開放了兩個用於編寫程式的函式:" -#: ../../library/ensurepip.rst:92 +#: ../../library/ensurepip.rst:102 msgid "" "Returns a string specifying the available version of pip that will be " "installed when bootstrapping an environment." msgstr "回傳一個字串,用以標明初始建置時,安裝的 pip 的可行版本號。" -#: ../../library/ensurepip.rst:99 +#: ../../library/ensurepip.rst:109 msgid "Bootstraps ``pip`` into the current or designated environment." -msgstr "在當前或指定的環境之中建立 ``pip``。" +msgstr "在目前或指定的環境之中建立 ``pip``。" -#: ../../library/ensurepip.rst:101 +#: ../../library/ensurepip.rst:111 msgid "" "*root* specifies an alternative root directory to install relative to. If " "*root* is ``None``, then installation uses the default install location for " "the current environment." msgstr "" "*root* 指定一個替代的根目錄,作為安裝的相對路徑。若 *root* 為 ``None``,則安" -"裝使用當前環境的預設安裝位置。" +"裝使用目前環境的預設安裝位置。" -#: ../../library/ensurepip.rst:105 +#: ../../library/ensurepip.rst:115 msgid "" "*upgrade* indicates whether or not to upgrade an existing installation of an " "earlier version of ``pip`` to the available version." msgstr "*upgrade* 指出是否要將一個既有的較早版本的 ``pip`` 升級至可用的新版。" -#: ../../library/ensurepip.rst:108 +#: ../../library/ensurepip.rst:118 msgid "" "*user* indicates whether to use the user scheme rather than installing " "globally." msgstr "*user* 指出是否要使用使用者的安裝方案而不是全域安裝。" -#: ../../library/ensurepip.rst:111 +#: ../../library/ensurepip.rst:121 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the current version of Python)." -msgstr "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表 Python 的當前版本)。" +msgstr "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表 Python 的目前版本)。" -#: ../../library/ensurepip.rst:114 +#: ../../library/ensurepip.rst:124 msgid "If *altinstall* is set, then ``pipX`` will *not* be installed." msgstr "如果啟用了 *altinstall*,則不會安裝 ``pipX``。" -#: ../../library/ensurepip.rst:116 +#: ../../library/ensurepip.rst:126 msgid "" "If *default_pip* is set, then ``pip`` will be installed in addition to the " "two regular scripts." msgstr "如果啟用了 *default_pip*,則會安裝 ``pip``,以及 2 個常規腳本。" -#: ../../library/ensurepip.rst:119 +#: ../../library/ensurepip.rst:129 msgid "" "Setting both *altinstall* and *default_pip* will trigger :exc:`ValueError`." msgstr "同時啟用 *altinstall* 跟 *default_pip*,將會觸發 :exc:`ValueError`。" -#: ../../library/ensurepip.rst:122 +#: ../../library/ensurepip.rst:132 msgid "" "*verbosity* controls the level of output to :data:`sys.stdout` from the " "bootstrapping operation." msgstr "" "*verbosity* 用來控制初始建置操作內,對於 :data:`sys.stdout` 的輸出等級。" -#: ../../library/ensurepip.rst:125 +#: ../../library/ensurepip.rst:135 msgid "" "Raises an :ref:`auditing event ` ``ensurepip.bootstrap`` with " "argument ``root``." msgstr "" -"引發一個附帶引數 ``root`` 的\\ :ref:`稽核事件 ` ``ensurepip." -"bootstrap``。" +"引發一個附帶引數 ``root`` 的\\ :ref:`稽核事件 ` " +"``ensurepip.bootstrap``。" -#: ../../library/ensurepip.rst:129 +#: ../../library/ensurepip.rst:139 msgid "" -"The bootstrapping process has side effects on both ``sys.path`` and ``os." -"environ``. Invoking the command line interface in a subprocess instead " +"The bootstrapping process has side effects on both ``sys.path`` and " +"``os.environ``. Invoking the command line interface in a subprocess instead " "allows these side effects to be avoided." msgstr "" "初始建置的過程對於 ``sys.path`` 及 ``os.environ`` 均有副作用。改為在一子行程 " -"(subprocess) 調用命令列介面可避免這些副作用。" +"(subprocess) 呼叫命令列介面可避免這些副作用。" -#: ../../library/ensurepip.rst:135 +#: ../../library/ensurepip.rst:145 msgid "" "The bootstrapping process may install additional modules required by " "``pip``, but other software should not assume those dependencies will always " diff --git a/library/enum.po b/library/enum.po index 25abbe8562..285fdae837 100644 --- a/library/enum.po +++ b/library/enum.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 00:13+0000\n" -"PO-Revision-Date: 2023-09-11 14:08+0800\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -85,6 +85,16 @@ msgid "" ">>> # functional syntax\n" ">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" msgstr "" +">>> from enum import Enum\n" +"\n" +">>> # class 語法\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"\n" +">>> # 函式語法\n" +">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" #: ../../library/enum.rst:49 msgid "" @@ -199,7 +209,7 @@ msgid "" "the :class:`str() ` of the mixed-in type." msgstr "" "由 :class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag` 所使用來保留這些混" -"合類型的 :class:`str() `。" +"合型別的 :class:`str() `。" #: ../../library/enum.rst:101 msgid ":class:`EnumCheck`" @@ -228,10 +238,18 @@ msgstr "" "對如何處理非法值做更細微的控制。" #: ../../library/enum.rst:113 +msgid ":class:`EnumDict`" +msgstr ":class:`EnumDict`" + +#: ../../library/enum.rst:115 +msgid "A subclass of :class:`dict` for use when subclassing :class:`EnumType`." +msgstr ":class:`dict` 的子類別,用於當作 :class:`EnumType` 的子類別時使用。" + +#: ../../library/enum.rst:117 msgid ":class:`auto`" msgstr ":class:`auto`" -#: ../../library/enum.rst:115 +#: ../../library/enum.rst:119 msgid "" "Instances are replaced with an appropriate value for Enum members. :class:" "`StrEnum` defaults to the lower-cased version of the member name, while " @@ -240,11 +258,11 @@ msgstr "" "列舉成員的實例會被取代成合適的值。:class:`StrEnum` 預設是小寫版本的成員名稱," "其它列舉則預設是 1 且往後遞增。" -#: ../../library/enum.rst:119 +#: ../../library/enum.rst:123 msgid ":func:`~enum.property`" msgstr ":func:`~enum.property`" -#: ../../library/enum.rst:121 +#: ../../library/enum.rst:125 msgid "" "Allows :class:`Enum` members to have attributes without conflicting with " "member names. The ``value`` and ``name`` attributes are implemented this " @@ -253,46 +271,46 @@ msgstr "" "允許 :class:`Enum` 成員擁有屬性且不會與成員名稱有衝突。``value`` 及 ``name`` " "屬性是用這個方式來實作。" -#: ../../library/enum.rst:125 +#: ../../library/enum.rst:129 msgid ":func:`unique`" msgstr ":func:`unique`" -#: ../../library/enum.rst:127 +#: ../../library/enum.rst:131 msgid "" "Enum class decorator that ensures only one name is bound to any one value." msgstr "Enum 類別的裝飾器,用來確保任何值只有綁定到一個名稱上。" -#: ../../library/enum.rst:129 +#: ../../library/enum.rst:133 msgid ":func:`verify`" msgstr ":func:`verify`" -#: ../../library/enum.rst:131 +#: ../../library/enum.rst:135 msgid "" "Enum class decorator that checks user-selectable constraints on an " "enumeration." msgstr "Enum 類別的裝飾器,用來檢查列舉上使用者所選的限制。" -#: ../../library/enum.rst:134 +#: ../../library/enum.rst:138 msgid ":func:`member`" msgstr ":func:`member`" -#: ../../library/enum.rst:136 +#: ../../library/enum.rst:140 msgid "Make ``obj`` a member. Can be used as a decorator." msgstr "讓 ``obj`` 變成成員。可以當作裝飾器使用。" -#: ../../library/enum.rst:138 +#: ../../library/enum.rst:142 msgid ":func:`nonmember`" msgstr ":func:`nonmember`" -#: ../../library/enum.rst:140 +#: ../../library/enum.rst:144 msgid "Do not make ``obj`` a member. Can be used as a decorator." msgstr "不讓 ``obj`` 變成成員。可以當作裝飾器使用。" -#: ../../library/enum.rst:142 +#: ../../library/enum.rst:146 msgid ":func:`global_enum`" msgstr ":func:`global_enum`" -#: ../../library/enum.rst:144 +#: ../../library/enum.rst:148 msgid "" "Modify the :class:`str() ` and :func:`repr` of an enum to show its " "members as belonging to the module instead of its class, and export the enum " @@ -301,19 +319,19 @@ msgstr "" "修改列舉上的 :class:`str() ` 及 :func:`repr` ,讓成員顯示為屬於模組而不" "是類別,並將該列舉成員匯出到全域命名空間。" -#: ../../library/enum.rst:148 +#: ../../library/enum.rst:152 msgid ":func:`show_flag_values`" msgstr ":func:`show_flag_values`" -#: ../../library/enum.rst:150 +#: ../../library/enum.rst:154 msgid "Return a list of all power-of-two integers contained in a flag." msgstr "回傳旗標 (flag) 裡包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:153 +#: ../../library/enum.rst:157 msgid "``Flag``, ``IntFlag``, ``auto``" msgstr "``Flag``, ``IntFlag``, ``auto``" -#: ../../library/enum.rst:154 +#: ../../library/enum.rst:158 msgid "" "``StrEnum``, ``EnumCheck``, ``ReprEnum``, ``FlagBoundary``, ``property``, " "``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" @@ -322,35 +340,38 @@ msgstr "" "``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" #: ../../library/enum.rst:159 +msgid "``EnumDict``" +msgstr "``EnumDict``" + +#: ../../library/enum.rst:164 msgid "Data Types" msgstr "資料型別" -#: ../../library/enum.rst:164 +#: ../../library/enum.rst:169 msgid "" "*EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible " "to subclass *EnumType* -- see :ref:`Subclassing EnumType ` for details." msgstr "" -"*EnumType* 是\\ *列舉*\\ 的 :term:`metaclass`。*EnumType* 可以有子類別 -- 細" +"*EnumType* 是 *enum* 列舉的 :term:`metaclass`。*EnumType* 可以有子類別 -- 細" "節請參考 :ref:`建立 EnumType 的子類別 `。" -#: ../../library/enum.rst:168 -#, fuzzy +#: ../../library/enum.rst:173 msgid "" "``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" "`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " "final *enum*, as well as creating the enum members, properly handling " "duplicates, providing iteration over the enum class, etc." msgstr "" -"*EnumType* 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:`!" -"__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成員," -"並正確處理重複,提供列舉類別的疊代等等。" +"``EnumType`` 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:" +"`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成" +"員、正確處理重複、提供列舉類別的疊代等等。" -#: ../../library/enum.rst:175 +#: ../../library/enum.rst:180 msgid "This method is called in two different ways:" msgstr "這個方法可以用兩種不同的方式呼叫:" -#: ../../library/enum.rst:177 +#: ../../library/enum.rst:182 msgid "to look up an existing member:" msgstr "查詢已存在的成員:" @@ -358,7 +379,7 @@ msgstr "查詢已存在的成員:" msgid "cls" msgstr "cls" -#: ../../library/enum.rst:179 ../../library/enum.rst:185 +#: ../../library/enum.rst:184 ../../library/enum.rst:190 msgid "The enum class being called." msgstr "所呼叫的列舉類別。" @@ -366,17 +387,17 @@ msgstr "所呼叫的列舉類別。" msgid "value" msgstr "value" -#: ../../library/enum.rst:180 +#: ../../library/enum.rst:185 msgid "The value to lookup." msgstr "要查詢的值。" -#: ../../library/enum.rst:182 +#: ../../library/enum.rst:187 msgid "" "to use the ``cls`` enum to create a new enum (only if the existing enum does " "not have any members):" msgstr "使用 ``cls`` 列舉來建立新列舉(只有在現有列舉沒有任何成員時)" -#: ../../library/enum.rst:186 +#: ../../library/enum.rst:191 msgid "The name of the new Enum to create." msgstr "要建立的新列舉的名稱。" @@ -384,7 +405,7 @@ msgstr "要建立的新列舉的名稱。" msgid "names" msgstr "names" -#: ../../library/enum.rst:187 +#: ../../library/enum.rst:192 msgid "The names/values of the members for the new Enum." msgstr "新列舉的成員的名稱/值。" @@ -392,7 +413,7 @@ msgstr "新列舉的成員的名稱/值。" msgid "module" msgstr "module" -#: ../../library/enum.rst:188 +#: ../../library/enum.rst:193 msgid "The name of the module the new Enum is created in." msgstr "新列舉要建立在哪個模組名稱下。" @@ -400,7 +421,7 @@ msgstr "新列舉要建立在哪個模組名稱下。" msgid "qualname" msgstr "qualname" -#: ../../library/enum.rst:189 +#: ../../library/enum.rst:194 msgid "The actual location in the module where this Enum can be found." msgstr "這個列舉在模組裡實際上的位置。" @@ -408,15 +429,15 @@ msgstr "這個列舉在模組裡實際上的位置。" msgid "type" msgstr "type" -#: ../../library/enum.rst:190 +#: ../../library/enum.rst:195 msgid "A mix-in type for the new Enum." -msgstr "新列舉的混合類型。" +msgstr "新列舉的混合型別。" #: ../../library/enum.rst:0 msgid "start" msgstr "start" -#: ../../library/enum.rst:191 +#: ../../library/enum.rst:196 msgid "The first integer value for the Enum (used by :class:`auto`)." msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" @@ -424,16 +445,16 @@ msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" msgid "boundary" msgstr "boundary" -#: ../../library/enum.rst:192 +#: ../../library/enum.rst:197 msgid "" "How to handle out-of-range values from bit operations (:class:`Flag` only)." msgstr "在位元操作時怎麼處理範圍外的值(只有 :class:`Flag` 會用到)" -#: ../../library/enum.rst:196 +#: ../../library/enum.rst:201 msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "如果 member 屬於 ``cls`` 則回傳 ``True``: ::" -#: ../../library/enum.rst:198 +#: ../../library/enum.rst:203 msgid "" ">>> some_var = Color.RED\n" ">>> some_var in Color\n" @@ -447,7 +468,7 @@ msgstr "" ">>> Color.RED.value in Color\n" "True" -#: ../../library/enum.rst:206 +#: ../../library/enum.rst:211 msgid "" "Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used " "in a containment check." @@ -455,7 +476,7 @@ msgstr "" "在 Python 3.12 之前,如果用非列舉成員做屬於檢查 (containment check) 會引發 " "``TypeError``。" -#: ../../library/enum.rst:211 +#: ../../library/enum.rst:216 msgid "" "Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the " "names of the members in *cls*::" @@ -463,7 +484,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__members__', '__module__']`` 及 *cls* 的成" "員名稱: ::" -#: ../../library/enum.rst:214 +#: ../../library/enum.rst:219 msgid "" ">>> dir(Color)\n" "['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " @@ -475,13 +496,13 @@ msgstr "" "'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " "'__module__', '__name__', '__qualname__']" -#: ../../library/enum.rst:219 +#: ../../library/enum.rst:224 msgid "" "Returns the Enum member in *cls* matching *name*, or raises a :exc:" "`KeyError`::" msgstr "回傳 *cls* 中符合 *name* 的列舉成員,或引發 :exc:`KeyError`: ::" -#: ../../library/enum.rst:221 +#: ../../library/enum.rst:226 msgid "" ">>> Color['BLUE']\n" "" @@ -489,11 +510,11 @@ msgstr "" ">>> Color['BLUE']\n" "" -#: ../../library/enum.rst:226 +#: ../../library/enum.rst:231 msgid "Returns each member in *cls* in definition order::" msgstr "以定義的順序回傳在 *cls* 中的每個成員: ::" -#: ../../library/enum.rst:228 +#: ../../library/enum.rst:233 msgid "" ">>> list(Color)\n" "[, , ]" @@ -501,11 +522,11 @@ msgstr "" ">>> list(Color)\n" "[, , ]" -#: ../../library/enum.rst:233 +#: ../../library/enum.rst:238 msgid "Returns the number of member in *cls*::" msgstr "回傳 *cls* 的成員數量: ::" -#: ../../library/enum.rst:235 +#: ../../library/enum.rst:240 msgid "" ">>> len(Color)\n" "3" @@ -513,15 +534,15 @@ msgstr "" ">>> len(Color)\n" "3" -#: ../../library/enum.rst:240 +#: ../../library/enum.rst:245 msgid "Returns a mapping of every enum name to its member, including aliases" msgstr "回傳每個列舉名稱到其成員的對映,包括別名" -#: ../../library/enum.rst:244 +#: ../../library/enum.rst:249 msgid "Returns each member in *cls* in reverse definition order::" msgstr "以跟定義相反的順序回傳 *cls* 的每個成員: ::" -#: ../../library/enum.rst:246 +#: ../../library/enum.rst:251 msgid "" ">>> list(reversed(Color))\n" "[, , ]" @@ -529,35 +550,37 @@ msgstr "" ">>> list(reversed(Color))\n" "[, , ]" -#: ../../library/enum.rst:251 +#: ../../library/enum.rst:256 msgid "" "Adds a new name as an alias to an existing member. Raises a :exc:" "`NameError` if the name is already assigned to a different member." msgstr "" +"新增一個名稱作為現有成員的別名。如果該名稱已被指派給不同的成員,則會引發 :" +"exc:`NameError`。" -#: ../../library/enum.rst:256 +#: ../../library/enum.rst:261 msgid "" "Adds a new value as an alias to an existing member. Raises a :exc:" "`ValueError` if the value is already linked with a different member." msgstr "" +"新增一個值作為現有成員的別名。如果該值已與不同成員連結,則會引發 :exc:" +"`ValueError`。" -#: ../../library/enum.rst:261 -#, fuzzy +#: ../../library/enum.rst:266 msgid "" "Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " "as an alias." -msgstr "" -"在 3.11 之前,``enum`` 使用 ``EnumMeta`` 類型,目前保留此類型當作別名。" +msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" -#: ../../library/enum.rst:266 +#: ../../library/enum.rst:271 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "*Enum* 是所有 *enum* 列舉的基礎類別。" -#: ../../library/enum.rst:270 +#: ../../library/enum.rst:275 msgid "The name used to define the ``Enum`` member::" msgstr "用來定義 ``Enum`` 成員的名稱: ::" -#: ../../library/enum.rst:272 +#: ../../library/enum.rst:277 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" @@ -565,11 +588,11 @@ msgstr "" ">>> Color.BLUE.name\n" "'BLUE'" -#: ../../library/enum.rst:277 +#: ../../library/enum.rst:282 msgid "The value given to the ``Enum`` member::" msgstr "``Enum`` 成員給定的值: ::" -#: ../../library/enum.rst:279 +#: ../../library/enum.rst:284 msgid "" ">>> Color.RED.value\n" "1" @@ -577,15 +600,15 @@ msgstr "" ">>> Color.RED.value\n" "1" -#: ../../library/enum.rst:282 ../../library/enum.rst:302 +#: ../../library/enum.rst:287 ../../library/enum.rst:307 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "成員的值,可以在 :meth:`~Enum.__new__` 設定。" -#: ../../library/enum.rst:284 +#: ../../library/enum.rst:289 msgid "Enum member values" msgstr "列舉成員的值" -#: ../../library/enum.rst:286 +#: ../../library/enum.rst:291 msgid "" "Member values can be anything: :class:`int`, :class:`str`, etc. If the " "exact value is unimportant you may use :class:`auto` instances and an " @@ -595,31 +618,34 @@ msgstr "" "重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參考 :" "class:`auto`。" -#: ../../library/enum.rst:291 +#: ../../library/enum.rst:296 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " "quadratic performance impact during creation relative to the total number of " "mutable/unhashable values in the enum." msgstr "" +"雖然可以使用可變的 (mutable) / 不可雜湊的 (unhashable) 值,例如 :class:" +"`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它們在建立期" +"間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" -#: ../../library/enum.rst:298 +#: ../../library/enum.rst:303 msgid "Name of the member." msgstr "成員名稱。" -#: ../../library/enum.rst:306 +#: ../../library/enum.rst:311 msgid "" "No longer used, kept for backward compatibility. (class attribute, removed " "during class creation)." msgstr "已不再使用,只為了向後相容而保留(類別屬性,在類別建立時移除)" -#: ../../library/enum.rst:311 +#: ../../library/enum.rst:316 msgid "" "``_ignore_`` is only used during creation and is removed from the " "enumeration once creation is complete." msgstr "``_ignore_`` 只有在建立的時候用到,在列舉建立完成後會被移除。" -#: ../../library/enum.rst:314 +#: ../../library/enum.rst:319 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " "names will also be removed from the completed enumeration. See :ref:" @@ -628,7 +654,7 @@ msgstr "" "``_ignore_`` 是一個不會變成成員的名稱串列,在列舉建立完成後其名稱會被移除。範" "例請參考 :ref:`TimePeriod `。" -#: ../../library/enum.rst:320 +#: ../../library/enum.rst:325 msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" @@ -636,7 +662,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__module__', 'name', 'value']`` 及任何 " "*self.__class__* 上定義的公開方法: ::" -#: ../../library/enum.rst:323 +#: ../../library/enum.rst:328 msgid "" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" @@ -676,11 +702,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:341 +#: ../../library/enum.rst:346 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:342 +#: ../../library/enum.rst:347 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -688,7 +714,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:343 +#: ../../library/enum.rst:348 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -696,17 +722,17 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:344 +#: ../../library/enum.rst:349 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:346 +#: ../../library/enum.rst:351 msgid "" "A *staticmethod* that is used to determine the next value returned by :class:" "`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:349 +#: ../../library/enum.rst:354 msgid "" ">>> from enum import auto\n" ">>> class PowersOfThree(Enum):\n" @@ -730,7 +756,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:362 +#: ../../library/enum.rst:367 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -738,19 +764,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:369 +#: ../../library/enum.rst:374 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:373 +#: ../../library/enum.rst:378 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:378 +#: ../../library/enum.rst:383 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -758,7 +784,7 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:381 +#: ../../library/enum.rst:386 msgid "" ">>> from enum import StrEnum\n" ">>> class Build(StrEnum):\n" @@ -794,7 +820,7 @@ msgstr "" ">>> Build('deBUG')\n" "" -#: ../../library/enum.rst:400 +#: ../../library/enum.rst:405 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -803,12 +829,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:408 +#: ../../library/enum.rst:413 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." -msgstr "" +msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" -#: ../../library/enum.rst:412 +#: ../../library/enum.rst:417 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -816,7 +842,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:417 +#: ../../library/enum.rst:422 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -824,7 +850,7 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:420 +#: ../../library/enum.rst:425 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -850,7 +876,7 @@ msgstr "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:433 +#: ../../library/enum.rst:438 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -858,7 +884,7 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:436 +#: ../../library/enum.rst:441 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -882,7 +908,7 @@ msgstr "" "ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:448 +#: ../../library/enum.rst:453 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -890,7 +916,7 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:451 +#: ../../library/enum.rst:456 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -914,34 +940,33 @@ msgstr "" "ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:463 +#: ../../library/enum.rst:468 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:466 +#: ../../library/enum.rst:471 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:471 -#, fuzzy +#: ../../library/enum.rst:476 msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " "operation is performed with an *IntEnum* member, the resulting value loses " "its enumeration status." msgstr "" -"*IntEnum* 和 *Enum* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" -"方。如果 *IntEnum* 成員經過任何整數運算,其結果會失去列舉狀態。" +"*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" +"的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" -#: ../../library/enum.rst:492 +#: ../../library/enum.rst:497 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:495 +#: ../../library/enum.rst:500 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " @@ -951,18 +976,17 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:502 -#, fuzzy +#: ../../library/enum.rst:507 msgid "" "``StrEnum`` is the same as :class:`Enum`, but its members are also strings " "and can be used in most of the same places that a string can be used. The " "result of any string operation performed on or with a *StrEnum* member is " "not part of the enumeration." msgstr "" -"*StrEnum* 和 *Enum* 一樣,但其成員同時也是字串而可以被用在幾乎所有使用字串的" -"地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" +"``StrEnum`` 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使" +"用字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:508 +#: ../../library/enum.rst:513 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -973,13 +997,13 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(StrEnum.member)``。" -#: ../../library/enum.rst:515 +#: ../../library/enum.rst:520 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:520 +#: ../../library/enum.rst:525 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " @@ -989,7 +1013,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:528 +#: ../../library/enum.rst:533 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -999,11 +1023,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:534 +#: ../../library/enum.rst:539 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:536 +#: ../../library/enum.rst:541 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1039,11 +1063,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:555 +#: ../../library/enum.rst:560 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:557 +#: ../../library/enum.rst:562 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -1055,11 +1079,11 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../library/enum.rst:566 +#: ../../library/enum.rst:571 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:568 +#: ../../library/enum.rst:573 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1071,11 +1095,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:577 +#: ../../library/enum.rst:582 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:579 +#: ../../library/enum.rst:584 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1093,11 +1117,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:589 +#: ../../library/enum.rst:594 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:591 +#: ../../library/enum.rst:596 msgid "" ">>> Color.RED | Color.GREEN\n" "" @@ -1105,11 +1129,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "" -#: ../../library/enum.rst:596 +#: ../../library/enum.rst:601 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:598 +#: ../../library/enum.rst:603 msgid "" ">>> purple & white\n" "\n" @@ -1121,11 +1145,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "" -#: ../../library/enum.rst:605 +#: ../../library/enum.rst:610 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:607 +#: ../../library/enum.rst:612 msgid "" ">>> purple ^ white\n" "\n" @@ -1137,12 +1161,11 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "" -#: ../../library/enum.rst:614 -#, fuzzy +#: ../../library/enum.rst:619 msgid "Returns all the flags in *type(self)* that are not in *self*::" -msgstr "回傳所有在 *type(self)* 但不在 self 裡的旗標: ::" +msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" -#: ../../library/enum.rst:616 +#: ../../library/enum.rst:621 msgid "" ">>> ~white\n" "\n" @@ -1158,7 +1181,7 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../library/enum.rst:625 +#: ../../library/enum.rst:630 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1166,32 +1189,31 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:630 +#: ../../library/enum.rst:635 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:633 +#: ../../library/enum.rst:638 msgid "The *repr()* of zero-valued flags has changed. It is now::" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" -#: ../../library/enum.rst:641 -#, fuzzy +#: ../../library/enum.rst:646 msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." msgstr "" -"*IntFlag* 和 *Flag* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" -"方。" +"``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" +"數的地方。" -#: ../../library/enum.rst:655 +#: ../../library/enum.rst:660 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:658 +#: ../../library/enum.rst:663 msgid "" ">>> Color.RED + 2\n" "3" @@ -1199,35 +1221,32 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:661 -#, fuzzy +#: ../../library/enum.rst:666 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" -msgstr "如果 *IntFlag* 成員經過 *Flag* 操作且:" +msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" -#: ../../library/enum.rst:663 +#: ../../library/enum.rst:668 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:664 -#, fuzzy +#: ../../library/enum.rst:669 msgid "" "the result is not a valid *IntFlag*: the result depends on the :class:" "`FlagBoundary` setting" -msgstr "結果不是合法的 *IntFlag*:結果會根據 *FlagBoundary* 的設定" +msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" -#: ../../library/enum.rst:666 -#, fuzzy +#: ../../library/enum.rst:671 msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now:" -msgstr "未命名且值為 0 的旗標的 *repr()* 已改變。現在是: ::" +msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是:" -#: ../../library/enum.rst:673 +#: ../../library/enum.rst:678 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:678 +#: ../../library/enum.rst:683 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " @@ -1237,7 +1256,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:682 +#: ../../library/enum.rst:687 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1246,32 +1265,32 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:688 +#: ../../library/enum.rst:693 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" -"用混合資料類型的 :class:`str() `:" +"用混合資料型別的 :class:`str() `:" -#: ../../library/enum.rst:691 +#: ../../library/enum.rst:696 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:692 +#: ../../library/enum.rst:697 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:694 +#: ../../library/enum.rst:699 msgid "" "Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" "`format` of the mixed-in data type instead of using the :class:`Enum`-" "default :meth:`str() `." msgstr "" -"繼承 :class:`!ReprEnum` 來保留混合資料類型的 :class:`str() ` / :func:" +"繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() ` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" -#: ../../library/enum.rst:703 +#: ../../library/enum.rst:708 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1279,11 +1298,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:708 +#: ../../library/enum.rst:713 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:710 +#: ../../library/enum.rst:715 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1307,13 +1326,13 @@ msgstr "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" -#: ../../library/enum.rst:724 +#: ../../library/enum.rst:729 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:727 +#: ../../library/enum.rst:732 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1335,7 +1354,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:739 +#: ../../library/enum.rst:744 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1343,7 +1362,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:742 +#: ../../library/enum.rst:747 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1371,25 +1390,24 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:756 +#: ../../library/enum.rst:761 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:762 -#, fuzzy +#: ../../library/enum.rst:767 msgid "" "``FlagBoundary`` controls how out-of-range values are handled in :class:" "`Flag` and its subclasses." -msgstr "*FlagBoundary* 控制在 *Flag* 及其子類別中如何處理範圍外的值。" +msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:767 +#: ../../library/enum.rst:772 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:770 +#: ../../library/enum.rst:775 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1417,14 +1435,13 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:785 -#, fuzzy +#: ../../library/enum.rst:790 msgid "" "Out-of-range values have invalid values removed, leaving a valid :class:" "`Flag` value::" -msgstr "範圍外的值會移除非法值,留下合法的 *Flag* 值: ::" +msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" -#: ../../library/enum.rst:788 +#: ../../library/enum.rst:793 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1444,23 +1461,21 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:799 -#, fuzzy +#: ../../library/enum.rst:804 msgid "" "Out-of-range values lose their :class:`Flag` membership and revert to :class:" "`int`." -msgstr "範圍外的值會失去它們的 *Flag* 成員資格且恢復成 :class:`int`。" +msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:812 -#, fuzzy +#: ../../library/enum.rst:817 msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" msgstr "" -"範圍外的值會被保留,*Flag* 成員資格也會被保留。這是 :class:`IntFlag` 的預設行" -"為: ::" +"範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " +"的預設行為: ::" -#: ../../library/enum.rst:815 +#: ../../library/enum.rst:820 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1480,11 +1495,40 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:829 +#: ../../library/enum.rst:833 +msgid "" +"*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " +"defining enum classes (see :ref:`prepare`). It is exposed to allow " +"subclasses of :class:`EnumType` with advanced behavior like having multiple " +"values per member. It should be called with the name of the enum class being " +"created, otherwise private names and internal classes will not be handled " +"correctly." +msgstr "" +"*EnumDict* 是 :class:`dict` 的子類別,用來作為定義列舉類別的命名空間(參見 :" +"ref:`prepare`)。它被公開來使得 :class:`EnumType` 的子類別能具有進階行為,例" +"如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則私有名" +"稱和內部類別將無法被正確處理。" + +#: ../../library/enum.rst:840 +msgid "" +"Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" +"`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " +"possible to bypass the checks using other :class:`!dict` operations like :" +"meth:`|= `." +msgstr "" +"注意只有 :class:`~collections.abc.MutableMapping` 介面(:meth:`~object." +"__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其他 :class:`!" +"dict` 操作來繞過檢查,例如 :meth:`|= `。" + +#: ../../library/enum.rst:847 +msgid "A list of member names." +msgstr "一個成員名稱的串列。" + +#: ../../library/enum.rst:854 msgid "Supported ``__dunder__`` names" -msgstr "支援 ``__dunder__`` 名稱" +msgstr "支援的 ``__dunder__`` 名稱" -#: ../../library/enum.rst:831 +#: ../../library/enum.rst:856 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1492,49 +1536,48 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:834 -#, fuzzy +#: ../../library/enum.rst:859 msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " "appropriately. Once all the members are created it is no longer used." msgstr "" -"如果指定了 :meth:`~Enum.__new__`,它必須建立並回傳列舉成員;適當地設定成員" +":meth:`~Enum.__new__`,如果有指定,它必須建立並回傳列舉成員;適當地設定成員" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:840 +#: ../../library/enum.rst:865 msgid "Supported ``_sunder_`` names" -msgstr "支援 ``_sunder_`` 名稱" +msgstr "支援的 ``_sunder_`` 名稱" -#: ../../library/enum.rst:842 +#: ../../library/enum.rst:867 msgid "" ":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " "member." -msgstr "" +msgstr ":meth:`~EnumType._add_alias_` -- 新增一個名稱作為現有成員的別名。" -#: ../../library/enum.rst:844 +#: ../../library/enum.rst:869 msgid "" ":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " "existing member." -msgstr "" +msgstr ":meth:`~EnumType._add_value_alias_` -- 新增一個值作為現有成員的別名。" -#: ../../library/enum.rst:846 +#: ../../library/enum.rst:871 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:847 +#: ../../library/enum.rst:872 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:848 +#: ../../library/enum.rst:873 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:850 +#: ../../library/enum.rst:875 msgid "" ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" "class:`str`, that will not be transformed into members, and will be removed " @@ -1543,7 +1586,7 @@ msgstr "" ":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" "`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:853 +#: ../../library/enum.rst:878 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1551,59 +1594,59 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:855 +#: ../../library/enum.rst:880 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:860 -#, fuzzy +#: ../../library/enum.rst:885 msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" -"對標準的 :class:`Enum` 類別來說,下一個被選擇的值是最後一個看見的值加一。" +"對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" -#: ../../library/enum.rst:863 -#, fuzzy +#: ../../library/enum.rst:888 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" -"對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方,不管最後" -"一個看見的值是什麼。" +"對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" -#: ../../library/enum.rst:866 +#: ../../library/enum.rst:891 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" msgstr "" +"雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" +"用,但有些是明確允許的:" -#: ../../library/enum.rst:869 +#: ../../library/enum.rst:894 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" +"``_repr_*``\\ (例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 " +"`_" -#: ../../library/enum.rst:871 +#: ../../library/enum.rst:896 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:872 +#: ../../library/enum.rst:897 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:873 +#: ../../library/enum.rst:898 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" -msgstr "" +msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" -#: ../../library/enum.rst:879 +#: ../../library/enum.rst:904 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:883 -#, fuzzy +#: ../../library/enum.rst:908 msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " @@ -1613,22 +1656,22 @@ msgid "" "for :class:`StrEnum` it will be the lower-cased version of the member's " "name. Care must be taken if mixing *auto()* with manually specified values." msgstr "" -"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 *Enum* 的 :meth:" -"`~Enum._generate_next_value_` 來取得合適的值。對 *Enum* 和 *IntEnum* 來說,合" -"適的值是最後一個值加一;對 *Flag* 和 *IntFlag* 來說,是第一個比最大值還大的 " -"2 的次方的數字;對 *StrEnum* 來說,是成員名稱的小寫版本。如果混用 *auto()* 和" -"手動指定值的話要特別注意。" +"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 :class:`Enum` 的 :" +"meth:`~Enum._generate_next_value_` 來取得合適的值。對 :class:`Enum` 和 :" +"class:`IntEnum` 來說,合適的值是最後一個值加一;對 :class:`Flag` 和 :class:" +"`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" +"說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" -#: ../../library/enum.rst:891 +#: ../../library/enum.rst:916 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:893 +#: ../../library/enum.rst:918 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:894 +#: ../../library/enum.rst:919 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1636,7 +1679,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:896 +#: ../../library/enum.rst:921 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" @@ -1644,28 +1687,28 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:901 +#: ../../library/enum.rst:926 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:904 +#: ../../library/enum.rst:929 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:907 +#: ../../library/enum.rst:932 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " "incompatible type." msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" -"是不相容的類型就會失敗。" +"是不相容的型別就會失敗。" -#: ../../library/enum.rst:913 +#: ../../library/enum.rst:938 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1674,7 +1717,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:917 +#: ../../library/enum.rst:942 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1684,7 +1727,7 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:926 +#: ../../library/enum.rst:951 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " @@ -1694,7 +1737,7 @@ msgstr "" "__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" "`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:930 +#: ../../library/enum.rst:955 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1720,7 +1763,7 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../library/enum.rst:944 +#: ../../library/enum.rst:969 msgid "" "A :keyword:`class` decorator specifically for enumerations. Members from :" "class:`EnumCheck` are used to specify which constraints should be checked on " @@ -1729,15 +1772,15 @@ msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:952 +#: ../../library/enum.rst:977 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:958 +#: ../../library/enum.rst:983 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:964 +#: ../../library/enum.rst:989 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1748,45 +1791,45 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:974 +#: ../../library/enum.rst:998 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:981 +#: ../../library/enum.rst:1006 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:983 +#: ../../library/enum.rst:1008 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:985 +#: ../../library/enum.rst:1010 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" msgstr "" -"這三種列舉類型是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" +"這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:988 +#: ../../library/enum.rst:1013 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:990 +#: ../../library/enum.rst:1015 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:993 +#: ../../library/enum.rst:1018 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" msgstr "" -"如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 類型來建立自" +"如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:996 +#: ../../library/enum.rst:1021 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1796,11 +1839,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:1000 +#: ../../library/enum.rst:1025 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:1002 +#: ../../library/enum.rst:1027 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" diff --git a/library/errno.po b/library/errno.po index 0d41f0a9c6..8da2253e03 100644 --- a/library/errno.po +++ b/library/errno.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-01-29 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -581,24 +581,128 @@ msgstr "" msgid "Interface output queue is full" msgstr "" -#: ../../library/errno.rst:670 +#: ../../library/errno.rst:671 +msgid "No medium found" +msgstr "" + +#: ../../library/errno.rst:676 +msgid "Wrong medium type" +msgstr "" + +#: ../../library/errno.rst:681 +msgid "Required key not available" +msgstr "" + +#: ../../library/errno.rst:686 +msgid "Key has expired" +msgstr "" + +#: ../../library/errno.rst:691 +msgid "Key has been revoked" +msgstr "" + +#: ../../library/errno.rst:696 +msgid "Key was rejected by service" +msgstr "" + +#: ../../library/errno.rst:701 +msgid "Operation not possible due to RF-kill" +msgstr "" + +#: ../../library/errno.rst:706 +msgid "Locked lock was unmapped" +msgstr "" + +#: ../../library/errno.rst:711 +msgid "Facility is not active" +msgstr "" + +#: ../../library/errno.rst:716 +msgid "Authentication error" +msgstr "" + +#: ../../library/errno.rst:723 +msgid "Bad CPU type in executable" +msgstr "" + +#: ../../library/errno.rst:730 +msgid "Bad executable (or shared library)" +msgstr "" + +#: ../../library/errno.rst:737 +msgid "Malformed Mach-o file" +msgstr "" + +#: ../../library/errno.rst:744 +msgid "Device error" +msgstr "" + +#: ../../library/errno.rst:751 +msgid "Inappropriate file type or format" +msgstr "" + +#: ../../library/errno.rst:758 +msgid "Need authenticator" +msgstr "" + +#: ../../library/errno.rst:765 +msgid "Attribute not found" +msgstr "" + +#: ../../library/errno.rst:772 +msgid "Policy not found" +msgstr "" + +#: ../../library/errno.rst:779 +msgid "Too many processes" +msgstr "" + +#: ../../library/errno.rst:786 +msgid "Bad procedure for program" +msgstr "" + +#: ../../library/errno.rst:793 +msgid "Program version wrong" +msgstr "" + +#: ../../library/errno.rst:800 +msgid "RPC prog. not avail" +msgstr "" + +#: ../../library/errno.rst:807 +msgid "Device power is off" +msgstr "" + +#: ../../library/errno.rst:814 +msgid "RPC struct is bad" +msgstr "" + +#: ../../library/errno.rst:821 +msgid "RPC version wrong" +msgstr "" + +#: ../../library/errno.rst:828 +msgid "Shared library version mismatch" +msgstr "" + +#: ../../library/errno.rst:835 msgid "" "Capabilities insufficient. This error is mapped to the exception :exc:" "`PermissionError`." msgstr "" -#: ../../library/errno.rst:673 +#: ../../library/errno.rst:838 msgid "Availability" msgstr "" -#: ../../library/errno.rst:680 +#: ../../library/errno.rst:845 msgid "Operation canceled" msgstr "" -#: ../../library/errno.rst:687 +#: ../../library/errno.rst:852 msgid "Owner died" msgstr "" -#: ../../library/errno.rst:694 +#: ../../library/errno.rst:859 msgid "State not recoverable" msgstr "" diff --git a/library/exceptions.po b/library/exceptions.po index eb2e321fa6..e862cec0b2 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2024-09-17 09:18+0800\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" +"PO-Revision-Date: 2024-12-20 16:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -18,7 +17,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4.2\n" #: ../../library/exceptions.rst:4 msgid "Built-in Exceptions" @@ -26,12 +24,13 @@ msgstr "內建的例外" #: ../../library/exceptions.rst:10 msgid "" -"In Python, all exceptions must be instances of a class that derives from :" -"class:`BaseException`. In a :keyword:`try` statement with an :keyword:" -"`except` clause that mentions a particular class, that clause also handles " -"any exception classes derived from that class (but not exception classes " -"from which *it* is derived). Two exception classes that are not related via " -"subclassing are never equivalent, even if they have the same name." +"In Python, all exceptions must be instances of a class that derives " +"from :class:`BaseException`. In a :keyword:`try` statement with " +"an :keyword:`except` clause that mentions a particular class, that clause " +"also handles any exception classes derived from that class (but not " +"exception classes from which *it* is derived). Two exception classes that " +"are not related via subclassing are never equivalent, even if they have the " +"same name." msgstr "" "在 Python 中,所有例外必須是從 :class:`BaseException` 衍生的類別的實例。在陳" "述式 :keyword:`try` 搭配 :keyword:`except` 子句裡提到一個特定的類別時,那個子" @@ -68,10 +67,10 @@ msgstr "" #: ../../library/exceptions.rst:31 msgid "" "The built-in exception classes can be subclassed to define new exceptions; " -"programmers are encouraged to derive new exceptions from the :exc:" -"`Exception` class or one of its subclasses, and not from :exc:" -"`BaseException`. More information on defining exceptions is available in " -"the Python Tutorial under :ref:`tut-userexceptions`." +"programmers are encouraged to derive new exceptions from " +"the :exc:`Exception` class or one of its subclasses, and not " +"from :exc:`BaseException`. More information on defining exceptions is " +"available in the Python Tutorial under :ref:`tut-userexceptions`." msgstr "" "可以從內建的例外類別定義新的例外子類別;程式設計師被鼓勵從 :exc:`Exception` " "類別或其子類別衍生新的例外,而不是從 :exc:`BaseException` 來衍生。更多關於定" @@ -91,13 +90,13 @@ msgstr "三個例外物件上的屬性提供關於引發此例外的情境的資 msgid "" "When raising a new exception while another exception is already being " "handled, the new exception's :attr:`!__context__` attribute is automatically " -"set to the handled exception. An exception may be handled when an :keyword:" -"`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is " -"used." +"set to the handled exception. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"statement, is used." msgstr "" "當引發一個新的例外而同時有另一個例外已經正在被處理時,這個新例外的 :attr:`!" -"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` 或 :" -"keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" +"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` " +"或 :keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" #: ../../library/exceptions.rst:59 msgid "" @@ -123,11 +122,11 @@ msgid "" "introspection when debugging." msgstr "" "在 :keyword:`from` 後面的運算式必須是一個例外或 ``None``。它將會被設定" -"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設定 :" -"attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc from " -"None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉換 :exc:`KeyError` " -"為 :exc:`AttributeError`),同時保持舊的例外可以透過 :attr:`!__context__` 取" -"得以方便 debug 的時候檢查。" +"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設" +"定 :attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc " +"from None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉" +"換 :exc:`KeyError` 為 :exc:`AttributeError`),同時保持舊的例外可以透" +"過 :attr:`!__context__` 取得以方便 debug 的時候檢查。" #: ../../library/exceptions.rst:74 msgid "" @@ -163,23 +162,24 @@ msgid "" "possible conflicts between how the bases handle the ``args`` attribute, as " "well as due to possible memory layout incompatibilities." msgstr "" -"使用者的程式碼可以建立繼承自例外類型的子類別。建議一次只繼承一種例外類型以避" +"使用者的程式碼可以建立繼承自例外型別的子類別。建議一次只繼承一種例外型別以避" "免在基底類別之間如何處理 ``args`` 屬性的任何可能衝突,以及可能的記憶體佈局 " "(memory layout) 不相容。" #: ../../library/exceptions.rst:95 msgid "" -"Most built-in exceptions are implemented in C for efficiency, see: :source:" -"`Objects/exceptions.c`. Some have custom memory layouts which makes it " -"impossible to create a subclass that inherits from multiple exception types. " -"The memory layout of a type is an implementation detail and might change " -"between Python versions, leading to new conflicts in the future. Therefore, " -"it's recommended to avoid subclassing multiple exception types altogether." +"Most built-in exceptions are implemented in C for efficiency, " +"see: :source:`Objects/exceptions.c`. Some have custom memory layouts which " +"makes it impossible to create a subclass that inherits from multiple " +"exception types. The memory layout of a type is an implementation detail and " +"might change between Python versions, leading to new conflicts in the " +"future. Therefore, it's recommended to avoid subclassing multiple exception " +"types altogether." msgstr "" -"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/exceptions." -"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外類型的子類" -"別。類型的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" -"衝突。因此,總之建議避免繼承多種例外類型。" +"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/" +"exceptions.c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型" +"別的子類別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成" +"未來新的衝突。因此,總之建議避免繼承多種例外型別。" #: ../../library/exceptions.rst:105 msgid "Base classes" @@ -194,14 +194,14 @@ msgstr "以下的例外大部分被用在當作其他例外的基底類別。" #: ../../library/exceptions.rst:111 msgid "" "The base class for all built-in exceptions. It is not meant to be directly " -"inherited by user-defined classes (for that, use :exc:`Exception`). If :" -"func:`str` is called on an instance of this class, the representation of the " -"argument(s) to the instance are returned, or the empty string when there " +"inherited by user-defined classes (for that, use :exc:`Exception`). " +"If :func:`str` is called on an instance of this class, the representation of " +"the argument(s) to the instance are returned, or the empty string when there " "were no arguments." msgstr "" -"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使用 :exc:" -"`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引數的表" -"示,或者沒有引數的時候會回傳空字串。" +"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使" +"用 :exc:`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引" +"數的表示,或者沒有引數的時候會回傳空字串。" #: ../../library/exceptions.rst:119 msgid "" @@ -264,8 +264,9 @@ msgstr "" #: ../../library/exceptions.rst:157 msgid "" -"A list of the notes of this exception, which were added with :meth:" -"`add_note`. This attribute is created when :meth:`add_note` is called." +"A list of the notes of this exception, which were added " +"with :meth:`add_note`. This attribute is created when :meth:`add_note` is " +"called." msgstr "" "該例外的備註串列,使用 :meth:`add_note` 來新增。此屬性在 :meth:`add_note` 被" "呼叫的時候建立。" @@ -281,11 +282,12 @@ msgstr "" #: ../../library/exceptions.rst:171 msgid "" "The base class for those built-in exceptions that are raised for various " -"arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" -"`FloatingPointError`." +"arithmetic " +"errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`." msgstr "" -"各種運算錯誤所引發的那些內建例外::exc:`OverflowError`、:exc:" -"`ZeroDivisionError`、:exc:`FloatingPointError` 的基底類別。" +"各種運算錯誤所引發的那些內建例" +"外::exc:`OverflowError`、:exc:`ZeroDivisionError`、:exc:`FloatingPointError` " +"的基底類別。" #: ../../library/exceptions.rst:178 msgid "" @@ -301,8 +303,9 @@ msgid "" "on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. " "This can be raised directly by :func:`codecs.lookup`." msgstr "" -"當使用在對映或序列上的鍵或索引是無效的時候所引發的例外::exc:`IndexError`、:" -"exc:`KeyError` 的基底類別。這可以被 :func:`codecs.lookup` 直接引發。" +"當使用在對映或序列上的鍵或索引是無效的時候所引發的例" +"外::exc:`IndexError`、:exc:`KeyError` 的基底類別。這可以" +"被 :func:`codecs.lookup` 直接引發。" #: ../../library/exceptions.rst:190 msgid "Concrete exceptions" @@ -343,8 +346,9 @@ msgstr "新增 :attr:`name` 與 :attr:`obj` 屬性。" #: ../../library/exceptions.rst:217 msgid "" "Raised when the :func:`input` function hits an end-of-file condition (EOF) " -"without reading any data. (N.B.: the :meth:`io.IOBase.read` and :meth:`io." -"IOBase.readline` methods return an empty string when they hit EOF.)" +"without reading any data. (N.B.: the :meth:`io.IOBase.read` " +"and :meth:`io.IOBase.readline` methods return an empty string when they hit " +"EOF.)" msgstr "" "當 :func:`input` 函式在沒有讀到任何資料而到達檔案結尾 (end-of-file, EOF) 條件" "的時候被引發。(注意::meth:`io.IOBase.read` 和 :meth:`io.IOBase.readline` 方" @@ -356,14 +360,15 @@ msgstr "目前沒有被使用。" #: ../../library/exceptions.rst:229 msgid "" -"Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:" -"`generator.close` and :meth:`coroutine.close`. It directly inherits from :" -"exc:`BaseException` instead of :exc:`Exception` since it is technically not " -"an error." +"Raised when a :term:`generator` or :term:`coroutine` is closed; " +"see :meth:`generator.close` and :meth:`coroutine.close`. It directly " +"inherits from :exc:`BaseException` instead of :exc:`Exception` since it is " +"technically not an error." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參考 :meth:" -"`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承自 :exc:" -"`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯誤。" +"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參" +"考 :meth:`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承" +"自 :exc:`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯" +"誤。" #: ../../library/exceptions.rst:237 msgid "" @@ -395,8 +400,8 @@ msgstr "新增 :attr:`name` 與 :attr:`path` 屬性。" #: ../../library/exceptions.rst:257 msgid "" "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " -"module could not be located. It is also raised when ``None`` is found in :" -"data:`sys.modules`." +"module could not be located. It is also raised when ``None`` is found " +"in :data:`sys.modules`." msgstr "" ":exc:`ImportError` 的子類別,當模組不能被定位的時候會被 :keyword:`import` 所" "引發。當在 :data:`sys.modules` 裡找到 ``None`` 時也會被引發。" @@ -418,16 +423,16 @@ msgstr "當對映(字典)的鍵無法在已存在的鍵的集合中被找到 #: ../../library/exceptions.rst:282 msgid "" -"Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :" -"kbd:`Delete`). During execution, a check for interrupts is made regularly. " -"The exception inherits from :exc:`BaseException` so as to not be " +"Raised when the user hits the interrupt key (normally :kbd:`Control-C` " +"or :kbd:`Delete`). During execution, a check for interrupts is made " +"regularly. The exception inherits from :exc:`BaseException` so as to not be " "accidentally caught by code that catches :exc:`Exception` and thus prevent " "the interpreter from exiting." msgstr "" -"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` 或 :kbd:" -"`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼承自 :" -"exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕捉,而因" -"此讓直譯器無法結束。" +"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` " +"或 :kbd:`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼" +"承自 :exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕" +"捉,而因此讓直譯器無法結束。" #: ../../library/exceptions.rst:290 msgid "" @@ -438,19 +443,20 @@ msgid "" "avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" "捕捉 :exc:`KeyboardInterrupt` 需要特殊的考量。因為它可以在無法預期的時間點被" -"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好讓 :" -"exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參考 :ref:" -"`handlers-and-exceptions`。)" +"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好" +"讓 :exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參" +"考 :ref:`handlers-and-exceptions`。)" #: ../../library/exceptions.rst:300 msgid "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " "indicating what kind of (internal) operation ran out of memory. Note that " -"because of the underlying memory management architecture (C's :c:func:" -"`malloc` function), the interpreter may not always be able to completely " -"recover from this situation; it nevertheless raises an exception so that a " -"stack traceback can be printed, in case a run-away program was the cause." +"because of the underlying memory management architecture " +"(C's :c:func:`malloc` function), the interpreter may not always be able to " +"completely recover from this situation; it nevertheless raises an exception " +"so that a stack traceback can be printed, in case a run-away program was the " +"cause." msgstr "" "當一個操作用光了記憶體但情況還可能被修復 (rescued)(透過刪除一些物件)的時候" "被引發。關聯值是一個字串,表示什麼類型的(內部)操作用光了記憶體。需注意的是" @@ -502,14 +508,16 @@ msgstr "" #: ../../library/exceptions.rst:338 msgid "" -"``NotImplementedError`` and :data:`NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :data:`!" -"NotImplemented` for details on when to use it." +":exc:`!NotImplementedError` and :data:`!NotImplemented` are not " +"interchangeable. This exception should only be used as described above; " +"see :data:`NotImplemented` for details on correct usage of the built-in " +"constant." msgstr "" -"``NotImplementedError`` 和 :data:`NotImplemented` 雖然有相似的名稱和目的但並" -"不是可互換的。參考 :data:`!NotImplemented` 裡關於何時使用的細節。" +":exc:`!NotImplementedError` 和 :data:`!NotImplemented` 並不是可互換的。這個例" +"外只能用在上面描述的情況;參考 :data:`NotImplemented` 裡關於內建常數正確使用" +"方法的細節。" -#: ../../library/exceptions.rst:347 +#: ../../library/exceptions.rst:349 msgid "" "This exception is raised when a system function returns a system-related " "error, including I/O failures such as \"file not found\" or \"disk full\" " @@ -518,164 +526,167 @@ msgstr "" "當系統函式回傳系統相關錯誤,包含像\"找不到檔案\"或\"硬碟已滿\"的 I/O 失敗會引" "發此例外(而非不合法的引數或其他次要的錯誤)。" -#: ../../library/exceptions.rst:351 +#: ../../library/exceptions.rst:353 msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " -"For backwards compatibility, if three arguments are passed, the :attr:" -"`~BaseException.args` attribute contains only a 2-tuple of the first two " -"constructor arguments." +"For backwards compatibility, if three arguments are passed, " +"the :attr:`~BaseException.args` attribute contains only a 2-tuple of the " +"first two constructor arguments." msgstr "" -"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設為 :" -"const:`None`。為了向後相容,如果傳入三個引數,:attr:`~BaseException.args` 屬" -"性只會是包含建構函式前兩個引數的雙元素元組。" +"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設" +"為 :const:`None`。為了向後相容,如果傳入三個引" +"數,:attr:`~BaseException.args` 屬性只會是包含建構函式前兩個引數的雙元素元" +"組。" -#: ../../library/exceptions.rst:357 +#: ../../library/exceptions.rst:359 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " -"final :attr:`.errno` value. This behaviour only occurs when constructing :" -"exc:`OSError` directly or via an alias, and is not inherited when " -"subclassing." +"final :attr:`.errno` value. This behaviour only occurs when " +"constructing :exc:`OSError` directly or via an alias, and is not inherited " +"when subclassing." msgstr "" "如同下面的\\ `作業系統例外 `_\\ 所描述,實際上建構函式通常回" "傳 :exc:`OSError` 的子類別。會依據最後 :attr:`.errno` 的值決定特定子類別。這" "個行為只發生在直接建構 :exc:`OSError` 或透過別名,且產生子類別的時候不會被繼" "承。" -#: ../../library/exceptions.rst:365 +#: ../../library/exceptions.rst:367 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "從 C 變數 :c:data:`errno` 而來的數值錯誤代碼。" -#: ../../library/exceptions.rst:369 +#: ../../library/exceptions.rst:371 msgid "" -"Under Windows, this gives you the native Windows error code. The :attr:`." -"errno` attribute is then an approximate translation, in POSIX terms, of that " -"native error code." +"Under Windows, this gives you the native Windows error code. " +"The :attr:`.errno` attribute is then an approximate translation, in POSIX " +"terms, of that native error code." msgstr "" "在 Windows 下,這會提供你原生的 Windows 錯誤代碼。而 :attr:`.errno` 屬性是一" "個該原生錯誤代碼對於 POSIX 來說的近似翻譯。" -#: ../../library/exceptions.rst:373 +#: ../../library/exceptions.rst:375 msgid "" -"Under Windows, if the *winerror* constructor argument is an integer, the :" -"attr:`.errno` attribute is determined from the Windows error code, and the " -"*errno* argument is ignored. On other platforms, the *winerror* argument is " -"ignored, and the :attr:`winerror` attribute does not exist." +"Under Windows, if the *winerror* constructor argument is an integer, " +"the :attr:`.errno` attribute is determined from the Windows error code, and " +"the *errno* argument is ignored. On other platforms, the *winerror* " +"argument is ignored, and the :attr:`winerror` attribute does not exist." msgstr "" "在 Windows 下,如果建構函式引數 *winerror* 是整數,則 :attr:`.errno` 屬性會根" "據該 Windows 錯誤代碼來決定,且 *errno* 引數會被忽略。在其他平台上," "*winerror* 引數會被忽略,而 :attr:`winerror` 屬性會不存在。" -#: ../../library/exceptions.rst:381 +#: ../../library/exceptions.rst:383 msgid "" "The corresponding error message, as provided by the operating system. It is " -"formatted by the C functions :c:func:`perror` under POSIX, and :c:func:" -"`FormatMessage` under Windows." +"formatted by the C functions :c:func:`perror` under POSIX, " +"and :c:func:`FormatMessage` under Windows." msgstr "" "作業系統提供的對應錯誤訊息。在 POSIX 下會使用 C 函式 :c:func:`perror` 做格式" "化,而在 Windows 下會使用 :c:func:`FormatMessage`。" -#: ../../library/exceptions.rst:389 +#: ../../library/exceptions.rst:391 msgid "" -"For exceptions that involve a file system path (such as :func:`open` or :" -"func:`os.unlink`), :attr:`filename` is the file name passed to the function. " -"For functions that involve two file system paths (such as :func:`os." -"rename`), :attr:`filename2` corresponds to the second file name passed to " -"the function." +"For exceptions that involve a file system path (such as :func:`open` " +"or :func:`os.unlink`), :attr:`filename` is the file name passed to the " +"function. For functions that involve two file system paths (such " +"as :func:`os.rename`), :attr:`filename2` corresponds to the second file name " +"passed to the function." msgstr "" -"對於包含檔案系統路徑的例外(像是 :func:`open` 或 :func:`os.unlink`),:attr:" -"`filename` 是傳入函式的檔案名稱。對於包含兩個檔案系統路徑的函式(像是 :func:" -"`os.rename`),:attr:`filename2` 對應到傳入函式的第二個檔案名稱。" +"對於包含檔案系統路徑的例外(像是 :func:`open` " +"或 :func:`os.unlink`),:attr:`filename` 是傳入函式的檔案名稱。對於包含兩個檔" +"案系統路徑的函式(像是 :func:`os.rename`),:attr:`filename2` 對應到傳入函式" +"的第二個檔案名稱。" -#: ../../library/exceptions.rst:396 +#: ../../library/exceptions.rst:398 msgid "" -":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." -"error`, :exc:`select.error` and :exc:`mmap.error` have been merged into :exc:" -"`OSError`, and the constructor may return a subclass." +":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` " +"and :exc:`mmap.error` have been merged into :exc:`OSError`, and the " +"constructor may return a subclass." msgstr "" -":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket." -"error`、:exc:`select.error` 及 :exc:`mmap.error` 已合併進 :exc:`OSError`,而" -"建構函式可能會回傳子類別。" +":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket.error`、:exc:`select.error` " +"及 :exc:`mmap.error` 已合併進 :exc:`OSError`,而建構函式可能會回傳子類別。" -#: ../../library/exceptions.rst:402 +#: ../../library/exceptions.rst:404 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " -"function, instead of the name encoded to or decoded from the :term:" -"`filesystem encoding and error handler`. Also, the *filename2* constructor " -"argument and attribute was added." +"function, instead of the name encoded to or decoded from " +"the :term:`filesystem encoding and error handler`. Also, the *filename2* " +"constructor argument and attribute was added." msgstr "" ":attr:`filename` 屬性現在是傳入函式的原始檔名,而不是從\\ :term:`檔案系統編碼" "和錯誤處理函式 `\\ 編碼或解碼過的名" "稱。並且新增 *filename2* 建構函式引數與屬性。" -#: ../../library/exceptions.rst:411 +#: ../../library/exceptions.rst:413 msgid "" "Raised when the result of an arithmetic operation is too large to be " -"represented. This cannot occur for integers (which would rather raise :exc:" -"`MemoryError` than give up). However, for historical reasons, OverflowError " -"is sometimes raised for integers that are outside a required range. " -"Because of the lack of standardization of floating-point exception handling " -"in C, most floating-point operations are not checked." +"represented. This cannot occur for integers (which would rather " +"raise :exc:`MemoryError` than give up). However, for historical reasons, " +"OverflowError is sometimes raised for integers that are outside a required " +"range. Because of the lack of standardization of floating-point exception " +"handling in C, most floating-point operations are not checked." msgstr "" "當運算操作的結果太大而無法表示的時候會引發此例外。這不會發生在整數上(會改成" "引發 :exc:`MemoryError` 而不是放棄)。然而,因為一些歷史因素,OverflowError " "有時候會因為整數在要求範圍之外而引發。因為在 C 裡面缺乏浮點數例外處理的標準" "化,大部分的浮點數運算都沒有被檢查。" -#: ../../library/exceptions.rst:421 -#, fuzzy +#: ../../library/exceptions.rst:423 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when an " "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization `." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" -"func:`sys.getrecursionlimit`)時會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱" +"作 :term:`Python 最終化 (Python finalization) `)期間" +"被阻塞會引發此例外。" -#: ../../library/exceptions.rst:425 +#: ../../library/exceptions.rst:427 msgid "" -"Examples of operations which can be blocked with a :exc:" -"`PythonFinalizationError` during the Python finalization:" +"Examples of operations which can be blocked with " +"a :exc:`PythonFinalizationError` during the Python finalization:" msgstr "" +"在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範" +"例:" -#: ../../library/exceptions.rst:428 +#: ../../library/exceptions.rst:430 msgid "Creating a new Python thread." -msgstr "" +msgstr "建立新的 Python 執行緒。" -#: ../../library/exceptions.rst:429 +#: ../../library/exceptions.rst:431 msgid ":func:`os.fork`." msgstr ":func:`os.fork`。" -#: ../../library/exceptions.rst:431 +#: ../../library/exceptions.rst:433 msgid "See also the :func:`sys.is_finalizing` function." -msgstr "" +msgstr "也可以參閱 :func:`sys.is_finalizing` 函式。" -#: ../../library/exceptions.rst:433 ../../library/exceptions.rst:443 +#: ../../library/exceptions.rst:435 ../../library/exceptions.rst:445 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "在之前,會引發一般的 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:439 +#: ../../library/exceptions.rst:441 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth (see :func:`sys." -"getrecursionlimit`) is exceeded." +"interpreter detects that the maximum recursion depth " +"(see :func:`sys.getrecursionlimit`) is exceeded." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" -"func:`sys.getrecursionlimit`)時會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參" +"考 :func:`sys.getrecursionlimit`)時會引發此例外。" -#: ../../library/exceptions.rst:449 +#: ../../library/exceptions.rst:451 msgid "" -"This exception is raised when a weak reference proxy, created by the :func:" -"`weakref.proxy` function, is used to access an attribute of the referent " -"after it has been garbage collected. For more information on weak " +"This exception is raised when a weak reference proxy, created by " +"the :func:`weakref.proxy` function, is used to access an attribute of the " +"referent after it has been garbage collected. For more information on weak " "references, see the :mod:`weakref` module." msgstr "" "當一個被 :func:`weakref.proxy` 函式建立的弱參照代理 (weak reference proxy) 被" "用來存取已經被垃圾回收 (garbage collected) 的參照物屬性時會引發此例外。更多關" "於弱參照的資訊參考 :mod:`weakref` 模組。" -#: ../../library/exceptions.rst:457 +#: ../../library/exceptions.rst:459 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " @@ -684,50 +695,51 @@ msgstr "" "當偵測到一個不屬於任何其他種類的錯誤時會引發此例外。關聯值是一個表示確切什麼" "地方出錯的字串。" -#: ../../library/exceptions.rst:464 +#: ../../library/exceptions.rst:466 msgid "" -"Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" -"`~iterator.__next__` method to signal that there are no further items " -"produced by the iterator." +"Raised by built-in function :func:`next` and " +"an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that " +"there are no further items produced by the iterator." msgstr "" "會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` " "方法引發,用來表示疊代器沒有更多項目可以產生。" -#: ../../library/exceptions.rst:470 +#: ../../library/exceptions.rst:472 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " -"as an argument when constructing the exception, and defaults to :const:" -"`None`." +"as an argument when constructing the exception, and defaults " +"to :const:`None`." msgstr "" -"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設為 :" -"const:`None`。" +"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設" +"為 :const:`None`。" -#: ../../library/exceptions.rst:474 +#: ../../library/exceptions.rst:476 msgid "" -"When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" -"`StopIteration` instance is raised, and the value returned by the function " -"is used as the :attr:`value` parameter to the constructor of the exception." +"When a :term:`generator` or :term:`coroutine` function returns, a " +"new :exc:`StopIteration` instance is raised, and the value returned by the " +"function is used as the :attr:`value` parameter to the constructor of the " +"exception." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新的 :exc:" -"`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構函式的 :" -"attr:`value` 參數。" +"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新" +"的 :exc:`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構" +"函式的 :attr:`value` 參數。" -#: ../../library/exceptions.rst:479 +#: ../../library/exceptions.rst:481 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " "as the new exception's cause)." msgstr "" -"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換成 :exc:" -"`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" +"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換" +"成 :exc:`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" -#: ../../library/exceptions.rst:483 +#: ../../library/exceptions.rst:485 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "新增 ``value`` 屬性且產生器函式可以用它來回傳值。" -#: ../../library/exceptions.rst:487 +#: ../../library/exceptions.rst:489 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." @@ -735,7 +747,7 @@ msgstr "" "透過 ``from __future__ import generator_stop`` 引入 RuntimeError 的轉換,參" "考 :pep:`479`。" -#: ../../library/exceptions.rst:491 +#: ../../library/exceptions.rst:493 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." @@ -743,7 +755,7 @@ msgstr "" "預設對所有程式啟用 :pep:`479`:在產生器引發的 :exc:`StopIteration` 錯誤會轉換" "成 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:497 +#: ../../library/exceptions.rst:499 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." @@ -751,18 +763,18 @@ msgstr "" "此例外必須被 :term:`asynchronous iterator` 物件的 :meth:`~object.__anext__` " "方法引發來停止疊代。" -#: ../../library/exceptions.rst:504 +#: ../../library/exceptions.rst:506 msgid "" -"Raised when the parser encounters a syntax error. This may occur in an :" -"keyword:`import` statement, in a call to the built-in functions :func:" -"`compile`, :func:`exec`, or :func:`eval`, or when reading the initial script " -"or standard input (also interactively)." +"Raised when the parser encounters a syntax error. This may occur in " +"an :keyword:`import` statement, in a call to the built-in " +"functions :func:`compile`, :func:`exec`, or :func:`eval`, or when reading " +"the initial script or standard input (also interactively)." msgstr "" "當剖析器遇到語法錯誤時會引發此例外。這可能發生在 :keyword:`import` 陳述式、在" "呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取" "初始腳本或標準輸入(也包含互動式)的時候。" -#: ../../library/exceptions.rst:510 +#: ../../library/exceptions.rst:512 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." @@ -770,18 +782,18 @@ msgstr "" "例外實例的 :func:`str` 只回傳錯誤訊息。Details 是個元組,其成員也能夠以分開的" "屬性取得。" -#: ../../library/exceptions.rst:515 +#: ../../library/exceptions.rst:517 msgid "The name of the file the syntax error occurred in." msgstr "發生語法錯誤所在的檔案名稱。" -#: ../../library/exceptions.rst:519 +#: ../../library/exceptions.rst:521 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" "發生錯誤所在檔案的列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 1。" -#: ../../library/exceptions.rst:524 +#: ../../library/exceptions.rst:526 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." @@ -789,11 +801,11 @@ msgstr "" "發生錯誤所在該列的欄號 (column)。這是以 1 開始的索引:該列第一個字元的 " "``offset`` 是 1。" -#: ../../library/exceptions.rst:529 +#: ../../library/exceptions.rst:531 msgid "The source code text involved in the error." msgstr "涉及該錯誤的原始程式碼文字。" -#: ../../library/exceptions.rst:533 +#: ../../library/exceptions.rst:535 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." @@ -801,7 +813,7 @@ msgstr "" "發生錯誤所在檔案的結束列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 " "1。" -#: ../../library/exceptions.rst:538 +#: ../../library/exceptions.rst:540 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." @@ -809,7 +821,7 @@ msgstr "" "發生錯誤所在該結束列的欄號。這是以 1 開始的索引:該列第一個字元的 ``offset`` " "是 1。" -#: ../../library/exceptions.rst:541 +#: ../../library/exceptions.rst:543 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -820,68 +832,75 @@ msgstr "" "(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" -#: ../../library/exceptions.rst:546 +#: ../../library/exceptions.rst:548 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:551 +#: ../../library/exceptions.rst:553 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" "與不正確的縮排有關的語法錯誤的基礎類別。這是 :exc:`SyntaxError` 的子類別。" -#: ../../library/exceptions.rst:557 +#: ../../library/exceptions.rst:559 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這是 :exc:" -"`IndentationError` 的子類別。" +"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這" +"是 :exc:`IndentationError` 的子類別。" -#: ../../library/exceptions.rst:563 +#: ../../library/exceptions.rst:565 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " -"a string indicating what went wrong (in low-level terms)." +"a string indicating what went wrong (in low-level terms). " +"In :term:`CPython`, this could be raised by incorrectly using Python's C " +"API, such as returning a ``NULL`` value without an exception set." msgstr "" "當直譯器找到一個內部錯誤,但該情況看起來沒有嚴重到要讓它放棄所有的希望時會引" "發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。" +"在 :term:`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 " +"``NULL`` 值而沒有設定例外。" -#: ../../library/exceptions.rst:567 +#: ../../library/exceptions.rst:571 msgid "" -"You should report this to the author or maintainer of your Python " -"interpreter. Be sure to report the version of the Python interpreter (``sys." -"version``; it is also printed at the start of an interactive Python " -"session), the exact error message (the exception's associated value) and if " -"possible the source of the program that triggered the error." +"If you're confident that this exception wasn't your fault, or the fault of a " +"package you're using, you should report this to the author or maintainer of " +"your Python interpreter. Be sure to report the version of the Python " +"interpreter (``sys.version``; it is also printed at the start of an " +"interactive Python session), the exact error message (the exception's " +"associated value) and if possible the source of the program that triggered " +"the error." msgstr "" -"你應該向你的 Python 直譯器作者或維護者回報此錯誤。務必要回報該 Python 直譯器" -"的版本(``sys.version``;這也會在互動式 Python 會話的開頭被印出)、確切的錯誤" -"訊息(該例外的關聯值)及如果可能的話,觸發此錯誤的程式來源。" +"如果你確定這個例外不是你的或者所用套件的錯,你應該向你的 Python 直譯器作者或" +"維護者回報此錯誤。務必要回報該 Python 直譯器的版本(``sys.version``;這也會在" +"互動式 Python 會話的開頭被印出)、確切的錯誤訊息(該例外的關聯值)及如果可能" +"的話,觸發此錯誤的程式來源。" -#: ../../library/exceptions.rst:576 +#: ../../library/exceptions.rst:582 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " "accidentally caught by code that catches :exc:`Exception`. This allows the " "exception to properly propagate up and cause the interpreter to exit. When " "it is not handled, the Python interpreter exits; no stack traceback is " -"printed. The constructor accepts the same optional argument passed to :func:" -"`sys.exit`. If the value is an integer, it specifies the system exit status " -"(passed to C's :c:func:`exit` function); if it is ``None``, the exit status " -"is zero; if it has another type (such as a string), the object's value is " -"printed and the exit status is one." -msgstr "" -"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不是 :" -"exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許例外" -"可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;不會" -"印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該值是" -"整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " -"``None``,結束狀態會是 0;如果它是其他類型(例如字串),則物件的值會被印出而" +"printed. The constructor accepts the same optional argument passed " +"to :func:`sys.exit`. If the value is an integer, it specifies the system " +"exit status (passed to C's :c:func:`exit` function); if it is ``None``, the " +"exit status is zero; if it has another type (such as a string), the object's " +"value is printed and the exit status is one." +msgstr "" +"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不" +"是 :exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許" +"例外可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;" +"不會印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該" +"值是整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " +"``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而" "結束狀態是 1。" -#: ../../library/exceptions.rst:587 +#: ../../library/exceptions.rst:593 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -892,25 +911,25 @@ msgid "" msgstr "" "對 :func:`sys.exit` 的呼叫會轉譯成例外讓負責清理的處理函式(:keyword:`try` 陳" "述式的 :keyword:`finally` 子句)可以被執行,且讓除錯器可以在不冒著失去控制的" -"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫完 :func:`os." -"fork` 之後 )可以使用 :func:`os._exit` 函式。" +"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫" +"完 :func:`os.fork` 之後 )可以使用 :func:`os._exit` 函式。" -#: ../../library/exceptions.rst:596 +#: ../../library/exceptions.rst:602 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )" -#: ../../library/exceptions.rst:602 +#: ../../library/exceptions.rst:608 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -"當一個操作或函式被用在不適合的類型的物件時會引發此例外。關聯值是一個字串,提" -"供關於不相符類型的細節。" +"當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提" +"供關於不相符型別的細節。" -#: ../../library/exceptions.rst:605 +#: ../../library/exceptions.rst:611 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -921,27 +940,27 @@ msgstr "" "這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外" "是 :exc:`NotImplementedError`。" -#: ../../library/exceptions.rst:610 +#: ../../library/exceptions.rst:616 msgid "" -"Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" -"class:`int` is expected) should result in a :exc:`TypeError`, but passing " -"arguments with the wrong value (e.g. a number outside expected boundaries) " -"should result in a :exc:`ValueError`." +"Passing arguments of the wrong type (e.g. passing a :class:`list` when " +"an :class:`int` is expected) should result in a :exc:`TypeError`, but " +"passing arguments with the wrong value (e.g. a number outside expected " +"boundaries) should result in a :exc:`ValueError`." msgstr "" -"傳入錯誤類型的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" +"傳入錯誤型別的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" -#: ../../library/exceptions.rst:617 +#: ../../library/exceptions.rst:623 msgid "" "Raised when a reference is made to a local variable in a function or method, " -"but no value has been bound to that variable. This is a subclass of :exc:" -"`NameError`." +"but no value has been bound to that variable. This is a subclass " +"of :exc:`NameError`." msgstr "" "當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例" "外。這是 :exc:`NameError` 的子類別。" -#: ../../library/exceptions.rst:624 +#: ../../library/exceptions.rst:630 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." @@ -949,36 +968,36 @@ msgstr "" "當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的" "子類別。" -#: ../../library/exceptions.rst:627 +#: ../../library/exceptions.rst:633 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " "invalid input that the codec failed on." msgstr "" -":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 ``err.object[err.start:" -"err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" +":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 " +"``err.object[err.start:err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" -#: ../../library/exceptions.rst:633 +#: ../../library/exceptions.rst:639 msgid "The name of the encoding that raised the error." msgstr "引發錯誤的編碼名稱。" -#: ../../library/exceptions.rst:637 +#: ../../library/exceptions.rst:643 msgid "A string describing the specific codec error." msgstr "描述特定編解碼器錯誤的字串。" -#: ../../library/exceptions.rst:641 +#: ../../library/exceptions.rst:647 msgid "The object the codec was attempting to encode or decode." msgstr "編解碼器嘗試編碼或解碼的物件。" -#: ../../library/exceptions.rst:645 +#: ../../library/exceptions.rst:651 msgid "The first index of invalid data in :attr:`object`." msgstr "在 :attr:`object` 中無效資料的開始索引。" -#: ../../library/exceptions.rst:649 +#: ../../library/exceptions.rst:655 msgid "The index after the last invalid data in :attr:`object`." msgstr "在 :attr:`object` 中最後的無效資料後的索引。" -#: ../../library/exceptions.rst:654 +#: ../../library/exceptions.rst:660 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." @@ -986,7 +1005,7 @@ msgstr "" "在編碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:660 +#: ../../library/exceptions.rst:666 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." @@ -994,7 +1013,7 @@ msgstr "" "在解碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:666 +#: ../../library/exceptions.rst:672 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." @@ -1002,16 +1021,16 @@ msgstr "" "在轉譯當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:672 +#: ../../library/exceptions.rst:678 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -"當一個操作或函式收到引數是正確類型但是不適合的值,且該情況無法被更精確的例外" +"當一個操作或函式收到引數是正確型別但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" -#: ../../library/exceptions.rst:679 +#: ../../library/exceptions.rst:685 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " @@ -1020,47 +1039,47 @@ msgstr "" "當除法或模數運算 (modulo operation) 的第二個引數是 0 的時候會引發此例外。關聯" "值是一個字串,表示運算元及運算的類型。" -#: ../../library/exceptions.rst:684 +#: ../../library/exceptions.rst:690 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" -"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們是 :exc:" -"`OSError` 的別名。" +"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們" +"是 :exc:`OSError` 的別名。" -#: ../../library/exceptions.rst:693 +#: ../../library/exceptions.rst:699 msgid "Only available on Windows." msgstr "僅限於在 Windows 中使用。" -#: ../../library/exceptions.rst:697 +#: ../../library/exceptions.rst:703 msgid "OS exceptions" msgstr "作業系統例外" -#: ../../library/exceptions.rst:699 +#: ../../library/exceptions.rst:705 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "以下的例外是 :exc:`OSError` 的子類別,它們根據系統錯誤代碼來引發。" -#: ../../library/exceptions.rst:704 +#: ../../library/exceptions.rst:710 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" -"blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." -"EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` and :py:" -"const:`~errno.EINPROGRESS`." +"blocking operation. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` " +"and :py:const:`~errno.EINPROGRESS`." msgstr "" "當設置為非阻塞操作的物件(例如 socket)上的操作將要阻塞時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:" -"py:const:`~errno.EWOULDBLOCK` 及 :py:const:`~errno.EINPROGRESS`。" +"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:py:const:`~errno.EWOULDBLOCK` " +"及 :py:const:`~errno.EINPROGRESS`。" -#: ../../library/exceptions.rst:709 +#: ../../library/exceptions.rst:715 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" "除了 :exc:`OSError` 的那些屬性之外,:exc:`BlockingIOError` 有多一個屬性:" -#: ../../library/exceptions.rst:714 +#: ../../library/exceptions.rst:720 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " @@ -1069,56 +1088,58 @@ msgstr "" "一個整數,內容為在其阻塞之前,已寫進串流的字元數。當使用 :mod:`io` 模組裡的緩" "衝 I/O 類別時這個屬性是可用的。" -#: ../../library/exceptions.rst:720 +#: ../../library/exceptions.rst:726 msgid "" -"Raised when an operation on a child process failed. Corresponds to :c:data:" -"`errno` :py:const:`~errno.ECHILD`." +"Raised when an operation on a child process failed. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECHILD`." msgstr "" -"當子行程上的操作失敗時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." -"ECHILD`。" +"當子行程上的操作失敗時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ECHILD`。" -#: ../../library/exceptions.rst:725 +#: ../../library/exceptions.rst:731 msgid "A base class for connection-related issues." msgstr "連線相關問題的基礎類別。" -#: ../../library/exceptions.rst:727 +#: ../../library/exceptions.rst:733 msgid "" -"Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" -"`ConnectionRefusedError` and :exc:`ConnectionResetError`." +"Subclasses " +"are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` " +"and :exc:`ConnectionResetError`." msgstr "" -"子類別有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:" -"`ConnectionRefusedError` 及 :exc:`ConnectionResetError`。" +"子類別" +"有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:`ConnectionRefusedError` " +"及 :exc:`ConnectionResetError`。" -#: ../../library/exceptions.rst:732 +#: ../../library/exceptions.rst:738 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " -"has been shutdown for writing. Corresponds to :c:data:`errno` :py:const:" -"`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." +"has been shutdown for writing. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." msgstr "" ":exc:`ConnectionError` 的子類別,當嘗試寫入管道 (pipe) 同時另一端已經被關閉時" -"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應到 :c:data:" -"`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" +"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應" +"到 :c:data:`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" -#: ../../library/exceptions.rst:739 +#: ../../library/exceptions.rst:745 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNABORTED`." +"aborted by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNABORTED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點 (peer) 中斷時會引" "發此例外。對應到 :c:data:`errno` :py:const:`~errno.ECONNABORTED`。" -#: ../../library/exceptions.rst:745 +#: ../../library/exceptions.rst:751 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNREFUSED`." +"refused by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNREFUSED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點拒絕時會引發此例" "外。對應到 :c:data:`errno` :py:const:`~errno.ECONNREFUSED`。" -#: ../../library/exceptions.rst:751 +#: ../../library/exceptions.rst:757 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." @@ -1126,146 +1147,146 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線被對等端點重置時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECONNRESET`。" -#: ../../library/exceptions.rst:757 +#: ../../library/exceptions.rst:763 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." msgstr "" -"當嘗試建立已存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.EEXIST`。" +"當嘗試建立已存在的檔案或目錄時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EEXIST`。" -#: ../../library/exceptions.rst:762 +#: ../../library/exceptions.rst:768 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." msgstr "" -"當請求不存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.ENOENT`。" +"當請求不存在的檔案或目錄時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ENOENT`。" -#: ../../library/exceptions.rst:767 +#: ../../library/exceptions.rst:773 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." msgstr "" -"當系統呼叫被傳入的信號中斷時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.EINTR`。" +"當系統呼叫被傳入的信號中斷時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EINTR`。" -#: ../../library/exceptions.rst:770 +#: ../../library/exceptions.rst:776 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " "rationale), instead of raising :exc:`InterruptedError`." msgstr "" -"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引發 :exc:" -"`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" +"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引" +"發 :exc:`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" -#: ../../library/exceptions.rst:777 +#: ../../library/exceptions.rst:783 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." msgstr "" -"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應到 :c:" -"data:`errno` :py:const:`~errno.EISDIR`。" +"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EISDIR`。" -#: ../../library/exceptions.rst:783 +#: ../../library/exceptions.rst:789 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " "be raised if an operation attempts to open or traverse a non-directory file " -"as if it were a directory. Corresponds to :c:data:`errno` :py:const:`~errno." -"ENOTDIR`." +"as if it were a directory. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ENOTDIR`." msgstr "" "當在某個不是目錄的東西上請求目錄操作(例如 :func:`os.listdir`)時會引發此例" "外。在大多數的 POSIX 平台上,如果嘗試操作開啟或遍歷一個當作目錄的非目錄檔案也" "會引發此例外。對應到 :c:data:`errno` :py:const:`~errno.ENOTDIR`。" -#: ../../library/exceptions.rst:791 +#: ../../library/exceptions.rst:797 msgid "" "Raised when trying to run an operation without the adequate access rights - " -"for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" -"`~errno.EACCES`, :py:const:`~errno.EPERM`, and :py:const:`~errno." -"ENOTCAPABLE`." +"for example filesystem permissions. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EACCES`, :py:const:`~errno.EPERM`, " +"and :py:const:`~errno.ENOTCAPABLE`." msgstr "" "當嘗試執行一個沒有合乎存取權限的操作時會引發此例外 — 例如檔案系統權限。對應" -"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` 及 :" -"py:const:`~errno.ENOTCAPABLE`。" +"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` " +"及 :py:const:`~errno.ENOTCAPABLE`。" -#: ../../library/exceptions.rst:796 +#: ../../library/exceptions.rst:802 msgid "" -"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" -"`PermissionError`." +"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped " +"to :exc:`PermissionError`." msgstr "" "WASI 的 :py:const:`~errno.ENOTCAPABLE` 現在對應到 :exc:`PermissionError`。" -#: ../../library/exceptions.rst:802 +#: ../../library/exceptions.rst:808 msgid "" -"Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" -"py:const:`~errno.ESRCH`." +"Raised when a given process doesn't exist. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ESRCH`." msgstr "" -"當給定的行程不存在時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." -"ESRCH`。" +"當給定的行程不存在時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ESRCH`。" -#: ../../library/exceptions.rst:807 +#: ../../library/exceptions.rst:813 msgid "" -"Raised when a system function timed out at the system level. Corresponds to :" -"c:data:`errno` :py:const:`~errno.ETIMEDOUT`." +"Raised when a system function timed out at the system level. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." msgstr "" -"當系統函式在系統層級超時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.ETIMEDOUT`。" +"當系統函式在系統層級超時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ETIMEDOUT`。" -#: ../../library/exceptions.rst:810 +#: ../../library/exceptions.rst:816 msgid "All the above :exc:`OSError` subclasses were added." msgstr "加入以上所有的 :exc:`OSError` 子類別。" -#: ../../library/exceptions.rst:816 +#: ../../library/exceptions.rst:822 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr ":pep:`3151` — 改寫作業系統與 IO 例外階層" -#: ../../library/exceptions.rst:822 +#: ../../library/exceptions.rst:828 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:824 +#: ../../library/exceptions.rst:830 msgid "" -"The following exceptions are used as warning categories; see the :ref:" -"`warning-categories` documentation for more details." +"The following exceptions are used as warning categories; see " +"the :ref:`warning-categories` documentation for more details." msgstr "" "以下的例外是當作警告的種類使用;更多細節參考 :ref:`warning-categories` 文件。" -#: ../../library/exceptions.rst:829 +#: ../../library/exceptions.rst:835 msgid "Base class for warning categories." msgstr "警告種類的基礎類別。" -#: ../../library/exceptions.rst:834 +#: ../../library/exceptions.rst:840 msgid "Base class for warnings generated by user code." msgstr "使用者程式碼產生的警告的基礎類別。" -#: ../../library/exceptions.rst:839 +#: ../../library/exceptions.rst:845 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "關於已棄用功能的警告的基礎類別,且當那些警告是針對其他 Python 開發者。" -#: ../../library/exceptions.rst:842 +#: ../../library/exceptions.rst:848 msgid "" -"Ignored by the default warning filters, except in the ``__main__`` module (:" -"pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " -"warning." +"Ignored by the default warning filters, except in the ``__main__`` module " +"(:pep:`565`). Enabling the :ref:`Python Development Mode ` shows " +"this warning." msgstr "" -"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟用 :ref:" -"`Python 開發模式 `\\ 會顯示此警告。" +"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟" +"用 :ref:`Python 開發模式 `\\ 會顯示此警告。" -#: ../../library/exceptions.rst:846 ../../library/exceptions.rst:862 +#: ../../library/exceptions.rst:852 ../../library/exceptions.rst:868 msgid "The deprecation policy is described in :pep:`387`." msgstr "棄用原則描述在 :pep:`387` 裡。" -#: ../../library/exceptions.rst:851 +#: ../../library/exceptions.rst:857 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "關於過時且預期未來要被棄用,但目前尚未被棄用的功能的警告的基礎類別。" -#: ../../library/exceptions.rst:855 +#: ../../library/exceptions.rst:861 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " @@ -1274,8 +1295,8 @@ msgstr "" "因為發出關於可能即將被棄用的警告是不尋常的,此類別很少被使用,而對已經被棄用" "的情況會優先使用 :exc:`DeprecationWarning`。" -#: ../../library/exceptions.rst:859 ../../library/exceptions.rst:885 -#: ../../library/exceptions.rst:912 +#: ../../library/exceptions.rst:865 ../../library/exceptions.rst:891 +#: ../../library/exceptions.rst:918 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." @@ -1283,15 +1304,15 @@ msgstr "" "會被預設的警告過濾器忽略。啟用 :ref:`Python 開發模式 `\\ 會顯示此警" "告。" -#: ../../library/exceptions.rst:867 +#: ../../library/exceptions.rst:873 msgid "Base class for warnings about dubious syntax." msgstr "關於可疑語法的警告的基礎類別。" -#: ../../library/exceptions.rst:872 +#: ../../library/exceptions.rst:878 msgid "Base class for warnings about dubious runtime behavior." msgstr "關於可疑執行環境行為的警告的基礎類別。" -#: ../../library/exceptions.rst:877 +#: ../../library/exceptions.rst:883 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." @@ -1299,36 +1320,36 @@ msgstr "" "關於已棄用功能的警告的基礎類別,且當那些警告是針對以 Python 寫的應用程式的終" "端使用者。" -#: ../../library/exceptions.rst:883 +#: ../../library/exceptions.rst:889 msgid "Base class for warnings about probable mistakes in module imports." msgstr "關於在模組引入的可能錯誤的警告的基礎類別。" -#: ../../library/exceptions.rst:891 +#: ../../library/exceptions.rst:897 msgid "Base class for warnings related to Unicode." msgstr "Unicode 相關警告的基礎類別。" -#: ../../library/exceptions.rst:896 +#: ../../library/exceptions.rst:902 msgid "Base class for warnings related to encodings." msgstr "編碼相關警告的基礎類別。" -#: ../../library/exceptions.rst:898 +#: ../../library/exceptions.rst:904 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節參考\\ :ref:`io-encoding-warning`。" -#: ../../library/exceptions.rst:905 +#: ../../library/exceptions.rst:911 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr ":class:`bytes` 及 :class:`bytearray` 相關警告的基礎類別。" -#: ../../library/exceptions.rst:910 +#: ../../library/exceptions.rst:916 msgid "Base class for warnings related to resource usage." msgstr "資源用法相關警告的基礎類別。" -#: ../../library/exceptions.rst:921 +#: ../../library/exceptions.rst:927 msgid "Exception groups" msgstr "例外群組" -#: ../../library/exceptions.rst:923 +#: ../../library/exceptions.rst:929 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1337,49 +1358,51 @@ msgid "" "based on the types of the contained exceptions." msgstr "" "當需要引發多個不相關例外時會使用下列的類別。它們是例外階層的一部分所以可以像" -"所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外類型為" +"所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外型別為" "基礎來比對其子群組而被 :keyword:`except*` 辨認出來。" -#: ../../library/exceptions.rst:932 +#: ../../library/exceptions.rst:938 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " "classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and " -"it can wrap any exception, while :exc:`ExceptionGroup` extends :exc:" -"`Exception` and it can only wrap subclasses of :exc:`Exception`. This design " -"is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" -"exc:`BaseExceptionGroup`." +"it can wrap any exception, while :exc:`ExceptionGroup` " +"extends :exc:`Exception` and it can only wrap subclasses " +"of :exc:`Exception`. This design is so that ``except Exception`` catches " +"an :exc:`ExceptionGroup` but not :exc:`BaseExceptionGroup`." msgstr "" -"這兩個例外類型都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" +"這兩個例外型別都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" "類別的差異是 :exc:`BaseExceptionGroup` 擴充了 :exc:`BaseException` 且可以包裝" -"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包裝 :exc:" -"`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" -"`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" +"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包" +"裝 :exc:`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕" +"捉 :exc:`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" -#: ../../library/exceptions.rst:940 +#: ../../library/exceptions.rst:946 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " -"rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" -"`Exception` instances, so it can be used to make the selection automatic. " -"The :exc:`ExceptionGroup` constructor, on the other hand, raises a :exc:" -"`TypeError` if any contained exception is not an :exc:`Exception` subclass." +"rather than a :exc:`BaseExceptionGroup` if all contained exceptions " +"are :exc:`Exception` instances, so it can be used to make the selection " +"automatic. The :exc:`ExceptionGroup` constructor, on the other hand, raises " +"a :exc:`TypeError` if any contained exception is not an :exc:`Exception` " +"subclass." msgstr "" "如果所有包含的例外都是 :exc:`Exception` 實例,:exc:`BaseExceptionGroup` 建構" "函式會回傳 :exc:`ExceptionGroup` 而不是 :exc:`BaseExceptionGroup`,因此可以被" -"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不是 :exc:" -"`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引發 :exc:`TypeError`。" +"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不" +"是 :exc:`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引" +"發 :exc:`TypeError`。" -#: ../../library/exceptions.rst:949 +#: ../../library/exceptions.rst:955 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "建構函式的 ``msg`` 引數。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:953 +#: ../../library/exceptions.rst:959 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "指定給建構函式 ``excs`` 序列中的例外組成的元組。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:958 +#: ../../library/exceptions.rst:964 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." @@ -1387,7 +1410,7 @@ msgstr "" "回傳只包含從現有群組比對到 *condition* 的例外的例外群組,或者當結果為空時回" "傳 ``None``。" -#: ../../library/exceptions.rst:961 +#: ../../library/exceptions.rst:967 msgid "" "The condition can be an exception type or tuple of exception types, in which " "case each exception is checked for a match using the same check that is used " @@ -1395,21 +1418,25 @@ msgid "" "type object) that accepts an exception as its single argument and returns " "true for the exceptions that should be in the subgroup." msgstr "" +"條件式可以是一個例外型別或是例外型別的元組,在此情況下,每個例外都會使用與 " +"``except`` 子句中使用的相同檢查方法來檢查是否有匹配。條件式也可以是一個可呼叫" +"物件(除了型別物件之外),其接受一個例外作為單一引數,而如果該例外應該在子群" +"組中就回傳 true。" -#: ../../library/exceptions.rst:967 +#: ../../library/exceptions.rst:973 msgid "" "The nesting structure of the current exception is preserved in the result, " -"as are the values of its :attr:`message`, :attr:`~BaseException." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields. Empty nested " -"groups are omitted from the result." +"as are the values of " +"its :attr:`message`, :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields. Empty nested groups are omitted " +"from the result." msgstr "" -"現有例外的巢狀結構會保留在結果裡,其 :attr:`message`、:attr:`~BaseException." -"__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException." -"__context__` 及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組" -"會從結果裡排除。" +"現有例外的巢狀結構會保留在結果裡," +"其 :attr:`message`、:attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " +"及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組會從結果裡排" +"除。" -#: ../../library/exceptions.rst:974 +#: ../../library/exceptions.rst:980 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " @@ -1418,11 +1445,11 @@ msgstr "" "條件會對巢狀例外群組裡的所有例外做檢查,包括頂層及任何巢狀的例外群組。如果條" "件對這樣的例外群組為 true,它會被完整包含在結果裡。" -#: ../../library/exceptions.rst:978 +#: ../../library/exceptions.rst:984 msgid "``condition`` can be any callable which is not a type object." -msgstr "" +msgstr "``condition`` 可以是任何不是型別物件的可呼叫物件。" -#: ../../library/exceptions.rst:983 +#: ../../library/exceptions.rst:989 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" @@ -1431,13 +1458,13 @@ msgstr "" "像 :meth:`subgroup` 一樣,但回傳一對 ``(match, rest)``,其中 ``match`` 是 " "``subgroup(condition)`` 而 ``rest`` 是剩下沒有比對到的部分。" -#: ../../library/exceptions.rst:989 +#: ../../library/exceptions.rst:995 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "回傳有相同 :attr:`message` 但將例外包裝在 ``excs`` 的例外群組。" -#: ../../library/exceptions.rst:992 +#: ../../library/exceptions.rst:998 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " @@ -1445,23 +1472,23 @@ msgid "" "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" "此方法被 :meth:`subgroup` 及 :meth:`split` 使用,被用來在各種情境下拆分例外群" -"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不是 :" -"exc:`ExceptionGroup` 的實例。" +"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不" +"是 :exc:`ExceptionGroup` 的實例。" -#: ../../library/exceptions.rst:998 +#: ../../library/exceptions.rst:1004 msgid "" -":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields from the original " -"exception group to the one returned by :meth:`derive`, so these fields do " -"not need to be updated by :meth:`derive`." +":meth:`subgroup` and :meth:`split` copy " +"the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields from the original exception " +"group to the one returned by :meth:`derive`, so these fields do not need to " +"be updated by :meth:`derive`." msgstr "" -":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複製 :attr:" -"`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:" -"`~BaseException.__context__` 和 :attr:`~BaseException.__notes__` 欄位到 :" -"meth:`derive` 所回傳的例外群組上,因此這些欄位不需要被 :meth:`derive` 更新。" +":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複" +"製 :attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " +"和 :attr:`~BaseException.__notes__` 欄位到 :meth:`derive` 所回傳的例外群組" +"上,因此這些欄位不需要被 :meth:`derive` 更新。" -#: ../../library/exceptions.rst:1005 +#: ../../library/exceptions.rst:1011 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1515,7 +1542,7 @@ msgstr "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" -#: ../../library/exceptions.rst:1031 +#: ../../library/exceptions.rst:1037 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1527,7 +1554,7 @@ msgstr "" "建構函式簽名的子類別需要覆寫它而不是 :meth:`~object.__init__`。例如下面定義了" "一個例外群組子類別接受 exit_code 並從中建構群組的訊息。: ::" -#: ../../library/exceptions.rst:1037 +#: ../../library/exceptions.rst:1043 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1547,25 +1574,24 @@ msgstr "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1046 +#: ../../library/exceptions.rst:1052 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " -"is also a subclass of :exc:`Exception` can only wrap instances of :exc:" -"`Exception`." +"is also a subclass of :exc:`Exception` can only wrap instances " +"of :exc:`Exception`." msgstr "" "像 :exc:`ExceptionGroup` 一樣,任何 :exc:`BaseExceptionGroup` 的子類別且也" "是 :exc:`Exception` 的子類別只能包裝 :exc:`Exception` 的實例。" -#: ../../library/exceptions.rst:1054 +#: ../../library/exceptions.rst:1060 msgid "Exception hierarchy" msgstr "例外階層" -#: ../../library/exceptions.rst:1056 +#: ../../library/exceptions.rst:1062 msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" -#: ../../library/exceptions.rst:1058 -#, fuzzy +#: ../../library/exceptions.rst:1064 msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" @@ -1678,6 +1704,7 @@ msgstr "" " ├── ReferenceError\n" " ├── RuntimeError\n" " │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" " │ └── RecursionError\n" " ├── StopAsyncIteration\n" " ├── StopIteration\n" @@ -1745,20 +1772,10 @@ msgstr "__suppress_context__(例外屬性)" msgid "assert" msgstr "assert" -#: ../../library/exceptions.rst:345 +#: ../../library/exceptions.rst:347 msgid "module" msgstr "module(模組)" -#: ../../library/exceptions.rst:345 +#: ../../library/exceptions.rst:347 msgid "errno" msgstr "errno" - -#~ msgid "" -#~ "The condition can be either a function that accepts an exception and " -#~ "returns true for those that should be in the subgroup, or it can be an " -#~ "exception type or a tuple of exception types, which is used to check for " -#~ "a match using the same check that is used in an ``except`` clause." -#~ msgstr "" -#~ "條件可以是一個函式,接受一個例外並對那些應該要在子群組裡的例外回傳 true," -#~ "或者可以是一個例外類型或例外類型的元組,並使用與 ``except`` 子句所使用的相" -#~ "同檢查來檢查是否有比對到。" diff --git a/library/fcntl.po b/library/fcntl.po index a806871acf..69d45662a5 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -118,24 +118,43 @@ msgid "" "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " "for *cmd* are operating system dependent, and are available as constants in " "the :mod:`fcntl` module, using the same names as used in the relevant C " -"header files. The argument *arg* can either be an integer value, or a :class:" -"`bytes` object. With an integer value, the return value of this function is " -"the integer return value of the C :c:func:`fcntl` call. When the argument " -"is bytes it represents a binary structure, e.g. created by :func:`struct." -"pack`. The binary data is copied to a buffer whose address is passed to the " -"C :c:func:`fcntl` call. The return value after a successful call is the " -"contents of the buffer, converted to a :class:`bytes` object. The length of " -"the returned object will be the same as the length of the *arg* argument. " -"This is limited to 1024 bytes. If the information returned in the buffer by " -"the operating system is larger than 1024 bytes, this is most likely to " -"result in a segmentation violation or a more subtle data corruption." -msgstr "" - -#: ../../library/fcntl.rst:104 +"header files. The argument *arg* can either be an integer value, a :class:" +"`bytes` object, or a string. The type and size of *arg* must match the type " +"and size of the argument of the operation as specified in the relevant C " +"documentation." +msgstr "" + +#: ../../library/fcntl.rst:96 +msgid "" +"When *arg* is an integer, the function returns the integer return value of " +"the C :c:func:`fcntl` call." +msgstr "" + +#: ../../library/fcntl.rst:99 +msgid "" +"When the argument is bytes, it represents a binary structure, for example, " +"created by :func:`struct.pack`. A string value is encoded to binary using " +"the UTF-8 encoding. The binary data is copied to a buffer whose address is " +"passed to the C :c:func:`fcntl` call. The return value after a successful " +"call is the contents of the buffer, converted to a :class:`bytes` object. " +"The length of the returned object will be the same as the length of the " +"*arg* argument. This is limited to 1024 bytes." +msgstr "" + +#: ../../library/fcntl.rst:108 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." msgstr "" -#: ../../library/fcntl.rst:106 +#: ../../library/fcntl.rst:111 +msgid "" +"If the type or the size of *arg* does not match the type or size of the " +"argument of the operation (for example, if an integer is passed when a " +"pointer is expected, or the information returned in the buffer by the " +"operating system is larger than 1024 bytes), this is most likely to result " +"in a segmentation violation or a more subtle data corruption." +msgstr "" + +#: ../../library/fcntl.rst:118 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." @@ -143,68 +162,65 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``arg`` 的\\ :ref:`稽核事件 ` " "``fcntl.fcntl``。" -#: ../../library/fcntl.rst:111 +#: ../../library/fcntl.rst:123 msgid "" "This function is identical to the :func:`~fcntl.fcntl` function, except that " "the argument handling is even more complicated." msgstr "" -#: ../../library/fcntl.rst:114 -msgid "" -"The *request* parameter is limited to values that can fit in 32-bits. " -"Additional constants of interest for use as the *request* argument can be " -"found in the :mod:`termios` module, under the same names as used in the " -"relevant C header files." -msgstr "" - -#: ../../library/fcntl.rst:119 +#: ../../library/fcntl.rst:126 msgid "" -"The parameter *arg* can be one of an integer, an object supporting the read-" -"only buffer interface (like :class:`bytes`) or an object supporting the read-" -"write buffer interface (like :class:`bytearray`)." +"The *request* parameter is limited to values that can fit in 32-bits or 64-" +"bits, depending on the platform. Additional constants of interest for use as " +"the *request* argument can be found in the :mod:`termios` module, under the " +"same names as used in the relevant C header files." msgstr "" -#: ../../library/fcntl.rst:123 +#: ../../library/fcntl.rst:132 msgid "" -"In all but the last case, behaviour is as for the :func:`~fcntl.fcntl` " -"function." +"The parameter *arg* can be an integer, a :term:`bytes-like object`, or a " +"string. The type and size of *arg* must match the type and size of the " +"argument of the operation as specified in the relevant C documentation." msgstr "" -#: ../../library/fcntl.rst:126 +#: ../../library/fcntl.rst:137 msgid "" -"If a mutable buffer is passed, then the behaviour is determined by the value " -"of the *mutate_flag* parameter." +"If *arg* does not support the read-write buffer interface or the " +"*mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl` function." msgstr "" -#: ../../library/fcntl.rst:129 +#: ../../library/fcntl.rst:141 msgid "" -"If it is false, the buffer's mutability is ignored and behaviour is as for a " -"read-only buffer, except that the 1024 byte limit mentioned above is avoided " -"-- so long as the buffer you pass is at least as long as what the operating " -"system wants to put there, things should work." +"If *arg* supports the read-write buffer interface (like :class:`bytearray`) " +"and *mutate_flag* is true (the default), then the buffer is (in effect) " +"passed to the underlying :c:func:`!ioctl` system call, the latter's return " +"code is passed back to the calling Python, and the buffer's new contents " +"reflect the action of the :c:func:`ioctl`. This is a slight simplification, " +"because if the supplied buffer is less than 1024 bytes long it is first " +"copied into a static buffer 1024 bytes long which is then passed to :func:" +"`ioctl` and copied back into the supplied buffer." msgstr "" -#: ../../library/fcntl.rst:134 +#: ../../library/fcntl.rst:150 msgid "" -"If *mutate_flag* is true (the default), then the buffer is (in effect) " -"passed to the underlying :func:`ioctl` system call, the latter's return code " -"is passed back to the calling Python, and the buffer's new contents reflect " -"the action of the :func:`ioctl`. This is a slight simplification, because " -"if the supplied buffer is less than 1024 bytes long it is first copied into " -"a static buffer 1024 bytes long which is then passed to :func:`ioctl` and " -"copied back into the supplied buffer." +"If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:142 +#: ../../library/fcntl.rst:153 msgid "" -"If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." +"If the type or size of *arg* does not match the type or size of the " +"operation's argument (for example, if an integer is passed when a pointer is " +"expected, or the information returned in the buffer by the operating system " +"is larger than 1024 bytes, or the size of the mutable bytes-like object is " +"too small), this is most likely to result in a segmentation violation or a " +"more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:144 +#: ../../library/fcntl.rst:161 msgid "An example::" msgstr "範例: ::" -#: ../../library/fcntl.rst:146 +#: ../../library/fcntl.rst:163 msgid "" ">>> import array, fcntl, struct, termios, os\n" ">>> os.getpgrp()\n" @@ -228,7 +244,7 @@ msgstr "" ">>> buf\n" "array('h', [13341])" -#: ../../library/fcntl.rst:157 +#: ../../library/fcntl.rst:174 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." @@ -236,7 +252,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``request``、``arg`` 的\\ :ref:`稽核事件 " "` ``fcntl.ioctl``。" -#: ../../library/fcntl.rst:162 +#: ../../library/fcntl.rst:179 msgid "" "Perform the lock operation *operation* on file descriptor *fd* (file objects " "providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " @@ -244,12 +260,12 @@ msgid "" "function is emulated using :c:func:`fcntl`.)" msgstr "" -#: ../../library/fcntl.rst:167 +#: ../../library/fcntl.rst:184 msgid "" "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:169 +#: ../../library/fcntl.rst:186 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." @@ -257,7 +273,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``operation`` 的\\ :ref:`稽核事件 ` " "``fcntl.flock``。" -#: ../../library/fcntl.rst:174 +#: ../../library/fcntl.rst:191 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " "*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." @@ -265,25 +281,25 @@ msgid "" "*cmd* is one of the following values:" msgstr "" -#: ../../library/fcntl.rst:181 +#: ../../library/fcntl.rst:198 msgid "Release an existing lock." msgstr "" -#: ../../library/fcntl.rst:185 +#: ../../library/fcntl.rst:202 msgid "Acquire a shared lock." msgstr "" -#: ../../library/fcntl.rst:189 +#: ../../library/fcntl.rst:206 msgid "Acquire an exclusive lock." msgstr "" -#: ../../library/fcntl.rst:193 +#: ../../library/fcntl.rst:210 msgid "" "Bitwise OR with any of the other three ``LOCK_*`` constants to make the " "request non-blocking." msgstr "" -#: ../../library/fcntl.rst:196 +#: ../../library/fcntl.rst:213 msgid "" "If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:" "`OSError` will be raised and the exception will have an *errno* attribute " @@ -293,33 +309,33 @@ msgid "" "a file opened for writing." msgstr "" -#: ../../library/fcntl.rst:203 +#: ../../library/fcntl.rst:220 msgid "" "*len* is the number of bytes to lock, *start* is the byte offset at which " "the lock starts, relative to *whence*, and *whence* is as with :func:`io." "IOBase.seek`, specifically:" msgstr "" -#: ../../library/fcntl.rst:207 +#: ../../library/fcntl.rst:224 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" msgstr "" -#: ../../library/fcntl.rst:208 +#: ../../library/fcntl.rst:225 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" msgstr "" -#: ../../library/fcntl.rst:209 +#: ../../library/fcntl.rst:226 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" msgstr "" -#: ../../library/fcntl.rst:211 +#: ../../library/fcntl.rst:228 msgid "" "The default for *start* is 0, which means to start at the beginning of the " "file. The default for *len* is 0 which means to lock to the end of the " "file. The default for *whence* is also 0." msgstr "" -#: ../../library/fcntl.rst:215 +#: ../../library/fcntl.rst:232 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." @@ -327,11 +343,11 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len``、``start``、``whence`` 的\\ :ref:`" "稽核事件 ` ``fcntl.lockf``。" -#: ../../library/fcntl.rst:217 +#: ../../library/fcntl.rst:234 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" -#: ../../library/fcntl.rst:219 +#: ../../library/fcntl.rst:236 msgid "" "import struct, fcntl, os\n" "\n" @@ -349,7 +365,7 @@ msgstr "" "lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" "rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" -#: ../../library/fcntl.rst:227 +#: ../../library/fcntl.rst:244 msgid "" "Note that in the first example the return value variable *rv* will hold an " "integer value; in the second example it will hold a :class:`bytes` object. " @@ -357,11 +373,11 @@ msgid "" "therefore using the :func:`flock` call may be better." msgstr "" -#: ../../library/fcntl.rst:235 +#: ../../library/fcntl.rst:252 msgid "Module :mod:`os`" msgstr ":mod:`os` 模組" -#: ../../library/fcntl.rst:236 +#: ../../library/fcntl.rst:253 msgid "" "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " diff --git a/library/filecmp.po b/library/filecmp.po index ca8839f45d..350f3717b1 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -87,8 +87,8 @@ msgstr "" #: ../../library/filecmp.rst:51 msgid "" -"The *shallow* parameter has the same meaning and default value as for :func:" -"`filecmp.cmp`." +"The *shallow* parameter has the same meaning and default value as " +"for :func:`filecmp.cmp`." msgstr "" #: ../../library/filecmp.rst:54 @@ -112,9 +112,9 @@ msgstr "" #: ../../library/filecmp.rst:75 msgid "" "Construct a new directory comparison object, to compare the directories *a* " -"and *b*. *ignore* is a list of names to ignore, and defaults to :const:" -"`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and defaults " -"to ``[os.curdir, os.pardir]``." +"and *b*. *ignore* is a list of names to ignore, and defaults " +"to :const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and " +"defaults to ``[os.curdir, os.pardir]``." msgstr "" #: ../../library/filecmp.rst:80 @@ -251,8 +251,8 @@ msgid "" "... for sub_dcmp in dcmp.subdirs.values():\n" "... print_diff_files(sub_dcmp)\n" "...\n" -">>> dcmp = dircmp('dir1', 'dir2') \n" -">>> print_diff_files(dcmp) " +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" msgstr "" ">>> from filecmp import dircmp\n" ">>> def print_diff_files(dcmp):\n" @@ -262,5 +262,5 @@ msgstr "" "... for sub_dcmp in dcmp.subdirs.values():\n" "... print_diff_files(sub_dcmp)\n" "...\n" -">>> dcmp = dircmp('dir1', 'dir2') \n" -">>> print_diff_files(dcmp) " +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" diff --git a/library/filesys.po b/library/filesys.po index 039d7bf996..9c42ea3858 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2021-11-22 20:13+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,11 +35,11 @@ msgstr "" "取檔案的屬性、以可攜 (portable) 方式操作路徑以及建立暫存檔。本章中的完整 " "module 清單是:" -#: ../../library/filesys.rst:29 +#: ../../library/filesys.rst:28 msgid "Module :mod:`os`" msgstr "Module :mod:`os`" -#: ../../library/filesys.rst:30 +#: ../../library/filesys.rst:29 msgid "" "Operating system interfaces, including functions to work with files at a " "lower level than Python :term:`file objects `." @@ -48,11 +47,11 @@ msgstr "" "作業系統介面,包括處理比 Python :term:`檔案物件 `\\ 更低階檔案的" "函式。" -#: ../../library/filesys.rst:33 +#: ../../library/filesys.rst:32 msgid "Module :mod:`io`" msgstr "Module :mod:`io`" -#: ../../library/filesys.rst:34 +#: ../../library/filesys.rst:33 msgid "" "Python's built-in I/O library, including both abstract classes and some " "concrete classes such as file I/O." @@ -60,10 +59,10 @@ msgstr "" "Python 的內建 I/O 函式庫,包含抽象類別和一些具體類別 (concrete class),如檔" "案 I/O。" -#: ../../library/filesys.rst:37 +#: ../../library/filesys.rst:36 msgid "Built-in function :func:`open`" msgstr "內建函式 :func:`open`" -#: ../../library/filesys.rst:38 +#: ../../library/filesys.rst:37 msgid "The standard way to open files for reading and writing with Python." msgstr "使用 Python 打開檔案以進行讀寫檔案的標準方法。" diff --git a/library/fnmatch.po b/library/fnmatch.po index 345fd99a0a..75dd730a60 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-01-15 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,12 +90,20 @@ msgstr "" #: ../../library/fnmatch.rst:49 msgid "" -"Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is " -"used to cache the compiled regex patterns in the following functions: :func:" -"`fnmatch`, :func:`fnmatchcase`, :func:`.filter`." +"Unless stated otherwise, \"filename string\" and \"pattern string\" either " +"refer to :class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note " +"that the functions documented below do not allow to mix a :class:`!bytes` " +"pattern with a :class:`!str` filename, and vice-versa." msgstr "" -#: ../../library/fnmatch.rst:55 +#: ../../library/fnmatch.rst:54 +msgid "" +"Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768 is " +"used to cache the (typed) compiled regex patterns in the following " +"functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`." +msgstr "" + +#: ../../library/fnmatch.rst:61 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " "returning ``True`` or ``False``. Both parameters are case-normalized using :" @@ -104,13 +112,13 @@ msgid "" "operating system." msgstr "" -#: ../../library/fnmatch.rst:61 +#: ../../library/fnmatch.rst:67 msgid "" "This example will print all file names in the current directory with the " "extension ``.txt``::" msgstr "" -#: ../../library/fnmatch.rst:64 +#: ../../library/fnmatch.rst:70 msgid "" "import fnmatch\n" "import os\n" @@ -126,35 +134,35 @@ msgstr "" " if fnmatch.fnmatch(file, '*.txt'):\n" " print(file)" -#: ../../library/fnmatch.rst:74 +#: ../../library/fnmatch.rst:80 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " "returning ``True`` or ``False``; the comparison is case-sensitive and does " "not apply :func:`os.path.normcase`." msgstr "" -#: ../../library/fnmatch.rst:81 +#: ../../library/fnmatch.rst:87 msgid "" -"Construct a list from those elements of the :term:`iterable` *names* that " -"match pattern *pat*. It is the same as ``[n for n in names if fnmatch(n, " -"pat)]``, but implemented more efficiently." +"Construct a list from those elements of the :term:`iterable` of filename " +"strings *names* that match the pattern string *pat*. It is the same as ``[n " +"for n in names if fnmatch(n, pat)]``, but implemented more efficiently." msgstr "" -#: ../../library/fnmatch.rst:89 +#: ../../library/fnmatch.rst:95 msgid "" "Return the shell-style pattern *pat* converted to a regular expression for " -"using with :func:`re.match`." +"using with :func:`re.match`. The pattern is expected to be a :class:`str`." msgstr "" -#: ../../library/fnmatch.rst:92 +#: ../../library/fnmatch.rst:98 msgid "Example:" msgstr "範例:" -#: ../../library/fnmatch.rst:106 +#: ../../library/fnmatch.rst:112 msgid "Module :mod:`glob`" msgstr ":mod:`glob` 模組" -#: ../../library/fnmatch.rst:107 +#: ../../library/fnmatch.rst:113 msgid "Unix shell-style path expansion." msgstr "" diff --git a/library/fractions.po b/library/fractions.po index 0bed2f807a..19f4409273 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -43,13 +43,13 @@ msgid "" "of :class:`numbers.Rational` and returns a new :class:`Fraction` instance " "with value ``numerator/denominator``. If *denominator* is ``0``, it raises " "a :exc:`ZeroDivisionError`. The second version requires that " -"*other_fraction* is an instance of :class:`numbers.Rational` and returns a :" -"class:`Fraction` instance with the same value. The next two versions accept " -"either a :class:`float` or a :class:`decimal.Decimal` instance, and return " -"a :class:`Fraction` instance with exactly the same value. Note that due to " -"the usual issues with binary floating point (see :ref:`tut-fp-issues`), the " -"argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so " -"``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might " +"*other_fraction* is an instance of :class:`numbers.Rational` and returns " +"a :class:`Fraction` instance with the same value. The next two versions " +"accept either a :class:`float` or a :class:`decimal.Decimal` instance, and " +"return a :class:`Fraction` instance with exactly the same value. Note that " +"due to the usual issues with binary floating point (see :ref:`tut-fp-" +"issues`), the argument to ``Fraction(1.1)`` is not exactly equal to 11/10, " +"and so ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might " "expect. (But see the documentation for the :meth:`limit_denominator` method " "below.) The last version of the constructor expects a string or unicode " "instance. The usual form for this instance is::" @@ -64,10 +64,10 @@ msgid "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " "``denominator`` (if present) are strings of decimal digits (underscores may " "be used to delimit digits as with integral literals in code). In addition, " -"any string that represents a finite value and is accepted by the :class:" -"`float` constructor is also accepted by the :class:`Fraction` constructor. " -"In either form the input string may also have leading and/or trailing " -"whitespace. Here are some examples::" +"any string that represents a finite value and is accepted by " +"the :class:`float` constructor is also accepted by the :class:`Fraction` " +"constructor. In either form the input string may also have leading and/or " +"trailing whitespace. Here are some examples::" msgstr "" #: ../../library/fractions.rst:52 @@ -124,17 +124,17 @@ msgstr "" #: ../../library/fractions.rst:78 msgid "" -"The :class:`Fraction` class inherits from the abstract base class :class:" -"`numbers.Rational`, and implements all of the methods and operations from " -"that class. :class:`Fraction` instances are :term:`hashable`, and should be " -"treated as immutable. In addition, :class:`Fraction` has the following " -"properties and methods:" +"The :class:`Fraction` class inherits from the abstract base " +"class :class:`numbers.Rational`, and implements all of the methods and " +"operations from that class. :class:`Fraction` instances " +"are :term:`hashable`, and should be treated as immutable. In " +"addition, :class:`Fraction` has the following properties and methods:" msgstr "" #: ../../library/fractions.rst:84 msgid "" -"The :class:`Fraction` constructor now accepts :class:`float` and :class:" -"`decimal.Decimal` instances." +"The :class:`Fraction` constructor now accepts :class:`float` " +"and :class:`decimal.Decimal` instances." msgstr "" #: ../../library/fractions.rst:88 @@ -152,8 +152,8 @@ msgstr "" #: ../../library/fractions.rst:97 msgid "" -":class:`Fraction` implements ``__int__`` now to satisfy ``typing." -"SupportsInt`` instance checks." +":class:`Fraction` implements ``__int__`` now to satisfy " +"``typing.SupportsInt`` instance checks." msgstr "" #: ../../library/fractions.rst:101 @@ -194,9 +194,9 @@ msgstr "" #: ../../library/fractions.rst:138 msgid "" -"Alternative constructor which only accepts instances of :class:`float` or :" -"class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " -"the same value as ``Fraction(3, 10)``." +"Alternative constructor which only accepts instances of :class:`float` " +"or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is " +"not the same value as ``Fraction(3, 10)``." msgstr "" #: ../../library/fractions.rst:144 @@ -207,8 +207,8 @@ msgstr "" #: ../../library/fractions.rst:150 msgid "" -"Alternative constructor which only accepts instances of :class:`decimal." -"Decimal` or :class:`numbers.Integral`." +"Alternative constructor which only accepts instances " +"of :class:`decimal.Decimal` or :class:`numbers.Integral`." msgstr "" #: ../../library/fractions.rst:155 @@ -245,15 +245,15 @@ msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " "``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again " -"rounding half toward even. This method can also be accessed through the :" -"func:`round` function." +"rounding half toward even. This method can also be accessed through " +"the :func:`round` function." msgstr "" #: ../../library/fractions.rst:208 msgid "" -"Provides support for formatting of :class:`Fraction` instances via the :meth:" -"`str.format` method, the :func:`format` built-in function, or :ref:" -"`Formatted string literals `." +"Provides support for formatting of :class:`Fraction` instances via " +"the :meth:`str.format` method, the :func:`format` built-in function, " +"or :ref:`Formatted string literals `." msgstr "" #: ../../library/fractions.rst:212 @@ -281,7 +281,6 @@ msgid "Here are some examples::" msgstr "" #: ../../library/fractions.rst:229 -#, fuzzy msgid "" ">>> from fractions import Fraction\n" ">>> format(Fraction(103993, 33102), '_')\n" @@ -303,6 +302,14 @@ msgid "" "'34.67% price increase'" msgstr "" ">>> from fractions import Fraction\n" +">>> format(Fraction(103993, 33102), '_')\n" +"'103_993/33_102'\n" +">>> format(Fraction(1, 7), '.^+10')\n" +"'...+1/7...'\n" +">>> format(Fraction(3, 1), '')\n" +"'3'\n" +">>> format(Fraction(3, 1), '#')\n" +"'3/1'\n" ">>> format(Fraction(1, 7), '.40g')\n" "'0.1428571428571428571428571428571428571429'\n" ">>> format(Fraction('1234567.855'), '_.2f')\n" diff --git a/library/ftplib.po b/library/ftplib.po index 15641cfa55..ee1c0a319e 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -455,7 +455,7 @@ msgid "" "but server is not guaranteed to return all requested facts." msgstr "" "使用 ``MLSD`` 命令 (:rfc:`3659`) 列出標準格式的目錄。如果省略 *path* 則假定為" -"作用於當前目錄。*facts* 是表示所需資訊類型的字串列表(例如 ``[\"type\", " +"作用於目前目錄。*facts* 是表示所需資訊類型的字串列表(例如 ``[\"type\", " "\"size\", \"perm\"]`` )。會回傳一個產生器物件,為每個在路徑中找到的檔案生成" "一個包含兩個元素的元組,第一個元素是檔案名稱,第二個元素是包含有關檔案名稱 " "facts的字典。該字典的內容可能受 *facts* 引數限制,但不保證伺服器會回傳所有請" @@ -469,7 +469,7 @@ msgid "" "the ``NLST`` command." msgstr "" "回傳由 ``NLST`` 命令回傳的檔案名稱列表。可選的 *argument* 是要列出的目錄(預" -"設為當前伺服器目錄)。多個引數可用於將非標準選項傳遞給 ``NLST`` 命令。" +"設為目前伺服器目錄)。多個引數可用於將非標準選項傳遞給 ``NLST`` 命令。" #: ../../library/ftplib.rst:373 ../../library/ftplib.rst:385 msgid "If your server supports the command, :meth:`mlsd` offers a better API." @@ -485,7 +485,7 @@ msgid "" "default prints to :data:`sys.stdout`. This method returns ``None``." msgstr "" "生成由 ``LIST`` 命令回傳的目錄列表,並將其印出到標準輸出 (standard output)。" -"可選的 *argument* 是要列出的目錄(預設為當前伺服器目錄)。有多個引數可用於將" +"可選的 *argument* 是要列出的目錄(預設為目前伺服器目錄)。有多個引數可用於將" "非標準選項傳遞給 ``LIST`` 命令。如果最後一個引數是一個函式,它被用作 :meth:" "`retrlines` 的 *callback* 函式;預設印出到 :data:`sys.stdout`。此方法回傳 " "``None``。" @@ -505,7 +505,7 @@ msgstr "" #: ../../library/ftplib.rst:402 msgid "Set the current directory on the server." -msgstr "設定伺服器上的當前目錄。" +msgstr "設定伺服器上的目前目錄。" #: ../../library/ftplib.rst:407 msgid "Create a new directory on the server." @@ -513,7 +513,7 @@ msgstr "在伺服器上建立一個新目錄。" #: ../../library/ftplib.rst:412 msgid "Return the pathname of the current directory on the server." -msgstr "回傳伺服器上當前目錄的路徑名。" +msgstr "回傳伺服器上目前目錄的路徑名。" #: ../../library/ftplib.rst:417 msgid "Remove the directory named *dirname* on the server." diff --git a/library/functional.po b/library/functional.po index d8cea9f862..89f98aafb8 100644 --- a/library/functional.po +++ b/library/functional.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -21,13 +20,15 @@ msgstr "" #: ../../library/functional.rst:3 msgid "Functional Programming Modules" -msgstr "函式編程模組" +msgstr "函式程式設計模組" #: ../../library/functional.rst:5 msgid "" "The modules described in this chapter provide functions and classes that " "support a functional programming style, and general operations on callables." msgstr "" +"本章節所描述的模組提供了支援函式程式設計風格的函式和類別,以及對可呼叫物件的" +"一般操作。" #: ../../library/functional.rst:8 msgid "The following modules are documented in this chapter:" diff --git a/library/functions.po b/library/functions.po index aec90b86d9..9493604248 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -460,9 +460,9 @@ msgid "" "iterator. If *default* is given, it is returned if the iterator is " "exhausted, otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回傳 :term:" -"`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器結束時會返" -"回該值,否則會引發 :exc:`StopAsyncIteration` 。" +"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回" +"傳 :term:`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器" +"結束時會返回該值,否則會引發 :exc:`StopAsyncIteration` 。" #: ../../library/functions.rst:104 msgid "" @@ -489,9 +489,9 @@ msgstr "" #: ../../library/functions.rst:116 msgid "" "As :func:`repr`, return a string containing a printable representation of an " -"object, but escape the non-ASCII characters in the string returned by :func:" -"`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a string " -"similar to that returned by :func:`repr` in Python 2." +"object, but escape the non-ASCII characters in the string returned " +"by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates " +"a string similar to that returned by :func:`repr` in Python 2." msgstr "" "就像函式 :func:`repr`,回傳一個表示物件的字串,但是 :func:`repr` 回傳的字串中" "非 ASCII 編碼的字元會被跳脫 (escape),像是 ``\\x``、``\\u`` 和 ``\\U``。這個" @@ -505,8 +505,8 @@ msgid "" "integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:`~object." -"__index__` method 回傳一個整數。舉例來說:" +"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:134 msgid "" @@ -517,16 +517,16 @@ msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" #: ../../library/functions.rst:141 ../../library/functions.rst:942 #: ../../library/functions.rst:1323 msgid "See also :func:`format` for more information." -msgstr "可參考 :func:`format` 獲取更多資訊。" +msgstr "可參考 :func:`format` 取得更多資訊。" #: ../../library/functions.rst:146 msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " "argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:" -"`typesnumeric`). It cannot be subclassed further. Its only instances are " -"``False`` and ``True`` (see :ref:`typebool`)." +"``True``. The :class:`bool` class is a subclass of :class:`int` " +"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " +"instances are ``False`` and ``True`` (see :ref:`typebool`)." msgstr "" "回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" "程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" @@ -551,18 +551,18 @@ msgid "" "not accessible, this function will raise :exc:`RuntimeError`." msgstr "" "這個函式將呼叫 :func:`sys.breakpointhook` 函式,並將 ``args`` 和 ``kws`` 傳遞" -"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下,``sys." -"breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設計是為" -"了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可以進入" -"除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並且 :func:" -"`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存取 :func:" -"`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" +"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下," +"``sys.breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設" +"計是為了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可" +"以進入除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並" +"且 :func:`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存" +"取 :func:`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" #: ../../library/functions.rst:173 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with the :" -"envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." -"breakpointhook` for usage details." +"By default, the behavior of :func:`breakpoint` can be changed with " +"the :envvar:`PYTHONBREAKPOINT` environment variable. " +"See :func:`sys.breakpointhook` for usage details." msgstr "" "預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境" "變數來更改。有關使用詳情,請參考 :func:`sys.breakpointhook`。" @@ -589,9 +589,9 @@ msgid "" "as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" "回傳一個新的 bytes 陣列。:class:`bytearray` class 是一個可變的整數序列,包含" -"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如在 :ref:" -"`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" -"見 :ref:`bytes-methods`。" +"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如" +"在 :ref:`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 " +"method,參見 :ref:`bytes-methods`。" #: ../../library/functions.rst:195 msgid "" @@ -644,8 +644,8 @@ msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" #: ../../library/functions.rst:222 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" -"class:`bytearray` -- it has the same non-mutating methods and the same " +"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " +"of :class:`bytearray` -- it has the same non-mutating methods and the same " "indexing and slicing behavior." msgstr "" "回傳一個新的 \"bytes\" 物件,會是一個元素是範圍為 ``0 <= x < 256`` 整數的不可" @@ -667,11 +667,12 @@ msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods` #: ../../library/functions.rst:236 msgid "" -"Return :const:`True` if the *object* argument appears callable, :const:" -"`False` if not. If this returns ``True``, it is still possible that a call " -"fails, but if it is ``False``, calling *object* will never succeed. Note " -"that classes are callable (calling a class returns a new instance); " -"instances are callable if their class has a :meth:`~object.__call__` method." +"Return :const:`True` if the *object* argument appears " +"callable, :const:`False` if not. If this returns ``True``, it is still " +"possible that a call fails, but if it is ``False``, calling *object* will " +"never succeed. Note that classes are callable (calling a class returns a new " +"instance); instances are callable if their class has " +"a :meth:`~object.__call__` method." msgstr "" "如果引數 *object* 是可呼叫的,回傳 :const:`True`,否則回傳 :const:`False`。如" "果回傳 ``True``,呼叫仍可能會失敗;但如果回傳 ``False``,則呼叫 *object* 肯定" @@ -726,8 +727,8 @@ msgstr "" #: ../../library/functions.rst:269 msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@classmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" "於函式定義的詳細介紹。" @@ -755,31 +756,30 @@ msgstr "" #: ../../library/functions.rst:281 msgid "" -"Class methods can now wrap other :term:`descriptors ` such as :" -"func:`property`." +"Class methods can now wrap other :term:`descriptors ` such " +"as :func:`property`." msgstr "" -"Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:" -"`property`" +"Class methods 現在可以包裝其他\\ :term:`描述器 `,例" +"如 :func:`property`" #: ../../library/functions.rst:285 msgid "" -"Class methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " -"new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " +"attribute." msgstr "" -"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性。" +"Class method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性。" #: ../../library/functions.rst:292 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." msgstr "" -"Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" -"`property`。" +"Class methods 不能再包裝其他的\\ :term:`描述器 `,例" +"如 :func:`property`。" #: ../../library/functions.rst:299 msgid "" @@ -788,9 +788,9 @@ msgid "" "string, a byte string, or an AST object. Refer to the :mod:`ast` module " "documentation for information on how to work with AST objects." msgstr "" -"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` 或 :func:" -"`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" -"`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" +"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` " +"或 :func:`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。" +"參見 :mod:`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" #: ../../library/functions.rst:304 msgid "" @@ -816,38 +816,40 @@ msgstr "" #: ../../library/functions.rst:314 msgid "" -"The optional arguments *flags* and *dont_inherit* control which :ref:" -"`compiler options ` should be activated and which :ref:" -"`future features ` should be allowed. If neither is present (or both " -"are zero) the code is compiled with the same flags that affect the code that " -"is calling :func:`compile`. If the *flags* argument is given and " -"*dont_inherit* is not (or is zero) then the compiler options and the future " -"statements specified by the *flags* argument are used in addition to those " -"that would be used anyway. If *dont_inherit* is a non-zero integer then the " -"*flags* argument is it -- the flags (future features and compiler options) " -"in the surrounding code are ignored." +"The optional arguments *flags* and *dont_inherit* control " +"which :ref:`compiler options ` should be activated and " +"which :ref:`future features ` should be allowed. If neither is " +"present (or both are zero) the code is compiled with the same flags that " +"affect the code that is calling :func:`compile`. If the *flags* argument is " +"given and *dont_inherit* is not (or is zero) then the compiler options and " +"the future statements specified by the *flags* argument are used in addition " +"to those that would be used anyway. If *dont_inherit* is a non-zero integer " +"then the *flags* argument is it -- the flags (future features and compiler " +"options) in the surrounding code are ignored." msgstr "" "可選引數 *flags* 和 *dont_inherit* 控制啟用哪個\\ :ref:`編譯器選項 `\\ 以及允許哪個\\ :ref:`未來功能 `。如果兩者都不存在" "(或兩者都為零),則會呼叫與 :func:`compile` 相同旗標的程式碼來編譯。如果給" "定 *flags* 引數而未給定 *dont_inherit*(或為零)則無論如何都會使用由 *flags* " "引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" -"用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" +"用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" #: ../../library/functions.rst:325 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as the :attr:`~__future__." -"_Feature.compiler_flag` attribute on the :class:`~__future__._Feature` " -"instance in the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with ``PyCF_`` prefix." +"specify a given future feature can be found as " +"the :attr:`~__future__._Feature.compiler_flag` attribute on " +"the :class:`~__future__._Feature` instance in the :mod:`__future__` " +"module. :ref:`Compiler flags ` can be found " +"in :mod:`ast` module, with ``PyCF_`` prefix." msgstr "" "編譯器選項和 future 陳述式使用 bits 來表示,可以一起被位元操作 OR 來表示複數" -"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module 中 :" -"class:`~__future__._Feature` 實例中的 :attr:`~__future__._Feature." -"compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" -"mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" +"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module " +"中 :class:`~__future__._Feature` 實例中" +"的 :attr:`~__future__._Feature.compiler_flag` 屬性來獲得。:ref:`編譯器旗標 " +"`\\ 可以在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名" +"稱。" #: ../../library/functions.rst:333 msgid "" @@ -857,8 +859,8 @@ msgid "" "optimization; ``__debug__`` is true), ``1`` (asserts are removed, " "``__debug__`` is false) or ``2`` (docstrings are removed too)." msgstr "" -"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :" -"option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " +"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器" +"的 :option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" @@ -872,8 +874,8 @@ msgstr "" #: ../../library/functions.rst:342 msgid "" -"If you want to parse Python code into its AST representation, see :func:`ast." -"parse`." +"If you want to parse Python code into its AST representation, " +"see :func:`ast.parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" #: ../../library/functions.rst:345 ../../library/functions.rst:347 @@ -889,8 +891,8 @@ msgstr "" msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in the :mod:" -"`code` module." +"to facilitate detection of incomplete and complete statements in " +"the :mod:`code` module." msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" @@ -983,23 +985,23 @@ msgid "" "and ``')'``, which are ignored. The string must not contain whitespace " "between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " "number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to the :" -"token:`~float:complexvalue` production rule in the following grammar, after " -"parentheses and leading and trailing whitespace characters are removed:" +"raises :exc:`ValueError`. More precisely, the input must conform to " +"the :token:`~float:complexvalue` production rule in the following grammar, " +"after parentheses and leading and trailing whitespace characters are removed:" msgstr "" #: ../../library/functions.rst:424 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object." -"__complex__` is not defined then it falls back to :meth:`~object.__float__`. " -"If :meth:`!__float__` is not defined then it falls back to :meth:`~object." -"__index__`." +"``complex(x)`` delegates to ``x.__complex__()``. " +"If :meth:`~object.__complex__` is not defined then it falls back " +"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" -"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." -"__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 " +"``x.__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" @@ -1029,8 +1031,8 @@ msgstr "可以使用底線將程式碼文字中的數字進行分組。" #: ../../library/functions.rst:450 msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" -"meth:`~object.__float__` are not defined." +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " +"and :meth:`~object.__float__` are not defined." msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" @@ -1058,8 +1060,8 @@ msgstr "" #: ../../library/functions.rst:473 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, and :" -"class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, " +"and :class:`tuple` classes, as well as the :mod:`collections` module." msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" @@ -1070,16 +1072,16 @@ msgid "" "With an argument, attempt to return a list of valid attributes for that " "object." msgstr "" -"如果沒有引數,則回傳當前區域作用域 (local scope) 中的名稱列表。如果有引數,它" +"如果沒有引數,則回傳目前區域作用域 (local scope) 中的名稱列表。如果有引數,它" "會嘗試回傳該物件的有效屬性列表。" #: ../../library/functions.rst:483 msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` or :func:`~object." -"__getattribute__` function to customize the way :func:`dir` reports their " -"attributes." +"implement a custom :func:`~object.__getattr__` " +"or :func:`~object.__getattribute__` function to customize the " +"way :func:`dir` reports their attributes." msgstr "" "如果物件有一個名為 :meth:`~object.__dir__` 的 method,那麼該 method 將被呼" "叫,並且必須回傳一個屬性列表。這允許實現自定義 :func:`~object.__getattr__` " @@ -1091,12 +1093,12 @@ msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " "attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a custom :" -"func:`~object.__getattr__`." +"necessarily complete and may be inaccurate when the object has a " +"custom :func:`~object.__getattr__`." msgstr "" -"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義的 :attr:" -"`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" -"自定義 :func:`~object.__getattr__`,那結果可能不準確。" +"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義" +"的 :attr:`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的," +"如果物件有自定義 :func:`~object.__getattr__`,那結果可能不準確。" #: ../../library/functions.rst:496 msgid "" @@ -1153,30 +1155,30 @@ msgid "" "consisting of their quotient and remainder when using integer division. " "With mixed operand types, the rules for binary arithmetic operators apply. " "For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually ``math." -"floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` " -"is very close to *a*, if ``a % b`` is non-zero it has the same sign as *b*, " -"and ``0 <= abs(a % b) < abs(b)``." +"point numbers the result is ``(q, a % b)``, where *q* is usually " +"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " +"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " +"*b*, and ``0 <= abs(a % b) < abs(b)``." msgstr "" "它將兩個(非複數)數字作為引數,並在執行整數除法時回傳一對商和餘數。對於混合" "運算元型別,適用二進位算術運算子的規則。對於整數,運算結果和 ``(a // b, a % " -"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 ``math." -"floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 *a* 基本相" -"等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " -"abs(b)``。" +"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 " +"``math.floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 " +"*a* 基本相等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % " +"b) < abs(b)``。" #: ../../library/functions.rst:552 msgid "" -"Return an enumerate object. *iterable* must be a sequence, an :term:" -"`iterator`, or some other object which supports iteration. The :meth:" -"`~iterator.__next__` method of the iterator returned by :func:`enumerate` " -"returns a tuple containing a count (from *start* which defaults to 0) and " -"the values obtained from iterating over *iterable*." +"Return an enumerate object. *iterable* must be a sequence, " +"an :term:`iterator`, or some other object which supports iteration. " +"The :meth:`~iterator.__next__` method of the iterator returned " +"by :func:`enumerate` returns a tuple containing a count (from *start* which " +"defaults to 0) and the values obtained from iterating over *iterable*." msgstr "" "回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或" -"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator 的 :meth:`~iterator." -"__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" -"始,預設為 0)和透過疊代 *iterable* 獲得的值。" +"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator " +"的 :meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數" +"值(從 *start* 開始,預設為 0)和透過疊代 *iterable* 獲得的值。" #: ../../library/functions.rst:564 msgid "Equivalent to::" @@ -1243,14 +1245,14 @@ msgid "" "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " -"own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " -"dictionary. If both mappings are omitted, the expression is executed with " -"the *globals* and *locals* in the environment where :func:`eval` is called. " -"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " -"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" -"`nonlocal` statement)." +"own ``__builtins__`` dictionary into *globals* before passing it " +"to :func:`eval`. If the *locals* mapping is omitted it defaults to the " +"*globals* dictionary. If both mappings are omitted, the expression is " +"executed with the *globals* and *locals* in the environment " +"where :func:`eval` is called. Note, *eval()* will only have access to " +"the :term:`nested scopes ` (non-locals) in the enclosing " +"environment if they are already referenced in the scope that is " +"calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" "求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " @@ -1258,11 +1260,11 @@ msgstr "" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" "入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," -"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" -"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" -"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" -"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" -"`nonlocal` 陳述式)。" +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以" +"在 :func:`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意," +"*eval()* 在封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透" +"過 :keyword:`nonlocal` 陳述式)。" #: ../../library/functions.rst:612 msgid "Example:" @@ -1287,8 +1289,8 @@ msgid "" "pass around for use by :func:`eval` or :func:`exec`." msgstr "" "提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` " -"函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" -"`eval` 或 :func:`exec` 可能會方便許多。" +"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞" +"給 :func:`eval` 或 :func:`exec` 可能會方便許多。" #: ../../library/functions.rst:628 msgid "" @@ -1330,18 +1332,18 @@ msgid "" "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " "cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that the :" -"keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements may " -"not be used outside of function definitions even within the context of code " -"passed to the :func:`exec` function. The return value is ``None``." +"the section :ref:`file-input` in the Reference Manual). Be aware that " +"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " +"may not be used outside of function definitions even within the context of " +"code passed to the :func:`exec` function. The return value is ``None``." msgstr "" "這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" -"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文中,:keyword:" -"`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" -"用。該函式回傳值是 ``None``。" +"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文" +"中,:keyword:`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在" +"函式之外使用。該函式回傳值是 ``None``。" #: ../../library/functions.rst:668 msgid "" @@ -1353,7 +1355,7 @@ msgid "" "any mapping object. Remember that at the module level, globals and locals " "are the same dictionary." msgstr "" -"無論哪種情況,如果省略了選擇性的部分,程式碼將在當前作用域內執行。如果只提供" +"無論哪種情況,如果省略了選擇性的部分,程式碼將在目前作用域內執行。如果只提供" "了 *globals* 引數,就必須是 dictionary 型別(且不能是 dictionary 的子類別)," "而且會被用作全域和區域變數。如果同時提供了 *globals* 和 *locals*,它們分別被" "用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " @@ -1371,9 +1373,9 @@ msgstr "" #: ../../library/functions.rst:684 msgid "" "If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in module :mod:" -"`builtins` is inserted under that key. That way you can control what " -"builtins are available to the executed code by inserting your own " +"``__builtins__``, a reference to the dictionary of the built-in " +"module :mod:`builtins` is inserted under that key. That way you can control " +"what builtins are available to the executed code by inserting your own " "``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." msgstr "" "如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內" @@ -1399,7 +1401,7 @@ msgid "" "global and local namespace, respectively, which may be useful to pass around " "for use as the second and third argument to :func:`exec`." msgstr "" -"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," +"內建 :func:`globals` 和 :func:`locals` 函式各自回傳目前的全域和區域命名空間," "因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" #: ../../library/functions.rst:709 @@ -1408,9 +1410,9 @@ msgid "" "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" -"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " -"dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想" +"在 :func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 " +"*locals* dictionary 。" #: ../../library/functions.rst:713 msgid "Added the *closure* parameter." @@ -1510,9 +1512,9 @@ msgstr "" #: ../../library/functions.rst:796 msgid "" -"For a general Python object ``x``, ``float(x)`` delegates to ``x." -"__float__()``. If :meth:`~object.__float__` is not defined then it falls " -"back to :meth:`~object.__index__`." +"For a general Python object ``x``, ``float(x)`` delegates to " +"``x.__float__()``. If :meth:`~object.__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" @@ -1540,8 +1542,8 @@ msgid "" "is used by most built-in types: :ref:`formatspec`." msgstr "" "將 *value* 轉換為 *format_spec* 控制的 \"格式化\" 表示。*format_spec* 的解釋" -"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" -"`formatspec`。" +"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語" +"法::ref:`formatspec`。" #: ../../library/functions.rst:825 msgid "" @@ -1553,12 +1555,12 @@ msgstr "" #: ../../library/functions.rst:828 msgid "" -"A call to ``format(value, format_spec)`` is translated to ``type(value)." -"__format__(value, format_spec)`` which bypasses the instance dictionary when " -"searching for the value's :meth:`~object.__format__` method. A :exc:" -"`TypeError` exception is raised if the method search reaches :mod:`object` " -"and the *format_spec* is non-empty, or if either the *format_spec* or the " -"return value are not strings." +"A call to ``format(value, format_spec)`` is translated to " +"``type(value).__format__(value, format_spec)`` which bypasses the instance " +"dictionary when searching for the value's :meth:`~object.__format__` method. " +"A :exc:`TypeError` exception is raised if the method search " +"reaches :mod:`object` and the *format_spec* is non-empty, or if either the " +"*format_spec* or the return value are not strings." msgstr "" "呼叫 ``format(value, format_spec)`` 會轉換成 ``type(value).__format__(value, " "format_spec)``,當搜尋 value 的 :meth:`~object.__format__` method 時,會忽略" @@ -1570,23 +1572,24 @@ msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." msgstr "" -"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" -"exc:`TypeError`。" +"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引" +"發 :exc:`TypeError`。" #: ../../library/functions.rst:844 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" -"ref:`types-set` for documentation about this class." +"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " +"and :ref:`types-set` for documentation about this class." msgstr "" "回傳一個新的 :class:`frozenset` 物件,它包含選擇性引數 *iterable* 中的元素。" -"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" -"`frozenset` 和 :ref:`types-set`。" +"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參" +"閱 :class:`frozenset` 和 :ref:`types-set`。" #: ../../library/functions.rst:848 msgid "" -"For other containers see the built-in :class:`set`, :class:`list`, :class:" -"`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." +"For other containers see the built-" +"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " +"as well as the :mod:`collections` module." msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" @@ -1602,16 +1605,16 @@ msgid "" msgstr "" "回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名" "稱,則回傳該屬性的值。例如,``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如" -"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引發 :exc:" -"`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" -"`setattr`)。" +"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引" +"發 :exc:`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請" +"見 :func:`setattr`)。" #: ../../library/functions.rst:865 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it with :func:" -"`getattr`." +"with two leading underscores) name in order to retrieve it " +"with :func:`getattr`." msgstr "" "由於\\ :ref:`私有名稱改編 (private name mangling) ` 是" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" @@ -1623,7 +1626,7 @@ msgid "" "within functions, this is set when the function is defined and remains the " "same regardless of where the function is called." msgstr "" -"回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" +"回傳代表目前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" #: ../../library/functions.rst:880 @@ -1650,8 +1653,9 @@ msgstr "" #: ../../library/functions.rst:895 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note that :func:" -"`hash` truncates the return value based on the bit width of the host machine." +"For objects with custom :meth:`~object.__hash__` methods, note " +"that :func:`hash` truncates the return value based on the bit width of the " +"host machine." msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" @@ -1667,7 +1671,7 @@ msgid "" msgstr "" "啟動內建的幫助系統(此函式主要以互動式使用)。如果沒有引數,直譯器控制台裡會" "啟動互動式幫助系統。如果引數是一個字串,則會在 module、函式、class、method、" -"關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" +"關鍵字或說明文件主題中搜尋該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" #: ../../library/functions.rst:909 @@ -1697,12 +1701,12 @@ msgstr "" #: ../../library/functions.rst:923 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " -"\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" -"meth:`~object.__index__` method that returns an integer. Some examples:" +"\"0x\". If *x* is not a Python :class:`int` object, it has to define " +"an :meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" -"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 Python :" -"class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" -"個整數。舉例來說:" +"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 " +"Python :class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並" +"且回傳一個整數。舉例來說:" #: ../../library/functions.rst:932 msgid "" @@ -1721,10 +1725,10 @@ msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基 #: ../../library/functions.rst:949 msgid "" -"To obtain a hexadecimal string representation for a float, use the :meth:" -"`float.hex` method." +"To obtain a hexadecimal string representation for a float, use " +"the :meth:`float.hex` method." msgstr "" -"如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" +"如果要取得浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" #: ../../library/functions.rst:955 msgid "" @@ -1760,14 +1764,14 @@ msgstr "" #: ../../library/functions.rst:973 msgid "" -">>> s = input('--> ') \n" +">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" -">>> s \n" +">>> s\n" "\"Monty Python's Flying Circus\"" msgstr "" -">>> s = input('--> ') \n" +">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" -">>> s \n" +">>> s\n" "\"Monty Python's Flying Circus\"" #: ../../library/functions.rst:978 @@ -1830,11 +1834,11 @@ msgstr "" #: ../../library/functions.rst:1015 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." -"__int__()``. If the argument defines :meth:`~object.__index__`, it returns " -"``x.__index__()``. If the argument defines :meth:`~object.__trunc__`, it " -"returns ``x.__trunc__()``. For floating-point numbers, this truncates " -"towards zero." +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " +"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " +"returns ``x.__index__()``. If the argument " +"defines :meth:`~object.__trunc__`, it returns ``x.__trunc__()``. For " +"floating-point numbers, this truncates towards zero." msgstr "" "如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。" "如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。如果引數定" @@ -1849,10 +1853,10 @@ msgid "" "``-`` (with no space in between), have leading zeros, be surrounded by " "whitespace, and have single underscores interspersed between digits." msgstr "" -"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` 或 :" -"class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之前可" -"以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" -"數字間有單一底線。" +"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` " +"或 :class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之" +"前可以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、" +"或在數字間有單一底線。" #: ../../library/functions.rst:1027 msgid "" @@ -1882,15 +1886,15 @@ msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" #: ../../library/functions.rst:1040 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has a :" -"meth:`base.__index__ ` method, that method is called to " +"If *base* is not an instance of :class:`int` and the *base* object has " +"a :meth:`base.__index__ ` method, that method is called to " "obtain an integer for the base. Previous versions used :meth:`base.__int__ " "` instead of :meth:`base.__index__ `." msgstr "" "如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " -"` method,則會呼叫該 method 來獲取此進位制所需的整數。以前" -"的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." -"__index__ `。" +"` method,則會呼叫該 method 來取得此進位制所需的整數。以前" +"的版本使用 :meth:`base.__int__ ` 而不" +"是 :meth:`base.__index__ `。" #: ../../library/functions.rst:1050 msgid "The first parameter is now positional-only." @@ -1912,14 +1916,14 @@ msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " "limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See the :" -"ref:`integer string conversion length limitation ` " +"converting an :class:`int` into a string would exceed the limit. See " +"the :ref:`integer string conversion length limitation ` " "documentation." msgstr "" ":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of " -"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是在 :class:" -"`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" -"數字串轉換的長度限制 `\\ 說明文件。" +"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是" +"在 :class:`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱" +"\\ :ref:`整數字串轉換的長度限制 `\\ 說明文件。" #: ../../library/functions.rst:1069 msgid "" @@ -1929,18 +1933,18 @@ msgid "" "the function always returns ``False``. If *classinfo* is a tuple of type " "objects (or recursively, other such tuples) or a :ref:`types-union` of " "multiple types, return ``True`` if *object* is an instance of any of the " -"types. If *classinfo* is not a type or tuple of types and such tuples, a :" -"exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised for " -"an invalid type if an earlier check succeeds." -msgstr "" -"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接或 :term:" -"`virtual `)subclass 的實例,則回傳 ``True``。如果 " -"*object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是包含" -"物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`," -"若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 *classinfo* 既不" -"是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引發 :exc:`TypeError` 異" -"常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引" -"發。" +"types. If *classinfo* is not a type or tuple of types and such tuples, " +"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " +"for an invalid type if an earlier check succeeds." +msgstr "" +"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接" +"或 :term:`virtual `)subclass 的實例,則回傳 ``True``。" +"如果 *object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是" +"包含物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-" +"union`,若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 " +"*classinfo* 既不是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引" +"發 :exc:`TypeError` 異常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因" +"為不合格的型別而被引發。" #: ../../library/functions.rst:1080 ../../library/functions.rst:1094 msgid "*classinfo* can be a :ref:`types-union`." @@ -1948,27 +1952,27 @@ msgstr "*classinfo* 可以是一個 :ref:`types-union`。" #: ../../library/functions.rst:1086 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, or :term:" -"`virtual `) of *classinfo*. A class is considered a " -"subclass of itself. *classinfo* may be a tuple of class objects (or " -"recursively, other such tuples) or a :ref:`types-union`, in which case " +"Return ``True`` if *class* is a subclass (direct, indirect, " +"or :term:`virtual `) of *classinfo*. A class is " +"considered a subclass of itself. *classinfo* may be a tuple of class objects " +"(or recursively, other such tuples) or a :ref:`types-union`, in which case " "return ``True`` if *class* is a subclass of any entry in *classinfo*. In " "any other case, a :exc:`TypeError` exception is raised." msgstr "" "如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual " "`),則回傳 ``True``。*classinfo* 可以是 class 物件的 " "tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* " -"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" -"exc:`TypeError`。" +"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引" +"發 :exc:`TypeError`。" #: ../../library/functions.rst:1101 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " -"second argument, *object* must be a collection object which supports the :" -"term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must " -"support the sequence protocol (the :meth:`~object.__getitem__` method with " -"integer arguments starting at ``0``). If it does not support either of " +"second argument, *object* must be a collection object which supports " +"the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it " +"must support the sequence protocol (the :meth:`~object.__getitem__` method " +"with integer arguments starting at ``0``). If it does not support either of " "those protocols, :exc:`TypeError` is raised. If the second argument, " "*sentinel*, is given, then *object* must be a callable object. The iterator " "created in this case will call *object* with no arguments for each call to " @@ -1977,13 +1981,13 @@ msgid "" "returned." msgstr "" "回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非" -"常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定(有 :" -"meth:`~object.__iter__` method)的集合物件,或必須支援序列協定(有 :meth:" -"`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些協定," -"會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 *object* 必須是可" -"呼叫的物件,這種情況下生成的 iterator,每次疊代呼叫 :meth:`~iterator." -"__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" -"exc:`StopIteration`,否則回傳呼叫結果。" +"常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定" +"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" +"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支" +"援這些協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 " +"*object* 必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" +"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 " +"*sentinel* 則引發 :exc:`StopIteration`,否則回傳呼叫結果。" #: ../../library/functions.rst:1115 msgid "See also :ref:`typeiter`." @@ -2021,8 +2025,8 @@ msgstr "" #: ../../library/functions.rst:1135 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." -"maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger " +"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" @@ -2045,8 +2049,8 @@ msgstr "" #: ../../library/functions.rst:1154 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace as :func:" -"`globals`." +"single namespace, this function returns the same namespace " +"as :func:`globals`." msgstr "" #: ../../library/functions.rst:1158 @@ -2107,10 +2111,10 @@ msgstr "" #: ../../library/functions.rst:1193 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior in :term:" -"`optimized scopes ` is now as described above. Aside from " -"being defined, the behaviour in other scopes remains unchanged from previous " -"versions." +"returned from this function are now defined. The behavior " +"in :term:`optimized scopes ` is now as described above. " +"Aside from being defined, the behaviour in other scopes remains unchanged " +"from previous versions." msgstr "" #: ../../library/functions.rst:1203 @@ -2124,7 +2128,7 @@ msgid "" msgstr "" "產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 " "iterator。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" -"引數,並使用所有從 iterables 中同時獲取的元素。當有多個 iterables 時,最短的 " +"引數,並使用所有從 iterables 中同時取得的元素。當有多個 iterables 時,最短的 " "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" @@ -2148,20 +2152,20 @@ msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " "*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, a :exc:" -"`ValueError` is raised." +"empty. If the iterable is empty and *default* is not provided, " +"a :exc:`ValueError` is raised." msgstr "" "這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" "式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" -"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" -"`ValueError`。" +"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" +"發 :exc:`ValueError`。" #: ../../library/functions.rst:1229 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq." -"nlargest(1, iterable, key=keyfunc)``." +"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " +"``heapq.nlargest(1, iterable, key=keyfunc)``." msgstr "" "如果有多個最大元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 " "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " @@ -2177,8 +2181,8 @@ msgstr "*key* 可以為 ``None``。" #: ../../library/functions.rst:1245 msgid "" -"Return a \"memory view\" object created from the given argument. See :ref:" -"`typememoryview` for more information." +"Return a \"memory view\" object created from the given argument. " +"See :ref:`typememoryview` for more information." msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" @@ -2211,13 +2215,14 @@ msgstr "" #: ../../library/functions.rst:1282 msgid "" -"Retrieve the next item from the :term:`iterator` by calling its :meth:" -"`~iterator.__next__` method. If *default* is given, it is returned if the " -"iterator is exhausted, otherwise :exc:`StopIteration` is raised." +"Retrieve the next item from the :term:`iterator` by calling " +"its :meth:`~iterator.__next__` method. If *default* is given, it is " +"returned if the iterator is exhausted, otherwise :exc:`StopIteration` is " +"raised." msgstr "" -"透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 獲取下一個元" -"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" -"exc:`StopIteration`。" +"透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元" +"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引" +"發 :exc:`StopIteration`。" #: ../../library/functions.rst:1289 msgid "" @@ -2246,8 +2251,8 @@ msgid "" "integer. For example:" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " -"Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" -"`~object.__index__` method 回傳一個整數。舉例來說:" +"Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:1313 msgid "" @@ -2276,7 +2281,7 @@ msgid "" "is set to ``False``.)" msgstr "" "*file* 是一個\\ :term:`類路徑物件 `,是將被開啟之檔案的路徑" -"(絕對路徑或當前工作目錄的相對路徑),或是要被包裝 (wrap) 檔案的整數檔案描述" +"(絕對路徑或目前工作目錄的相對路徑),或是要被包裝 (wrap) 檔案的整數檔案描述" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" @@ -2288,18 +2293,18 @@ msgid "" "already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-dependent: :func:" -"`locale.getencoding` is called to get the current locale encoding. (For " -"reading and writing raw bytes use binary mode and leave *encoding* " -"unspecified.) The available modes are:" +"*encoding* is not specified the encoding used is platform-" +"dependent: :func:`locale.getencoding` is called to get the current locale " +"encoding. (For reading and writing raw bytes use binary mode and leave " +"*encoding* unspecified.) The available modes are:" msgstr "" "*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" "以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" "案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論" -"當前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" -"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 :func:`locale." -"getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" -"式且不要指定 *encoding*。)可用的模式有:" +"目前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" +"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼" +"叫 :func:`locale.getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 " +"bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" #: ../../library/functions.rst:1357 msgid "Character" @@ -2429,9 +2434,9 @@ msgid "" "systems, the buffer will typically be 4096 or 8192 bytes long." msgstr "" "二進制檔案會以固定大小的區塊進行緩衝;緩衝區的大小是使用啟發式嘗試 " -"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退到 :attr:`io." -"DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" -"組。" +"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退" +"到 :attr:`io.DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 " +"8192 個位元組。" #: ../../library/functions.rst:1401 msgid "" @@ -2460,8 +2465,9 @@ msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " "standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered with :func:`codecs." -"register_error` is also valid. The standard names include:" +"though any error handling name that has been registered " +"with :func:`codecs.register_error` is also valid. The standard names " +"include:" msgstr "" "*errors* 是一個選擇性的字串,用於指定要如何處理編碼和解碼的錯誤——它不能在二進" "制模式下使用。有許多不同的標準錯誤處理程式(error handler,在\\ :ref:`error-" @@ -2555,10 +2561,10 @@ msgstr "" #: ../../library/functions.rst:1463 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line separator, :" -"data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation " -"takes place. If *newline* is any of the other legal values, any ``'\\n'`` " -"characters written are translated to the given string." +"characters written are translated to the system default line " +"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " +"translation takes place. If *newline* is any of the other legal values, any " +"``'\\n'`` characters written are translated to the given string." msgstr "" "將輸出寫入資料串流時,如果 *newline* 是 ``None``,則被寫入的任何 ``'\\n'`` 字" "元都會轉換為系統預設的行分隔符號 :data:`os.linesep`。如果 *newline* 是 " @@ -2595,8 +2601,8 @@ msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" #: ../../library/functions.rst:1482 msgid "" -"The following example uses the :ref:`dir_fd ` parameter of the :func:" -"`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of " +"the :func:`os.open` function to open a file relative to a given directory::" msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" @@ -2618,35 +2624,35 @@ msgstr "" msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :" -"class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used " -"to open a file in a binary mode with buffering, the returned class is a " +"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " +"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " +"used to open a file in a binary mode with buffering, the returned class is a " "subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " "binary mode, it returns an :class:`io.BufferedReader`; in write binary and " "append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" "write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io." -"FileIO`, is returned." +"disabled, the raw stream, a subclass " +"of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." msgstr "" ":func:`open` 函式回傳的 :term:`file object` 型別取決於模式。當 :func:`open` " "是在文字模式中開啟檔案時(``'w'``、``'r'``、``'wt'``、``'rt'`` 等),它會回" -"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就是 :class:`io." -"TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 class 則會是 :" -"class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:在讀取的二進制" -"模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制模式,它會回" -"傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回傳 :class:`io." -"BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" -"是 :class:`io.RawIOBase` 的一個 subclass。" +"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就" +"是 :class:`io.TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 " +"class 則會是 :class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:" +"在讀取的二進制模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制" +"模式,它會回傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回" +"傳 :class:`io.BufferedRandom`。當緩衝被停用時,會回傳原始資料串" +"流 :class:`io.FileIO`,它是 :class:`io.RawIOBase` 的一個 subclass。" #: ../../library/functions.rst:1516 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" -"`tempfile`, and :mod:`shutil`." +"(where :func:`open` is " +"declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." msgstr "" -"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義了 :func:" -"`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" -"`shutil`。" +"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義" +"了 :func:`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以" +"及 :mod:`shutil`。" #: ../../library/functions.rst:1520 msgid "" @@ -2679,8 +2685,8 @@ msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." msgstr "" -"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" -"`FileExistsError`。" +"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引" +"發 :exc:`FileExistsError`。" #: ../../library/functions.rst:1535 msgid "The file is now non-inheritable." @@ -2689,8 +2695,8 @@ msgstr "檔案在此版本開始是不可繼承的。" #: ../../library/functions.rst:1539 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising an :" -"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the function now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" @@ -2705,8 +2711,8 @@ msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" #: ../../library/functions.rst:1547 msgid "" -"On Windows, opening a console buffer may return a subclass of :class:`io." -"RawIOBase` other than :class:`io.FileIO`." +"On Windows, opening a console buffer may return a subclass " +"of :class:`io.RawIOBase` other than :class:`io.FileIO`." msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" @@ -2747,9 +2753,9 @@ msgid "" "2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " "base of type :class:`int` or :class:`float` and a non-integral exponent, a " "complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:" -"`float` with an integral exponent, a float result is delivered. For example, " -"``pow(-9, 2.0)`` returns ``81.0``." +"close to ``3j``. Whereas, for a negative base of type :class:`int` " +"or :class:`float` with an integral exponent, a float result is delivered. " +"For example, ``pow(-9, 2.0)`` returns ``81.0``." msgstr "" "引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" @@ -2757,9 +2763,9 @@ msgstr "" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" "數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " -"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:" -"`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " -"會回傳 ``81.0``。" +"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` " +"或 :class:`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 " +"``pow(-9, 2.0)`` 會回傳 ``81.0``。" #: ../../library/functions.rst:1580 msgid "" @@ -2903,19 +2909,19 @@ msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." msgstr "" -"如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " -"value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" +"如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會叫用取得器 (getter),``c.x = " +"value`` 會呼叫設定器 (setter),而 ``del c.x`` 會叫用刪除器 (deleter)。" #: ../../library/functions.rst:1656 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as a :" -"term:`decorator`::" +"possible to create read-only properties easily using :func:`property` as " +"a :term:`decorator`::" msgstr "" "如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 " -"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" -"`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" +"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使" +"用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" #: ../../library/functions.rst:1660 msgid "" @@ -3046,10 +3052,10 @@ msgstr "" #: ../../library/functions.rst:1754 msgid "" -"Return a reverse :term:`iterator`. *seq* must be an object which has a :" -"meth:`~object.__reversed__` method or supports the sequence protocol (the :" -"meth:`~object.__len__` method and the :meth:`~object.__getitem__` method " -"with integer arguments starting at ``0``)." +"Return a reverse :term:`iterator`. *seq* must be an object which has " +"a :meth:`~object.__reversed__` method or supports the sequence protocol " +"(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " +"method with integer arguments starting at ``0``)." msgstr "" #: ../../library/functions.rst:1762 @@ -3072,8 +3078,8 @@ msgstr "" #: ../../library/functions.rst:1775 msgid "" -"For a general Python object ``number``, ``round`` delegates to ``number." -"__round__``." +"For a general Python object ``number``, ``round`` delegates to " +"``number.__round__``." msgstr "" #: ../../library/functions.rst:1780 @@ -3094,9 +3100,9 @@ msgstr "" #: ../../library/functions.rst:1796 msgid "" -"For other containers see the built-in :class:`frozenset`, :class:`list`, :" -"class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " -"module." +"For other containers see the built-" +"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " +"classes, as well as the :mod:`collections` module." msgstr "" #: ../../library/functions.rst:1803 @@ -3111,10 +3117,10 @@ msgstr "" #: ../../library/functions.rst:1809 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a custom :meth:" -"`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute " -"whose name is not an identifier will not be accessible using the dot " -"notation, but is accessible through :func:`getattr` etc.." +"unless the object chooses to enforce that, for example in a " +"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " +"attribute whose name is not an identifier will not be accessible using the " +"dot notation, but is accessible through :func:`getattr` etc.." msgstr "" #: ../../library/functions.rst:1817 @@ -3142,14 +3148,16 @@ msgstr "" #: ../../library/functions.rst:1839 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" -"`itertools.islice` for an alternate version that returns an :term:`iterator`." +"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " +"See :func:`itertools.islice` for an alternate version that returns " +"an :term:`iterator`." msgstr "" #: ../../library/functions.rst:1844 msgid "" -"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" -"`~slice.stop`, and :attr:`~slice.step` are hashable)." +"Slice objects are now :term:`hashable` " +"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " +"are hashable)." msgstr "" #: ../../library/functions.rst:1850 @@ -3164,8 +3172,9 @@ msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" #: ../../library/functions.rst:1854 msgid "" "*key* specifies a function of one argument that is used to extract a " -"comparison key from each element in *iterable* (for example, ``key=str." -"lower``). The default value is ``None`` (compare the elements directly)." +"comparison key from each element in *iterable* (for example, " +"``key=str.lower``). The default value is ``None`` (compare the elements " +"directly)." msgstr "" #: ../../library/functions.rst:1858 @@ -3227,8 +3236,8 @@ msgstr "" #: ../../library/functions.rst:1891 msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@staticmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" @@ -3236,9 +3245,9 @@ msgstr "" #: ../../library/functions.rst:1894 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static method :term:" -"`descriptor` is also callable, so it can be used in the class definition " -"(such as ``f()``)." +"an instance (such as ``C().f()``). Moreover, the static " +"method :term:`descriptor` is also callable, so it can be used in the class " +"definition (such as ``f()``)." msgstr "" #: ../../library/functions.rst:1899 @@ -3277,15 +3286,15 @@ msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" #: ../../library/functions.rst:1917 msgid "" -"Static methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " -"``__wrapped__`` attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` " +"attribute, and are now callable as regular functions." msgstr "" -"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" +"Static method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性," +"且為如一般函式的可呼叫物件。" #: ../../library/functions.rst:1933 msgid "" @@ -3308,10 +3317,10 @@ msgstr "" #: ../../library/functions.rst:1945 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling ``''." -"join(sequence)``. To add floating-point values with extended precision, " -"see :func:`math.fsum`\\. To concatenate a series of iterables, consider " -"using :func:`itertools.chain`." +"preferred, fast way to concatenate a sequence of strings is by calling " +"``''.join(sequence)``. To add floating-point values with extended " +"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " +"consider using :func:`itertools.chain`." msgstr "" #: ../../library/functions.rst:1951 @@ -3339,17 +3348,17 @@ msgstr "" #: ../../library/functions.rst:1969 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" -"> A -> object`` and the value of *type* is ``B``, then :func:`super` " +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " +"-> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" #: ../../library/functions.rst:1973 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " -"*object_or_type* lists the method resolution search order used by both :func:" -"`getattr` and :func:`super`. The attribute is dynamic and can change " -"whenever the inheritance hierarchy is updated." +"*object_or_type* lists the method resolution search order used by " +"both :func:`getattr` and :func:`super`. The attribute is dynamic and can " +"change whenever the inheritance hierarchy is updated." msgstr "" #: ../../library/functions.rst:1978 @@ -3432,9 +3441,9 @@ msgstr "" #: ../../library/functions.rst:2031 msgid "" -"For practical suggestions on how to design cooperative classes using :func:" -"`super`, see `guide to using super() `_." +"For practical suggestions on how to design cooperative classes " +"using :func:`super`, see `guide to using super() `_." msgstr "" #: ../../library/functions.rst:2041 @@ -3446,8 +3455,8 @@ msgstr "" #: ../../library/functions.rst:2050 msgid "" "With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned by :attr:`object." -"__class__`." +"type object and generally the same object as returned " +"by :attr:`object.__class__`." msgstr "" #: ../../library/functions.rst:2054 @@ -3464,9 +3473,9 @@ msgid "" "tuple contains the base classes and becomes the :attr:`~type.__bases__` " "attribute; if empty, :class:`object`, the ultimate base of all classes, is " "added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming the :attr:`~type." -"__dict__` attribute. The following two statements create identical :class:`!" -"type` objects:" +"the class body; it may be copied or wrapped before becoming " +"the :attr:`~type.__dict__` attribute. The following two statements create " +"identical :class:`!type` objects:" msgstr "" #: ../../library/functions.rst:2072 @@ -3509,10 +3518,11 @@ msgstr "" #: ../../library/functions.rst:2094 msgid "" -"Objects such as modules and instances have an updateable :attr:`~object." -"__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." -"MappingProxyType` to prevent direct dictionary updates)." +"Objects such as modules and instances have an " +"updateable :attr:`~object.__dict__` attribute; however, other objects may " +"have write restrictions on their :attr:`!__dict__` attributes (for example, " +"classes use a :class:`types.MappingProxyType` to prevent direct dictionary " +"updates)." msgstr "" #: ../../library/functions.rst:2099 @@ -3567,15 +3577,15 @@ msgstr "" #: ../../library/functions.rst:2128 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"columns into rows. This is similar to `transposing a matrix `_." msgstr "" #: ../../library/functions.rst:2132 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" -"`list`." +"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " +"a :class:`list`." msgstr "" #: ../../library/functions.rst:2136 @@ -3632,8 +3642,8 @@ msgstr "" #: ../../library/functions.rst:2177 msgid "" "Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done by :func:`itertools." -"zip_longest`." +"iterables have the same length. This is done " +"by :func:`itertools.zip_longest`." msgstr "" #: ../../library/functions.rst:2181 @@ -3913,29 +3923,3 @@ msgstr "import(引入)" #: ../../library/functions.rst:2209 msgid "builtins" msgstr "builtins(內建)" - -#~ msgid "" -#~ "Most users should just pass a *globals* argument and never *locals*. If " -#~ "exec gets two separate objects as *globals* and *locals*, the code will " -#~ "be executed as if it were embedded in a class definition." -#~ msgstr "" -#~ "大部分使用者只需要傳入 *globals* 引數,而不用傳遞 *locals*。如果 exec 有" -#~ "兩個不同的 *globals* 和 *locals* 物件,程式碼就像嵌入在 class 定義中一樣執" -#~ "行。" - -#~ msgid "" -#~ "Update and return a dictionary representing the current local symbol " -#~ "table. Free variables are returned by :func:`locals` when it is called in " -#~ "function blocks, but not in class blocks. Note that at the module level, :" -#~ "func:`locals` and :func:`globals` are the same dictionary." -#~ msgstr "" -#~ "更新並回傳表示當前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" -#~ "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:" -#~ "`locals` 和 :func:`globals` 是相同的 dictionary。" - -#~ msgid "" -#~ "The contents of this dictionary should not be modified; changes may not " -#~ "affect the values of local and free variables used by the interpreter." -#~ msgstr "" -#~ "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自" -#~ "由變數的值。" diff --git a/library/gc.po b/library/gc.po index dd5103866b..78ce3ab4e8 100644 --- a/library/gc.po +++ b/library/gc.po @@ -101,7 +101,7 @@ msgstr "" #: ../../library/gc.rst:66 msgid "Return the debugging flags currently set." -msgstr "回傳當前設置的除錯旗標。" +msgstr "回傳目前設置的除錯旗標。" #: ../../library/gc.rst:71 msgid "" @@ -191,14 +191,14 @@ msgstr "" msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." -msgstr "將當前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" +msgstr "將目前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" #: ../../library/gc.rst:127 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" -"將當前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" +"將目前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" #: ../../library/gc.rst:133 msgid "" @@ -218,7 +218,7 @@ msgid "" "call :func:`collect` before calling :func:`get_referrers`." msgstr "" "需要注意的是,已經解除參照的物件,但仍存在於參照迴圈中未被回收時,該物件仍然" -"會被作為參照者出現在回傳的 list 中。若只要獲取當前正在參照的物件,需要在呼" +"會被作為參照者出現在回傳的 list 中。若只要取得目前正在參照的物件,需要在呼" "叫 :func:`get_referrers` 之前呼叫 :func:`collect`。" #: ../../library/gc.rst:144 @@ -252,9 +252,9 @@ msgid "" "object may or may not appear in the result list." msgstr "" "回傳包含被任意一個引數直接參照之物件的 list。回傳的被參照物件是有被引數的 C " -"語言級別 :c:member:`~PyTypeObject.tp_traverse` 方法(若存在)訪問到的物件,可" +"語言級別 :c:member:`~PyTypeObject.tp_traverse` 方法(若存在)瀏覽到的物件,可" "能不是所有的實際直接可達物件。只有支援垃圾回收的物件支援 :c:member:" -"`~PyTypeObject.tp_traverse` 方法,並且此方法只會訪問涉及參照迴圈的物件。因" +"`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈的物件。因" "此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" "或不出現在結果的 list 當中。" @@ -429,7 +429,7 @@ msgid "" "after collection. The callbacks will be called with two arguments, *phase* " "and *info*." msgstr "" -"會被垃圾回收器在回收開始前和完成後呼叫的一系列回呼函式 (callback) 。這些回呼" +"會被垃圾回收器在回收開始前和完成後叫用的一系列回呼函式 (callback) 。這些回呼" "函式在被呼叫時附帶兩個引數:*phase* 和 *info*。" #: ../../library/gc.rst:271 diff --git a/library/getopt.po b/library/getopt.po index 8ec79f09ad..f9d84aca9d 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,22 +25,16 @@ msgstr ":mod:`!getopt` --- 用於命令列選項的 C 風格剖析器" msgid "**Source code:** :source:`Lib/getopt.py`" msgstr "**原始碼:**\\ :source:`Lib/getopt.py`" -#: ../../library/getopt.rst:10 +#: ../../library/getopt.rst:12 msgid "" -"The :mod:`getopt` module is :term:`soft deprecated` and will not be " -"developed further; development will continue with the :mod:`argparse` module." +"This module is considered feature complete. A more declarative and " +"extensible alternative to this API is provided in the :mod:`optparse` " +"module. Further functional enhancements for command line parameter " +"processing are provided either as third party modules on PyPI, or else as " +"features in the :mod:`argparse` module." msgstr "" -#: ../../library/getopt.rst:17 -msgid "" -"The :mod:`getopt` module is a parser for command line options whose API is " -"designed to be familiar to users of the C :c:func:`!getopt` function. Users " -"who are unfamiliar with the C :c:func:`!getopt` function or who would like " -"to write less code and get better help and error messages should consider " -"using the :mod:`argparse` module instead." -msgstr "" - -#: ../../library/getopt.rst:25 +#: ../../library/getopt.rst:20 msgid "" "This module helps scripts to parse the command line arguments in ``sys." "argv``. It supports the same conventions as the Unix :c:func:`!getopt` " @@ -49,11 +43,21 @@ msgid "" "be used as well via an optional third argument." msgstr "" -#: ../../library/getopt.rst:31 -msgid "This module provides two functions and an exception:" +#: ../../library/getopt.rst:26 +msgid "" +"Users who are unfamiliar with the Unix :c:func:`!getopt` function should " +"consider using the :mod:`argparse` module instead. Users who are familiar " +"with the Unix :c:func:`!getopt` function, but would like to get equivalent " +"behavior while writing less code and getting better help and error messages " +"should consider using the :mod:`optparse` module. See :ref:`choosing-an-" +"argument-parser` for additional details." msgstr "" -#: ../../library/getopt.rst:37 +#: ../../library/getopt.rst:33 +msgid "This module provides two functions and an exception:" +msgstr "這個模組提供兩個函式和一個例外:" + +#: ../../library/getopt.rst:39 msgid "" "Parses command line options and parameter list. *args* is the argument list " "to be parsed, without the leading reference to the running program. " @@ -63,14 +67,14 @@ msgid "" "func:`!getopt` uses)." msgstr "" -#: ../../library/getopt.rst:45 +#: ../../library/getopt.rst:47 msgid "" "Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " "arguments are considered also non-options. This is similar to the way non-" "GNU Unix systems work." msgstr "" -#: ../../library/getopt.rst:49 +#: ../../library/getopt.rst:51 msgid "" "*longopts*, if specified, must be a list of strings with the names of the " "long options which should be supported. The leading ``'--'`` characters " @@ -84,7 +88,7 @@ msgid "" "uniquely, so :exc:`GetoptError` will be raised." msgstr "" -#: ../../library/getopt.rst:60 +#: ../../library/getopt.rst:62 msgid "" "The return value consists of two elements: the first is a list of ``(option, " "value)`` pairs; the second is the list of program arguments left after the " @@ -97,7 +101,7 @@ msgid "" "occurrences. Long and short options may be mixed." msgstr "" -#: ../../library/getopt.rst:73 +#: ../../library/getopt.rst:75 msgid "" "This function works like :func:`getopt`, except that GNU style scanning mode " "is used by default. This means that option and non-option arguments may be " @@ -105,14 +109,14 @@ msgid "" "a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:78 +#: ../../library/getopt.rst:80 msgid "" "If the first character of the option string is ``'+'``, or if the " "environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " "processing stops as soon as a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:85 +#: ../../library/getopt.rst:87 msgid "" "This is raised when an unrecognized option is found in the argument list or " "when an option requiring an argument is given none. The argument to the " @@ -123,15 +127,15 @@ msgid "" "which the exception relates, :attr:`!opt` is an empty string." msgstr "" -#: ../../library/getopt.rst:96 +#: ../../library/getopt.rst:98 msgid "Alias for :exc:`GetoptError`; for backward compatibility." -msgstr "" +msgstr "為了向後相容性而設的 :exc:`GetoptError` 別名。" -#: ../../library/getopt.rst:98 +#: ../../library/getopt.rst:100 msgid "An example using only Unix style options:" -msgstr "" +msgstr "一個僅使用 Unix 風格選項的範例:" -#: ../../library/getopt.rst:100 +#: ../../library/getopt.rst:102 msgid "" ">>> import getopt\n" ">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" @@ -153,11 +157,11 @@ msgstr "" ">>> args\n" "['a1', 'a2']" -#: ../../library/getopt.rst:112 +#: ../../library/getopt.rst:114 msgid "Using long option names is equally easy:" -msgstr "" +msgstr "使用長選項名稱同樣容易:" -#: ../../library/getopt.rst:114 +#: ../../library/getopt.rst:116 msgid "" ">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" ">>> args = s.split()\n" @@ -185,11 +189,11 @@ msgstr "" ">>> args\n" "['a1', 'a2']" -#: ../../library/getopt.rst:127 +#: ../../library/getopt.rst:129 msgid "In a script, typical usage is something like this:" -msgstr "" +msgstr "在腳本中,典型的用法如下:" -#: ../../library/getopt.rst:129 +#: ../../library/getopt.rst:131 msgid "" "import getopt, sys\n" "\n" @@ -215,7 +219,7 @@ msgid "" " output = a\n" " else:\n" " assert False, \"unhandled option\"\n" -" # ...\n" +" process(args, output=output, verbose=verbose)\n" "\n" "if __name__ == \"__main__\":\n" " main()" @@ -243,35 +247,87 @@ msgstr "" " output = a\n" " else:\n" " assert False, \"unhandled option\"\n" -" # ...\n" +" process(args, output=output, verbose=verbose)\n" "\n" "if __name__ == \"__main__\":\n" " main()" -#: ../../library/getopt.rst:158 +#: ../../library/getopt.rst:160 msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" -"`argparse` module:" +"`optparse` module:" msgstr "" -#: ../../library/getopt.rst:161 +#: ../../library/getopt.rst:163 msgid "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" +msgstr "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" + +#: ../../library/getopt.rst:174 +msgid "" +"A roughly equivalent command line interface for this case can also be " +"produced by using the :mod:`argparse` module:" +msgstr "" + +#: ../../library/getopt.rst:177 +msgid "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" +msgstr "" "import argparse\n" "\n" "if __name__ == '__main__':\n" " parser = argparse.ArgumentParser()\n" " parser.add_argument('-o', '--output')\n" " parser.add_argument('-v', dest='verbose', action='store_true')\n" +" parser.add_argument('rest', nargs='*')\n" " args = parser.parse_args()\n" -" # ... do something with args.output ...\n" -" # ... do something with args.verbose .." +" process(args.rest, output=args.output, verbose=args.verbose)" + +#: ../../library/getopt.rst:189 +msgid "" +"See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` " +"version of this code differs in behaviour from the ``optparse`` (and " +"``getopt``) version." msgstr "" +"參見 :ref:`choosing-an-argument-parser` 以瞭解這段程式碼的 ``argparse`` 版本" +"與 ``optparse``\\(以及 ``getopt``)版本在行為上的差異。" + +#: ../../library/getopt.rst:195 +msgid "Module :mod:`optparse`" +msgstr ":mod:`optparse` 模組" + +#: ../../library/getopt.rst:196 +msgid "Declarative command line option parsing." +msgstr "宣告式命令列選項剖析。" -#: ../../library/getopt.rst:175 +#: ../../library/getopt.rst:198 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` 模組" -#: ../../library/getopt.rst:176 -msgid "Alternative command line option and argument parsing library." +#: ../../library/getopt.rst:199 +msgid "More opinionated command line option and argument parsing library." msgstr "" diff --git a/library/getpass.po b/library/getpass.po index afd4253883..5762de3fea 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -61,8 +61,8 @@ msgstr "" #: ../../library/getpass.rst:28 msgid "" "If echo free input is unavailable getpass() falls back to printing a warning " -"message to *stream* and reading from ``sys.stdin`` and issuing a :exc:" -"`GetPassWarning`." +"message to *stream* and reading from ``sys.stdin`` and issuing " +"a :exc:`GetPassWarning`." msgstr "" "如果無回音輸入 (echo-free input) 無法使用則 getpass() 將回退為印出一條警告訊" "息到 *stream*,並從 ``sys.stdin`` 讀取且同時發出 :exc:`GetPassWarning`。" @@ -84,18 +84,18 @@ msgid "Return the \"login name\" of the user." msgstr "回傳使用者的\"登入名稱\"。" #: ../../library/getpass.rst:45 -#, fuzzy msgid "" -"This function checks the environment variables :envvar:`LOGNAME`, :envvar:" -"`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the " -"value of the first one which is set to a non-empty string. If none are set, " -"the login name from the password database is returned on systems which " -"support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." +"This function checks the environment " +"variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` " +"and :envvar:`USERNAME`, in order, and returns the value of the first one " +"which is set to a non-empty string. If none are set, the login name from " +"the password database is returned on systems which support the :mod:`pwd` " +"module, otherwise, an :exc:`OSError` is raised." msgstr "" "此函式會按順序檢查環境變數 :envvar:`LOGNAME`、:envvar:`USER`、:envvar:`!" "LNAME` 和 :envvar:`USERNAME`,並回傳其中第一個被設定成非空字串的值。如果均未" "設定,則在支援 :mod:`pwd` 模組的系統上將會回傳來自密碼資料庫的登入名稱,否則" -"將引發一個例外。" +"將引發一個 :exc:`OSError` 例外。" #: ../../library/getpass.rst:52 msgid "In general, this function should be preferred over :func:`os.getlogin`." @@ -103,4 +103,4 @@ msgstr "大部分情況下,此函式應該要比 :func:`os.getlogin` 優先使 #: ../../library/getpass.rst:54 msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." -msgstr "" +msgstr "在過去,除了 :exc:`OSError` 外還會引發各種例外。" diff --git a/library/glob.po b/library/glob.po index 287f0efe19..610ddefb58 100644 --- a/library/glob.po +++ b/library/glob.po @@ -39,7 +39,7 @@ msgstr "" ":mod:`glob` 模組根據 Unix shell 使用的規則查找與指定模式匹配的所有路徑名稱," "結果以任意順序回傳。沒有波浪號 (tilde) 擴展,但是 ``*``、``?`` 和用 ``[]`` 表" "示的字元範圍將被正確匹配。這是透過同時使用 :func:`os.scandir` 和 :func:" -"`fnmatch.fnmatch` 函式來完成的,而沒有實際調用 subshell。" +"`fnmatch.fnmatch` 函式來完成的,而沒有實際呼叫 subshell。" #: ../../library/glob.rst:28 msgid "" @@ -89,8 +89,8 @@ msgid "" "func:`glob` as changing the current directory before calling it. If " "*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" -"如果 *root_dir* 不是 ``None``,它應該是一個指定搜索根目錄的 :term:`path-like " -"object`。它在呼叫它之前更改當前目錄的影響與 :func:`glob` 相同。如果 " +"如果 *root_dir* 不是 ``None``,它應該是一個指定搜尋根目錄的 :term:`path-like " +"object`。它在呼叫它之前更改目前目錄的影響與 :func:`glob` 相同。如果 " "*pathname* 是相對的,結果將包含相對於 *root_dir* 的路徑。" #: ../../library/glob.rst:58 diff --git a/library/gzip.po b/library/gzip.po index d2643f46da..80147ac8e0 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-26 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,7 +105,7 @@ msgstr "" msgid "Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes." msgstr "新增 ``'x'``、``'xb'`` 和 ``'xt'`` 模式的支援。" -#: ../../library/gzip.rst:59 ../../library/gzip.rst:175 +#: ../../library/gzip.rst:59 ../../library/gzip.rst:173 msgid "Accepts a :term:`path-like object`." msgstr "接受\\ :term:`類路徑物件 `。" @@ -201,27 +201,26 @@ msgstr ":class:`GzipFile` 也提供了以下的方法和屬性:" #: ../../library/gzip.rst:124 msgid "" -"Read *n* uncompressed bytes without advancing the file position. At most one " -"single read on the compressed stream is done to satisfy the call. The " -"number of bytes returned may be more or less than requested." +"Read *n* uncompressed bytes without advancing the file position. The number " +"of bytes returned may be more or less than requested." msgstr "" -#: ../../library/gzip.rst:129 +#: ../../library/gzip.rst:127 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`GzipFile`, it may change the position of the underlying file object (e.g. " "if the :class:`GzipFile` was constructed with the *fileobj* parameter)." msgstr "" -#: ../../library/gzip.rst:138 +#: ../../library/gzip.rst:136 msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" -#: ../../library/gzip.rst:140 +#: ../../library/gzip.rst:138 msgid "In previous versions it was an integer ``1`` or ``2``." msgstr "" -#: ../../library/gzip.rst:145 +#: ../../library/gzip.rst:143 msgid "" "When decompressing, this attribute is set to the last timestamp in the most " "recently read header. It is an integer, holding the number of seconds since " @@ -229,62 +228,62 @@ msgid "" "reading any headers is ``None``." msgstr "" -#: ../../library/gzip.rst:152 +#: ../../library/gzip.rst:150 msgid "" "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " "Equivalent to the output of :func:`os.fspath` on the original input path, " "with no other normalization, resolution or expansion." msgstr "" -#: ../../library/gzip.rst:156 +#: ../../library/gzip.rst:154 msgid "" "Support for the :keyword:`with` statement was added, along with the *mtime* " "constructor argument and :attr:`mtime` attribute." msgstr "" -#: ../../library/gzip.rst:160 +#: ../../library/gzip.rst:158 msgid "Support for zero-padded and unseekable files was added." msgstr "" -#: ../../library/gzip.rst:163 +#: ../../library/gzip.rst:161 msgid "The :meth:`io.BufferedIOBase.read1` method is now implemented." msgstr ":meth:`io.BufferedIOBase.read1` 方法現在已有實作。" -#: ../../library/gzip.rst:166 +#: ../../library/gzip.rst:164 msgid "Added support for the ``'x'`` and ``'xb'`` modes." msgstr "新增 ``'x'`` 和 ``'xb'`` 模式的支援。" -#: ../../library/gzip.rst:169 +#: ../../library/gzip.rst:167 msgid "" "Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument " "of ``None``." msgstr "" -#: ../../library/gzip.rst:178 +#: ../../library/gzip.rst:176 msgid "" "Opening :class:`GzipFile` for writing without specifying the *mode* argument " "is deprecated." msgstr "" -#: ../../library/gzip.rst:182 +#: ../../library/gzip.rst:180 msgid "" "Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " "instead." msgstr "" -#: ../../library/gzip.rst:189 +#: ../../library/gzip.rst:187 msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " "the :class:`GzipFile` constructor above." msgstr "" -#: ../../library/gzip.rst:194 +#: ../../library/gzip.rst:192 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -#: ../../library/gzip.rst:196 +#: ../../library/gzip.rst:194 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." @@ -293,13 +292,13 @@ msgid "" "underlying zlib implementation." msgstr "" -#: ../../library/gzip.rst:203 +#: ../../library/gzip.rst:201 msgid "" "The gzip header OS byte is guaranteed to be set to 255 when this function is " "used as was the case in 3.10 and earlier." msgstr "" -#: ../../library/gzip.rst:209 +#: ../../library/gzip.rst:207 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " @@ -308,21 +307,21 @@ msgid "" "*wbits* set to 31 is faster." msgstr "" -#: ../../library/gzip.rst:216 +#: ../../library/gzip.rst:214 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" -#: ../../library/gzip.rst:223 +#: ../../library/gzip.rst:221 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:225 +#: ../../library/gzip.rst:223 msgid "Example of how to read a compressed file::" msgstr "如何讀取壓縮檔案的範例: ::" -#: ../../library/gzip.rst:227 +#: ../../library/gzip.rst:225 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" @@ -332,11 +331,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" -#: ../../library/gzip.rst:231 +#: ../../library/gzip.rst:229 msgid "Example of how to create a compressed GZIP file::" msgstr "如何建立一個壓縮的 GZIP 檔案的範例: ::" -#: ../../library/gzip.rst:233 +#: ../../library/gzip.rst:231 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" @@ -348,11 +347,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" " f.write(content)" -#: ../../library/gzip.rst:238 +#: ../../library/gzip.rst:236 msgid "Example of how to GZIP compress an existing file::" msgstr "如何壓縮一個已存在的檔案的範例: ::" -#: ../../library/gzip.rst:240 +#: ../../library/gzip.rst:238 msgid "" "import gzip\n" "import shutil\n" @@ -366,11 +365,11 @@ msgstr "" " with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" " shutil.copyfileobj(f_in, f_out)" -#: ../../library/gzip.rst:246 +#: ../../library/gzip.rst:244 msgid "Example of how to GZIP compress a binary string::" msgstr "如何壓縮一個二進位字串的範例: ::" -#: ../../library/gzip.rst:248 +#: ../../library/gzip.rst:246 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" @@ -380,56 +379,62 @@ msgstr "" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" -#: ../../library/gzip.rst:254 +#: ../../library/gzip.rst:252 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:255 +#: ../../library/gzip.rst:253 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:264 +#: ../../library/gzip.rst:256 +msgid "" +"In case gzip (de)compression is a bottleneck, the `python-isal`_ package " +"speeds up (de)compression with a mostly compatible API." +msgstr "" + +#: ../../library/gzip.rst:266 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/gzip.rst:266 +#: ../../library/gzip.rst:268 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:269 +#: ../../library/gzip.rst:271 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:273 +#: ../../library/gzip.rst:275 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:277 +#: ../../library/gzip.rst:279 msgid "Command line options" msgstr "命令列選項" -#: ../../library/gzip.rst:281 +#: ../../library/gzip.rst:283 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "如果未指定 *file*,則從 :data:`sys.stdin` 讀取。" -#: ../../library/gzip.rst:285 +#: ../../library/gzip.rst:287 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:289 +#: ../../library/gzip.rst:291 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:293 +#: ../../library/gzip.rst:295 msgid "Decompress the given file." msgstr "解壓縮指定的檔案。" -#: ../../library/gzip.rst:297 +#: ../../library/gzip.rst:299 msgid "Show the help message." msgstr "顯示幫助訊息。" diff --git a/library/hashlib.po b/library/hashlib.po index e7b2a5de94..f2b02c5096 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,42 +29,39 @@ msgstr "**原始碼:**\\ :source:`Lib/hashlib.py`" #: ../../library/hashlib.rst:23 msgid "" -"This module implements a common interface to many different secure hash and " -"message digest algorithms. Included are the FIPS secure hash algorithms " -"SHA1, SHA224, SHA256, SHA384, SHA512, (defined in `the FIPS 180-4 " -"standard`_), the SHA-3 series (defined in `the FIPS 202 standard`_) as well " -"as RSA's MD5 algorithm (defined in internet :rfc:`1321`). The terms " -"\"secure hash\" and \"message digest\" are interchangeable. Older " -"algorithms were called message digests. The modern term is secure hash." +"This module implements a common interface to many different hash algorithms. " +"Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512, " +"(defined in `the FIPS 180-4 standard`_), the SHA-3 series (defined in `the " +"FIPS 202 standard`_) as well as the legacy algorithms SHA1 (`formerly part " +"of FIPS`_) and the MD5 algorithm (defined in internet :rfc:`1321`)." msgstr "" -"該模組實作了許多不同安全雜湊和訊息摘要演算法的通用介面,其中包括 FIPS 安全雜" -"湊演算法 SHA1、SHA224、SHA256、SHA384、SHA512(定義於 `FIPS 180-4 標準 `_)、SHA-3 系列(定義於 `FIPS 202 標準 `_)以及 RSA 的 MD5 演算法(定義於網際網路 :rfc:`1321`)。「安全雜" -"湊 (secure hash)」和「訊息摘要 (message digest)」這兩個術語是可以互換的。較舊" -"的演算法稱為訊息摘要、現代則較常稱之安全雜湊。" +"該模組實作了許多不同雜湊演算法的通用介面,其中包括 FIPS 安全雜湊演算法 SHA1、" +"SHA224、SHA256、SHA384、SHA512(定義於 `FIPS 180-4 標準 `_)、SHA-3 系列(定義於 `FIPS 202 標準 `_)以及遺留的 SHA1 演算法(`先前為 FIPS 的一部分 `_)和 MD5 演算法(定義於網際網路 :rfc:`1321`)。" -#: ../../library/hashlib.rst:33 +#: ../../library/hashlib.rst:31 msgid "" -"If you want the adler32 or crc32 hash functions, they are available in the :" -"mod:`zlib` module." +"If you want the adler32 or crc32 hash functions, they are available in " +"the :mod:`zlib` module." msgstr "" "如果你需要 adler32 或 crc32 雜湊函式,可以在 :mod:`zlib` 模組中找到它們。" -#: ../../library/hashlib.rst:40 +#: ../../library/hashlib.rst:38 msgid "Hash algorithms" msgstr "雜湊演算法" -#: ../../library/hashlib.rst:42 +#: ../../library/hashlib.rst:40 msgid "" "There is one constructor method named for each type of :dfn:`hash`. All " -"return a hash object with the same simple interface. For example: use :func:" -"`sha256` to create a SHA-256 hash object. You can now feed this object with :" -"term:`bytes-like objects ` (normally :class:`bytes`) " -"using the :meth:`update` method. At any point you can ask it " -"for the :dfn:`digest` of the concatenation of the data fed to it so far " -"using the :meth:`digest()` or :meth:`hexdigest()` methods." +"return a hash object with the same simple interface. For example: " +"use :func:`sha256` to create a SHA-256 hash object. You can now feed this " +"object with :term:`bytes-like objects ` " +"(normally :class:`bytes`) using the :meth:`update` method. At " +"any point you can ask it for the :dfn:`digest` of the concatenation of the " +"data fed to it so far using the :meth:`digest()` " +"or :meth:`hexdigest()` methods." msgstr "" "每種種類的 :dfn:`hash` 都有一個以其命名的建構函式方法。全部都會回傳具有相同簡" "單介面的雜湊物件。例如:可使用 :func:`sha256` 來建立 SHA-256 雜湊物件。現在你" @@ -74,45 +71,43 @@ msgstr "" "` 方法來要求它提供迄今為止傳遞給它的資料串聯的\\ :dfn:`摘要 " "(digest)`。" -#: ../../library/hashlib.rst:50 +#: ../../library/hashlib.rst:48 msgid "" "To allow multithreading, the Python :term:`GIL` is released while computing " -"a hash supplied more than 2047 bytes of data at once in its constructor or :" -"meth:`.update` method." +"a hash supplied more than 2047 bytes of data at once in its constructor " +"or :meth:`.update` method." msgstr "" "為了允許多執行緒 (multithreading),Python :term:`GIL` 被釋放,同時在其建構函" "式或 :meth:`.update` 方法中計算一次提供超過 2047 位元組資料的雜" "湊值。" -#: ../../library/hashlib.rst:57 +#: ../../library/hashlib.rst:55 msgid "" -"Constructors for hash algorithms that are always present in this module are :" -"func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:" -"`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:" -"`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, and :func:" -"`blake2s`. :func:`md5` is normally available as well, though it may be " -"missing or blocked if you are using a rare \"FIPS compliant\" build of " -"Python. These correspond to :data:`algorithms_guaranteed`." +"Constructors for hash algorithms that are always present in this module " +"are :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, " +"and :func:`blake2s`. :func:`md5` is normally available as well, though it " +"may be missing or blocked if you are using a rare \"FIPS compliant\" build " +"of Python. These correspond to :data:`algorithms_guaranteed`." msgstr "" -"此模組中始終存在的雜湊演算法之建構函式有 :func:`sha1`、:func:`sha224`、:func:" -"`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:" -"`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:" -"`shake_256`、:func:`blake2b` 和 :func:`blake2s`。:func:`md5` 通常也可用,但如" -"果你使用罕見的「符合 FIPS (FIPS compliant)」的 Python 建置版本,它可能不存在" -"或者不被允許使用。以上會對應到 :data:`algorithms_guaranteed`。" +"此模組中始終存在的雜湊演算法之建構函式" +"有 :func:`sha1`、:func:`sha224`、:func:`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`、:func:`blake2b` " +"和 :func:`blake2s`。:func:`md5` 通常也可用,但如果你使用罕見的「符合 FIPS " +"(FIPS compliant)」的 Python 建置版本,它可能不存在或者不被允許使用。以上會對" +"應到 :data:`algorithms_guaranteed`。" -#: ../../library/hashlib.rst:65 +#: ../../library/hashlib.rst:63 msgid "" -"Additional algorithms may also be available if your Python distribution's :" -"mod:`hashlib` was linked against a build of OpenSSL that provides others. " -"Others *are not guaranteed available* on all installations and will only be " -"accessible by name via :func:`new`. See :data:`algorithms_available`." +"Additional algorithms may also be available if your Python " +"distribution's :mod:`hashlib` was linked against a build of OpenSSL that " +"provides others. Others *are not guaranteed available* on all installations " +"and will only be accessible by name via :func:`new`. " +"See :data:`algorithms_available`." msgstr "" "如果你的 Python 發行版的 :mod:`hashlib` 與提供其他演算法的 OpenSSL 版本鏈結," "也可能有其他演算法可用。其他則\\ *不保證可用*\\ 於在所有安裝上,並且只能以名" "稱來透過 :func:`new` 存取。請參閱 :data:`algorithms_available`。" -#: ../../library/hashlib.rst:72 +#: ../../library/hashlib.rst:70 msgid "" "Some algorithms have known hash collision weaknesses (including MD5 and " "SHA1). Refer to `Attacks on cryptographic hash algorithms`_ and the `hashlib-" @@ -122,17 +117,17 @@ msgstr "" "閱 `Attacks on cryptographic hash algorithms`_ 和本文件後面的\\ `也參考 " "`_\\ 部分。" -#: ../../library/hashlib.rst:76 +#: ../../library/hashlib.rst:74 msgid "" -"SHA3 (Keccak) and SHAKE constructors :func:`sha3_224`, :func:`sha3_256`, :" -"func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` were " -"added. :func:`blake2b` and :func:`blake2s` were added." +"SHA3 (Keccak) and SHAKE " +"constructors :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` " +"were added. :func:`blake2b` and :func:`blake2s` were added." msgstr "" -"新增了 SHA3 (Keccak) 和 SHAKE 建構函式 :func:`sha3_224`、:func:`sha3_256`、:" -"func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。也新" -"增了 :func:`blake2b` 和 :func:`blake2s`。" +"新增了 SHA3 (Keccak) 和 SHAKE 建構函" +"式 :func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。" +"也新增了 :func:`blake2b` 和 :func:`blake2s`。" -#: ../../library/hashlib.rst:84 +#: ../../library/hashlib.rst:82 msgid "" "All hashlib constructors take a keyword-only argument *usedforsecurity* with " "default value ``True``. A false value allows the use of insecure and blocked " @@ -145,11 +140,11 @@ msgstr "" "全 (insecure) 和阻塞的 (blocked) 雜湊演算法。``False`` 表示雜湊演算法未在安全" "情境中使用,例如作為一種非加密用途的單向壓縮函式。" -#: ../../library/hashlib.rst:91 +#: ../../library/hashlib.rst:89 msgid "Hashlib now uses SHA3 and SHAKE from OpenSSL if it provides it." msgstr "Hashlib 現在使用 OpenSSL 中的 SHA3 和 SHAKE(如果有提供的話)。" -#: ../../library/hashlib.rst:94 +#: ../../library/hashlib.rst:92 msgid "" "For any of the MD5, SHA1, SHA2, or SHA3 algorithms that the linked OpenSSL " "does not provide we fall back to a verified implementation from the `HACL\\* " @@ -158,18 +153,18 @@ msgstr "" "對於鏈結之 OpenSSL 未提供的任何 MD5、SHA1、SHA2 或 SHA3 演算法,我們會回退使" "用 `HACL\\* 專案 `_\\ 中經過驗證的實作。" -#: ../../library/hashlib.rst:100 +#: ../../library/hashlib.rst:98 msgid "Usage" msgstr "用法" -#: ../../library/hashlib.rst:102 +#: ../../library/hashlib.rst:100 msgid "" "To obtain the digest of the byte string ``b\"Nobody inspects the spammish " "repetition\"``::" msgstr "" -"獲取位元組字串 ``b\"Nobody inspects the spammish repetition\"`` 的摘要: ::" +"取得位元組字串 ``b\"Nobody inspects the spammish repetition\"`` 的摘要: ::" -#: ../../library/hashlib.rst:105 +#: ../../library/hashlib.rst:103 msgid "" ">>> import hashlib\n" ">>> m = hashlib.sha256()\n" @@ -177,8 +172,7 @@ msgid "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" -"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" msgstr "" @@ -188,20 +182,19 @@ msgstr "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" -"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" -#: ../../library/hashlib.rst:114 +#: ../../library/hashlib.rst:112 msgid "More condensed:" msgstr "更濃縮:" -#: ../../library/hashlib.rst:120 +#: ../../library/hashlib.rst:118 msgid "Constructors" msgstr "建構函式" -#: ../../library/hashlib.rst:124 +#: ../../library/hashlib.rst:122 msgid "" "Is a generic constructor that takes the string *name* of the desired " "algorithm as its first parameter. It also exists to allow access to the " @@ -211,25 +204,25 @@ msgstr "" "是一個通用建構函式,它將目標演算法的字串 *name* 作為其第一個參數。它還允許使" "用者取得上面列出的雜湊值以及 OpenSSL 函式庫可能提供的任何其他演算法。" -#: ../../library/hashlib.rst:129 +#: ../../library/hashlib.rst:127 msgid "Using :func:`new` with an algorithm name:" msgstr "使用 :func:`new` 和演算法名稱:" -#: ../../library/hashlib.rst:148 +#: ../../library/hashlib.rst:146 msgid "" "Named constructors such as these are faster than passing an algorithm name " "to :func:`new`." msgstr "諸如此類的附名建構函式比將演算法名稱傳遞給 :func:`new` 更快。" -#: ../../library/hashlib.rst:152 +#: ../../library/hashlib.rst:150 msgid "Attributes" msgstr "屬性" -#: ../../library/hashlib.rst:154 +#: ../../library/hashlib.rst:152 msgid "Hashlib provides the following constant module attributes:" msgstr "Hashlib 提供以下常數模組屬性:" -#: ../../library/hashlib.rst:158 +#: ../../library/hashlib.rst:156 msgid "" "A set containing the names of the hash algorithms guaranteed to be supported " "by this module on all platforms. Note that 'md5' is in this list despite " @@ -240,41 +233,41 @@ msgstr "" "列表中,儘管有一些上游供應商提供了奇怪的「符合 FIPS (FIPS compliant)」的 " "Python 建置,並將其排除在外。" -#: ../../library/hashlib.rst:167 +#: ../../library/hashlib.rst:165 msgid "" "A set containing the names of the hash algorithms that are available in the " -"running Python interpreter. These names will be recognized when passed to :" -"func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " +"running Python interpreter. These names will be recognized when passed " +"to :func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " "same algorithm may appear multiple times in this set under different names " "(thanks to OpenSSL)." msgstr "" -"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞給 :" -"func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。相同" -"的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" +"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞" +"給 :func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。" +"相同的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" -#: ../../library/hashlib.rst:176 +#: ../../library/hashlib.rst:174 msgid "Hash Objects" msgstr "雜湊物件" -#: ../../library/hashlib.rst:178 +#: ../../library/hashlib.rst:176 msgid "" "The following values are provided as constant attributes of the hash objects " "returned by the constructors:" msgstr "以下的值皆為建構函式回傳之雜湊物件的常數屬性:" -#: ../../library/hashlib.rst:183 +#: ../../library/hashlib.rst:181 msgid "The size of the resulting hash in bytes." msgstr "生成雜湊的大小(以位元組為單位)。" -#: ../../library/hashlib.rst:187 +#: ../../library/hashlib.rst:185 msgid "The internal block size of the hash algorithm in bytes." msgstr "雜湊演算法的內部區塊大小(以位元組為單位)。" -#: ../../library/hashlib.rst:189 +#: ../../library/hashlib.rst:187 msgid "A hash object has the following attributes:" msgstr "雜湊物件具有以下屬性:" -#: ../../library/hashlib.rst:193 +#: ../../library/hashlib.rst:191 msgid "" "The canonical name of this hash, always lowercase and always suitable as a " "parameter to :func:`new` to create another hash of this type." @@ -282,7 +275,7 @@ msgstr "" "該雜湊的規範名稱,都會是小寫,且都會適合作為 :func:`new` 的參數以建立此型別的" "另一個雜湊。" -#: ../../library/hashlib.rst:196 +#: ../../library/hashlib.rst:194 msgid "" "The name attribute has been present in CPython since its inception, but " "until Python 3.4 was not formally specified, so may not exist on some " @@ -291,30 +284,31 @@ msgstr "" "name 屬性自 CPython 誕生以來就存在於其中,但直到 Python 3.4 才正式確立,因此" "在某些平台上可能不存在。" -#: ../../library/hashlib.rst:201 +#: ../../library/hashlib.rst:199 msgid "A hash object has the following methods:" msgstr "雜湊物件具有以下方法:" -#: ../../library/hashlib.rst:206 +#: ../../library/hashlib.rst:204 msgid "" "Update the hash object with the :term:`bytes-like object`. Repeated calls " "are equivalent to a single call with the concatenation of all the arguments: " "``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." msgstr "" "使用\\ :term:`類位元組物件 `\\ 來更新雜湊物件。重複呼叫相" -"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 ``m." -"update(a+b)``。" +"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 " +"``m.update(a+b)``。" -#: ../../library/hashlib.rst:214 +#: ../../library/hashlib.rst:212 msgid "" "Return the digest of the data passed to the :meth:`update` method so far. " "This is a bytes object of size :attr:`digest_size` which may contain bytes " "in the whole range from 0 to 255." msgstr "" -"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小為 :attr:" -"`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元組。" +"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小" +"為 :attr:`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元" +"組。" -#: ../../library/hashlib.rst:221 +#: ../../library/hashlib.rst:219 msgid "" "Like :meth:`digest` except the digest is returned as a string object of " "double length, containing only hexadecimal digits. This may be used to " @@ -323,7 +317,7 @@ msgstr "" "與 :meth:`digest` 類似,只不過摘要會是作為雙倍長度的字串物件回傳,僅包含十六" "進位數字。這可用於在電子郵件或其他非二進位環境中安全地交換值。" -#: ../../library/hashlib.rst:228 +#: ../../library/hashlib.rst:226 msgid "" "Return a copy (\"clone\") of the hash object. This can be used to " "efficiently compute the digests of data sharing a common initial substring." @@ -331,11 +325,11 @@ msgstr "" "回傳雜湊物件的副本(「複製 (clone)」),這可用於高效率地計算出共享同一初始子" "字串的資料之摘要。" -#: ../../library/hashlib.rst:233 +#: ../../library/hashlib.rst:231 msgid "SHAKE variable length digests" msgstr "SHAKE 可變長度摘要" -#: ../../library/hashlib.rst:238 +#: ../../library/hashlib.rst:236 msgid "" "The :func:`shake_128` and :func:`shake_256` algorithms provide variable " "length digests with length_in_bits//2 up to 128 or 256 bits of security. As " @@ -346,7 +340,7 @@ msgstr "" "length_in_bits//2 最高為 128 或 256 位元安全性。因此,他們的摘要方法會需要長" "度。最大長度不受 SHAKE 演算法限制。" -#: ../../library/hashlib.rst:245 +#: ../../library/hashlib.rst:243 msgid "" "Return the digest of the data passed to the :meth:`~hash.update` method so " "far. This is a bytes object of size *length* which may contain bytes in the " @@ -355,7 +349,7 @@ msgstr "" "回傳目前有傳遞給 :meth:`~hash.update` 方法的資料之摘要。這是一個大小為 " "*length* 的位元組物件,可能包含從 0 到 255 的整個範圍內的位元組。" -#: ../../library/hashlib.rst:252 +#: ../../library/hashlib.rst:250 msgid "" "Like :meth:`digest` except the digest is returned as a string object of " "double length, containing only hexadecimal digits. This may be used to " @@ -364,15 +358,15 @@ msgstr "" "與 :meth:`digest` 類似,只不過摘要作為雙倍長度的字串物件回傳,僅包含十六進位" "數字。這可用於交換電子郵件或其他非二進位環境中的值。" -#: ../../library/hashlib.rst:256 +#: ../../library/hashlib.rst:254 msgid "Example use:" msgstr "範例:" -#: ../../library/hashlib.rst:263 +#: ../../library/hashlib.rst:261 msgid "File hashing" msgstr "檔案雜湊" -#: ../../library/hashlib.rst:265 +#: ../../library/hashlib.rst:263 msgid "" "The hashlib module provides a helper function for efficient hashing of a " "file or file-like object." @@ -380,28 +374,36 @@ msgstr "" "hashlib 模組提供了一個輔助函式,用於對檔案或類檔案物件 (file-like object) 進" "行有效率的雜湊。" -#: ../../library/hashlib.rst:270 +#: ../../library/hashlib.rst:268 msgid "" "Return a digest object that has been updated with contents of file object." msgstr "回傳已用檔案物件內容更新的摘要物件。" -#: ../../library/hashlib.rst:272 +#: ../../library/hashlib.rst:270 msgid "" "*fileobj* must be a file-like object opened for reading in binary mode. It " "accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " "instances, SocketIO objects from :meth:`socket.socket.makefile`, and " -"similar. The function may bypass Python's I/O and use the file descriptor " +"similar. *fileobj* must be opened in blocking mode, otherwise " +"a :exc:`BlockingIOError` may be raised." +msgstr "" +"*fileobj* 必須是以二進位模式讀取的類檔案物件。它接受來自內建 :func:`open` 的" +"檔案物件、:class:`~io.BytesIO` 實例、來自 :meth:`socket.socket.makefile` 的 " +"SocketIO 物件等。*fileobj* 必須以阻塞模式開啟,否則可能會引" +"發 :exc:`BlockingIOError`。" + +#: ../../library/hashlib.rst:276 +msgid "" +"The function may bypass Python's I/O and use the file descriptor " "from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in " "an unknown state after this function returns or raises. It is up to the " "caller to close *fileobj*." msgstr "" -"*fileobj* 必須是以二進位模式讀取的類檔案物件。它接受來自內建 :func:`open` 的" -"檔案物件、:class:`~io.BytesIO` 實例、來自 :meth:`socket.socket.makefile` 的 " -"SocketIO 物件等。該函式可以繞過 Python 的 I/O 並直接使用 :meth:`~io.IOBase." -"fileno` 中的檔案描述器 (file descriptor)。在此函式回傳或引發後,必須假定 " -"*fileobj* 處於未知狀態 (unknown state)。由呼叫者決定是否關閉 *fileobj*。" +"該函式可以繞過 Python 的 I/O 並直接使用 :meth:`~io.IOBase.fileno` 中的檔案描" +"述器 (file descriptor)。在此函式回傳或引發後,必須假定 *fileobj* 處於未知狀" +"態 (unknown state)。由呼叫者決定是否關閉 *fileobj*。" -#: ../../library/hashlib.rst:280 +#: ../../library/hashlib.rst:281 msgid "" "*digest* must either be a hash algorithm name as a *str*, a hash " "constructor, or a callable that returns a hash object." @@ -409,15 +411,21 @@ msgstr "" "*digest* 必須是名稱作為 *str* 的雜湊演算法、雜湊建構函式或會回傳雜湊物件的可" "呼叫函式。" -#: ../../library/hashlib.rst:283 +#: ../../library/hashlib.rst:284 msgid "Example:" msgstr "範例:" -#: ../../library/hashlib.rst:306 +#: ../../library/hashlib.rst:305 +msgid "" +"Now raises a :exc:`BlockingIOError` if the file is opened in blocking mode. " +"Previously, spurious null bytes were added to the digest." +msgstr "" + +#: ../../library/hashlib.rst:311 msgid "Key derivation" msgstr "密鑰的生成" -#: ../../library/hashlib.rst:308 +#: ../../library/hashlib.rst:313 msgid "" "Key derivation and key stretching algorithms are designed for secure " "password hashing. Naive algorithms such as ``sha1(password)`` are not " @@ -430,7 +438,7 @@ msgstr "" "的密碼雜湊函式必須是可調校的 (tunable)、緩慢的,並且有包含 `salt(鹽) " "`_。" -#: ../../library/hashlib.rst:316 +#: ../../library/hashlib.rst:321 msgid "" "The function provides PKCS#5 password-based key derivation function 2. It " "uses HMAC as pseudorandom function." @@ -438,7 +446,7 @@ msgstr "" "該函式提供基於密碼的 PKCS#5 密鑰生成函式 2。它使用 HMAC 作為偽隨機函式 " "(pseudorandom function)。" -#: ../../library/hashlib.rst:319 +#: ../../library/hashlib.rst:324 msgid "" "The string *hash_name* is the desired name of the hash digest algorithm for " "HMAC, e.g. 'sha1' or 'sha256'. *password* and *salt* are interpreted as " @@ -448,10 +456,10 @@ msgid "" msgstr "" "字串 *hash_name* 是 HMAC 的雜湊摘要演算法所需的名稱,例如 ``sha1`` 或 " "``sha256``。*password* 和 *salt* 被直譯為位元組緩衝區。應用程式和函式庫應為 " -"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例如 :" -"func:`os.urandom`)且大約 16 或更多位元組。" +"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例" +"如 :func:`os.urandom`)且大約 16 或更多位元組。" -#: ../../library/hashlib.rst:325 +#: ../../library/hashlib.rst:330 msgid "" "The number of *iterations* should be chosen based on the hash algorithm and " "computing power. As of 2022, hundreds of thousands of iterations of SHA-256 " @@ -464,7 +472,7 @@ msgstr "" "讀 NIST-SP-800-132_ 的 *Appendix A.2.2*。`stackexchange pbkdf2 疊代問題`_\\ " "上的答案有詳細解釋。" -#: ../../library/hashlib.rst:331 +#: ../../library/hashlib.rst:336 msgid "" "*dklen* is the length of the derived key in bytes. If *dklen* is ``None`` " "then the digest size of the hash algorithm *hash_name* is used, e.g. 64 for " @@ -473,11 +481,11 @@ msgstr "" "*dklen* 是生成的密鑰長度。如果 *dklen* 為 ``None``,則會使用雜湊演算法 " "*hash_name* 的摘要大小,例如 SHA-512 為 64。" -#: ../../library/hashlib.rst:340 +#: ../../library/hashlib.rst:345 msgid "Function only available when Python is compiled with OpenSSL." msgstr "僅當有使用 OpenSSL 編譯 Python 時該函式才可用。" -#: ../../library/hashlib.rst:344 +#: ../../library/hashlib.rst:349 msgid "" "Function now only available when Python is built with OpenSSL. The slow pure " "Python implementation has been removed." @@ -485,13 +493,13 @@ msgstr "" "該函式現在僅在有使用 OpenSSL 建置 Python 時可用。緩慢的純 Python 實作已被刪" "除。" -#: ../../library/hashlib.rst:350 +#: ../../library/hashlib.rst:355 msgid "" "The function provides scrypt password-based key derivation function as " "defined in :rfc:`7914`." msgstr "該函式提供(如 :rfc:`7914` 中所定義的)scrypt 基於密碼的密鑰衍生函式。" -#: ../../library/hashlib.rst:353 +#: ../../library/hashlib.rst:358 msgid "" "*password* and *salt* must be :term:`bytes-like objects `. Applications and libraries should limit *password* to a sensible " @@ -502,7 +510,7 @@ msgstr "" "程式和函式庫應為 *password* 設下合理的長度限制(例如 1024)。*salt* 應該是來" "自適當來源(例如 :func:`os.urandom`)且大約 16 或更多位元組。" -#: ../../library/hashlib.rst:358 +#: ../../library/hashlib.rst:363 msgid "" "*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization " "factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). " @@ -511,17 +519,17 @@ msgstr "" "*n* 是 CPU/記憶體開銷係數、*r* 是區塊大小、*p* 為平行化係數、*maxmem* 為記憶" "體限制(OpenSSL 1.1.0 預設為 32 MiB)。*dklen* 是生成密鑰的長度。" -#: ../../library/hashlib.rst:368 +#: ../../library/hashlib.rst:373 msgid "BLAKE2" msgstr "BLAKE2" -#: ../../library/hashlib.rst:375 +#: ../../library/hashlib.rst:380 msgid "" "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " "in two flavors:" msgstr "BLAKE2_ 是在 :rfc:`7693` 中定義的加密雜湊函式,有兩種類型:" -#: ../../library/hashlib.rst:378 +#: ../../library/hashlib.rst:383 msgid "" "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " "between 1 and 64 bytes," @@ -529,7 +537,7 @@ msgstr "" "**BLAKE2b**,針對 64 位元平台進行了最佳化,可生成 1 到 64 位元組之間任意大小" "的摘要," -#: ../../library/hashlib.rst:381 +#: ../../library/hashlib.rst:386 msgid "" "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " "any size between 1 and 32 bytes." @@ -537,7 +545,7 @@ msgstr "" "**BLAKE2s**,針對 8 至 32 位元平台進行了最佳化,可生成 1 至 32 位元組之間任意" "大小的摘要。" -#: ../../library/hashlib.rst:384 +#: ../../library/hashlib.rst:389 msgid "" "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " "**salted hashing**, **personalization**, and **tree hashing**." @@ -545,21 +553,21 @@ msgstr "" "BLAKE2 支援\\ **密鑰模式 (keyed mode)** (更快、更簡單的 HMAC_ 替代品)、**加" "鹽雜湊 (salted hashing)**、**個人化**\\ 和\\ **樹狀雜湊**。" -#: ../../library/hashlib.rst:387 +#: ../../library/hashlib.rst:392 msgid "" -"Hash objects from this module follow the API of standard library's :mod:" -"`hashlib` objects." +"Hash objects from this module follow the API of standard " +"library's :mod:`hashlib` objects." msgstr "該模組中的雜湊物件遵循標準函式庫的 :mod:`hashlib` 物件 API。" -#: ../../library/hashlib.rst:392 +#: ../../library/hashlib.rst:397 msgid "Creating hash objects" msgstr "建立雜湊物件" -#: ../../library/hashlib.rst:394 +#: ../../library/hashlib.rst:399 msgid "New hash objects are created by calling constructor functions:" msgstr "新的雜湊物件是透過呼叫建構函式建立的:" -#: ../../library/hashlib.rst:408 +#: ../../library/hashlib.rst:413 msgid "" "These functions return the corresponding hash objects for calculating " "BLAKE2b or BLAKE2s. They optionally take these general parameters:" @@ -567,7 +575,7 @@ msgstr "" "這些函式回傳相應的雜湊物件以計算 BLAKE2b 或 BLAKE2s。他們可以選擇採用這些通用" "參數:" -#: ../../library/hashlib.rst:411 +#: ../../library/hashlib.rst:416 msgid "" "*data*: initial chunk of data to hash, which must be :term:`bytes-like " "object`. It can be passed only as positional argument." @@ -575,18 +583,18 @@ msgstr "" "*data*:要雜湊的初始資料塊 (data chunk),它必須是\\ :term:`類位元組物件 " "`。它只能作為位置引數傳遞。" -#: ../../library/hashlib.rst:414 +#: ../../library/hashlib.rst:419 msgid "*digest_size*: size of output digest in bytes." msgstr "*digest_size*:輸出摘要的大小(以位元組為單位)。" -#: ../../library/hashlib.rst:416 +#: ../../library/hashlib.rst:421 msgid "" "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " "BLAKE2s)." msgstr "" "*key*:用於密鑰雜湊的密鑰(BLAKE2b 最多 64 位元組、BLAKE2s 最多 32 位元組)。" -#: ../../library/hashlib.rst:419 +#: ../../library/hashlib.rst:424 msgid "" "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " "bytes for BLAKE2s)." @@ -594,62 +602,62 @@ msgstr "" "*salt*:用於隨機雜湊的鹽(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元" "組)。" -#: ../../library/hashlib.rst:422 +#: ../../library/hashlib.rst:427 msgid "" "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " "for BLAKE2s)." msgstr "" "*person*:個人化字串(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元組)。" -#: ../../library/hashlib.rst:425 +#: ../../library/hashlib.rst:430 msgid "The following table shows limits for general parameters (in bytes):" msgstr "下表顯示了一般參數的限制(以位元組為單位):" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "Hash" msgstr "雜湊" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "digest_size" msgstr "digest_size" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "len(key)" msgstr "len(key)" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "len(salt)" msgstr "len(salt)" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "len(person)" msgstr "len(person)" -#: ../../library/hashlib.rst:430 +#: ../../library/hashlib.rst:435 msgid "BLAKE2b" msgstr "BLAKE2b" -#: ../../library/hashlib.rst:430 +#: ../../library/hashlib.rst:435 msgid "64" msgstr "64" -#: ../../library/hashlib.rst:430 +#: ../../library/hashlib.rst:435 msgid "16" msgstr "16" -#: ../../library/hashlib.rst:431 +#: ../../library/hashlib.rst:436 msgid "BLAKE2s" msgstr "BLAKE2s" -#: ../../library/hashlib.rst:431 +#: ../../library/hashlib.rst:436 msgid "32" msgstr "32" -#: ../../library/hashlib.rst:431 +#: ../../library/hashlib.rst:436 msgid "8" msgstr "8" -#: ../../library/hashlib.rst:436 +#: ../../library/hashlib.rst:441 msgid "" "BLAKE2 specification defines constant lengths for salt and personalization " "parameters, however, for convenience, this implementation accepts byte " @@ -663,26 +671,26 @@ msgstr "" "以像是 ``b'salt`` 和 ``b'salt\\x00`` 是相同的值。(但 *key* 的情況並非如" "此。)" -#: ../../library/hashlib.rst:443 +#: ../../library/hashlib.rst:448 msgid "These sizes are available as module `constants`_ described below." msgstr "這些大小可作為模組\\ `常數 `_\\ 使用,如下所述。" -#: ../../library/hashlib.rst:445 +#: ../../library/hashlib.rst:450 msgid "" "Constructor functions also accept the following tree hashing parameters:" msgstr "建構函式還接受以下樹狀雜湊參數:" -#: ../../library/hashlib.rst:447 +#: ../../library/hashlib.rst:452 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "*fanout*:扇出(0 到 255,如果無限制則為 0、順序模式為 1)。" -#: ../../library/hashlib.rst:449 +#: ../../library/hashlib.rst:454 msgid "" "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " "mode)." msgstr "*depth*:樹的最大深度(1 到 255,如果無限制則為 255、順序模式為 1)。" -#: ../../library/hashlib.rst:452 +#: ../../library/hashlib.rst:457 msgid "" "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " "or in sequential mode)." @@ -690,7 +698,7 @@ msgstr "" "*leaf_size*:葉的最大位元組長度(0 到 ``2**32-1``,如果無限制或處於順序模式則" "為 0)。" -#: ../../library/hashlib.rst:455 +#: ../../library/hashlib.rst:460 msgid "" "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " "for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." @@ -698,12 +706,12 @@ msgstr "" "*node_offset*:節點偏移量(BLAKE2b 為 0 到 ``2**64-1``,BLAKE2s 為 0 到 " "``2**48-1``,0 表示第一個、最左邊、葉子或在順序模式下)。" -#: ../../library/hashlib.rst:458 +#: ../../library/hashlib.rst:463 msgid "" "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "*node_depth*:節點深度(0 到 255,葉為 0,或在順序模式下)。" -#: ../../library/hashlib.rst:460 +#: ../../library/hashlib.rst:465 msgid "" "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " "in sequential mode)." @@ -711,18 +719,18 @@ msgstr "" "*inner_size*:內部摘要大小(BLAKE2b 為 0 到 64,BLAKE2s 為 0 到 32,順序模式" "為 0)。" -#: ../../library/hashlib.rst:463 +#: ../../library/hashlib.rst:468 msgid "" "*last_node*: boolean indicating whether the processed node is the last one " "(``False`` for sequential mode)." msgstr "" "*last_node*:布林值,代表處理的節點是否為最後一個(``False`` 代表順序模式)。" -#: ../../library/hashlib.rst:466 +#: ../../library/hashlib.rst:471 msgid "Explanation of tree mode parameters." msgstr "樹狀模式參數說明。" -#: ../../library/hashlib.rst:470 +#: ../../library/hashlib.rst:475 msgid "" "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." @@ -730,49 +738,51 @@ msgstr "" "關於樹狀雜湊的綜合回顧,請參閱 `BLAKE2 規範 `_\\ 中的第 2.10 節。" -#: ../../library/hashlib.rst:476 +#: ../../library/hashlib.rst:481 msgid "Constants" msgstr "常數" -#: ../../library/hashlib.rst:481 +#: ../../library/hashlib.rst:486 msgid "Salt length (maximum length accepted by constructors)." msgstr "鹽長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:487 +#: ../../library/hashlib.rst:492 msgid "" "Personalization string length (maximum length accepted by constructors)." msgstr "個人化字串長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:493 +#: ../../library/hashlib.rst:498 msgid "Maximum key size." msgstr "最大密鑰大小。" -#: ../../library/hashlib.rst:499 +#: ../../library/hashlib.rst:504 msgid "Maximum digest size that the hash function can output." msgstr "雜湊函式可以輸出的最大摘要大小。" -#: ../../library/hashlib.rst:503 +#: ../../library/hashlib.rst:508 msgid "Examples" msgstr "範例" -#: ../../library/hashlib.rst:506 +#: ../../library/hashlib.rst:511 msgid "Simple hashing" msgstr "簡單雜湊" -#: ../../library/hashlib.rst:508 +#: ../../library/hashlib.rst:513 msgid "" "To calculate hash of some data, you should first construct a hash object by " -"calling the appropriate constructor function (:func:`blake2b` or :func:" -"`blake2s`), then update it with the data by calling :meth:`~hash.update` on " -"the object, and, finally, get the digest out of the object by calling :meth:" -"`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." +"calling the appropriate constructor function (:func:`blake2b` " +"or :func:`blake2s`), then update it with the data by " +"calling :meth:`~hash.update` on the object, and, finally, get the digest out " +"of the object by calling :meth:`~hash.digest` (or :meth:`~hash.hexdigest` " +"for hex-encoded string)." msgstr "" "要計算某些資料的雜湊值,你應該首先透過呼叫適當的建構函式(:func:`blake2b` " -"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼叫 :meth:`~hash." -"update` 來以資料對它更新,最後透過呼叫 :meth:`~hash.digest`\\ (或對於十六進" -"位編碼字串則為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" +"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼" +"叫 :meth:`~hash.update` 來以資料對它更新,最後透過呼" +"叫 :meth:`~hash.digest`\\ (或對於十六進位編碼字串則" +"為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" -#: ../../library/hashlib.rst:521 +#: ../../library/hashlib.rst:526 msgid "" "As a shortcut, you can pass the first chunk of data to update directly to " "the constructor as the positional argument:" @@ -780,17 +790,17 @@ msgstr "" "作為一個快捷方式,你可以將要更新的第一個資料塊作為位置引數直接傳遞給建構函" "式:" -#: ../../library/hashlib.rst:528 +#: ../../library/hashlib.rst:533 msgid "" "You can call :meth:`hash.update` as many times as you need to iteratively " "update the hash:" msgstr "你可以根據需求來多次呼叫 :meth:`hash.update` 以疊代更新雜湊:" -#: ../../library/hashlib.rst:542 +#: ../../library/hashlib.rst:547 msgid "Using different digest sizes" msgstr "使用不同的摘要大小" -#: ../../library/hashlib.rst:544 +#: ../../library/hashlib.rst:549 msgid "" "BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to " "32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without " @@ -800,7 +810,7 @@ msgstr "" "組。例如,要在不改變輸出大小的情況下用 BLAKE2b 替換 SHA-1,我們可以指定 " "BLAKE2b 生成 20 位元組的摘要:" -#: ../../library/hashlib.rst:558 +#: ../../library/hashlib.rst:563 msgid "" "Hash objects with different digest sizes have completely different outputs " "(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " @@ -809,31 +819,31 @@ msgstr "" "具有不同摘要大小的雜湊物件具有完全不同的輸出(較短的雜湊值\\ *不是*\\ 較長雜" "湊值的前綴);即使輸出長度相同,BLAKE2b 和 BLAKE2s 也會產生不同的輸出:" -#: ../../library/hashlib.rst:574 +#: ../../library/hashlib.rst:579 msgid "Keyed hashing" msgstr "密鑰雜湊 (Keyed hashing)" -#: ../../library/hashlib.rst:576 +#: ../../library/hashlib.rst:581 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " -"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-MAC " -"mode thanks to the indifferentiability property inherited from BLAKE." +"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-" +"MAC mode thanks to the indifferentiability property inherited from BLAKE." msgstr "" "密鑰雜湊可用於身份驗證,作為\\ `基於雜湊的訊息驗證碼 (Hash-based message " "authentication code) `_ (HMAC) 的更快、" "更簡單的替代方案。由於繼承自 BLAKE 的不可微特性 (indifferentiability " "property),BLAKE2 可以安全地用於 prefix-MAC 模式。" -#: ../../library/hashlib.rst:582 +#: ../../library/hashlib.rst:587 msgid "" "This example shows how to get a (hex-encoded) 128-bit authentication code " "for message ``b'message data'`` with key ``b'pseudorandom key'``::" msgstr "" -"此範例示範了如何使用密鑰 ``b'pseudorandom key'`` 獲取訊息 ``b'message " +"此範例示範了如何使用密鑰 ``b'pseudorandom key'`` 取得訊息 ``b'message " "data'`` 的(十六進位編碼)128 位元驗證碼: ::" -#: ../../library/hashlib.rst:585 +#: ../../library/hashlib.rst:590 msgid "" ">>> from hashlib import blake2b\n" ">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" @@ -847,7 +857,7 @@ msgstr "" ">>> h.hexdigest()\n" "'3d363ff7401e02026f4a4687d4863ced'" -#: ../../library/hashlib.rst:592 +#: ../../library/hashlib.rst:597 msgid "" "As a practical example, a web application can symmetrically sign cookies " "sent to users and later verify them to make sure they weren't tampered with::" @@ -855,7 +865,7 @@ msgstr "" "舉一個實際的例子,網頁應用程式可以對發送給使用者的 cookie 進行對稱簽名 " "(symmetrically sign),然後驗證它們以確保它們沒有被篡改: ::" -#: ../../library/hashlib.rst:595 +#: ../../library/hashlib.rst:600 msgid "" ">>> from hashlib import blake2b\n" ">>> from hmac import compare_digest\n" @@ -909,7 +919,7 @@ msgstr "" ">>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\n" "False" -#: ../../library/hashlib.rst:621 +#: ../../library/hashlib.rst:626 msgid "" "Even though there's a native keyed hashing mode, BLAKE2 can, of course, be " "used in HMAC construction with :mod:`hmac` module::" @@ -917,7 +927,7 @@ msgstr "" "儘管有原生密鑰雜湊模式,BLAKE2 還是可以透過 :mod:`hmac` 模組用於建構 " "HMAC: ::" -#: ../../library/hashlib.rst:624 +#: ../../library/hashlib.rst:629 msgid "" ">>> import hmac, hashlib\n" ">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" @@ -931,11 +941,11 @@ msgstr "" ">>> m.hexdigest()\n" "'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" -#: ../../library/hashlib.rst:632 +#: ../../library/hashlib.rst:637 msgid "Randomized hashing" msgstr "隨機雜湊 (Randomized hashing)" -#: ../../library/hashlib.rst:634 +#: ../../library/hashlib.rst:639 msgid "" "By setting *salt* parameter users can introduce randomization to the hash " "function. Randomized hashing is useful for protecting against collision " @@ -944,7 +954,7 @@ msgstr "" "透過設定 *salt* 參數,使用者可以向雜湊函式引入隨機化。隨機雜湊在防止針對數位" "簽章中雜湊函式的碰撞攻擊 (collision attacks) 非常有用。" -#: ../../library/hashlib.rst:638 +#: ../../library/hashlib.rst:643 msgid "" "Randomized hashing is designed for situations where one party, the message " "preparer, generates all or part of a message to be signed by a second party, " @@ -968,14 +978,14 @@ msgstr "" "方(訊息簽名者)簽名。如果訊息準備者能夠發現加密雜湊函式發生碰撞(collision," "即兩條訊息產生相同的雜湊值),那麼他們可能會準備有意義的訊息版本,該版本將產" "生相同的雜湊值和數位簽章,但結果不同(例如,將 $1,000,000 轉入賬戶,而不是 " -"$10)。加密雜湊函式的設計以抗碰撞性為主要目標,但當前對加密雜湊函式攻擊的關注" +"$10)。加密雜湊函式的設計以抗碰撞性為主要目標,但目前對加密雜湊函式攻擊的關注" "可能會導致給定的加密雜湊函式所提供的抗碰撞性低於預期。隨機雜湊透過降低準備者" "在數位簽章生成過程中生成最終產生相同雜湊值的兩個或多個訊息的可能性,為簽名者" "提供額外的保護 —— 即便嘗試去找到雜湊函式碰撞的發生是實際可行的。然而,若訊息" "的所有部分都是由簽名者所準備好的,使用隨機雜湊可能會降低數位簽章提供的安全" "性。" -#: ../../library/hashlib.rst:657 +#: ../../library/hashlib.rst:662 msgid "" "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" @@ -983,7 +993,7 @@ msgstr "" "(`NIST SP-800-106 「數位簽章的隨機雜湊 (Randomized Hashing for Digital " "Signatures)」 `_)" -#: ../../library/hashlib.rst:660 +#: ../../library/hashlib.rst:665 msgid "" "In BLAKE2 the salt is processed as a one-time input to the hash function " "during initialization, rather than as an input to each compression function." @@ -991,7 +1001,7 @@ msgstr "" "在 BLAKE2 中,鹽在初始化期間作為雜湊函式的一次性輸入被處理,而不是作為每個壓" "縮函式的輸入。" -#: ../../library/hashlib.rst:665 +#: ../../library/hashlib.rst:670 msgid "" "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " "cryptographic hash function, such as SHA-256, is not suitable for hashing " @@ -1002,11 +1012,11 @@ msgstr "" "純雜湊)不適合對密碼進行雜湊處理。有關更多資訊,請參閱 `BLAKE2 FAQ `_ 。" -#: ../../library/hashlib.rst:688 +#: ../../library/hashlib.rst:693 msgid "Personalization" msgstr "個人化" -#: ../../library/hashlib.rst:690 +#: ../../library/hashlib.rst:695 msgid "" "Sometimes it is useful to force hash function to produce different digests " "for the same input for different purposes. Quoting the authors of the Skein " @@ -1015,7 +1025,7 @@ msgstr "" "有時候強制雜湊函式為不同目的的相同輸入生成不同的摘要是很有用的。引用 Skein 雜" "湊函式的作者的話:" -#: ../../library/hashlib.rst:694 +#: ../../library/hashlib.rst:699 msgid "" "We recommend that all application designers seriously consider doing this; " "we have seen many protocols where a hash that is computed in one part of the " @@ -1029,7 +1039,7 @@ msgstr "" "關的資料上完成的,並且攻擊者可以強制應用程式將雜湊輸入設為相同的。對協議中使" "用的每個雜湊函式進行個人化可以立即阻止此類攻擊。" -#: ../../library/hashlib.rst:701 +#: ../../library/hashlib.rst:706 msgid "" "(`The Skein Hash Function Family `_, p. 21)" @@ -1037,11 +1047,11 @@ msgstr "" "(`Skein 雜湊函式系列 `_,第 21 頁)" -#: ../../library/hashlib.rst:705 +#: ../../library/hashlib.rst:710 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "BLAKE2 可以透過將位元組傳遞給 *person* 引數來做個人化: ::" -#: ../../library/hashlib.rst:707 +#: ../../library/hashlib.rst:712 msgid "" ">>> from hashlib import blake2b\n" ">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" @@ -1067,21 +1077,21 @@ msgstr "" ">>> h.hexdigest()\n" "'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" -#: ../../library/hashlib.rst:719 +#: ../../library/hashlib.rst:724 msgid "" "Personalization together with the keyed mode can also be used to derive " "different keys from a single one." msgstr "個人化與密鑰模式還可以一起用於從單個密鑰得出不同的密鑰。" -#: ../../library/hashlib.rst:733 +#: ../../library/hashlib.rst:738 msgid "Tree mode" msgstr "樹狀模式" -#: ../../library/hashlib.rst:735 +#: ../../library/hashlib.rst:740 msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "下面是對具有兩個葉節點的最小樹進行雜湊處理的範例: ::" -#: ../../library/hashlib.rst:737 +#: ../../library/hashlib.rst:742 msgid "" " 10\n" " / \\\n" @@ -1091,13 +1101,13 @@ msgstr "" " / \\\n" "00 01" -#: ../../library/hashlib.rst:741 +#: ../../library/hashlib.rst:746 msgid "" "This example uses 64-byte internal digests, and returns the 32-byte final " "digest::" msgstr "此範例使用 64-byte 內部摘要,並回傳 32-byte 最終摘要: ::" -#: ../../library/hashlib.rst:744 +#: ../../library/hashlib.rst:749 msgid "" ">>> from hashlib import blake2b\n" ">>>\n" @@ -1151,11 +1161,11 @@ msgstr "" ">>> h10.hexdigest()\n" "'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" -#: ../../library/hashlib.rst:771 +#: ../../library/hashlib.rst:776 msgid "Credits" msgstr "製作人員" -#: ../../library/hashlib.rst:773 +#: ../../library/hashlib.rst:778 msgid "" "BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko " "Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ " @@ -1167,13 +1177,13 @@ msgstr "" "Henzen*、*Willi Meier* 和 *Raphael C.-W. Phan* 所建立的 SHA-3_ 最終版本 " "BLAKE_。" -#: ../../library/hashlib.rst:778 +#: ../../library/hashlib.rst:783 msgid "" "It uses core algorithm from ChaCha_ cipher designed by *Daniel J. " "Bernstein*." msgstr "它使用 *Daniel J. Bernstein* 設計的 ChaCha_ 密碼的核心演算法。" -#: ../../library/hashlib.rst:780 +#: ../../library/hashlib.rst:785 msgid "" "The stdlib implementation is based on pyblake2_ module. It was written by " "*Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The " @@ -1183,17 +1193,17 @@ msgstr "" "Neves* 的 C 版本實作為基礎所編寫的。該文件是由 *Dmitry Chestnykh* 編寫並從 " "pyblake2_ 複製過來的。" -#: ../../library/hashlib.rst:784 +#: ../../library/hashlib.rst:789 msgid "The C code was partly rewritten for Python by *Christian Heimes*." msgstr "*Christian Heimes* 為 Python 重寫了部分 C 程式碼。" -#: ../../library/hashlib.rst:786 +#: ../../library/hashlib.rst:791 msgid "" "The following public domain dedication applies for both C hash function " "implementation, extension code, and this documentation:" msgstr "以下公開領域貢獻適用於 C 雜湊函式實作、擴充程式碼和此文件:" -#: ../../library/hashlib.rst:789 +#: ../../library/hashlib.rst:794 msgid "" "To the extent possible under law, the author(s) have dedicated all copyright " "and related and neighboring rights to this software to the public domain " @@ -1202,7 +1212,7 @@ msgstr "" "在法律允許的範圍內,作者已將該軟體的所有版權以及相關和鄰接權利奉獻給全球的公" "開領域。該軟體的發布沒有任何授權 (warranty)。" -#: ../../library/hashlib.rst:793 +#: ../../library/hashlib.rst:798 msgid "" "You should have received a copy of the CC0 Public Domain Dedication along " "with this software. If not, see https://creativecommons.org/publicdomain/" @@ -1212,7 +1222,7 @@ msgstr "" "Dedication) 的副本。如果沒有,請參閱 https://creativecommons.org/" "publicdomain/zero/1.0/ 。" -#: ../../library/hashlib.rst:797 +#: ../../library/hashlib.rst:802 msgid "" "The following people have helped with development or contributed their " "changes to the project and the public domain according to the Creative " @@ -1221,55 +1231,55 @@ msgstr "" "以下人員根據創用 CC 通用公眾領域貢獻宣告 1.0 (Creative Commons Public Domain " "Dedication 1.0 Universal) 於專案和公開領域做出了開發或貢獻:" -#: ../../library/hashlib.rst:801 +#: ../../library/hashlib.rst:806 msgid "*Alexandr Sokolovskiy*" msgstr "*Alexandr Sokolovskiy*" -#: ../../library/hashlib.rst:821 +#: ../../library/hashlib.rst:827 msgid "Module :mod:`hmac`" msgstr ":mod:`hmac` 模組" -#: ../../library/hashlib.rst:822 +#: ../../library/hashlib.rst:828 msgid "A module to generate message authentication codes using hashes." msgstr "使用雜湊生成訊息驗證程式碼的模組。" -#: ../../library/hashlib.rst:824 +#: ../../library/hashlib.rst:830 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/hashlib.rst:825 +#: ../../library/hashlib.rst:831 msgid "Another way to encode binary hashes for non-binary environments." msgstr "另一種在非二進位環境中編碼二進位雜湊的方法。" -#: ../../library/hashlib.rst:827 +#: ../../library/hashlib.rst:833 msgid "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" msgstr "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" -#: ../../library/hashlib.rst:828 +#: ../../library/hashlib.rst:834 msgid "The FIPS 180-4 publication on Secure Hash Algorithms." msgstr "有關安全雜湊演算法的 FIPS 180-4 出版物。" -#: ../../library/hashlib.rst:830 +#: ../../library/hashlib.rst:836 msgid "https://csrc.nist.gov/pubs/fips/202/final" msgstr "https://csrc.nist.gov/pubs/fips/202/final" -#: ../../library/hashlib.rst:831 +#: ../../library/hashlib.rst:837 msgid "The FIPS 202 publication on the SHA-3 Standard." msgstr "有關 SHA-3 標準的 FIPS 202 出版物。" -#: ../../library/hashlib.rst:833 +#: ../../library/hashlib.rst:839 msgid "https://www.blake2.net/" msgstr "https://www.blake2.net/" -#: ../../library/hashlib.rst:834 +#: ../../library/hashlib.rst:840 msgid "Official BLAKE2 website." msgstr "BLAKE2 官方網站。" -#: ../../library/hashlib.rst:836 +#: ../../library/hashlib.rst:842 msgid "https://en.wikipedia.org/wiki/Cryptographic_hash_function" msgstr "https://en.wikipedia.org/wiki/Cryptographic_hash_function" -#: ../../library/hashlib.rst:837 +#: ../../library/hashlib.rst:843 msgid "" "Wikipedia article with information on which algorithms have known issues and " "what that means regarding their use." @@ -1277,21 +1287,21 @@ msgstr "" "包含有關哪些演算法存在已知問題以及這些問題對其使用意味著什麼資訊的維基百科文" "章。" -#: ../../library/hashlib.rst:840 +#: ../../library/hashlib.rst:846 msgid "https://www.ietf.org/rfc/rfc8018.txt" msgstr "https://www.ietf.org/rfc/rfc8018.txt" -#: ../../library/hashlib.rst:841 +#: ../../library/hashlib.rst:847 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" msgstr "PKCS #5:基於密碼的加密規範版本 2.1" -#: ../../library/hashlib.rst:843 +#: ../../library/hashlib.rst:849 msgid "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" -#: ../../library/hashlib.rst:844 +#: ../../library/hashlib.rst:850 msgid "NIST Recommendation for Password-Based Key Derivation." msgstr "NIST(美國國家標準技術研究院)針對基於密碼的密鑰衍生的建議。" @@ -1307,14 +1317,14 @@ msgstr "" "安全雜湊演算法、SHA1、SHA2、SHA224、SHA256、SHA384、SHA512、SHA3、Shake、" "Blake2" -#: ../../library/hashlib.rst:55 +#: ../../library/hashlib.rst:53 msgid "OpenSSL" msgstr "OpenSSL" -#: ../../library/hashlib.rst:55 +#: ../../library/hashlib.rst:53 msgid "(use in module hashlib)" msgstr "(使用於 hashlib 模組中)" -#: ../../library/hashlib.rst:372 +#: ../../library/hashlib.rst:377 msgid "blake2b, blake2s" msgstr "blake2b, blake2s" diff --git a/library/heapq.po b/library/heapq.po index 859f7606c5..fb9399796c 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -123,8 +123,8 @@ msgstr "在線性時間內將 list *x* 轉為 heap,且過程不會申請額外 #: ../../library/heapq.rst:71 msgid "" "Pop and return the smallest item from the *heap*, and also push the new " -"*item*. The heap size doesn't change. If the heap is empty, :exc:" -"`IndexError` is raised." +"*item*. The heap size doesn't change. If the heap is " +"empty, :exc:`IndexError` is raised." msgstr "" "從 *heap* 取出並回傳最小的元素,接著將新的 *item* 放進heap。heap 的大小不會改" "變。如果 heap 是空的會產生 :exc:`IndexError` 錯誤。" @@ -220,26 +220,26 @@ msgid "" "Return a list with the *n* smallest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " "is used to extract a comparison key from each element in *iterable* (for " -"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)[:" -"n]``." +"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)" +"[:n]``." msgstr "" "回傳一個包含資料 *iterable* 中前 *n* 小元素的 list 。如果有指定 *key* 引數," "*key* 會是只有一個引數的函式,用來從每一個在 *iterable* 中的元素提取一個比較" -"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)[:" -"n]`` 。" +"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)" +"[:n]`` 。" #: ../../library/heapq.rst:130 msgid "" "The latter two functions perform best for smaller values of *n*. For larger " "values, it is more efficient to use the :func:`sorted` function. Also, when " -"``n==1``, it is more efficient to use the built-in :func:`min` and :func:" -"`max` functions. If repeated usage of these functions is required, consider " -"turning the iterable into an actual heap." +"``n==1``, it is more efficient to use the built-in :func:`min` " +"and :func:`max` functions. If repeated usage of these functions is " +"required, consider turning the iterable into an actual heap." msgstr "" -"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只用 :func:" -"`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函式 :func:`min` " -"和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以考慮將 iterable " -"轉成真正的 heap 。" +"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只" +"用 :func:`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函" +"式 :func:`min` 和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以" +"考慮將 iterable 轉成真正的 heap 。" #: ../../library/heapq.rst:138 msgid "Basic Examples" @@ -358,10 +358,10 @@ msgid "" "returned in the order they were added. And since no two entry counts are the " "same, the tuple comparison will never attempt to directly compare two tasks." msgstr "" -"一個針對前兩個問題的解法是:儲存一個包含 priority 、 entry count 和 task 三個" -"元素的 tuple 。兩個 task 有相同 priority 時, entry count 會讓兩個 task 能根" -"據加入的順序排序。因為沒有任何兩個 task 擁有相同的 entry count ,所以永遠不會" -"直接使用 task 做比較。" +"一個針對前兩個問題的解法是:儲存一個包含 priority、entry count 和 task 三個元" +"素的 tuple 。兩個 task 有相同 priority 時,entry count 會讓兩個 task 能根據加" +"入的順序排序。因為沒有任何兩個 task 擁有相同的 entry count,所以永遠不會直接" +"使用 task 做比較。" #: ../../library/heapq.rst:192 msgid "" @@ -439,6 +439,33 @@ msgid "" " return task\n" " raise KeyError('pop from an empty priority queue')" msgstr "" +"pq = [] # 在 heap 中的 entry 串列\n" +"entry_finder = {} # task 對應到 entry 的對映\n" +"REMOVED = '' # 被刪除的 task 的佔位器\n" +"counter = itertools.count() # 唯一的序列計數\n" +"\n" +"def add_task(task, priority=0):\n" +" '新增一個 task 或更新一個已存在 task 的 priority'\n" +" if task in entry_finder:\n" +" remove_task(task)\n" +" count = next(counter)\n" +" entry = [priority, count, task]\n" +" entry_finder[task] = entry\n" +" heappush(pq, entry)\n" +"\n" +"def remove_task(task):\n" +" '將一個已存在的 task 標記為 REMOVED。如果找不到會引發 KeyError。'\n" +" entry = entry_finder.pop(task)\n" +" entry[-1] = REMOVED\n" +"\n" +"def pop_task():\n" +" '移除並回傳最低 priority 的 task。如果 heap 是空的會引發 KeyError。'\n" +" while pq:\n" +" priority, count, task = heappop(pq)\n" +" if task is not REMOVED:\n" +" del entry_finder[task]\n" +" return task\n" +" raise KeyError('從空的優先佇列中 pop 出元素')" #: ../../library/heapq.rst:241 msgid "Theory" @@ -566,7 +593,7 @@ msgstr "" "序涉及 \"runs\" 的產生(也就是預先排序的序列,其大小通常與 CPU 記憶體的大小有" "關),之後再對這些 run 合併,而這些合併的過程通常相當巧妙 [#]_。很重要的一點" "是,初始排序產生的 run 越長越好。錦標賽是達成這一點的好方法,若你用所有可用記" -"憶體來舉行一場錦標賽,並透過替換與向下交換來處理所有適配當前 run 的值,那麼對" +"憶體來舉行一場錦標賽,並透過替換與向下交換來處理所有適配目前 run 的值,那麼對" "於隨機產生的輸入,將可以產生長度兩倍於記憶體大小的 run。對於已模糊排序過的輸" "入,效果更好。" @@ -580,7 +607,7 @@ msgid "" "the first heap is melting. When the first heap completely vanishes, you " "switch heaps and start a new run. Clever and quite effective!" msgstr "" -"此外,若你將索引為 0 的項目輸出至磁碟,並取得一個無法適配當前錦標賽的輸入(因" +"此外,若你將索引為 0 的項目輸出至磁碟,並取得一個無法適配目前錦標賽的輸入(因" "為該值「勝過」最後的輸出值),則該輸入值就無法插入至 heap 當中,因此 heap 的" "大小會減小。釋放出來的記憶體可以巧妙地立即再被運用,逐步建構出第二個 heap,其" "大小增加的速度會與第一個 heap 減少的速度一致。當第一個 heap 完全消失時,你可" diff --git a/library/hmac.po b/library/hmac.po index 96c143d75c..cbad165573 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -109,7 +109,7 @@ msgid "" "given to the constructor. It may contain non-ASCII bytes, including NUL " "bytes." msgstr "" -"回傳當前已傳給 :meth:`update` 方法的 bytes 摘要。這個 bytes 物件的長度會與傳" +"回傳目前已傳給 :meth:`update` 方法的 bytes 摘要。這個 bytes 物件的長度會與傳" "給建構函式的摘要 *digest_size* 的長度相同。它可以包含 NUL bytes 以及 non-" "ASCII bytes。" @@ -200,8 +200,8 @@ msgid "" "attack could theoretically reveal information about the types and lengths of " "*a* and *b*—but not their values." msgstr "" -"如果 *a* 和 *b* 具有不同的長度,或者如果發生了錯誤,定時攻擊在理論上可以獲取" -"有關 *a* 和 *b* 的型別和長度的訊息 — 但不能獲取他們的值。" +"如果 *a* 和 *b* 具有不同的長度,或者如果發生了錯誤,定時攻擊在理論上可以取得" +"有關 *a* 和 *b* 的型別和長度的訊息 — 但不能取得他們的值。" #: ../../library/hmac.rst:140 msgid "" diff --git a/library/html.parser.po b/library/html.parser.po index f8c640799e..e557e6025b 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -192,7 +192,7 @@ msgstr "重置實例。丟棄所有未處理的資料。這在實例化時被會 #: ../../library/html.parser.rst:111 msgid "Return current line number and offset." -msgstr "回傳當前列號 (line number) 和偏移量 (offset)。" +msgstr "回傳目前列號 (line number) 和偏移量 (offset)。" #: ../../library/html.parser.rst:116 msgid "" diff --git a/library/html.po b/library/html.po index 5da95baaf8..a8f42a9973 100644 --- a/library/html.po +++ b/library/html.po @@ -20,7 +20,7 @@ msgstr "" #: ../../library/html.rst:2 msgid ":mod:`!html` --- HyperText Markup Language support" -msgstr ":mod:`!html` --- 超連結標記語言 (HTML) 支援" +msgstr ":mod:`!html` --- 超文本標記語言 (HTML) 支援" #: ../../library/html.rst:7 msgid "**Source code:** :source:`Lib/html/__init__.py`" @@ -45,11 +45,11 @@ msgstr "" #: ../../library/html.rst:26 msgid "" -"Convert all named and numeric character references (e.g. ``>``, ``>" -"``, ``>``) in the string *s* to the corresponding Unicode characters. " -"This function uses the rules defined by the HTML 5 standard for both valid " -"and invalid character references, and the :data:`list of HTML 5 named " -"character references `." +"Convert all named and numeric character references (e.g. ``>``, " +"``>``, ``>``) in the string *s* to the corresponding Unicode " +"characters. This function uses the rules defined by the HTML 5 standard for " +"both valid and invalid character references, and the :data:`list of HTML 5 " +"named character references `." msgstr "" "將字串 *s* 中所有附名 (named) 且為數值的 (numeric) 字元參照(如: ``>``、 " "``>``、``>`` )轉換為對應的 Unicode 字元。此函式針對有效及無效的字元" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index 6184715dab..8614f5b523 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -36,11 +36,11 @@ msgstr "" #: ../../library/http.cookiejar.rst:19 msgid "" -"Both the regular Netscape cookie protocol and the protocol defined by :rfc:" -"`2965` are handled. RFC 2965 handling is switched off by default. :rfc:" -"`2109` cookies are parsed as Netscape cookies and subsequently treated " -"either as Netscape or RFC 2965 cookies according to the 'policy' in effect. " -"Note that the great majority of cookies on the internet are Netscape " +"Both the regular Netscape cookie protocol and the protocol defined " +"by :rfc:`2965` are handled. RFC 2965 handling is switched off by " +"default. :rfc:`2109` cookies are parsed as Netscape cookies and subsequently " +"treated either as Netscape or RFC 2965 cookies according to the 'policy' in " +"effect. Note that the great majority of cookies on the internet are Netscape " "cookies. :mod:`http.cookiejar` attempts to follow the de-facto Netscape " "cookie protocol (which differs substantially from that set out in the " "original Netscape specification), including taking note of the ``max-age`` " @@ -49,11 +49,11 @@ msgstr "" #: ../../library/http.cookiejar.rst:31 msgid "" -"The various named parameters found in :mailheader:`Set-Cookie` and :" -"mailheader:`Set-Cookie2` headers (eg. ``domain`` and ``expires``) are " +"The various named parameters found in :mailheader:`Set-Cookie` " +"and :mailheader:`Set-Cookie2` headers (eg. ``domain`` and ``expires``) are " "conventionally referred to as :dfn:`attributes`. To distinguish them from " -"Python attributes, the documentation for this module uses the term :dfn:" -"`cookie-attribute` instead." +"Python attributes, the documentation for this module uses the " +"term :dfn:`cookie-attribute` instead." msgstr "" #: ../../library/http.cookiejar.rst:38 @@ -126,8 +126,8 @@ msgid "" "a sequence of the only domains for which we accept and return cookies. " "*secure_protocols* is a sequence of protocols for which secure cookies can " "be added to. By default *https* and *wss* (secure websocket) are considered " -"secure protocols. For all other arguments, see the documentation for :class:" -"`CookiePolicy` and :class:`DefaultCookiePolicy` objects." +"secure protocols. For all other arguments, see the documentation " +"for :class:`CookiePolicy` and :class:`DefaultCookiePolicy` objects." msgstr "" #: ../../library/http.cookiejar.rst:98 @@ -138,17 +138,17 @@ msgid "" "attribute of 1) are treated according to the RFC 2965 rules. However, if " "RFC 2965 handling is turned off or :attr:`rfc2109_as_netscape` is ``True``, " "RFC 2109 cookies are 'downgraded' by the :class:`CookieJar` instance to " -"Netscape cookies, by setting the :attr:`version` attribute of the :class:" -"`Cookie` instance to 0. :class:`DefaultCookiePolicy` also provides some " -"parameters to allow some fine-tuning of policy." +"Netscape cookies, by setting the :attr:`version` attribute of " +"the :class:`Cookie` instance to 0. :class:`DefaultCookiePolicy` also " +"provides some parameters to allow some fine-tuning of policy." msgstr "" #: ../../library/http.cookiejar.rst:111 msgid "" "This class represents Netscape, :rfc:`2109` and :rfc:`2965` cookies. It is " -"not expected that users of :mod:`http.cookiejar` construct their own :class:" -"`Cookie` instances. Instead, if necessary, call :meth:`make_cookies` on a :" -"class:`CookieJar` instance." +"not expected that users of :mod:`http.cookiejar` construct their " +"own :class:`Cookie` instances. Instead, if necessary, " +"call :meth:`make_cookies` on a :class:`CookieJar` instance." msgstr "" #: ../../library/http.cookiejar.rst:119 @@ -165,8 +165,9 @@ msgstr ":mod:`http.cookies` 模組" #: ../../library/http.cookiejar.rst:123 msgid "" -"HTTP cookie classes, principally useful for server-side code. The :mod:" -"`http.cookiejar` and :mod:`http.cookies` modules do not depend on each other." +"HTTP cookie classes, principally useful for server-side code. " +"The :mod:`http.cookiejar` and :mod:`http.cookies` modules do not depend on " +"each other." msgstr "" #: ../../library/http.cookiejar.rst:127 @@ -227,7 +228,7 @@ msgstr ":class:`CookieJar` 擁有以下方法:" #: ../../library/http.cookiejar.rst:158 msgid "Add correct :mailheader:`Cookie` header to *request*." -msgstr "" +msgstr "將正確的 :mailheader:`Cookie` 標頭加入 *request*。" #: ../../library/http.cookiejar.rst:160 msgid "" @@ -240,10 +241,10 @@ msgstr "" #: ../../library/http.cookiejar.rst:164 msgid "" "The *request* object (usually a :class:`urllib.request.Request` instance) " -"must support the methods :meth:`get_full_url`, :meth:`has_header`, :meth:" -"`get_header`, :meth:`header_items`, :meth:`add_unredirected_header` and the " -"attributes :attr:`host`, :attr:`!type`, :attr:`unverifiable` and :attr:" -"`origin_req_host` as documented by :mod:`urllib.request`." +"must support the " +"methods :meth:`get_full_url`, :meth:`has_header`, :meth:`get_header`, :meth:`header_items`, :meth:`add_unredirected_header` " +"and the attributes :attr:`host`, :attr:`!type`, :attr:`unverifiable` " +"and :attr:`origin_req_host` as documented by :mod:`urllib.request`." msgstr "" #: ../../library/http.cookiejar.rst:172 ../../library/http.cookiejar.rst:198 @@ -254,32 +255,34 @@ msgstr "" #: ../../library/http.cookiejar.rst:178 msgid "" -"Extract cookies from HTTP *response* and store them in the :class:" -"`CookieJar`, where allowed by policy." +"Extract cookies from HTTP *response* and store them in " +"the :class:`CookieJar`, where allowed by policy." msgstr "" #: ../../library/http.cookiejar.rst:181 msgid "" -"The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and :" -"mailheader:`Set-Cookie2` headers in the *response* argument, and store " +"The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` " +"and :mailheader:`Set-Cookie2` headers in the *response* argument, and store " "cookies as appropriate (subject to the :meth:`CookiePolicy.set_ok` method's " "approval)." msgstr "" #: ../../library/http.cookiejar.rst:185 msgid "" -"The *response* object (usually the result of a call to :meth:`urllib.request." -"urlopen`, or similar) should support an :meth:`info` method, which returns " -"an :class:`email.message.Message` instance." +"The *response* object (usually the result of a call " +"to :meth:`urllib.request.urlopen`, or similar) should support " +"an :meth:`info` method, which returns an :class:`email.message.Message` " +"instance." msgstr "" #: ../../library/http.cookiejar.rst:189 msgid "" "The *request* object (usually a :class:`urllib.request.Request` instance) " -"must support the method :meth:`get_full_url` and the attributes :attr:" -"`host`, :attr:`unverifiable` and :attr:`origin_req_host`, as documented by :" -"mod:`urllib.request`. The request is used to set default values for cookie-" -"attributes as well as for checking that the cookie is allowed to be set." +"must support the method :meth:`get_full_url` and the " +"attributes :attr:`host`, :attr:`unverifiable` and :attr:`origin_req_host`, " +"as documented by :mod:`urllib.request`. The request is used to set default " +"values for cookie-attributes as well as for checking that the cookie is " +"allowed to be set." msgstr "" #: ../../library/http.cookiejar.rst:203 @@ -309,7 +312,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:227 msgid "Clear some cookies." -msgstr "" +msgstr "清除一些 cookies。" #: ../../library/http.cookiejar.rst:229 msgid "" @@ -322,7 +325,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:235 msgid "Raises :exc:`KeyError` if no matching cookie exists." -msgstr "" +msgstr "如果沒有符合的 cookie 存在,則引發 :exc:`KeyError`。" #: ../../library/http.cookiejar.rst:240 msgid "Discard all session cookies." @@ -349,7 +352,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:255 msgid "Save cookies to a file." -msgstr "" +msgstr "將 cookies 儲存到檔案中。" #: ../../library/http.cookiejar.rst:257 msgid "" @@ -361,8 +364,8 @@ msgstr "" msgid "" "*filename* is the name of file in which to save cookies. If *filename* is " "not specified, :attr:`self.filename` is used (whose default is the value " -"passed to the constructor, if any); if :attr:`self.filename` is :const:" -"`None`, :exc:`ValueError` is raised." +"passed to the constructor, if any); if :attr:`self.filename` " +"is :const:`None`, :exc:`ValueError` is raised." msgstr "" #: ../../library/http.cookiejar.rst:265 @@ -374,32 +377,32 @@ msgstr "" #: ../../library/http.cookiejar.rst:268 msgid "" "The file is overwritten if it already exists, thus wiping all the cookies it " -"contains. Saved cookies can be restored later using the :meth:`load` or :" -"meth:`revert` methods." +"contains. Saved cookies can be restored later using the :meth:`load` " +"or :meth:`revert` methods." msgstr "" #: ../../library/http.cookiejar.rst:275 msgid "Load cookies from a file." -msgstr "" +msgstr "從檔案中載入 cookies。" #: ../../library/http.cookiejar.rst:277 msgid "Old cookies are kept unless overwritten by newly loaded ones." -msgstr "" +msgstr "舊的 cookies 會被保留,除非被新載入的 cookies 覆蓋。" #: ../../library/http.cookiejar.rst:279 msgid "Arguments are as for :meth:`save`." -msgstr "" +msgstr "引數與 :meth:`save` 相同。" #: ../../library/http.cookiejar.rst:281 msgid "" -"The named file must be in the format understood by the class, or :exc:" -"`LoadError` will be raised. Also, :exc:`OSError` may be raised, for example " -"if the file does not exist." +"The named file must be in the format understood by the class, " +"or :exc:`LoadError` will be raised. Also, :exc:`OSError` may be raised, for " +"example if the file does not exist." msgstr "" #: ../../library/http.cookiejar.rst:285 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." -msgstr "" +msgstr "以前會引發 :exc:`IOError`,現在它是 :exc:`OSError` 的別名。" #: ../../library/http.cookiejar.rst:291 msgid "Clear all cookies and reload cookies from a saved file." @@ -413,7 +416,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:296 msgid ":class:`FileCookieJar` instances have the following public attributes:" -msgstr "" +msgstr ":class:`FileCookieJar` 實例擁有以下公開屬性:" #: ../../library/http.cookiejar.rst:301 msgid "" @@ -493,8 +496,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:366 msgid "" "*cookie* is a :class:`Cookie` instance. *request* is an object implementing " -"the interface defined by the documentation for :meth:`CookieJar." -"extract_cookies`." +"the interface defined by the documentation " +"for :meth:`CookieJar.extract_cookies`." msgstr "" #: ../../library/http.cookiejar.rst:373 @@ -505,8 +508,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:375 msgid "" "*cookie* is a :class:`Cookie` instance. *request* is an object implementing " -"the interface defined by the documentation for :meth:`CookieJar." -"add_cookie_header`." +"the interface defined by the documentation " +"for :meth:`CookieJar.add_cookie_header`." msgstr "" #: ../../library/http.cookiejar.rst:382 @@ -524,12 +527,13 @@ msgstr "" #: ../../library/http.cookiejar.rst:389 msgid "" -"If :meth:`domain_return_ok` returns true for the cookie domain, :meth:" -"`path_return_ok` is called for the cookie path. Otherwise, :meth:" -"`path_return_ok` and :meth:`return_ok` are never called for that cookie " -"domain. If :meth:`path_return_ok` returns true, :meth:`return_ok` is called " -"with the :class:`Cookie` object itself for a full check. Otherwise, :meth:" -"`return_ok` is never called for that cookie path." +"If :meth:`domain_return_ok` returns true for the cookie " +"domain, :meth:`path_return_ok` is called for the cookie path. " +"Otherwise, :meth:`path_return_ok` and :meth:`return_ok` are never called for " +"that cookie domain. If :meth:`path_return_ok` returns " +"true, :meth:`return_ok` is called with the :class:`Cookie` object itself for " +"a full check. Otherwise, :meth:`return_ok` is never called for that cookie " +"path." msgstr "" #: ../../library/http.cookiejar.rst:396 @@ -554,19 +558,19 @@ msgstr "關於 :meth:`domain_return_ok` 請見文件。" #: ../../library/http.cookiejar.rst:410 msgid "" -"In addition to implementing the methods above, implementations of the :class:" -"`CookiePolicy` interface must also supply the following attributes, " -"indicating which protocols should be used, and how. All of these attributes " -"may be assigned to." +"In addition to implementing the methods above, implementations of " +"the :class:`CookiePolicy` interface must also supply the following " +"attributes, indicating which protocols should be used, and how. All of " +"these attributes may be assigned to." msgstr "" #: ../../library/http.cookiejar.rst:418 msgid "Implement Netscape protocol." -msgstr "" +msgstr "實作 Netscape 協定。" #: ../../library/http.cookiejar.rst:423 msgid "Implement :rfc:`2965` protocol." -msgstr "" +msgstr "實作 :rfc:`2965` 協定。" #: ../../library/http.cookiejar.rst:428 msgid "" @@ -640,8 +644,8 @@ msgid "" "A domain blocklist and allowlist is provided (both off by default). Only " "domains not in the blocklist and present in the allowlist (if the allowlist " "is active) participate in cookie setting and returning. Use the " -"*blocked_domains* constructor argument, and :meth:`blocked_domains` and :" -"meth:`set_blocked_domains` methods (and the corresponding argument and " +"*blocked_domains* constructor argument, and :meth:`blocked_domains` " +"and :meth:`set_blocked_domains` methods (and the corresponding argument and " "methods for *allowed_domains*). If you set an allowlist, you can turn it " "off again by setting it to :const:`None`." msgstr "" @@ -652,11 +656,12 @@ msgid "" "cookie domain to be matched. For example, ``\"example.com\"`` matches a " "blocklist entry of ``\"example.com\"``, but ``\"www.example.com\"`` does " "not. Domains that do start with a dot are matched by more specific domains " -"too. For example, both ``\"www.example.com\"`` and ``\"www.coyote.example." -"com\"`` match ``\".example.com\"`` (but ``\"example.com\"`` itself does " -"not). IP addresses are an exception, and must match exactly. For example, " -"if blocked_domains contains ``\"192.168.1.2\"`` and ``\".168.1.2\"``, " -"192.168.1.2 is blocked, but 193.168.1.2 is not." +"too. For example, both ``\"www.example.com\"`` and " +"``\"www.coyote.example.com\"`` match ``\".example.com\"`` (but " +"``\"example.com\"`` itself does not). IP addresses are an exception, and " +"must match exactly. For example, if blocked_domains contains " +"``\"192.168.1.2\"`` and ``\".168.1.2\"``, 192.168.1.2 is blocked, but " +"193.168.1.2 is not." msgstr "" #: ../../library/http.cookiejar.rst:483 @@ -704,10 +709,10 @@ msgid "" "If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` " "cookies (ie. cookies received in a :mailheader:`Set-Cookie` header with a " "version cookie-attribute of 1) to Netscape cookies by setting the version " -"attribute of the :class:`Cookie` instance to 0. The default value is :const:" -"`None`, in which case RFC 2109 cookies are downgraded if and only if :rfc:" -"`2965` handling is turned off. Therefore, RFC 2109 cookies are downgraded " -"by default." +"attribute of the :class:`Cookie` instance to 0. The default value " +"is :const:`None`, in which case RFC 2109 cookies are downgraded if and only " +"if :rfc:`2965` handling is turned off. Therefore, RFC 2109 cookies are " +"downgraded by default." msgstr "" #: ../../library/http.cookiejar.rst:532 @@ -767,8 +772,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:580 msgid "" -"When setting cookies, the 'host prefix' must not contain a dot (eg. ``www." -"foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo`` " +"When setting cookies, the 'host prefix' must not contain a dot (eg. " +"``www.foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo`` " "contains a dot)." msgstr "" @@ -824,10 +829,10 @@ msgstr "" #: ../../library/http.cookiejar.rst:630 msgid "" -"Integer or :const:`None`. Netscape cookies have :attr:`version` 0. :rfc:" -"`2965` and :rfc:`2109` cookies have a ``version`` cookie-attribute of 1. " -"However, note that :mod:`http.cookiejar` may 'downgrade' RFC 2109 cookies to " -"Netscape cookies, in which case :attr:`version` is 0." +"Integer or :const:`None`. Netscape cookies have :attr:`version` " +"0. :rfc:`2965` and :rfc:`2109` cookies have a ``version`` cookie-attribute " +"of 1. However, note that :mod:`http.cookiejar` may 'downgrade' RFC 2109 " +"cookies to Netscape cookies, in which case :attr:`version` is 0." msgstr "" #: ../../library/http.cookiejar.rst:638 @@ -840,8 +845,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:648 msgid "" -"String representing a port or a set of ports (eg. '80', or '80,8080'), or :" -"const:`None`." +"String representing a port or a set of ports (eg. '80', or '80,8080'), " +"or :const:`None`." msgstr "" #: ../../library/http.cookiejar.rst:654 @@ -858,8 +863,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:669 msgid "" -"Integer expiry date in seconds since epoch, or :const:`None`. See also the :" -"meth:`is_expired` method." +"Integer expiry date in seconds since epoch, or :const:`None`. See also " +"the :meth:`is_expired` method." msgstr "" #: ../../library/http.cookiejar.rst:675 @@ -868,8 +873,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:680 msgid "" -"String comment from the server explaining the function of this cookie, or :" -"const:`None`." +"String comment from the server explaining the function of this cookie, " +"or :const:`None`." msgstr "" #: ../../library/http.cookiejar.rst:686 @@ -947,14 +952,14 @@ msgstr "" msgid "" "import http.cookiejar, urllib.request\n" "cj = http.cookiejar.CookieJar()\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" msgstr "" "import http.cookiejar, urllib.request\n" "cj = http.cookiejar.CookieJar()\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" #: ../../library/http.cookiejar.rst:754 @@ -968,18 +973,18 @@ msgstr "" msgid "" "import os, http.cookiejar, urllib.request\n" "cj = http.cookiejar.MozillaCookieJar()\n" -"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", \"cookies." -"txt\"))\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", " +"\"cookies.txt\"))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" msgstr "" "import os, http.cookiejar, urllib.request\n" "cj = http.cookiejar.MozillaCookieJar()\n" -"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", \"cookies." -"txt\"))\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", " +"\"cookies.txt\"))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" #: ../../library/http.cookiejar.rst:763 @@ -998,8 +1003,8 @@ msgid "" " rfc2965=True, strict_ns_domain=Policy.DomainStrict,\n" " blocked_domains=[\"ads.net\", \".ads.net\"])\n" "cj = CookieJar(policy)\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" msgstr "" "import urllib.request\n" @@ -1008,6 +1013,6 @@ msgstr "" " rfc2965=True, strict_ns_domain=Policy.DomainStrict,\n" " blocked_domains=[\"ads.net\", \".ads.net\"])\n" "cj = CookieJar(policy)\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com/\")" diff --git a/library/http.cookies.po b/library/http.cookies.po index 4bd8b76059..28b2b12d38 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2016-11-19 00:31+0000\n" +"POT-Creation-Date: 2024-12-14 00:14+0000\n" +"PO-Revision-Date: 2024-12-24 18:49+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -32,16 +32,22 @@ msgid "" "string-only cookies, and provides an abstraction for having any serializable " "data-type as cookie value." msgstr "" +":mod:`http.cookies` 模組定義了 cookie 概念的抽象化的類別,cookie 是一種 HTTP " +"狀態管理機制。它支援簡單的純字串 cookie,也提供了將任何可序列化的資料型別作" +"為 cookie 值的抽象化。" #: ../../library/http.cookies.rst:19 msgid "" -"The module formerly strictly applied the parsing rules described in the :rfc:" -"`2109` and :rfc:`2068` specifications. It has since been discovered that " -"MSIE 3.0x didn't follow the character rules outlined in those specs; many " -"current-day browsers and servers have also relaxed parsing rules when it " -"comes to cookie handling. As a result, this module now uses parsing rules " -"that are a bit less strict than they once were." +"The module formerly strictly applied the parsing rules described in " +"the :rfc:`2109` and :rfc:`2068` specifications. It has since been " +"discovered that MSIE 3.0x didn't follow the character rules outlined in " +"those specs; many current-day browsers and servers have also relaxed parsing " +"rules when it comes to cookie handling. As a result, this module now uses " +"parsing rules that are a bit less strict than they once were." msgstr "" +"此模組原先嚴格遵循了 :rfc:`2109` 和 :rfc:`2068` 規範所描述的剖析規則。自從發" +"現 MSIE 3.0x 並不遵循這些規範所描述的字元規則,許多目前的瀏覽器和伺服器也在處" +"理 cookie 時放寬了剖析規則。因此,此模組現在使用的剖析規則比之前的更為寬鬆。" #: ../../library/http.cookies.rst:26 msgid "" @@ -49,10 +55,13 @@ msgid "" "``!#$%&'*+-.^_`|~:`` denote the set of valid characters allowed by this " "module in a cookie name (as :attr:`~Morsel.key`)." msgstr "" +"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$" +"%&'*+-.^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字" +"元集合。" #: ../../library/http.cookies.rst:30 msgid "Allowed ':' as a valid cookie name character." -msgstr "" +msgstr "允許 ':' 作為有效的 cookie 名稱字元。" #: ../../library/http.cookies.rst:36 msgid "" @@ -60,12 +69,16 @@ msgid "" "cookie data comes from a browser you should always prepare for invalid data " "and catch :exc:`CookieError` on parsing." msgstr "" +"當遇到無效的 cookie 時,會引發 :exc:`CookieError`,因此如果你的 cookie 資料來" +"自瀏覽器,在剖析時你應該總是為無效資料作準備並捕捉 :exc:`CookieError`。" #: ../../library/http.cookies.rst:43 msgid "" "Exception failing because of :rfc:`2109` invalidity: incorrect attributes, " "incorrect :mailheader:`Set-Cookie` header, etc." msgstr "" +"因為不符合 :rfc:`2109` 而引發的例外:不正確的屬性、不正確的 :mailheader:`Set-" +"Cookie` 標頭等。" #: ../../library/http.cookies.rst:49 msgid "" @@ -74,19 +87,26 @@ msgid "" "value, the value is first converted to a :class:`Morsel` containing the key " "and the value." msgstr "" +"這個類別是一個類似字典的物件,其中的鍵是字串,而值則是 :class:`Morsel` 實例。" +"請注意,當設定鍵的值時,值會先被轉換為一個包含該鍵和值的 :class:`Morsel`。" #: ../../library/http.cookies.rst:53 msgid "If *input* is given, it is passed to the :meth:`load` method." -msgstr "" +msgstr "如果有給定 *input*,它會被傳遞給 :meth:`load` 方法。" #: ../../library/http.cookies.rst:58 msgid "" -"This class derives from :class:`BaseCookie` and overrides :meth:`~BaseCookie." -"value_decode` and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` " -"supports strings as cookie values. When setting the value, :class:`!" -"SimpleCookie` calls the builtin :func:`str` to convert the value to a " -"string. Values received from HTTP are kept as strings." -msgstr "" +"This class derives from :class:`BaseCookie` and " +"overrides :meth:`~BaseCookie.value_decode` " +"and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` supports " +"strings as cookie values. When setting the value, :class:`!SimpleCookie` " +"calls the builtin :func:`str` to convert the value to a string. Values " +"received from HTTP are kept as strings." +msgstr "" +"這個類別繼承自 :class:`BaseCookie` 並覆寫了 :meth:`~BaseCookie.value_decode` " +"和 :meth:`~BaseCookie.value_encode`。:class:`!SimpleCookie` 支援字串作為 " +"cookie 值。當設定值時,:class:`!SimpleCookie` 會呼叫內建的 :func:`str` 來將值" +"轉換為字串。從 HTTP 接收的值會保持為字串。" #: ../../library/http.cookies.rst:66 msgid "Module :mod:`http.cookiejar`" @@ -94,17 +114,19 @@ msgstr ":mod:`http.cookiejar` 模組" #: ../../library/http.cookies.rst:67 msgid "" -"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` and :mod:" -"`http.cookies` modules do not depend on each other." +"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` " +"and :mod:`http.cookies` modules do not depend on each other." msgstr "" +"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` " +"和 :mod:`http.cookies` 模組互不相依。" #: ../../library/http.cookies.rst:70 msgid ":rfc:`2109` - HTTP State Management Mechanism" -msgstr "" +msgstr ":rfc:`2109` - HTTP 狀態管理機制" #: ../../library/http.cookies.rst:71 msgid "This is the state management specification implemented by this module." -msgstr "" +msgstr "這是此模組實作的狀態管理規範。" #: ../../library/http.cookies.rst:77 msgid "Cookie Objects" @@ -113,9 +135,11 @@ msgstr "Cookie 物件" #: ../../library/http.cookies.rst:82 msgid "" "Return a tuple ``(real_value, coded_value)`` from a string representation. " -"``real_value`` can be any type. This method does no decoding in :class:" -"`BaseCookie` --- it exists so it can be overridden." +"``real_value`` can be any type. This method does no decoding " +"in :class:`BaseCookie` --- it exists so it can be overridden." msgstr "" +"從字串表示回傳 ``(real_value, coded_value)`` 的元組。``real_value`` 可以是任" +"何型別。此方法在 :class:`BaseCookie` 中不做解碼 --- 它存在以便可以被覆寫。" #: ../../library/http.cookies.rst:89 msgid "" @@ -123,31 +147,41 @@ msgid "" "``coded_value`` will always be converted to a string. This method does no " "encoding in :class:`BaseCookie` --- it exists so it can be overridden." msgstr "" +"回傳一個元組 ``(real_value, coded_value)``。*val* 可以是任何型別,但 " +"``coded_value`` 總是會被轉換為字串。此方法在 :class:`BaseCookie` 中不做編碼 " +"--- 它存在以便可以被覆寫。" #: ../../library/http.cookies.rst:94 msgid "" -"In general, it should be the case that :meth:`value_encode` and :meth:" -"`value_decode` are inverses on the range of *value_decode*." +"In general, it should be the case that :meth:`value_encode` " +"and :meth:`value_decode` are inverses on the range of *value_decode*." msgstr "" +"一般來說,:meth:`value_encode` 和 :meth:`value_decode` 應該在 *value_decode* " +"的範圍內是互逆的 (inverse)。" #: ../../library/http.cookies.rst:100 msgid "" "Return a string representation suitable to be sent as HTTP headers. *attrs* " -"and *header* are sent to each :class:`Morsel`'s :meth:`output` method. *sep* " -"is used to join the headers together, and is by default the combination " -"``'\\r\\n'`` (CRLF)." +"and *header* are sent to each :class:`Morsel`'s :meth:`~Morsel.output` " +"method. *sep* is used to join the headers together, and is by default the " +"combination ``'\\r\\n'`` (CRLF)." msgstr "" +"回傳一個適合作為 HTTP 標頭來傳送的字串表示。*attrs* 和 *header* 會傳送給每" +"個 :class:`Morsel` 的 :meth:`~Morsel.output` 方法。*sep* 用來連接標頭,預設" +"為 ``'\\r\\n'`` (CRLF) 的組合。" #: ../../library/http.cookies.rst:108 msgid "" "Return an embeddable JavaScript snippet, which, if run on a browser which " "supports JavaScript, will act the same as if the HTTP headers was sent." msgstr "" +"回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" +"行為會與 HTTP 標頭被傳送的情況相同。" #: ../../library/http.cookies.rst:111 ../../library/http.cookies.rst:207 #: ../../library/http.cookies.rst:215 msgid "The meaning for *attrs* is the same as in :meth:`output`." -msgstr "" +msgstr "*attrs* 的意義與 :meth:`output` 裡的相同。" #: ../../library/http.cookies.rst:116 msgid "" @@ -155,6 +189,8 @@ msgid "" "found there as :class:`Morsel`\\ s. If it is a dictionary, it is equivalent " "to::" msgstr "" +"如果 *rawdata* 是字串,會將其作為 ``HTTP_COOKIE`` 剖析,並將在其中找到的值當" +"作 :class:`Morsel` 新增。如果它是一個字典,則等同於: ::" #: ../../library/http.cookies.rst:119 msgid "" @@ -170,13 +206,15 @@ msgstr "Morsel 物件" #: ../../library/http.cookies.rst:131 msgid "Abstract a key/value pair, which has some :rfc:`2109` attributes." -msgstr "" +msgstr "抽象化一個鍵 / 值對,它有一些 :rfc:`2109` 屬性。" #: ../../library/http.cookies.rst:133 msgid "" "Morsels are dictionary-like objects, whose set of keys is constant --- the " "valid :rfc:`2109` attributes, which are:" msgstr "" +"Morsel 是一種類似字典的物件,其鍵的集合是固定的 --- 有效的 :rfc:`2109` 屬性," +"它們是:" #: ../../library/http.cookies.rst:146 msgid "" @@ -184,6 +222,8 @@ msgid "" "in HTTP requests, and is not accessible through JavaScript. This is intended " "to mitigate some forms of cross-site scripting." msgstr "" +"屬性 :attr:`httponly` 指定 cookie 僅在 HTTP 請求中傳輸,而不可通過 " +"JavaScript 存取。這是為了減輕某些形式的跨網站腳本攻擊。" #: ../../library/http.cookies.rst:150 msgid "" @@ -191,46 +231,53 @@ msgid "" "send the cookie along with cross-site requests. This helps to mitigate CSRF " "attacks. Valid values for this attribute are \"Strict\" and \"Lax\"." msgstr "" +"屬性 :attr:`samesite` 指定瀏覽器不能將 cookie 與跨網站請求一起傳送。這有助於" +"減輕 CSRF 攻擊。此屬性的有效值為 \"Strict\" 和 \"Lax\"。" #: ../../library/http.cookies.rst:154 msgid "The keys are case-insensitive and their default value is ``''``." -msgstr "" +msgstr "鍵不區分大小寫,其預設值為 ``''``。" #: ../../library/http.cookies.rst:156 msgid "" ":meth:`!__eq__` now takes :attr:`~Morsel.key` and :attr:`~Morsel.value` into " "account." msgstr "" +":meth:`!__eq__` 現在會考慮 :attr:`~Morsel.key` 和 :attr:`~Morsel.value`。" #: ../../library/http.cookies.rst:160 msgid "" -"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` and :attr:`~Morsel." -"coded_value` are read-only. Use :meth:`~Morsel.set` for setting them." +"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` " +"and :attr:`~Morsel.coded_value` are read-only. Use :meth:`~Morsel.set` for " +"setting them." msgstr "" +"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` " +"和 :attr:`~Morsel.coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它" +"們。" #: ../../library/http.cookies.rst:165 msgid "Added support for the :attr:`samesite` attribute." -msgstr "新增 :attr:`samesite` 屬性的支援" +msgstr "新增對 :attr:`samesite` 屬性的支援。" #: ../../library/http.cookies.rst:171 msgid "The value of the cookie." -msgstr "" +msgstr "cookie 的值。" #: ../../library/http.cookies.rst:176 msgid "The encoded value of the cookie --- this is what should be sent." -msgstr "" +msgstr "cookie 的編碼值 --- 這是應該被傳送的值。" #: ../../library/http.cookies.rst:181 msgid "The name of the cookie." -msgstr "" +msgstr "cookie 的名稱。" #: ../../library/http.cookies.rst:186 msgid "Set the *key*, *value* and *coded_value* attributes." -msgstr "" +msgstr "設定 *key*、*value* 和 *coded_value* 屬性。" #: ../../library/http.cookies.rst:191 msgid "Whether *K* is a member of the set of keys of a :class:`Morsel`." -msgstr "" +msgstr "*K* 是否為 :class:`Morsel` 的鍵集合中的成員。" #: ../../library/http.cookies.rst:196 msgid "" @@ -239,18 +286,23 @@ msgid "" "given, in which case it should be a list of attributes to use. *header* is " "by default ``\"Set-Cookie:\"``." msgstr "" +"回傳適合作為 HTTP 標頭傳送的 Morsel 的字串表示。預設會包含所有屬性,除非有給" +"定 *attrs*,在此情況下,它應該是一個要使用的屬性的串列。預設的 *header* 是 " +"``\"Set-Cookie:\"``。" #: ../../library/http.cookies.rst:204 msgid "" "Return an embeddable JavaScript snippet, which, if run on a browser which " "supports JavaScript, will act the same as if the HTTP header was sent." msgstr "" +"回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" +"行為會與 HTTP 標頭被傳送的情況相同。" #: ../../library/http.cookies.rst:212 msgid "" "Return a string representing the Morsel, without any surrounding HTTP or " "JavaScript." -msgstr "" +msgstr "回傳表示 Morsel 的字串,不包含周圍任何的 HTTP 或 JavaScript。" #: ../../library/http.cookies.rst:220 msgid "" @@ -258,24 +310,28 @@ msgid "" "*values*. Raise an error if any of the keys in the *values* dict is not a " "valid :rfc:`2109` attribute." msgstr "" +"更新 Morsel 字典中的值為 *values* 字典中的值。如果 *values* 字典中的任何鍵不" +"是有效的 :rfc:`2109` 屬性則引發錯誤。" #: ../../library/http.cookies.rst:224 msgid "an error is raised for invalid keys." -msgstr "" +msgstr "對於無效的鍵會引發錯誤。" #: ../../library/http.cookies.rst:230 msgid "Return a shallow copy of the Morsel object." -msgstr "" +msgstr "回傳 Morsel 物件的淺層複製。" #: ../../library/http.cookies.rst:232 msgid "return a Morsel object instead of a dict." -msgstr "" +msgstr "回傳 Morsel 物件而不是字典。" #: ../../library/http.cookies.rst:238 msgid "" "Raise an error if key is not a valid :rfc:`2109` attribute, otherwise behave " "the same as :meth:`dict.setdefault`." msgstr "" +"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為" +"與 :meth:`dict.setdefault` 相同。" #: ../../library/http.cookies.rst:245 msgid "Example" @@ -284,7 +340,7 @@ msgstr "範例" #: ../../library/http.cookies.rst:247 msgid "" "The following example demonstrates how to use the :mod:`http.cookies` module." -msgstr "" +msgstr "以下範例示範如何使用 :mod:`http.cookies` 模組。" #: ../../library/http.cookies.rst:249 msgid "" @@ -335,3 +391,48 @@ msgid "" "Set-Cookie: number=7\n" "Set-Cookie: string=seven" msgstr "" +">>> from http import cookies\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"fig\"] = \"newton\"\n" +">>> C[\"sugar\"] = \"wafer\"\n" +">>> print(C) # 產生 HTTP 標頭\n" +"Set-Cookie: fig=newton\n" +"Set-Cookie: sugar=wafer\n" +">>> print(C.output()) # 同上\n" +"Set-Cookie: fig=newton\n" +"Set-Cookie: sugar=wafer\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"rocky\"] = \"road\"\n" +">>> C[\"rocky\"][\"path\"] = \"/cookie\"\n" +">>> print(C.output(header=\"Cookie:\"))\n" +"Cookie: rocky=road; Path=/cookie\n" +">>> print(C.output(attrs=[], header=\"Cookie:\"))\n" +"Cookie: rocky=road\n" +">>> C = cookies.SimpleCookie()\n" +">>> C.load(\"chips=ahoy; vienna=finger\") # 從字串(HTTP 標頭)載入\n" +">>> print(C)\n" +"Set-Cookie: chips=ahoy\n" +"Set-Cookie: vienna=finger\n" +">>> C = cookies.SimpleCookie()\n" +">>> C.load('keebler=\"E=everybody; L=\\\\\"Loves\\\\\"; fudge=\\\\012;\";')\n" +">>> print(C)\n" +"Set-Cookie: keebler=\"E=everybody; L=\\\"Loves\\\"; fudge=\\012;\"\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"oreo\"] = \"doublestuff\"\n" +">>> C[\"oreo\"][\"path\"] = \"/\"\n" +">>> print(C)\n" +"Set-Cookie: oreo=doublestuff; Path=/\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"twix\"] = \"none for you\"\n" +">>> C[\"twix\"].value\n" +"'none for you'\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"number\"] = 7 # 等同於 C[\"number\"] = str(7)\n" +">>> C[\"string\"] = \"seven\"\n" +">>> C[\"number\"].value\n" +"'7'\n" +">>> C[\"string\"].value\n" +"'seven'\n" +">>> print(C)\n" +"Set-Cookie: number=7\n" +"Set-Cookie: string=seven" diff --git a/library/http.po b/library/http.po index 96924cb5a1..f1803bc12b 100644 --- a/library/http.po +++ b/library/http.po @@ -40,13 +40,13 @@ msgid "" ":mod:`http.client` is a low-level HTTP protocol client; for high-level URL " "opening use :mod:`urllib.request`" msgstr "" -":mod:`http.client` 是一個低階的 HTTP 協定客戶端;對於高階的 URL 訪問請使用 :" -"mod:`urllib.request`" +":mod:`http.client` 是一個低階的 HTTP 協定客戶端;對於高階的 URL 存取請使" +"用 :mod:`urllib.request`" #: ../../library/http.rst:20 msgid "" -":mod:`http.server` contains basic HTTP server classes based on :mod:" -"`socketserver`" +":mod:`http.server` contains basic HTTP server classes based " +"on :mod:`socketserver`" msgstr ":mod:`http.server` 包含基於 :mod:`socketserver` 的基本 HTTP 伺服器類別" #: ../../library/http.rst:21 @@ -116,8 +116,8 @@ msgstr "HTTP 狀態碼" #: ../../library/http.rst:55 msgid "" "Supported, `IANA-registered status codes `_ available in :class:`http." -"HTTPStatus` are:" +"http-status-codes/http-status-codes.xhtml>`_ available " +"in :class:`http.HTTPStatus` are:" msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" @@ -590,9 +590,8 @@ msgid "``413``" msgstr "``413``" #: ../../library/http.rst:97 -#, fuzzy msgid "``CONTENT_TOO_LARGE``" -msgstr "``REQUEST_ENTITY_TOO_LARGE``" +msgstr "``CONTENT_TOO_LARGE``" #: ../../library/http.rst:97 #, fuzzy @@ -604,9 +603,8 @@ msgid "``414``" msgstr "``414``" #: ../../library/http.rst:98 -#, fuzzy msgid "``URI_TOO_LONG``" -msgstr "``REQUEST_URI_TOO_LONG``" +msgstr "``URI_TOO_LONG``" #: ../../library/http.rst:98 #, fuzzy @@ -631,9 +629,8 @@ msgid "``416``" msgstr "``416``" #: ../../library/http.rst:100 -#, fuzzy msgid "``RANGE_NOT_SATISFIABLE``" -msgstr "``REQUESTED_RANGE_NOT_SATISFIABLE``" +msgstr "``RANGE_NOT_SATISFIABLE``" #: ../../library/http.rst:100 #, fuzzy diff --git a/library/http.server.po b/library/http.server.po index e9346abbd1..73e6238b9b 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-16 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "此模組定義了用於實作 HTTP 伺服器的類別。" #: ../../library/http.server.rst:22 msgid "" -":mod:`http.server` is not recommended for production. It only implements :" -"ref:`basic security checks `." +":mod:`http.server` is not recommended for production. It only " +"implements :ref:`basic security checks `." msgstr "" #: ../../includes/wasm-notavail.rst:3 @@ -69,9 +69,9 @@ msgstr "" #: ../../library/http.server.rst:39 msgid "" "This class builds on the :class:`~socketserver.TCPServer` class by storing " -"the server address as instance variables named :attr:`server_name` and :attr:" -"`server_port`. The server is accessible by the handler, typically through " -"the handler's :attr:`server` instance variable." +"the server address as instance variables named :attr:`server_name` " +"and :attr:`server_port`. The server is accessible by the handler, typically " +"through the handler's :attr:`server` instance variable." msgstr "" #: ../../library/http.server.rst:46 @@ -93,9 +93,9 @@ msgstr "" msgid "" "This class is used to handle the HTTP requests that arrive at the server. " "By itself, it cannot respond to any actual HTTP requests; it must be " -"subclassed to handle each request method (e.g. GET or POST). :class:" -"`BaseHTTPRequestHandler` provides a number of class and instance variables, " -"and methods for use by subclasses." +"subclassed to handle each request method (e.g. GET or " +"POST). :class:`BaseHTTPRequestHandler` provides a number of class and " +"instance variables, and methods for use by subclasses." msgstr "" #: ../../library/http.server.rst:66 @@ -132,9 +132,9 @@ msgstr "" #: ../../library/http.server.rst:92 msgid "" "Contains the string representation of the HTTP request line. The terminating " -"CRLF is stripped. This attribute should be set by :meth:" -"`handle_one_request`. If no valid request line was processed, it should be " -"set to the empty string." +"CRLF is stripped. This attribute should be set " +"by :meth:`handle_one_request`. If no valid request line was processed, it " +"should be set to the empty string." msgstr "" #: ../../library/http.server.rst:99 @@ -192,9 +192,9 @@ msgstr "" #: ../../library/http.server.rst:144 msgid "" -"Contains the Python system version, in a form usable by the :attr:" -"`version_string` method and the :attr:`server_version` class variable. For " -"example, ``'Python/1.4'``." +"Contains the Python system version, in a form usable by " +"the :attr:`version_string` method and the :attr:`server_version` class " +"variable. For example, ``'Python/1.4'``." msgstr "" #: ../../library/http.server.rst:150 @@ -225,8 +225,8 @@ msgstr "" #: ../../library/http.server.rst:172 msgid "" "Specifies an :class:`email.message.Message`\\ -like class to parse HTTP " -"headers. Typically, this is not overridden, and it defaults to :class:`http." -"client.HTTPMessage`." +"headers. Typically, this is not overridden, and it defaults " +"to :class:`http.client.HTTPMessage`." msgstr "" #: ../../library/http.server.rst:178 @@ -307,8 +307,8 @@ msgid "" "Adds the HTTP header to an internal buffer which will be written to the " "output stream when either :meth:`end_headers` or :meth:`flush_headers` is " "invoked. *keyword* should specify the header keyword, with *value* " -"specifying its value. Note that, after the send_header calls are done, :meth:" -"`end_headers` MUST BE called in order to complete the operation." +"specifying its value. Note that, after the send_header calls are " +"done, :meth:`end_headers` MUST BE called in order to complete the operation." msgstr "" #: ../../library/http.server.rst:250 @@ -357,15 +357,15 @@ msgstr "" msgid "" "Logs an arbitrary message to ``sys.stderr``. This is typically overridden to " "create custom error logging mechanisms. The *format* argument is a standard " -"printf-style format string, where the additional arguments to :meth:" -"`log_message` are applied as inputs to the formatting. The client ip address " -"and current date and time are prefixed to every message logged." +"printf-style format string, where the additional arguments " +"to :meth:`log_message` are applied as inputs to the formatting. The client " +"ip address and current date and time are prefixed to every message logged." msgstr "" #: ../../library/http.server.rst:301 msgid "" -"Returns the server software's version string. This is a combination of the :" -"attr:`server_version` and :attr:`sys_version` attributes." +"Returns the server software's version string. This is a combination of " +"the :attr:`server_version` and :attr:`sys_version` attributes." msgstr "" #: ../../library/http.server.rst:306 @@ -410,15 +410,15 @@ msgstr "" #: ../../library/http.server.rst:337 msgid "" -"A lot of the work, such as parsing the request, is done by the base class :" -"class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET` " -"and :func:`do_HEAD` functions." +"A lot of the work, such as parsing the request, is done by the base " +"class :class:`BaseHTTPRequestHandler`. This class implements " +"the :func:`do_GET` and :func:`do_HEAD` functions." msgstr "" #: ../../library/http.server.rst:341 msgid "" -"The following are defined as class-level attributes of :class:" -"`SimpleHTTPRequestHandler`:" +"The following are defined as class-level attributes " +"of :class:`SimpleHTTPRequestHandler`:" msgstr "" #: ../../library/http.server.rst:346 @@ -463,9 +463,9 @@ msgid "" "If the request was mapped to a directory, the directory is checked for a " "file named ``index.html`` or ``index.htm`` (in that order). If found, the " "file's contents are returned; otherwise a directory listing is generated by " -"calling the :meth:`list_directory` method. This method uses :func:`os." -"listdir` to scan the directory, and returns a ``404`` error response if the :" -"func:`~os.listdir` fails." +"calling the :meth:`list_directory` method. This method " +"uses :func:`os.listdir` to scan the directory, and returns a ``404`` error " +"response if the :func:`~os.listdir` fails." msgstr "" #: ../../library/http.server.rst:379 @@ -495,8 +495,8 @@ msgstr "" #: ../../library/http.server.rst:395 msgid "" -"For example usage, see the implementation of the ``test`` function in :" -"source:`Lib/http/server.py`." +"For example usage, see the implementation of the ``test`` function " +"in :source:`Lib/http/server.py`." msgstr "" #: ../../library/http.server.rst:398 @@ -541,92 +541,21 @@ msgid "" "attribute :attr:`index_pages`." msgstr "" -#: ../../library/http.server.rst:423 -msgid "" -":mod:`http.server` can also be invoked directly using the :option:`-m` " -"switch of the interpreter. Similar to the previous example, this serves " -"files relative to the current directory::" -msgstr "" - -#: ../../library/http.server.rst:427 -msgid "python -m http.server" -msgstr "python -m http.server" - -#: ../../library/http.server.rst:429 -msgid "" -"The server listens to port 8000 by default. The default can be overridden by " -"passing the desired port number as an argument::" -msgstr "" - -#: ../../library/http.server.rst:432 -msgid "python -m http.server 9000" -msgstr "python -m http.server 9000" - -#: ../../library/http.server.rst:434 -msgid "" -"By default, the server binds itself to all interfaces. The option ``-b/--" -"bind`` specifies a specific address to which it should bind. Both IPv4 and " -"IPv6 addresses are supported. For example, the following command causes the " -"server to bind to localhost only::" -msgstr "" - -#: ../../library/http.server.rst:439 -msgid "python -m http.server --bind 127.0.0.1" -msgstr "python -m http.server --bind 127.0.0.1" - -#: ../../library/http.server.rst:441 -msgid "Added the ``--bind`` option." -msgstr "新增 ``--bind`` 選項。" - -#: ../../library/http.server.rst:444 -msgid "Support IPv6 in the ``--bind`` option." -msgstr "於 ``--bind`` 選項中支援 IPv6。" - -#: ../../library/http.server.rst:447 -msgid "" -"By default, the server uses the current directory. The option ``-d/--" -"directory`` specifies a directory to which it should serve the files. For " -"example, the following command uses a specific directory::" -msgstr "" - -#: ../../library/http.server.rst:451 -msgid "python -m http.server --directory /tmp/" -msgstr "python -m http.server --directory /tmp/" - -#: ../../library/http.server.rst:453 -msgid "Added the ``--directory`` option." -msgstr "新增 ``--directory`` 選項。" - -#: ../../library/http.server.rst:456 -msgid "" -"By default, the server is conformant to HTTP/1.0. The option ``-p/--" -"protocol`` specifies the HTTP version to which the server is conformant. For " -"example, the following command runs an HTTP/1.1 conformant server::" -msgstr "" - -#: ../../library/http.server.rst:460 -msgid "python -m http.server --protocol HTTP/1.1" -msgstr "python -m http.server --protocol HTTP/1.1" - -#: ../../library/http.server.rst:462 -msgid "Added the ``--protocol`` option." -msgstr "新增 ``--protocol`` 選項。" - -#: ../../library/http.server.rst:467 +#: ../../library/http.server.rst:424 msgid "" "This class is used to serve either files or output of CGI scripts from the " "current directory and below. Note that mapping HTTP hierarchic structure to " "local directory structure is exactly as in :class:`SimpleHTTPRequestHandler`." msgstr "" -#: ../../library/http.server.rst:473 +#: ../../library/http.server.rst:430 msgid "" "CGI scripts run by the :class:`CGIHTTPRequestHandler` class cannot execute " "redirects (HTTP code 302), because code 200 (script output follows) is sent " "prior to execution of the CGI script. This pre-empts the status code." msgstr "" -#: ../../library/http.server.rst:478 +#: ../../library/http.server.rst:435 msgid "" "The class will however, run the CGI script, instead of serving it as a file, " "if it guesses it to be a CGI script. Only directory-based CGI are used --- " @@ -634,93 +563,160 @@ msgid "" "denoting CGI scripts." msgstr "" -#: ../../library/http.server.rst:483 +#: ../../library/http.server.rst:440 msgid "" "The :func:`do_GET` and :func:`do_HEAD` functions are modified to run CGI " "scripts and serve the output, instead of serving files, if the request leads " "to somewhere below the ``cgi_directories`` path." msgstr "" -#: ../../library/http.server.rst:487 +#: ../../library/http.server.rst:444 msgid "The :class:`CGIHTTPRequestHandler` defines the following data member:" msgstr "" -#: ../../library/http.server.rst:491 +#: ../../library/http.server.rst:448 msgid "" "This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to " "treat as containing CGI scripts." msgstr "" -#: ../../library/http.server.rst:494 +#: ../../library/http.server.rst:451 msgid "The :class:`CGIHTTPRequestHandler` defines the following method:" msgstr "" -#: ../../library/http.server.rst:498 +#: ../../library/http.server.rst:455 msgid "" "This method serves the ``'POST'`` request type, only allowed for CGI " "scripts. Error 501, \"Can only POST to CGI scripts\", is output when trying " "to POST to a non-CGI url." msgstr "" -#: ../../library/http.server.rst:502 +#: ../../library/http.server.rst:459 msgid "" "Note that CGI scripts will be run with UID of user nobody, for security " "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:507 +#: ../../library/http.server.rst:464 msgid "" ":class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been " "considered a good way to do things for well over a decade. This code has " "been unmaintained for a while now and sees very little practical use. " -"Retaining it could lead to further :ref:`security considerations `." +"Retaining it could lead to further :ref:`security considerations " +"`." +msgstr "" + +#: ../../library/http.server.rst:474 +msgid "Command-line interface" +msgstr "命令列介面" + +#: ../../library/http.server.rst:476 +msgid "" +":mod:`http.server` can also be invoked directly using the :option:`-m` " +"switch of the interpreter. The following example illustrates how to serve " +"files relative to the current directory::" +msgstr "" + +#: ../../library/http.server.rst:480 +msgid "python -m http.server [OPTIONS] [port]" +msgstr "python -m http.server [OPTIONS] [port]" + +#: ../../library/http.server.rst:482 +msgid "The following options are accepted:" +msgstr "可接受以下選項:" + +#: ../../library/http.server.rst:488 +msgid "" +"The server listens to port 8000 by default. The default can be overridden by " +"passing the desired port number as an argument::" +msgstr "" + +#: ../../library/http.server.rst:491 +msgid "python -m http.server 9000" +msgstr "python -m http.server 9000" + +#: ../../library/http.server.rst:495 +msgid "" +"Specifies a specific address to which it should bind. Both IPv4 and IPv6 " +"addresses are supported. By default, the server binds itself to all " +"interfaces. For example, the following command causes the server to bind to " +"localhost only::" +msgstr "" + +#: ../../library/http.server.rst:500 +msgid "python -m http.server --bind 127.0.0.1" +msgstr "python -m http.server --bind 127.0.0.1" + +#: ../../library/http.server.rst:504 +msgid "Support IPv6 in the ``--bind`` option." +msgstr "於 ``--bind`` 選項中支援 IPv6。" + +#: ../../library/http.server.rst:509 +msgid "" +"Specifies a directory to which it should serve the files. By default, the " +"server uses the current directory. For example, the following command uses a " +"specific directory::" msgstr "" #: ../../library/http.server.rst:513 +msgid "python -m http.server --directory /tmp/" +msgstr "python -m http.server --directory /tmp/" + +#: ../../library/http.server.rst:519 +msgid "" +"Specifies the HTTP version to which the server is conformant. By default, " +"the server is conformant to HTTP/1.0. For example, the following command " +"runs an HTTP/1.1 conformant server::" +msgstr "" + +#: ../../library/http.server.rst:523 +msgid "python -m http.server --protocol HTTP/1.1" +msgstr "python -m http.server --protocol HTTP/1.1" + +#: ../../library/http.server.rst:529 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:516 +#: ../../library/http.server.rst:532 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:520 +#: ../../library/http.server.rst:536 msgid "" -":mod:`http.server` command line ``--cgi`` support is being removed because :" -"class:`CGIHTTPRequestHandler` is being removed." +":mod:`http.server` command line ``--cgi`` support is being removed " +"because :class:`CGIHTTPRequestHandler` is being removed." msgstr "" -#: ../../library/http.server.rst:525 +#: ../../library/http.server.rst:541 msgid "" -":class:`CGIHTTPRequestHandler` and the ``--cgi`` command line option are not " +":class:`CGIHTTPRequestHandler` and the ``--cgi`` command-line option are not " "intended for use by untrusted clients and may be vulnerable to exploitation. " "Always use within a secure environment." msgstr "" -#: ../../library/http.server.rst:532 -msgid "Security Considerations" +#: ../../library/http.server.rst:549 +msgid "Security considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:536 +#: ../../library/http.server.rst:553 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " "directory to be served." msgstr "" -#: ../../library/http.server.rst:540 +#: ../../library/http.server.rst:557 msgid "" "Earlier versions of Python did not scrub control characters from the log " -"messages emitted to stderr from ``python -m http.server`` or the default :" -"class:`BaseHTTPRequestHandler` ``.log_message`` implementation. This could " -"allow remote clients connecting to your server to send nefarious control " -"codes to your terminal." +"messages emitted to stderr from ``python -m http.server`` or the " +"default :class:`BaseHTTPRequestHandler` ``.log_message`` implementation. " +"This could allow remote clients connecting to your server to send nefarious " +"control codes to your terminal." msgstr "" -#: ../../library/http.server.rst:546 +#: ../../library/http.server.rst:563 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -748,10 +744,19 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:534 +#: ../../library/http.server.rst:551 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:534 +#: ../../library/http.server.rst:551 msgid "security" msgstr "security(安全)" + +#~ msgid "Added the ``--bind`` option." +#~ msgstr "新增 ``--bind`` 選項。" + +#~ msgid "Added the ``--directory`` option." +#~ msgstr "新增 ``--directory`` 選項。" + +#~ msgid "Added the ``--protocol`` option." +#~ msgstr "新增 ``--protocol`` 選項。" diff --git a/library/idle.po b/library/idle.po index 66d6e0817f..e68ee42b2f 100644 --- a/library/idle.po +++ b/library/idle.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,59 +17,64 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../library/idle.rst:4 ../../library/idle.rst:10 -msgid "IDLE" -msgstr "IDLE" +#: ../../library/idle.rst:4 +msgid "IDLE --- Python editor and shell" +msgstr "IDLE --- Python 編輯器與 shell" #: ../../library/idle.rst:8 msgid "**Source code:** :source:`Lib/idlelib/`" msgstr "**原始碼:**\\ :source:`Lib/idlelib/`" -#: ../../library/idle.rst:17 +#: ../../library/idle.rst:20 msgid "IDLE is Python's Integrated Development and Learning Environment." msgstr "" +"IDLE 是 Python 的整合開發與學習環境 (Integrated Development and Learning " +"Environment)。" -#: ../../library/idle.rst:19 +#: ../../library/idle.rst:22 msgid "IDLE has the following features:" -msgstr "" +msgstr "IDLE 具有以下功能:" -#: ../../library/idle.rst:21 +#: ../../library/idle.rst:24 msgid "cross-platform: works mostly the same on Windows, Unix, and macOS" -msgstr "" +msgstr "跨平台:在 Windows、Unix 和 macOS 上的運作大致相同" -#: ../../library/idle.rst:23 +#: ../../library/idle.rst:26 msgid "" "Python shell window (interactive interpreter) with colorizing of code input, " "output, and error messages" msgstr "" +"Python shell window(互動式解譯器)提供有色彩的程式碼輸入、輸出和錯誤訊息" -#: ../../library/idle.rst:26 +#: ../../library/idle.rst:29 msgid "" "multi-window text editor with multiple undo, Python colorizing, smart " "indent, call tips, auto completion, and other features" msgstr "" +"多視窗文字編輯器,具有多次復原、Python 語法上色、智慧縮排、呼叫提示、自動完成" +"等功能" -#: ../../library/idle.rst:29 +#: ../../library/idle.rst:32 msgid "" "search within any window, replace within editor windows, and search through " "multiple files (grep)" -msgstr "" +msgstr "能在任何視窗中搜尋、編輯器視窗中取代文字,以及搜尋多個檔案 (grep)" -#: ../../library/idle.rst:32 +#: ../../library/idle.rst:35 msgid "" "debugger with persistent breakpoints, stepping, and viewing of global and " "local namespaces" -msgstr "" +msgstr "具有持久性斷點、能夠逐步執行和檢視全域和區域命名空間的除錯器" -#: ../../library/idle.rst:35 +#: ../../library/idle.rst:38 msgid "configuration, browsers, and other dialogs" -msgstr "" +msgstr "設定、瀏覽器和其他對話框" -#: ../../library/idle.rst:38 +#: ../../library/idle.rst:41 msgid "Menus" msgstr "目錄" -#: ../../library/idle.rst:40 +#: ../../library/idle.rst:43 msgid "" "IDLE has two main window types, the Shell window and the Editor window. It " "is possible to have multiple editor windows simultaneously. On Windows and " @@ -78,81 +82,81 @@ msgid "" "which window type it is associated with." msgstr "" -#: ../../library/idle.rst:45 +#: ../../library/idle.rst:48 msgid "" "Output windows, such as used for Edit => Find in Files, are a subtype of " "editor window. They currently have the same top menu but a different " "default title and context menu." msgstr "" -#: ../../library/idle.rst:49 +#: ../../library/idle.rst:52 msgid "" "On macOS, there is one application menu. It dynamically changes according " "to the window currently selected. It has an IDLE menu, and some entries " "described below are moved around to conform to Apple guidelines." msgstr "" -#: ../../library/idle.rst:54 +#: ../../library/idle.rst:57 msgid "File menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:56 +#: ../../library/idle.rst:59 msgid "New File" msgstr "新增檔案" -#: ../../library/idle.rst:57 +#: ../../library/idle.rst:60 msgid "Create a new file editing window." msgstr "" -#: ../../library/idle.rst:59 +#: ../../library/idle.rst:62 msgid "Open..." msgstr "" -#: ../../library/idle.rst:60 +#: ../../library/idle.rst:63 msgid "Open an existing file with an Open dialog." msgstr "" -#: ../../library/idle.rst:62 +#: ../../library/idle.rst:65 msgid "Open Module..." msgstr "" -#: ../../library/idle.rst:63 +#: ../../library/idle.rst:66 msgid "Open an existing module (searches sys.path)." msgstr "" -#: ../../library/idle.rst:65 +#: ../../library/idle.rst:68 msgid "Recent Files" msgstr "" -#: ../../library/idle.rst:66 +#: ../../library/idle.rst:69 msgid "Open a list of recent files. Click one to open it." msgstr "" -#: ../../library/idle.rst:72 +#: ../../library/idle.rst:75 msgid "Module Browser" msgstr "" -#: ../../library/idle.rst:73 +#: ../../library/idle.rst:76 msgid "" "Show functions, classes, and methods in the current Editor file in a tree " "structure. In the shell, open a module first." msgstr "" -#: ../../library/idle.rst:76 +#: ../../library/idle.rst:79 msgid "Path Browser" msgstr "" -#: ../../library/idle.rst:77 +#: ../../library/idle.rst:80 msgid "" "Show sys.path directories, modules, functions, classes and methods in a tree " "structure." msgstr "" -#: ../../library/idle.rst:80 +#: ../../library/idle.rst:83 msgid "Save" msgstr "" -#: ../../library/idle.rst:81 +#: ../../library/idle.rst:84 msgid "" "Save the current window to the associated file, if there is one. Windows " "that have been changed since being opened or last saved have a \\* before " @@ -160,11 +164,11 @@ msgid "" "instead." msgstr "" -#: ../../library/idle.rst:86 +#: ../../library/idle.rst:89 msgid "Save As..." msgstr "" -#: ../../library/idle.rst:87 +#: ../../library/idle.rst:90 msgid "" "Save the current window with a Save As dialog. The file saved becomes the " "new associated file for the window. (If your file namager is set to hide " @@ -173,283 +177,283 @@ msgid "" "text files, except that on macOS Aqua,'.py' is added for all files.)" msgstr "" -#: ../../library/idle.rst:93 +#: ../../library/idle.rst:96 msgid "Save Copy As..." msgstr "" -#: ../../library/idle.rst:94 +#: ../../library/idle.rst:97 msgid "" "Save the current window to different file without changing the associated " "file. (See Save As note above about filename extensions.)" msgstr "" -#: ../../library/idle.rst:97 +#: ../../library/idle.rst:100 msgid "Print Window" msgstr "" -#: ../../library/idle.rst:98 +#: ../../library/idle.rst:101 msgid "Print the current window to the default printer." msgstr "" -#: ../../library/idle.rst:100 +#: ../../library/idle.rst:103 msgid "Close Window" msgstr "" -#: ../../library/idle.rst:101 +#: ../../library/idle.rst:104 msgid "" "Close the current window (if an unsaved editor, ask to save; if an unsaved " "Shell, ask to quit execution). Calling ``exit()`` or ``close()`` in the " "Shell window also closes Shell. If this is the only window, also exit IDLE." msgstr "" -#: ../../library/idle.rst:105 +#: ../../library/idle.rst:108 msgid "Exit IDLE" msgstr "離開 IDLE" -#: ../../library/idle.rst:106 +#: ../../library/idle.rst:109 msgid "Close all windows and quit IDLE (ask to save unsaved edit windows)." msgstr "" -#: ../../library/idle.rst:109 +#: ../../library/idle.rst:112 msgid "Edit menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:111 +#: ../../library/idle.rst:114 msgid "Undo" msgstr "" -#: ../../library/idle.rst:112 +#: ../../library/idle.rst:115 msgid "" "Undo the last change to the current window. A maximum of 1000 changes may " "be undone." msgstr "" -#: ../../library/idle.rst:115 +#: ../../library/idle.rst:118 msgid "Redo" msgstr "" -#: ../../library/idle.rst:116 +#: ../../library/idle.rst:119 msgid "Redo the last undone change to the current window." msgstr "" -#: ../../library/idle.rst:118 +#: ../../library/idle.rst:121 msgid "Select All" msgstr "Select All(選擇全部)" -#: ../../library/idle.rst:119 +#: ../../library/idle.rst:122 msgid "Select the entire contents of the current window." msgstr "" -#: ../../library/idle.rst:121 ../../library/idle.rst:353 -#: ../../library/idle.rst:367 +#: ../../library/idle.rst:124 ../../library/idle.rst:356 +#: ../../library/idle.rst:370 msgid "Cut" msgstr "Cut(剪下)" -#: ../../library/idle.rst:122 ../../library/idle.rst:368 +#: ../../library/idle.rst:125 ../../library/idle.rst:371 msgid "" "Copy selection into the system-wide clipboard; then delete the selection." msgstr "" -#: ../../library/idle.rst:124 ../../library/idle.rst:353 -#: ../../library/idle.rst:370 +#: ../../library/idle.rst:127 ../../library/idle.rst:356 +#: ../../library/idle.rst:373 msgid "Copy" msgstr "Copy(複製)" -#: ../../library/idle.rst:125 ../../library/idle.rst:371 +#: ../../library/idle.rst:128 ../../library/idle.rst:374 msgid "Copy selection into the system-wide clipboard." msgstr "" -#: ../../library/idle.rst:127 ../../library/idle.rst:353 -#: ../../library/idle.rst:373 +#: ../../library/idle.rst:130 ../../library/idle.rst:356 +#: ../../library/idle.rst:376 msgid "Paste" msgstr "Paste(貼上)" -#: ../../library/idle.rst:128 ../../library/idle.rst:374 +#: ../../library/idle.rst:131 ../../library/idle.rst:377 msgid "Insert contents of the system-wide clipboard into the current window." msgstr "" -#: ../../library/idle.rst:130 +#: ../../library/idle.rst:133 msgid "The clipboard functions are also available in context menus." msgstr "" -#: ../../library/idle.rst:132 +#: ../../library/idle.rst:135 msgid "Find..." msgstr "" -#: ../../library/idle.rst:133 +#: ../../library/idle.rst:136 msgid "Open a search dialog with many options" msgstr "" -#: ../../library/idle.rst:135 +#: ../../library/idle.rst:138 msgid "Find Again" msgstr "" -#: ../../library/idle.rst:136 +#: ../../library/idle.rst:139 msgid "Repeat the last search, if there is one." msgstr "" -#: ../../library/idle.rst:138 +#: ../../library/idle.rst:141 msgid "Find Selection" msgstr "" -#: ../../library/idle.rst:139 +#: ../../library/idle.rst:142 msgid "Search for the currently selected string, if there is one." msgstr "" -#: ../../library/idle.rst:141 +#: ../../library/idle.rst:144 msgid "Find in Files..." msgstr "" -#: ../../library/idle.rst:142 +#: ../../library/idle.rst:145 msgid "Open a file search dialog. Put results in a new output window." msgstr "" -#: ../../library/idle.rst:144 +#: ../../library/idle.rst:147 msgid "Replace..." msgstr "" -#: ../../library/idle.rst:145 +#: ../../library/idle.rst:148 msgid "Open a search-and-replace dialog." msgstr "" -#: ../../library/idle.rst:147 +#: ../../library/idle.rst:150 msgid "Go to Line" msgstr "" -#: ../../library/idle.rst:148 +#: ../../library/idle.rst:151 msgid "" "Move the cursor to the beginning of the line requested and make that line " "visible. A request past the end of the file goes to the end. Clear any " "selection and update the line and column status." msgstr "" -#: ../../library/idle.rst:152 +#: ../../library/idle.rst:155 msgid "Show Completions" msgstr "" -#: ../../library/idle.rst:153 +#: ../../library/idle.rst:156 msgid "" "Open a scrollable list allowing selection of existing names. See :ref:" "`Completions ` in the Editing and navigation section below." msgstr "" -#: ../../library/idle.rst:156 +#: ../../library/idle.rst:159 msgid "Expand Word" msgstr "" -#: ../../library/idle.rst:157 +#: ../../library/idle.rst:160 msgid "" "Expand a prefix you have typed to match a full word in the same window; " "repeat to get a different expansion." msgstr "" -#: ../../library/idle.rst:160 +#: ../../library/idle.rst:163 msgid "Show Call Tip" msgstr "" -#: ../../library/idle.rst:161 +#: ../../library/idle.rst:164 msgid "" "After an unclosed parenthesis for a function, open a small window with " "function parameter hints. See :ref:`Calltips ` in the Editing and " "navigation section below." msgstr "" -#: ../../library/idle.rst:165 +#: ../../library/idle.rst:168 msgid "Show Surrounding Parens" msgstr "" -#: ../../library/idle.rst:166 +#: ../../library/idle.rst:169 msgid "Highlight the surrounding parenthesis." msgstr "" -#: ../../library/idle.rst:171 +#: ../../library/idle.rst:174 msgid "Format menu (Editor window only)" msgstr "" -#: ../../library/idle.rst:173 +#: ../../library/idle.rst:176 msgid "Format Paragraph" msgstr "" -#: ../../library/idle.rst:174 +#: ../../library/idle.rst:177 msgid "" "Reformat the current blank-line-delimited paragraph in comment block or " "multiline string or selected line in a string. All lines in the paragraph " "will be formatted to less than N columns, where N defaults to 72." msgstr "" -#: ../../library/idle.rst:178 +#: ../../library/idle.rst:181 msgid "Indent Region" msgstr "" -#: ../../library/idle.rst:179 +#: ../../library/idle.rst:182 msgid "Shift selected lines right by the indent width (default 4 spaces)." msgstr "" -#: ../../library/idle.rst:181 +#: ../../library/idle.rst:184 msgid "Dedent Region" msgstr "" -#: ../../library/idle.rst:182 +#: ../../library/idle.rst:185 msgid "Shift selected lines left by the indent width (default 4 spaces)." msgstr "" -#: ../../library/idle.rst:184 +#: ../../library/idle.rst:187 msgid "Comment Out Region" msgstr "" -#: ../../library/idle.rst:185 +#: ../../library/idle.rst:188 msgid "Insert ## in front of selected lines." msgstr "" -#: ../../library/idle.rst:187 +#: ../../library/idle.rst:190 msgid "Uncomment Region" msgstr "" -#: ../../library/idle.rst:188 +#: ../../library/idle.rst:191 msgid "Remove leading # or ## from selected lines." msgstr "" -#: ../../library/idle.rst:190 +#: ../../library/idle.rst:193 msgid "Tabify Region" msgstr "" -#: ../../library/idle.rst:191 +#: ../../library/idle.rst:194 msgid "" "Turn *leading* stretches of spaces into tabs. (Note: We recommend using 4 " "space blocks to indent Python code.)" msgstr "" -#: ../../library/idle.rst:194 +#: ../../library/idle.rst:197 msgid "Untabify Region" msgstr "" -#: ../../library/idle.rst:195 +#: ../../library/idle.rst:198 msgid "Turn *all* tabs into the correct number of spaces." msgstr "" -#: ../../library/idle.rst:197 +#: ../../library/idle.rst:200 msgid "Toggle Tabs" msgstr "" -#: ../../library/idle.rst:198 +#: ../../library/idle.rst:201 msgid "Open a dialog to switch between indenting with spaces and tabs." msgstr "" -#: ../../library/idle.rst:200 +#: ../../library/idle.rst:203 msgid "New Indent Width" msgstr "" -#: ../../library/idle.rst:201 +#: ../../library/idle.rst:204 msgid "" "Open a dialog to change indent width. The accepted default by the Python " "community is 4 spaces." msgstr "" -#: ../../library/idle.rst:204 +#: ../../library/idle.rst:207 msgid "Strip Trailing Chitespace" msgstr "" -#: ../../library/idle.rst:205 +#: ../../library/idle.rst:208 msgid "" "Remove trailing space and other whitespace characters after the last non-" "whitespace character of a line by applying str.rstrip to each line, " @@ -457,15 +461,15 @@ msgid "" "extra newlines at the end of the file." msgstr "" -#: ../../library/idle.rst:214 +#: ../../library/idle.rst:217 msgid "Run menu (Editor window only)" msgstr "" -#: ../../library/idle.rst:218 +#: ../../library/idle.rst:221 msgid "Run Module" msgstr "" -#: ../../library/idle.rst:219 +#: ../../library/idle.rst:222 msgid "" "Do :ref:`Check Module `. If no error, restart the shell to " "clean the environment, then execute the module. Output is displayed in the " @@ -475,22 +479,22 @@ msgid "" "similar to executing a file with ``python -i file`` at a command line." msgstr "" -#: ../../library/idle.rst:229 +#: ../../library/idle.rst:232 msgid "Run... Customized" msgstr "" -#: ../../library/idle.rst:230 +#: ../../library/idle.rst:233 msgid "" "Same as :ref:`Run Module `, but run the module with customized " "settings. *Command Line Arguments* extend :data:`sys.argv` as if passed on " "a command line. The module can be run in the Shell without restarting." msgstr "" -#: ../../library/idle.rst:236 +#: ../../library/idle.rst:239 msgid "Check Module" msgstr "" -#: ../../library/idle.rst:237 +#: ../../library/idle.rst:240 msgid "" "Check the syntax of the module currently open in the Editor window. If the " "module has not been saved IDLE will either prompt the user to save or " @@ -499,70 +503,70 @@ msgid "" "window." msgstr "" -#: ../../library/idle.rst:245 +#: ../../library/idle.rst:248 msgid "Python Shell" msgstr "" -#: ../../library/idle.rst:246 +#: ../../library/idle.rst:249 msgid "Open or wake up the Python Shell window." msgstr "" -#: ../../library/idle.rst:250 +#: ../../library/idle.rst:253 msgid "Shell menu (Shell window only)" msgstr "" -#: ../../library/idle.rst:252 +#: ../../library/idle.rst:255 msgid "View Last Restart" msgstr "" -#: ../../library/idle.rst:253 +#: ../../library/idle.rst:256 msgid "Scroll the shell window to the last Shell restart." msgstr "" -#: ../../library/idle.rst:255 +#: ../../library/idle.rst:258 msgid "Restart Shell" msgstr "" -#: ../../library/idle.rst:256 +#: ../../library/idle.rst:259 msgid "" "Restart the shell to clean the environment and reset display and exception " "handling." msgstr "" -#: ../../library/idle.rst:258 +#: ../../library/idle.rst:261 msgid "Previous History" msgstr "" -#: ../../library/idle.rst:259 +#: ../../library/idle.rst:262 msgid "" "Cycle through earlier commands in history which match the current entry." msgstr "" -#: ../../library/idle.rst:261 +#: ../../library/idle.rst:264 msgid "Next History" msgstr "" -#: ../../library/idle.rst:262 +#: ../../library/idle.rst:265 msgid "Cycle through later commands in history which match the current entry." msgstr "" -#: ../../library/idle.rst:264 +#: ../../library/idle.rst:267 msgid "Interrupt Execution" msgstr "" -#: ../../library/idle.rst:265 +#: ../../library/idle.rst:268 msgid "Stop a running program." msgstr "" -#: ../../library/idle.rst:268 +#: ../../library/idle.rst:271 msgid "Debug menu (Shell window only)" msgstr "" -#: ../../library/idle.rst:270 +#: ../../library/idle.rst:273 msgid "Go to File/Line" msgstr "" -#: ../../library/idle.rst:271 +#: ../../library/idle.rst:274 msgid "" "Look on the current line. with the cursor, and the line above for a filename " "and line number. If found, open the file if not already open, and show the " @@ -571,45 +575,45 @@ msgid "" "Shell window and Output windows." msgstr "" -#: ../../library/idle.rst:281 +#: ../../library/idle.rst:284 msgid "Debugger (toggle)" msgstr "" -#: ../../library/idle.rst:282 +#: ../../library/idle.rst:285 msgid "" "When activated, code entered in the Shell or run from an Editor will run " "under the debugger. In the Editor, breakpoints can be set with the context " "menu. This feature is still incomplete and somewhat experimental." msgstr "" -#: ../../library/idle.rst:286 +#: ../../library/idle.rst:289 msgid "Stack Viewer" msgstr "" -#: ../../library/idle.rst:287 +#: ../../library/idle.rst:290 msgid "" "Show the stack traceback of the last exception in a tree widget, with access " "to locals and globals." msgstr "" -#: ../../library/idle.rst:290 +#: ../../library/idle.rst:293 msgid "Auto-open Stack Viewer" msgstr "" -#: ../../library/idle.rst:291 +#: ../../library/idle.rst:294 msgid "" "Toggle automatically opening the stack viewer on an unhandled exception." msgstr "" -#: ../../library/idle.rst:294 +#: ../../library/idle.rst:297 msgid "Options menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:296 +#: ../../library/idle.rst:299 msgid "Configure IDLE" msgstr "" -#: ../../library/idle.rst:297 +#: ../../library/idle.rst:300 msgid "" "Open a configuration dialog and change preferences for the following: fonts, " "indentation, keybindings, text color themes, startup windows and size, " @@ -618,39 +622,39 @@ msgid "" "see :ref:`Setting preferences ` under Help and preferences." msgstr "" -#: ../../library/idle.rst:304 +#: ../../library/idle.rst:307 msgid "" "Most configuration options apply to all windows or all future windows. The " "option items below only apply to the active window." msgstr "" -#: ../../library/idle.rst:307 +#: ../../library/idle.rst:310 msgid "Show/Hide Code Context (Editor Window only)" msgstr "" -#: ../../library/idle.rst:308 +#: ../../library/idle.rst:311 msgid "" "Open a pane at the top of the edit window which shows the block context of " "the code which has scrolled above the top of the window. See :ref:`Code " "Context ` in the Editing and Navigation section below." msgstr "" -#: ../../library/idle.rst:313 +#: ../../library/idle.rst:316 msgid "Show/Hide Line Numbers (Editor Window only)" msgstr "" -#: ../../library/idle.rst:314 +#: ../../library/idle.rst:317 msgid "" "Open a column to the left of the edit window which shows the number of each " "line of text. The default is off, which may be changed in the preferences " "(see :ref:`Setting preferences `)." msgstr "" -#: ../../library/idle.rst:318 +#: ../../library/idle.rst:321 msgid "Zoom/Restore Height" msgstr "" -#: ../../library/idle.rst:319 +#: ../../library/idle.rst:322 msgid "" "Toggles the window between normal size and maximum height. The initial size " "defaults to 40 lines by 80 chars unless changed on the General tab of the " @@ -660,74 +664,74 @@ msgid "" "no effect when a window is maximized." msgstr "" -#: ../../library/idle.rst:327 +#: ../../library/idle.rst:330 msgid "Window menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:329 +#: ../../library/idle.rst:332 msgid "" "Lists the names of all open windows; select one to bring it to the " "foreground (deiconifying it if necessary)." msgstr "" -#: ../../library/idle.rst:333 +#: ../../library/idle.rst:336 msgid "Help menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:335 +#: ../../library/idle.rst:338 msgid "About IDLE" -msgstr "" +msgstr "關於 IDLE" -#: ../../library/idle.rst:336 +#: ../../library/idle.rst:339 msgid "Display version, copyright, license, credits, and more." msgstr "" -#: ../../library/idle.rst:338 +#: ../../library/idle.rst:341 msgid "IDLE Help" msgstr "" -#: ../../library/idle.rst:339 +#: ../../library/idle.rst:342 msgid "" "Display this IDLE document, detailing the menu options, basic editing and " "navigation, and other tips." msgstr "" -#: ../../library/idle.rst:342 +#: ../../library/idle.rst:345 msgid "Python Docs" msgstr "" -#: ../../library/idle.rst:343 +#: ../../library/idle.rst:346 msgid "" "Access local Python documentation, if installed, or start a web browser and " "open docs.python.org showing the latest Python documentation." msgstr "" -#: ../../library/idle.rst:346 +#: ../../library/idle.rst:349 msgid "Turtle Demo" msgstr "" -#: ../../library/idle.rst:347 +#: ../../library/idle.rst:350 msgid "Run the turtledemo module with example Python code and turtle drawings." msgstr "" -#: ../../library/idle.rst:349 +#: ../../library/idle.rst:352 msgid "" "Additional help sources may be added here with the Configure IDLE dialog " "under the General tab. See the :ref:`Help sources ` subsection " "below for more on Help menu choices." msgstr "" -#: ../../library/idle.rst:362 +#: ../../library/idle.rst:365 msgid "Context menus" msgstr "" -#: ../../library/idle.rst:364 +#: ../../library/idle.rst:367 msgid "" "Open a context menu by right-clicking in a window (Control-click on macOS). " "Context menus have the standard clipboard functions also on the Edit menu." msgstr "" -#: ../../library/idle.rst:376 +#: ../../library/idle.rst:379 msgid "" "Editor windows also have breakpoint functions. Lines with a breakpoint set " "are specially marked. Breakpoints only have an effect when running under " @@ -735,66 +739,66 @@ msgid "" "directory." msgstr "" -#: ../../library/idle.rst:353 ../../library/idle.rst:381 +#: ../../library/idle.rst:356 ../../library/idle.rst:384 msgid "Set Breakpoint" msgstr "" -#: ../../library/idle.rst:382 +#: ../../library/idle.rst:385 msgid "Set a breakpoint on the current line." msgstr "" -#: ../../library/idle.rst:353 ../../library/idle.rst:384 +#: ../../library/idle.rst:356 ../../library/idle.rst:387 msgid "Clear Breakpoint" msgstr "" -#: ../../library/idle.rst:385 +#: ../../library/idle.rst:388 msgid "Clear the breakpoint on that line." msgstr "" -#: ../../library/idle.rst:387 +#: ../../library/idle.rst:390 msgid "Shell and Output windows also have the following." msgstr "" -#: ../../library/idle.rst:389 +#: ../../library/idle.rst:392 msgid "Go to file/line" msgstr "" -#: ../../library/idle.rst:390 +#: ../../library/idle.rst:393 msgid "Same as in Debug menu." msgstr "" -#: ../../library/idle.rst:392 +#: ../../library/idle.rst:395 msgid "" "The Shell window also has an output squeezing facility explained in the " "*Python Shell window* subsection below." msgstr "" -#: ../../library/idle.rst:395 +#: ../../library/idle.rst:398 msgid "Squeeze" msgstr "" -#: ../../library/idle.rst:396 +#: ../../library/idle.rst:399 msgid "" "If the cursor is over an output line, squeeze all the output between the " "code above and the prompt below down to a 'Squeezed text' label." msgstr "" -#: ../../library/idle.rst:403 +#: ../../library/idle.rst:406 msgid "Editing and Navigation" msgstr "" -#: ../../library/idle.rst:406 +#: ../../library/idle.rst:409 msgid "Editor windows" msgstr "" -#: ../../library/idle.rst:408 +#: ../../library/idle.rst:411 msgid "" "IDLE may open editor windows when it starts, depending on settings and how " "you start IDLE. Thereafter, use the File menu. There can be only one open " "editor window for a given file." msgstr "" -#: ../../library/idle.rst:412 +#: ../../library/idle.rst:415 msgid "" "The title bar contains the name of the file, the full path, and the version " "of Python and IDLE running the window. The status bar contains the line " @@ -802,17 +806,17 @@ msgid "" "numbers with 0." msgstr "" -#: ../../library/idle.rst:417 +#: ../../library/idle.rst:420 msgid "" "IDLE assumes that files with a known .py* extension contain Python code and " "that other files do not. Run Python code with the Run menu." msgstr "" -#: ../../library/idle.rst:421 +#: ../../library/idle.rst:424 msgid "Key bindings" msgstr "" -#: ../../library/idle.rst:423 +#: ../../library/idle.rst:426 msgid "" "The IDLE insertion cursor is a thin vertical bar between character " "positions. When characters are entered, the insertion cursor and everything " @@ -820,7 +824,7 @@ msgid "" "the new space." msgstr "" -#: ../../library/idle.rst:428 +#: ../../library/idle.rst:431 msgid "" "Several non-character keys move the cursor and possibly delete characters. " "Deletion does not puts text on the clipboard, but IDLE has an undo list. " @@ -829,52 +833,52 @@ msgid "" "discussions assume that the keys have not been re-bound to something else.)" msgstr "" -#: ../../library/idle.rst:435 +#: ../../library/idle.rst:438 msgid "Arrow keys move the cursor one character or line." msgstr "" -#: ../../library/idle.rst:437 +#: ../../library/idle.rst:440 msgid "" ":kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves left or right one word." msgstr "" -#: ../../library/idle.rst:439 +#: ../../library/idle.rst:442 msgid ":kbd:`Home` and :kbd:`End` go to the beginning or end of the line." msgstr "" -#: ../../library/idle.rst:441 +#: ../../library/idle.rst:444 msgid ":kbd:`Page Up` and :kbd:`Page Down` go up or down one screen." msgstr "" -#: ../../library/idle.rst:443 +#: ../../library/idle.rst:446 msgid ":kbd:`C-Home` and :kbd:`C-End` go to beginning or end of the file." msgstr "" -#: ../../library/idle.rst:445 +#: ../../library/idle.rst:448 msgid "" ":kbd:`Backspace` and :kbd:`Del` (or :kbd:`C-d`) delete the previous or next " "character." msgstr "" -#: ../../library/idle.rst:448 +#: ../../library/idle.rst:451 msgid ":kbd:`C-Backspace` and :kbd:`C-Del` delete one word left or right." msgstr "" -#: ../../library/idle.rst:450 +#: ../../library/idle.rst:453 msgid ":kbd:`C-k` deletes ('kills') everything to the right." msgstr "" -#: ../../library/idle.rst:452 +#: ../../library/idle.rst:455 msgid "" "Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste) may " "work. Keybindings are selected in the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:456 +#: ../../library/idle.rst:459 msgid "Automatic indentation" msgstr "" -#: ../../library/idle.rst:458 +#: ../../library/idle.rst:461 msgid "" "After a block-opening statement, the next line is indented by 4 spaces (in " "the Python Shell window by one tab). After certain keywords (break, return " @@ -884,17 +888,17 @@ msgid "" "tabs are restricted to four spaces due to Tcl/Tk limitations." msgstr "" -#: ../../library/idle.rst:465 +#: ../../library/idle.rst:468 msgid "" "See also the indent/dedent region commands on the :ref:`Format menu `." msgstr "" -#: ../../library/idle.rst:469 +#: ../../library/idle.rst:472 msgid "Search and Replace" msgstr "" -#: ../../library/idle.rst:471 +#: ../../library/idle.rst:474 msgid "" "Any selection becomes a search target. However, only selections within a " "line work because searches are only performed within lines with the terminal " @@ -902,11 +906,11 @@ msgid "" "interpreted according to the Python re module." msgstr "" -#: ../../library/idle.rst:479 +#: ../../library/idle.rst:482 msgid "Completions" msgstr "" -#: ../../library/idle.rst:481 +#: ../../library/idle.rst:484 msgid "" "Completions are supplied, when requested and available, for module names, " "attributes of classes or functions, or filenames. Each request method " @@ -919,7 +923,7 @@ msgid "" "box. A double click within the box selects and closes." msgstr "" -#: ../../library/idle.rst:492 +#: ../../library/idle.rst:495 msgid "" "One way to open a box is to type a key character and wait for a predefined " "interval. This defaults to 2 seconds; customize it in the settings dialog. " @@ -931,7 +935,7 @@ msgid "" "directory name and a separator." msgstr "" -#: ../../library/idle.rst:502 +#: ../../library/idle.rst:505 msgid "" "Instead of waiting, or after a box is closed, open a completion box " "immediately with Show Completions on the Edit menu. The default hot key is :" @@ -942,7 +946,7 @@ msgid "" "directory." msgstr "" -#: ../../library/idle.rst:510 +#: ../../library/idle.rst:513 msgid "" "Hitting :kbd:`Tab` after a prefix usually has the same effect as Show " "Completions. (With no prefix, it indents.) However, if there is only one " @@ -950,14 +954,14 @@ msgid "" "without opening a box." msgstr "" -#: ../../library/idle.rst:515 +#: ../../library/idle.rst:518 msgid "" "Invoking 'Show Completions', or hitting :kbd:`Tab` after a prefix, outside " "of a string and without a preceding '.' opens a box with keywords, builtin " "names, and available module-level names." msgstr "" -#: ../../library/idle.rst:519 +#: ../../library/idle.rst:522 msgid "" "When editing code in an editor (as oppose to Shell), increase the available " "module-level names by running your code and not restarting the Shell " @@ -965,18 +969,18 @@ msgid "" "file. This also increases possible attribute completions." msgstr "" -#: ../../library/idle.rst:525 +#: ../../library/idle.rst:528 msgid "" "Completion boxes initially exclude names beginning with '_' or, for modules, " "not included in '__all__'. The hidden names can be accessed by typing '_' " "after '.', either before or after the box is opened." msgstr "" -#: ../../library/idle.rst:532 +#: ../../library/idle.rst:535 msgid "Calltips" msgstr "" -#: ../../library/idle.rst:534 +#: ../../library/idle.rst:537 msgid "" "A calltip is shown automatically when one types :kbd:`(` after the name of " "an *accessible* function. A function name expression may include dots and " @@ -986,7 +990,7 @@ msgid "" "or enter its shortcut to display a calltip." msgstr "" -#: ../../library/idle.rst:541 +#: ../../library/idle.rst:544 msgid "" "The calltip consists of the function's signature and docstring up to the " "latter's first blank line or the fifth non-blank line. (Some builtin " @@ -995,14 +999,14 @@ msgid "" "or name (keyword) only. Details are subject to change." msgstr "" -#: ../../library/idle.rst:547 +#: ../../library/idle.rst:550 msgid "" "In Shell, the accessible functions depends on what modules have been " "imported into the user process, including those imported by Idle itself, and " "which definitions have been run, all since the last restart." msgstr "" -#: ../../library/idle.rst:551 +#: ../../library/idle.rst:554 msgid "" "For example, restart the Shell and enter ``itertools.count(``. A calltip " "appears because Idle imports itertools into the user process for its own " @@ -1012,18 +1016,18 @@ msgid "" "display a calltip." msgstr "" -#: ../../library/idle.rst:558 +#: ../../library/idle.rst:561 msgid "" "In an editor, import statements have no effect until one runs the file. One " "might want to run a file after writing import statements, after adding " "function definitions, or after opening an existing file." msgstr "" -#: ../../library/idle.rst:565 +#: ../../library/idle.rst:568 msgid "Code Context" msgstr "" -#: ../../library/idle.rst:567 +#: ../../library/idle.rst:570 msgid "" "Within an editor window containing Python code, code context can be toggled " "in order to show or hide a pane at the top of the window. When shown, this " @@ -1037,23 +1041,23 @@ msgid "" "the top of the editor." msgstr "" -#: ../../library/idle.rst:578 +#: ../../library/idle.rst:581 msgid "" "The text and background colors for the context pane can be configured under " "the Highlights tab in the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:582 +#: ../../library/idle.rst:585 msgid "Shell window" msgstr "" -#: ../../library/idle.rst:584 +#: ../../library/idle.rst:587 msgid "" "In IDLE's Shell, enter, edit, and recall complete statements. (Most consoles " "and terminals only work with a single physical line at a time)." msgstr "" -#: ../../library/idle.rst:587 +#: ../../library/idle.rst:590 msgid "" "Submit a single-line statement for execution by hitting :kbd:`Return` with " "the cursor anywhere on the line. If a line is extended with Backslash (:kbd:" @@ -1061,7 +1065,7 @@ msgid "" "compound statement by entering a blank line after the statement." msgstr "" -#: ../../library/idle.rst:593 +#: ../../library/idle.rst:596 msgid "" "When one pastes code into Shell, it is not compiled and possibly executed " "until one hits :kbd:`Return`, as specified above. One may edit pasted code " @@ -1070,7 +1074,7 @@ msgid "" "one." msgstr "" -#: ../../library/idle.rst:599 +#: ../../library/idle.rst:602 msgid "" "Lines containing ``RESTART`` mean that the user execution process has been " "re-started. This occurs when the user execution process has crashed, when " @@ -1078,38 +1082,38 @@ msgid "" "window." msgstr "" -#: ../../library/idle.rst:604 +#: ../../library/idle.rst:607 msgid "" "The editing features described in previous subsections work when entering " "code interactively. IDLE's Shell window also responds to the following:" msgstr "" -#: ../../library/idle.rst:607 +#: ../../library/idle.rst:610 msgid ":kbd:`C-c` attempts to interrupt statement execution (but may fail)." msgstr "" -#: ../../library/idle.rst:609 +#: ../../library/idle.rst:612 msgid ":kbd:`C-d` closes Shell if typed at a ``>>>`` prompt." msgstr "" -#: ../../library/idle.rst:611 +#: ../../library/idle.rst:614 msgid "" ":kbd:`Alt-p` and :kbd:`Alt-n` (:kbd:`C-p` and :kbd:`C-n` on macOS) retrieve " "to the current prompt the previous or next previously entered statement that " "matches anything already typed." msgstr "" -#: ../../library/idle.rst:615 +#: ../../library/idle.rst:618 msgid "" ":kbd:`Return` while the cursor is on any previous statement appends the " "latter to anything already typed at the prompt." msgstr "" -#: ../../library/idle.rst:619 +#: ../../library/idle.rst:622 msgid "Text colors" msgstr "" -#: ../../library/idle.rst:621 +#: ../../library/idle.rst:624 msgid "" "Idle defaults to black on white text, but colors text with special meanings. " "For the shell, these are shell output, shell error, user output, and user " @@ -1119,7 +1123,7 @@ msgid "" "(when present), found text (when possible), and selected text." msgstr "" -#: ../../library/idle.rst:628 +#: ../../library/idle.rst:631 msgid "" "IDLE also highlights the :ref:`soft keywords ` :keyword:" "`match`, :keyword:`case `, and :keyword:`_ ` in " @@ -1128,7 +1132,7 @@ msgid "" "patterns." msgstr "" -#: ../../library/idle.rst:634 +#: ../../library/idle.rst:637 msgid "" "Text coloring is done in the background, so uncolorized text is occasionally " "visible. To change the color scheme, use the Configure IDLE dialog " @@ -1136,11 +1140,11 @@ msgid "" "and text in popups and dialogs is not user-configurable." msgstr "" -#: ../../library/idle.rst:641 +#: ../../library/idle.rst:644 msgid "Startup and Code Execution" msgstr "" -#: ../../library/idle.rst:643 +#: ../../library/idle.rst:646 msgid "" "Upon startup with the ``-s`` option, IDLE will execute the file referenced " "by the environment variables :envvar:`IDLESTARTUP` or :envvar:" @@ -1152,7 +1156,7 @@ msgid "" "modules." msgstr "" -#: ../../library/idle.rst:651 +#: ../../library/idle.rst:654 msgid "" "In addition, ``Tk`` also loads a startup file if it is present. Note that " "the Tk file is loaded unconditionally. This additional file is ``.Idle.py`` " @@ -1161,61 +1165,90 @@ msgid "" "importing functions to be used from IDLE's Python shell." msgstr "" -#: ../../library/idle.rst:658 +#: ../../library/idle.rst:661 msgid "Command line usage" msgstr "命令列用法" -#: ../../library/idle.rst:660 -msgid "" -"idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " -"[arg] ...\n" -"\n" -"-c command run command in the shell window\n" -"-d enable debugger and open shell window\n" -"-e open editor window\n" -"-h print help message with legal combinations and exit\n" -"-i open shell window\n" -"-r file run file in shell window\n" -"-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" -"-t title set title of shell window\n" -"- run stdin in shell (- must be last option before args)" -msgstr "" -"idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " -"[arg] ...\n" -"\n" -"-c command run command in the shell window\n" -"-d enable debugger and open shell window\n" -"-e open editor window\n" -"-h print help message with legal combinations and exit\n" -"-i open shell window\n" -"-r file run file in shell window\n" -"-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" -"-t title set title of shell window\n" -"- run stdin in shell (- must be last option before args)" - -#: ../../library/idle.rst:674 -msgid "If there are arguments:" -msgstr "" - -#: ../../library/idle.rst:676 -msgid "" -"If ``-``, ``-c``, or ``r`` is used, all arguments are placed in ``sys." -"argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'``. " -"No editor window is opened, even if that is the default set in the Options " -"dialog." +#: ../../library/idle.rst:665 +msgid "" +"IDLE can be invoked from the command line with various options. The general " +"syntax is:" +msgstr "" + +#: ../../library/idle.rst:667 +msgid "python -m idlelib [options] [file ...]" msgstr "" -#: ../../library/idle.rst:681 +#: ../../library/idle.rst:671 +msgid "The following options are available:" +msgstr "" + +#: ../../library/idle.rst:675 msgid "" -"Otherwise, arguments are files opened for editing and ``sys.argv`` reflects " -"the arguments passed to IDLE itself." +"Run the specified Python command in the shell window. For example, pass ``-c " +"\"print('Hello, World!')\"``. On Windows, the outer quotes must be double " +"quotes as shown." +msgstr "" + +#: ../../library/idle.rst:681 +msgid "Enable the debugger and open the shell window." msgstr "" #: ../../library/idle.rst:685 +msgid "Open an editor window." +msgstr "" + +#: ../../library/idle.rst:689 +msgid "Print a help message with legal combinations of options and exit." +msgstr "" + +#: ../../library/idle.rst:693 +msgid "Open a shell window." +msgstr "" + +#: ../../library/idle.rst:697 +msgid "Run the specified file in the shell window." +msgstr "" + +#: ../../library/idle.rst:701 +msgid "" +"Run the startup file (as defined by the environment variables :envvar:" +"`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`) before opening the shell window." +msgstr "" + +#: ../../library/idle.rst:705 +msgid "Set the title of the shell window." +msgstr "" + +#: ../../library/idle.rst:709 +msgid "" +"Read and execute standard input in the shell window. This option must be the " +"last one before any arguments." +msgstr "" + +#: ../../library/idle.rst:711 +msgid "If arguments are provided:" +msgstr "" + +#: ../../library/idle.rst:713 +msgid "" +"If ``-``, ``-c``, or ``-r`` is used, all arguments are placed in ``sys." +"argv[1:]``, and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'`` " +"respectively. No editor window is opened, even if that is the default set in " +"the *Options* dialog." +msgstr "" + +#: ../../library/idle.rst:716 +msgid "" +"Otherwise, arguments are treated as files to be opened for editing, and " +"``sys.argv`` reflects the arguments passed to IDLE itself." +msgstr "" + +#: ../../library/idle.rst:720 msgid "Startup failure" msgstr "" -#: ../../library/idle.rst:687 +#: ../../library/idle.rst:722 msgid "" "IDLE uses a socket to communicate between the IDLE GUI process and the user " "code execution process. A connection must be established whenever the Shell " @@ -1225,7 +1258,7 @@ msgid "" "directs the user here. It then exits." msgstr "" -#: ../../library/idle.rst:694 +#: ../../library/idle.rst:729 msgid "" "One specific connection failure on Unix systems results from misconfigured " "masquerading rules somewhere in a system's network setup. When IDLE is " @@ -1235,7 +1268,7 @@ msgid "" "``tcplisten `` in another." msgstr "" -#: ../../library/idle.rst:702 +#: ../../library/idle.rst:737 msgid "" "A common cause of failure is a user-written file with the same name as a " "standard library module, such as *random.py* and *tkinter.py*. When such a " @@ -1244,7 +1277,7 @@ msgid "" "file." msgstr "" -#: ../../library/idle.rst:708 +#: ../../library/idle.rst:743 msgid "" "Though less common than in the past, an antivirus or firewall program may " "stop the connection. If the program cannot be taught to allow the " @@ -1254,7 +1287,7 @@ msgid "" "connections." msgstr "" -#: ../../library/idle.rst:715 +#: ../../library/idle.rst:750 msgid "" "Python installation issues occasionally stop IDLE: multiple versions can " "clash, or a single installation might need admin access. If one undo the " @@ -1262,7 +1295,7 @@ msgid "" "completely remove Python and start over." msgstr "" -#: ../../library/idle.rst:720 +#: ../../library/idle.rst:755 msgid "" "A zombie pythonw.exe process could be a problem. On Windows, use Task " "Manager to check for one and stop it if there is. Sometimes a restart " @@ -1271,7 +1304,7 @@ msgid "" "may fix a temporary problem." msgstr "" -#: ../../library/idle.rst:726 +#: ../../library/idle.rst:761 msgid "" "When IDLE first starts, it attempts to read user configuration files in ``~/." "idlerc/`` (~ is one's home directory). If there is a problem, an error " @@ -1282,14 +1315,14 @@ msgid "" "with the settings dialog." msgstr "" -#: ../../library/idle.rst:734 +#: ../../library/idle.rst:769 msgid "" "If IDLE quits with no message, and it was not started from a console, try " "starting it from a console or terminal (``python -m idlelib``) and see if " "this results in an error message." msgstr "" -#: ../../library/idle.rst:738 +#: ../../library/idle.rst:773 msgid "" "On Unix-based systems with tcl/tk older than ``8.6.11`` (see ``About IDLE``) " "certain characters of certain fonts can cause a tk failure with a message to " @@ -1298,11 +1331,11 @@ msgid "" "upgrade tcl/tk, then re-configure IDLE to use a font that works better." msgstr "" -#: ../../library/idle.rst:746 +#: ../../library/idle.rst:781 msgid "Running user code" msgstr "" -#: ../../library/idle.rst:748 +#: ../../library/idle.rst:783 msgid "" "With rare exceptions, the result of executing Python code with IDLE is " "intended to be the same as executing the same code by the default method, " @@ -1312,7 +1345,7 @@ msgid "" "``threading.active_count()`` returns 2 instead of 1." msgstr "" -#: ../../library/idle.rst:755 +#: ../../library/idle.rst:790 msgid "" "By default, IDLE runs user code in a separate OS process rather than in the " "user interface process that runs the shell and editor. In the execution " @@ -1322,7 +1355,7 @@ msgid "" "__stderr__`` are not touched, but may be ``None``." msgstr "" -#: ../../library/idle.rst:762 +#: ../../library/idle.rst:797 msgid "" "Sending print output from one process to a text widget in another is slower " "than printing to a system terminal in the same process. This has the most " @@ -1334,7 +1367,7 @@ msgid "" "fields and lines." msgstr "" -#: ../../library/idle.rst:771 +#: ../../library/idle.rst:806 msgid "" "IDLE's standard stream replacements are not inherited by subprocesses " "created in the execution process, whether directly by user code or by " @@ -1345,14 +1378,14 @@ msgid "" "attached to that window for input and output." msgstr "" -#: ../../library/idle.rst:780 +#: ../../library/idle.rst:815 msgid "" "If ``sys`` is reset by user code, such as with ``importlib.reload(sys)``, " "IDLE's changes are lost and input from the keyboard and output to the screen " "will not work correctly." msgstr "" -#: ../../library/idle.rst:784 +#: ../../library/idle.rst:819 msgid "" "When Shell has the focus, it controls the keyboard and screen. This is " "normally transparent, but functions that directly access the keyboard and " @@ -1360,7 +1393,7 @@ msgid "" "determine whether a key has been pressed and if so, which." msgstr "" -#: ../../library/idle.rst:789 +#: ../../library/idle.rst:824 msgid "" "The IDLE code running in the execution process adds frames to the call stack " "that would not be there otherwise. IDLE wraps ``sys.getrecursionlimit`` and " @@ -1368,17 +1401,17 @@ msgid "" "frames." msgstr "" -#: ../../library/idle.rst:794 +#: ../../library/idle.rst:829 msgid "" "When user code raises SystemExit either directly or by calling sys.exit, " "IDLE returns to a Shell prompt instead of exiting." msgstr "" -#: ../../library/idle.rst:798 +#: ../../library/idle.rst:833 msgid "User output in Shell" msgstr "" -#: ../../library/idle.rst:800 +#: ../../library/idle.rst:835 msgid "" "When a program outputs text, the result is determined by the corresponding " "output device. When IDLE executes user code, ``sys.stdout`` and ``sys." @@ -1388,7 +1421,7 @@ msgid "" "rather than production runs." msgstr "" -#: ../../library/idle.rst:807 +#: ../../library/idle.rst:842 msgid "" "For instance, Shell never throws away output. A program that sends " "unlimited output to Shell will eventually fill memory, resulting in a memory " @@ -1397,7 +1430,7 @@ msgid "" "lines, with 300 the default." msgstr "" -#: ../../library/idle.rst:813 +#: ../../library/idle.rst:848 msgid "" "A Tk Text widget, and hence IDLE's Shell, displays characters (codepoints) " "in the BMP (Basic Multilingual Plane) subset of Unicode. Which characters " @@ -1411,7 +1444,7 @@ msgid "" "spacing behavior.) ::" msgstr "" -#: ../../library/idle.rst:823 +#: ../../library/idle.rst:858 msgid "" ">>> s = 'a\\tb\\a<\\x02><\\r>\\bc\\nd' # Enter 22 chars.\n" ">>> len(s)\n" @@ -1422,7 +1455,7 @@ msgid "" "# Result varies by OS and font. Try it." msgstr "" -#: ../../library/idle.rst:831 +#: ../../library/idle.rst:866 msgid "" "The ``repr`` function is used for interactive echo of expression values. It " "returns an altered version of the input string in which control codes, some " @@ -1431,13 +1464,13 @@ msgid "" "regardless of how they are displayed." msgstr "" -#: ../../library/idle.rst:837 +#: ../../library/idle.rst:872 msgid "" "Normal and error output are generally kept separate (on separate lines) from " "code input and each other. They each get different highlight colors." msgstr "" -#: ../../library/idle.rst:840 +#: ../../library/idle.rst:875 msgid "" "For SyntaxError tracebacks, the normal '^' marking where the error was " "detected is replaced by coloring the text with an error highlight. When code " @@ -1446,7 +1479,7 @@ msgid "" "opened if necessary." msgstr "" -#: ../../library/idle.rst:846 +#: ../../library/idle.rst:881 msgid "" "Shell has a special facility for squeezing output lines down to a 'Squeezed " "text' label. This is done automatically for output over N lines (N = 50 by " @@ -1455,18 +1488,18 @@ msgid "" "on the output. This can be useful lines long enough to slow down scrolling." msgstr "" -#: ../../library/idle.rst:854 +#: ../../library/idle.rst:889 msgid "" "Squeezed output is expanded in place by double-clicking the label. It can " "also be sent to the clipboard or a separate view window by right-clicking " "the label." msgstr "" -#: ../../library/idle.rst:859 +#: ../../library/idle.rst:894 msgid "Developing tkinter applications" msgstr "" -#: ../../library/idle.rst:861 +#: ../../library/idle.rst:896 msgid "" "IDLE is intentionally different from standard Python in order to facilitate " "development of tkinter programs. Enter ``import tkinter as tk; root = tk." @@ -1478,7 +1511,7 @@ msgid "" "changes in standard Python until one enters ``root.update()``." msgstr "" -#: ../../library/idle.rst:870 +#: ../../library/idle.rst:905 msgid "" "Most tkinter programs run ``root.mainloop()``, which usually does not return " "until the tk app is destroyed. If the program is run with ``python -i`` or " @@ -1486,7 +1519,7 @@ msgid "" "``mainloop()`` returns, at which time there is nothing left to interact with." msgstr "" -#: ../../library/idle.rst:876 +#: ../../library/idle.rst:911 msgid "" "When running a tkinter program from an IDLE editor, one can comment out the " "mainloop call. One then gets a shell prompt immediately and can interact " @@ -1494,11 +1527,11 @@ msgid "" "mainloop call when running in standard Python." msgstr "" -#: ../../library/idle.rst:882 +#: ../../library/idle.rst:917 msgid "Running without a subprocess" msgstr "" -#: ../../library/idle.rst:884 +#: ../../library/idle.rst:919 msgid "" "By default, IDLE executes user code in a separate subprocess via a socket, " "which uses the internal loopback interface. This connection is not " @@ -1506,7 +1539,7 @@ msgid "" "firewall software complains anyway, you can ignore it." msgstr "" -#: ../../library/idle.rst:889 +#: ../../library/idle.rst:924 msgid "" "If the attempt to make the socket connection fails, Idle will notify you. " "Such failures are sometimes transient, but if persistent, the problem may be " @@ -1515,7 +1548,7 @@ msgid "" "command line switch." msgstr "" -#: ../../library/idle.rst:895 +#: ../../library/idle.rst:930 msgid "" "If IDLE is started with the -n command line switch it will run in a single " "process and will not create the subprocess which runs the RPC Python " @@ -1529,15 +1562,15 @@ msgid "" "at all possible." msgstr "" -#: ../../library/idle.rst:910 +#: ../../library/idle.rst:945 msgid "Help and Preferences" msgstr "" -#: ../../library/idle.rst:915 +#: ../../library/idle.rst:950 msgid "Help sources" msgstr "" -#: ../../library/idle.rst:917 +#: ../../library/idle.rst:952 msgid "" "Help menu entry \"IDLE Help\" displays a formatted html version of the IDLE " "chapter of the Library Reference. The result, in a read-only tkinter text " @@ -1547,7 +1580,7 @@ msgid "" "the opened box." msgstr "" -#: ../../library/idle.rst:925 +#: ../../library/idle.rst:960 msgid "" "Help menu entry \"Python Docs\" opens the extensive sources of help, " "including tutorials, available at ``docs.python.org/x.y``, where 'x.y' is " @@ -1556,17 +1589,17 @@ msgid "" "instead." msgstr "" -#: ../../library/idle.rst:931 +#: ../../library/idle.rst:966 msgid "" "Selected URLs can be added or removed from the help menu at any time using " "the General tab of the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:937 +#: ../../library/idle.rst:972 msgid "Setting preferences" -msgstr "" +msgstr "設定偏好" -#: ../../library/idle.rst:939 +#: ../../library/idle.rst:974 msgid "" "The font preferences, highlighting, keys, and general preferences can be " "changed via Configure IDLE on the Option menu. Non-default user settings are " @@ -1575,7 +1608,7 @@ msgid "" "or more of the files in ``.idlerc``." msgstr "" -#: ../../library/idle.rst:945 +#: ../../library/idle.rst:980 msgid "" "On the Font tab, see the text sample for the effect of font face and size on " "multiple characters in multiple languages. Edit the sample to add other " @@ -1584,7 +1617,7 @@ msgid "" "them to the top of the sample and try changing first size and then font." msgstr "" -#: ../../library/idle.rst:952 +#: ../../library/idle.rst:987 msgid "" "On the Highlights and Keys tab, select a built-in or custom color theme and " "key set. To use a newer built-in color theme or key set with older IDLEs, " @@ -1592,22 +1625,22 @@ msgid "" "IDLEs." msgstr "" -#: ../../library/idle.rst:958 +#: ../../library/idle.rst:993 msgid "IDLE on macOS" -msgstr "" +msgstr "macOS 上的 IDLE" -#: ../../library/idle.rst:960 +#: ../../library/idle.rst:995 msgid "" "Under System Preferences: Dock, one can set \"Prefer tabs when opening " "documents\" to \"Always\". This setting is not compatible with the tk/" "tkinter GUI framework used by IDLE, and it breaks a few IDLE features." msgstr "" -#: ../../library/idle.rst:965 +#: ../../library/idle.rst:1000 msgid "Extensions" msgstr "" -#: ../../library/idle.rst:967 +#: ../../library/idle.rst:1002 msgid "" "IDLE contains an extension facility. Preferences for extensions can be " "changed with the Extensions tab of the preferences dialog. See the beginning " @@ -1616,21 +1649,21 @@ msgid "" "testing." msgstr "" -#: ../../library/idle.rst:975 -msgid "idlelib" -msgstr "idlelib" +#: ../../library/idle.rst:1010 +msgid "idlelib --- implementation of IDLE application" +msgstr "" -#: ../../library/idle.rst:980 +#: ../../library/idle.rst:1015 msgid "**Source code:** :source:`Lib/idlelib`" msgstr "**原始碼:**\\ :source:`Lib/idlelib/`" -#: ../../library/idle.rst:984 +#: ../../library/idle.rst:1019 msgid "" "The Lib/idlelib package implements the IDLE application. See the rest of " "this page for how to use IDLE." msgstr "" -#: ../../library/idle.rst:987 +#: ../../library/idle.rst:1022 msgid "" "The files in idlelib are described in idlelib/README.txt. Access it either " "in idlelib or click Help => About IDLE on the IDLE menu. This file also " @@ -1639,6 +1672,10 @@ msgid "" "changes can be backported (see :pep:`434`)." msgstr "" +#: ../../library/idle.rst:10 +msgid "IDLE" +msgstr "IDLE" + #: ../../library/idle.rst:10 msgid "Python Editor" msgstr "Python Editor(Python 編輯器)" @@ -1647,26 +1684,56 @@ msgstr "Python Editor(Python 編輯器)" msgid "Integrated Development Environment" msgstr "Integrated Development Environment(整合開發環境)" -#: ../../library/idle.rst:68 +#: ../../library/idle.rst:71 msgid "Module browser" msgstr "Module browser(模組瀏覽器)" -#: ../../library/idle.rst:68 +#: ../../library/idle.rst:71 msgid "Path browser" msgstr "Path browser(路徑瀏覽器)" -#: ../../library/idle.rst:210 +#: ../../library/idle.rst:213 msgid "Run script" msgstr "Run script(執行腳本)" -#: ../../library/idle.rst:277 +#: ../../library/idle.rst:280 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/idle.rst:277 +#: ../../library/idle.rst:280 msgid "stack viewer" msgstr "stack viewer(堆疊檢視器)" -#: ../../library/idle.rst:353 +#: ../../library/idle.rst:356 msgid "breakpoints" msgstr "breakpoints(中斷點)" + +#~ msgid "" +#~ "idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " +#~ "[arg] ...\n" +#~ "\n" +#~ "-c command run command in the shell window\n" +#~ "-d enable debugger and open shell window\n" +#~ "-e open editor window\n" +#~ "-h print help message with legal combinations and exit\n" +#~ "-i open shell window\n" +#~ "-r file run file in shell window\n" +#~ "-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" +#~ "-t title set title of shell window\n" +#~ "- run stdin in shell (- must be last option before args)" +#~ msgstr "" +#~ "idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " +#~ "[arg] ...\n" +#~ "\n" +#~ "-c command run command in the shell window\n" +#~ "-d enable debugger and open shell window\n" +#~ "-e open editor window\n" +#~ "-h print help message with legal combinations and exit\n" +#~ "-i open shell window\n" +#~ "-r file run file in shell window\n" +#~ "-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" +#~ "-t title set title of shell window\n" +#~ "- run stdin in shell (- must be last option before args)" + +#~ msgid "idlelib" +#~ msgstr "idlelib" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 3f925524cf..32a230af5d 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-03-28 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -113,13 +113,13 @@ msgstr "" #: ../../library/importlib.metadata.rst:82 msgid "" "(example) $ python\n" -">>> from importlib.metadata import version \n" -">>> version('wheel') \n" +">>> from importlib.metadata import version\n" +">>> version('wheel')\n" "'0.32.3'" msgstr "" "(example) $ python\n" -">>> from importlib.metadata import version \n" -">>> version('wheel') \n" +">>> from importlib.metadata import version\n" +">>> version('wheel')\n" "'0.32.3'" #: ../../library/importlib.metadata.rst:89 @@ -136,7 +136,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:95 msgid "" -">>> list(metadata('wheel')) \n" +">>> list(metadata('wheel'))\n" "['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', " "'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', " "'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', " @@ -145,7 +145,7 @@ msgid "" "'Classifier', 'Requires-Python', 'Provides-Extra', 'Requires-Dist', " "'Requires-Dist']" msgstr "" -">>> list(metadata('wheel')) \n" +">>> list(metadata('wheel'))\n" "['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', " "'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', " "'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', " @@ -225,8 +225,8 @@ msgid "Query all entry points::" msgstr "" #: ../../library/importlib.metadata.rst:152 -msgid ">>> eps = entry_points() " -msgstr ">>> eps = entry_points() " +msgid ">>> eps = entry_points()" +msgstr ">>> eps = entry_points()" #: ../../library/importlib.metadata.rst:154 msgid "" @@ -237,11 +237,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:158 msgid "" -">>> sorted(eps.groups) \n" +">>> sorted(eps.groups)\n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" msgstr "" -">>> sorted(eps.groups) \n" +">>> sorted(eps.groups)\n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" @@ -253,8 +253,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:165 -msgid ">>> scripts = eps.select(group='console_scripts') " -msgstr ">>> scripts = eps.select(group='console_scripts') " +msgid ">>> scripts = eps.select(group='console_scripts')" +msgstr ">>> scripts = eps.select(group='console_scripts')" #: ../../library/importlib.metadata.rst:167 msgid "" @@ -263,8 +263,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:170 -msgid ">>> scripts = entry_points(group='console_scripts') " -msgstr ">>> scripts = entry_points(group='console_scripts') " +msgid ">>> scripts = entry_points(group='console_scripts')" +msgstr ">>> scripts = entry_points(group='console_scripts')" #: ../../library/importlib.metadata.rst:172 msgid "" @@ -273,13 +273,13 @@ msgstr "" #: ../../library/importlib.metadata.rst:174 msgid "" -">>> 'wheel' in scripts.names \n" +">>> 'wheel' in scripts.names\n" "True\n" -">>> wheel = scripts['wheel'] " +">>> wheel = scripts['wheel']" msgstr "" -">>> 'wheel' in scripts.names \n" +">>> 'wheel' in scripts.names\n" "True\n" -">>> wheel = scripts['wheel'] " +">>> wheel = scripts['wheel']" #: ../../library/importlib.metadata.rst:178 msgid "Equivalently, query for that entry point during selection::" @@ -287,11 +287,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:180 msgid "" -">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" -">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " +">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" +">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" msgstr "" -">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" -">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " +">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" +">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" #: ../../library/importlib.metadata.rst:183 msgid "Inspect the resolved entry point::" @@ -299,28 +299,28 @@ msgstr "" #: ../../library/importlib.metadata.rst:185 msgid "" -">>> wheel \n" +">>> wheel\n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" -">>> wheel.module \n" +">>> wheel.module\n" "'wheel.cli'\n" -">>> wheel.attr \n" +">>> wheel.attr\n" "'main'\n" -">>> wheel.extras \n" +">>> wheel.extras\n" "[]\n" -">>> main = wheel.load() \n" -">>> main \n" +">>> main = wheel.load()\n" +">>> main\n" "" msgstr "" -">>> wheel \n" +">>> wheel\n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" -">>> wheel.module \n" +">>> wheel.module\n" "'wheel.cli'\n" -">>> wheel.attr \n" +">>> wheel.attr\n" "'main'\n" -">>> wheel.extras \n" +">>> wheel.extras\n" "[]\n" -">>> main = wheel.load() \n" -">>> main \n" +">>> main = wheel.load()\n" +">>> main\n" "" #: ../../library/importlib.metadata.rst:197 @@ -359,10 +359,10 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:226 -#: ../../library/importlib.metadata.rst:274 -#: ../../library/importlib.metadata.rst:295 -#: ../../library/importlib.metadata.rst:358 -#: ../../library/importlib.metadata.rst:409 +#: ../../library/importlib.metadata.rst:275 +#: ../../library/importlib.metadata.rst:296 +#: ../../library/importlib.metadata.rst:359 +#: ../../library/importlib.metadata.rst:410 msgid "" "Raises :exc:`PackageNotFoundError` if the named distribution package is not " "installed in the current Python environment." @@ -389,8 +389,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:240 -msgid ">>> wheel_metadata = metadata('wheel') " -msgstr ">>> wheel_metadata = metadata('wheel') " +msgid ">>> wheel_metadata = metadata('wheel')" +msgstr ">>> wheel_metadata = metadata('wheel')" #: ../../library/importlib.metadata.rst:242 msgid "" @@ -400,10 +400,10 @@ msgstr "" #: ../../library/importlib.metadata.rst:245 msgid "" -">>> wheel_metadata['Requires-Python'] \n" +">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" msgstr "" -">>> wheel_metadata['Requires-Python'] \n" +">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" #: ../../library/importlib.metadata.rst:248 @@ -421,7 +421,7 @@ msgstr "" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" #: ../../library/importlib.metadata.rst:254 -#: ../../library/importlib.metadata.rst:452 +#: ../../library/importlib.metadata.rst:453 msgid "" "The full set of available metadata is not described here. See the PyPA `Core " "metadata specification `__ for the named " +"distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:277 +#: ../../library/importlib.metadata.rst:278 msgid "" "The :func:`!version` function is the quickest way to get a `Distribution " "Package `_'s version number, as a string::" msgstr "" -#: ../../library/importlib.metadata.rst:281 +#: ../../library/importlib.metadata.rst:282 msgid "" -">>> version('wheel') \n" +">>> version('wheel')\n" "'0.32.3'" msgstr "" -">>> version('wheel') \n" +">>> version('wheel')\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:288 +#: ../../library/importlib.metadata.rst:289 msgid "Distribution files" msgstr "" -#: ../../library/importlib.metadata.rst:292 +#: ../../library/importlib.metadata.rst:293 msgid "" "Return the full set of files contained within the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:298 +#: ../../library/importlib.metadata.rst:299 msgid "" "Returns :const:`None` if the distribution is found but the installation " "database records reporting the files associated with the distribuion package " "are missing." msgstr "" -#: ../../library/importlib.metadata.rst:304 +#: ../../library/importlib.metadata.rst:305 msgid "" "A :class:`pathlib.PurePath` derived object with additional ``dist``, " "``size``, and ``hash`` properties corresponding to the distribution " "package's installation metadata for that file." msgstr "" -#: ../../library/importlib.metadata.rst:308 +#: ../../library/importlib.metadata.rst:309 msgid "" "The :func:`!files` function takes a `Distribution Package `_ name and returns " @@ -494,35 +495,35 @@ msgid "" "class:`PackagePath` instance. For example::" msgstr "" -#: ../../library/importlib.metadata.rst:313 +#: ../../library/importlib.metadata.rst:314 msgid "" -">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" -">>> util \n" +">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n" +">>> util\n" "PackagePath('wheel/util.py')\n" -">>> util.size \n" +">>> util.size\n" "859\n" -">>> util.dist \n" +">>> util.dist\n" "\n" -">>> util.hash \n" +">>> util.hash\n" "" msgstr "" -">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" -">>> util \n" +">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n" +">>> util\n" "PackagePath('wheel/util.py')\n" -">>> util.size \n" +">>> util.size\n" "859\n" -">>> util.dist \n" +">>> util.dist\n" "\n" -">>> util.hash \n" +">>> util.hash\n" "" -#: ../../library/importlib.metadata.rst:323 +#: ../../library/importlib.metadata.rst:324 msgid "Once you have the file, you can also read its contents::" msgstr "" -#: ../../library/importlib.metadata.rst:325 +#: ../../library/importlib.metadata.rst:326 msgid "" -">>> print(util.read_text()) \n" +">>> print(util.read_text())\n" "import base64\n" "import sys\n" "...\n" @@ -531,7 +532,7 @@ msgid "" " return s.encode('utf-8')\n" " return s" msgstr "" -">>> print(util.read_text()) \n" +">>> print(util.read_text())\n" "import base64\n" "import sys\n" "...\n" @@ -540,21 +541,21 @@ msgstr "" " return s.encode('utf-8')\n" " return s" -#: ../../library/importlib.metadata.rst:334 +#: ../../library/importlib.metadata.rst:335 msgid "" "You can also use the :meth:`!locate` method to get the absolute path to the " "file::" msgstr "" -#: ../../library/importlib.metadata.rst:337 +#: ../../library/importlib.metadata.rst:338 msgid "" -">>> util.locate() \n" +">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" msgstr "" -">>> util.locate() \n" +">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" -#: ../../library/importlib.metadata.rst:340 +#: ../../library/importlib.metadata.rst:341 msgid "" "In the case where the metadata file listing files (``RECORD`` or ``SOURCES." "txt``) is missing, :func:`!files` will return :const:`None`. The caller may " @@ -564,49 +565,49 @@ msgid "" "distribution is not known to have the metadata present." msgstr "" -#: ../../library/importlib.metadata.rst:351 +#: ../../library/importlib.metadata.rst:352 msgid "Distribution requirements" msgstr "" -#: ../../library/importlib.metadata.rst:355 +#: ../../library/importlib.metadata.rst:356 msgid "" "Return the declared dependency specifiers for the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:361 +#: ../../library/importlib.metadata.rst:362 msgid "" "To get the full set of requirements for a `Distribution Package `_, use " "the :func:`!requires` function::" msgstr "" -#: ../../library/importlib.metadata.rst:365 +#: ../../library/importlib.metadata.rst:366 msgid "" -">>> requires('wheel') \n" +">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" msgstr "" -">>> requires('wheel') \n" +">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" -#: ../../library/importlib.metadata.rst:373 +#: ../../library/importlib.metadata.rst:374 msgid "Mapping import to distribution packages" msgstr "" -#: ../../library/importlib.metadata.rst:377 +#: ../../library/importlib.metadata.rst:378 msgid "" "Return a mapping from the top level module and import package names found " -"via :attr:`sys.meta_path` to the names of the distribution packages (if any) " +"via :data:`sys.meta_path` to the names of the distribution packages (if any) " "that provide the corresponding files." msgstr "" -#: ../../library/importlib.metadata.rst:381 +#: ../../library/importlib.metadata.rst:382 msgid "" "To allow for namespace packages (which may have members provided by multiple " "distribution packages), each top level import name maps to a list of " "distribution names rather than mapping directly to a single name." msgstr "" -#: ../../library/importlib.metadata.rst:385 +#: ../../library/importlib.metadata.rst:386 msgid "" "A convenience method to resolve the `Distribution Package `_ name (or names, " @@ -615,7 +616,7 @@ msgid "" "glossary/#term-Import-Package>`_::" msgstr "" -#: ../../library/importlib.metadata.rst:390 +#: ../../library/importlib.metadata.rst:391 msgid "" ">>> packages_distributions()\n" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " @@ -625,110 +626,110 @@ msgstr "" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " "['jaraco.classes', 'jaraco.functools'], ...}" -#: ../../library/importlib.metadata.rst:393 +#: ../../library/importlib.metadata.rst:394 msgid "" "Some editable installs, `do not supply top-level names `_, and thus this function is not " "reliable with such installs." msgstr "" -#: ../../library/importlib.metadata.rst:402 +#: ../../library/importlib.metadata.rst:403 msgid "Distributions" msgstr "" -#: ../../library/importlib.metadata.rst:406 +#: ../../library/importlib.metadata.rst:407 msgid "" "Return a :class:`Distribution` instance describing the named distribution " "package." msgstr "" -#: ../../library/importlib.metadata.rst:414 +#: ../../library/importlib.metadata.rst:415 msgid "Details of an installed distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:416 +#: ../../library/importlib.metadata.rst:417 msgid "" "Note: different :class:`!Distribution` instances do not currently compare " "equal, even if they relate to the same installed distribution and " "accordingly have the same attributes." msgstr "" -#: ../../library/importlib.metadata.rst:420 +#: ../../library/importlib.metadata.rst:421 msgid "" "While the module level API described above is the most common and convenient " "usage, you can get all of that information from the :class:`!Distribution` " "class. :class:`!Distribution` is an abstract object that represents the " "metadata for a Python `Distribution Package `_. You can get the concreate :" +"latest/glossary/#term-Distribution-Package>`_. You can get the concrete :" "class:`!Distribution` subclass instance for an installed distribution " "package by calling the :func:`distribution` function::" msgstr "" -#: ../../library/importlib.metadata.rst:427 +#: ../../library/importlib.metadata.rst:428 msgid "" -">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') \n" -">>> type(dist) \n" +">>> from importlib.metadata import distribution\n" +">>> dist = distribution('wheel')\n" +">>> type(dist)\n" "" msgstr "" -">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') \n" -">>> type(dist) \n" +">>> from importlib.metadata import distribution\n" +">>> dist = distribution('wheel')\n" +">>> type(dist)\n" "" -#: ../../library/importlib.metadata.rst:432 +#: ../../library/importlib.metadata.rst:433 msgid "" "Thus, an alternative way to get the version number is through the :class:`!" "Distribution` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:435 +#: ../../library/importlib.metadata.rst:436 msgid "" -">>> dist.version \n" +">>> dist.version\n" "'0.32.3'" msgstr "" -">>> dist.version \n" +">>> dist.version\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:438 +#: ../../library/importlib.metadata.rst:439 msgid "" "There are all kinds of additional metadata available on :class:`!" "Distribution` instances::" msgstr "" -#: ../../library/importlib.metadata.rst:441 +#: ../../library/importlib.metadata.rst:442 msgid "" -">>> dist.metadata['Requires-Python'] \n" +">>> dist.metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" -">>> dist.metadata['License'] \n" +">>> dist.metadata['License']\n" "'MIT'" msgstr "" -">>> dist.metadata['Requires-Python'] \n" +">>> dist.metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" -">>> dist.metadata['License'] \n" +">>> dist.metadata['License']\n" "'MIT'" -#: ../../library/importlib.metadata.rst:446 +#: ../../library/importlib.metadata.rst:447 msgid "" "For editable packages, an ``origin`` property may present :pep:`610` " "metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:449 +#: ../../library/importlib.metadata.rst:450 msgid "" ">>> dist.origin.url\n" "'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" msgstr "" -#: ../../library/importlib.metadata.rst:455 +#: ../../library/importlib.metadata.rst:456 msgid "The ``.origin`` property was added." msgstr "新增 ``.origin`` 屬性 (property)。" -#: ../../library/importlib.metadata.rst:459 +#: ../../library/importlib.metadata.rst:460 msgid "Distribution Discovery" msgstr "" -#: ../../library/importlib.metadata.rst:461 +#: ../../library/importlib.metadata.rst:462 msgid "" "By default, this package provides built-in support for discovery of metadata " "for file system and zip file `Distribution Package `_ metadata is not available through :" @@ -763,14 +764,14 @@ msgid "" "on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:480 +#: ../../library/importlib.metadata.rst:481 msgid "" "By default ``importlib.metadata`` installs a finder for distribution " "packages found on the file system. This finder doesn't actually find any " "*distributions*, but it can find their metadata." msgstr "" -#: ../../library/importlib.metadata.rst:485 +#: ../../library/importlib.metadata.rst:486 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " "interface expected of finders by Python's import system. ``importlib." @@ -780,7 +781,7 @@ msgid "" "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:493 +#: ../../library/importlib.metadata.rst:494 msgid "" "@abc.abstractmethod\n" "def find_distributions(context=DistributionFinder.Context()):\n" @@ -789,14 +790,14 @@ msgid "" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:499 +#: ../../library/importlib.metadata.rst:500 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " "other relevant context." msgstr "" -#: ../../library/importlib.metadata.rst:503 +#: ../../library/importlib.metadata.rst:504 msgid "" "What this means in practice is that to support finding distribution package " "metadata in locations other than the file system, subclass ``Distribution`` " @@ -805,17 +806,17 @@ msgid "" "method." msgstr "" -#: ../../library/importlib.metadata.rst:510 +#: ../../library/importlib.metadata.rst:511 msgid "Example" msgstr "" -#: ../../library/importlib.metadata.rst:512 +#: ../../library/importlib.metadata.rst:513 msgid "" "Consider for example a custom finder that loads Python modules from a " "database::" msgstr "" -#: ../../library/importlib.metadata.rst:515 +#: ../../library/importlib.metadata.rst:516 msgid "" "class DatabaseImporter(importlib.abc.MetaPathFinder):\n" " def __init__(self, db):\n" @@ -827,14 +828,14 @@ msgid "" "sys.meta_path.append(DatabaseImporter(connect_db(...)))" msgstr "" -#: ../../library/importlib.metadata.rst:524 +#: ../../library/importlib.metadata.rst:525 msgid "" "That importer now presumably provides importable modules from a database, " "but it provides no metadata or entry points. For this custom importer to " "provide metadata, it would also need to implement ``DistributionFinder``::" msgstr "" -#: ../../library/importlib.metadata.rst:529 +#: ../../library/importlib.metadata.rst:530 msgid "" "from importlib.metadata import DistributionFinder\n" "\n" @@ -847,7 +848,7 @@ msgid "" " yield DatabaseDistribution(dist_record)" msgstr "" -#: ../../library/importlib.metadata.rst:539 +#: ../../library/importlib.metadata.rst:540 msgid "" "In this way, ``query_distributions`` would return records for each " "distribution served by the database matching the query. For example, if " @@ -856,7 +857,7 @@ msgid "" "``Context(name=None)``." msgstr "" -#: ../../library/importlib.metadata.rst:545 +#: ../../library/importlib.metadata.rst:546 msgid "" "For the sake of simplicity, this example ignores ``context.path``\\. The " "``path`` attribute defaults to ``sys.path`` and is the set of import paths " @@ -869,11 +870,11 @@ msgid "" "``context.path`` and only yield ``Distribution``\\ s pertinent to that path." msgstr "" -#: ../../library/importlib.metadata.rst:556 +#: ../../library/importlib.metadata.rst:557 msgid "``DatabaseDistribution``, then, would look something like::" msgstr "" -#: ../../library/importlib.metadata.rst:558 +#: ../../library/importlib.metadata.rst:559 msgid "" "class DatabaseDistribution(importlib.metadata.Distribution):\n" " def __init__(self, record):\n" @@ -896,14 +897,14 @@ msgid "" " raise RuntimeError(\"This distribution has no file system\")" msgstr "" -#: ../../library/importlib.metadata.rst:578 +#: ../../library/importlib.metadata.rst:579 msgid "" "This basic implementation should provide metadata and entry points for " "packages served by the ``DatabaseImporter``, assuming that the ``record`` " "supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." msgstr "" -#: ../../library/importlib.metadata.rst:583 +#: ../../library/importlib.metadata.rst:584 msgid "" "The ``DatabaseDistribution`` may also provide other metadata files, like " "``RECORD`` (required for ``Distribution.files``) or override the " diff --git a/library/importlib.po b/library/importlib.po index abe935981e..4c36d9ea83 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,9 +43,9 @@ msgid "" "to comprehend than one implemented in a programming language other than " "Python." msgstr "" -"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸到 :" -"func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 Python " -"直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。 " +"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸" +"到 :func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 " +"Python 直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。" #: ../../library/importlib.rst:29 msgid "" @@ -89,8 +89,8 @@ msgstr "" #: ../../library/importlib.rst:47 msgid "" "Original specification of packages. Some semantics have changed since the " -"writing of this document (e.g. redirecting based on ``None`` in :data:`sys." -"modules`)." +"writing of this document (e.g. redirecting based on ``None`` " +"in :data:`sys.modules`)." msgstr "" #: ../../library/importlib.rst:51 @@ -231,11 +231,11 @@ msgstr "" #: ../../library/importlib.rst:115 msgid "" -"The :func:`import_module` function acts as a simplifying wrapper around :" -"func:`importlib.__import__`. This means all semantics of the function are " -"derived from :func:`importlib.__import__`. The most important difference " -"between these two functions is that :func:`import_module` returns the " -"specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " +"The :func:`import_module` function acts as a simplifying wrapper " +"around :func:`importlib.__import__`. This means all semantics of the " +"function are derived from :func:`importlib.__import__`. The most important " +"difference between these two functions is that :func:`import_module` returns " +"the specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " "returns the top-level package or module (e.g. ``pkg``)." msgstr "" @@ -347,11 +347,11 @@ msgstr "" #: ../../library/importlib.rst:193 msgid "" -"If a module imports objects from another module using :keyword:`from` ... :" -"keyword:`import` ..., calling :func:`reload` for the other module does not " -"redefine the objects imported from it --- one way around this is to re-" -"execute the :keyword:`!from` statement, another is to use :keyword:`!import` " -"and qualified names (*module.name*) instead." +"If a module imports objects from another module " +"using :keyword:`from` ... :keyword:`import` ..., calling :func:`reload` for " +"the other module does not redefine the objects imported from it --- one way " +"around this is to re-execute the :keyword:`!from` statement, another is to " +"use :keyword:`!import` and qualified names (*module.name*) instead." msgstr "" #: ../../library/importlib.rst:199 @@ -364,8 +364,8 @@ msgstr "" #: ../../library/importlib.rst:205 msgid "" -":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks a :" -"class:`~importlib.machinery.ModuleSpec`." +":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks " +"a :class:`~importlib.machinery.ModuleSpec`." msgstr "" #: ../../library/importlib.rst:211 @@ -444,26 +444,27 @@ msgstr "" msgid "" "An abstract base class representing a :term:`path entry finder`. Though it " "bears some similarities to :class:`MetaPathFinder`, ``PathEntryFinder`` is " -"meant for use only within the path-based import subsystem provided by :class:" -"`importlib.machinery.PathFinder`." +"meant for use only within the path-based import subsystem provided " +"by :class:`importlib.machinery.PathFinder`." msgstr "" #: ../../library/importlib.rst:285 msgid "" "An abstract method for finding a :term:`spec ` for the " -"specified module. The finder will search for the module only within the :" -"term:`path entry` to which it is assigned. If a spec cannot be found, " +"specified module. The finder will search for the module only within " +"the :term:`path entry` to which it is assigned. If a spec cannot be found, " "``None`` is returned. When passed in, ``target`` is a module object that " -"the finder may use to make a more educated guess about what spec to return. :" -"func:`importlib.util.spec_from_loader` may be useful for implementing " -"concrete ``PathEntryFinders``." +"the finder may use to make a more educated guess about what spec to " +"return. :func:`importlib.util.spec_from_loader` may be useful for " +"implementing concrete ``PathEntryFinders``." msgstr "" #: ../../library/importlib.rst:297 msgid "" "An optional method which, when called, should invalidate any internal cache " -"used by the finder. Used by :meth:`importlib.machinery.PathFinder." -"invalidate_caches` when invalidating the caches of all cached finders." +"used by the finder. Used " +"by :meth:`importlib.machinery.PathFinder.invalidate_caches` when " +"invalidating the caches of all cached finders." msgstr "" #: ../../library/importlib.rst:305 @@ -474,9 +475,9 @@ msgstr "" #: ../../library/importlib.rst:308 msgid "" -"Loaders that wish to support resource reading should implement a :meth:" -"`get_resource_reader` method as specified by :class:`importlib.resources.abc." -"ResourceReader`." +"Loaders that wish to support resource reading should implement " +"a :meth:`get_resource_reader` method as specified " +"by :class:`importlib.resources.abc.ResourceReader`." msgstr "" #: ../../library/importlib.rst:312 @@ -498,8 +499,8 @@ msgstr "" msgid "" "An abstract method that executes the module in its own namespace when a " "module is imported or reloaded. The module should already be initialized " -"when :meth:`exec_module` is called. When this method exists, :meth:" -"`create_module` must be defined." +"when :meth:`exec_module` is called. When this method " +"exists, :meth:`create_module` must be defined." msgstr "" #: ../../library/importlib.rst:336 @@ -508,8 +509,9 @@ msgstr ":meth:`create_module` 也必須被定義。" #: ../../library/importlib.rst:341 msgid "" -"A legacy method for loading a module. If the module cannot be loaded, :exc:" -"`ImportError` is raised, otherwise the loaded module is returned." +"A legacy method for loading a module. If the module cannot be " +"loaded, :exc:`ImportError` is raised, otherwise the loaded module is " +"returned." msgstr "" #: ../../library/importlib.rst:345 @@ -567,63 +569,69 @@ msgstr "" #: ../../library/importlib.rst:373 msgid "" -"The recommended API for loading a module is :meth:`exec_module` (and :meth:" -"`create_module`). Loaders should implement it instead of :meth:" -"`load_module`. The import machinery takes care of all the other " +"The recommended API for loading a module is :meth:`exec_module` " +"(and :meth:`create_module`). Loaders should implement it instead " +"of :meth:`load_module`. The import machinery takes care of all the other " "responsibilities of :meth:`load_module` when :meth:`exec_module` is " "implemented." msgstr "" -#: ../../library/importlib.rst:383 +#: ../../library/importlib.rst:383 ../../library/importlib.rst:636 +msgid "*Superseded by TraversableResources*" +msgstr "" + +#: ../../library/importlib.rst:385 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loading arbitrary resources from the storage back-end." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loading arbitrary resources from the " +"storage back-end." msgstr "" -#: ../../library/importlib.rst:387 +#: ../../library/importlib.rst:389 msgid "" -"This ABC is deprecated in favour of supporting resource loading through :" -"class:`importlib.resources.abc.ResourceReader`." +"This ABC is deprecated in favour of supporting resource loading " +"through :class:`importlib.resources.abc.TraversableResources`." msgstr "" -#: ../../library/importlib.rst:393 +#: ../../library/importlib.rst:396 msgid "" "An abstract method to return the bytes for the data located at *path*. " "Loaders that have a file-like storage back-end that allows storing arbitrary " "data can implement this abstract method to give direct access to the data " "stored. :exc:`OSError` is to be raised if the *path* cannot be found. The " -"*path* is expected to be constructed using a module's :attr:`~module." -"__file__` attribute or an item from a package's :attr:`~module.__path__`." +"*path* is expected to be constructed using a " +"module's :attr:`~module.__file__` attribute or an item from a " +"package's :attr:`~module.__path__`." msgstr "" -#: ../../library/importlib.rst:402 +#: ../../library/importlib.rst:405 msgid "Raises :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:408 +#: ../../library/importlib.rst:411 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loaders that inspect modules." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loaders that inspect modules." msgstr "" -#: ../../library/importlib.rst:413 +#: ../../library/importlib.rst:416 msgid "" "Return the code object for a module, or ``None`` if the module does not have " "a code object (as would be the case, for example, for a built-in module). " "Raise an :exc:`ImportError` if loader cannot find the requested module." msgstr "" -#: ../../library/importlib.rst:419 +#: ../../library/importlib.rst:422 msgid "" "While the method has a default implementation, it is suggested that it be " "overridden if possible for performance." msgstr "" -#: ../../library/importlib.rst:425 +#: ../../library/importlib.rst:428 msgid "No longer abstract and a concrete implementation is provided." msgstr "" -#: ../../library/importlib.rst:430 +#: ../../library/importlib.rst:434 msgid "" "An abstract method to return the source of a module. It is returned as a " "text string using :term:`universal newlines`, translating all recognized " @@ -632,237 +640,234 @@ msgid "" "cannot find the module specified." msgstr "" -#: ../../library/importlib.rst:436 ../../library/importlib.rst:445 -#: ../../library/importlib.rst:495 +#: ../../library/importlib.rst:440 ../../library/importlib.rst:449 +#: ../../library/importlib.rst:500 msgid "Raises :exc:`ImportError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:441 +#: ../../library/importlib.rst:445 msgid "" "An optional method to return a true value if the module is a package, a " "false value otherwise. :exc:`ImportError` is raised if the :term:`loader` " "cannot find the module." msgstr "" -#: ../../library/importlib.rst:450 +#: ../../library/importlib.rst:454 msgid "Create a code object from Python source." msgstr "" -#: ../../library/importlib.rst:452 +#: ../../library/importlib.rst:456 msgid "" -"The *data* argument can be whatever the :func:`compile` function supports (i." -"e. string or bytes). The *path* argument should be the \"path\" to where the " -"source code originated from, which can be an abstract concept (e.g. location " -"in a zip file)." +"The *data* argument can be whatever the :func:`compile` function supports " +"(i.e. string or bytes). The *path* argument should be the \"path\" to where " +"the source code originated from, which can be an abstract concept (e.g. " +"location in a zip file)." msgstr "" -#: ../../library/importlib.rst:457 +#: ../../library/importlib.rst:461 msgid "" "With the subsequent code object one can execute it in a module by running " "``exec(code, module.__dict__)``." msgstr "" -#: ../../library/importlib.rst:462 +#: ../../library/importlib.rst:466 msgid "Made the method static." msgstr "" -#: ../../library/importlib.rst:467 +#: ../../library/importlib.rst:471 msgid "Implementation of :meth:`Loader.exec_module`." msgstr ":meth:`Loader.exec_module` 的實作。" -#: ../../library/importlib.rst:473 +#: ../../library/importlib.rst:477 msgid "Implementation of :meth:`Loader.load_module`." msgstr ":meth:`Loader.load_module` 的實作。" -#: ../../library/importlib.rst:475 +#: ../../library/importlib.rst:479 msgid "use :meth:`exec_module` instead." msgstr "請改用 :meth:`exec_module`。" -#: ../../library/importlib.rst:481 +#: ../../library/importlib.rst:485 msgid "" "An abstract base class which inherits from :class:`InspectLoader` that, when " "implemented, helps a module to be executed as a script. The ABC represents " "an optional :pep:`302` protocol." msgstr "" -#: ../../library/importlib.rst:487 +#: ../../library/importlib.rst:492 msgid "" "An abstract method that is to return the value of :attr:`~module.__file__` " "for the specified module. If no path is available, :exc:`ImportError` is " "raised." msgstr "" -#: ../../library/importlib.rst:491 +#: ../../library/importlib.rst:496 msgid "" "If source code is available, then the method should return the path to the " "source file, regardless of whether a bytecode was used to load the module." msgstr "" -#: ../../library/importlib.rst:501 +#: ../../library/importlib.rst:506 msgid "" -"An abstract base class which inherits from :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, providing concrete implementations of :meth:" -"`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." +"An abstract base class which inherits from :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, providing concrete implementations " +"of :meth:`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" -#: ../../library/importlib.rst:505 +#: ../../library/importlib.rst:510 msgid "" "The *fullname* argument is a fully resolved name of the module the loader is " "to handle. The *path* argument is the path to the file for the module." msgstr "" -#: ../../library/importlib.rst:512 +#: ../../library/importlib.rst:517 msgid "The name of the module the loader can handle." msgstr "" -#: ../../library/importlib.rst:516 +#: ../../library/importlib.rst:521 msgid "Path to the file of the module." msgstr "" -#: ../../library/importlib.rst:520 +#: ../../library/importlib.rst:525 msgid "Calls super's ``load_module()``." msgstr "" -#: ../../library/importlib.rst:522 +#: ../../library/importlib.rst:527 msgid "Use :meth:`Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:527 ../../library/importlib.rst:1122 +#: ../../library/importlib.rst:533 ../../library/importlib.rst:1140 msgid "Returns :attr:`path`." msgstr "" -#: ../../library/importlib.rst:531 +#: ../../library/importlib.rst:538 msgid "Reads *path* as a binary file and returns the bytes from it." msgstr "" -#: ../../library/importlib.rst:536 +#: ../../library/importlib.rst:543 msgid "" "An abstract base class for implementing source (and optionally bytecode) " -"file loading. The class inherits from both :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, requiring the implementation of:" +"file loading. The class inherits from both :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, requiring the implementation of:" msgstr "" -#: ../../library/importlib.rst:540 +#: ../../library/importlib.rst:547 msgid ":meth:`ResourceLoader.get_data`" msgstr ":meth:`ResourceLoader.get_data`" -#: ../../library/importlib.rst:541 +#: ../../library/importlib.rst:548 msgid ":meth:`ExecutionLoader.get_filename`" msgstr ":meth:`ExecutionLoader.get_filename`" -#: ../../library/importlib.rst:542 +#: ../../library/importlib.rst:549 msgid "" "Should only return the path to the source file; sourceless loading is not " "supported." msgstr "" -#: ../../library/importlib.rst:545 +#: ../../library/importlib.rst:552 msgid "" "The abstract methods defined by this class are to add optional bytecode file " -"support. Not implementing these optional methods (or causing them to raise :" -"exc:`NotImplementedError`) causes the loader to only work with source code. " -"Implementing the methods allows the loader to work with source *and* " +"support. Not implementing these optional methods (or causing them to " +"raise :exc:`NotImplementedError`) causes the loader to only work with source " +"code. Implementing the methods allows the loader to work with source *and* " "bytecode files; it does not allow for *sourceless* loading where only " "bytecode is provided. Bytecode files are an optimization to speed up " "loading by removing the parsing step of Python's compiler, and so no " "bytecode-specific API is exposed." msgstr "" -#: ../../library/importlib.rst:556 +#: ../../library/importlib.rst:563 msgid "" "Optional abstract method which returns a :class:`dict` containing metadata " "about the specified path. Supported dictionary keys are:" msgstr "" -#: ../../library/importlib.rst:559 +#: ../../library/importlib.rst:566 msgid "" "``'mtime'`` (mandatory): an integer or floating-point number representing " "the modification time of the source code;" msgstr "" -#: ../../library/importlib.rst:561 +#: ../../library/importlib.rst:568 msgid "``'size'`` (optional): the size in bytes of the source code." msgstr "" -#: ../../library/importlib.rst:563 +#: ../../library/importlib.rst:570 msgid "" "Any other keys in the dictionary are ignored, to allow for future " "extensions. If the path cannot be handled, :exc:`OSError` is raised." msgstr "" -#: ../../library/importlib.rst:568 ../../library/importlib.rst:581 +#: ../../library/importlib.rst:575 ../../library/importlib.rst:588 msgid "Raise :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:573 +#: ../../library/importlib.rst:580 msgid "" "Optional abstract method which returns the modification time for the " "specified path." msgstr "" -#: ../../library/importlib.rst:576 +#: ../../library/importlib.rst:583 msgid "" "This method is deprecated in favour of :meth:`path_stats`. You don't have " "to implement it, but it is still available for compatibility purposes. " "Raise :exc:`OSError` if the path cannot be handled." msgstr "" -#: ../../library/importlib.rst:586 +#: ../../library/importlib.rst:593 msgid "" "Optional abstract method which writes the specified bytes to a file path. " "Any intermediate directories which do not exist are to be created " "automatically." msgstr "" -#: ../../library/importlib.rst:590 +#: ../../library/importlib.rst:597 msgid "" -"When writing to the path fails because the path is read-only (:const:`errno." -"EACCES`/:exc:`PermissionError`), do not propagate the exception." +"When writing to the path fails because the path is read-only " +"(:const:`errno.EACCES`/:exc:`PermissionError`), do not propagate the " +"exception." msgstr "" -#: ../../library/importlib.rst:594 +#: ../../library/importlib.rst:601 msgid "No longer raises :exc:`NotImplementedError` when called." msgstr "" -#: ../../library/importlib.rst:599 +#: ../../library/importlib.rst:606 msgid "Concrete implementation of :meth:`InspectLoader.get_code`." msgstr "" -#: ../../library/importlib.rst:603 +#: ../../library/importlib.rst:610 msgid "Concrete implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:609 +#: ../../library/importlib.rst:616 msgid "Concrete implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:611 +#: ../../library/importlib.rst:618 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:616 +#: ../../library/importlib.rst:623 msgid "Concrete implementation of :meth:`InspectLoader.get_source`." msgstr "" -#: ../../library/importlib.rst:620 +#: ../../library/importlib.rst:627 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " -"determined to be a package if its file path (as provided by :meth:" -"`ExecutionLoader.get_filename`) is a file named ``__init__`` when the file " -"extension is removed **and** the module name itself does not end in " +"determined to be a package if its file path (as provided " +"by :meth:`ExecutionLoader.get_filename`) is a file named ``__init__`` when " +"the file extension is removed **and** the module name itself does not end in " "``__init__``." msgstr "" -#: ../../library/importlib.rst:629 -msgid "*Superseded by TraversableResources*" -msgstr "" - -#: ../../library/importlib.rst:631 +#: ../../library/importlib.rst:638 msgid "" "An :term:`abstract base class` to provide the ability to read *resources*." msgstr "" -#: ../../library/importlib.rst:634 +#: ../../library/importlib.rst:641 msgid "" "From the perspective of this ABC, a *resource* is a binary artifact that is " "shipped within a package. Typically this is something like a data file that " @@ -872,11 +877,11 @@ msgid "" "file versus on the file system." msgstr "" -#: ../../library/importlib.rst:642 +#: ../../library/importlib.rst:649 msgid "" -"For any of methods of this class, a *resource* argument is expected to be a :" -"term:`path-like object` which represents conceptually just a file name. This " -"means that no subdirectory paths should be included in the *resource* " +"For any of methods of this class, a *resource* argument is expected to be " +"a :term:`path-like object` which represents conceptually just a file name. " +"This means that no subdirectory paths should be included in the *resource* " "argument. This is because the location of the package the reader is for, " "acts as the \"directory\". Hence the metaphor for directories and file names " "is packages and resources, respectively. This is also why instances of this " @@ -884,7 +889,7 @@ msgid "" "potentially representing multiple packages or a module)." msgstr "" -#: ../../library/importlib.rst:653 +#: ../../library/importlib.rst:660 msgid "" "Loaders that wish to support resource reading are expected to provide a " "method called ``get_resource_reader(fullname)`` which returns an object " @@ -893,45 +898,45 @@ msgid "" "with this ABC should only be returned when the specified module is a package." msgstr "" -#: ../../library/importlib.rst:662 ../../library/importlib.rst:772 +#: ../../library/importlib.rst:669 ../../library/importlib.rst:789 msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.rst:667 +#: ../../library/importlib.rst:675 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.rst:670 +#: ../../library/importlib.rst:678 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.rst:675 +#: ../../library/importlib.rst:684 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.rst:677 +#: ../../library/importlib.rst:686 msgid "" -"If the resource does not concretely exist on the file system, raise :exc:" -"`FileNotFoundError`." +"If the resource does not concretely exist on the file system, " +"raise :exc:`FileNotFoundError`." msgstr "" -#: ../../library/importlib.rst:682 +#: ../../library/importlib.rst:692 msgid "" -"Returns ``True`` if the named *name* is considered a resource. :exc:" -"`FileNotFoundError` is raised if *name* does not exist." +"Returns ``True`` if the named *name* is considered a " +"resource. :exc:`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.rst:687 +#: ../../library/importlib.rst:698 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " -"actual resources, e.g. it is acceptable to return names for which :meth:" -"`is_resource` would be false." +"actual resources, e.g. it is acceptable to return names for " +"which :meth:`is_resource` would be false." msgstr "" -#: ../../library/importlib.rst:693 +#: ../../library/importlib.rst:704 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -940,254 +945,258 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.rst:701 +#: ../../library/importlib.rst:712 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.rst:706 +#: ../../library/importlib.rst:717 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.rst:709 +#: ../../library/importlib.rst:720 msgid "" -"For a representation of the object on the file-system, use :meth:`importlib." -"resources.as_file`." +"For a representation of the object on the file-system, " +"use :meth:`importlib.resources.as_file`." msgstr "" -#: ../../library/importlib.rst:714 +#: ../../library/importlib.rst:725 msgid "Use :class:`importlib.resources.abc.Traversable` instead." msgstr "" -#: ../../library/importlib.rst:719 +#: ../../library/importlib.rst:730 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.rst:723 +#: ../../library/importlib.rst:735 msgid "Yield ``Traversable`` objects in ``self``." msgstr "" -#: ../../library/importlib.rst:727 +#: ../../library/importlib.rst:740 msgid "Return ``True`` if ``self`` is a directory." msgstr "" -#: ../../library/importlib.rst:731 +#: ../../library/importlib.rst:745 msgid "Return ``True`` if ``self`` is a file." msgstr "" -#: ../../library/importlib.rst:735 +#: ../../library/importlib.rst:750 msgid "Return Traversable child in ``self``." msgstr "" -#: ../../library/importlib.rst:739 +#: ../../library/importlib.rst:755 msgid "Return ``Traversable`` child in ``self``." msgstr "" -#: ../../library/importlib.rst:743 +#: ../../library/importlib.rst:760 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.rst:746 +#: ../../library/importlib.rst:763 msgid "" -"When opening as text, accepts encoding parameters such as those accepted by :" -"attr:`io.TextIOWrapper`." +"When opening as text, accepts encoding parameters such as those accepted " +"by :class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.rst:751 +#: ../../library/importlib.rst:768 msgid "Read contents of ``self`` as bytes." msgstr "" -#: ../../library/importlib.rst:755 +#: ../../library/importlib.rst:772 msgid "Read contents of ``self`` as text." msgstr "" -#: ../../library/importlib.rst:760 +#: ../../library/importlib.rst:777 msgid "" -"An abstract base class for resource readers capable of serving the :meth:" -"`importlib.resources.files` interface. Subclasses :class:`importlib." -"resources.abc.ResourceReader` and provides concrete implementations of the :" -"class:`importlib.resources.abc.ResourceReader`'s abstract methods. " +"An abstract base class for resource readers capable of serving " +"the :meth:`importlib.resources.files` interface. " +"Subclasses :class:`importlib.resources.abc.ResourceReader` and provides " +"concrete implementations of " +"the :class:`importlib.resources.abc.ResourceReader`'s abstract methods. " "Therefore, any loader supplying :class:`importlib.abc.TraversableResources` " "also supplies ResourceReader." msgstr "" -#: ../../library/importlib.rst:767 +#: ../../library/importlib.rst:784 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.rst:777 +#: ../../library/importlib.rst:795 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." msgstr "" -#: ../../library/importlib.rst:783 +#: ../../library/importlib.rst:801 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:788 +#: ../../library/importlib.rst:806 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:792 +#: ../../library/importlib.rst:810 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:797 +#: ../../library/importlib.rst:815 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:804 +#: ../../library/importlib.rst:822 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:809 ../../library/importlib.rst:819 -msgid "Use :attr:`BYTECODE_SUFFIXES` instead." +#: ../../library/importlib.rst:827 ../../library/importlib.rst:837 +msgid "Use :const:`BYTECODE_SUFFIXES` instead." msgstr "" -#: ../../library/importlib.rst:814 +#: ../../library/importlib.rst:832 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:824 +#: ../../library/importlib.rst:842 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:829 +#: ../../library/importlib.rst:847 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:834 +#: ../../library/importlib.rst:852 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:841 +#: ../../library/importlib.rst:859 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " "code which simply needs to know if a filesystem path potentially refers to a " -"module without needing any details on the kind of module (for example, :func:" -"`inspect.getmodulename`)." +"module without needing any details on the kind of module (for " +"example, :func:`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:852 +#: ../../library/importlib.rst:870 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " -"listed in :data:`sys.builtin_module_names`. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"listed in :data:`sys.builtin_module_names`. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:857 ../../library/importlib.rst:871 -#: ../../library/importlib.rst:884 ../../library/importlib.rst:899 +#: ../../library/importlib.rst:875 ../../library/importlib.rst:889 +#: ../../library/importlib.rst:902 ../../library/importlib.rst:917 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:860 +#: ../../library/importlib.rst:878 msgid "" -"As part of :pep:`489`, the builtin importer now implements :meth:`Loader." -"create_module` and :meth:`Loader.exec_module`" +"As part of :pep:`489`, the builtin importer now " +"implements :meth:`Loader.create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:867 +#: ../../library/importlib.rst:885 msgid "" -"An :term:`importer` for frozen modules. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"An :term:`importer` for frozen modules. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:874 +#: ../../library/importlib.rst:892 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:881 +#: ../../library/importlib.rst:899 msgid "" ":term:`Finder ` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:889 +#: ../../library/importlib.rst:907 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:896 +#: ../../library/importlib.rst:914 msgid "" "A :term:`Finder ` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:904 +#: ../../library/importlib.rst:922 msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " -"*path*. For each path entry that is searched, :data:`sys." -"path_importer_cache` is checked. If a non-false object is found then it is " -"used as the :term:`path entry finder` to look for the module being searched " -"for. If no entry is found in :data:`sys.path_importer_cache`, then :data:" -"`sys.path_hooks` is searched for a finder for the path entry and, if found, " -"is stored in :data:`sys.path_importer_cache` along with being queried about " -"the module. If no finder is ever found then ``None`` is both stored in the " -"cache and returned." +"*path*. For each path entry that is " +"searched, :data:`sys.path_importer_cache` is checked. If a non-false object " +"is found then it is used as the :term:`path entry finder` to look for the " +"module being searched for. If no entry is found " +"in :data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is searched " +"for a finder for the path entry and, if found, is stored " +"in :data:`sys.path_importer_cache` along with being queried about the " +"module. If no finder is ever found then ``None`` is both stored in the cache " +"and returned." msgstr "" -#: ../../library/importlib.rst:918 +#: ../../library/importlib.rst:936 msgid "" "If the current working directory -- represented by an empty string -- is no " -"longer valid then ``None`` is returned but no value is cached in :data:`sys." -"path_importer_cache`." +"longer valid then ``None`` is returned but no value is cached " +"in :data:`sys.path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:925 +#: ../../library/importlib.rst:943 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:930 +#: ../../library/importlib.rst:948 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:933 +#: ../../library/importlib.rst:951 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:940 +#: ../../library/importlib.rst:958 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:943 +#: ../../library/importlib.rst:961 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:946 +#: ../../library/importlib.rst:964 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1195,7 +1204,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:951 +#: ../../library/importlib.rst:969 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1208,166 +1217,166 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:965 +#: ../../library/importlib.rst:983 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:969 +#: ../../library/importlib.rst:987 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:975 +#: ../../library/importlib.rst:993 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:979 +#: ../../library/importlib.rst:997 msgid "" "A class method which returns a closure for use on :data:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:984 +#: ../../library/importlib.rst:1002 msgid "" -"If the argument to the closure is not an existing directory, :exc:" -"`ImportError` is raised." +"If the argument to the closure is not an existing " +"directory, :exc:`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:990 +#: ../../library/importlib.rst:1008 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:998 +#: ../../library/importlib.rst:1016 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1002 +#: ../../library/importlib.rst:1020 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1006 +#: ../../library/importlib.rst:1024 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1010 +#: ../../library/importlib.rst:1028 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1014 +#: ../../library/importlib.rst:1032 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1018 ../../library/importlib.rst:1061 +#: ../../library/importlib.rst:1036 ../../library/importlib.rst:1079 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1023 ../../library/importlib.rst:1066 +#: ../../library/importlib.rst:1041 ../../library/importlib.rst:1084 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1028 +#: ../../library/importlib.rst:1046 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1031 +#: ../../library/importlib.rst:1049 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1040 +#: ../../library/importlib.rst:1058 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1044 +#: ../../library/importlib.rst:1062 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1048 +#: ../../library/importlib.rst:1066 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1052 +#: ../../library/importlib.rst:1070 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1056 +#: ../../library/importlib.rst:1074 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1071 +#: ../../library/importlib.rst:1089 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1074 +#: ../../library/importlib.rst:1092 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1077 +#: ../../library/importlib.rst:1095 msgid "" "Note that, by default, importing an extension module will fail in " "subinterpreters if it doesn't implement multi-phase init (see :pep:`489`), " "even if it would otherwise import successfully." msgstr "" -#: ../../library/importlib.rst:1083 +#: ../../library/importlib.rst:1101 msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1088 ../../library/importlib.rst:1274 +#: ../../library/importlib.rst:1106 ../../library/importlib.rst:1292 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1092 +#: ../../library/importlib.rst:1110 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1096 +#: ../../library/importlib.rst:1114 msgid "" -"Creates the module object from the given specification in accordance with :" -"pep:`489`." +"Creates the module object from the given specification in accordance " +"with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1103 +#: ../../library/importlib.rst:1121 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1109 +#: ../../library/importlib.rst:1127 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " -"based on :attr:`EXTENSION_SUFFIXES`." +"based on :const:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1114 +#: ../../library/importlib.rst:1132 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1118 +#: ../../library/importlib.rst:1136 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1129 +#: ../../library/importlib.rst:1147 msgid "" "A concrete implementation of :class:`importlib.abc.InspectLoader` for " "namespace packages. This is an alias for a private class and is only made " "public for introspecting the ``__loader__`` attribute on namespace packages::" msgstr "" -#: ../../library/importlib.rst:1134 +#: ../../library/importlib.rst:1152 msgid "" ">>> from importlib.machinery import NamespaceLoader\n" ">>> import my_namespace\n" @@ -1385,7 +1394,7 @@ msgstr "" ">>> isinstance(my_namespace.__loader__, importlib.abc.Loader)\n" "True" -#: ../../library/importlib.rst:1147 +#: ../../library/importlib.rst:1165 msgid "" "A specification for a module's import-system-related state. This is " "typically exposed as the module's :attr:`~module.__spec__` attribute. Many " @@ -1394,39 +1403,40 @@ msgid "" "the *values* are usually equivalent, they can differ since there is no " "synchronization between the two objects. For example, it is possible to " "update the module's :attr:`~module.__file__` at runtime and this will not be " -"automatically reflected in the module's :attr:`__spec__.origin `, and vice versa." +"automatically reflected in the module's :attr:`__spec__.origin " +"`, and vice versa." msgstr "" -#: ../../library/importlib.rst:1161 +#: ../../library/importlib.rst:1179 msgid "" -"The module's fully qualified name (see :attr:`module.__name__`). The :term:" -"`finder` should always set this attribute to a non-empty string." +"The module's fully qualified name (see :attr:`module.__name__`). " +"The :term:`finder` should always set this attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1166 +#: ../../library/importlib.rst:1184 msgid "" "The :term:`loader` used to load the module (see :attr:`module.__loader__`). " "The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1171 +#: ../../library/importlib.rst:1189 msgid "" -"The location the :term:`loader` should use to load the module (see :attr:" -"`module.__file__`). For example, for modules loaded from a ``.py`` file this " -"is the filename. The :term:`finder` should always set this attribute to a " -"meaningful value for the :term:`loader` to use. In the uncommon case that " -"there is not one (like for namespace packages), it should be set to ``None``." +"The location the :term:`loader` should use to load the module " +"(see :attr:`module.__file__`). For example, for modules loaded from a " +"``.py`` file this is the filename. The :term:`finder` should always set this " +"attribute to a meaningful value for the :term:`loader` to use. In the " +"uncommon case that there is not one (like for namespace packages), it should " +"be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1180 +#: ../../library/importlib.rst:1198 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations in " "which a package's submodules will be found (see :attr:`module.__path__`). " "Most of the time there will only be a single directory in this list." msgstr "" -#: ../../library/importlib.rst:1185 +#: ../../library/importlib.rst:1203 msgid "" "The :term:`finder` should set this attribute to a sequence, even an empty " "one, to indicate to the import system that the module is a package. It " @@ -1434,41 +1444,42 @@ msgid "" "later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1193 +#: ../../library/importlib.rst:1211 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1199 +#: ../../library/importlib.rst:1217 msgid "" -"The filename of a compiled version of the module's code (see :attr:`module." -"__cached__`). The :term:`finder` should always set this attribute but it may " -"be ``None`` for modules that do not need compiled code stored." +"The filename of a compiled version of the module's code " +"(see :attr:`module.__cached__`). The :term:`finder` should always set this " +"attribute but it may be ``None`` for modules that do not need compiled code " +"stored." msgstr "" -#: ../../library/importlib.rst:1206 +#: ../../library/importlib.rst:1224 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " "empty string for a top-level module). See :attr:`module.__package__`. If the " "module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1213 +#: ../../library/importlib.rst:1231 msgid "" "``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`!origin` is interpreted " "and how the module's :attr:`~module.__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1220 +#: ../../library/importlib.rst:1238 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1223 +#: ../../library/importlib.rst:1241 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1477,37 +1488,37 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1229 +#: ../../library/importlib.rst:1247 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " "individual standalone frameworks. To discover those frameworks, this loader " "is be registered against the ``.fwork`` file extension, with a ``.fwork`` " -"file acting as a placeholder in the original location of the binary on ``sys." -"path``. The ``.fwork`` file contains the path of the actual binary in the " -"``Frameworks`` folder, relative to the app bundle. To allow for resolving a " -"framework-packaged binary back to the original location, the framework is " -"expected to contain a ``.origin`` file that contains the location of the ``." -"fwork`` file, relative to the app bundle." +"file acting as a placeholder in the original location of the binary on " +"``sys.path``. The ``.fwork`` file contains the path of the actual binary in " +"the ``Frameworks`` folder, relative to the app bundle. To allow for " +"resolving a framework-packaged binary back to the original location, the " +"framework is expected to contain a ``.origin`` file that contains the " +"location of the ``.fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1240 +#: ../../library/importlib.rst:1258 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" -"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." -"path``, relative to the application bundle. This module *must* be " +"_whiz.abi3.so``, with ``sources`` being the location registered on " +"``sys.path``, relative to the application bundle. This module *must* be " "distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " "(creating the framework name from the full import path of the module), with " "an ``Info.plist`` file in the ``.framework`` directory identifying the " "binary as a framework. The ``foo.bar._whiz`` module would be represented in " "the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " "file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " -"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." -"_whiz.origin``, containing the path to the ``.fwork`` file." +"framework would also contain ``Frameworks/foo.bar._whiz.framework/" +"foo.bar._whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1254 +#: ../../library/importlib.rst:1272 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1516,7 +1527,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1260 +#: ../../library/importlib.rst:1278 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1527,45 +1538,45 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1270 +#: ../../library/importlib.rst:1288 msgid "Availability" msgstr "" -#: ../../library/importlib.rst:1278 +#: ../../library/importlib.rst:1296 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1282 +#: ../../library/importlib.rst:1300 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1288 +#: ../../library/importlib.rst:1306 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1292 +#: ../../library/importlib.rst:1310 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1297 +#: ../../library/importlib.rst:1315 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1304 +#: ../../library/importlib.rst:1322 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " "return value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python " -"3.2. The ``cpython-32`` string comes from the current magic tag (see :func:" -"`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined then :exc:" -"`NotImplementedError` will be raised)." +"3.2. The ``cpython-32`` string comes from the current magic tag " +"(see :func:`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined " +"then :exc:`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1311 +#: ../../library/importlib.rst:1329 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1573,12 +1584,12 @@ msgid "" "``/foo/bar/__pycache__/baz.cpython-32.pyc``. ``None`` causes the " "interpreter's optimization level to be used. Any other value's string " "representation is used, so ``/foo/bar/baz.py`` with an *optimization* of " -"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/baz." -"cpython-32.opt-2.pyc``. The string representation of *optimization* can only " -"be alphanumeric, else :exc:`ValueError` is raised." +"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/" +"baz.cpython-32.opt-2.pyc``. The string representation of *optimization* can " +"only be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1321 +#: ../../library/importlib.rst:1339 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1587,60 +1598,63 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1329 +#: ../../library/importlib.rst:1347 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1333 ../../library/importlib.rst:1349 -#: ../../library/importlib.rst:1438 +#: ../../library/importlib.rst:1351 ../../library/importlib.rst:1367 +#: ../../library/importlib.rst:1456 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1339 +#: ../../library/importlib.rst:1357 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " -"code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." -"cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " +"code file path. For example, if *path* is ``/foo/bar/__pycache__/" +"baz.cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " "need not exist, however if it does not conform to :pep:`3147` or :pep:`488` " -"format, a :exc:`ValueError` is raised. If :attr:`sys.implementation." -"cache_tag` is not defined, :exc:`NotImplementedError` is raised." +"format, a :exc:`ValueError` is raised. " +"If :attr:`sys.implementation.cache_tag` is not " +"defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1354 +#: ../../library/importlib.rst:1372 msgid "" "Decode the given bytes representing source code and return it as a string " -"with universal newlines (as required by :meth:`importlib.abc.InspectLoader." -"get_source`)." +"with universal newlines (as required " +"by :meth:`importlib.abc.InspectLoader.get_source`)." msgstr "" -#: ../../library/importlib.rst:1362 +#: ../../library/importlib.rst:1380 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1364 +#: ../../library/importlib.rst:1382 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " -"allows for usage such as ``importlib.util.resolve_name('sys', __spec__." -"parent)`` without doing a check to see if the **package** argument is needed." +"allows for usage such as ``importlib.util.resolve_name('sys', " +"__spec__.parent)`` without doing a check to see if the **package** argument " +"is needed." msgstr "" -#: ../../library/importlib.rst:1369 +#: ../../library/importlib.rst:1387 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " -"**package** is a false value (e.g. ``None`` or the empty string). :exc:" -"`ImportError` is also raised if a relative name would escape its containing " -"package (e.g. requesting ``..bacon`` from within the ``spam`` package)." +"**package** is a false value (e.g. ``None`` or the empty " +"string). :exc:`ImportError` is also raised if a relative name would escape " +"its containing package (e.g. requesting ``..bacon`` from within the ``spam`` " +"package)." msgstr "" -#: ../../library/importlib.rst:1377 +#: ../../library/importlib.rst:1395 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1384 +#: ../../library/importlib.rst:1402 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1650,30 +1664,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1391 +#: ../../library/importlib.rst:1409 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1394 +#: ../../library/importlib.rst:1412 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1398 +#: ../../library/importlib.rst:1416 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`~module.__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1405 +#: ../../library/importlib.rst:1423 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1408 +#: ../../library/importlib.rst:1426 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1681,23 +1695,23 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1413 +#: ../../library/importlib.rst:1431 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1421 +#: ../../library/importlib.rst:1439 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " -"for ModuleSpec. The function uses available :term:`loader` APIs, such as :" -"meth:`InspectLoader.is_package`, to fill in any missing information on the " -"spec." +"for ModuleSpec. The function uses available :term:`loader` APIs, such " +"as :meth:`InspectLoader.is_package`, to fill in any missing information on " +"the spec." msgstr "" -#: ../../library/importlib.rst:1431 +#: ../../library/importlib.rst:1449 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1705,14 +1719,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1443 +#: ../../library/importlib.rst:1461 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1451 +#: ../../library/importlib.rst:1469 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1721,46 +1735,49 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1458 +#: ../../library/importlib.rst:1476 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1462 +#: ../../library/importlib.rst:1480 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" +"你可以透過實作多階段初始化的基本介面 (:pep:`489`) 並假稱有多個直譯器(或直譯" +"器各別持有的 GIL)的支援,來達到與此函式相同的效果。" -#: ../../library/importlib.rst:1467 +#: ../../library/importlib.rst:1485 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1475 +#: ../../library/importlib.rst:1493 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1478 +#: ../../library/importlib.rst:1496 msgid "" -"This class **only** works with loaders that define :meth:`~importlib.abc." -"Loader.exec_module` as control over what module type is used for the module " -"is required. For those same reasons, the loader's :meth:`~importlib.abc." -"Loader.create_module` method must return ``None`` or a type for which its " -"``__class__`` attribute can be mutated along with not using :term:`slots " -"<__slots__>`. Finally, modules which substitute the object placed into :data:" -"`sys.modules` will not work as there is no way to properly replace the " -"module references throughout the interpreter safely; :exc:`ValueError` is " -"raised if such a substitution is detected." +"This class **only** works with loaders that " +"define :meth:`~importlib.abc.Loader.exec_module` as control over what module " +"type is used for the module is required. For those same reasons, the " +"loader's :meth:`~importlib.abc.Loader.create_module` method must return " +"``None`` or a type for which its ``__class__`` attribute can be mutated " +"along with not using :term:`slots <__slots__>`. Finally, modules which " +"substitute the object placed into :data:`sys.modules` will not work as there " +"is no way to properly replace the module references throughout the " +"interpreter safely; :exc:`ValueError` is raised if such a substitution is " +"detected." msgstr "" -#: ../../library/importlib.rst:1489 +#: ../../library/importlib.rst:1507 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1769,21 +1786,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1497 +#: ../../library/importlib.rst:1515 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " -"compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" -"class:`importlib.machinery.ExtensionFileLoader`." +"compatibility warning for :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1504 +#: ../../library/importlib.rst:1522 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1509 +#: ../../library/importlib.rst:1527 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1795,20 +1812,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1517 +#: ../../library/importlib.rst:1535 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1520 +#: ../../library/importlib.rst:1538 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1522 +#: ../../library/importlib.rst:1540 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1525 +#: ../../library/importlib.rst:1543 msgid "" "import importlib\n" "\n" @@ -1818,23 +1835,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1531 +#: ../../library/importlib.rst:1549 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1533 +#: ../../library/importlib.rst:1551 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1536 +#: ../../library/importlib.rst:1554 msgid "" -"Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." -"find_spec` will import the parent module. ::" +"Note that if ``name`` is a submodule (contains a " +"dot), :func:`importlib.util.find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1540 +#: ../../library/importlib.rst:1558 msgid "" "import importlib.util\n" "import sys\n" @@ -1854,27 +1871,27 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1559 +#: ../../library/importlib.rst:1577 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1561 +#: ../../library/importlib.rst:1579 msgid "" "This recipe should be used with caution: it is an approximation of an import " -"statement where the file path is specified directly, rather than :data:`sys." -"path` being searched. Alternatives should first be considered first, such as " -"modifying :data:`sys.path` when a proper module is required, or using :func:" -"`runpy.run_path` when the global namespace resulting from running a Python " -"file is appropriate." +"statement where the file path is specified directly, rather " +"than :data:`sys.path` being searched. Alternatives should first be " +"considered first, such as modifying :data:`sys.path` when a proper module is " +"required, or using :func:`runpy.run_path` when the global namespace " +"resulting from running a Python file is appropriate." msgstr "" -#: ../../library/importlib.rst:1568 +#: ../../library/importlib.rst:1586 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1570 +#: ../../library/importlib.rst:1588 msgid "" "import importlib.util\n" "import sys\n" @@ -1897,15 +1914,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1592 +#: ../../library/importlib.rst:1610 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1594 +#: ../../library/importlib.rst:1612 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1596 +#: ../../library/importlib.rst:1614 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1925,25 +1942,26 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1615 +#: ../../library/importlib.rst:1633 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1617 +#: ../../library/importlib.rst:1635 msgid "" -"For deep customizations of import, you typically want to implement an :term:" -"`importer`. This means managing both the :term:`finder` and :term:`loader` " -"side of things. For finders there are two flavours to choose from depending " -"on your needs: a :term:`meta path finder` or a :term:`path entry finder`. " -"The former is what you would put on :data:`sys.meta_path` while the latter " -"is what you create using a :term:`path entry hook` on :data:`sys.path_hooks` " -"which works with :data:`sys.path` entries to potentially create a finder. " -"This example will show you how to register your own importers so that import " -"will use them (for creating an importer for yourself, read the documentation " -"for the appropriate classes defined within this package)::" +"For deep customizations of import, you typically want to implement " +"an :term:`importer`. This means managing both the :term:`finder` " +"and :term:`loader` side of things. For finders there are two flavours to " +"choose from depending on your needs: a :term:`meta path finder` or " +"a :term:`path entry finder`. The former is what you would put " +"on :data:`sys.meta_path` while the latter is what you create using " +"a :term:`path entry hook` on :data:`sys.path_hooks` which works " +"with :data:`sys.path` entries to potentially create a finder. This example " +"will show you how to register your own importers so that import will use " +"them (for creating an importer for yourself, read the documentation for the " +"appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1628 +#: ../../library/importlib.rst:1646 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1967,11 +1985,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1649 +#: ../../library/importlib.rst:1667 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1651 +#: ../../library/importlib.rst:1669 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -1979,7 +1997,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1657 +#: ../../library/importlib.rst:1675 msgid "" "import importlib.util\n" "import sys\n" @@ -2012,11 +2030,11 @@ msgid "" " return module" msgstr "" -#: ../../library/importlib.rst:422 +#: ../../library/importlib.rst:425 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/importlib.rst:422 +#: ../../library/importlib.rst:425 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po index f000c0ec12..0f8fe4133b 100644 --- a/library/importlib.resources.abc.po +++ b/library/importlib.resources.abc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,33 +69,33 @@ msgstr "" msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.resources.abc.rst:51 +#: ../../library/importlib.resources.abc.rst:52 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.resources.abc.rst:54 +#: ../../library/importlib.resources.abc.rst:55 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.resources.abc.rst:59 +#: ../../library/importlib.resources.abc.rst:61 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.resources.abc.rst:61 +#: ../../library/importlib.resources.abc.rst:63 msgid "" "If the resource does not concretely exist on the file system, raise :exc:" "`FileNotFoundError`." msgstr "" -#: ../../library/importlib.resources.abc.rst:66 +#: ../../library/importlib.resources.abc.rst:69 msgid "" "Returns ``True`` if the named *name* is considered a resource. :exc:" "`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.resources.abc.rst:71 +#: ../../library/importlib.resources.abc.rst:75 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " @@ -103,7 +103,7 @@ msgid "" "`is_resource` would be false." msgstr "" -#: ../../library/importlib.resources.abc.rst:77 +#: ../../library/importlib.resources.abc.rst:81 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -112,52 +112,52 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.resources.abc.rst:85 +#: ../../library/importlib.resources.abc.rst:89 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.resources.abc.rst:90 +#: ../../library/importlib.resources.abc.rst:94 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.resources.abc.rst:93 +#: ../../library/importlib.resources.abc.rst:97 msgid "" "For a representation of the object on the file-system, use :meth:`importlib." "resources.as_file`." msgstr "" -#: ../../library/importlib.resources.abc.rst:98 +#: ../../library/importlib.resources.abc.rst:102 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.resources.abc.rst:102 +#: ../../library/importlib.resources.abc.rst:107 msgid "Yield Traversable objects in self." msgstr "" -#: ../../library/importlib.resources.abc.rst:106 +#: ../../library/importlib.resources.abc.rst:112 msgid "Return ``True`` if self is a directory." msgstr "" -#: ../../library/importlib.resources.abc.rst:110 +#: ../../library/importlib.resources.abc.rst:117 msgid "Return ``True`` if self is a file." msgstr "" -#: ../../library/importlib.resources.abc.rst:114 +#: ../../library/importlib.resources.abc.rst:122 msgid "" "Traverse directories according to *pathsegments* and return the result as :" "class:`!Traversable`." msgstr "" -#: ../../library/importlib.resources.abc.rst:117 +#: ../../library/importlib.resources.abc.rst:125 msgid "" "Each *pathsegments* argument may contain multiple names separated by forward " "slashes (``/``, ``posixpath.sep`` ). For example, the following are " "equivalent::" msgstr "" -#: ../../library/importlib.resources.abc.rst:121 +#: ../../library/importlib.resources.abc.rst:129 msgid "" "files.joinpath('subdir', 'subsuddir', 'file.txt')\n" "files.joinpath('subdir/subsuddir/file.txt')" @@ -165,7 +165,7 @@ msgstr "" "files.joinpath('subdir', 'subsuddir', 'file.txt')\n" "files.joinpath('subdir/subsuddir/file.txt')" -#: ../../library/importlib.resources.abc.rst:124 +#: ../../library/importlib.resources.abc.rst:132 msgid "" "Note that some :class:`!Traversable` implementations might not be updated to " "the latest version of the protocol. For compatibility with such " @@ -173,42 +173,42 @@ msgid "" "call to ``joinpath``. For example::" msgstr "" -#: ../../library/importlib.resources.abc.rst:129 +#: ../../library/importlib.resources.abc.rst:137 msgid "files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')" msgstr "files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')" -#: ../../library/importlib.resources.abc.rst:133 +#: ../../library/importlib.resources.abc.rst:141 msgid "" "``joinpath`` accepts multiple *pathsegments*, and these segments may contain " "forward slashes as path separators. Previously, only a single *child* " "argument was accepted." msgstr "" -#: ../../library/importlib.resources.abc.rst:139 +#: ../../library/importlib.resources.abc.rst:148 msgid "Return Traversable child in self. Equivalent to ``joinpath(child)``." msgstr "" -#: ../../library/importlib.resources.abc.rst:144 +#: ../../library/importlib.resources.abc.rst:154 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.resources.abc.rst:147 +#: ../../library/importlib.resources.abc.rst:157 msgid "" "When opening as text, accepts encoding parameters such as those accepted by :" "class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.resources.abc.rst:152 +#: ../../library/importlib.resources.abc.rst:162 msgid "Read contents of self as bytes." msgstr "" -#: ../../library/importlib.resources.abc.rst:156 +#: ../../library/importlib.resources.abc.rst:166 msgid "Read contents of self as text." msgstr "" -#: ../../library/importlib.resources.abc.rst:161 +#: ../../library/importlib.resources.abc.rst:171 msgid "" "An abstract base class for resource readers capable of serving the :meth:" "`importlib.resources.files` interface. Subclasses :class:`ResourceReader` " @@ -217,13 +217,13 @@ msgid "" "TraversableResources` also supplies :class:`!ResourceReader`." msgstr "" -#: ../../library/importlib.resources.abc.rst:168 +#: ../../library/importlib.resources.abc.rst:178 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.resources.abc.rst:173 +#: ../../library/importlib.resources.abc.rst:184 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." diff --git a/library/index.po b/library/index.po index 35406943a5..45c84d8fd6 100644 --- a/library/index.po +++ b/library/index.po @@ -1,10 +1,8 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2015-2016 -# Liang-Bo Wang , 2016 # Frank Jheng , 2015 # Steven Hsu , 2021 msgid "" diff --git a/library/io.po b/library/io.po index feecd18d50..d248520927 100644 --- a/library/io.po +++ b/library/io.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-05-04 00:16+0000\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -77,7 +77,7 @@ msgstr "" "原本會引發 :exc:`IOError` 的操作,現在將改成引發 :exc:`OSError`。因為 :exc:" "`IOError` 現在是 :exc:`OSError` 的別名。" -#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1149 +#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1150 msgid "Text I/O" msgstr "文字 I/O" @@ -118,7 +118,7 @@ msgid "" "`TextIOBase`." msgstr "文字資料串流 API 的詳細說明在 :class:`TextIOBase` 文件當中。" -#: ../../library/io.rst:72 ../../library/io.rst:1137 +#: ../../library/io.rst:72 ../../library/io.rst:1138 msgid "Binary I/O" msgstr "二進位 (Binary) I/O" @@ -345,7 +345,7 @@ msgid "" "This is a helper function for callables that use :func:`open` or :class:" "`TextIOWrapper` and have an ``encoding=None`` parameter." msgstr "" -"這是個輔助函數,適用於使用 :func:`open` 或 :class:`TextIOWrapper` 且具有 " +"這是個輔助函式,適用於使用 :func:`open` 或 :class:`TextIOWrapper` 且具有 " "``encoding=None`` 參數的可呼叫物件。" #: ../../library/io.rst:203 @@ -812,7 +812,7 @@ msgid "" "additional bytes are zero-filled). The new file size is returned." msgstr "" "將串流的大小調整為指定的 *size* 位元組(如果沒有指定 *size*,則調整為目前位" -"置)。目前串流位置不會改變。這種調整可以擴展或縮減當前檔案大小。在擴展的情況" +"置)。目前串流位置不會改變。這種調整可以擴展或縮減目前檔案大小。在擴展的情況" "下,新檔案區域的內容取決於平台(在大多數系統上,額外的位元組會被填充為零)。" "回傳新的檔案大小。" @@ -1029,7 +1029,7 @@ msgid "" "A :exc:`BlockingIOError` is raised if the underlying raw stream is in non " "blocking-mode, and has no data available at the moment." msgstr "" -"如果底層原始串流處於非阻塞模式,且當前沒有可用資料,則會引發 :exc:" +"如果底層原始串流處於非阻塞模式,且目前沒有可用資料,則會引發 :exc:" "`BlockingIOError`。" #: ../../library/io.rst:580 @@ -1552,12 +1552,13 @@ msgstr "" #: ../../library/io.rst:952 msgid "" "*encoding* gives the name of the encoding that the stream will be decoded or " -"encoded with. It defaults to :func:`locale.getencoding`. " +"encoded with. In :ref:`UTF-8 Mode `, this defaults to UTF-8. " +"Otherwise, it defaults to :func:`locale.getencoding`. " "``encoding=\"locale\"`` can be used to specify the current locale's encoding " "explicitly. See :ref:`io-text-encoding` for more information." msgstr "" -#: ../../library/io.rst:957 +#: ../../library/io.rst:958 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError` " @@ -1572,13 +1573,13 @@ msgid "" "that has been registered with :func:`codecs.register_error` is also valid." msgstr "" -#: ../../library/io.rst:973 +#: ../../library/io.rst:974 msgid "" "*newline* controls how line endings are handled. It can be ``None``, " "``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as follows:" msgstr "" -#: ../../library/io.rst:976 +#: ../../library/io.rst:977 msgid "" "When reading input from the stream, if *newline* is ``None``, :term:" "`universal newlines` mode is enabled. Lines in the input can end in " @@ -1590,7 +1591,7 @@ msgid "" "returned to the caller untranslated." msgstr "" -#: ../../library/io.rst:985 +#: ../../library/io.rst:986 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -1599,13 +1600,13 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/io.rst:991 +#: ../../library/io.rst:992 msgid "" "If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a " "call to write contains a newline character or a carriage return." msgstr "" -#: ../../library/io.rst:994 +#: ../../library/io.rst:995 msgid "" "If *write_through* is ``True``, calls to :meth:`~BufferedIOBase.write` are " "guaranteed not to be buffered: any data written on the :class:" @@ -1613,11 +1614,11 @@ msgid "" "*buffer*." msgstr "" -#: ../../library/io.rst:998 +#: ../../library/io.rst:999 msgid "The *write_through* argument has been added." msgstr "" -#: ../../library/io.rst:1001 +#: ../../library/io.rst:1002 msgid "" "The default *encoding* is now ``locale.getpreferredencoding(False)`` instead " "of ``locale.getpreferredencoding()``. Don't change temporary the locale " @@ -1625,108 +1626,108 @@ msgid "" "instead of the user preferred encoding." msgstr "" -#: ../../library/io.rst:1007 +#: ../../library/io.rst:1008 msgid "" "The *encoding* argument now supports the ``\"locale\"`` dummy encoding name." msgstr "" -#: ../../library/io.rst:1010 +#: ../../library/io.rst:1011 msgid "" ":class:`TextIOWrapper` provides these data attributes and methods in " "addition to those from :class:`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1015 +#: ../../library/io.rst:1016 msgid "Whether line buffering is enabled." msgstr "" -#: ../../library/io.rst:1019 +#: ../../library/io.rst:1020 msgid "Whether writes are passed immediately to the underlying binary buffer." msgstr "" -#: ../../library/io.rst:1027 +#: ../../library/io.rst:1028 msgid "" "Reconfigure this text stream using new settings for *encoding*, *errors*, " "*newline*, *line_buffering* and *write_through*." msgstr "" -#: ../../library/io.rst:1030 +#: ../../library/io.rst:1031 msgid "" "Parameters not specified keep current settings, except ``errors='strict'`` " "is used when *encoding* is specified but *errors* is not specified." msgstr "" -#: ../../library/io.rst:1034 +#: ../../library/io.rst:1035 msgid "" "It is not possible to change the encoding or newline if some data has " "already been read from the stream. On the other hand, changing encoding " "after write is possible." msgstr "" -#: ../../library/io.rst:1038 +#: ../../library/io.rst:1039 msgid "" "This method does an implicit stream flush before setting the new parameters." msgstr "" -#: ../../library/io.rst:1043 +#: ../../library/io.rst:1044 msgid "The method supports ``encoding=\"locale\"`` option." msgstr "" -#: ../../library/io.rst:1048 +#: ../../library/io.rst:1049 msgid "" "Set the stream position. Return the new stream position as an :class:`int`." msgstr "" -#: ../../library/io.rst:1051 +#: ../../library/io.rst:1052 msgid "" "Four operations are supported, given by the following argument combinations:" msgstr "" -#: ../../library/io.rst:1054 +#: ../../library/io.rst:1055 msgid "``seek(0, SEEK_SET)``: Rewind to the start of the stream." msgstr "" -#: ../../library/io.rst:1055 +#: ../../library/io.rst:1056 msgid "" "``seek(cookie, SEEK_SET)``: Restore a previous position; *cookie* **must " "be** a number returned by :meth:`tell`." msgstr "" -#: ../../library/io.rst:1057 +#: ../../library/io.rst:1058 msgid "``seek(0, SEEK_END)``: Fast-forward to the end of the stream." msgstr "" -#: ../../library/io.rst:1058 +#: ../../library/io.rst:1059 msgid "``seek(0, SEEK_CUR)``: Leave the current stream position unchanged." msgstr "" -#: ../../library/io.rst:1060 +#: ../../library/io.rst:1061 msgid "Any other argument combinations are invalid, and may raise exceptions." msgstr "" -#: ../../library/io.rst:1065 +#: ../../library/io.rst:1066 msgid ":data:`os.SEEK_SET`, :data:`os.SEEK_CUR`, and :data:`os.SEEK_END`." msgstr "" -#: ../../library/io.rst:1069 +#: ../../library/io.rst:1070 msgid "" "Return the stream position as an opaque number. The return value of :meth:`!" "tell` can be given as input to :meth:`seek`, to restore a previous stream " "position." msgstr "" -#: ../../library/io.rst:1076 +#: ../../library/io.rst:1077 msgid "" "A text stream using an in-memory text buffer. It inherits from :class:" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:1079 +#: ../../library/io.rst:1080 msgid "" "The text buffer is discarded when the :meth:`~IOBase.close` method is called." msgstr "" -#: ../../library/io.rst:1082 +#: ../../library/io.rst:1083 msgid "" "The initial value of the buffer can be set by providing *initial_value*. If " "newline translation is enabled, newlines will be encoded as if by :meth:" @@ -1738,31 +1739,31 @@ msgid "" "at the end of the buffer." msgstr "" -#: ../../library/io.rst:1091 +#: ../../library/io.rst:1092 msgid "" "The *newline* argument works like that of :class:`TextIOWrapper`, except " "that when writing output to the stream, if *newline* is ``None``, newlines " "are written as ``\\n`` on all platforms." msgstr "" -#: ../../library/io.rst:1095 +#: ../../library/io.rst:1096 msgid "" ":class:`StringIO` provides this method in addition to those from :class:" "`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1100 +#: ../../library/io.rst:1101 msgid "" "Return a :class:`str` containing the entire contents of the buffer. Newlines " "are decoded as if by :meth:`~TextIOBase.read`, although the stream position " "is not changed." msgstr "" -#: ../../library/io.rst:1104 +#: ../../library/io.rst:1105 msgid "Example usage::" msgstr "使用範例: ::" -#: ../../library/io.rst:1106 +#: ../../library/io.rst:1107 msgid "" "import io\n" "\n" @@ -1779,23 +1780,23 @@ msgid "" "output.close()" msgstr "" -#: ../../library/io.rst:1126 +#: ../../library/io.rst:1127 msgid "" "A helper codec that decodes newlines for :term:`universal newlines` mode. It " "inherits from :class:`codecs.IncrementalDecoder`." msgstr "" -#: ../../library/io.rst:1131 +#: ../../library/io.rst:1132 msgid "Performance" msgstr "" -#: ../../library/io.rst:1133 +#: ../../library/io.rst:1134 msgid "" "This section discusses the performance of the provided concrete I/O " "implementations." msgstr "" -#: ../../library/io.rst:1139 +#: ../../library/io.rst:1140 msgid "" "By reading and writing only large chunks of data even when the user asks for " "a single byte, buffered I/O hides any inefficiency in calling and executing " @@ -1808,7 +1809,7 @@ msgid "" "data." msgstr "" -#: ../../library/io.rst:1151 +#: ../../library/io.rst:1152 msgid "" "Text I/O over a binary storage (such as a file) is significantly slower than " "binary I/O over the same storage, because it requires conversions between " @@ -1818,24 +1819,24 @@ msgid "" "the reconstruction algorithm used." msgstr "" -#: ../../library/io.rst:1158 +#: ../../library/io.rst:1159 msgid "" ":class:`StringIO`, however, is a native in-memory unicode container and will " "exhibit similar speed to :class:`BytesIO`." msgstr "" -#: ../../library/io.rst:1162 +#: ../../library/io.rst:1163 msgid "Multi-threading" msgstr "" -#: ../../library/io.rst:1164 +#: ../../library/io.rst:1165 msgid "" ":class:`FileIO` objects are thread-safe to the extent that the operating " "system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-" "safe too." msgstr "" -#: ../../library/io.rst:1167 +#: ../../library/io.rst:1168 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) " @@ -1843,15 +1844,15 @@ msgid "" "them from multiple threads at once." msgstr "" -#: ../../library/io.rst:1172 +#: ../../library/io.rst:1173 msgid ":class:`TextIOWrapper` objects are not thread-safe." msgstr "" -#: ../../library/io.rst:1175 +#: ../../library/io.rst:1176 msgid "Reentrancy" msgstr "" -#: ../../library/io.rst:1177 +#: ../../library/io.rst:1178 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) are " @@ -1862,7 +1863,7 @@ msgid "" "from entering the buffered object." msgstr "" -#: ../../library/io.rst:1185 +#: ../../library/io.rst:1186 msgid "" "The above implicitly extends to text files, since the :func:`open` function " "will wrap a buffered object inside a :class:`TextIOWrapper`. This includes " @@ -1878,31 +1879,14 @@ msgstr "file object(檔案物件)" msgid "io module" msgstr "io 模組" -#: ../../library/io.rst:970 ../../library/io.rst:1121 +#: ../../library/io.rst:971 ../../library/io.rst:1122 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/io.rst:970 +#: ../../library/io.rst:971 msgid "io.TextIOWrapper class" msgstr "io.TextIOWrapper 類別" -#: ../../library/io.rst:1121 +#: ../../library/io.rst:1122 msgid "io.IncrementalNewlineDecoder class" msgstr "io.IncrementalNewlineDecoder 類別" - -#, fuzzy -#~ msgid "" -#~ "This function raises an auditing event open with arguments path, mode and " -#~ "flags. The mode and flags arguments may have been modified or inferred " -#~ "from the original call." -#~ msgstr "" -#~ "此函式會引發一個帶有引數 *path*、*mode* 以及 *flags* 的\\ :ref:`稽核事件 " -#~ "(auditing event) ` ``open``。*mode* 與 *flags* 引數可能已經被修" -#~ "改或者從原始呼叫中被推斷出來。" - -#~ msgid "" -#~ "Raises an :ref:`auditing event ` ``open`` with arguments " -#~ "``path``, ``mode``, ``flags``." -#~ msgstr "" -#~ "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " -#~ "` ``open``。" diff --git a/library/itertools.po b/library/itertools.po index b02809e1e2..5e949d15db 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,383 +55,371 @@ msgstr "" "f(1), ...``。在 Python 中,可以透過結合 :func:`map` 和 :func:`count` 組成 " "``map(f, count())`` 以達到同樣的效果。" -#: ../../library/itertools.rst:33 -msgid "" -"These tools and their built-in counterparts also work well with the high-" -"speed functions in the :mod:`operator` module. For example, the " -"multiplication operator can be mapped across two vectors to form an " -"efficient dot-product: ``sum(starmap(operator.mul, zip(vec1, vec2, " -"strict=True)))``." -msgstr "" -"這些工具及其內建的對等部分 (counterpart) 也可以很好地與 :mod:`operator` 模組" -"中的高速函式配合使用。例如,乘法運算子可以對映到兩個向量上以組成高效率的內" -"積:``sum(starmap(operator.mul, zip(vec1, vec2, strict=True)))``。" - -#: ../../library/itertools.rst:39 +#: ../../library/itertools.rst:34 msgid "**Infinite iterators:**" msgstr "**無限疊代器:**" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 -#: ../../library/itertools.rst:73 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 +#: ../../library/itertools.rst:68 msgid "Iterator" msgstr "疊代器" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 -#: ../../library/itertools.rst:73 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 +#: ../../library/itertools.rst:68 msgid "Arguments" msgstr "引數" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 -#: ../../library/itertools.rst:73 ../../library/itertools.rst:82 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 +#: ../../library/itertools.rst:68 ../../library/itertools.rst:77 msgid "Results" msgstr "結果" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 msgid "Example" msgstr "範例" -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid ":func:`count`" msgstr ":func:`count`" -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid "[start[, step]]" msgstr "[start[, step]]" -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid "start, start+step, start+2*step, ..." msgstr "start, start+step, start+2*step, ..." -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid "``count(10) → 10 11 12 13 14 ...``" msgstr "``count(10) → 10 11 12 13 14 ...``" -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid ":func:`cycle`" msgstr ":func:`cycle`" -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid "p" msgstr "p" -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid "p0, p1, ... plast, p0, p1, ..." msgstr "p0, p1, ... plast, p0, p1, ..." -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid "``cycle('ABCD') → A B C D A B C D ...``" msgstr "``cycle('ABCD') → A B C D A B C D ...``" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid ":func:`repeat`" msgstr ":func:`repeat`" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid "elem [,n]" msgstr "elem [,n]" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid "elem, elem, elem, ... endlessly or up to n times" msgstr "elem, elem, elem,... 重複無限次或 n 次" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid "``repeat(10, 3) → 10 10 10``" msgstr "``repeat(10, 3) → 10 10 10``" -#: ../../library/itertools.rst:49 +#: ../../library/itertools.rst:44 msgid "**Iterators terminating on the shortest input sequence:**" msgstr "**在最短輸入序列 (shortest input sequence) 處終止的疊代器:**" -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid ":func:`accumulate`" msgstr ":func:`accumulate`" -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid "p [,func]" msgstr "p [,func]" -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid "p0, p0+p1, p0+p1+p2, ..." msgstr "p0, p0+p1, p0+p1+p2, ..." -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid "``accumulate([1,2,3,4,5]) → 1 3 6 10 15``" msgstr "``accumulate([1,2,3,4,5]) → 1 3 6 10 15``" -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid ":func:`batched`" msgstr ":func:`batched`" -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid "p, n" msgstr "p, n" -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid "(p0, p1, ..., p_n-1), ..." msgstr "(p0, p1, ..., p_n-1), ..." -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid "``batched('ABCDEFG', n=3) → ABC DEF G``" msgstr "``batched('ABCDEFG', n=3) → ABC DEF G``" -#: ../../library/itertools.rst:56 +#: ../../library/itertools.rst:51 msgid ":func:`chain`" msgstr ":func:`chain`" -#: ../../library/itertools.rst:56 ../../library/itertools.rst:67 +#: ../../library/itertools.rst:51 ../../library/itertools.rst:62 msgid "p, q, ..." msgstr "p, q, ..." -#: ../../library/itertools.rst:56 ../../library/itertools.rst:57 +#: ../../library/itertools.rst:51 ../../library/itertools.rst:52 msgid "p0, p1, ... plast, q0, q1, ..." msgstr "p0, p1, ... plast, q0, q1, ..." -#: ../../library/itertools.rst:56 +#: ../../library/itertools.rst:51 msgid "``chain('ABC', 'DEF') → A B C D E F``" msgstr "``chain('ABC', 'DEF') → A B C D E F``" -#: ../../library/itertools.rst:57 +#: ../../library/itertools.rst:52 msgid ":func:`chain.from_iterable`" msgstr ":func:`chain.from_iterable`" -#: ../../library/itertools.rst:57 ../../library/itertools.rst:63 +#: ../../library/itertools.rst:52 ../../library/itertools.rst:58 msgid "iterable" msgstr "可疊代物件" -#: ../../library/itertools.rst:57 +#: ../../library/itertools.rst:52 msgid "``chain.from_iterable(['ABC', 'DEF']) → A B C D E F``" msgstr "``chain.from_iterable(['ABC', 'DEF']) → A B C D E F``" -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid ":func:`compress`" msgstr ":func:`compress`" -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid "data, selectors" msgstr "data, selectors" -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid "(d[0] if s[0]), (d[1] if s[1]), ..." msgstr "(d[0] if s[0]), (d[1] if s[1]), ..." -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid "``compress('ABCDEF', [1,0,1,0,1,1]) → A C E F``" msgstr "``compress('ABCDEF', [1,0,1,0,1,1]) → A C E F``" -#: ../../library/itertools.rst:59 +#: ../../library/itertools.rst:54 msgid ":func:`dropwhile`" msgstr ":func:`dropwhile`" -#: ../../library/itertools.rst:59 ../../library/itertools.rst:60 -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:54 ../../library/itertools.rst:55 +#: ../../library/itertools.rst:60 msgid "predicate, seq" msgstr "predicate, seq" -#: ../../library/itertools.rst:59 +#: ../../library/itertools.rst:54 msgid "seq[n], seq[n+1], starting when predicate fails" msgstr "seq[n], seq[n+1],當 predicate 失敗時開始" -#: ../../library/itertools.rst:59 +#: ../../library/itertools.rst:54 msgid "``dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8``" msgstr "``dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8``" -#: ../../library/itertools.rst:60 +#: ../../library/itertools.rst:55 msgid ":func:`filterfalse`" msgstr ":func:`filterfalse`" -#: ../../library/itertools.rst:60 +#: ../../library/itertools.rst:55 msgid "elements of seq where predicate(elem) fails" msgstr "當 predicate(elem) 失敗時 seq 的元素" -#: ../../library/itertools.rst:60 +#: ../../library/itertools.rst:55 msgid "``filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8``" msgstr "``filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8``" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid ":func:`groupby`" msgstr ":func:`groupby`" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid "iterable[, key]" msgstr "iterable[, key]" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid "sub-iterators grouped by value of key(v)" msgstr "根據 key(v) 的值分組的子疊代器" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid "``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)``" msgstr "``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)``" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid ":func:`islice`" msgstr ":func:`islice`" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid "seq, [start,] stop [, step]" msgstr "seq, [start,] stop [, step]" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid "elements from seq[start:stop:step]" msgstr "seq[start:stop:step] 的元素" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid "``islice('ABCDEFG', 2, None) → C D E F G``" msgstr "``islice('ABCDEFG', 2, None) → C D E F G``" -#: ../../library/itertools.rst:63 +#: ../../library/itertools.rst:58 msgid ":func:`pairwise`" msgstr ":func:`pairwise`" -#: ../../library/itertools.rst:63 +#: ../../library/itertools.rst:58 msgid "(p[0], p[1]), (p[1], p[2])" msgstr "(p[0], p[1]), (p[1], p[2])" -#: ../../library/itertools.rst:63 +#: ../../library/itertools.rst:58 msgid "``pairwise('ABCDEFG') → AB BC CD DE EF FG``" msgstr "``pairwise('ABCDEFG') → AB BC CD DE EF FG``" -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid ":func:`starmap`" msgstr ":func:`starmap`" -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid "func, seq" msgstr "func, seq" -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid "func(\\*seq[0]), func(\\*seq[1]), ..." msgstr "func(\\*seq[0]), func(\\*seq[1]), ..." -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid "``starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000``" msgstr "``starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000``" -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:60 msgid ":func:`takewhile`" msgstr ":func:`takewhile`" -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:60 msgid "seq[0], seq[1], until predicate fails" msgstr "seq[0], seq[1],直到 predicate 失敗" -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:60 msgid "``takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4``" msgstr "``takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4``" -#: ../../library/itertools.rst:66 +#: ../../library/itertools.rst:61 msgid ":func:`tee`" msgstr ":func:`tee`" -#: ../../library/itertools.rst:66 +#: ../../library/itertools.rst:61 msgid "it, n" msgstr "it, n" -#: ../../library/itertools.rst:66 +#: ../../library/itertools.rst:61 msgid "it1, it2, ... itn splits one iterator into n" msgstr "it1, it2, ... itn,將一個疊代器分成 n 個" -#: ../../library/itertools.rst:67 +#: ../../library/itertools.rst:62 msgid ":func:`zip_longest`" msgstr ":func:`zip_longest`" -#: ../../library/itertools.rst:67 +#: ../../library/itertools.rst:62 msgid "(p[0], q[0]), (p[1], q[1]), ..." msgstr "(p[0], q[0]), (p[1], q[1]), ..." -#: ../../library/itertools.rst:67 +#: ../../library/itertools.rst:62 msgid "``zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-``" msgstr "``zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-``" -#: ../../library/itertools.rst:70 +#: ../../library/itertools.rst:65 msgid "**Combinatoric iterators:**" msgstr "**組合疊代器:**" -#: ../../library/itertools.rst:75 +#: ../../library/itertools.rst:70 msgid ":func:`product`" msgstr ":func:`product`" -#: ../../library/itertools.rst:75 +#: ../../library/itertools.rst:70 msgid "p, q, ... [repeat=1]" msgstr "p, q, ... [repeat=1]" -#: ../../library/itertools.rst:75 +#: ../../library/itertools.rst:70 msgid "cartesian product, equivalent to a nested for-loop" msgstr "笛卡爾乘積 (cartesian product),相當於巢狀的 for 迴圈" -#: ../../library/itertools.rst:76 +#: ../../library/itertools.rst:71 msgid ":func:`permutations`" msgstr ":func:`permutations`" -#: ../../library/itertools.rst:76 +#: ../../library/itertools.rst:71 msgid "p[, r]" msgstr "p[, r]" -#: ../../library/itertools.rst:76 +#: ../../library/itertools.rst:71 msgid "r-length tuples, all possible orderings, no repeated elements" msgstr "長度為 r 的元組,所有可能的定序,無重複元素" -#: ../../library/itertools.rst:77 +#: ../../library/itertools.rst:72 msgid ":func:`combinations`" msgstr ":func:`combinations`" -#: ../../library/itertools.rst:77 ../../library/itertools.rst:78 +#: ../../library/itertools.rst:72 ../../library/itertools.rst:73 msgid "p, r" msgstr "p, r" -#: ../../library/itertools.rst:77 +#: ../../library/itertools.rst:72 msgid "r-length tuples, in sorted order, no repeated elements" msgstr "長度為 r 的元組,按照排序過後的定序,無重複元素" -#: ../../library/itertools.rst:78 +#: ../../library/itertools.rst:73 msgid ":func:`combinations_with_replacement`" msgstr ":func:`combinations_with_replacement`" -#: ../../library/itertools.rst:78 +#: ../../library/itertools.rst:73 msgid "r-length tuples, in sorted order, with repeated elements" msgstr "長度為 r 的元組,按照排序過後的定序,有重複元素" -#: ../../library/itertools.rst:82 +#: ../../library/itertools.rst:77 msgid "Examples" msgstr "範例" -#: ../../library/itertools.rst:84 +#: ../../library/itertools.rst:79 msgid "``product('ABCD', repeat=2)``" msgstr "``product('ABCD', repeat=2)``" -#: ../../library/itertools.rst:84 +#: ../../library/itertools.rst:79 msgid "``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``" msgstr "``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``" -#: ../../library/itertools.rst:85 +#: ../../library/itertools.rst:80 msgid "``permutations('ABCD', 2)``" msgstr "``permutations('ABCD', 2)``" -#: ../../library/itertools.rst:85 +#: ../../library/itertools.rst:80 msgid "``AB AC AD BA BC BD CA CB CD DA DB DC``" msgstr "``AB AC AD BA BC BD CA CB CD DA DB DC``" -#: ../../library/itertools.rst:86 +#: ../../library/itertools.rst:81 msgid "``combinations('ABCD', 2)``" msgstr "``combinations('ABCD', 2)``" -#: ../../library/itertools.rst:86 +#: ../../library/itertools.rst:81 msgid "``AB AC AD BC BD CD``" msgstr "``AB AC AD BC BD CD``" -#: ../../library/itertools.rst:87 +#: ../../library/itertools.rst:82 msgid "``combinations_with_replacement('ABCD', 2)``" msgstr "``combinations_with_replacement('ABCD', 2)``" -#: ../../library/itertools.rst:87 +#: ../../library/itertools.rst:82 msgid "``AA AB AC AD BB BC BD CC CD DD``" msgstr "``AA AB AC AD BB BC BD CC CD DD``" -#: ../../library/itertools.rst:94 +#: ../../library/itertools.rst:89 msgid "Itertool Functions" msgstr "Itertool 函式" -#: ../../library/itertools.rst:96 +#: ../../library/itertools.rst:91 msgid "" "The following functions all construct and return iterators. Some provide " "streams of infinite length, so they should only be accessed by functions or " @@ -440,13 +428,13 @@ msgstr "" "以下的函式都會建構並回傳疊代器。一些函式提供無限長度的串流 (stream),因此應僅" "由截斷串流的函式或迴圈來存取它們。" -#: ../../library/itertools.rst:103 +#: ../../library/itertools.rst:98 msgid "" "Make an iterator that returns accumulated sums or accumulated results from " "other binary functions." msgstr "建立一個回傳累積和的疊代器,或其他二進位函式的累積結果。" -#: ../../library/itertools.rst:106 +#: ../../library/itertools.rst:101 msgid "" "The *function* defaults to addition. The *function* should accept two " "arguments, an accumulated total and a value from the *iterable*." @@ -454,7 +442,7 @@ msgstr "" "*function* 預設為加法。*function* 應接受兩個引數,即累積總和和來自 " "*iterable* 的值。" -#: ../../library/itertools.rst:109 +#: ../../library/itertools.rst:104 msgid "" "If an *initial* value is provided, the accumulation will start with that " "value and the output will have one more element than the input iterable." @@ -462,15 +450,15 @@ msgstr "" "如果提供了 *initial* 值,則累積將從該值開始,並且輸出的元素數將比輸入的可疊代" "物件多一個。" -#: ../../library/itertools.rst:113 ../../library/itertools.rst:186 -#: ../../library/itertools.rst:245 ../../library/itertools.rst:288 -#: ../../library/itertools.rst:489 ../../library/itertools.rst:524 -#: ../../library/itertools.rst:561 ../../library/itertools.rst:637 -#: ../../library/itertools.rst:698 ../../library/itertools.rst:779 +#: ../../library/itertools.rst:108 ../../library/itertools.rst:181 +#: ../../library/itertools.rst:240 ../../library/itertools.rst:283 +#: ../../library/itertools.rst:484 ../../library/itertools.rst:519 +#: ../../library/itertools.rst:556 ../../library/itertools.rst:632 +#: ../../library/itertools.rst:693 ../../library/itertools.rst:774 msgid "Roughly equivalent to::" msgstr "大致等價於: ::" -#: ../../library/itertools.rst:115 +#: ../../library/itertools.rst:110 msgid "" "def accumulate(iterable, function=operator.add, *, initial=None):\n" " 'Return running totals'\n" @@ -492,7 +480,7 @@ msgid "" " yield total" msgstr "" -#: ../../library/itertools.rst:134 +#: ../../library/itertools.rst:129 msgid "" "To compute a running minimum, set *function* to :func:`min`. For a running " "maximum, set *function* to :func:`max`. Or for a running product, set " @@ -505,7 +493,7 @@ msgstr "" "也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) `_ :" -#: ../../library/itertools.rst:141 +#: ../../library/itertools.rst:136 msgid "" ">>> data = [3, 4, 6, 2, 1, 9, 0, 7, 5, 8]\n" ">>> list(accumulate(data, max)) # running maximum\n" @@ -519,35 +507,35 @@ msgid "" "[1000, 960, 918, 874, 828, 779, 728, 674, 618, 559, 497]" msgstr "" -#: ../../library/itertools.rst:154 +#: ../../library/itertools.rst:149 msgid "" "See :func:`functools.reduce` for a similar function that returns only the " "final accumulated value." msgstr "" "可參見 :func:`functools.reduce`,其是個類似的函式,但僅回傳最終的累積值。" -#: ../../library/itertools.rst:159 +#: ../../library/itertools.rst:154 msgid "Added the optional *function* parameter." msgstr "新增可選的 *function* 參數。" -#: ../../library/itertools.rst:162 +#: ../../library/itertools.rst:157 msgid "Added the optional *initial* parameter." msgstr "新增可選的 *initial* 參數。" -#: ../../library/itertools.rst:168 +#: ../../library/itertools.rst:163 msgid "" "Batch data from the *iterable* into tuples of length *n*. The last batch may " "be shorter than *n*." msgstr "" "將來自 *iterable* 的資料分批為長度為 *n* 的元組。最後一個批次可能比 *n* 短。" -#: ../../library/itertools.rst:171 +#: ../../library/itertools.rst:166 msgid "" "If *strict* is true, will raise a :exc:`ValueError` if the final batch is " "shorter than *n*." msgstr "" -#: ../../library/itertools.rst:174 +#: ../../library/itertools.rst:169 msgid "" "Loops over the input iterable and accumulates data into tuples up to size " "*n*. The input is consumed lazily, just enough to fill a batch. The result " @@ -558,7 +546,7 @@ msgstr "" "消耗 (consumed lazily) 的,會剛好足夠填充一批的資料。一旦批次填滿或輸入的可疊" "代物件耗盡,就會 yield 出結果:" -#: ../../library/itertools.rst:179 +#: ../../library/itertools.rst:174 msgid "" ">>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']\n" ">>> unflattened = list(batched(flattened_data, 2))\n" @@ -570,7 +558,7 @@ msgstr "" ">>> unflattened\n" "[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]" -#: ../../library/itertools.rst:188 +#: ../../library/itertools.rst:183 msgid "" "def batched(iterable, n, *, strict=False):\n" " # batched('ABCDEFG', 3) → ABC DEF G\n" @@ -592,11 +580,11 @@ msgstr "" " raise ValueError('batched(): incomplete batch')\n" " yield batch" -#: ../../library/itertools.rst:200 +#: ../../library/itertools.rst:195 msgid "Added the *strict* option." msgstr "新增 *strict* 選項。" -#: ../../library/itertools.rst:206 +#: ../../library/itertools.rst:201 msgid "" "Make an iterator that returns elements from the first iterable until it is " "exhausted, then proceeds to the next iterable, until all of the iterables " @@ -607,7 +595,7 @@ msgstr "" "代物件,直到所有可疊代物件都耗盡。這將多個資料來源結合為單一個疊代器。大致等" "價於: ::" -#: ../../library/itertools.rst:211 +#: ../../library/itertools.rst:206 msgid "" "def chain(*iterables):\n" " # chain('ABC', 'DEF') → A B C D E F\n" @@ -615,7 +603,7 @@ msgid "" " yield from iterable" msgstr "" -#: ../../library/itertools.rst:219 +#: ../../library/itertools.rst:214 msgid "" "Alternate constructor for :func:`chain`. Gets chained inputs from a single " "iterable argument that is evaluated lazily. Roughly equivalent to::" @@ -623,7 +611,7 @@ msgstr "" ":func:`chain` 的另一個建構函式。從單個可疊代的引數中得到鏈接的輸入,該引數是" "惰性計算的。大致等價於:" -#: ../../library/itertools.rst:222 +#: ../../library/itertools.rst:217 msgid "" "def from_iterable(iterables):\n" " # chain.from_iterable(['ABC', 'DEF']) → A B C D E F\n" @@ -635,11 +623,11 @@ msgstr "" " for iterable in iterables:\n" " yield from iterable" -#: ../../library/itertools.rst:230 +#: ../../library/itertools.rst:225 msgid "Return *r* length subsequences of elements from the input *iterable*." msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" -#: ../../library/itertools.rst:232 +#: ../../library/itertools.rst:227 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " "subsequences of the *iterable*. The length of the output is given by :func:" @@ -650,7 +638,7 @@ msgstr "" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" "``,當 ``r > n`` 時為零。" -#: ../../library/itertools.rst:237 +#: ../../library/itertools.rst:232 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the output " @@ -659,7 +647,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:241 +#: ../../library/itertools.rst:236 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within " @@ -668,7 +656,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則每" "個組合內將不會有重複的值。" -#: ../../library/itertools.rst:247 +#: ../../library/itertools.rst:242 msgid "" "def combinations(iterable, r):\n" " # combinations('ABCD', 2) → AB AC AD BC BD CD\n" @@ -693,14 +681,14 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:272 +#: ../../library/itertools.rst:267 msgid "" "Return *r* length subsequences of elements from the input *iterable* " "allowing individual elements to be repeated more than once." msgstr "" "回傳來自輸入 *iterable* 的長度為 *r* 的子序列,且允許個別元素重複多次。" -#: ../../library/itertools.rst:275 +#: ../../library/itertools.rst:270 msgid "" "The output is a subsequence of :func:`product` that keeps only entries that " "are subsequences (with possible repeated elements) of the *iterable*. The " @@ -711,7 +699,7 @@ msgstr "" "複元素)的條目。當 ``n > 0`` 時,回傳的子序列數量為 ``(n + r - 1)! / r! / (n " "- 1)!``。" -#: ../../library/itertools.rst:280 +#: ../../library/itertools.rst:275 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. if the input *iterable* is sorted, the output " @@ -720,7 +708,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:284 +#: ../../library/itertools.rst:279 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, the generated combinations will also be " @@ -729,7 +717,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,生成" "的組合也將是獨特的。" -#: ../../library/itertools.rst:290 +#: ../../library/itertools.rst:285 msgid "" "def combinations_with_replacement(iterable, r):\n" " # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC\n" @@ -751,7 +739,7 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:314 +#: ../../library/itertools.rst:309 msgid "" "Make an iterator that returns elements from *data* where the corresponding " "element in *selectors* is true. Stops when either the *data* or *selectors* " @@ -760,14 +748,14 @@ msgstr "" "建立一個疊代器,回傳 *data* 中對應 *selectors* 的元素為 true 的元素。當 " "*data* 或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::" -#: ../../library/itertools.rst:319 +#: ../../library/itertools.rst:314 msgid "" "def compress(data, selectors):\n" " # compress('ABCDEF', [1,0,1,0,1,1]) → A C E F\n" " return (datum for datum, selector in zip(data, selectors) if selector)" msgstr "" -#: ../../library/itertools.rst:328 +#: ../../library/itertools.rst:323 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " "Can be used with :func:`map` to generate consecutive data points or with :" @@ -776,7 +764,7 @@ msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" -#: ../../library/itertools.rst:333 +#: ../../library/itertools.rst:328 msgid "" "def count(start=0, step=1):\n" " # count(10) → 10 11 12 13 14 ...\n" @@ -794,7 +782,7 @@ msgstr "" " yield n\n" " n += step" -#: ../../library/itertools.rst:341 +#: ../../library/itertools.rst:336 msgid "" "When counting with floating-point numbers, better accuracy can sometimes be " "achieved by substituting multiplicative code such as: ``(start + step * i " @@ -803,11 +791,11 @@ msgstr "" "當用浮點數計數時,將上述程式碼替換為乘法有時可以獲得更好的精確度,例如:" "``(start + step * i for i in count())``。" -#: ../../library/itertools.rst:345 +#: ../../library/itertools.rst:340 msgid "Added *step* argument and allowed non-integer arguments." msgstr "新增 *step* 引數並允許非整數引數。" -#: ../../library/itertools.rst:351 +#: ../../library/itertools.rst:346 msgid "" "Make an iterator returning elements from the *iterable* and saving a copy of " "each. When the iterable is exhausted, return elements from the saved copy. " @@ -816,7 +804,7 @@ msgstr "" "建立一個疊代器,回傳 *iterable* 中的元素並保存每個元素的副本。當可疊代物件耗" "盡時,從保存的副本中回傳元素。會無限次的重複。大致等價於: ::" -#: ../../library/itertools.rst:355 +#: ../../library/itertools.rst:350 msgid "" "def cycle(iterable):\n" " # cycle('ABCD') → A B C D A B C D A B C D ...\n" @@ -842,13 +830,13 @@ msgstr "" " for element in saved:\n" " yield element" -#: ../../library/itertools.rst:367 +#: ../../library/itertools.rst:362 msgid "" "This itertool may require significant auxiliary storage (depending on the " "length of the iterable)." msgstr "此 itertool 可能需要大量的輔助儲存空間(取決於可疊代物件的長度)。" -#: ../../library/itertools.rst:373 +#: ../../library/itertools.rst:368 msgid "" "Make an iterator that drops elements from the *iterable* while the " "*predicate* is true and afterwards returns every element. Roughly " @@ -857,7 +845,7 @@ msgstr "" "建立一個疊代器,在 *predicate* 為 true 時丟棄 *iterable* 中的元素,之後回傳每" "個元素。大致等價於:" -#: ../../library/itertools.rst:377 +#: ../../library/itertools.rst:372 msgid "" "def dropwhile(predicate, iterable):\n" " # dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8\n" @@ -883,7 +871,7 @@ msgstr "" " for x in iterator:\n" " yield x" -#: ../../library/itertools.rst:389 +#: ../../library/itertools.rst:384 msgid "" "Note this does not produce *any* output until the predicate first becomes " "false, so this itertool may have a lengthy start-up time." @@ -891,7 +879,7 @@ msgstr "" "注意,在 predicate 首次變為 False 之前,這不會產生\\ *任何*\\ 輸出,所以此 " "itertool 可能會有較長的啟動時間。" -#: ../../library/itertools.rst:395 +#: ../../library/itertools.rst:390 msgid "" "Make an iterator that filters elements from the *iterable* returning only " "those for which the *predicate* returns a false value. If *predicate* is " @@ -900,7 +888,7 @@ msgstr "" "建立一個疊代器,過濾 *iterable* 中的元素,僅回傳 *predicate* 為 False 值的元" "素。如果 *predicate* 是 ``None``,則回傳為 False 的項目。大致等價於: ::" -#: ../../library/itertools.rst:400 +#: ../../library/itertools.rst:395 msgid "" "def filterfalse(predicate, iterable):\n" " # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8\n" @@ -922,7 +910,7 @@ msgstr "" " if not predicate(x):\n" " yield x" -#: ../../library/itertools.rst:413 +#: ../../library/itertools.rst:408 msgid "" "Make an iterator that returns consecutive keys and groups from the " "*iterable*. The *key* is a function computing a key value for each element. " @@ -935,7 +923,7 @@ msgstr "" "(identity function),並回傳未被更改的元素。一般來說,可疊代物件需要已經用相同" "的鍵函式進行排序。" -#: ../../library/itertools.rst:419 +#: ../../library/itertools.rst:414 msgid "" "The operation of :func:`groupby` is similar to the ``uniq`` filter in Unix. " "It generates a break or new group every time the value of the key function " @@ -948,7 +936,7 @@ msgstr "" "料進行排序)。這種行為不同於 SQL 的 GROUP BY,其無論輸入順序如何都會聚合相同" "的元素。" -#: ../../library/itertools.rst:425 +#: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " "with :func:`groupby`. Because the source is shared, when the :func:" @@ -959,7 +947,7 @@ msgstr "" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" "要該資料,應將其儲存為串列: ::" -#: ../../library/itertools.rst:430 +#: ../../library/itertools.rst:425 msgid "" "groups = []\n" "uniquekeys = []\n" @@ -969,11 +957,11 @@ msgid "" " uniquekeys.append(k)" msgstr "" -#: ../../library/itertools.rst:437 +#: ../../library/itertools.rst:432 msgid ":func:`groupby` is roughly equivalent to::" msgstr ":func:`groupby` 大致等價於: ::" -#: ../../library/itertools.rst:439 +#: ../../library/itertools.rst:434 msgid "" "def groupby(iterable, key=None):\n" " # [k for k, g in groupby('AAAABBBCCDAABBB')] → A B C D A B\n" @@ -1039,7 +1027,7 @@ msgstr "" " for _ in curr_group:\n" " pass" -#: ../../library/itertools.rst:475 +#: ../../library/itertools.rst:470 msgid "" "Make an iterator that returns selected elements from the iterable. Works " "like sequence slicing but does not support negative values for *start*, " @@ -1048,7 +1036,7 @@ msgstr "" "建立一個疊代器,回傳從 iterable 中選取的元素。其作用類似於序列切片 (sequence " "slicing),但不支援負數的 *start*、*stop* 或 *step* 的值。" -#: ../../library/itertools.rst:479 +#: ../../library/itertools.rst:474 msgid "" "If *start* is zero or ``None``, iteration starts at zero. Otherwise, " "elements from the iterable are skipped until *start* is reached." @@ -1056,7 +1044,7 @@ msgstr "" "如果 *start* 為零或 ``None``,則從零開始疊代。否則在達到 *start* 之前,會跳" "過 iterable 中的元素。" -#: ../../library/itertools.rst:482 +#: ../../library/itertools.rst:477 msgid "" "If *stop* is ``None``, iteration continues until the input is exhausted, if " "at all. Otherwise, it stops at the specified position." @@ -1064,7 +1052,7 @@ msgstr "" "如果 *stop* 為 ``None``,則疊代將繼續前進直到輸入耗盡。如果指定了 *stop*,則" "在達到指定位置時停止。" -#: ../../library/itertools.rst:485 +#: ../../library/itertools.rst:480 msgid "" "If *step* is ``None``, the step defaults to one. Elements are returned " "consecutively unless *step* is set higher than one which results in items " @@ -1073,7 +1061,7 @@ msgstr "" "如果 *step* 為 ``None``,則步長 (step) 預設為一。元素會連續回傳,除非將 " "*step* 設定為大於一,這會導致一些項目被跳過。" -#: ../../library/itertools.rst:491 +#: ../../library/itertools.rst:486 msgid "" "def islice(iterable, *args):\n" " # islice('ABCDEFG', 2) → A B\n" @@ -1115,17 +1103,17 @@ msgstr "" " yield element\n" " next_i += step" -#: ../../library/itertools.rst:511 +#: ../../library/itertools.rst:506 msgid "" "If the input is an iterator, then fully consuming the *islice* advances the " "input iterator by ``max(start, stop)`` steps regardless of the *step* value." msgstr "" -#: ../../library/itertools.rst:518 +#: ../../library/itertools.rst:513 msgid "Return successive overlapping pairs taken from the input *iterable*." msgstr "回傳從輸入的 *iterable* 中提取的連續重疊對。" -#: ../../library/itertools.rst:520 +#: ../../library/itertools.rst:515 msgid "" "The number of 2-tuples in the output iterator will be one fewer than the " "number of inputs. It will be empty if the input iterable has fewer than two " @@ -1134,7 +1122,7 @@ msgstr "" "輸出疊代器中的 2 元組數量將比輸入少一個。如果輸入的可疊代物件中的值少於兩個," "則輸出將為空值。" -#: ../../library/itertools.rst:526 +#: ../../library/itertools.rst:521 msgid "" "def pairwise(iterable):\n" " # pairwise('ABCDEFG') → AB BC CD DE EF FG\n" @@ -1156,7 +1144,7 @@ msgstr "" " yield a, b\n" " a = b" -#: ../../library/itertools.rst:541 +#: ../../library/itertools.rst:536 msgid "" "Return successive *r* length `permutations of elements `_ from the *iterable*." @@ -1164,7 +1152,7 @@ msgstr "" "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" -#: ../../library/itertools.rst:544 +#: ../../library/itertools.rst:539 msgid "" "If *r* is not specified or is ``None``, then *r* defaults to the length of " "the *iterable* and all possible full-length permutations are generated." @@ -1172,7 +1160,7 @@ msgstr "" "如果未指定 *r* 或其值為 ``None``,則 *r* 預設為 *iterable* 的長度,並產生所有" "可能的完整長度的排列。" -#: ../../library/itertools.rst:548 +#: ../../library/itertools.rst:543 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " "elements have been filtered out. The length of the output is given by :func:" @@ -1183,7 +1171,7 @@ msgstr "" "func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " "> n`` 時為零。" -#: ../../library/itertools.rst:553 +#: ../../library/itertools.rst:548 msgid "" "The permutation tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the " @@ -1192,7 +1180,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,排列的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:557 +#: ../../library/itertools.rst:552 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within a " @@ -1201,7 +1189,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則排" "列中將不會有重複的值。" -#: ../../library/itertools.rst:563 +#: ../../library/itertools.rst:558 msgid "" "def permutations(iterable, r=None):\n" " # permutations('ABCD', 2) → AB AC AD BA BC BD CA CB CD DA DB DC\n" @@ -1259,13 +1247,13 @@ msgstr "" " else:\n" " return" -#: ../../library/itertools.rst:594 +#: ../../library/itertools.rst:589 msgid "" "`Cartesian product `_ of " "the input iterables." msgstr "" -#: ../../library/itertools.rst:597 +#: ../../library/itertools.rst:592 msgid "" "Roughly equivalent to nested for-loops in a generator expression. For " "example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in " @@ -1274,7 +1262,7 @@ msgstr "" "大致等價於產生器運算式中的巢狀 for 迴圈。例如,``product(A, B)`` 的回傳結果" "與 ``((x,y) for x in A for y in B)`` 相同。" -#: ../../library/itertools.rst:600 +#: ../../library/itertools.rst:595 msgid "" "The nested loops cycle like an odometer with the rightmost element advancing " "on every iteration. This pattern creates a lexicographic ordering so that " @@ -1284,7 +1272,7 @@ msgstr "" "巢狀迴圈的循環類似於里程表,最右邊的元素在每次疊代時前進。這種模式會建立字典" "順序,因此如果輸入的 iterables 已排序,則輸出的乘積元組也將按排序的順序產生。" -#: ../../library/itertools.rst:605 +#: ../../library/itertools.rst:600 msgid "" "To compute the product of an iterable with itself, specify the number of " "repetitions with the optional *repeat* keyword argument. For example, " @@ -1293,7 +1281,7 @@ msgstr "" "要計算可疊代物件自身的乘積,可以使用可選的 *repeat* 關鍵字引數來指定重複次" "數。例如,``product(A, repeat=4)`` 與 ``product(A, A, A, A)`` 相同。" -#: ../../library/itertools.rst:609 +#: ../../library/itertools.rst:604 msgid "" "This function is roughly equivalent to the following code, except that the " "actual implementation does not build up intermediate results in memory::" @@ -1301,7 +1289,7 @@ msgstr "" "此函式大致等價於以下的程式碼,不同之處在於真正的實作不會在記憶體中建立中間結" "果: ::" -#: ../../library/itertools.rst:612 +#: ../../library/itertools.rst:607 msgid "" "def product(*iterables, repeat=1):\n" " # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy\n" @@ -1333,7 +1321,7 @@ msgstr "" " for prod in result:\n" " yield tuple(prod)" -#: ../../library/itertools.rst:627 +#: ../../library/itertools.rst:622 msgid "" "Before :func:`product` runs, it completely consumes the input iterables, " "keeping pools of values in memory to generate the products. Accordingly, it " @@ -1342,7 +1330,7 @@ msgstr "" "在 :func:`product` 執行之前,它會完全消耗輸入的 iterables,並將值的池 (pools " "of values) 保存在記憶體中以產生乘積。因此,它僅對有限的輸入有用。" -#: ../../library/itertools.rst:634 +#: ../../library/itertools.rst:629 msgid "" "Make an iterator that returns *object* over and over again. Runs " "indefinitely unless the *times* argument is specified." @@ -1350,7 +1338,7 @@ msgstr "" "建立一個疊代器,反覆回傳 *object*。除非指定了 *times* 引數,否則會執行無限" "次。" -#: ../../library/itertools.rst:639 +#: ../../library/itertools.rst:634 msgid "" "def repeat(object, times=None):\n" " # repeat(10, 3) → 10 10 10\n" @@ -1370,13 +1358,13 @@ msgstr "" " for i in range(times):\n" " yield object" -#: ../../library/itertools.rst:648 +#: ../../library/itertools.rst:643 msgid "" "A common use for *repeat* is to supply a stream of constant values to *map* " "or *zip*:" msgstr "*repeat* 的常見用途是為 *map* 或 *zip* 提供定值的串流:" -#: ../../library/itertools.rst:651 +#: ../../library/itertools.rst:646 msgid "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" @@ -1384,16 +1372,16 @@ msgstr "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" -#: ../../library/itertools.rst:659 +#: ../../library/itertools.rst:654 msgid "" "Make an iterator that computes the *function* using arguments obtained from " "the *iterable*. Used instead of :func:`map` when argument parameters have " "already been \"pre-zipped\" into tuples." msgstr "" -"建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經" +"建立一個疊代器,使用從 *iterable* 取得的引數計算 *function* 。當引數參數已經" "被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。" -#: ../../library/itertools.rst:663 +#: ../../library/itertools.rst:658 msgid "" "The difference between :func:`map` and :func:`starmap` parallels the " "distinction between ``function(a,b)`` and ``function(*c)``. Roughly " @@ -1402,7 +1390,7 @@ msgstr "" ":func:`map` 和 :func:`starmap` 之間的區別類似於 ``function(a,b)`` 和 " "``function(*c)`` 之間的區別。大致等價於:" -#: ../../library/itertools.rst:667 +#: ../../library/itertools.rst:662 msgid "" "def starmap(function, iterable):\n" " # starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000\n" @@ -1414,7 +1402,7 @@ msgstr "" " for args in iterable:\n" " yield function(*args)" -#: ../../library/itertools.rst:675 +#: ../../library/itertools.rst:670 msgid "" "Make an iterator that returns elements from the *iterable* as long as the " "*predicate* is true. Roughly equivalent to::" @@ -1422,7 +1410,7 @@ msgstr "" "建立一個疊代器,只在 *predicate* 為 true 時回傳 *iterable* 中的元素。大致等價" "於:" -#: ../../library/itertools.rst:678 +#: ../../library/itertools.rst:673 msgid "" "def takewhile(predicate, iterable):\n" " # takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4\n" @@ -1438,13 +1426,13 @@ msgstr "" " break\n" " yield x" -#: ../../library/itertools.rst:685 +#: ../../library/itertools.rst:680 msgid "" "Note, the element that first fails the predicate condition is consumed from " "the input iterator and there is no way to access it. This could be an issue " "if an application wants to further consume the input iterator after " "*takewhile* has been run to exhaustion. To work around this problem, " -"consider using `more-iterools before_and_after() `_ instead." msgstr "" "注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果" @@ -1453,11 +1441,11 @@ msgstr "" "more-itertools.readthedocs.io/en/stable/api.html#more_itertools." "before_and_after>`_ 作為替代。" -#: ../../library/itertools.rst:696 +#: ../../library/itertools.rst:691 msgid "Return *n* independent iterators from a single iterable." msgstr "從一個 iterable 中回傳 *n* 個獨立的疊代器。" -#: ../../library/itertools.rst:700 +#: ../../library/itertools.rst:695 msgid "" "def tee(iterable, n=2):\n" " if n < 0:\n" @@ -1493,7 +1481,7 @@ msgid "" " return value" msgstr "" -#: ../../library/itertools.rst:733 +#: ../../library/itertools.rst:728 msgid "" "When the input *iterable* is already a tee iterator object, all members of " "the return tuple are constructed as if they had been produced by the " @@ -1502,11 +1490,11 @@ msgid "" "update step rather than a chain of calls." msgstr "" -#: ../../library/itertools.rst:739 +#: ../../library/itertools.rst:734 msgid "The flattening property makes tee iterators efficiently peekable:" msgstr "" -#: ../../library/itertools.rst:741 +#: ../../library/itertools.rst:736 msgid "" "def lookahead(tee_iterator):\n" " \"Return the next value without moving the input forward\"\n" @@ -1514,7 +1502,7 @@ msgid "" " return next(forked_iterator)" msgstr "" -#: ../../library/itertools.rst:748 +#: ../../library/itertools.rst:743 msgid "" ">>> iterator = iter('abcdef')\n" ">>> [iterator] = tee(iterator, 1) # Make the input peekable\n" @@ -1526,7 +1514,7 @@ msgid "" "'b'" msgstr "" -#: ../../library/itertools.rst:759 +#: ../../library/itertools.rst:754 msgid "" "``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised " "when simultaneously using iterators returned by the same :func:`tee` call, " @@ -1536,7 +1524,7 @@ msgstr "" "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" "`RuntimeError`。" -#: ../../library/itertools.rst:763 +#: ../../library/itertools.rst:758 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " @@ -1547,11 +1535,11 @@ msgstr "" "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" "`list` 會比 :func:`tee` 更快。" -#: ../../library/itertools.rst:771 +#: ../../library/itertools.rst:766 msgid "Make an iterator that aggregates elements from each of the *iterables*." msgstr "建立一個疊代器,聚合來自每個 *iterables* 中的元素。" -#: ../../library/itertools.rst:774 +#: ../../library/itertools.rst:769 msgid "" "If the iterables are of uneven length, missing values are filled-in with " "*fillvalue*. If not specified, *fillvalue* defaults to ``None``." @@ -1559,11 +1547,11 @@ msgstr "" "如果 iterables 的長度不一,則使用 *fillvalue* 填充缺少的值。如果未指定," "*fillvalue* 會預設為 ``None``。" -#: ../../library/itertools.rst:777 +#: ../../library/itertools.rst:772 msgid "Iteration continues until the longest iterable is exhausted." msgstr "疊代將持續直到最長的可疊代物件耗盡為止。" -#: ../../library/itertools.rst:781 +#: ../../library/itertools.rst:776 msgid "" "def zip_longest(*iterables, fillvalue=None):\n" " # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-\n" @@ -1609,7 +1597,7 @@ msgstr "" " values.append(value)\n" " yield tuple(values)" -#: ../../library/itertools.rst:803 +#: ../../library/itertools.rst:798 msgid "" "If one of the iterables is potentially infinite, then the :func:" "`zip_longest` function should be wrapped with something that limits the " @@ -1618,18 +1606,18 @@ msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" -#: ../../library/itertools.rst:811 +#: ../../library/itertools.rst:806 msgid "Itertools Recipes" msgstr "Itertools 應用技巧" -#: ../../library/itertools.rst:813 +#: ../../library/itertools.rst:808 msgid "" "This section shows recipes for creating an extended toolset using the " "existing itertools as building blocks." msgstr "" "此段落展示了使用現有的 itertools 作為構建塊來建立擴展工具集的應用技巧。" -#: ../../library/itertools.rst:816 +#: ../../library/itertools.rst:811 msgid "" "The primary purpose of the itertools recipes is educational. The recipes " "show various ways of thinking about individual tools — for example, that " @@ -1647,7 +1635,7 @@ msgstr "" "`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" "``reversed()`` 和 ``enumerate()``)一同使用的模式。" -#: ../../library/itertools.rst:825 +#: ../../library/itertools.rst:820 msgid "" "A secondary purpose of the recipes is to serve as an incubator. The " "``accumulate()``, ``compress()``, and ``pairwise()`` itertools started out " @@ -1659,7 +1647,7 @@ msgstr "" "``sliding_window()``、``iter_index()`` 和 ``sieve()`` 的應用技巧正在被測試," "以確定它們是否有價值被收錄到內建的 itertools 中。" -#: ../../library/itertools.rst:830 +#: ../../library/itertools.rst:825 msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" @@ -1667,11 +1655,11 @@ msgstr "" "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" "pypi:`more-itertools` 專案中安裝: ::" -#: ../../library/itertools.rst:834 +#: ../../library/itertools.rst:829 msgid "python -m pip install more-itertools" msgstr "python -m pip install more-itertools" -#: ../../library/itertools.rst:836 +#: ../../library/itertools.rst:831 msgid "" "Many of the recipes offer the same high performance as the underlying " "toolset. Superior memory performance is kept by processing elements one at a " @@ -1689,14 +1677,13 @@ msgstr "" "用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" "term:`產生器 `,則能保持高速度。" -#: ../../library/itertools.rst:844 +#: ../../library/itertools.rst:839 msgid "" -"import collections\n" -"import contextlib\n" -"import functools\n" -"import math\n" -"import operator\n" -"import random\n" +"from collections import Counter, deque\n" +"from contextlib import suppress\n" +"from functools import reduce\n" +"from math import comb, prod, sumprod, isqrt\n" +"from operator import itemgetter, getitem, mul, neg\n" "\n" "def take(n, iterable):\n" " \"Return first n items of the iterable as a list.\"\n" @@ -1711,11 +1698,11 @@ msgid "" " \"Return function(0), function(1), ...\"\n" " return map(function, count(start))\n" "\n" -"def repeatfunc(func, times=None, *args):\n" -" \"Repeat calls to func with specified arguments.\"\n" +"def repeatfunc(function, times=None, *args):\n" +" \"Repeat calls to a function with specified arguments.\"\n" " if times is None:\n" -" return starmap(func, repeat(args))\n" -" return starmap(func, repeat(args, times))\n" +" return starmap(function, repeat(args))\n" +" return starmap(function, repeat(args, times))\n" "\n" "def flatten(list_of_lists):\n" " \"Flatten one level of nesting.\"\n" @@ -1725,16 +1712,21 @@ msgid "" " \"Returns the sequence elements n times.\"\n" " return chain.from_iterable(repeat(tuple(iterable), n))\n" "\n" +"def loops(n):\n" +" \"Loop n times. Like range(n) but without creating integers.\"\n" +" # for _ in loops(100): ...\n" +" return repeat(None, n)\n" +"\n" "def tail(n, iterable):\n" " \"Return an iterator over the last n items.\"\n" " # tail(3, 'ABCDEFG') → E F G\n" -" return iter(collections.deque(iterable, maxlen=n))\n" +" return iter(deque(iterable, maxlen=n))\n" "\n" "def consume(iterator, n=None):\n" " \"Advance the iterator n-steps ahead. If n is None, consume entirely.\"\n" " # Use functions that consume iterators at C speed.\n" " if n is None:\n" -" collections.deque(iterator, maxlen=0)\n" +" deque(iterator, maxlen=0)\n" " else:\n" " next(islice(iterator, n, n), None)\n" "\n" @@ -1765,8 +1757,8 @@ msgid "" " # unique_justseen('AAAABBBCCDAABBB') → A B C D A B\n" " # unique_justseen('ABBcCAD', str.casefold) → A B c A D\n" " if key is None:\n" -" return map(operator.itemgetter(0), groupby(iterable))\n" -" return map(next, map(operator.itemgetter(1), groupby(iterable, key)))\n" +" return map(itemgetter(0), groupby(iterable))\n" +" return map(next, map(itemgetter(1), groupby(iterable, key)))\n" "\n" "def unique_everseen(iterable, key=None):\n" " \"Yield unique elements, preserving order. Remember all elements ever " @@ -1788,14 +1780,14 @@ msgid "" "def unique(iterable, key=None, reverse=False):\n" " \"Yield unique elements in sorted order. Supports unhashable inputs.\"\n" " # unique([[1, 2], [3, 4], [1, 2]]) → [1, 2] [3, 4]\n" -" return unique_justseen(sorted(iterable, key=key, reverse=reverse), " -"key=key)\n" +" sequenced = sorted(iterable, key=key, reverse=reverse)\n" +" return unique_justseen(sequenced, key=key)\n" "\n" "def sliding_window(iterable, n):\n" " \"Collect data into overlapping fixed-length chunks or blocks.\"\n" " # sliding_window('ABCDEFG', 4) → ABCD BCDE CDEF DEFG\n" " iterator = iter(iterable)\n" -" window = collections.deque(islice(iterator, n - 1), maxlen=n)\n" +" window = deque(islice(iterator, n - 1), maxlen=n)\n" " for x in iterator:\n" " window.append(x)\n" " yield tuple(window)\n" @@ -1829,7 +1821,7 @@ msgid "" " \"Return all contiguous non-empty subslices of a sequence.\"\n" " # subslices('ABCD') → A AB ABC ABCD B BC BCD C CD D\n" " slices = starmap(slice, combinations(range(len(seq) + 1), 2))\n" -" return map(operator.getitem, repeat(seq), slices)\n" +" return map(getitem, repeat(seq), slices)\n" "\n" "def iter_index(iterable, value, start=0, stop=None):\n" " \"Return indices where a value occurs in a sequence or iterable.\"\n" @@ -1843,19 +1835,19 @@ msgid "" " else:\n" " stop = len(iterable) if stop is None else stop\n" " i = start\n" -" with contextlib.suppress(ValueError):\n" +" with suppress(ValueError):\n" " while True:\n" " yield (i := seq_index(value, i, stop))\n" " i += 1\n" "\n" -"def iter_except(func, exception, first=None):\n" +"def iter_except(function, exception, first=None):\n" " \"Convert a call-until-exception interface to an iterator interface.\"\n" " # iter_except(d.popitem, KeyError) → non-blocking dictionary iterator\n" -" with contextlib.suppress(exception):\n" +" with suppress(exception):\n" " if first is not None:\n" " yield first()\n" " while True:\n" -" yield func()" +" yield function()" msgstr "" #: ../../library/itertools.rst:1008 @@ -1864,20 +1856,27 @@ msgstr "以下的應用技巧具有更多的數學風格:" #: ../../library/itertools.rst:1010 msgid "" +"def multinomial(*counts):\n" +" \"Number of distinct arrangements of a multiset.\"\n" +" # Counter('abracadabra').values() → 5 2 2 1 1\n" +" # multinomial(5, 2, 2, 1, 1) → 83160\n" +" return prod(map(comb, accumulate(counts), counts))\n" +"\n" "def powerset(iterable):\n" -" \"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\n" +" \"Subsequences of the iterable from shortest to longest.\"\n" +" # powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\n" " s = list(iterable)\n" " return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))\n" "\n" "def sum_of_squares(iterable):\n" " \"Add up the squares of the input values.\"\n" " # sum_of_squares([10, 20, 30]) → 1400\n" -" return math.sumprod(*tee(iterable))\n" +" return sumprod(*tee(iterable))\n" "\n" -"def reshape(matrix, cols):\n" +"def reshape(matrix, columns):\n" " \"Reshape a 2-D matrix to have a given number of columns.\"\n" " # reshape([(0, 1), (2, 3), (4, 5)], 3) → (0, 1, 2), (3, 4, 5)\n" -" return batched(chain.from_iterable(matrix), cols, strict=True)\n" +" return batched(chain.from_iterable(matrix), columns, strict=True)\n" "\n" "def transpose(matrix):\n" " \"Swap the rows and columns of a 2-D matrix.\"\n" @@ -1888,7 +1887,7 @@ msgid "" " \"Multiply two matrices.\"\n" " # matmul([(7, 5), (3, 5)], [(2, 5), (7, 9)]) → (49, 80), (41, 60)\n" " n = len(m2[0])\n" -" return batched(starmap(math.sumprod, product(m1, transpose(m2))), n)\n" +" return batched(starmap(sumprod, product(m1, transpose(m2))), n)\n" "\n" "def convolve(signal, kernel):\n" " \"\"\"Discrete linear convolution of two iterables.\n" @@ -1909,7 +1908,7 @@ msgid "" " n = len(kernel)\n" " padded_signal = chain(repeat(0, n-1), signal, repeat(0, n-1))\n" " windowed_signal = sliding_window(padded_signal, n)\n" -" return map(math.sumprod, repeat(kernel), windowed_signal)\n" +" return map(sumprod, repeat(kernel), windowed_signal)\n" "\n" "def polynomial_from_roots(roots):\n" " \"\"\"Compute a polynomial's coefficients from its roots.\n" @@ -1917,8 +1916,8 @@ msgid "" " (x - 5) (x + 4) (x - 3) expands to: x³ -4x² -17x + 60\n" " \"\"\"\n" " # polynomial_from_roots([5, -4, 3]) → [1, -4, -17, 60]\n" -" factors = zip(repeat(1), map(operator.neg, roots))\n" -" return list(functools.reduce(convolve, factors, [1]))\n" +" factors = zip(repeat(1), map(neg, roots))\n" +" return list(reduce(convolve, factors, [1]))\n" "\n" "def polynomial_eval(coefficients, x):\n" " \"\"\"Evaluate a polynomial at a specific value.\n" @@ -1931,7 +1930,7 @@ msgid "" " if not n:\n" " return type(x)(0)\n" " powers = map(pow, repeat(x), reversed(range(n)))\n" -" return math.sumprod(coefficients, powers)\n" +" return sumprod(coefficients, powers)\n" "\n" "def polynomial_derivative(coefficients):\n" " \"\"\"Compute the first derivative of a polynomial.\n" @@ -1942,7 +1941,7 @@ msgid "" " # polynomial_derivative([1, -4, -17, 60]) → [3, -8, -17]\n" " n = len(coefficients)\n" " powers = reversed(range(1, n))\n" -" return list(map(operator.mul, coefficients, powers))\n" +" return list(map(mul, coefficients, powers))\n" "\n" "def sieve(n):\n" " \"Primes less than n.\"\n" @@ -1950,7 +1949,7 @@ msgid "" " if n > 2:\n" " yield 2\n" " data = bytearray((0, 1)) * (n // 2)\n" -" for p in iter_index(data, 1, start=3, stop=math.isqrt(n) + 1):\n" +" for p in iter_index(data, 1, start=3, stop=isqrt(n) + 1):\n" " data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))\n" " yield from iter_index(data, 1, start=3)\n" "\n" @@ -1959,7 +1958,7 @@ msgid "" " # factor(99) → 3 3 11\n" " # factor(1_000_000_000_000_007) → 47 59 360620266859\n" " # factor(1_000_000_000_000_403) → 1000000000000403\n" -" for prime in sieve(math.isqrt(n) + 1):\n" +" for prime in sieve(isqrt(n) + 1):\n" " while not n % prime:\n" " yield prime\n" " n //= prime\n" @@ -1968,6 +1967,11 @@ msgid "" " if n > 1:\n" " yield n\n" "\n" +"def is_prime(n):\n" +" \"Return True if n is prime.\"\n" +" # is_prime(1_000_000_000_000_403) → True\n" +" return n > 1 and next(factor(n)) == n\n" +"\n" "def totient(n):\n" " \"Count of natural numbers up to n that are coprime to n.\"\n" " # https://mathworld.wolfram.com/TotientFunction.html\n" @@ -1976,3 +1980,14 @@ msgid "" " n -= n // prime\n" " return n" msgstr "" + +#~ msgid "" +#~ "These tools and their built-in counterparts also work well with the high-" +#~ "speed functions in the :mod:`operator` module. For example, the " +#~ "multiplication operator can be mapped across two vectors to form an " +#~ "efficient dot-product: ``sum(starmap(operator.mul, zip(vec1, vec2, " +#~ "strict=True)))``." +#~ msgstr "" +#~ "這些工具及其內建的對等部分 (counterpart) 也可以很好地與 :mod:`operator` 模" +#~ "組中的高速函式配合使用。例如,乘法運算子可以對映到兩個向量上以組成高效率的" +#~ "內積:``sum(starmap(operator.mul, zip(vec1, vec2, strict=True)))``。" diff --git a/library/json.po b/library/json.po index a910b316ff..485a9121cb 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,12 +30,12 @@ msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 msgid "" -"`JSON (JavaScript Object Notation) `_, specified by :rfc:" -"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, specified " +"by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " -"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " -"strict subset of JavaScript [#rfc-errata]_ )." +"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is " +"not a strict subset of JavaScript [#rfc-errata]_ )." msgstr "" "`JSON (JavaScript Object Notation) `_ 是一個輕量化的資料交" "換格式,在 :rfc:`7159`\\ (其廢棄了 :rfc:`4627`\\ )及 `ECMA-404 >> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': obj." -"imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': " +"obj.imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" @@ -280,153 +280,139 @@ msgstr "基本用法" #: ../../library/json.rst:153 msgid "" "Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-" -"supporting :term:`file-like object`) using this :ref:`conversion table `." +"supporting :term:`file-like object`) using this :ref:`Python-to-JSON " +"conversion table `." msgstr "" -"參考這個\\ :ref:`轉換表 `\\ 將 *obj* 序列化為符合 JSON 格式" -"的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like " -"object`)" +"參考這個 :ref:`Python-to-JSON 轉換表 `\\ 將 *obj* 序列化為" +"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法" +"的 :term:`file-like object`)" -#: ../../library/json.rst:157 +# SkyLull: 我想這裡的 "framed protocol" 指的是 +# https://peps.python.org/pep-3154/#framing +#: ../../library/json.rst:159 msgid "" -"If *skipkeys* is true (default: ``False``), then dict keys that are not of a " -"basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, " -"``None``) will be skipped instead of raising a :exc:`TypeError`." +"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " +"trying to serialize multiple objects with repeated calls to :func:`dump` " +"using the same *fp* will result in an invalid JSON file." msgstr "" -"如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別(:class:" -"`str`、:class:`int`、:class:`float`、:class:`bool`、``None``)的 dictionary" -"(字典)鍵值將被略過而不會引發 :exc:`TypeError`。" +"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不具有二進位分框(binary " +"framed)的協定,因此嘗試重複呼叫 :func:`dump` 來序列化多個物件到同一個 *fp* " +"裡將導致無效的 JSON 檔案。" -#: ../../library/json.rst:161 +#: ../../library/json.rst:0 +msgid "Parameters" +msgstr "參數" + +#: ../../library/json.rst:163 +msgid "The Python object to be serialized." +msgstr "要被序列化的 Python 物件。" + +#: ../../library/json.rst:166 msgid "" -"The :mod:`json` module always produces :class:`str` objects, not :class:" -"`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input." +"The file-like object *obj* will be serialized to. The :mod:`!json` module " +"always produces :class:`str` objects, not :class:`bytes` objects, therefore " +"``fp.write()`` must support :class:`str` input." msgstr "" -":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。因此," -"``fp.write()`` 必須支援 :class:`str` 輸入。" -#: ../../library/json.rst:165 ../../library/json.rst:442 +#: ../../library/json.rst:173 msgid "" -"If *ensure_ascii* is true (the default), the output is guaranteed to have " -"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " -"these characters will be output as-is." +"If ``True``, keys that are not of a basic type " +"(:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will " +"be skipped instead of raising a :exc:`TypeError`. Default ``False``." msgstr "" -"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII " -"字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" -#: ../../library/json.rst:169 +#: ../../library/json.rst:179 msgid "" -"If *check_circular* is false (default: ``True``), then the circular " -"reference check for container types will be skipped and a circular reference " -"will result in a :exc:`RecursionError` (or worse)." +"If ``True`` (the default), the output is guaranteed to have all incoming non-" +"ASCII characters escaped. If ``False``, these characters will be outputted " +"as-is." msgstr "" -"如果 *check_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環" -"參照 (circular reference) 檢查將會被跳過,若有循環參照則最後將引發 :exc:" -"`RecursionError` (或其他更糟的錯誤)。" -#: ../../library/json.rst:173 +#: ../../library/json.rst:184 msgid "" -"If *allow_nan* is false (default: ``True``), then it will be a :exc:" -"`ValueError` to serialize out of range :class:`float` values (``nan``, " -"``inf``, ``-inf``) in strict compliance of the JSON specification. If " -"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-" -"Infinity``) will be used." +"If ``False``, the circular reference check for container types is skipped " +"and a circular reference will result in a :exc:`RecursionError` (or worse). " +"Default ``True``." msgstr "" -"如果 *allow_nan* 為 false(預設值:``True``\\ ),則序列化不符合嚴格 JSON 規" -"範的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:" -"`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效表示 " -"(``NaN``, ``Infinity``, ``-Infinity``)。" +"如為 ``False``,則針對不同容器型別的循環參照 (circular reference) 檢查將會被" +"跳過,若有循環參照則最後將引發 :exc:`RecursionError`\\ (或其他更糟的錯誤)。" +"預設為 ``True``。" -#: ../../library/json.rst:179 ../../library/json.rst:461 +#: ../../library/json.rst:189 msgid "" -"If *indent* is a non-negative integer or string, then JSON array elements " -"and object members will be pretty-printed with that indent level. An indent " -"level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the " -"default) selects the most compact representation. Using a positive integer " -"indent indents that many spaces per level. If *indent* is a string (such as " -"``\"\\t\"``), that string is used to indent each level." +"If ``False``, serialization of out-of-range :class:`float` values (``nan``, " +"``inf``, ``-inf``) will result in a :exc:`ValueError`, in strict compliance " +"with the JSON specification. If ``True`` (the default), their JavaScript " +"equivalents (``NaN``, ``Infinity``, ``-Infinity``) are used." msgstr "" -"如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進" -"行格式美化。縮排等級 0、負數或 ``\"\"`` 只會插入換行符號。``None``\\ (預設" -"值)等於是選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如" -"果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" - -#: ../../library/json.rst:186 ../../library/json.rst:468 -msgid "Allow strings for *indent* in addition to integers." -msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。" +"如為 ``False``,則序列化不符合嚴格 JSON 規範的超出範圍 :class:`float` 值 " +"(``nan``, ``inf``, ``-inf``) 會引發 :exc:`ValueError`。如為 ``True``\\ (預設" +"值),則將使用它們的 JavaScript 等效表示 (``NaN``, ``Infinity``, ``-" +"Infinity``)。" -#: ../../library/json.rst:189 ../../library/json.rst:471 +#: ../../library/json.rst:196 msgid "" -"If specified, *separators* should be an ``(item_separator, key_separator)`` " -"tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " -"': ')`` otherwise. To get the most compact JSON representation, you should " -"specify ``(',', ':')`` to eliminate whitespace." +"If set, a custom JSON encoder with the :meth:`~JSONEncoder.default` method " +"overridden, for serializing into custom datatypes. If ``None`` (the " +"default), :class:`!JSONEncoder` is used." msgstr "" -"如果有指定本引數內容,*separators* 應該是一個 ``(item_separator, " -"key_separator)`` 二元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': " -"')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" -"指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:194 ../../library/json.rst:476 -msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." -msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值" - -#: ../../library/json.rst:197 ../../library/json.rst:479 +#: ../../library/json.rst:203 msgid "" -"If specified, *default* should be a function that gets called for objects " -"that can't otherwise be serialized. It should return a JSON encodable " -"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" -"`TypeError` is raised." +"If a positive integer or string, JSON array elements and object members will " +"be pretty-printed with that indent level. A positive integer indents that " +"many spaces per level; a string (such as ``\"\\t\"``) is used to indent each " +"level. If zero, negative, or ``\"\"`` (the empty string), only newlines are " +"inserted. If ``None`` (the default), the most compact representation is used." msgstr "" -"如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" -"應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" -"引發 :exc:`TypeError`。" -#: ../../library/json.rst:202 +#: ../../library/json.rst:213 msgid "" -"If *sort_keys* is true (default: ``False``), then the output of dictionaries " -"will be sorted by key." +"A two-tuple: ``(item_separator, key_separator)``. If ``None`` (the default), " +"*separators* defaults to ``(', ', ': ')`` if *indent* is ``None``, and " +"``(',', ': ')`` otherwise. For the most compact JSON, specify ``(',', ':')`` " +"to eliminate whitespace." msgstr "" -"如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵值排序。" +"一個二元組:``(item_separator, key_separator)``。如為 ``None``\\ (預設值)" +"則 *separators* 被預設為 ``(', ', ': ')``,否則預設為 ``(',', ': ')``。想要獲" +"得最緊湊的 JSON 表示形式,你可以指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:205 +#: ../../library/json.rst:222 msgid "" -"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :" -"meth:`~JSONEncoder.default` method to serialize additional types), specify " -"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." +"A function that is called for objects that can't otherwise be serialized. It " +"should return a JSON encodable version of the object or raise " +"a :exc:`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." msgstr "" -"若要使用繼承自 :class:`JSONEncoder` 的自訂子類別(例如覆寫 :meth:" -"`~JSONEncoder.default` 方法來序列化其他型別的一個子類別物件),請使用關鍵字引" -"數 *cls* 指定該類別物件;否則預設使用 :class:`JSONEncoder`。" -#: ../../library/json.rst:209 ../../library/json.rst:287 +#: ../../library/json.rst:229 msgid "" -"All optional parameters are now :ref:`keyword-only `." +"If ``True``, dictionaries will be outputted sorted by key. Default ``False``." msgstr "" -"所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" -# SkyLull: 我想這裡的 "framed protocol" 指的是 -# https://peps.python.org/pep-3154/#framing -#: ../../library/json.rst:214 +#: ../../library/json.rst:233 ../../library/json.rst:518 +msgid "Allow strings for *indent* in addition to integers." +msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。" + +#: ../../library/json.rst:236 ../../library/json.rst:526 +msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." +msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值" + +#: ../../library/json.rst:239 ../../library/json.rst:338 msgid "" -"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " -"trying to serialize multiple objects with repeated calls to :func:`dump` " -"using the same *fp* will result in an invalid JSON file." +"All optional parameters are now :ref:`keyword-only `." msgstr "" -"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不具有二進位分框(binary " -"framed)的協定,因此嘗試重複呼叫 :func:`dump` 來序列化多個物件到同一個 *fp* " -"裡將導致無效的 JSON 檔案。" +"所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" -#: ../../library/json.rst:223 +#: ../../library/json.rst:248 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " -"table `. The arguments have the same meaning as in :func:" -"`dump`." +"table `. The arguments have the same meaning as " +"in :func:`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" -"class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格" +"式 :class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" -#: ../../library/json.rst:229 +#: ../../library/json.rst:254 msgid "" "Keys in key/value pairs of JSON are always of the type :class:`str`. When a " "dictionary is converted into JSON, all the keys of the dictionary are " @@ -439,113 +425,120 @@ msgstr "" "轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值," "則 ``loads(dumps(x)) != x``。" -#: ../../library/json.rst:238 +#: ../../library/json.rst:265 msgid "" -"Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:" -"`binary file` containing a JSON document) to a Python object using this :ref:" -"`conversion table `." +"Deserialize *fp* to a Python object using the :ref:`JSON-to-Python " +"conversion table `." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *fp*\\ (一個支援 ``." -"read()``、包含 JSON 文件的\\ :term:`文字檔案 `\\ 或\\ :term:`二進" -"位檔案 `\\ )去序列化為 Python 物件。" +"使用此 :ref:`JSON-to-Python 轉換表 `\\ 將 *fp* 解碼為 " +"Python 物件。" -#: ../../library/json.rst:242 +#: ../../library/json.rst:268 msgid "" -"*object_hook* is an optional function that will be called with the result of " -"any object literal decoded (a :class:`dict`). The return value of " -"*object_hook* will be used instead of the :class:`dict`. This feature can " -"be used to implement custom decoders (e.g. `JSON-RPC `_ class hinting)." +"A ``.read()``-supporting :term:`text file` or :term:`binary file` containing " +"the JSON document to be deserialized." +msgstr "" + +#: ../../library/json.rst:273 +msgid "" +"If set, a custom JSON decoder. Additional keyword arguments to :func:`!load` " +"will be passed to the constructor of *cls*. If ``None`` (the " +"default), :class:`!JSONDecoder` is used." +msgstr "" + +#: ../../library/json.rst:280 +#, fuzzy +msgid "" +"If set, a function that is called with the result of any object literal " +"decoded (a :class:`dict`). The return value of this function will be used " +"instead of the :class:`dict`. This feature can be used to implement custom " +"decoders, for example `JSON-RPC `_ class hinting. " +"Default ``None``." msgstr "" "*object_hook* 是一個可選引數,其接受一個函式作為輸入。原始的字串解碼結果(一" "個 :class:`dict`\\ )將被傳入這個函式、並使用 *object_hook* 的回傳值來取代原" "先的 :class:`dict` 輸出。此功能可用於實作自訂解碼器(例如 `JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:248 +#: ../../library/json.rst:290 +#, fuzzy msgid "" -"*object_pairs_hook* is an optional function that will be called with the " -"result of any object literal decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of the :class:" -"`dict`. This feature can be used to implement custom decoders. If " -"*object_hook* is also defined, the *object_pairs_hook* takes priority." +"If set, a function that is called with the result of any object literal " +"decoded with an ordered list of pairs. The return value of this function " +"will be used instead of the :class:`dict`. This feature can be used to " +"implement custom decoders. If *object_hook* is also set, *object_pairs_hook* " +"takes priority. Default ``None``." msgstr "" "*object_pairs_hook* 是一個可選引數,其接受一個函式作為輸入。原始的有序對串列" "(ordered list of pairs)解碼結果將被傳入這個函式、並使用 " "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" "自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" -#: ../../library/json.rst:254 ../../library/json.rst:358 -msgid "Added support for *object_pairs_hook*." -msgstr "新增對於 *object_pairs_hook* 的支援。" - -#: ../../library/json.rst:257 ../../library/json.rst:361 +#: ../../library/json.rst:300 +#, fuzzy msgid "" -"*parse_float* is an optional function that will be called with the string of " -"every JSON float to be decoded. By default, this is equivalent to " -"``float(num_str)``. This can be used to use another datatype or parser for " -"JSON floats (e.g. :class:`decimal.Decimal`)." +"If set, a function that is called with the string of every JSON float to be " +"decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " +"This can be used to parse JSON floats into custom datatypes, for " +"example :class:`decimal.Decimal`." msgstr "" "*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " "中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:262 ../../library/json.rst:366 +#: ../../library/json.rst:308 +#, fuzzy msgid "" -"*parse_int* is an optional function that will be called with the string of " -"every JSON int to be decoded. By default, this is equivalent to " -"``int(num_str)``. This can be used to use another datatype or parser for " -"JSON integers (e.g. :class:`float`)." +"If set, a function that is called with the string of every JSON int to be " +"decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " +"This can be used to parse JSON integers into custom datatypes, for " +"example :class:`float`." msgstr "" "*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" "(例如 :class:`float`)。" -#: ../../library/json.rst:267 +#: ../../library/json.rst:316 +#, fuzzy msgid "" -"The default *parse_int* of :func:`int` now limits the maximum length of the " -"integer string via the interpreter's :ref:`integer string conversion length " -"limitation ` to help avoid denial of service attacks." -msgstr "" -"預設 *parse_int* 使用的 :func:`int` 函式現在有限制整數字串的長度上限了,限制" -"由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," -"這能防止阻斷服務攻擊 (Denial of Service attacks)。" - -#: ../../library/json.rst:273 ../../library/json.rst:371 -msgid "" -"*parse_constant* is an optional function that will be called with one of the " -"following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " -"used to raise an exception if invalid JSON numbers are encountered." +"If set, a function that is called with one of the following strings: ``'-" +"Infinity'``, ``'Infinity'``, or ``'NaN'``. This can be used to raise an " +"exception if invalid JSON numbers are encountered. Default ``None``." msgstr "" "*parse_constant* 為可選函式,在解碼時若遭遇字串 ``'-Infinity'``、" "``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" -#: ../../library/json.rst:277 -msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." +#: ../../library/json.rst:0 +msgid "Raises" msgstr "" -"遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" -#: ../../library/json.rst:280 -msgid "" -"To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` " -"kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " -"will be passed to the constructor of the class." +#: ../../library/json.rst:324 +#, fuzzy +msgid "When the data being deserialized is not a valid JSON document." msgstr "" -"若想要使用自訂的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指定" -"之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳入" -"給 JSONDecoder 的建構函式使用。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:284 ../../library/json.rst:302 -#: ../../library/json.rst:380 +#: ../../library/json.rst:327 +#, fuzzy msgid "" -"If the data being deserialized is not a valid JSON document, a :exc:" -"`JSONDecodeError` will be raised." +"When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " +"encoded data." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" -"`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:290 +#: ../../library/json.rst:333 +msgid "Added the optional *object_pairs_hook* parameter." +msgstr "新增可選的 *object_pairs_hook* 參數。" + +#: ../../library/json.rst:334 +msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." +msgstr "" +"遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" + +#: ../../library/json.rst:339 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." @@ -553,21 +546,29 @@ msgstr "" "現在,*fp* 可以是一個\\ :term:`二進位檔案 `,前提是其編碼格式為 " "UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:296 +#: ../../library/json.rst:342 msgid "" -"Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray` " -"instance containing a JSON document) to a Python object using this :ref:" -"`conversion table `." +"The default *parse_int* of :func:`int` now limits the maximum length of the " +"integer string via the interpreter's :ref:`integer string conversion length " +"limitation ` to help avoid denial of service attacks." msgstr "" -"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件的 :" -"class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" -"化(deserialize)為一個 Python 物件" +"預設 *parse_int* 使用的 :func:`int` 函式現在有限制整數字串的長度上限了,限制" +"由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," +"這能防止阻斷服務攻擊 (Denial of Service attacks)。" -#: ../../library/json.rst:300 -msgid "The other arguments have the same meaning as in :func:`load`." -msgstr "其餘引數的使用方式與意義和 :func:`load` 的相同。" +#: ../../library/json.rst:350 +#, fuzzy +msgid "" +"Identical to :func:`load`, but instead of a file-like object, deserialize " +"*s* (a :class:`str`, :class:`bytes` or :class:`bytearray` instance " +"containing a JSON document) to a Python object using this :ref:`conversion " +"table `." +msgstr "" +"使用\\ :ref:`轉換表 `\\ 將 *s* (一個含有 JSON 文件" +"的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去" +"序列化(deserialize)為一個 Python 物件" -#: ../../library/json.rst:305 +#: ../../library/json.rst:355 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." @@ -575,95 +576,95 @@ msgstr "" "現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是" "其編碼格式為 UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:309 +#: ../../library/json.rst:359 msgid "The keyword argument *encoding* has been removed." msgstr "刪除關鍵字引數 *encoding*。" -#: ../../library/json.rst:314 +#: ../../library/json.rst:364 msgid "Encoders and Decoders" msgstr "編碼器與解碼器" -#: ../../library/json.rst:318 +#: ../../library/json.rst:368 msgid "Simple JSON decoder." msgstr "簡易 JSON 解碼器" -#: ../../library/json.rst:320 +#: ../../library/json.rst:370 msgid "Performs the following translations in decoding by default:" msgstr "預設將執行下列資料型別轉換:" -#: ../../library/json.rst:325 ../../library/json.rst:413 +#: ../../library/json.rst:375 ../../library/json.rst:463 msgid "JSON" msgstr "JSON" -#: ../../library/json.rst:325 ../../library/json.rst:413 +#: ../../library/json.rst:375 ../../library/json.rst:463 msgid "Python" msgstr "Python" -#: ../../library/json.rst:327 ../../library/json.rst:415 +#: ../../library/json.rst:377 ../../library/json.rst:465 msgid "object" msgstr "object" -#: ../../library/json.rst:327 ../../library/json.rst:415 +#: ../../library/json.rst:377 ../../library/json.rst:465 msgid "dict" msgstr "dict" -#: ../../library/json.rst:329 ../../library/json.rst:417 +#: ../../library/json.rst:379 ../../library/json.rst:467 msgid "array" msgstr "array" -#: ../../library/json.rst:329 +#: ../../library/json.rst:379 msgid "list" msgstr "list" -#: ../../library/json.rst:331 ../../library/json.rst:419 +#: ../../library/json.rst:381 ../../library/json.rst:469 msgid "string" msgstr "string" -#: ../../library/json.rst:331 ../../library/json.rst:419 +#: ../../library/json.rst:381 ../../library/json.rst:469 msgid "str" msgstr "str" -#: ../../library/json.rst:333 +#: ../../library/json.rst:383 msgid "number (int)" msgstr "number (整數)" -#: ../../library/json.rst:333 +#: ../../library/json.rst:383 msgid "int" msgstr "int" -#: ../../library/json.rst:335 +#: ../../library/json.rst:385 msgid "number (real)" msgstr "number (實數)" -#: ../../library/json.rst:335 +#: ../../library/json.rst:385 msgid "float" msgstr "float" -#: ../../library/json.rst:337 ../../library/json.rst:423 +#: ../../library/json.rst:387 ../../library/json.rst:473 msgid "true" msgstr "true" -#: ../../library/json.rst:337 ../../library/json.rst:423 +#: ../../library/json.rst:387 ../../library/json.rst:473 msgid "True" msgstr "True" -#: ../../library/json.rst:339 ../../library/json.rst:425 +#: ../../library/json.rst:389 ../../library/json.rst:475 msgid "false" msgstr "false" -#: ../../library/json.rst:339 ../../library/json.rst:425 +#: ../../library/json.rst:389 ../../library/json.rst:475 msgid "False" msgstr "False" -#: ../../library/json.rst:341 ../../library/json.rst:427 +#: ../../library/json.rst:391 ../../library/json.rst:477 msgid "null" msgstr "null" -#: ../../library/json.rst:341 ../../library/json.rst:427 +#: ../../library/json.rst:391 ../../library/json.rst:477 msgid "None" msgstr "None" -#: ../../library/json.rst:344 +#: ../../library/json.rst:394 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." @@ -671,27 +672,63 @@ msgstr "" "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然" "能正確地將其轉換到相應的 Python ``float`` 值。" -#: ../../library/json.rst:347 +#: ../../library/json.rst:397 msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " -"given :class:`dict`. This can be used to provide custom deserializations (e." -"g. to support `JSON-RPC `_ class hinting)." +"given :class:`dict`. This can be used to provide custom deserializations " +"(e.g. to support `JSON-RPC `_ class hinting)." msgstr "" "*object_hook* 是一個可選函式,其接受一個解碼後的 JSON 物件作為輸入,並使用其" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " "`JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:352 +#: ../../library/json.rst:402 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of the :class:" -"`dict`. This feature can be used to implement custom decoders. If " -"*object_hook* is also defined, the *object_pairs_hook* takes priority." +"return value of *object_pairs_hook* will be used instead of " +"the :class:`dict`. This feature can be used to implement custom decoders. " +"If *object_hook* is also defined, the *object_pairs_hook* takes priority." +msgstr "" + +#: ../../library/json.rst:408 +msgid "Added support for *object_pairs_hook*." +msgstr "新增對於 *object_pairs_hook* 的支援。" + +#: ../../library/json.rst:411 +msgid "" +"*parse_float* is an optional function that will be called with the string of " +"every JSON float to be decoded. By default, this is equivalent to " +"``float(num_str)``. This can be used to use another datatype or parser for " +"JSON floats (e.g. :class:`decimal.Decimal`)." msgstr "" +"*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" +"的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " +"中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:375 +#: ../../library/json.rst:416 +msgid "" +"*parse_int* is an optional function that will be called with the string of " +"every JSON int to be decoded. By default, this is equivalent to " +"``int(num_str)``. This can be used to use another datatype or parser for " +"JSON integers (e.g. :class:`float`)." +msgstr "" +"*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " +"``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" +"(例如 :class:`float`)。" + +#: ../../library/json.rst:421 +msgid "" +"*parse_constant* is an optional function that will be called with one of the " +"following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " +"used to raise an exception if invalid JSON numbers are encountered." +msgstr "" +"*parse_constant* 為可選函式,在解碼時若遭遇字串 ``'-Infinity'``、" +"``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" +"也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" + +#: ../../library/json.rst:425 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -702,25 +739,33 @@ msgstr "" "語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" "(tab)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" -#: ../../library/json.rst:383 ../../library/json.rst:484 +#: ../../library/json.rst:430 +msgid "" +"If the data being deserialized is not a valid JSON document, " +"a :exc:`JSONDecodeError` will be raised." +msgstr "" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" + +#: ../../library/json.rst:433 ../../library/json.rst:534 msgid "All parameters are now :ref:`keyword-only `." msgstr "" "所有參數現在都是\\ :ref:`僅限關鍵字參數 `\\ 了。" -#: ../../library/json.rst:388 +#: ../../library/json.rst:438 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" "回傳用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" -#: ../../library/json.rst:391 +#: ../../library/json.rst:441 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:396 +#: ../../library/json.rst:446 msgid "" "Decode a JSON document from *s* (a :class:`str` beginning with a JSON " "document) and return a 2-tuple of the Python representation and the index in " @@ -729,43 +774,43 @@ msgstr "" "將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件" "結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" -#: ../../library/json.rst:400 +#: ../../library/json.rst:450 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" -#: ../../library/json.rst:406 +#: ../../library/json.rst:456 msgid "Extensible JSON encoder for Python data structures." msgstr "可擴充的 Python 資料結構 JSON 編碼器。" -#: ../../library/json.rst:408 +#: ../../library/json.rst:458 msgid "Supports the following objects and types by default:" msgstr "預設可支援下列物件及型別:" -#: ../../library/json.rst:417 +#: ../../library/json.rst:467 msgid "list, tuple" msgstr "list, tuple" -#: ../../library/json.rst:421 +#: ../../library/json.rst:471 msgid "int, float, int- & float-derived Enums" msgstr "" "int、float 或可作為整數或浮點數運算的衍生列舉(int- or float-derived Enums)" -#: ../../library/json.rst:421 +#: ../../library/json.rst:471 msgid "number" msgstr "number" -#: ../../library/json.rst:430 +#: ../../library/json.rst:480 msgid "Added support for int- and float-derived Enum classes." msgstr "" "增加對整數(int)、浮點數(float)或可作為整數或浮點數運算的衍生列舉(int- " "or float-derived Enums)類別的支援性。" -#: ../../library/json.rst:433 +#: ../../library/json.rst:483 msgid "" -"To extend this to recognize other objects, subclass and implement a :meth:" -"`~JSONEncoder.default` method with another method that returns a " +"To extend this to recognize other objects, subclass and implement " +"a :meth:`~JSONEncoder.default` method with another method that returns a " "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" @@ -773,17 +818,28 @@ msgstr "" "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " "JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" -#: ../../library/json.rst:438 +#: ../../library/json.rst:488 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " -"trying to encode keys that are not :class:`str`, :class:`int`, :class:" -"`float` or ``None``. If *skipkeys* is true, such items are simply skipped." +"trying to encode keys that are " +"not :class:`str`, :class:`int`, :class:`float`, :class:`bool` or ``None``. " +"If *skipkeys* is true, such items are simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`、:class:" -"`int`、:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " -"*skipkeys* 為 true,這些項目將直接被跳過。" +"若 *skipkeys* 為 false(預設值),則當在編碼不" +"是 :class:`str`、:class:`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵" +"值時,將引發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳" +"過。" -#: ../../library/json.rst:446 +#: ../../library/json.rst:492 +msgid "" +"If *ensure_ascii* is true (the default), the output is guaranteed to have " +"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " +"these characters will be output as-is." +msgstr "" +"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII " +"字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" + +#: ../../library/json.rst:496 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -791,10 +847,10 @@ msgid "" "Otherwise, no such check takes place." msgstr "" "如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" -"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" -"`RecursionError` 例外的問題)。否則不會進行此類檢查。" +"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導" +"致 :exc:`RecursionError` 例外的問題)。否則不會進行此類檢查。" -#: ../../library/json.rst:451 +#: ../../library/json.rst:501 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -806,7 +862,7 @@ msgstr "" "數基於 JavaScript 的編碼器和解碼器一致。否則若設為 false,嘗試對這些浮點數進" "行編碼將引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:457 +#: ../../library/json.rst:507 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key; this is useful for regression tests to ensure that " @@ -816,24 +872,61 @@ msgstr "" "按鍵值排序。這項功能可確保 JSON 序列化的結果能被互相比較,能讓日常的回歸測試" "檢查變得方便一些。" -#: ../../library/json.rst:490 +#: ../../library/json.rst:511 +msgid "" +"If *indent* is a non-negative integer or string, then JSON array elements " +"and object members will be pretty-printed with that indent level. An indent " +"level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the " +"default) selects the most compact representation. Using a positive integer " +"indent indents that many spaces per level. If *indent* is a string (such as " +"``\"\\t\"``), that string is used to indent each level." +msgstr "" +"如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進" +"行格式美化。縮排等級 0、負數或 ``\"\"`` 只會插入換行符號。``None``\\ (預設" +"值)等於是選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如" +"果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" + +#: ../../library/json.rst:521 +msgid "" +"If specified, *separators* should be an ``(item_separator, key_separator)`` " +"tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " +"': ')`` otherwise. To get the most compact JSON representation, you should " +"specify ``(',', ':')`` to eliminate whitespace." +msgstr "" +"如果有指定本引數內容,*separators* 應該是一個 ``(item_separator, " +"key_separator)`` 二元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': " +"')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" +"指定 ``(',', ':')`` 來消除空格。" + +#: ../../library/json.rst:529 +msgid "" +"If specified, *default* should be a function that gets called for objects " +"that can't otherwise be serialized. It should return a JSON encodable " +"version of the object or raise a :exc:`TypeError`. If not " +"specified, :exc:`TypeError` is raised." +msgstr "" +"如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" +"應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" +"引發 :exc:`TypeError`。" + +#: ../../library/json.rst:540 msgid "" "Implement this method in a subclass such that it returns a serializable " -"object for *o*, or calls the base implementation (to raise a :exc:" -"`TypeError`)." +"object for *o*, or calls the base implementation (to raise " +"a :exc:`TypeError`)." msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" -#: ../../library/json.rst:494 +#: ../../library/json.rst:544 msgid "" -"For example, to support arbitrary iterators, you could implement :meth:" -"`~JSONEncoder.default` like this::" +"For example, to support arbitrary iterators, you could " +"implement :meth:`~JSONEncoder.default` like this::" msgstr "" -"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" -"`~JSONEncoder.default`: ::" +"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子" +"的 :meth:`~JSONEncoder.default`: ::" -#: ../../library/json.rst:497 +#: ../../library/json.rst:547 msgid "" "def default(self, o):\n" " try:\n" @@ -846,13 +939,13 @@ msgid "" " return super().default(o)" msgstr "" -#: ../../library/json.rst:510 +#: ../../library/json.rst:560 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" -#: ../../library/json.rst:513 +#: ../../library/json.rst:563 msgid "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" @@ -860,7 +953,7 @@ msgstr "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" -#: ../../library/json.rst:519 +#: ../../library/json.rst:569 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" @@ -868,7 +961,7 @@ msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的物件。如下" "例: ::" -#: ../../library/json.rst:522 +#: ../../library/json.rst:572 msgid "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" @@ -876,39 +969,39 @@ msgstr "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" -#: ../../library/json.rst:527 +#: ../../library/json.rst:577 msgid "Exceptions" msgstr "例外" -#: ../../library/json.rst:531 +#: ../../library/json.rst:581 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" -#: ../../library/json.rst:535 +#: ../../library/json.rst:585 msgid "The unformatted error message." msgstr "未受格式化的錯誤訊息。" -#: ../../library/json.rst:539 +#: ../../library/json.rst:589 msgid "The JSON document being parsed." msgstr "正在被剖析的 JSON 文件。" -#: ../../library/json.rst:543 +#: ../../library/json.rst:593 msgid "The start index of *doc* where parsing failed." msgstr "*doc* 剖析失敗處的起始點的索引值。" -#: ../../library/json.rst:547 +#: ../../library/json.rst:597 msgid "The line corresponding to *pos*." msgstr "*pos* 所在的列(line)數。" -#: ../../library/json.rst:551 +#: ../../library/json.rst:601 msgid "The column corresponding to *pos*." msgstr "*pos* 所在的行(column)數。" -#: ../../library/json.rst:557 +#: ../../library/json.rst:607 msgid "Standard Compliance and Interoperability" msgstr "合規性與互通性(Interoperability)" -#: ../../library/json.rst:559 +#: ../../library/json.rst:609 msgid "" "The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. This " @@ -921,7 +1014,7 @@ msgstr "" "組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` " "子類別以及未明確提及的參數將不予討論。" -#: ../../library/json.rst:565 +#: ../../library/json.rst:615 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" @@ -929,17 +1022,17 @@ msgstr "" "這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 " "JavaScript 語法格式,但並不符合 JSON 格式:" -#: ../../library/json.rst:568 +#: ../../library/json.rst:618 msgid "Infinite and NaN number values are accepted and output;" msgstr "無限(Infinite)和非數字(NaN)值會被接受。" -#: ../../library/json.rst:569 +#: ../../library/json.rst:619 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。" -#: ../../library/json.rst:572 +#: ../../library/json.rst:622 msgid "" "Since the RFC permits RFC-compliant parsers to accept input texts that are " "not RFC-compliant, this module's deserializer is technically RFC-compliant " @@ -948,11 +1041,11 @@ msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" "定運作,本模組的去序列化器(deserializer)是符合 RFC 規範的。" -#: ../../library/json.rst:577 +#: ../../library/json.rst:627 msgid "Character Encodings" msgstr "字元編碼格式" -#: ../../library/json.rst:579 +#: ../../library/json.rst:629 msgid "" "The RFC requires that JSON be represented using either UTF-8, UTF-16, or " "UTF-32, with UTF-8 being the recommended default for maximum " @@ -961,7 +1054,7 @@ msgstr "" "RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以" "達成最佳的互通性。" -#: ../../library/json.rst:582 +#: ../../library/json.rst:632 msgid "" "As permitted, though not required, by the RFC, this module's serializer sets " "*ensure_ascii=True* by default, thus escaping the output so that the " @@ -970,17 +1063,18 @@ msgstr "" "RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作" "了此一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" -#: ../../library/json.rst:586 +#: ../../library/json.rst:636 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " "`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" -"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" -"`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" +"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件" +"與 :class:`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的" +"問題。" -#: ../../library/json.rst:591 +#: ../../library/json.rst:641 msgid "" "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON " "text, and this module's serializer does not add a BOM to its output. The RFC " @@ -993,24 +1087,24 @@ msgstr "" "(deserializer)忽略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文" "件開頭的端序記號時引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:597 +#: ../../library/json.rst:647 msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " "surrogates), but it does note that they may cause interoperability problems. " -"By default, this module accepts and outputs (when present in the original :" -"class:`str`) code points for such sequences." +"By default, this module accepts and outputs (when present in the " +"original :class:`str`) code points for such sequences." msgstr "" "RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配" "對的 UTF-16 代理對(surrogate pairs)),但這個特性的確可能會引起相容性問題。" "預設情況下,當原始輸入的 :class:`str` 中存在此類序列時,該模組將接受並輸出這" "些序列的編碼位置(code points)。" -#: ../../library/json.rst:605 +#: ../../library/json.rst:655 msgid "Infinite and NaN Number Values" msgstr "正負無限與非數值" -#: ../../library/json.rst:607 +#: ../../library/json.rst:657 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" @@ -1019,7 +1113,7 @@ msgstr "" "RFC 不允許表現無限大或非數值(NaN)。但預設情況下,這個模組仍接受並輸出 " "``Infinity``、``-Infinity`` 和 ``NaN``,如同它們是有效的 JSON 數值字面值: ::" -#: ../../library/json.rst:611 +#: ../../library/json.rst:661 msgid "" ">>> # Neither of these calls raises an exception, but the results are not " "valid JSON\n" @@ -1034,7 +1128,7 @@ msgid "" "nan" msgstr "" -#: ../../library/json.rst:622 +#: ../../library/json.rst:672 msgid "" "In the serializer, the *allow_nan* parameter can be used to alter this " "behavior. In the deserializer, the *parse_constant* parameter can be used " @@ -1043,11 +1137,11 @@ msgstr "" "在序列化器中,*allow_nan* 參數可以改變這個行為。在去序列化器中," "*parse_constant* 參數可以改變這個行為。" -#: ../../library/json.rst:628 +#: ../../library/json.rst:678 msgid "Repeated Names Within an Object" msgstr "物件內重複的名稱" -#: ../../library/json.rst:630 +#: ../../library/json.rst:680 msgid "" "The RFC specifies that the names within a JSON object should be unique, but " "does not mandate how repeated names in JSON objects should be handled. By " @@ -1058,22 +1152,22 @@ msgstr "" "字。預設情況下,本模組不會因此引發例外;相反的,它會忽略該名字的所有重複鍵值" "對,並只保留最後一個: ::" -#: ../../library/json.rst:635 +#: ../../library/json.rst:685 msgid "" ">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" ">>> json.loads(weird_json)\n" "{'x': 3}" msgstr "" -#: ../../library/json.rst:639 +#: ../../library/json.rst:689 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "*object_parts_hook* 參數可以改變這個行為。" -#: ../../library/json.rst:643 +#: ../../library/json.rst:693 msgid "Top-level Non-Object, Non-Array Values" msgstr "位於頂層的非物件及非列表值" -#: ../../library/json.rst:645 +#: ../../library/json.rst:695 msgid "" "The old version of JSON specified by the obsolete :rfc:`4627` required that " "the top-level value of a JSON text must be either a JSON object or array " @@ -1087,37 +1181,37 @@ msgstr "" "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的序列化器或去串" "列化器中未曾實施過該限制。" -#: ../../library/json.rst:652 +#: ../../library/json.rst:702 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "如果想要最大限度地保留互通性,你可能還是會想要自行施加這個限制。" -#: ../../library/json.rst:657 +#: ../../library/json.rst:707 msgid "Implementation Limitations" msgstr "實作限制" -#: ../../library/json.rst:659 +#: ../../library/json.rst:709 msgid "Some JSON deserializer implementations may set limits on:" msgstr "某些 JSON 去序列化器的實作可能會造成下列限制:" -#: ../../library/json.rst:661 +#: ../../library/json.rst:711 msgid "the size of accepted JSON texts" msgstr "JSON 文件長度上限" -#: ../../library/json.rst:662 +#: ../../library/json.rst:712 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "JSON 物件或陣列的最大巢狀層數(level of nesting)限制" -#: ../../library/json.rst:663 +#: ../../library/json.rst:713 msgid "the range and precision of JSON numbers" msgstr "數字的精準度或範圍" -#: ../../library/json.rst:664 +#: ../../library/json.rst:714 msgid "the content and maximum length of JSON strings" msgstr "JSON 字串長度上限" -#: ../../library/json.rst:666 +#: ../../library/json.rst:716 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." @@ -1125,7 +1219,7 @@ msgstr "" "本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此" "類限制。" -#: ../../library/json.rst:669 +#: ../../library/json.rst:719 msgid "" "When serializing to JSON, beware any such limitations in applications that " "may consume your JSON. In particular, it is common for JSON numbers to be " @@ -1140,30 +1234,31 @@ msgstr "" "因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" -#: ../../library/json.rst:682 +#: ../../library/json.rst:732 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/json.rst:687 +#: ../../library/json.rst:737 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" -#: ../../library/json.rst:691 +#: ../../library/json.rst:741 msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" -":mod:`json.tool` 模組提供了一個簡易的命令列界面以供校驗與美化呈現 JSON 物件。" +":mod:`json.tool` 模組提供了一個簡易的命令列介面以供校驗與美化呈現 JSON 物件。" -#: ../../library/json.rst:694 +#: ../../library/json.rst:744 msgid "" -"If the optional ``infile`` and ``outfile`` arguments are not specified, :" -"data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" +"If the optional ``infile`` and ``outfile`` arguments are not " +"specified, :data:`sys.stdin` and :data:`sys.stdout` will be used " +"respectively:" msgstr "" -"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" -"data:`sys.stdout` 將各自做為輸入和輸出的預設值。" +"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` " +"和 :data:`sys.stdout` 將各自做為輸入和輸出的預設值。" -#: ../../library/json.rst:697 +#: ../../library/json.rst:747 msgid "" "$ echo '{\"json\": \"obj\"}' | python -m json.tool\n" "{\n" @@ -1173,7 +1268,7 @@ msgid "" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" -#: ../../library/json.rst:706 +#: ../../library/json.rst:756 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." @@ -1181,15 +1276,15 @@ msgstr "" "現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" -#: ../../library/json.rst:713 +#: ../../library/json.rst:763 msgid "Command line options" msgstr "命令列選項" -#: ../../library/json.rst:717 +#: ../../library/json.rst:767 msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" -#: ../../library/json.rst:719 +#: ../../library/json.rst:769 msgid "" "$ python -m json.tool mp_films.json\n" "[\n" @@ -1215,45 +1310,45 @@ msgstr "" " }\n" "]" -#: ../../library/json.rst:733 +#: ../../library/json.rst:783 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" -#: ../../library/json.rst:737 +#: ../../library/json.rst:787 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." -"stdout`。" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入" +"到 :data:`sys.stdout`。" -#: ../../library/json.rst:742 +#: ../../library/json.rst:792 msgid "Sort the output of dictionaries alphabetically by key." msgstr "按照鍵值的字母順序對輸出字典進行排序。" -#: ../../library/json.rst:748 +#: ../../library/json.rst:798 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "關閉非 ASCII 字元的自動轉義功能。詳情請參照 :func:`json.dumps`。" -#: ../../library/json.rst:754 +#: ../../library/json.rst:804 msgid "Parse every input line as separate JSON object." msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" -#: ../../library/json.rst:760 +#: ../../library/json.rst:810 msgid "Mutually exclusive options for whitespace control." msgstr "互斥的空白字元控制選項。" -#: ../../library/json.rst:766 +#: ../../library/json.rst:816 msgid "Show the help message." msgstr "顯示說明訊息。" -#: ../../library/json.rst:770 +#: ../../library/json.rst:820 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:771 +#: ../../library/json.rst:821 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " @@ -1263,16 +1358,3 @@ msgstr "" "如 `RFC 7159 更正 `_ " "所述,JSON 允許字串中出現 U+2028(列分隔符)和 U+2029(段落分隔符)字元,而 " "JavaScript(截至 ECMAScript 5.1 版)則不允許。" - -#~ msgid "" -#~ "*object_pairs_hook*, if specified will be called with the result of every " -#~ "JSON object decoded with an ordered list of pairs. The return value of " -#~ "*object_pairs_hook* will be used instead of the :class:`dict`. This " -#~ "feature can be used to implement custom decoders. If *object_hook* is " -#~ "also defined, the *object_pairs_hook* takes priority." -#~ msgstr "" -#~ "*object_pairs_hook* 是一個可選引數,其接受一個函式作為輸入。原始的有序對串" -#~ "列(ordered list of pairs)解碼結果將被傳入這個函式、並使用 " -#~ "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於" -#~ "實作自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優" -#~ "先。" diff --git a/library/language.po b/library/language.po index fd197d5ad7..faf9fb5c18 100644 --- a/library/language.po +++ b/library/language.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -28,6 +27,8 @@ msgid "" "language. These modules support tokenizing, parsing, syntax analysis, " "bytecode disassembly, and various other facilities." msgstr "" +"Python 提供了許多模組來協助處理 Python 語言。這些模組支援標記化、剖析、語法分" +"析、位元碼反組譯,以及其他各種設施。" #: ../../library/language.rst:11 msgid "These modules include:" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index c735ab982e..e8b7682ec7 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1608,36 +1608,41 @@ msgid "" "process." msgstr "" -#: ../../library/logging.handlers.rst:1177 +#: ../../library/logging.handlers.rst:1175 +msgid "" +"Raises :exc:`RuntimeError` if called and the listener is already running." +msgstr "" + +#: ../../library/logging.handlers.rst:1181 msgid "Stops the listener." msgstr "" -#: ../../library/logging.handlers.rst:1179 +#: ../../library/logging.handlers.rst:1183 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: ../../library/logging.handlers.rst:1185 +#: ../../library/logging.handlers.rst:1189 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1195 +#: ../../library/logging.handlers.rst:1199 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.handlers.rst:1196 +#: ../../library/logging.handlers.rst:1200 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.handlers.rst:1198 +#: ../../library/logging.handlers.rst:1202 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.handlers.rst:1199 +#: ../../library/logging.handlers.rst:1203 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/logging.po b/library/logging.po index 8bfdaea17d..b1f72fc580 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -527,7 +527,7 @@ msgstr "" msgid "" "If no handler is attached to this logger (or any of its ancestors, taking " "into account the relevant :attr:`Logger.propagate` attributes), the message " -"will be sent to the handler set on :attr:`lastResort`." +"will be sent to the handler set on :data:`lastResort`." msgstr "" #: ../../library/logging.rst:347 @@ -791,18 +791,20 @@ msgid "" msgstr "" #: ../../library/logging.rst:565 -msgid "Sets the :class:`Formatter` for this handler to *fmt*." +msgid "" +"Sets the formatter for this handler to *fmt*. The *fmt* argument must be a :" +"class:`Formatter` instance or ``None``." msgstr "" -#: ../../library/logging.rst:570 +#: ../../library/logging.rst:571 msgid "Adds the specified filter *filter* to this handler." msgstr "" -#: ../../library/logging.rst:575 +#: ../../library/logging.rst:576 msgid "Removes the specified filter *filter* from this handler." msgstr "" -#: ../../library/logging.rst:580 +#: ../../library/logging.rst:581 msgid "" "Apply this handler's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -811,28 +813,33 @@ msgid "" "record." msgstr "" -#: ../../library/logging.rst:589 +#: ../../library/logging.rst:590 msgid "" "Ensure all logging output has been flushed. This version does nothing and is " "intended to be implemented by subclasses." msgstr "" -#: ../../library/logging.rst:595 +#: ../../library/logging.rst:596 msgid "" "Tidy up any resources used by the handler. This version does no output but " -"removes the handler from an internal list of handlers which is closed when :" -"func:`shutdown` is called. Subclasses should ensure that this gets called " -"from overridden :meth:`close` methods." +"removes the handler from an internal map of handlers, which is used for " +"handler lookup by name." +msgstr "" + +#: ../../library/logging.rst:600 +msgid "" +"Subclasses should ensure that this gets called from overridden :meth:`close` " +"methods." msgstr "" -#: ../../library/logging.rst:603 +#: ../../library/logging.rst:606 msgid "" "Conditionally emits the specified logging record, depending on filters which " "may have been added to the handler. Wraps the actual emission of the record " "with acquisition/release of the I/O thread lock." msgstr "" -#: ../../library/logging.rst:610 +#: ../../library/logging.rst:613 msgid "" "This method should be called from handlers when an exception is encountered " "during an :meth:`emit` call. If the module-level attribute :data:" @@ -845,20 +852,20 @@ msgid "" "is more useful during development)." msgstr "" -#: ../../library/logging.rst:623 +#: ../../library/logging.rst:626 msgid "" "Do formatting for a record - if a formatter is set, use it. Otherwise, use " "the default formatter for the module." msgstr "" -#: ../../library/logging.rst:629 +#: ../../library/logging.rst:632 msgid "" "Do whatever it takes to actually log the specified logging record. This " "version is intended to be implemented by subclasses and so raises a :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/logging.rst:633 +#: ../../library/logging.rst:636 msgid "" "This method is called after a handler-level lock is acquired, which is " "released after this method returns. When you override this method, note that " @@ -867,13 +874,13 @@ msgid "" "Specifically:" msgstr "" -#: ../../library/logging.rst:639 +#: ../../library/logging.rst:642 msgid "" "Logging configuration APIs acquire the module-level lock, and then " "individual handler-level locks as those handlers are configured." msgstr "" -#: ../../library/logging.rst:642 +#: ../../library/logging.rst:645 msgid "" "Many logging APIs lock the module-level lock. If such an API is called from " "this method, it could cause a deadlock if a configuration call is made on " @@ -883,16 +890,16 @@ msgid "" "method, the handler-level lock has already been acquired)." msgstr "" -#: ../../library/logging.rst:649 +#: ../../library/logging.rst:652 msgid "" "For a list of handlers included as standard, see :mod:`logging.handlers`." msgstr "" -#: ../../library/logging.rst:654 +#: ../../library/logging.rst:657 msgid "Formatter Objects" msgstr "" -#: ../../library/logging.rst:660 +#: ../../library/logging.rst:663 msgid "" "Responsible for converting a :class:`LogRecord` to an output string to be " "interpreted by a human or external system." @@ -902,7 +909,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/logging.rst:663 +#: ../../library/logging.rst:666 msgid "" "A format string in the given *style* for the logged output as a whole. The " "possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" @@ -910,14 +917,14 @@ msgid "" "is just the logged message." msgstr "" -#: ../../library/logging.rst:671 +#: ../../library/logging.rst:674 msgid "" "A format string in the given *style* for the date/time portion of the logged " "output. If not specified, the default described in :meth:`formatTime` is " "used." msgstr "" -#: ../../library/logging.rst:676 +#: ../../library/logging.rst:679 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" @@ -928,32 +935,32 @@ msgid "" "use ``{``- and ``$``-formatting for log messages." msgstr "" -#: ../../library/logging.rst:686 +#: ../../library/logging.rst:689 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " "raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " "%(message)s', style='{')``." msgstr "" -#: ../../library/logging.rst:691 +#: ../../library/logging.rst:694 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: ../../library/logging.rst:696 +#: ../../library/logging.rst:699 msgid "Added the *style* parameter." msgstr "新增 *style* 參數。" -#: ../../library/logging.rst:699 +#: ../../library/logging.rst:702 msgid "Added the *validate* parameter." msgstr "新增 *validate* 參數。" -#: ../../library/logging.rst:702 +#: ../../library/logging.rst:705 msgid "Added the *defaults* parameter." msgstr "新增 *defaults* 參數。" -#: ../../library/logging.rst:708 +#: ../../library/logging.rst:711 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " @@ -972,13 +979,13 @@ msgid "" "recalculates it afresh." msgstr "" -#: ../../library/logging.rst:724 +#: ../../library/logging.rst:727 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: ../../library/logging.rst:730 +#: ../../library/logging.rst:733 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " @@ -991,7 +998,7 @@ msgid "" "resulting string is returned." msgstr "" -#: ../../library/logging.rst:740 +#: ../../library/logging.rst:743 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -1001,7 +1008,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: ../../library/logging.rst:748 +#: ../../library/logging.rst:751 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -1016,11 +1023,11 @@ msgid "" "the millisecond value)." msgstr "" -#: ../../library/logging.rst:761 +#: ../../library/logging.rst:764 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: ../../library/logging.rst:766 +#: ../../library/logging.rst:769 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -1028,14 +1035,14 @@ msgid "" "returned." msgstr "" -#: ../../library/logging.rst:773 +#: ../../library/logging.rst:776 msgid "" "Formats the specified stack information (a string as returned by :func:" "`traceback.print_stack`, but with the last newline removed) as a string. " "This default implementation just returns the input value." msgstr "" -#: ../../library/logging.rst:779 +#: ../../library/logging.rst:782 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -1044,7 +1051,7 @@ msgid "" "used as the line formatter." msgstr "" -#: ../../library/logging.rst:787 +#: ../../library/logging.rst:790 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -1052,14 +1059,14 @@ msgid "" "separator line." msgstr "" -#: ../../library/logging.rst:794 +#: ../../library/logging.rst:797 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: ../../library/logging.rst:801 +#: ../../library/logging.rst:804 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -1067,11 +1074,11 @@ msgid "" "and the footer." msgstr "" -#: ../../library/logging.rst:809 +#: ../../library/logging.rst:812 msgid "Filter Objects" msgstr "" -#: ../../library/logging.rst:811 +#: ../../library/logging.rst:814 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -1081,7 +1088,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: ../../library/logging.rst:821 +#: ../../library/logging.rst:824 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -1089,7 +1096,7 @@ msgid "" "event." msgstr "" -#: ../../library/logging.rst:828 +#: ../../library/logging.rst:831 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -1097,7 +1104,7 @@ msgid "" "future processing of the event." msgstr "" -#: ../../library/logging.rst:833 +#: ../../library/logging.rst:836 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1107,13 +1114,13 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: ../../library/logging.rst:840 +#: ../../library/logging.rst:843 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: ../../library/logging.rst:843 +#: ../../library/logging.rst:846 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " @@ -1124,7 +1131,7 @@ msgid "" "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: ../../library/logging.rst:853 +#: ../../library/logging.rst:856 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1132,7 +1139,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: ../../library/logging.rst:859 +#: ../../library/logging.rst:862 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1144,11 +1151,11 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: ../../library/logging.rst:872 +#: ../../library/logging.rst:875 msgid "LogRecord Objects" msgstr "LogRecord 物件" -#: ../../library/logging.rst:874 +#: ../../library/logging.rst:877 msgid "" ":class:`LogRecord` instances are created automatically by the :class:" "`Logger` every time something is logged, and can be created manually via :" @@ -1156,17 +1163,17 @@ msgid "" "wire)." msgstr "" -#: ../../library/logging.rst:882 +#: ../../library/logging.rst:885 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: ../../library/logging.rst:884 +#: ../../library/logging.rst:887 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: ../../library/logging.rst:888 +#: ../../library/logging.rst:891 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1174,7 +1181,7 @@ msgid "" "different (ancestor) logger." msgstr "" -#: ../../library/logging.rst:896 +#: ../../library/logging.rst:899 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " @@ -1182,46 +1189,46 @@ msgid "" "attr:`!levelname` for the corresponding level name." msgstr "" -#: ../../library/logging.rst:903 +#: ../../library/logging.rst:906 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:907 +#: ../../library/logging.rst:910 msgid "The line number in the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:911 +#: ../../library/logging.rst:914 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: ../../library/logging.rst:916 +#: ../../library/logging.rst:919 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: ../../library/logging.rst:920 +#: ../../library/logging.rst:923 msgid "" "An exception tuple with the current exception information, as returned by :" "func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: ../../library/logging.rst:925 +#: ../../library/logging.rst:928 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: ../../library/logging.rst:929 +#: ../../library/logging.rst:932 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: ../../library/logging.rst:936 +#: ../../library/logging.rst:939 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1230,7 +1237,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: ../../library/logging.rst:943 +#: ../../library/logging.rst:946 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1238,13 +1245,13 @@ msgid "" "this for the factory's signature)." msgstr "" -#: ../../library/logging.rst:949 +#: ../../library/logging.rst:952 msgid "" "This functionality can be used to inject your own values into a :class:" "`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: ../../library/logging.rst:952 +#: ../../library/logging.rst:955 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1264,18 +1271,18 @@ msgstr "" "\n" "logging.setLogRecordFactory(record_factory)" -#: ../../library/logging.rst:961 +#: ../../library/logging.rst:964 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: ../../library/logging.rst:970 +#: ../../library/logging.rst:973 msgid "LogRecord attributes" msgstr "LogRecord 屬性" -#: ../../library/logging.rst:972 +#: ../../library/logging.rst:975 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1286,7 +1293,7 @@ msgid "" "style format string." msgstr "" -#: ../../library/logging.rst:980 +#: ../../library/logging.rst:983 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" "`` as the placeholder in the format string. If you are using $-formatting (:" @@ -1294,7 +1301,7 @@ msgid "" "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: ../../library/logging.rst:986 +#: ../../library/logging.rst:989 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1303,318 +1310,318 @@ msgid "" "on the options available to you." msgstr "" -#: ../../library/logging.rst:993 +#: ../../library/logging.rst:996 msgid "Attribute name" msgstr "屬性名稱" -#: ../../library/logging.rst:993 ../../library/logging.rst:1363 +#: ../../library/logging.rst:996 ../../library/logging.rst:1366 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:993 ../../library/logging.rst:1363 +#: ../../library/logging.rst:996 ../../library/logging.rst:1366 msgid "Description" msgstr "描述" -#: ../../library/logging.rst:0 ../../library/logging.rst:995 +#: ../../library/logging.rst:0 ../../library/logging.rst:998 msgid "args" msgstr "args" -#: ../../library/logging.rst:995 ../../library/logging.rst:1009 -#: ../../library/logging.rst:1037 ../../library/logging.rst:1055 +#: ../../library/logging.rst:998 ../../library/logging.rst:1012 +#: ../../library/logging.rst:1040 ../../library/logging.rst:1058 msgid "You shouldn't need to format this yourself." msgstr "你不應該需要自己格式化它。" -#: ../../library/logging.rst:995 +#: ../../library/logging.rst:998 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "asctime" msgstr "asctime" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "``%(asctime)s``" msgstr "``%(asctime)s``" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "created" msgstr "created" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "``%(created)f``" msgstr "``%(created)f``" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." "time_ns` / 1e9)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1009 +#: ../../library/logging.rst:0 ../../library/logging.rst:1012 msgid "exc_info" msgstr "exc_info" -#: ../../library/logging.rst:1009 +#: ../../library/logging.rst:1012 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "filename" msgstr "filename" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "``%(filename)s``" msgstr "``%(filename)s``" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "Filename portion of ``pathname``." msgstr "``pathname`` 的檔案名稱部分。" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "funcName" msgstr "funcName" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "``%(funcName)s``" msgstr "``%(funcName)s``" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "Name of function containing the logging call." msgstr "" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "levelname" msgstr "levelname" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "``%(levelname)s``" msgstr "``%(levelname)s``" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "levelno" msgstr "levelno" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "``%(levelno)s``" msgstr "``%(levelno)s``" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "" "Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" "`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "lineno" msgstr "lineno" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "``%(lineno)d``" msgstr "``%(lineno)d``" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "message" msgstr "message" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "``%(message)s``" msgstr "``%(message)s``" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "" "The logged message, computed as ``msg % args``. This is set when :meth:" "`Formatter.format` is invoked." msgstr "" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "module" msgstr "模組" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "``%(module)s``" msgstr "``%(module)s``" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "Module (name portion of ``filename``)." msgstr "模組(``filename`` 的名稱部分)。" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "msecs" msgstr "msecs" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "``%(msecs)d``" msgstr "``%(msecs)d``" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1037 +#: ../../library/logging.rst:0 ../../library/logging.rst:1040 msgid "msg" msgstr "msg" -#: ../../library/logging.rst:1037 +#: ../../library/logging.rst:1040 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1042 +#: ../../library/logging.rst:0 ../../library/logging.rst:1045 msgid "name" msgstr "name" -#: ../../library/logging.rst:1042 +#: ../../library/logging.rst:1045 msgid "``%(name)s``" msgstr "``%(name)s``" -#: ../../library/logging.rst:1042 +#: ../../library/logging.rst:1045 msgid "Name of the logger used to log the call." msgstr "" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "pathname" msgstr "pathname" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "``%(pathname)s``" msgstr "``%(pathname)s``" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "process" msgstr "process" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "``%(process)d``" msgstr "``%(process)d``" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "Process ID (if available)." msgstr "行程 ID(如果可用)。" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "processName" msgstr "processName" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "``%(processName)s``" msgstr "``%(processName)s``" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "Process name (if available)." msgstr "行程名稱(如果可用)。" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "relativeCreated" msgstr "relativeCreated" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "``%(relativeCreated)d``" msgstr "``%(relativeCreated)d``" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: ../../library/logging.rst:1055 +#: ../../library/logging.rst:1058 msgid "stack_info" msgstr "stack_info" -#: ../../library/logging.rst:1055 +#: ../../library/logging.rst:1058 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "thread" msgstr "thread" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "``%(thread)d``" msgstr "``%(thread)d``" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "Thread ID (if available)." msgstr "執行緒 ID(如果可用)。" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "threadName" msgstr "threadName" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "``%(threadName)s``" msgstr "``%(threadName)s``" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "Thread name (if available)." msgstr "" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid "taskName" msgstr "taskName" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid "``%(taskName)s``" msgstr "``%(taskName)s``" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: ../../library/logging.rst:1068 +#: ../../library/logging.rst:1071 msgid "*processName* was added." msgstr "新增 *processName*。" -#: ../../library/logging.rst:1071 +#: ../../library/logging.rst:1074 msgid "*taskName* was added." msgstr "新增 *taskName*。" -#: ../../library/logging.rst:1077 +#: ../../library/logging.rst:1080 msgid "LoggerAdapter Objects" msgstr "LoggerAdapter 物件" -#: ../../library/logging.rst:1079 +#: ../../library/logging.rst:1082 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " "information into logging calls. For a usage example, see the section on :ref:" "`adding contextual information to your logging output `." msgstr "" -#: ../../library/logging.rst:1085 +#: ../../library/logging.rst:1088 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " "underlying :class:`Logger` instance, a dict-like object (*extra*), and a " @@ -1624,7 +1631,7 @@ msgid "" "calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1094 +#: ../../library/logging.rst:1097 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1633,15 +1640,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1102 +#: ../../library/logging.rst:1105 msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: ../../library/logging.rst:1106 +#: ../../library/logging.rst:1109 msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: ../../library/logging.rst:1108 +#: ../../library/logging.rst:1111 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1653,28 +1660,28 @@ msgid "" "interchangeably." msgstr "" -#: ../../library/logging.rst:1119 +#: ../../library/logging.rst:1122 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1125 +#: ../../library/logging.rst:1128 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1130 +#: ../../library/logging.rst:1133 msgid "The *merge_extra* argument was added." msgstr "新增 *merge_extra* 引數。" -#: ../../library/logging.rst:1134 +#: ../../library/logging.rst:1137 msgid "Thread Safety" msgstr "執行緒安全" -#: ../../library/logging.rst:1136 +#: ../../library/logging.rst:1139 msgid "" "The logging module is intended to be thread-safe without any special work " "needing to be done by its clients. It achieves this though using threading " @@ -1683,7 +1690,7 @@ msgid "" "O." msgstr "" -#: ../../library/logging.rst:1141 +#: ../../library/logging.rst:1144 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1691,17 +1698,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1148 +#: ../../library/logging.rst:1151 msgid "Module-Level Functions" msgstr "模組層級函式" -#: ../../library/logging.rst:1150 +#: ../../library/logging.rst:1153 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1156 +#: ../../library/logging.rst:1159 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1711,14 +1718,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1163 +#: ../../library/logging.rst:1166 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1170 +#: ../../library/logging.rst:1173 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1727,7 +1734,7 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1175 +#: ../../library/logging.rst:1178 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" @@ -1735,37 +1742,37 @@ msgstr "" "class MyLogger(logging.getLoggerClass()):\n" " # ... 在這裡覆蓋其行為" -#: ../../library/logging.rst:1181 +#: ../../library/logging.rst:1184 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1183 +#: ../../library/logging.rst:1186 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1188 +#: ../../library/logging.rst:1191 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1193 +#: ../../library/logging.rst:1196 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1197 +#: ../../library/logging.rst:1200 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1200 +#: ../../library/logging.rst:1203 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1775,38 +1782,38 @@ msgid "" "described at the beginnning of this documentation." msgstr "" -#: ../../library/logging.rst:1210 +#: ../../library/logging.rst:1213 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1216 +#: ../../library/logging.rst:1219 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1219 +#: ../../library/logging.rst:1222 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1226 +#: ../../library/logging.rst:1229 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1232 +#: ../../library/logging.rst:1235 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1238 +#: ../../library/logging.rst:1241 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1814,13 +1821,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1244 +#: ../../library/logging.rst:1247 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1249 +#: ../../library/logging.rst:1252 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1834,7 +1841,7 @@ msgid "" "individual loggers." msgstr "" -#: ../../library/logging.rst:1260 +#: ../../library/logging.rst:1263 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1842,13 +1849,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1265 +#: ../../library/logging.rst:1268 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1271 +#: ../../library/logging.rst:1274 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1858,24 +1865,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1278 +#: ../../library/logging.rst:1281 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1283 +#: ../../library/logging.rst:1286 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1291 +#: ../../library/logging.rst:1294 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1293 +#: ../../library/logging.rst:1296 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1885,20 +1892,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1300 +#: ../../library/logging.rst:1303 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1304 +#: ../../library/logging.rst:1307 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1307 +#: ../../library/logging.rst:1310 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1907,7 +1914,7 @@ msgid "" "vice versa." msgstr "" -#: ../../library/logging.rst:1313 +#: ../../library/logging.rst:1316 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1915,17 +1922,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1321 +#: ../../library/logging.rst:1324 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1328 +#: ../../library/logging.rst:1331 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1334 +#: ../../library/logging.rst:1337 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1933,7 +1940,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1342 +#: ../../library/logging.rst:1345 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1942,13 +1949,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1348 +#: ../../library/logging.rst:1351 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1351 +#: ../../library/logging.rst:1354 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1957,54 +1964,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1358 +#: ../../library/logging.rst:1361 msgid "The following keyword arguments are supported." msgstr "支援以下的關鍵字引數。" -#: ../../library/logging.rst:1365 +#: ../../library/logging.rst:1368 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1365 +#: ../../library/logging.rst:1368 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1372 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1372 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1373 +#: ../../library/logging.rst:1376 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1373 +#: ../../library/logging.rst:1376 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1378 +#: ../../library/logging.rst:1381 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1378 +#: ../../library/logging.rst:1381 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1384 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1384 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1392 +#: ../../library/logging.rst:1395 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1392 +#: ../../library/logging.rst:1395 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1401 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1401 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2044,33 +2051,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1407 +#: ../../library/logging.rst:1410 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1407 +#: ../../library/logging.rst:1410 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1413 +#: ../../library/logging.rst:1416 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1413 +#: ../../library/logging.rst:1416 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1418 +#: ../../library/logging.rst:1421 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1418 +#: ../../library/logging.rst:1421 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -2079,39 +2086,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1429 +#: ../../library/logging.rst:1432 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1432 +#: ../../library/logging.rst:1435 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1438 +#: ../../library/logging.rst:1441 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1441 +#: ../../library/logging.rst:1444 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1446 +#: ../../library/logging.rst:1449 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1450 +#: ../../library/logging.rst:1453 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1457 +#: ../../library/logging.rst:1460 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -2123,32 +2130,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1468 +#: ../../library/logging.rst:1471 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1470 +#: ../../library/logging.rst:1473 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1472 +#: ../../library/logging.rst:1475 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1477 +#: ../../library/logging.rst:1480 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1479 +#: ../../library/logging.rst:1482 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1481 +#: ../../library/logging.rst:1484 msgid "The logger name." msgstr "" @@ -2156,7 +2163,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1482 +#: ../../library/logging.rst:1485 msgid "The logging level (numeric)." msgstr "" @@ -2164,7 +2171,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1483 +#: ../../library/logging.rst:1486 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2172,19 +2179,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1484 +#: ../../library/logging.rst:1487 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1485 +#: ../../library/logging.rst:1488 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1486 +#: ../../library/logging.rst:1489 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1490 msgid "An exception tuple, or ``None``." msgstr "" @@ -2192,7 +2199,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1488 +#: ../../library/logging.rst:1491 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2200,7 +2207,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1490 +#: ../../library/logging.rst:1493 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2210,15 +2217,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1492 +#: ../../library/logging.rst:1495 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1496 +#: ../../library/logging.rst:1499 msgid "Module-Level Attributes" msgstr "模組層級屬性" -#: ../../library/logging.rst:1500 +#: ../../library/logging.rst:1503 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2229,15 +2236,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1512 +#: ../../library/logging.rst:1515 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1514 +#: ../../library/logging.rst:1517 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1516 +#: ../../library/logging.rst:1519 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2245,22 +2252,22 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1523 +#: ../../library/logging.rst:1526 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1525 +#: ../../library/logging.rst:1528 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1530 +#: ../../library/logging.rst:1533 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1533 +#: ../../library/logging.rst:1536 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2269,46 +2276,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1538 +#: ../../library/logging.rst:1541 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1545 +#: ../../library/logging.rst:1548 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.rst:1546 +#: ../../library/logging.rst:1549 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1548 +#: ../../library/logging.rst:1551 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.rst:1549 +#: ../../library/logging.rst:1552 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1551 +#: ../../library/logging.rst:1554 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1552 +#: ../../library/logging.rst:1555 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1555 +#: ../../library/logging.rst:1558 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1556 +#: ../../library/logging.rst:1559 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " diff --git a/library/mailbox.po b/library/mailbox.po index 5a8a09d14a..44c110bdc8 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-24 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -426,7 +426,7 @@ msgid "" "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:654 +#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:669 msgid "Return a list of the names of all folders." msgstr "" @@ -443,7 +443,7 @@ msgid "" "instance representing it." msgstr "" -#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:672 +#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:687 msgid "" "Delete the folder whose name is *folder*. If the folder contains any " "messages, a :exc:`NotEmptyError` exception will be raised and the folder " @@ -664,55 +664,64 @@ msgid "" "remarks:" msgstr "" -#: ../../library/mailbox.rst:592 +#: ../../library/mailbox.rst:592 ../../library/mailbox.rst:602 +#: ../../library/mailbox.rst:608 ../../library/mailbox.rst:871 +#: ../../library/mailbox.rst:881 +msgid "" +"Note: This method has an extra parameter (*from_*) compared with other " +"classes. The first line of an mbox file entry is the Unix \"From \" line. If " +"*from_* is False, the first line of the file is dropped." +msgstr "" + +#: ../../library/mailbox.rst:598 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!mbox` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:600 ../../library/mailbox.rst:813 -#: ../../library/mailbox.rst:864 +#: ../../library/mailbox.rst:615 ../../library/mailbox.rst:828 +#: ../../library/mailbox.rst:889 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls." msgstr "" -#: ../../library/mailbox.rst:606 +#: ../../library/mailbox.rst:621 msgid "" "`mbox man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:607 +#: ../../library/mailbox.rst:622 msgid "A specification of the format, with details on locking." msgstr "" -#: ../../library/mailbox.rst:609 +#: ../../library/mailbox.rst:624 msgid "" "`Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad " "`_" msgstr "" -#: ../../library/mailbox.rst:610 +#: ../../library/mailbox.rst:625 msgid "An argument for using the original mbox format rather than a variation." msgstr "" -#: ../../library/mailbox.rst:612 +#: ../../library/mailbox.rst:627 msgid "" "`\"mbox\" is a family of several mutually incompatible mailbox formats " "`_" msgstr "" -#: ../../library/mailbox.rst:613 +#: ../../library/mailbox.rst:628 msgid "A history of mbox variations." msgstr "" -#: ../../library/mailbox.rst:619 +#: ../../library/mailbox.rst:634 msgid ":class:`!MH` objects" msgstr ":class:`!MH` 物件" -#: ../../library/mailbox.rst:624 +#: ../../library/mailbox.rst:639 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -722,7 +731,7 @@ msgid "" "is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:631 +#: ../../library/mailbox.rst:646 msgid "" "MH is a directory-based mailbox format invented for the MH Message Handling " "System, a mail user agent. Each message in an MH mailbox resides in its own " @@ -733,7 +742,7 @@ msgid "" "called :file:`.mh_sequences` in each folder." msgstr "" -#: ../../library/mailbox.rst:639 +#: ../../library/mailbox.rst:654 msgid "" "The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to " "emulate all of :program:`mh`'s behaviors. In particular, it does not modify " @@ -741,67 +750,67 @@ msgid "" "are used by :program:`mh` to store its state and configuration." msgstr "" -#: ../../library/mailbox.rst:644 +#: ../../library/mailbox.rst:659 msgid "" ":class:`!MH` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:649 +#: ../../library/mailbox.rst:664 msgid "Supported folders that don't contain a :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:659 +#: ../../library/mailbox.rst:674 msgid "" "Return an :class:`!MH` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: ../../library/mailbox.rst:666 +#: ../../library/mailbox.rst:681 msgid "" "Create a folder whose name is *folder* and return an :class:`!MH` instance " "representing it." msgstr "" -#: ../../library/mailbox.rst:679 +#: ../../library/mailbox.rst:694 msgid "" "Return a dictionary of sequence names mapped to key lists. If there are no " "sequences, the empty dictionary is returned." msgstr "" -#: ../../library/mailbox.rst:685 +#: ../../library/mailbox.rst:700 msgid "" "Re-define the sequences that exist in the mailbox based upon *sequences*, a " "dictionary of names mapped to key lists, like returned by :meth:" "`get_sequences`." msgstr "" -#: ../../library/mailbox.rst:692 +#: ../../library/mailbox.rst:707 msgid "" "Rename messages in the mailbox as necessary to eliminate gaps in numbering. " "Entries in the sequences list are updated correspondingly." msgstr "" -#: ../../library/mailbox.rst:697 +#: ../../library/mailbox.rst:712 msgid "" "Already-issued keys are invalidated by this operation and should not be " "subsequently used." msgstr "" -#: ../../library/mailbox.rst:700 +#: ../../library/mailbox.rst:715 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MH` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:708 +#: ../../library/mailbox.rst:723 msgid "" "These methods immediately delete the message. The MH convention of marking a " "message for deletion by prepending a comma to its name is not used." msgstr "" -#: ../../library/mailbox.rst:715 +#: ../../library/mailbox.rst:730 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls. For MH mailboxes, locking " @@ -810,51 +819,51 @@ msgid "" "files." msgstr "" -#: ../../library/mailbox.rst:724 +#: ../../library/mailbox.rst:739 msgid "" "Depending upon the host platform, it may not be possible to remove the " "underlying message while the returned file remains open." msgstr "" -#: ../../library/mailbox.rst:730 +#: ../../library/mailbox.rst:745 msgid "" "All changes to MH mailboxes are immediately applied, so this method does " "nothing." msgstr "" -#: ../../library/mailbox.rst:736 +#: ../../library/mailbox.rst:751 msgid "" ":class:`!MH` instances do not keep any open files, so this method is " "equivalent to :meth:`unlock`." msgstr "" -#: ../../library/mailbox.rst:742 +#: ../../library/mailbox.rst:757 msgid "`nmh - Message Handling System `_" msgstr "" -#: ../../library/mailbox.rst:743 +#: ../../library/mailbox.rst:758 msgid "" "Home page of :program:`nmh`, an updated version of the original :program:" "`mh`." msgstr "" -#: ../../library/mailbox.rst:745 +#: ../../library/mailbox.rst:760 msgid "" "`MH & nmh: Email for Users & Programmers `_" msgstr "" -#: ../../library/mailbox.rst:746 +#: ../../library/mailbox.rst:761 msgid "" "A GPL-licensed book on :program:`mh` and :program:`nmh`, with some " "information on the mailbox format." msgstr "" -#: ../../library/mailbox.rst:753 +#: ../../library/mailbox.rst:768 msgid ":class:`!Babyl` objects" msgstr ":class:`!Babyl` 物件" -#: ../../library/mailbox.rst:758 +#: ../../library/mailbox.rst:773 msgid "" "A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -864,7 +873,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:765 +#: ../../library/mailbox.rst:780 msgid "" "Babyl is a single-file mailbox format used by the Rmail mail user agent " "included with Emacs. The beginning of a message is indicated by a line " @@ -874,7 +883,7 @@ msgid "" "Underscore (``'\\037'``) character." msgstr "" -#: ../../library/mailbox.rst:772 +#: ../../library/mailbox.rst:787 msgid "" "Messages in a Babyl mailbox have two sets of headers, original headers and " "so-called visible headers. Visible headers are typically a subset of the " @@ -885,31 +894,31 @@ msgid "" "in the Babyl options section." msgstr "" -#: ../../library/mailbox.rst:780 +#: ../../library/mailbox.rst:795 msgid "" ":class:`!Babyl` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:786 +#: ../../library/mailbox.rst:801 msgid "" "Return a list of the names of all user-defined labels used in the mailbox." msgstr "" -#: ../../library/mailbox.rst:790 +#: ../../library/mailbox.rst:805 msgid "" "The actual messages are inspected to determine which labels exist in the " "mailbox rather than consulting the list of labels in the Babyl options " "section, but the Babyl section is updated whenever the mailbox is modified." msgstr "" -#: ../../library/mailbox.rst:795 +#: ../../library/mailbox.rst:810 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Babyl` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:801 +#: ../../library/mailbox.rst:816 msgid "" "In Babyl mailboxes, the headers of a message are not stored contiguously " "with the body of the message. To generate a file-like representation, the " @@ -919,30 +928,30 @@ msgid "" "memory compared to a string representation." msgstr "" -#: ../../library/mailbox.rst:819 +#: ../../library/mailbox.rst:834 msgid "" "`Format of Version 5 Babyl Files `_" msgstr "" -#: ../../library/mailbox.rst:820 +#: ../../library/mailbox.rst:835 msgid "A specification of the Babyl format." msgstr "" -#: ../../library/mailbox.rst:822 +#: ../../library/mailbox.rst:837 msgid "" "`Reading Mail with Rmail `_" msgstr "" -#: ../../library/mailbox.rst:823 +#: ../../library/mailbox.rst:838 msgid "The Rmail manual, with some information on Babyl semantics." msgstr "" -#: ../../library/mailbox.rst:829 +#: ../../library/mailbox.rst:844 msgid ":class:`!MMDF` objects" msgstr ":class:`!MMDF` 物件" -#: ../../library/mailbox.rst:834 +#: ../../library/mailbox.rst:849 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -952,7 +961,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:841 +#: ../../library/mailbox.rst:856 msgid "" "MMDF is a single-file mailbox format invented for the Multichannel " "Memorandum Distribution Facility, a mail transfer agent. Each message is in " @@ -965,52 +974,52 @@ msgid "" "subsequent messages." msgstr "" -#: ../../library/mailbox.rst:850 +#: ../../library/mailbox.rst:865 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MMDF` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:856 +#: ../../library/mailbox.rst:877 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!MMDF` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:870 +#: ../../library/mailbox.rst:895 msgid "" "`mmdf man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:871 +#: ../../library/mailbox.rst:896 msgid "" "A specification of MMDF format from the documentation of tin, a newsreader." msgstr "" -#: ../../library/mailbox.rst:873 +#: ../../library/mailbox.rst:898 msgid "`MMDF `_" msgstr "`MMDF `_" -#: ../../library/mailbox.rst:874 +#: ../../library/mailbox.rst:899 msgid "" "A Wikipedia article describing the Multichannel Memorandum Distribution " "Facility." msgstr "" -#: ../../library/mailbox.rst:881 +#: ../../library/mailbox.rst:906 msgid ":class:`!Message` objects" msgstr ":class:`!Message` 物件" -#: ../../library/mailbox.rst:886 +#: ../../library/mailbox.rst:911 msgid "" "A subclass of the :mod:`email.message` module's :class:`~email.message." "Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-" "specific state and behavior." msgstr "" -#: ../../library/mailbox.rst:890 +#: ../../library/mailbox.rst:915 msgid "" "If *message* is omitted, the new instance is created in a default, empty " "state. If *message* is an :class:`email.message.Message` instance, its " @@ -1022,7 +1031,7 @@ msgid "" "compatibility." msgstr "" -#: ../../library/mailbox.rst:899 +#: ../../library/mailbox.rst:924 msgid "" "The format-specific state and behaviors offered by subclasses vary, but in " "general it is only the properties that are not specific to a particular " @@ -1034,7 +1043,7 @@ msgid "" "important is retained, because it applies to the message itself." msgstr "" -#: ../../library/mailbox.rst:908 +#: ../../library/mailbox.rst:933 msgid "" "There is no requirement that :class:`!Message` instances be used to " "represent messages retrieved using :class:`Mailbox` instances. In some " @@ -1045,17 +1054,17 @@ msgid "" "initialized." msgstr "" -#: ../../library/mailbox.rst:919 +#: ../../library/mailbox.rst:944 msgid ":class:`!MaildirMessage` objects" msgstr ":class:`!MaildirMessage` 物件" -#: ../../library/mailbox.rst:924 +#: ../../library/mailbox.rst:949 msgid "" "A message with Maildir-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:927 +#: ../../library/mailbox.rst:952 msgid "" "Typically, a mail user agent application moves all of the messages in the :" "file:`new` subdirectory to the :file:`cur` subdirectory after the first time " @@ -1069,128 +1078,128 @@ msgid "" "flags for Maildir messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1502 msgid "Flag" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1502 msgid "Meaning" msgstr "含義" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1257 ../../library/mailbox.rst:1344 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1282 ../../library/mailbox.rst:1369 +#: ../../library/mailbox.rst:1502 msgid "Explanation" msgstr "" -#: ../../library/mailbox.rst:941 ../../library/mailbox.rst:1112 -#: ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:966 ../../library/mailbox.rst:1137 +#: ../../library/mailbox.rst:1508 msgid "D" msgstr "D" -#: ../../library/mailbox.rst:941 +#: ../../library/mailbox.rst:966 msgid "Draft" msgstr "" -#: ../../library/mailbox.rst:941 +#: ../../library/mailbox.rst:966 msgid "Under composition" msgstr "" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1510 msgid "F" msgstr "F" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1510 msgid "Flagged" msgstr "" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1263 ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1288 ../../library/mailbox.rst:1510 msgid "Marked as important" msgstr "" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "P" msgstr "P" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "Passed" msgstr "" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "Forwarded, resent, or bounced" msgstr "" -#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1479 +#: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1504 msgid "R" msgstr "R" -#: ../../library/mailbox.rst:947 +#: ../../library/mailbox.rst:972 msgid "Replied" msgstr "" -#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1116 -#: ../../library/mailbox.rst:1261 ../../library/mailbox.rst:1352 -#: ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1141 +#: ../../library/mailbox.rst:1286 ../../library/mailbox.rst:1377 +#: ../../library/mailbox.rst:1512 msgid "Replied to" msgstr "" -#: ../../library/mailbox.rst:949 +#: ../../library/mailbox.rst:974 msgid "S" msgstr "S" -#: ../../library/mailbox.rst:949 +#: ../../library/mailbox.rst:974 msgid "Seen" msgstr "" -#: ../../library/mailbox.rst:949 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1479 +#: ../../library/mailbox.rst:974 ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1504 msgid "Read" msgstr "" -#: ../../library/mailbox.rst:951 +#: ../../library/mailbox.rst:976 msgid "T" msgstr "T" -#: ../../library/mailbox.rst:951 +#: ../../library/mailbox.rst:976 msgid "Trashed" msgstr "" -#: ../../library/mailbox.rst:951 ../../library/mailbox.rst:1112 -#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:976 ../../library/mailbox.rst:1137 +#: ../../library/mailbox.rst:1373 ../../library/mailbox.rst:1508 msgid "Marked for subsequent deletion" msgstr "" -#: ../../library/mailbox.rst:954 +#: ../../library/mailbox.rst:979 msgid ":class:`!MaildirMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:959 +#: ../../library/mailbox.rst:984 msgid "" "Return either \"new\" (if the message should be stored in the :file:`new` " "subdirectory) or \"cur\" (if the message should be stored in the :file:`cur` " "subdirectory)." msgstr "" -#: ../../library/mailbox.rst:965 +#: ../../library/mailbox.rst:990 msgid "" "A message is typically moved from :file:`new` to :file:`cur` after its " "mailbox has been accessed, whether or not the message has been read. A " "message ``msg`` has been read if ``\"S\" in msg.get_flags()`` is ``True``." msgstr "" -#: ../../library/mailbox.rst:973 +#: ../../library/mailbox.rst:998 msgid "" "Set the subdirectory the message should be stored in. Parameter *subdir* " "must be either \"new\" or \"cur\"." msgstr "" -#: ../../library/mailbox.rst:979 +#: ../../library/mailbox.rst:1004 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the standard Maildir format, the result is the concatenation " @@ -1199,11 +1208,11 @@ msgid "" "flags are set or if \"info\" contains experimental semantics." msgstr "" -#: ../../library/mailbox.rst:989 +#: ../../library/mailbox.rst:1014 msgid "Set the flags specified by *flags* and unset all others." msgstr "" -#: ../../library/mailbox.rst:994 +#: ../../library/mailbox.rst:1019 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " @@ -1211,7 +1220,7 @@ msgid "" "experimental information rather than flags." msgstr "" -#: ../../library/mailbox.rst:1002 +#: ../../library/mailbox.rst:1027 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " @@ -1219,30 +1228,30 @@ msgid "" "the current \"info\" is not modified." msgstr "" -#: ../../library/mailbox.rst:1010 +#: ../../library/mailbox.rst:1035 msgid "" "Return the delivery date of the message as a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:1016 +#: ../../library/mailbox.rst:1041 msgid "" "Set the delivery date of the message to *date*, a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:1022 +#: ../../library/mailbox.rst:1047 msgid "" "Return a string containing the \"info\" for a message. This is useful for " "accessing and modifying \"info\" that is experimental (i.e., not a list of " "flags)." msgstr "" -#: ../../library/mailbox.rst:1029 +#: ../../library/mailbox.rst:1054 msgid "Set \"info\" to *info*, which should be a string." msgstr "" -#: ../../library/mailbox.rst:1031 +#: ../../library/mailbox.rst:1056 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1250,176 +1259,176 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1055 -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1177 -#: ../../library/mailbox.rst:1194 ../../library/mailbox.rst:1209 -#: ../../library/mailbox.rst:1225 ../../library/mailbox.rst:1292 -#: ../../library/mailbox.rst:1307 ../../library/mailbox.rst:1321 -#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1435 -#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1549 -#: ../../library/mailbox.rst:1566 ../../library/mailbox.rst:1581 -#: ../../library/mailbox.rst:1597 +#: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1080 +#: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1202 +#: ../../library/mailbox.rst:1219 ../../library/mailbox.rst:1234 +#: ../../library/mailbox.rst:1250 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1332 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1460 +#: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1574 +#: ../../library/mailbox.rst:1591 ../../library/mailbox.rst:1606 +#: ../../library/mailbox.rst:1622 msgid "Resulting state" msgstr "" -#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1307 -#: ../../library/mailbox.rst:1435 +#: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1332 +#: ../../library/mailbox.rst:1460 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1057 -#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1181 -#: ../../library/mailbox.rst:1553 +#: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1082 +#: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1206 +#: ../../library/mailbox.rst:1578 msgid "\"cur\" subdirectory" msgstr "" -#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1181 -#: ../../library/mailbox.rst:1198 ../../library/mailbox.rst:1213 -#: ../../library/mailbox.rst:1229 ../../library/mailbox.rst:1553 -#: ../../library/mailbox.rst:1570 ../../library/mailbox.rst:1585 -#: ../../library/mailbox.rst:1601 +#: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1206 +#: ../../library/mailbox.rst:1223 ../../library/mailbox.rst:1238 +#: ../../library/mailbox.rst:1254 ../../library/mailbox.rst:1578 +#: ../../library/mailbox.rst:1595 ../../library/mailbox.rst:1610 +#: ../../library/mailbox.rst:1626 msgid "O flag" msgstr "" -#: ../../library/mailbox.rst:1042 ../../library/mailbox.rst:1061 -#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1200 -#: ../../library/mailbox.rst:1233 ../../library/mailbox.rst:1298 -#: ../../library/mailbox.rst:1314 ../../library/mailbox.rst:1557 -#: ../../library/mailbox.rst:1572 ../../library/mailbox.rst:1605 +#: ../../library/mailbox.rst:1067 ../../library/mailbox.rst:1086 +#: ../../library/mailbox.rst:1210 ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1258 ../../library/mailbox.rst:1323 +#: ../../library/mailbox.rst:1339 ../../library/mailbox.rst:1582 +#: ../../library/mailbox.rst:1597 ../../library/mailbox.rst:1630 msgid "F flag" msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1046 -#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1078 -#: ../../library/mailbox.rst:1179 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1296 -#: ../../library/mailbox.rst:1424 ../../library/mailbox.rst:1551 -#: ../../library/mailbox.rst:1559 ../../library/mailbox.rst:1599 +#: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1071 +#: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1103 +#: ../../library/mailbox.rst:1204 ../../library/mailbox.rst:1212 +#: ../../library/mailbox.rst:1252 ../../library/mailbox.rst:1321 +#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1576 +#: ../../library/mailbox.rst:1584 ../../library/mailbox.rst:1624 msgid "R flag" msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1217 -#: ../../library/mailbox.rst:1235 ../../library/mailbox.rst:1312 -#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1559 -#: ../../library/mailbox.rst:1574 ../../library/mailbox.rst:1589 -#: ../../library/mailbox.rst:1607 +#: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1212 +#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1260 ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1467 ../../library/mailbox.rst:1584 +#: ../../library/mailbox.rst:1599 ../../library/mailbox.rst:1614 +#: ../../library/mailbox.rst:1632 msgid "A flag" msgstr "" -#: ../../library/mailbox.rst:1046 ../../library/mailbox.rst:1179 -#: ../../library/mailbox.rst:1551 +#: ../../library/mailbox.rst:1071 ../../library/mailbox.rst:1204 +#: ../../library/mailbox.rst:1576 msgid "S flag" msgstr "" -#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1080 -#: ../../library/mailbox.rst:1183 ../../library/mailbox.rst:1422 -#: ../../library/mailbox.rst:1555 +#: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1105 +#: ../../library/mailbox.rst:1208 ../../library/mailbox.rst:1447 +#: ../../library/mailbox.rst:1580 msgid "T flag" msgstr "" -#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1183 -#: ../../library/mailbox.rst:1215 ../../library/mailbox.rst:1231 -#: ../../library/mailbox.rst:1440 ../../library/mailbox.rst:1555 -#: ../../library/mailbox.rst:1587 ../../library/mailbox.rst:1603 +#: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1208 +#: ../../library/mailbox.rst:1240 ../../library/mailbox.rst:1256 +#: ../../library/mailbox.rst:1465 ../../library/mailbox.rst:1580 +#: ../../library/mailbox.rst:1612 ../../library/mailbox.rst:1628 msgid "D flag" msgstr "" -#: ../../library/mailbox.rst:1051 +#: ../../library/mailbox.rst:1076 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1055 ../../library/mailbox.rst:1194 -#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1566 +#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1219 +#: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1591 msgid ":class:`MHMessage` state" msgstr "" -#: ../../library/mailbox.rst:1057 ../../library/mailbox.rst:1198 -#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1310 -#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1451 -#: ../../library/mailbox.rst:1570 +#: ../../library/mailbox.rst:1082 ../../library/mailbox.rst:1223 +#: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1335 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1595 msgid "\"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1074 +#: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1099 msgid "\"cur\" subdirectory and S flag" msgstr "" -#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1196 -#: ../../library/mailbox.rst:1568 +#: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1221 +#: ../../library/mailbox.rst:1593 msgid "no \"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:1061 ../../library/mailbox.rst:1200 -#: ../../library/mailbox.rst:1298 ../../library/mailbox.rst:1314 -#: ../../library/mailbox.rst:1572 +#: ../../library/mailbox.rst:1086 ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1339 +#: ../../library/mailbox.rst:1597 msgid "\"flagged\" sequence" msgstr "" -#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1202 -#: ../../library/mailbox.rst:1296 ../../library/mailbox.rst:1312 -#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1453 -#: ../../library/mailbox.rst:1574 +#: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1227 +#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1599 msgid "\"replied\" sequence" msgstr "" -#: ../../library/mailbox.rst:1066 +#: ../../library/mailbox.rst:1091 msgid "" "When a :class:`!MaildirMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1209 -#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1581 +#: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1234 +#: ../../library/mailbox.rst:1346 ../../library/mailbox.rst:1606 msgid ":class:`BabylMessage` state" msgstr "" -#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1213 -#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1420 -#: ../../library/mailbox.rst:1438 ../../library/mailbox.rst:1451 -#: ../../library/mailbox.rst:1585 +#: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1238 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1445 +#: ../../library/mailbox.rst:1463 ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1610 msgid "\"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:1074 ../../library/mailbox.rst:1211 -#: ../../library/mailbox.rst:1583 +#: ../../library/mailbox.rst:1099 ../../library/mailbox.rst:1236 +#: ../../library/mailbox.rst:1608 msgid "no \"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:1076 ../../library/mailbox.rst:1426 +#: ../../library/mailbox.rst:1101 ../../library/mailbox.rst:1451 msgid "P flag" msgstr "" -#: ../../library/mailbox.rst:1076 +#: ../../library/mailbox.rst:1101 msgid "\"forwarded\" or \"resent\" label" msgstr "" -#: ../../library/mailbox.rst:1078 ../../library/mailbox.rst:1217 -#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1424 -#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1453 -#: ../../library/mailbox.rst:1589 +#: ../../library/mailbox.rst:1103 ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1449 +#: ../../library/mailbox.rst:1467 ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1614 msgid "\"answered\" label" msgstr "" -#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1215 -#: ../../library/mailbox.rst:1422 ../../library/mailbox.rst:1440 -#: ../../library/mailbox.rst:1587 +#: ../../library/mailbox.rst:1105 ../../library/mailbox.rst:1240 +#: ../../library/mailbox.rst:1447 ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1612 msgid "\"deleted\" label" msgstr "" -#: ../../library/mailbox.rst:1087 +#: ../../library/mailbox.rst:1112 msgid ":class:`!mboxMessage` objects" msgstr ":class:`!mboxMessage` 物件" -#: ../../library/mailbox.rst:1092 +#: ../../library/mailbox.rst:1117 msgid "" "A message with mbox-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1095 +#: ../../library/mailbox.rst:1120 msgid "" "Messages in an mbox mailbox are stored together in a single file. The " "sender's envelope address and the time of delivery are typically stored in a " @@ -1430,53 +1439,53 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1103 +#: ../../library/mailbox.rst:1128 msgid "Conventional flags for mbox messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "O" msgstr "O" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "Old" msgstr "" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "Previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1112 ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:1137 ../../library/mailbox.rst:1508 msgid "Deleted" msgstr "" -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:1141 ../../library/mailbox.rst:1512 msgid "A" msgstr "A" -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:1141 ../../library/mailbox.rst:1512 msgid "Answered" msgstr "" -#: ../../library/mailbox.rst:1119 ../../library/mailbox.rst:1490 +#: ../../library/mailbox.rst:1144 ../../library/mailbox.rst:1515 msgid "" "The \"R\" and \"O\" flags are stored in the :mailheader:`Status` header, and " "the \"D\", \"F\", and \"A\" flags are stored in the :mailheader:`X-Status` " "header. The flags and headers typically appear in the order mentioned." msgstr "" -#: ../../library/mailbox.rst:1123 +#: ../../library/mailbox.rst:1148 msgid ":class:`!mboxMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1128 ../../library/mailbox.rst:1500 +#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 msgid "" "Return a string representing the \"From \" line that marks the start of the " "message in an mbox mailbox. The leading \"From \" and the trailing newline " "are excluded." msgstr "" -#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1507 +#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 msgid "" "Set the \"From \" line to *from_*, which should be specified without a " "leading \"From \" or trailing newline. For convenience, *time_* may be " @@ -1486,7 +1495,7 @@ msgid "" "func:`time.gmtime`)." msgstr "" -#: ../../library/mailbox.rst:1145 ../../library/mailbox.rst:1517 +#: ../../library/mailbox.rst:1170 ../../library/mailbox.rst:1542 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the conventional format, the result is the concatenation in " @@ -1494,28 +1503,28 @@ msgid "" "``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 +#: ../../library/mailbox.rst:1178 ../../library/mailbox.rst:1550 msgid "" "Set the flags specified by *flags* and unset all others. Parameter *flags* " "should be the concatenation in any order of zero or more occurrences of each " "of ``'R'``, ``'O'``, ``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 +#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1557 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1167 ../../library/mailbox.rst:1539 +#: ../../library/mailbox.rst:1192 ../../library/mailbox.rst:1564 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1171 +#: ../../library/mailbox.rst:1196 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1523,50 +1532,50 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1177 ../../library/mailbox.rst:1292 -#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1549 +#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1574 msgid ":class:`MaildirMessage` state" msgstr "" -#: ../../library/mailbox.rst:1190 +#: ../../library/mailbox.rst:1215 msgid "" "When an :class:`!mboxMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1196 ../../library/mailbox.rst:1211 -#: ../../library/mailbox.rst:1568 ../../library/mailbox.rst:1583 +#: ../../library/mailbox.rst:1221 ../../library/mailbox.rst:1236 +#: ../../library/mailbox.rst:1593 ../../library/mailbox.rst:1608 msgid "R flag and O flag" msgstr "" -#: ../../library/mailbox.rst:1205 +#: ../../library/mailbox.rst:1230 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1220 +#: ../../library/mailbox.rst:1245 msgid "" "When a :class:`!mboxMessage` instance is created based upon an :class:" "`MMDFMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1250 msgid ":class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1267 msgid ":class:`!MHMessage` objects" msgstr ":class:`!MHMessage` 物件" -#: ../../library/mailbox.rst:1247 +#: ../../library/mailbox.rst:1272 msgid "" "A message with MH-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1250 +#: ../../library/mailbox.rst:1275 msgid "" "MH messages do not support marks or flags in the traditional sense, but they " "do support sequences, which are logical groupings of arbitrary messages. " @@ -1575,57 +1584,57 @@ msgid "" "formats, as follows:" msgstr "" -#: ../../library/mailbox.rst:1257 +#: ../../library/mailbox.rst:1282 msgid "Sequence" msgstr "" -#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1284 ../../library/mailbox.rst:1371 msgid "unseen" msgstr "" -#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1284 ../../library/mailbox.rst:1371 msgid "Not read, but previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1261 +#: ../../library/mailbox.rst:1286 msgid "replied" msgstr "" -#: ../../library/mailbox.rst:1263 +#: ../../library/mailbox.rst:1288 msgid "flagged" msgstr "" -#: ../../library/mailbox.rst:1266 +#: ../../library/mailbox.rst:1291 msgid ":class:`!MHMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1271 +#: ../../library/mailbox.rst:1296 msgid "Return a list of the names of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1276 +#: ../../library/mailbox.rst:1301 msgid "Set the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1281 +#: ../../library/mailbox.rst:1306 msgid "Add *sequence* to the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1286 +#: ../../library/mailbox.rst:1311 msgid "Remove *sequence* from the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1288 +#: ../../library/mailbox.rst:1313 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1420 +#: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1445 msgid "no S flag" msgstr "" -#: ../../library/mailbox.rst:1301 +#: ../../library/mailbox.rst:1326 msgid "" "When an :class:`!MHMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1633,110 +1642,110 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1310 ../../library/mailbox.rst:1438 +#: ../../library/mailbox.rst:1335 ../../library/mailbox.rst:1463 msgid "no R flag" msgstr "" -#: ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1342 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1332 +#: ../../library/mailbox.rst:1357 msgid ":class:`!BabylMessage` objects" msgstr ":class:`!BabylMessage` 物件" -#: ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1362 msgid "" "A message with Babyl-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1340 +#: ../../library/mailbox.rst:1365 msgid "" "Certain message labels, called :dfn:`attributes`, are defined by convention " "to have special meanings. The attributes are as follows:" msgstr "" -#: ../../library/mailbox.rst:1344 +#: ../../library/mailbox.rst:1369 msgid "Label" msgstr "" -#: ../../library/mailbox.rst:1348 +#: ../../library/mailbox.rst:1373 msgid "deleted" msgstr "" -#: ../../library/mailbox.rst:1350 +#: ../../library/mailbox.rst:1375 msgid "filed" msgstr "" -#: ../../library/mailbox.rst:1350 +#: ../../library/mailbox.rst:1375 msgid "Copied to another file or mailbox" msgstr "" -#: ../../library/mailbox.rst:1352 +#: ../../library/mailbox.rst:1377 msgid "answered" msgstr "" -#: ../../library/mailbox.rst:1354 +#: ../../library/mailbox.rst:1379 msgid "forwarded" msgstr "" -#: ../../library/mailbox.rst:1354 +#: ../../library/mailbox.rst:1379 msgid "Forwarded" msgstr "" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1381 msgid "edited" msgstr "" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1381 msgid "Modified by the user" msgstr "" -#: ../../library/mailbox.rst:1358 +#: ../../library/mailbox.rst:1383 msgid "resent" msgstr "" -#: ../../library/mailbox.rst:1358 +#: ../../library/mailbox.rst:1383 msgid "Resent" msgstr "" -#: ../../library/mailbox.rst:1361 +#: ../../library/mailbox.rst:1386 msgid "" "By default, Rmail displays only visible headers. The :class:`!BabylMessage` " "class, though, uses the original headers because they are more complete. " "Visible headers may be accessed explicitly if desired." msgstr "" -#: ../../library/mailbox.rst:1365 +#: ../../library/mailbox.rst:1390 msgid ":class:`!BabylMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1370 +#: ../../library/mailbox.rst:1395 msgid "Return a list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1375 +#: ../../library/mailbox.rst:1400 msgid "Set the list of labels on the message to *labels*." msgstr "" -#: ../../library/mailbox.rst:1380 +#: ../../library/mailbox.rst:1405 msgid "Add *label* to the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1385 +#: ../../library/mailbox.rst:1410 msgid "Remove *label* from the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1390 +#: ../../library/mailbox.rst:1415 msgid "" "Return a :class:`Message` instance whose headers are the message's visible " "headers and whose body is empty." msgstr "" -#: ../../library/mailbox.rst:1396 +#: ../../library/mailbox.rst:1421 msgid "" "Set the message's visible headers to be the same as the headers in " "*message*. Parameter *visible* should be a :class:`Message` instance, an :" @@ -1744,7 +1753,7 @@ msgid "" "(which should be open in text mode)." msgstr "" -#: ../../library/mailbox.rst:1404 +#: ../../library/mailbox.rst:1429 msgid "" "When a :class:`!BabylMessage` instance's original headers are modified, the " "visible headers are not automatically modified to correspond. This method " @@ -1757,17 +1766,17 @@ msgid "" "visible headers." msgstr "" -#: ../../library/mailbox.rst:1414 +#: ../../library/mailbox.rst:1439 msgid "" "When a :class:`!BabylMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1426 +#: ../../library/mailbox.rst:1451 msgid "\"forwarded\" label" msgstr "" -#: ../../library/mailbox.rst:1429 +#: ../../library/mailbox.rst:1454 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1775,23 +1784,23 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1445 +#: ../../library/mailbox.rst:1470 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1460 +#: ../../library/mailbox.rst:1485 msgid ":class:`!MMDFMessage` objects" msgstr ":class:`!MMDFMessage` 物件" -#: ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1490 msgid "" "A message with MMDF-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1468 +#: ../../library/mailbox.rst:1493 msgid "" "As with message in an mbox mailbox, MMDF messages are stored with the " "sender's address and the delivery date in an initial line beginning with " @@ -1799,19 +1808,19 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1473 +#: ../../library/mailbox.rst:1498 msgid "" "Conventional flags for MMDF messages are identical to those of mbox message " "and are as follows:" msgstr "" -#: ../../library/mailbox.rst:1494 +#: ../../library/mailbox.rst:1519 msgid "" ":class:`!MMDFMessage` instances offer the following methods, which are " "identical to those offered by :class:`mboxMessage`:" msgstr "" -#: ../../library/mailbox.rst:1543 +#: ../../library/mailbox.rst:1568 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1819,43 +1828,43 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1562 +#: ../../library/mailbox.rst:1587 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1577 +#: ../../library/mailbox.rst:1602 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1592 +#: ../../library/mailbox.rst:1617 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`mboxMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1597 +#: ../../library/mailbox.rst:1622 msgid ":class:`mboxMessage` state" msgstr "" -#: ../../library/mailbox.rst:1612 +#: ../../library/mailbox.rst:1637 msgid "Exceptions" msgstr "例外" -#: ../../library/mailbox.rst:1614 +#: ../../library/mailbox.rst:1639 msgid "" "The following exception classes are defined in the :mod:`!mailbox` module:" msgstr "" -#: ../../library/mailbox.rst:1619 +#: ../../library/mailbox.rst:1644 msgid "The based class for all other module-specific exceptions." msgstr "" -#: ../../library/mailbox.rst:1624 +#: ../../library/mailbox.rst:1649 msgid "" "Raised when a mailbox is expected but is not found, such as when " "instantiating a :class:`Mailbox` subclass with a path that does not exist " @@ -1863,13 +1872,13 @@ msgid "" "that does not exist." msgstr "" -#: ../../library/mailbox.rst:1631 +#: ../../library/mailbox.rst:1656 msgid "" "Raised when a mailbox is not empty but is expected to be, such as when " "deleting a folder that contains messages." msgstr "" -#: ../../library/mailbox.rst:1637 +#: ../../library/mailbox.rst:1662 msgid "" "Raised when some mailbox-related condition beyond the control of the program " "causes it to be unable to proceed, such as when failing to acquire a lock " @@ -1877,23 +1886,23 @@ msgid "" "name already exists." msgstr "" -#: ../../library/mailbox.rst:1645 +#: ../../library/mailbox.rst:1670 msgid "" "Raised when the data in a file cannot be parsed, such as when an :class:`MH` " "instance attempts to read a corrupted :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:1652 +#: ../../library/mailbox.rst:1677 msgid "Examples" msgstr "範例" -#: ../../library/mailbox.rst:1654 +#: ../../library/mailbox.rst:1679 msgid "" "A simple example of printing the subjects of all messages in a mailbox that " "seem interesting::" msgstr "" -#: ../../library/mailbox.rst:1657 +#: ../../library/mailbox.rst:1682 msgid "" "import mailbox\n" "for message in mailbox.mbox('~/mbox'):\n" @@ -1907,13 +1916,13 @@ msgstr "" " if subject and 'python' in subject.lower():\n" " print(subject)" -#: ../../library/mailbox.rst:1663 +#: ../../library/mailbox.rst:1688 msgid "" "To copy all mail from a Babyl mailbox to an MH mailbox, converting all of " "the format-specific information that can be converted::" msgstr "" -#: ../../library/mailbox.rst:1666 +#: ../../library/mailbox.rst:1691 msgid "" "import mailbox\n" "destination = mailbox.MH('~/Mail')\n" @@ -1931,7 +1940,7 @@ msgstr "" "destination.flush()\n" "destination.unlock()" -#: ../../library/mailbox.rst:1674 +#: ../../library/mailbox.rst:1699 msgid "" "This example sorts mail from several mailing lists into different mailboxes, " "being careful to avoid mail corruption due to concurrent modification by " @@ -1939,7 +1948,7 @@ msgid "" "termination due to malformed messages in the mailbox::" msgstr "" -#: ../../library/mailbox.rst:1679 +#: ../../library/mailbox.rst:1704 msgid "" "import mailbox\n" "import email.errors\n" diff --git a/library/markup.po b/library/markup.po index 6804f0d603..357746f4d1 100644 --- a/library/markup.po +++ b/library/markup.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -20,7 +19,7 @@ msgstr "" #: ../../library/markup.rst:5 msgid "Structured Markup Processing Tools" -msgstr "" +msgstr "結構化標記處理工具" #: ../../library/markup.rst:7 msgid "" @@ -29,3 +28,7 @@ msgid "" "Generalized Markup Language (SGML) and the Hypertext Markup Language (HTML), " "and several interfaces for working with the Extensible Markup Language (XML)." msgstr "" +"Python 支援多種模組來處理各種形式的結構化資料標記。這包括用於處理標準通用標記" +"語言 (SGML, Standard Generalized Markup Language) 和超文本標記語言 (HTML, " +"Hypertext Markup Language) 的模組,以及用於處理可擴展標記語言 (XML, " +"Extensible Markup Language) 的幾個介面。" diff --git a/library/marshal.po b/library/marshal.po index 03ab684ed4..92d8e87392 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -23,7 +23,7 @@ msgstr "" #: ../../library/marshal.rst:2 msgid ":mod:`!marshal` --- Internal Python object serialization" -msgstr ":mod:`!marshal` --- 内部 Python 物件序列化" +msgstr ":mod:`!marshal` --- 內部 Python 物件序列化" #: ../../library/marshal.rst:10 msgid "" @@ -34,34 +34,35 @@ msgid "" "are undocumented on purpose; it may change between Python versions (although " "it rarely does). [#]_" msgstr "" -"此 module(模組)包含一個能以二進位制格式來讀寫 Python 值的函式。這種格式是 " -"Python 專屬但獨立於機器架構的(例如,你可以在一臺 PC 上寫入某個 Python 值,再" -"將檔案傳到一臺 Mac 上並在那裡讀取它)。這種格式的細節是有意地不在文件上說明" -"的;它可能在不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" +"此模組包含一個能以二進位制格式來讀寫 Python 值的函式。這種格式是 Python 專屬" +"但獨立於機器架構的(例如,你可以在一臺 PC 上寫入某個 Python 值,再將檔案傳到" +"一臺 Mac 上並在那裡讀取它)。這種格式的細節是有意地不在文件上說明的;它可能在" +"不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" #: ../../library/marshal.rst:21 -#, fuzzy msgid "" "This is not a general \"persistence\" module. For general persistence and " "transfer of Python objects through RPC calls, see the modules :mod:`pickle` " "and :mod:`shelve`. The :mod:`marshal` module exists mainly to support " -"reading and writing the \"pseudo-compiled\" code for Python modules of :file:" -"`.pyc` files. Therefore, the Python maintainers reserve the right to modify " -"the marshal format in backward incompatible ways should the need arise. The " -"format of code objects is not compatible between Python versions, even if " -"the version of the format is the same. De-serializing a code object in the " -"incorrect Python version has undefined behavior. If you're serializing and " -"de-serializing Python objects, use the :mod:`pickle` module instead -- the " -"performance is comparable, version independence is guaranteed, and pickle " -"supports a substantially wider range of objects than marshal." +"reading and writing the \"pseudo-compiled\" code for Python modules " +"of :file:`.pyc` files. Therefore, the Python maintainers reserve the right " +"to modify the marshal format in backward incompatible ways should the need " +"arise. The format of code objects is not compatible between Python versions, " +"even if the version of the format is the same. De-serializing a code object " +"in the incorrect Python version has undefined behavior. If you're " +"serializing and de-serializing Python objects, use the :mod:`pickle` module " +"instead -- the performance is comparable, version independence is " +"guaranteed, and pickle supports a substantially wider range of objects than " +"marshal." msgstr "" -"這不是一個通用「持續性 (persistence)」module 。關於通用持續性以及透過 RPC 呼" -"叫傳遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等 module 。:mod:" -"`marshal` module 主要是為了支援用來讀寫「偽編譯 (pseudo-compiled)」 :file:`." -"pyc` 檔案的 Python module。因此,Python 維護者保留了在必要時以不向後相容的方" -"式修改 marshal 格式的權利。如果你要序列化和反序列化 Python 物件,請改用 :mod:" -"`pickle` module -- 其執行效率相當、有保證版本獨立性,且實質上 pickle 還支援" -"比 marshal 更多樣的物件。" +"這不是一個通用「持久性 (persistence)」模組。關於通用持久性以及透過 RPC 呼叫傳" +"遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等模組。:mod:`marshal` " +"模組主要是為了支援用來讀寫 :file:`.pyc` 檔案之 Python 模組的「偽編譯 (pseudo-" +"compiled)」程式碼。因此,Python 維護者保留了在必要時以不向後相容的方式修改 " +"marshal 格式的權利。程式碼物件的格式在不同 Python 版本間是不相容的,即使格式" +"版本相同。在不正確的 Python 版本中反序列化程式碼物件會有未定義的行為。如果你" +"要序列化和反序列化 Python 物件,請改用 :mod:`pickle` 模組 -- 其執行效率相當、" +"有保證版本獨立性,且實質上 pickle 還支援比 marshal 更多樣的物件。" #: ../../library/marshal.rst:37 msgid "" @@ -69,7 +70,7 @@ msgid "" "maliciously constructed data. Never unmarshal data received from an " "untrusted or unauthenticated source." msgstr "" -":mod:`marshal` module 對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " +":mod:`marshal` 模組對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " "unmarshal 來自不受信任的或來源未經驗證的資料。" #: ../../library/marshal.rst:43 @@ -81,20 +82,20 @@ msgid "" "bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects " "(if *allow_code* is true), where it should be understood that tuples, lists, " "sets, frozensets and dictionaries are only supported as long as the values " -"contained therein are themselves supported. The singletons :const:`None`, :" -"const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and " -"unmarshalled. For format *version* lower than 3, recursive lists, sets and " -"dictionaries cannot be written (see below)." +"contained therein are themselves supported. The " +"singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can " +"also be marshalled and unmarshalled. For format *version* lower than 3, " +"recursive lists, sets and dictionaries cannot be written (see below)." msgstr "" -"不是所有 Python 物件型別都有支援;一般來說,此 module 只能寫入和讀取不依賴於" -"特定 Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" -"數、浮點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " +"不是所有 Python 物件型別都有支援;一般來說,此模組只能寫入和讀取不依賴於特定 " +"Python 呼叫 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整數、浮" +"點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " "(bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" "dictionary 和程式碼物件(如 *allow_code* 為 true),需要了解的一點是元組、" "list、集合、凍結集合和 dictionary 只在其所包含的值也屬於這些型別時才會支援。" -"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` 和 :exc:" -"`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 的格式," -"遞迴 list、集合和 dictionary 無法被寫入(見下文)。" +"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` " +"和 :exc:`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 " +"的格式,遞迴 list、集合和 dictionary 無法被寫入(見下文)。" #: ../../library/marshal.rst:56 msgid "" @@ -105,7 +106,7 @@ msgstr "" #: ../../library/marshal.rst:59 msgid "The module defines these functions:" -msgstr "這個 module 定義了以下函式:" +msgstr "這個模組定義了以下函式:" #: ../../library/marshal.rst:64 msgid "" @@ -117,16 +118,16 @@ msgstr "" #: ../../library/marshal.rst:67 msgid "" -"If the value has (or contains an object that has) an unsupported type, a :" -"exc:`ValueError` exception is raised --- but garbage data will also be " -"written to the file. The object will not be properly read back by :func:" -"`load`. :ref:`Code objects ` are only supported if " +"If the value has (or contains an object that has) an unsupported type, " +"a :exc:`ValueError` exception is raised --- but garbage data will also be " +"written to the file. The object will not be properly read back " +"by :func:`load`. :ref:`Code objects ` are only supported if " "*allow_code* is true." msgstr "" "如果值具有(或其所包含的物件具有)不支援的型別,則會引發 :exc:`ValueError` 例" -"外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透過 :func:" -"`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 " -"true 時才會支援。" +"外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透" +"過 :func:`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 " +"*allow_code* 為 true 時才會支援。" #: ../../library/marshal.rst:72 msgid "" @@ -151,14 +152,15 @@ msgstr "新增 *allow_code* 參數。" msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " -"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" -"`Code objects ` are only supported if *allow_code* is true. " -"The file must be a readable :term:`binary file`." +"format), raise :exc:`EOFError`, :exc:`ValueError` " +"or :exc:`TypeError`. :ref:`Code objects ` are only supported " +"if *allow_code* is true. The file must be a readable :term:`binary file`." msgstr "" "從開啟的檔案讀取一個值並回傳。如果讀不到有效的值(例如,由於資料為不同 " -"Python 版本的不相容 marshal 格式),則會引發 :exc:`EOFError`、:exc:" -"`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 " -"*allow_code* 為 true 時才會支援。檔案必須為可讀取的 :term:`binary file`。" +"Python 版本的不相容 marshal 格式),則會引" +"發 :exc:`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 " +"`\\ 只有在 *allow_code* 為 true 時才會支援。檔案必須為可讀取" +"的 :term:`binary file`。" #: ../../library/marshal.rst:89 msgid "" @@ -168,8 +170,9 @@ msgstr "引發一個沒有附帶引數的\\ :ref:`稽核事件 ` ``mar #: ../../library/marshal.rst:93 msgid "" -"If an object containing an unsupported type was marshalled with :func:" -"`dump`, :func:`load` will substitute ``None`` for the unmarshallable type." +"If an object containing an unsupported type was marshalled " +"with :func:`dump`, :func:`load` will substitute ``None`` for the " +"unmarshallable type." msgstr "" "如果透過 :func:`dump` marshal 了一個包含不支援型別的物件,:func:`load` 會將不" "可 marshal 的型別替換為 ``None``。" @@ -191,9 +194,9 @@ msgid "" "is true." msgstr "" "回傳將透過 ``dump(value, file)`` 來被寫入一個檔案的位元組串物件,其值必須是有" -"支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引發 :exc:" -"`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true " -"時才會支援。" +"支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引" +"發 :exc:`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* " +"為 true 時才會支援。" #: ../../library/marshal.rst:112 msgid "" @@ -204,22 +207,22 @@ msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文 #: ../../library/marshal.rst:123 msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " -"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" -"`Code objects ` are only supported if *allow_code* is true. " -"Extra bytes in the input are ignored." +"found, raise :exc:`EOFError`, :exc:`ValueError` " +"or :exc:`TypeError`. :ref:`Code objects ` are only supported " +"if *allow_code* is true. Extra bytes in the input are ignored." msgstr "" -"將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引發 :exc:" -"`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組串會被" -"忽略。" +"將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引" +"發 :exc:`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 " +"`\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組" +"串會被忽略。" #: ../../library/marshal.rst:128 msgid "" "Raises an :ref:`auditing event ` ``marshal.loads`` with argument " "``bytes``." msgstr "" -"引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` ``marshal." -"loads``。" +"引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` " +"``marshal.loads``。" #: ../../library/marshal.rst:132 msgid "" @@ -240,7 +243,7 @@ msgid "" "for floating-point numbers. Version 3 adds support for object instancing and " "recursion. The current version is 4." msgstr "" -"表示 module 所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " +"表示模組所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " "string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" "支援。目前使用的是第 4 版。" @@ -256,7 +259,7 @@ msgid "" "marshal\" means to convert some data from internal to external form (in an " "RPC buffer for instance) and \"unmarshalling\" for the reverse process." msgstr "" -"此 module 的名稱來源於 Modula-3 (及其他語言) 的設計者所使用的術語,他們使用 " +"此模組的名稱來源於 Modula-3 (及其他語言) 的設計者所使用的術語,他們使用 " "\"marshal\" 來表示自包含 (self-contained) 形式資料的傳輸。嚴格來說,將資料從" "內部形式轉換為外部形式 (例如用於 RPC 緩衝區) 稱為 \"marshal\",而其反向過程則" "稱為 \"unmarshal\"。" diff --git a/library/math.po b/library/math.po index 8280532b1a..1c6cb27a07 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-20 00:14+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -754,35 +754,36 @@ msgstr "" #: ../../library/math.rst:251 msgid "" -"Return ``fmod(x, y)``, as defined by the platform C library. Note that the " -"Python expression ``x % y`` may not return the same result. The intent of " -"the C standard is that ``fmod(x, y)`` be exactly (mathematically; to " -"infinite precision) equal to ``x - n*y`` for some integer *n* such that the " -"result has the same sign as *x* and magnitude less than ``abs(y)``. " -"Python's ``x % y`` returns a result with the sign of *y* instead, and may " -"not be exactly computable for float arguments. For example, ``fmod(-1e-100, " -"1e100)`` is ``-1e-100``, but the result of Python's ``-1e-100 % 1e100`` is " -"``1e100-1e-100``, which cannot be represented exactly as a float, and rounds " -"to the surprising ``1e100``. For this reason, function :func:`fmod` is " -"generally preferred when working with floats, while Python's ``x % y`` is " -"preferred when working with integers." -msgstr "" -"回傳 C 函式庫所定義的 ``fmod(x, y)`` 函式值。請注意此函式與 Python 運算式 " -"``x % y`` 可能會回傳不同結果。C 標準要求 ``fmod(x, y)`` 的回傳值完全等同(數" -"學定義上,即無限精度)於 ``x - n*y``,*n* 為可使回傳值與 *x* 同號且長度小於 " -"``abs(y)`` 的整數。Python 運算式 ``x % y`` 的回傳值則與 *y* 同號,且可能無法" -"精確地計算浮點數引數。例如:``fmod(-1e-100, 1e100)`` 的值為 ``-1e-100``,但 " -"Python 運算式 ``-1e-100 % 1e100`` 的結果為 ``1e100-1e-100``,此值無法準確地表" -"示成浮點數,並會四捨五入為出乎意料的 ``1e100``。因此,處理浮點數時通常會選擇" -"函式 :func:`fmod`,而處理整數時會選擇 Python 運算式 ``x % y``。" - -#: ../../library/math.rst:266 +"Return the floating-point remainder of ``x / y``, as defined by the platform " +"C library function ``fmod(x, y)``. Note that the Python expression ``x % y`` " +"may not return the same result. The intent of the C standard is that " +"``fmod(x, y)`` be exactly (mathematically; to infinite precision) equal to " +"``x - n*y`` for some integer *n* such that the result has the same sign as " +"*x* and magnitude less than ``abs(y)``. Python's ``x % y`` returns a result " +"with the sign of *y* instead, and may not be exactly computable for float " +"arguments. For example, ``fmod(-1e-100, 1e100)`` is ``-1e-100``, but the " +"result of Python's ``-1e-100 % 1e100`` is ``1e100-1e-100``, which cannot be " +"represented exactly as a float, and rounds to the surprising ``1e100``. For " +"this reason, function :func:`fmod` is generally preferred when working with " +"floats, while Python's ``x % y`` is preferred when working with integers." +msgstr "" +"回傳 ``x / y`` 的浮點數餘數,其以平臺上的 C 函式庫 ``fmod(x, y)`` 函式定義。" +"請注意此函式與 Python 運算式 ``x % y`` 可能不會回傳相同結果。C 標準要求 " +"``fmod(x, y)`` 的回傳值完全等同(數學定義上,即無限精度)於 ``x - n*y``,*n* " +"為可使回傳值與 *x* 同號且長度小於 ``abs(y)`` 的整數。Python 運算式 ``x % y`` " +"的回傳值則與 *y* 同號,且可能無法精確地計算浮點數引數。例如:``fmod(-1e-100, " +"1e100)`` 的值為 ``-1e-100``,但 Python 運算式 ``-1e-100 % 1e100`` 的結果為 " +"``1e100-1e-100``,此值無法準確地表示成浮點數,並會四捨五入為出乎意料的 " +"``1e100``。因此,處理浮點數時通常會選擇函式 :func:`fmod`,而處理整數時會選擇 " +"Python 運算式 ``x % y``。" + +#: ../../library/math.rst:267 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:269 +#: ../../library/math.rst:270 msgid "" "Note that :func:`modf` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -790,7 +791,7 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:277 +#: ../../library/math.rst:278 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -800,7 +801,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:284 +#: ../../library/math.rst:285 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -808,13 +809,13 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:290 +#: ../../library/math.rst:291 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:298 +#: ../../library/math.rst:299 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " @@ -823,7 +824,7 @@ msgid "" "class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:305 +#: ../../library/math.rst:306 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -832,11 +833,11 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:313 +#: ../../library/math.rst:314 msgid "Floating point manipulation functions" msgstr "" -#: ../../library/math.rst:317 +#: ../../library/math.rst:318 msgid "" "Return a float with the magnitude (absolute value) of *x* but the sign of " "*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " @@ -845,7 +846,7 @@ msgstr "" "回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," "``copysign(1.0, -0.0)`` 回傳 *-1.0*。" -#: ../../library/math.rst:324 +#: ../../library/math.rst:325 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -856,7 +857,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:329 +#: ../../library/math.rst:330 msgid "" "Note that :func:`frexp` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -864,13 +865,13 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:336 +#: ../../library/math.rst:337 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:339 +#: ../../library/math.rst:340 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -879,7 +880,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/math.rst:343 +#: ../../library/math.rst:344 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -893,16 +894,16 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/math.rst:350 +#: ../../library/math.rst:351 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " -"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " -"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " -"to the call." +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any nonzero ``x`` " +"and *rel_tol* less than ``1.0``. So add an appropriate positive *abs_tol* " +"argument to the call." msgstr "" -#: ../../library/math.rst:356 +#: ../../library/math.rst:357 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -913,11 +914,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:365 +#: ../../library/math.rst:366 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:370 +#: ../../library/math.rst:371 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -925,128 +926,128 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:378 +#: ../../library/math.rst:379 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:384 +#: ../../library/math.rst:385 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:389 +#: ../../library/math.rst:390 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:395 +#: ../../library/math.rst:396 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:397 +#: ../../library/math.rst:398 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:399 +#: ../../library/math.rst:400 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:401 +#: ../../library/math.rst:402 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:402 +#: ../../library/math.rst:403 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:403 +#: ../../library/math.rst:404 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:404 +#: ../../library/math.rst:405 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:406 +#: ../../library/math.rst:407 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:410 +#: ../../library/math.rst:411 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:416 +#: ../../library/math.rst:417 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:418 +#: ../../library/math.rst:419 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:419 +#: ../../library/math.rst:420 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "若 *x* 為負值,回傳 ``ulp(-x)``。" -#: ../../library/math.rst:420 +#: ../../library/math.rst:421 msgid "If *x* is a positive infinity, return *x*." msgstr "若 *x* 為正無限值,回傳 *x*。" -#: ../../library/math.rst:421 +#: ../../library/math.rst:422 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:424 +#: ../../library/math.rst:425 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:427 +#: ../../library/math.rst:428 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:431 +#: ../../library/math.rst:432 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:433 +#: ../../library/math.rst:434 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:440 +#: ../../library/math.rst:441 msgid "Power, exponential and logarithmic functions" msgstr "" -#: ../../library/math.rst:444 +#: ../../library/math.rst:445 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:451 +#: ../../library/math.rst:452 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:458 +#: ../../library/math.rst:459 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:465 +#: ../../library/math.rst:466 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -1055,41 +1056,41 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:482 +#: ../../library/math.rst:483 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:484 +#: ../../library/math.rst:485 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:490 +#: ../../library/math.rst:491 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:496 +#: ../../library/math.rst:497 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:503 +#: ../../library/math.rst:504 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:509 +#: ../../library/math.rst:510 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:515 +#: ../../library/math.rst:516 msgid "" "Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " "standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " @@ -1098,44 +1099,44 @@ msgid "" "y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:522 +#: ../../library/math.rst:523 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:526 +#: ../../library/math.rst:527 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:534 +#: ../../library/math.rst:535 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:538 +#: ../../library/math.rst:539 msgid "Summation and product functions" msgstr "" -#: ../../library/math.rst:542 +#: ../../library/math.rst:543 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:546 ../../library/math.rst:607 +#: ../../library/math.rst:547 ../../library/math.rst:608 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:548 +#: ../../library/math.rst:549 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:555 +#: ../../library/math.rst:556 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -1143,7 +1144,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:558 +#: ../../library/math.rst:559 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -1155,7 +1156,7 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:564 +#: ../../library/math.rst:565 msgid "" "For further discussion and two alternative approaches, see the `ASPN " "cookbook recipes for accurate floating-point summation `_。" -#: ../../library/math.rst:571 +#: ../../library/math.rst:572 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:575 +#: ../../library/math.rst:576 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:579 +#: ../../library/math.rst:580 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:583 +#: ../../library/math.rst:584 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:591 +#: ../../library/math.rst:592 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:594 +#: ../../library/math.rst:595 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:603 +#: ../../library/math.rst:604 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:605 +#: ../../library/math.rst:606 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:609 +#: ../../library/math.rst:610 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:611 +#: ../../library/math.rst:612 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:618 +#: ../../library/math.rst:619 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:622 +#: ../../library/math.rst:623 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:627 +#: ../../library/math.rst:628 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:631 +#: ../../library/math.rst:632 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:635 +#: ../../library/math.rst:636 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:641 +#: ../../library/math.rst:642 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:647 +#: ../../library/math.rst:648 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:653 +#: ../../library/math.rst:654 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -1267,78 +1268,78 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:663 +#: ../../library/math.rst:664 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:668 +#: ../../library/math.rst:669 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:673 +#: ../../library/math.rst:674 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:677 +#: ../../library/math.rst:678 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:679 +#: ../../library/math.rst:680 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:685 +#: ../../library/math.rst:686 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:690 +#: ../../library/math.rst:691 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:695 +#: ../../library/math.rst:696 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:700 +#: ../../library/math.rst:701 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:705 +#: ../../library/math.rst:706 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:710 +#: ../../library/math.rst:711 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:714 +#: ../../library/math.rst:715 msgid "Special functions" msgstr "特殊函式" -#: ../../library/math.rst:718 +#: ../../library/math.rst:719 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:721 +#: ../../library/math.rst:722 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:725 +#: ../../library/math.rst:726 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:734 +#: ../../library/math.rst:735 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -1347,31 +1348,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:745 +#: ../../library/math.rst:746 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:753 +#: ../../library/math.rst:754 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:760 +#: ../../library/math.rst:761 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:764 +#: ../../library/math.rst:765 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:769 +#: ../../library/math.rst:770 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:774 +#: ../../library/math.rst:775 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -1380,13 +1381,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:785 +#: ../../library/math.rst:786 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:793 +#: ../../library/math.rst:794 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,19 +72,19 @@ msgstr "為抽象的。取得該數值的實數部分。" msgid "Abstract. Retrieves the imaginary component of this number." msgstr "為抽象的。取得該數值的虛數部分。" -#: ../../library/numbers.rst:43 +#: ../../library/numbers.rst:44 msgid "" "Abstract. Returns the complex conjugate. For example, ``(1+3j).conjugate() " "== (1-3j)``." msgstr "為抽象的。回傳共軛複數,例如 ``(1+3j).conjugate() == (1-3j)``。" -#: ../../library/numbers.rst:48 +#: ../../library/numbers.rst:49 msgid "" "To :class:`Complex`, :class:`!Real` adds the operations that work on real " "numbers." msgstr "相對於 :class:`Complex`,:class:`!Real` 加入了只有實數才能進行的操作。" -#: ../../library/numbers.rst:51 +#: ../../library/numbers.rst:52 msgid "" "In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" "func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " @@ -94,7 +94,7 @@ msgstr "" "`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、" "``<=``、``>``、和 ``>=``。" -#: ../../library/numbers.rst:55 +#: ../../library/numbers.rst:56 msgid "" "Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" "attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." @@ -102,7 +102,7 @@ msgstr "" "實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` " "和 :meth:`~Complex.conjugate` 的預設值。" -#: ../../library/numbers.rst:61 +#: ../../library/numbers.rst:62 msgid "" "Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" "`~Rational.denominator` properties. It also provides a default for :func:" @@ -111,7 +111,7 @@ msgstr "" ":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` 和 :attr:" "`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。" -#: ../../library/numbers.rst:65 +#: ../../library/numbers.rst:66 msgid "" "The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values " "should be instances of :class:`Integral` and should be in lowest terms with :" @@ -120,11 +120,11 @@ msgstr "" ":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :" "class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" -#: ../../library/numbers.rst:71 ../../library/numbers.rst:75 +#: ../../library/numbers.rst:72 ../../library/numbers.rst:76 msgid "Abstract." msgstr "為抽象的。" -#: ../../library/numbers.rst:80 +#: ../../library/numbers.rst:81 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " "defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" @@ -136,11 +136,11 @@ msgstr "" "預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string " "operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。" -#: ../../library/numbers.rst:88 +#: ../../library/numbers.rst:89 msgid "Notes for type implementers" msgstr "給型別實作者的註記" -#: ../../library/numbers.rst:90 +#: ../../library/numbers.rst:91 msgid "" "Implementers should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " @@ -151,7 +151,7 @@ msgstr "" "同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :" "func:`hash` 實作如下: ::" -#: ../../library/numbers.rst:95 +#: ../../library/numbers.rst:96 msgid "" "def __hash__(self):\n" " if self.denominator == 1:\n" @@ -165,12 +165,22 @@ msgid "" " # simple fractions.\n" " return hash((self.numerator, self.denominator))" msgstr "" +"def __hash__(self):\n" +" if self.denominator == 1:\n" +" # 正確處理整數。\n" +" return hash(self.numerator)\n" +" # 檢查費時,但絕對正確。\n" +" if self == float(self):\n" +" return hash(float(self))\n" +" else:\n" +" # 使用 tuple 的雜湊值以避免簡單分數上的高碰撞率。\n" +" return hash((self.numerator, self.denominator))" -#: ../../library/numbers.rst:109 +#: ../../library/numbers.rst:110 msgid "Adding More Numeric ABCs" msgstr "加入更多數值 ABC" -#: ../../library/numbers.rst:111 +#: ../../library/numbers.rst:112 msgid "" "There are, of course, more possible ABCs for numbers, and this would be a " "poor hierarchy if it precluded the possibility of adding those. You can add " @@ -179,7 +189,7 @@ msgstr "" "當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :" "class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" -#: ../../library/numbers.rst:116 +#: ../../library/numbers.rst:117 msgid "" "class MyFoo(Complex): ...\n" "MyFoo.register(Real)" @@ -187,11 +197,11 @@ msgstr "" "class MyFoo(Complex): ...\n" "MyFoo.register(Real)" -#: ../../library/numbers.rst:123 +#: ../../library/numbers.rst:124 msgid "Implementing the arithmetic operations" msgstr "實作算術操作" -#: ../../library/numbers.rst:125 +#: ../../library/numbers.rst:126 msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " @@ -204,7 +214,7 @@ msgstr "" "子型別,這意味著 :meth:`~object.__add__` 和 :meth:`~object.__radd__` 必須用如" "下方式定義: ::" -#: ../../library/numbers.rst:132 +#: ../../library/numbers.rst:133 msgid "" "class MyIntegral(Integral):\n" "\n" @@ -254,7 +264,7 @@ msgstr "" " else:\n" " return NotImplemented" -#: ../../library/numbers.rst:157 +#: ../../library/numbers.rst:158 msgid "" "There are 5 different cases for a mixed-type operation on subclasses of :" "class:`Complex`. I'll refer to all of the above code that doesn't refer to " @@ -267,13 +277,13 @@ msgstr "" "(boilerplate)」。``a`` 是 :class:`Complex` 之子型別 ``A`` 的實例 (``a : A <: " "Complex``),同時 ``b : B <: Complex``。我將要計算 ``a + b``:" -#: ../../library/numbers.rst:164 +#: ../../library/numbers.rst:165 msgid "" "If ``A`` defines an :meth:`~object.__add__` which accepts ``b``, all is well." msgstr "" "如果 ``A`` 有定義成一個接受 ``b`` 的 :meth:`~object.__add__`,不會發生問題。" -#: ../../library/numbers.rst:166 +#: ../../library/numbers.rst:167 msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`~object.__add__`, we'd miss the possibility that ``B`` defines a " @@ -286,14 +296,14 @@ msgstr "" "回傳一個來自 :meth:`!__add__` 的 :data:`NotImplemented`。(或者 ``A`` 可能完" "全不實作 :meth:`!__add__`。)" -#: ../../library/numbers.rst:172 +#: ../../library/numbers.rst:173 msgid "" "Then ``B``'s :meth:`~object.__radd__` gets a chance. If it accepts ``a``, " "all is well." msgstr "" "接著看 ``B`` 的 :meth:`~object.__radd__`。如果它接受 ``a`` ,不會發生問題。" -#: ../../library/numbers.rst:174 +#: ../../library/numbers.rst:175 msgid "" "If it falls back to the boilerplate, there are no more possible methods to " "try, so this is where the default implementation should live." @@ -301,7 +311,7 @@ msgstr "" "如果沒有成功回退到模板,就沒有更多的方法可以去嘗試,因此這裡將使用預設的實" "作。" -#: ../../library/numbers.rst:177 +#: ../../library/numbers.rst:178 msgid "" "If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, " "because it was implemented with knowledge of ``A``, so it can handle those " @@ -311,7 +321,7 @@ msgstr "" "的,因為它是透過對 ``A`` 的理解而實作的,所以這可以在交給 :class:`Complex` 之" "前處理好這些實例。" -#: ../../library/numbers.rst:182 +#: ../../library/numbers.rst:183 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " "then the appropriate shared operation is the one involving the built in :" @@ -322,7 +332,7 @@ msgstr "" "當的共享操作會涉及內建的 :class:`complex`,並且分別用到 :meth:`~object." "__radd__`,因此 ``a+b == b+a``。" -#: ../../library/numbers.rst:187 +#: ../../library/numbers.rst:188 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " @@ -333,7 +343,7 @@ msgstr "" "(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:" "`fractions.Fraction` 使用了: ::" -#: ../../library/numbers.rst:192 +#: ../../library/numbers.rst:193 msgid "" "def _operator_fallbacks(monomorphic_operator, fallback_operator):\n" " def forward(a, b):\n" diff --git a/library/operator.po b/library/operator.po index 3df309831a..297a3f9c14 100644 --- a/library/operator.po +++ b/library/operator.po @@ -32,12 +32,12 @@ msgstr "**原始碼:**\\ :source:`Lib/operator.py`" #: ../../library/operator.rst:18 msgid "" "The :mod:`operator` module exports a set of efficient functions " -"corresponding to the intrinsic operators of Python. For example, ``operator." -"add(x, y)`` is equivalent to the expression ``x+y``. Many function names are " -"those used for special methods, without the double underscores. For " -"backward compatibility, many of these have a variant with the double " -"underscores kept. The variants without the double underscores are preferred " -"for clarity." +"corresponding to the intrinsic operators of Python. For example, " +"``operator.add(x, y)`` is equivalent to the expression ``x+y``. Many " +"function names are those used for special methods, without the double " +"underscores. For backward compatibility, many of these have a variant with " +"the double underscores kept. The variants without the double underscores are " +"preferred for clarity." msgstr "" ":mod:`operator` module(模組)提供了一套與 Python 原生運算子對應的高效率函" "式。例如,``operator.add(x, y)`` 與表示式 ``x+y`` 相同。許多函式名與特殊方法" @@ -64,8 +64,8 @@ msgid "" "``eq(a, b)`` is equivalent to ``a == b``, ``ne(a, b)`` is equivalent to ``a !" "= b``, ``gt(a, b)`` is equivalent to ``a > b`` and ``ge(a, b)`` is " "equivalent to ``a >= b``. Note that these functions can return any value, " -"which may or may not be interpretable as a Boolean value. See :ref:" -"`comparisons` for more information about rich comparisons." +"which may or may not be interpretable as a Boolean value. " +"See :ref:`comparisons` for more information about rich comparisons." msgstr "" "在 *a* 和 *b* 之間進行 \"rich comparison\"。具體來說,``lt(a, b)`` 與 ``a < " "b`` 相同,``le(a, b)`` 與 ``a <= b`` 相同,``eq(a, b)`` 與 ``a == b`` 相同," @@ -84,8 +84,8 @@ msgstr "" msgid "" "Return the outcome of :keyword:`not` *obj*. (Note that there is no :meth:`!" "__not__` method for object instances; only the interpreter core defines this " -"operation. The result is affected by the :meth:`~object.__bool__` and :meth:" -"`~object.__len__` methods.)" +"operation. The result is affected by the :meth:`~object.__bool__` " +"and :meth:`~object.__len__` methods.)" msgstr "" "回傳 :keyword:`not` *obj* 的結果。(請注意物件實例並沒有 :meth:`!__not__` " "method(方法);只有直譯器核心定義此操作。結果會受 :meth:`~object.__bool__` " @@ -97,7 +97,7 @@ msgid "" "is equivalent to using the :class:`bool` constructor." msgstr "" "如果 *obj* 為真值則回傳 :const:`True`,否則回傳 :const:`False`。這等價於使" -"用 :class:`bool` 建構器。" +"用 :class:`bool` 建構函式。" #: ../../library/operator.rst:75 msgid "Return ``a is b``. Tests object identity." @@ -234,16 +234,16 @@ msgid "" "actual length, then an estimate using :meth:`object.__length_hint__`, and " "finally return the default value." msgstr "" -"回傳物件 *obj* 的估計長度。首先嘗試回傳其實際長度,再使用 :meth:`object." -"__length_hint__` 得出估計值,最後才是回傳預設值。" +"回傳物件 *obj* 的估計長度。首先嘗試回傳其實際長度,再使" +"用 :meth:`object.__length_hint__` 得出估計值,最後才是回傳預設值。" #: ../../library/operator.rst:254 msgid "The following operation works with callables:" -msgstr "" +msgstr "以下操作適用於可呼叫物件:" #: ../../library/operator.rst:259 msgid "Return ``obj(*args, **kwargs)``." -msgstr "" +msgstr "回傳 ``obj(*args, **kwargs)``。" #: ../../library/operator.rst:264 msgid "" @@ -253,8 +253,9 @@ msgid "" "other functions that expect a function argument." msgstr "" ":mod:`operator` module 還定義了一些用於常規屬性和條目查詢的工具。這些工具適合" -"用來編寫快速欄位提取器以作為 :func:`map`、:func:`sorted`、:meth:`itertools." -"groupby` 或其他需要函式引數的函式之引數。" +"用來編寫快速欄位提取器以作" +"為 :func:`map`、:func:`sorted`、:meth:`itertools.groupby` 或其他需要函式引數" +"的函式之引數。" #: ../../library/operator.rst:273 msgid "" @@ -262,7 +263,7 @@ msgid "" "one attribute is requested, returns a tuple of attributes. The attribute " "names can also contain dots. For example:" msgstr "" -"回傳一個可從運算元中獲取 *attr* 的可呼叫 (callable) 物件。如果請求了一個以上" +"回傳一個可從運算元中取得 *attr* 的可呼叫 (callable) 物件。如果請求了一個以上" "的屬性,則回傳一個包含屬性的 tupple(元組)。屬性名稱還可包含點號。例如:" #: ../../library/operator.rst:277 @@ -271,8 +272,8 @@ msgstr "在 ``f = attrgetter('name')`` 之後,呼叫 ``f(b)`` 將回傳 ``b.na #: ../../library/operator.rst:279 msgid "" -"After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns ``(b." -"name, b.date)``." +"After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns " +"``(b.name, b.date)``." msgstr "" "在 ``f = attrgetter('name', 'date')`` 之後,呼叫 ``f(b)`` 將回傳 ``(b.name, " "b.date)``。" @@ -309,6 +310,22 @@ msgid "" " obj = getattr(obj, name)\n" " return obj" msgstr "" +"def attrgetter(*items):\n" +" if any(not isinstance(item, str) for item in items):\n" +" raise TypeError('屬性名稱必須是一個字串')\n" +" if len(items) == 1:\n" +" attr = items[0]\n" +" def g(obj):\n" +" return resolve_attr(obj, attr)\n" +" else:\n" +" def g(obj):\n" +" return tuple(resolve_attr(obj, attr) for attr in items)\n" +" return g\n" +"\n" +"def resolve_attr(obj, attr):\n" +" for name in attr.split(\".\"):\n" +" obj = getattr(obj, name)\n" +" return obj" #: ../../library/operator.rst:308 msgid "" @@ -316,7 +333,7 @@ msgid "" "operand's :meth:`~object.__getitem__` method. If multiple items are " "specified, returns a tuple of lookup values. For example:" msgstr "" -"回傳一個使用運算元的 :meth:`~object.__getitem__` 方法從運算元中獲取 *item* 的" +"回傳一個使用運算元的 :meth:`~object.__getitem__` 方法從運算元中取得 *item* 的" "可呼叫物件。如果指定了多個條目,則回傳一個查詢值的 tupple。例如:" #: ../../library/operator.rst:312 @@ -355,9 +372,10 @@ msgstr "" #: ../../library/operator.rst:329 msgid "" -"The items can be any type accepted by the operand's :meth:`~object." -"__getitem__` method. Dictionaries accept any :term:`hashable` value. " -"Lists, tuples, and strings accept an index or a slice:" +"The items can be any type accepted by the " +"operand's :meth:`~object.__getitem__` method. Dictionaries accept " +"any :term:`hashable` value. Lists, tuples, and strings accept an index or a " +"slice:" msgstr "" "傳入的條目可以為運算元的 :meth:`~object.__getitem__` 所接受的任何型別。" "dictionary(字典)接受任意\\ :term:`可雜湊 `\\ 的值。list、tupple " @@ -389,8 +407,8 @@ msgid "" "After ``f = methodcaller('name', 'foo', bar=1)``, the call ``f(b)`` returns " "``b.name('foo', bar=1)``." msgstr "" -"在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 ``b." -"name('foo', bar=1)``。" +"在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 " +"``b.name('foo', bar=1)``。" #: ../../library/operator.rst:367 msgid "" @@ -843,9 +861,9 @@ msgid "" "y``." msgstr "" "許多運算都有「原地」版本。以下列出的是提供對原地運算子(與一般語法相比)更底" -"層存取的函式,例如 :term:`statement` ``x += y`` 相當於 ``x = operator." -"iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於複合陳述" -"式 ``z = x; z += y``。" +"層存取的函式,例如 :term:`statement` ``x += y`` 相當於 ``x = " +"operator.iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於" +"複合陳述式 ``z = x; z += y``。" #: ../../library/operator.rst:465 msgid "" diff --git a/library/optparse.po b/library/optparse.po index 7f39b49f93..b23b142f75 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,20 +21,222 @@ msgstr "" msgid ":mod:`!optparse` --- Parser for command line options" msgstr ":mod:`!optparse` --- 命令列選項剖析器" -#: ../../library/optparse.rst:11 +#: ../../library/optparse.rst:10 msgid "**Source code:** :source:`Lib/optparse.py`" msgstr "**原始碼:**\\ :source:`Lib/optparse.py`" -#: ../../library/optparse.rst:13 +#: ../../library/optparse.rst:17 +msgid "Choosing an argument parsing library" +msgstr "選擇一個命令列參數剖析函式庫" + +#: ../../library/optparse.rst:19 +msgid "The standard library includes three argument parsing libraries:" +msgstr "標準函式庫包含三個命令列引數剖析函式庫:" + +#: ../../library/optparse.rst:21 +msgid "" +":mod:`getopt`: a module that closely mirrors the procedural C ``getopt`` " +"API. Included in the standard library since before the initial Python 1.0 " +"release." +msgstr "" + +#: ../../library/optparse.rst:23 +msgid "" +":mod:`optparse`: a declarative replacement for ``getopt`` that provides " +"equivalent functionality without requiring each application to implement its " +"own procedural option parsing logic. Included in the standard library since " +"the Python 2.3 release." +msgstr "" + +#: ../../library/optparse.rst:27 +msgid "" +":mod:`argparse`: a more opinionated alternative to ``optparse`` that " +"provides more functionality by default, at the expense of reduced " +"application flexibility in controlling exactly how arguments are processed. " +"Included in the standard library since the Python 2.7 and Python 3.2 " +"releases." +msgstr "" + +#: ../../library/optparse.rst:32 +msgid "" +"In the absence of more specific argument parsing design constraints, :mod:" +"`argparse` is the recommended choice for implementing command line " +"applications, as it offers the highest level of baseline functionality with " +"the least application level code." +msgstr "" + +#: ../../library/optparse.rst:36 +msgid "" +":mod:`getopt` is retained almost entirely for backwards compatibility " +"reasons. However, it also serves a niche use case as a tool for prototyping " +"and testing command line argument handling in ``getopt``-based C " +"applications." +msgstr "" + +#: ../../library/optparse.rst:40 +msgid "" +":mod:`optparse` should be considered as an alternative to :mod:`argparse` in " +"the following cases:" +msgstr "" + +#: ../../library/optparse.rst:43 +msgid "" +"an application is already using :mod:`optparse` and doesn't want to risk the " +"subtle behavioural changes that may arise when migrating to :mod:`argparse`" +msgstr "" + +#: ../../library/optparse.rst:45 +msgid "" +"the application requires additional control over the way options and " +"positional parameters are interleaved on the command line (including the " +"ability to disable the interleaving feature completely)" +msgstr "" + +#: ../../library/optparse.rst:48 +msgid "" +"the application requires additional control over the incremental parsing of " +"command line elements (while ``argparse`` does support this, the exact way " +"it works in practice is undesirable for some use cases)" +msgstr "" + +#: ../../library/optparse.rst:51 +msgid "" +"the application requires additional control over the handling of options " +"which accept parameter values that may start with ``-`` (such as delegated " +"options to be passed to invoked subprocesses)" +msgstr "" + +#: ../../library/optparse.rst:54 +msgid "" +"the application requires some other command line parameter processing " +"behavior which ``argparse`` does not support, but which can be implemented " +"in terms of the lower level interface offered by ``optparse``" +msgstr "" + +#: ../../library/optparse.rst:58 +msgid "" +"These considerations also mean that :mod:`optparse` is likely to provide a " +"better foundation for library authors writing third party command line " +"argument processing libraries." +msgstr "" + +#: ../../library/optparse.rst:62 +msgid "" +"As a concrete example, consider the following two command line argument " +"parsing configurations, the first using ``optparse``, and the second using " +"``argparse``:" +msgstr "" + +#: ../../library/optparse.rst:66 +msgid "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" +msgstr "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" + +#: ../../library/optparse.rst:77 +msgid "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" +msgstr "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" + +#: ../../library/optparse.rst:89 +msgid "" +"The most obvious difference is that in the ``optparse`` version, the non-" +"option arguments are processed separately by the application after the " +"option processing is complete. In the ``argparse`` version, positional " +"arguments are declared and processed in the same way as the named options." +msgstr "" + +#: ../../library/optparse.rst:94 +msgid "" +"However, the ``argparse`` version will also handle some parameter " +"combination differently from the way the ``optparse`` version would handle " +"them. For example (amongst other differences):" +msgstr "" + +#: ../../library/optparse.rst:98 +msgid "" +"supplying ``-o -v`` gives ``output=\"-v\"`` and ``verbose=False`` when using " +"``optparse``, but a usage error with ``argparse`` (complaining that no value " +"has been supplied for ``-o/--output``, since ``-v`` is interpreted as " +"meaning the verbosity flag)" +msgstr "" + +#: ../../library/optparse.rst:102 +msgid "" +"similarly, supplying ``-o --`` gives ``output=\"--\"`` and ``args=()`` when " +"using ``optparse``, but a usage error with ``argparse`` (also complaining " +"that no value has been supplied for ``-o/--output``, since ``--`` is " +"interpreted as terminating the option processing and treating all remaining " +"values as positional arguments)" +msgstr "" + +#: ../../library/optparse.rst:107 msgid "" -"The :mod:`optparse` module is :term:`soft deprecated` and will not be " -"developed further; development will continue with the :mod:`argparse` module." +"supplying ``-o=foo`` gives ``output=\"=foo\"`` when using ``optparse``, but " +"gives ``output=\"foo\"`` with ``argparse`` (since ``=`` is special cased as " +"an alternative separator for option parameter values)" msgstr "" -#: ../../library/optparse.rst:20 +#: ../../library/optparse.rst:111 +msgid "" +"Whether these differing behaviors in the ``argparse`` version are considered " +"desirable or a problem will depend on the specific command line application " +"use case." +msgstr "" + +#: ../../library/optparse.rst:117 +msgid "" +":pypi:`click` is a third party argument processing library (originally based " +"on ``optparse``), which allows command line applications to be developed as " +"a set of decorated command implementation functions." +msgstr "" + +#: ../../library/optparse.rst:121 +msgid "" +"Other third party libraries, such as :pypi:`typer` or :pypi:`msgspec-click`, " +"allow command line interfaces to be specified in ways that more effectively " +"integrate with static checking of Python type annotations." +msgstr "" + +#: ../../library/optparse.rst:127 +msgid "Introduction" +msgstr "" + +#: ../../library/optparse.rst:129 msgid "" ":mod:`optparse` is a more convenient, flexible, and powerful library for " -"parsing command-line options than the old :mod:`getopt` module. :mod:" +"parsing command-line options than the minimalist :mod:`getopt` module. :mod:" "`optparse` uses a more declarative style of command-line parsing: you create " "an instance of :class:`OptionParser`, populate it with options, and parse " "the command line. :mod:`optparse` allows users to specify options in the " @@ -43,11 +244,11 @@ msgid "" "messages for you." msgstr "" -#: ../../library/optparse.rst:27 +#: ../../library/optparse.rst:137 msgid "Here's an example of using :mod:`optparse` in a simple script::" msgstr "" -#: ../../library/optparse.rst:29 +#: ../../library/optparse.rst:139 msgid "" "from optparse import OptionParser\n" "...\n" @@ -60,18 +261,28 @@ msgid "" "\n" "(options, args) = parser.parse_args()" msgstr "" +"from optparse import OptionParser\n" +"...\n" +"parser = OptionParser()\n" +"parser.add_option(\"-f\", \"--file\", dest=\"filename\",\n" +" help=\"write report to FILE\", metavar=\"FILE\")\n" +"parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\", default=True,\n" +" help=\"don't print status messages to stdout\")\n" +"\n" +"(options, args) = parser.parse_args()" -#: ../../library/optparse.rst:40 +#: ../../library/optparse.rst:150 msgid "" "With these few lines of code, users of your script can now do the \"usual " "thing\" on the command-line, for example::" msgstr "" -#: ../../library/optparse.rst:43 +#: ../../library/optparse.rst:153 msgid " --file=outfile -q" -msgstr "" +msgstr " --file=outfile -q" -#: ../../library/optparse.rst:45 +#: ../../library/optparse.rst:155 msgid "" "As it parses the command line, :mod:`optparse` sets attributes of the " "``options`` object returned by :meth:`~OptionParser.parse_args` based on " @@ -84,7 +295,7 @@ msgid "" "the above example::" msgstr "" -#: ../../library/optparse.rst:54 +#: ../../library/optparse.rst:164 msgid "" " -f outfile --quiet\n" " --quiet --file outfile\n" @@ -92,22 +303,24 @@ msgid "" " -qfoutfile" msgstr "" -#: ../../library/optparse.rst:59 +#: ../../library/optparse.rst:169 msgid "Additionally, users can run one of the following ::" msgstr "" -#: ../../library/optparse.rst:61 +#: ../../library/optparse.rst:171 msgid "" " -h\n" " --help" msgstr "" +" -h\n" +" --help" -#: ../../library/optparse.rst:64 +#: ../../library/optparse.rst:174 msgid "" "and :mod:`optparse` will print out a brief summary of your script's options:" msgstr "" -#: ../../library/optparse.rst:66 +#: ../../library/optparse.rst:176 msgid "" "Usage: [options]\n" "\n" @@ -116,35 +329,43 @@ msgid "" " -f FILE, --file=FILE write report to FILE\n" " -q, --quiet don't print status messages to stdout" msgstr "" +"Usage: [options]\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -f FILE, --file=FILE write report to FILE\n" +" -q, --quiet don't print status messages to stdout" -#: ../../library/optparse.rst:75 +#: ../../library/optparse.rst:185 msgid "" "where the value of *yourscript* is determined at runtime (normally from " "``sys.argv[0]``)." msgstr "" -#: ../../library/optparse.rst:82 +#: ../../library/optparse.rst:192 msgid "Background" msgstr "背景" -#: ../../library/optparse.rst:84 +#: ../../library/optparse.rst:194 msgid "" ":mod:`optparse` was explicitly designed to encourage the creation of " -"programs with straightforward, conventional command-line interfaces. To " -"that end, it supports only the most common command-line syntax and semantics " -"conventionally used under Unix. If you are unfamiliar with these " -"conventions, read this section to acquaint yourself with them." +"programs with straightforward command-line interfaces that follow the " +"conventions established by the :c:func:`!getopt` family of functions " +"available to C developers. To that end, it supports only the most common " +"command-line syntax and semantics conventionally used under Unix. If you " +"are unfamiliar with these conventions, reading this section will allow you " +"to acquaint yourself with them." msgstr "" -#: ../../library/optparse.rst:94 +#: ../../library/optparse.rst:205 msgid "Terminology" msgstr "術語" -#: ../../library/optparse.rst:96 +#: ../../library/optparse.rst:207 msgid "argument" -msgstr "" +msgstr "引數" -#: ../../library/optparse.rst:97 +#: ../../library/optparse.rst:208 msgid "" "a string entered on the command-line, and passed by the shell to ``execl()`` " "or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` " @@ -152,7 +373,7 @@ msgid "" "also use the term \"word\"." msgstr "" -#: ../../library/optparse.rst:102 +#: ../../library/optparse.rst:213 msgid "" "It is occasionally desirable to substitute an argument list other than ``sys." "argv[1:]``, so you should read \"argument\" as \"an element of ``sys." @@ -160,11 +381,11 @@ msgid "" "argv[1:]``\"." msgstr "" -#: ../../library/optparse.rst:107 +#: ../../library/optparse.rst:218 msgid "option" -msgstr "" +msgstr "選項" -#: ../../library/optparse.rst:108 +#: ../../library/optparse.rst:219 msgid "" "an argument used to supply extra information to guide or customize the " "execution of a program. There are many different syntaxes for options; the " @@ -176,36 +397,36 @@ msgid "" "option syntaxes provided by :mod:`optparse`." msgstr "" -#: ../../library/optparse.rst:117 +#: ../../library/optparse.rst:228 msgid "Some other option syntaxes that the world has seen include:" msgstr "" -#: ../../library/optparse.rst:119 +#: ../../library/optparse.rst:230 msgid "" "a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as " "multiple options merged into a single argument)" msgstr "" -#: ../../library/optparse.rst:122 +#: ../../library/optparse.rst:233 msgid "" "a hyphen followed by a whole word, e.g. ``-file`` (this is technically " "equivalent to the previous syntax, but they aren't usually seen in the same " "program)" msgstr "" -#: ../../library/optparse.rst:126 +#: ../../library/optparse.rst:237 msgid "" "a plus sign followed by a single letter, or a few letters, or a word, e.g. " "``+f``, ``+rgb``" msgstr "" -#: ../../library/optparse.rst:129 +#: ../../library/optparse.rst:240 msgid "" "a slash followed by a letter, or a few letters, or a word, e.g. ``/f``, ``/" "file``" msgstr "" -#: ../../library/optparse.rst:132 +#: ../../library/optparse.rst:243 msgid "" "These option syntaxes are not supported by :mod:`optparse`, and they never " "will be. This is deliberate: the first three are non-standard on any " @@ -213,11 +434,11 @@ msgid "" "Windows or certain legacy platforms (e.g. VMS, MS-DOS)." msgstr "" -#: ../../library/optparse.rst:137 +#: ../../library/optparse.rst:248 msgid "option argument" -msgstr "" +msgstr "選項引數" -#: ../../library/optparse.rst:138 +#: ../../library/optparse.rst:249 msgid "" "an argument that follows an option, is closely associated with that option, " "and is consumed from the argument list when that option is. With :mod:" @@ -225,23 +446,27 @@ msgid "" "option:" msgstr "" -#: ../../library/optparse.rst:143 +#: ../../library/optparse.rst:254 msgid "" "-f foo\n" "--file foo" msgstr "" +"-f foo\n" +"--file foo" -#: ../../library/optparse.rst:148 +#: ../../library/optparse.rst:259 msgid "or included in the same argument:" msgstr "" -#: ../../library/optparse.rst:150 +#: ../../library/optparse.rst:261 msgid "" "-ffoo\n" "--file=foo" msgstr "" +"-ffoo\n" +"--file=foo" -#: ../../library/optparse.rst:155 +#: ../../library/optparse.rst:266 msgid "" "Typically, a given option either takes an argument or it doesn't. Lots of " "people want an \"optional option arguments\" feature, meaning that some " @@ -252,22 +477,22 @@ msgid "" "support this feature." msgstr "" -#: ../../library/optparse.rst:163 +#: ../../library/optparse.rst:274 msgid "positional argument" -msgstr "" +msgstr "位置引數" -#: ../../library/optparse.rst:164 +#: ../../library/optparse.rst:275 msgid "" "something leftover in the argument list after options have been parsed, i.e. " "after options and their arguments have been parsed and removed from the " "argument list." msgstr "" -#: ../../library/optparse.rst:168 +#: ../../library/optparse.rst:279 msgid "required option" msgstr "" -#: ../../library/optparse.rst:169 +#: ../../library/optparse.rst:280 msgid "" "an option that must be supplied on the command-line; note that the phrase " "\"required option\" is self-contradictory in English. :mod:`optparse` " @@ -275,26 +500,26 @@ msgid "" "much help at it either." msgstr "" -#: ../../library/optparse.rst:174 +#: ../../library/optparse.rst:285 msgid "For example, consider this hypothetical command-line::" msgstr "" -#: ../../library/optparse.rst:176 +#: ../../library/optparse.rst:287 msgid "prog -v --report report.txt foo bar" -msgstr "" +msgstr "prog -v --report report.txt foo bar" -#: ../../library/optparse.rst:178 +#: ../../library/optparse.rst:289 msgid "" "``-v`` and ``--report`` are both options. Assuming that ``--report`` takes " "one argument, ``report.txt`` is an option argument. ``foo`` and ``bar`` are " "positional arguments." msgstr "" -#: ../../library/optparse.rst:186 +#: ../../library/optparse.rst:297 msgid "What are options for?" msgstr "" -#: ../../library/optparse.rst:188 +#: ../../library/optparse.rst:299 msgid "" "Options are used to provide extra information to tune or customize the " "execution of a program. In case it wasn't clear, options are usually " @@ -306,7 +531,7 @@ msgid "" "interfaces.)" msgstr "" -#: ../../library/optparse.rst:196 +#: ../../library/optparse.rst:307 msgid "" "Lots of people want their programs to have \"required options\". Think " "about it. If it's required, then it's *not optional*! If there is a piece " @@ -314,7 +539,7 @@ msgid "" "successfully, that's what positional arguments are for." msgstr "" -#: ../../library/optparse.rst:201 +#: ../../library/optparse.rst:312 msgid "" "As an example of good command-line interface design, consider the humble " "``cp`` utility, for copying files. It doesn't make much sense to try to " @@ -323,13 +548,15 @@ msgid "" "useful syntax that does not require any options at all::" msgstr "" -#: ../../library/optparse.rst:207 +#: ../../library/optparse.rst:318 msgid "" "cp SOURCE DEST\n" "cp SOURCE ... DEST-DIR" msgstr "" +"cp SOURCE DEST\n" +"cp SOURCE ... DEST-DIR" -#: ../../library/optparse.rst:210 +#: ../../library/optparse.rst:321 msgid "" "You can get pretty far with just that. Most ``cp`` implementations provide " "a bunch of options to tweak exactly how the files are copied: you can " @@ -339,17 +566,17 @@ msgid "" "files to another directory." msgstr "" -#: ../../library/optparse.rst:221 +#: ../../library/optparse.rst:332 msgid "What are positional arguments for?" msgstr "" -#: ../../library/optparse.rst:223 +#: ../../library/optparse.rst:334 msgid "" "Positional arguments are for those pieces of information that your program " "absolutely, positively requires to run." msgstr "" -#: ../../library/optparse.rst:226 +#: ../../library/optparse.rst:337 msgid "" "A good user interface should have as few absolute requirements as possible. " "If your program requires 17 distinct pieces of information in order to run " @@ -360,7 +587,7 @@ msgid "" "most of them will simply give up." msgstr "" -#: ../../library/optparse.rst:234 +#: ../../library/optparse.rst:345 msgid "" "In short, try to minimize the amount of information that users are " "absolutely required to supply---use sensible defaults whenever possible. Of " @@ -373,65 +600,70 @@ msgid "" "make your code much harder to maintain." msgstr "" -#: ../../library/optparse.rst:247 +#: ../../library/optparse.rst:358 msgid "Tutorial" msgstr "教學" -#: ../../library/optparse.rst:249 +#: ../../library/optparse.rst:360 msgid "" "While :mod:`optparse` is quite flexible and powerful, it's also " "straightforward to use in most cases. This section covers the code patterns " "that are common to any :mod:`optparse`\\ -based program." msgstr "" -#: ../../library/optparse.rst:253 +#: ../../library/optparse.rst:364 msgid "" "First, you need to import the OptionParser class; then, early in the main " "program, create an OptionParser instance::" msgstr "" -#: ../../library/optparse.rst:256 +#: ../../library/optparse.rst:367 msgid "" "from optparse import OptionParser\n" "...\n" "parser = OptionParser()" msgstr "" +"from optparse import OptionParser\n" +"...\n" +"parser = OptionParser()" -#: ../../library/optparse.rst:260 +#: ../../library/optparse.rst:371 msgid "Then you can start defining options. The basic syntax is::" msgstr "" -#: ../../library/optparse.rst:262 +#: ../../library/optparse.rst:373 msgid "" "parser.add_option(opt_str, ...,\n" " attr=value, ...)" msgstr "" +"parser.add_option(opt_str, ...,\n" +" attr=value, ...)" -#: ../../library/optparse.rst:265 +#: ../../library/optparse.rst:376 msgid "" "Each option has one or more option strings, such as ``-f`` or ``--file``, " "and several option attributes that tell :mod:`optparse` what to expect and " "what to do when it encounters that option on the command line." msgstr "" -#: ../../library/optparse.rst:269 +#: ../../library/optparse.rst:380 msgid "" "Typically, each option will have one short option string and one long option " "string, e.g.::" msgstr "" -#: ../../library/optparse.rst:272 +#: ../../library/optparse.rst:383 msgid "parser.add_option(\"-f\", \"--file\", ...)" -msgstr "" +msgstr "parser.add_option(\"-f\", \"--file\", ...)" -#: ../../library/optparse.rst:274 +#: ../../library/optparse.rst:385 msgid "" "You're free to define as many short option strings and as many long option " "strings as you like (including zero), as long as there is at least one " "option string overall." msgstr "" -#: ../../library/optparse.rst:278 +#: ../../library/optparse.rst:389 msgid "" "The option strings passed to :meth:`OptionParser.add_option` are effectively " "labels for the option defined by that call. For brevity, we will frequently " @@ -439,28 +671,28 @@ msgid "" "`optparse` encounters *option strings* and looks up options from them." msgstr "" -#: ../../library/optparse.rst:284 +#: ../../library/optparse.rst:395 msgid "" "Once all of your options are defined, instruct :mod:`optparse` to parse your " "program's command line::" msgstr "" -#: ../../library/optparse.rst:287 +#: ../../library/optparse.rst:398 msgid "(options, args) = parser.parse_args()" -msgstr "" +msgstr "(options, args) = parser.parse_args()" -#: ../../library/optparse.rst:289 +#: ../../library/optparse.rst:400 msgid "" "(If you like, you can pass a custom argument list to :meth:`~OptionParser." "parse_args`, but that's rarely necessary: by default it uses ``sys." "argv[1:]``.)" msgstr "" -#: ../../library/optparse.rst:292 +#: ../../library/optparse.rst:403 msgid ":meth:`~OptionParser.parse_args` returns two values:" msgstr ":meth:`~OptionParser.parse_args` 回傳兩個值:" -#: ../../library/optparse.rst:294 +#: ../../library/optparse.rst:405 msgid "" "``options``, an object containing values for all of your options---e.g. if " "``--file`` takes a single string argument, then ``options.file`` will be the " @@ -468,12 +700,12 @@ msgid "" "option" msgstr "" -#: ../../library/optparse.rst:299 +#: ../../library/optparse.rst:410 msgid "" "``args``, the list of positional arguments leftover after parsing options" msgstr "" -#: ../../library/optparse.rst:301 +#: ../../library/optparse.rst:412 msgid "" "This tutorial section only covers the four most important option " "attributes: :attr:`~Option.action`, :attr:`~Option.type`, :attr:`~Option." @@ -481,11 +713,11 @@ msgid "" "action` is the most fundamental." msgstr "" -#: ../../library/optparse.rst:310 +#: ../../library/optparse.rst:421 msgid "Understanding option actions" msgstr "" -#: ../../library/optparse.rst:312 +#: ../../library/optparse.rst:423 msgid "" "Actions tell :mod:`optparse` what to do when it encounters an option on the " "command line. There is a fixed set of actions hard-coded into :mod:" @@ -495,44 +727,48 @@ msgid "" "and store it in an attribute of ``options``." msgstr "" -#: ../../library/optparse.rst:319 +#: ../../library/optparse.rst:430 msgid "" "If you don't specify an option action, :mod:`optparse` defaults to ``store``." msgstr "" -#: ../../library/optparse.rst:325 +#: ../../library/optparse.rst:436 msgid "The store action" msgstr "" -#: ../../library/optparse.rst:327 +#: ../../library/optparse.rst:438 msgid "" "The most common option action is ``store``, which tells :mod:`optparse` to " "take the next argument (or the remainder of the current argument), ensure " "that it is of the correct type, and store it to your chosen destination." msgstr "" -#: ../../library/optparse.rst:331 +#: ../../library/optparse.rst:442 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/optparse.rst:333 +#: ../../library/optparse.rst:444 msgid "" "parser.add_option(\"-f\", \"--file\",\n" " action=\"store\", type=\"string\", dest=\"filename\")" msgstr "" +"parser.add_option(\"-f\", \"--file\",\n" +" action=\"store\", type=\"string\", dest=\"filename\")" -#: ../../library/optparse.rst:336 +#: ../../library/optparse.rst:447 msgid "" "Now let's make up a fake command line and ask :mod:`optparse` to parse it::" msgstr "" -#: ../../library/optparse.rst:338 +#: ../../library/optparse.rst:449 msgid "" "args = [\"-f\", \"foo.txt\"]\n" "(options, args) = parser.parse_args(args)" msgstr "" +"args = [\"-f\", \"foo.txt\"]\n" +"(options, args) = parser.parse_args(args)" -#: ../../library/optparse.rst:341 +#: ../../library/optparse.rst:452 msgid "" "When :mod:`optparse` sees the option string ``-f``, it consumes the next " "argument, ``foo.txt``, and stores it in ``options.filename``. So, after " @@ -540,51 +776,53 @@ msgid "" "``\"foo.txt\"``." msgstr "" -#: ../../library/optparse.rst:345 +#: ../../library/optparse.rst:456 msgid "" "Some other option types supported by :mod:`optparse` are ``int`` and " "``float``. Here's an option that expects an integer argument::" msgstr "" -#: ../../library/optparse.rst:348 +#: ../../library/optparse.rst:459 msgid "parser.add_option(\"-n\", type=\"int\", dest=\"num\")" -msgstr "" +msgstr "parser.add_option(\"-n\", type=\"int\", dest=\"num\")" -#: ../../library/optparse.rst:350 +#: ../../library/optparse.rst:461 msgid "" "Note that this option has no long option string, which is perfectly " "acceptable. Also, there's no explicit action, since the default is ``store``." msgstr "" -#: ../../library/optparse.rst:353 +#: ../../library/optparse.rst:464 msgid "" "Let's parse another fake command-line. This time, we'll jam the option " "argument right up against the option: since ``-n42`` (one argument) is " "equivalent to ``-n 42`` (two arguments), the code ::" msgstr "" -#: ../../library/optparse.rst:357 +#: ../../library/optparse.rst:468 msgid "" "(options, args) = parser.parse_args([\"-n42\"])\n" "print(options.num)" msgstr "" +"(options, args) = parser.parse_args([\"-n42\"])\n" +"print(options.num)" -#: ../../library/optparse.rst:360 +#: ../../library/optparse.rst:471 msgid "will print ``42``." -msgstr "" +msgstr "會印出 ``42``。" -#: ../../library/optparse.rst:362 +#: ../../library/optparse.rst:473 msgid "" "If you don't specify a type, :mod:`optparse` assumes ``string``. Combined " "with the fact that the default action is ``store``, that means our first " "example can be a lot shorter::" msgstr "" -#: ../../library/optparse.rst:366 +#: ../../library/optparse.rst:477 msgid "parser.add_option(\"-f\", \"--file\", dest=\"filename\")" -msgstr "" +msgstr "parser.add_option(\"-f\", \"--file\", dest=\"filename\")" -#: ../../library/optparse.rst:368 +#: ../../library/optparse.rst:479 msgid "" "If you don't supply a destination, :mod:`optparse` figures out a sensible " "default from the option strings: if the first long option string is ``--foo-" @@ -593,17 +831,17 @@ msgid "" "default destination for ``-f`` is ``f``." msgstr "" -#: ../../library/optparse.rst:374 +#: ../../library/optparse.rst:485 msgid "" ":mod:`optparse` also includes the built-in ``complex`` type. Adding types " "is covered in section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:381 +#: ../../library/optparse.rst:492 msgid "Handling boolean (flag) options" msgstr "" -#: ../../library/optparse.rst:383 +#: ../../library/optparse.rst:494 msgid "" "Flag options---set a variable to true or false when a particular option is " "seen---are quite common. :mod:`optparse` supports them with two separate " @@ -611,77 +849,79 @@ msgid "" "``verbose`` flag that is turned on with ``-v`` and off with ``-q``::" msgstr "" -#: ../../library/optparse.rst:388 +#: ../../library/optparse.rst:499 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" -#: ../../library/optparse.rst:391 +#: ../../library/optparse.rst:502 msgid "" "Here we have two different options with the same destination, which is " "perfectly OK. (It just means you have to be a bit careful when setting " "default values---see below.)" msgstr "" -#: ../../library/optparse.rst:395 +#: ../../library/optparse.rst:506 msgid "" "When :mod:`optparse` encounters ``-v`` on the command line, it sets " "``options.verbose`` to ``True``; when it encounters ``-q``, ``options." "verbose`` is set to ``False``." msgstr "" -#: ../../library/optparse.rst:403 +#: ../../library/optparse.rst:514 msgid "Other actions" msgstr "" -#: ../../library/optparse.rst:405 +#: ../../library/optparse.rst:516 msgid "Some other actions supported by :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 +#: ../../library/optparse.rst:518 ../../library/optparse.rst:1040 msgid "``\"store_const\"``" msgstr "``\"store_const\"``" -#: ../../library/optparse.rst:408 ../../library/optparse.rst:930 +#: ../../library/optparse.rst:519 ../../library/optparse.rst:1041 msgid "store a constant value, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 +#: ../../library/optparse.rst:521 ../../library/optparse.rst:1049 msgid "``\"append\"``" msgstr "``\"append\"``" -#: ../../library/optparse.rst:411 ../../library/optparse.rst:939 +#: ../../library/optparse.rst:522 ../../library/optparse.rst:1050 msgid "append this option's argument to a list" msgstr "" -#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 +#: ../../library/optparse.rst:524 ../../library/optparse.rst:1055 msgid "``\"count\"``" msgstr "``\"count\"``" -#: ../../library/optparse.rst:414 ../../library/optparse.rst:945 +#: ../../library/optparse.rst:525 ../../library/optparse.rst:1056 msgid "increment a counter by one" msgstr "" -#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 +#: ../../library/optparse.rst:527 ../../library/optparse.rst:1058 msgid "``\"callback\"``" msgstr "``\"callback\"``" -#: ../../library/optparse.rst:417 ../../library/optparse.rst:948 +#: ../../library/optparse.rst:528 ../../library/optparse.rst:1059 msgid "call a specified function" msgstr "" -#: ../../library/optparse.rst:419 +#: ../../library/optparse.rst:530 msgid "" "These are covered in section :ref:`optparse-reference-guide`, and section :" "ref:`optparse-option-callbacks`." msgstr "" -#: ../../library/optparse.rst:426 +#: ../../library/optparse.rst:537 msgid "Default values" -msgstr "" +msgstr "預設值" -#: ../../library/optparse.rst:428 +#: ../../library/optparse.rst:539 msgid "" "All of the above examples involve setting some variable (the " "\"destination\") when certain command-line options are seen. What happens " @@ -691,77 +931,87 @@ msgid "" "destination, which is assigned before the command line is parsed." msgstr "" -#: ../../library/optparse.rst:435 +#: ../../library/optparse.rst:546 msgid "" "First, consider the verbose/quiet example. If we want :mod:`optparse` to " "set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::" msgstr "" -#: ../../library/optparse.rst:438 +#: ../../library/optparse.rst:549 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=True)\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " +"default=True)\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" -#: ../../library/optparse.rst:441 +#: ../../library/optparse.rst:552 msgid "" "Since default values apply to the *destination* rather than to any " "particular option, and these two options happen to have the same " "destination, this is exactly equivalent::" msgstr "" -#: ../../library/optparse.rst:445 +#: ../../library/optparse.rst:556 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " "default=True)" msgstr "" -#: ../../library/optparse.rst:448 +#: ../../library/optparse.rst:559 msgid "Consider this::" msgstr "" -#: ../../library/optparse.rst:450 +#: ../../library/optparse.rst:561 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=False)\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " "default=True)" msgstr "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " +"default=False)\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " +"default=True)" -#: ../../library/optparse.rst:453 +#: ../../library/optparse.rst:564 msgid "" "Again, the default value for ``verbose`` will be ``True``: the last default " "value supplied for any particular destination is the one that counts." msgstr "" -#: ../../library/optparse.rst:456 +#: ../../library/optparse.rst:567 msgid "" "A clearer way to specify default values is the :meth:`set_defaults` method " "of OptionParser, which you can call at any time before calling :meth:" "`~OptionParser.parse_args`::" msgstr "" -#: ../../library/optparse.rst:460 +#: ../../library/optparse.rst:571 msgid "" "parser.set_defaults(verbose=True)\n" "parser.add_option(...)\n" "(options, args) = parser.parse_args()" msgstr "" +"parser.set_defaults(verbose=True)\n" +"parser.add_option(...)\n" +"(options, args) = parser.parse_args()" -#: ../../library/optparse.rst:464 +#: ../../library/optparse.rst:575 msgid "" "As before, the last value specified for a given option destination is the " "one that counts. For clarity, try to use one method or the other of setting " "default values, not both." msgstr "" -#: ../../library/optparse.rst:472 +#: ../../library/optparse.rst:583 msgid "Generating help" msgstr "" -#: ../../library/optparse.rst:474 +#: ../../library/optparse.rst:585 msgid "" ":mod:`optparse`'s ability to generate help and usage text automatically is " "useful for creating user-friendly command-line interfaces. All you have to " @@ -770,7 +1020,7 @@ msgid "" "populated with user-friendly (documented) options::" msgstr "" -#: ../../library/optparse.rst:480 +#: ../../library/optparse.rst:591 msgid "" "usage = \"usage: %prog [options] arg1 arg2\"\n" "parser = OptionParser(usage=usage)\n" @@ -787,15 +1037,29 @@ msgid "" " help=\"interaction mode: novice, intermediate, \"\n" " \"or expert [default: %default]\")" msgstr "" +"usage = \"usage: %prog [options] arg1 arg2\"\n" +"parser = OptionParser(usage=usage)\n" +"parser.add_option(\"-v\", \"--verbose\",\n" +" action=\"store_true\", dest=\"verbose\", default=True,\n" +" help=\"make lots of noise [default]\")\n" +"parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\",\n" +" help=\"be vewwy quiet (I'm hunting wabbits)\")\n" +"parser.add_option(\"-f\", \"--filename\",\n" +" metavar=\"FILE\", help=\"write output to FILE\")\n" +"parser.add_option(\"-m\", \"--mode\",\n" +" default=\"intermediate\",\n" +" help=\"interaction mode: novice, intermediate, \"\n" +" \"or expert [default: %default]\")" -#: ../../library/optparse.rst:495 +#: ../../library/optparse.rst:606 msgid "" "If :mod:`optparse` encounters either ``-h`` or ``--help`` on the command-" "line, or if you just call :meth:`parser.print_help`, it prints the following " "to standard output:" msgstr "" -#: ../../library/optparse.rst:499 +#: ../../library/optparse.rst:610 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -808,59 +1072,69 @@ msgid "" " -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" " expert [default: intermediate]" msgstr "" +"Usage: [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" +" expert [default: intermediate]" -#: ../../library/optparse.rst:512 +#: ../../library/optparse.rst:623 msgid "" "(If the help output is triggered by a help option, :mod:`optparse` exits " "after printing the help text.)" msgstr "" -#: ../../library/optparse.rst:515 +#: ../../library/optparse.rst:626 msgid "" "There's a lot going on here to help :mod:`optparse` generate the best " "possible help message:" msgstr "" -#: ../../library/optparse.rst:518 +#: ../../library/optparse.rst:629 msgid "the script defines its own usage message::" msgstr "" -#: ../../library/optparse.rst:520 +#: ../../library/optparse.rst:631 msgid "usage = \"usage: %prog [options] arg1 arg2\"" -msgstr "" +msgstr "usage = \"usage: %prog [options] arg1 arg2\"" -#: ../../library/optparse.rst:522 +#: ../../library/optparse.rst:633 msgid "" ":mod:`optparse` expands ``%prog`` in the usage string to the name of the " "current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded " "string is then printed before the detailed option help." msgstr "" -#: ../../library/optparse.rst:526 +#: ../../library/optparse.rst:637 msgid "" "If you don't supply a usage string, :mod:`optparse` uses a bland but " "sensible default: ``\"Usage: %prog [options]\"``, which is fine if your " "script doesn't take any positional arguments." msgstr "" -#: ../../library/optparse.rst:530 +#: ../../library/optparse.rst:641 msgid "" "every option defines a help string, and doesn't worry about line-wrapping---" "\\ :mod:`optparse` takes care of wrapping lines and making the help output " "look good." msgstr "" -#: ../../library/optparse.rst:534 +#: ../../library/optparse.rst:645 msgid "" "options that take a value indicate this fact in their automatically " "generated help message, e.g. for the \"mode\" option::" msgstr "" -#: ../../library/optparse.rst:537 +#: ../../library/optparse.rst:648 msgid "-m MODE, --mode=MODE" -msgstr "" +msgstr "-m MODE, --mode=MODE" -#: ../../library/optparse.rst:539 +#: ../../library/optparse.rst:650 msgid "" "Here, \"MODE\" is called the meta-variable: it stands for the argument that " "the user is expected to supply to ``-m``/``--mode``. By default, :mod:" @@ -870,11 +1144,11 @@ msgid "" "this automatically generated option description::" msgstr "" -#: ../../library/optparse.rst:546 +#: ../../library/optparse.rst:657 msgid "-f FILE, --filename=FILE" -msgstr "" +msgstr "-f FILE, --filename=FILE" -#: ../../library/optparse.rst:548 +#: ../../library/optparse.rst:659 msgid "" "This is important for more than just saving space, though: the manually " "written help text uses the meta-variable ``FILE`` to clue the user in that " @@ -884,7 +1158,7 @@ msgid "" "users." msgstr "" -#: ../../library/optparse.rst:554 +#: ../../library/optparse.rst:665 msgid "" "options that have a default value can include ``%default`` in the help " "string---\\ :mod:`optparse` will replace it with :func:`str` of the option's " @@ -892,58 +1166,58 @@ msgid "" "``None``), ``%default`` expands to ``none``." msgstr "" -#: ../../library/optparse.rst:560 +#: ../../library/optparse.rst:671 msgid "Grouping Options" msgstr "" -#: ../../library/optparse.rst:562 +#: ../../library/optparse.rst:673 msgid "" "When dealing with many options, it is convenient to group these options for " "better help output. An :class:`OptionParser` can contain several option " "groups, each of which can contain several options." msgstr "" -#: ../../library/optparse.rst:566 +#: ../../library/optparse.rst:677 msgid "An option group is obtained using the class :class:`OptionGroup`:" msgstr "" -#: ../../library/optparse.rst:570 ../../library/optparse.rst:1641 +#: ../../library/optparse.rst:681 ../../library/optparse.rst:1752 msgid "where" msgstr "" -#: ../../library/optparse.rst:572 +#: ../../library/optparse.rst:683 msgid "" "parser is the :class:`OptionParser` instance the group will be inserted in to" msgstr "" -#: ../../library/optparse.rst:574 +#: ../../library/optparse.rst:685 msgid "title is the group title" msgstr "" -#: ../../library/optparse.rst:575 +#: ../../library/optparse.rst:686 msgid "description, optional, is a long description of the group" msgstr "" -#: ../../library/optparse.rst:577 +#: ../../library/optparse.rst:688 msgid "" ":class:`OptionGroup` inherits from :class:`OptionContainer` (like :class:" "`OptionParser`) and so the :meth:`add_option` method can be used to add an " "option to the group." msgstr "" -#: ../../library/optparse.rst:581 +#: ../../library/optparse.rst:692 msgid "" "Once all the options are declared, using the :class:`OptionParser` method :" "meth:`add_option_group` the group is added to the previously defined parser." msgstr "" -#: ../../library/optparse.rst:584 +#: ../../library/optparse.rst:695 msgid "" "Continuing with the parser defined in the previous section, adding an :class:" "`OptionGroup` to a parser is easy::" msgstr "" -#: ../../library/optparse.rst:587 +#: ../../library/optparse.rst:698 msgid "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" @@ -951,12 +1225,17 @@ msgid "" "group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" "parser.add_option_group(group)" msgstr "" +"group = OptionGroup(parser, \"Dangerous Options\",\n" +" \"Caution: use these options at your own risk. \"\n" +" \"It is believed that some of them bite.\")\n" +"group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" +"parser.add_option_group(group)" -#: ../../library/optparse.rst:593 +#: ../../library/optparse.rst:704 msgid "This would result in the following help output:" msgstr "" -#: ../../library/optparse.rst:595 +#: ../../library/optparse.rst:706 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -975,15 +1254,46 @@ msgid "" "\n" " -g Group option." msgstr "" +"Usage: [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" +" expert [default: intermediate]\n" +"\n" +" Dangerous Options:\n" +" Caution: use these options at your own risk. It is believed that some\n" +" of them bite.\n" +"\n" +" -g Group option." -#: ../../library/optparse.rst:614 +#: ../../library/optparse.rst:725 msgid "" "A bit more complete example might involve using more than one group: still " "extending the previous example::" msgstr "" - -#: ../../library/optparse.rst:617 -msgid "" + +#: ../../library/optparse.rst:728 +msgid "" +"group = OptionGroup(parser, \"Dangerous Options\",\n" +" \"Caution: use these options at your own risk. \"\n" +" \"It is believed that some of them bite.\")\n" +"group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" +"parser.add_option_group(group)\n" +"\n" +"group = OptionGroup(parser, \"Debug Options\")\n" +"group.add_option(\"-d\", \"--debug\", action=\"store_true\",\n" +" help=\"Print debug information\")\n" +"group.add_option(\"-s\", \"--sql\", action=\"store_true\",\n" +" help=\"Print all SQL statements executed\")\n" +"group.add_option(\"-e\", action=\"store_true\", help=\"Print every action " +"done\")\n" +"parser.add_option_group(group)" +msgstr "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" " \"It is believed that some of them bite.\")\n" @@ -998,13 +1308,12 @@ msgid "" "group.add_option(\"-e\", action=\"store_true\", help=\"Print every action " "done\")\n" "parser.add_option_group(group)" -msgstr "" -#: ../../library/optparse.rst:631 +#: ../../library/optparse.rst:742 msgid "that results in the following output:" msgstr "" -#: ../../library/optparse.rst:633 +#: ../../library/optparse.rst:744 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -1028,36 +1337,58 @@ msgid "" " -s, --sql Print all SQL statements executed\n" " -e Print every action done" msgstr "" +"Usage: [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or expert\n" +" [default: intermediate]\n" +"\n" +" Dangerous Options:\n" +" Caution: use these options at your own risk. It is believed that some\n" +" of them bite.\n" +"\n" +" -g Group option.\n" +"\n" +" Debug Options:\n" +" -d, --debug Print debug information\n" +" -s, --sql Print all SQL statements executed\n" +" -e Print every action done" -#: ../../library/optparse.rst:657 +#: ../../library/optparse.rst:768 msgid "" "Another interesting method, in particular when working programmatically with " "option groups is:" msgstr "" -#: ../../library/optparse.rst:662 +#: ../../library/optparse.rst:773 msgid "" "Return the :class:`OptionGroup` to which the short or long option string " "*opt_str* (e.g. ``'-o'`` or ``'--option'``) belongs. If there's no such :" "class:`OptionGroup`, return ``None``." msgstr "" -#: ../../library/optparse.rst:669 +#: ../../library/optparse.rst:780 msgid "Printing a version string" msgstr "" -#: ../../library/optparse.rst:671 +#: ../../library/optparse.rst:782 msgid "" "Similar to the brief usage string, :mod:`optparse` can also print a version " "string for your program. You have to supply the string as the ``version`` " "argument to OptionParser::" msgstr "" -#: ../../library/optparse.rst:675 +#: ../../library/optparse.rst:786 msgid "parser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")" msgstr "" +"parser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")" -#: ../../library/optparse.rst:677 +#: ../../library/optparse.rst:788 msgid "" "``%prog`` is expanded just like it is in ``usage``. Apart from that, " "``version`` can contain anything you like. When you supply it, :mod:" @@ -1066,23 +1397,25 @@ msgid "" "string (by replacing ``%prog``), prints it to stdout, and exits." msgstr "" -#: ../../library/optparse.rst:683 +#: ../../library/optparse.rst:794 msgid "For example, if your script is called ``/usr/bin/foo``:" msgstr "" -#: ../../library/optparse.rst:685 +#: ../../library/optparse.rst:796 msgid "" "$ /usr/bin/foo --version\n" "foo 1.0" msgstr "" +"$ /usr/bin/foo --version\n" +"foo 1.0" -#: ../../library/optparse.rst:690 +#: ../../library/optparse.rst:801 msgid "" "The following two methods can be used to print and get the ``version`` " "string:" msgstr "" -#: ../../library/optparse.rst:694 +#: ../../library/optparse.rst:805 msgid "" "Print the version message for the current program (``self.version``) to " "*file* (default stdout). As with :meth:`print_usage`, any occurrence of " @@ -1090,17 +1423,17 @@ msgid "" "program. Does nothing if ``self.version`` is empty or undefined." msgstr "" -#: ../../library/optparse.rst:701 +#: ../../library/optparse.rst:812 msgid "" "Same as :meth:`print_version` but returns the version string instead of " "printing it." msgstr "" -#: ../../library/optparse.rst:708 +#: ../../library/optparse.rst:819 msgid "How :mod:`optparse` handles errors" msgstr "" -#: ../../library/optparse.rst:710 +#: ../../library/optparse.rst:821 msgid "" "There are two broad classes of errors that :mod:`optparse` has to worry " "about: programmer errors and user errors. Programmer errors are usually " @@ -1110,7 +1443,7 @@ msgid "" "OptionError` or :exc:`TypeError`) and let the program crash." msgstr "" -#: ../../library/optparse.rst:717 +#: ../../library/optparse.rst:828 msgid "" "Handling user errors is much more important, since they are guaranteed to " "happen no matter how stable your code is. :mod:`optparse` can automatically " @@ -1121,70 +1454,82 @@ msgid "" "error condition::" msgstr "" -#: ../../library/optparse.rst:725 +#: ../../library/optparse.rst:836 msgid "" "(options, args) = parser.parse_args()\n" "...\n" "if options.a and options.b:\n" " parser.error(\"options -a and -b are mutually exclusive\")" msgstr "" +"(options, args) = parser.parse_args()\n" +"...\n" +"if options.a and options.b:\n" +" parser.error(\"options -a and -b are mutually exclusive\")" -#: ../../library/optparse.rst:730 +#: ../../library/optparse.rst:841 msgid "" "In either case, :mod:`optparse` handles the error the same way: it prints " "the program's usage message and an error message to standard error and exits " "with error status 2." msgstr "" -#: ../../library/optparse.rst:734 +#: ../../library/optparse.rst:845 msgid "" "Consider the first example above, where the user passes ``4x`` to an option " "that takes an integer:" msgstr "" -#: ../../library/optparse.rst:737 +#: ../../library/optparse.rst:848 msgid "" "$ /usr/bin/foo -n 4x\n" "Usage: foo [options]\n" "\n" "foo: error: option -n: invalid integer value: '4x'" msgstr "" +"$ /usr/bin/foo -n 4x\n" +"Usage: foo [options]\n" +"\n" +"foo: error: option -n: invalid integer value: '4x'" -#: ../../library/optparse.rst:744 +#: ../../library/optparse.rst:855 msgid "Or, where the user fails to pass a value at all:" msgstr "" -#: ../../library/optparse.rst:746 +#: ../../library/optparse.rst:857 msgid "" "$ /usr/bin/foo -n\n" "Usage: foo [options]\n" "\n" "foo: error: -n option requires an argument" msgstr "" +"$ /usr/bin/foo -n\n" +"Usage: foo [options]\n" +"\n" +"foo: error: -n option requires an argument" -#: ../../library/optparse.rst:753 +#: ../../library/optparse.rst:864 msgid "" ":mod:`optparse`\\ -generated error messages take care always to mention the " "option involved in the error; be sure to do the same when calling :func:" "`OptionParser.error` from your application code." msgstr "" -#: ../../library/optparse.rst:757 +#: ../../library/optparse.rst:868 msgid "" "If :mod:`optparse`'s default error-handling behaviour does not suit your " "needs, you'll need to subclass OptionParser and override its :meth:" "`~OptionParser.exit` and/or :meth:`~OptionParser.error` methods." msgstr "" -#: ../../library/optparse.rst:765 +#: ../../library/optparse.rst:876 msgid "Putting it all together" msgstr "" -#: ../../library/optparse.rst:767 +#: ../../library/optparse.rst:878 msgid "Here's what :mod:`optparse`\\ -based scripts usually look like::" msgstr "" -#: ../../library/optparse.rst:769 +#: ../../library/optparse.rst:880 msgid "" "from optparse import OptionParser\n" "...\n" @@ -1208,33 +1553,54 @@ msgid "" "if __name__ == \"__main__\":\n" " main()" msgstr "" +"from optparse import OptionParser\n" +"...\n" +"def main():\n" +" usage = \"usage: %prog [options] arg\"\n" +" parser = OptionParser(usage)\n" +" parser.add_option(\"-f\", \"--file\", dest=\"filename\",\n" +" help=\"read data from FILENAME\")\n" +" parser.add_option(\"-v\", \"--verbose\",\n" +" action=\"store_true\", dest=\"verbose\")\n" +" parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\")\n" +" ...\n" +" (options, args) = parser.parse_args()\n" +" if len(args) != 1:\n" +" parser.error(\"incorrect number of arguments\")\n" +" if options.verbose:\n" +" print(\"reading %s...\" % options.filename)\n" +" ...\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" -#: ../../library/optparse.rst:795 +#: ../../library/optparse.rst:906 msgid "Reference Guide" msgstr "" -#: ../../library/optparse.rst:801 +#: ../../library/optparse.rst:912 msgid "Creating the parser" msgstr "" -#: ../../library/optparse.rst:803 +#: ../../library/optparse.rst:914 msgid "" "The first step in using :mod:`optparse` is to create an OptionParser " "instance." msgstr "" -#: ../../library/optparse.rst:807 +#: ../../library/optparse.rst:918 msgid "" "The OptionParser constructor has no required arguments, but a number of " "optional keyword arguments. You should always pass them as keyword " "arguments, i.e. do not rely on the order in which the arguments are declared." msgstr "" -#: ../../library/optparse.rst:811 +#: ../../library/optparse.rst:922 msgid "``usage`` (default: ``\"%prog [options]\"``)" msgstr "" -#: ../../library/optparse.rst:812 +#: ../../library/optparse.rst:923 msgid "" "The usage summary to print when your program is run incorrectly or with a " "help option. When :mod:`optparse` prints the usage string, it expands " @@ -1243,11 +1609,11 @@ msgid "" "value :const:`optparse.SUPPRESS_USAGE`." msgstr "" -#: ../../library/optparse.rst:818 +#: ../../library/optparse.rst:929 msgid "``option_list`` (default: ``[]``)" msgstr "" -#: ../../library/optparse.rst:819 +#: ../../library/optparse.rst:930 msgid "" "A list of Option objects to populate the parser with. The options in " "``option_list`` are added after any options in ``standard_option_list`` (a " @@ -1256,19 +1622,19 @@ msgid "" "the parser instead." msgstr "" -#: ../../library/optparse.rst:825 +#: ../../library/optparse.rst:936 msgid "``option_class`` (default: optparse.Option)" msgstr "" -#: ../../library/optparse.rst:826 +#: ../../library/optparse.rst:937 msgid "Class to use when adding options to the parser in :meth:`add_option`." msgstr "" -#: ../../library/optparse.rst:828 +#: ../../library/optparse.rst:939 msgid "``version`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:829 +#: ../../library/optparse.rst:940 msgid "" "A version string to print when the user supplies a version option. If you " "supply a true value for ``version``, :mod:`optparse` automatically adds a " @@ -1276,21 +1642,21 @@ msgid "" "``%prog`` is expanded the same as for ``usage``." msgstr "" -#: ../../library/optparse.rst:834 +#: ../../library/optparse.rst:945 msgid "``conflict_handler`` (default: ``\"error\"``)" msgstr "" -#: ../../library/optparse.rst:835 +#: ../../library/optparse.rst:946 msgid "" "Specifies what to do when options with conflicting option strings are added " "to the parser; see section :ref:`optparse-conflicts-between-options`." msgstr "" -#: ../../library/optparse.rst:839 +#: ../../library/optparse.rst:950 msgid "``description`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:840 +#: ../../library/optparse.rst:951 msgid "" "A paragraph of text giving a brief overview of your program. :mod:`optparse` " "reformats this paragraph to fit the current terminal width and prints it " @@ -1298,74 +1664,74 @@ msgid "" "options)." msgstr "" -#: ../../library/optparse.rst:845 +#: ../../library/optparse.rst:956 msgid "``formatter`` (default: a new :class:`IndentedHelpFormatter`)" msgstr "" -#: ../../library/optparse.rst:846 +#: ../../library/optparse.rst:957 msgid "" "An instance of optparse.HelpFormatter that will be used for printing help " "text. :mod:`optparse` provides two concrete classes for this purpose: " "IndentedHelpFormatter and TitledHelpFormatter." msgstr "" -#: ../../library/optparse.rst:850 +#: ../../library/optparse.rst:961 msgid "``add_help_option`` (default: ``True``)" msgstr "" -#: ../../library/optparse.rst:851 +#: ../../library/optparse.rst:962 msgid "" "If true, :mod:`optparse` will add a help option (with option strings ``-h`` " "and ``--help``) to the parser." msgstr "" -#: ../../library/optparse.rst:854 +#: ../../library/optparse.rst:965 msgid "``prog``" msgstr "``prog``" -#: ../../library/optparse.rst:855 +#: ../../library/optparse.rst:966 msgid "" "The string to use when expanding ``%prog`` in ``usage`` and ``version`` " "instead of ``os.path.basename(sys.argv[0])``." msgstr "" -#: ../../library/optparse.rst:858 +#: ../../library/optparse.rst:969 msgid "``epilog`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:859 +#: ../../library/optparse.rst:970 msgid "A paragraph of help text to print after the option help." msgstr "" -#: ../../library/optparse.rst:864 +#: ../../library/optparse.rst:975 msgid "Populating the parser" msgstr "" -#: ../../library/optparse.rst:866 +#: ../../library/optparse.rst:977 msgid "" "There are several ways to populate the parser with options. The preferred " "way is by using :meth:`OptionParser.add_option`, as shown in section :ref:" "`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:" msgstr "" -#: ../../library/optparse.rst:870 +#: ../../library/optparse.rst:981 msgid "pass it an Option instance (as returned by :func:`make_option`)" msgstr "" -#: ../../library/optparse.rst:872 +#: ../../library/optparse.rst:983 msgid "" "pass it any combination of positional and keyword arguments that are " "acceptable to :func:`make_option` (i.e., to the Option constructor), and it " "will create the Option instance for you" msgstr "" -#: ../../library/optparse.rst:876 +#: ../../library/optparse.rst:987 msgid "" "The other alternative is to pass a list of pre-constructed Option instances " "to the OptionParser constructor, as in::" msgstr "" -#: ../../library/optparse.rst:879 +#: ../../library/optparse.rst:990 msgid "" "option_list = [\n" " make_option(\"-f\", \"--filename\",\n" @@ -1375,8 +1741,15 @@ msgid "" " ]\n" "parser = OptionParser(option_list=option_list)" msgstr "" +"option_list = [\n" +" make_option(\"-f\", \"--filename\",\n" +" action=\"store\", type=\"string\", dest=\"filename\"),\n" +" make_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\"),\n" +" ]\n" +"parser = OptionParser(option_list=option_list)" -#: ../../library/optparse.rst:887 +#: ../../library/optparse.rst:998 msgid "" "(:func:`make_option` is a factory function for creating Option instances; " "currently it is an alias for the Option constructor. A future version of :" @@ -1385,40 +1758,40 @@ msgid "" "Option directly.)" msgstr "" -#: ../../library/optparse.rst:896 +#: ../../library/optparse.rst:1007 msgid "Defining options" -msgstr "" +msgstr "定義選項" -#: ../../library/optparse.rst:898 +#: ../../library/optparse.rst:1009 msgid "" "Each Option instance represents a set of synonymous command-line option " "strings, e.g. ``-f`` and ``--file``. You can specify any number of short or " "long option strings, but you must specify at least one overall option string." msgstr "" -#: ../../library/optparse.rst:902 +#: ../../library/optparse.rst:1013 msgid "" "The canonical way to create an :class:`Option` instance is with the :meth:" "`add_option` method of :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:908 +#: ../../library/optparse.rst:1019 msgid "To define an option with only a short option string::" msgstr "" -#: ../../library/optparse.rst:910 +#: ../../library/optparse.rst:1021 msgid "parser.add_option(\"-f\", attr=value, ...)" -msgstr "" +msgstr "parser.add_option(\"-f\", attr=value, ...)" -#: ../../library/optparse.rst:912 +#: ../../library/optparse.rst:1023 msgid "And to define an option with only a long option string::" msgstr "" -#: ../../library/optparse.rst:914 +#: ../../library/optparse.rst:1025 msgid "parser.add_option(\"--foo\", attr=value, ...)" -msgstr "" +msgstr "parser.add_option(\"--foo\", attr=value, ...)" -#: ../../library/optparse.rst:916 +#: ../../library/optparse.rst:1027 msgid "" "The keyword arguments define attributes of the new Option object. The most " "important option attribute is :attr:`~Option.action`, and it largely " @@ -1427,69 +1800,69 @@ msgid "" "raises an :exc:`OptionError` exception explaining your mistake." msgstr "" -#: ../../library/optparse.rst:922 +#: ../../library/optparse.rst:1033 msgid "" "An option's *action* determines what :mod:`optparse` does when it encounters " "this option on the command-line. The standard option actions hard-coded " "into :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:926 +#: ../../library/optparse.rst:1037 msgid "``\"store\"``" msgstr "``\"store\"``" -#: ../../library/optparse.rst:927 +#: ../../library/optparse.rst:1038 msgid "store this option's argument (default)" msgstr "" -#: ../../library/optparse.rst:932 +#: ../../library/optparse.rst:1043 msgid "``\"store_true\"``" msgstr "``\"store_true\"``" -#: ../../library/optparse.rst:933 +#: ../../library/optparse.rst:1044 msgid "store ``True``" msgstr "" -#: ../../library/optparse.rst:935 +#: ../../library/optparse.rst:1046 msgid "``\"store_false\"``" msgstr "``\"store_false\"``" -#: ../../library/optparse.rst:936 +#: ../../library/optparse.rst:1047 msgid "store ``False``" msgstr "" -#: ../../library/optparse.rst:941 +#: ../../library/optparse.rst:1052 msgid "``\"append_const\"``" msgstr "``\"append_const\"``" -#: ../../library/optparse.rst:942 +#: ../../library/optparse.rst:1053 msgid "append a constant value to a list, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:950 ../../library/optparse.rst:1245 +#: ../../library/optparse.rst:1061 ../../library/optparse.rst:1356 msgid "``\"help\"``" msgstr "``\"help\"``" -#: ../../library/optparse.rst:951 +#: ../../library/optparse.rst:1062 msgid "" "print a usage message including all options and the documentation for them" msgstr "" -#: ../../library/optparse.rst:953 +#: ../../library/optparse.rst:1064 msgid "" "(If you don't supply an action, the default is ``\"store\"``. For this " "action, you may also supply :attr:`~Option.type` and :attr:`~Option.dest` " "option attributes; see :ref:`optparse-standard-option-actions`.)" msgstr "" -#: ../../library/optparse.rst:957 +#: ../../library/optparse.rst:1068 msgid "" "As you can see, most actions involve storing or updating a value somewhere. :" "mod:`optparse` always creates a special object for this, conventionally " "called ``options``, which is an instance of :class:`optparse.Values`." msgstr "" -#: ../../library/optparse.rst:963 +#: ../../library/optparse.rst:1074 msgid "" "An object holding parsed argument names and values as attributes. Normally " "created by calling when calling :meth:`OptionParser.parse_args`, and can be " @@ -1498,35 +1871,35 @@ msgid "" "arguments`)." msgstr "" -#: ../../library/optparse.rst:968 +#: ../../library/optparse.rst:1079 msgid "" "Option arguments (and various other values) are stored as attributes of this " "object, according to the :attr:`~Option.dest` (destination) option attribute." msgstr "" -#: ../../library/optparse.rst:972 +#: ../../library/optparse.rst:1083 msgid "For example, when you call ::" msgstr "例如說,當你呼叫: ::" -#: ../../library/optparse.rst:974 +#: ../../library/optparse.rst:1085 msgid "parser.parse_args()" msgstr "parser.parse_args()" -#: ../../library/optparse.rst:976 +#: ../../library/optparse.rst:1087 msgid "" "one of the first things :mod:`optparse` does is create the ``options`` " "object::" msgstr "" -#: ../../library/optparse.rst:978 +#: ../../library/optparse.rst:1089 msgid "options = Values()" msgstr "options = Values()" -#: ../../library/optparse.rst:980 +#: ../../library/optparse.rst:1091 msgid "If one of the options in this parser is defined with ::" msgstr "" -#: ../../library/optparse.rst:982 +#: ../../library/optparse.rst:1093 msgid "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" @@ -1534,11 +1907,11 @@ msgstr "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" -#: ../../library/optparse.rst:984 +#: ../../library/optparse.rst:1095 msgid "and the command-line being parsed includes any of the following::" msgstr "" -#: ../../library/optparse.rst:986 +#: ../../library/optparse.rst:1097 msgid "" "-ffoo\n" "-f foo\n" @@ -1550,27 +1923,27 @@ msgstr "" "--file=foo\n" "--file foo" -#: ../../library/optparse.rst:991 +#: ../../library/optparse.rst:1102 msgid "" "then :mod:`optparse`, on seeing this option, will do the equivalent of ::" msgstr "" -#: ../../library/optparse.rst:993 +#: ../../library/optparse.rst:1104 msgid "options.filename = \"foo\"" msgstr "options.filename = \"foo\"" -#: ../../library/optparse.rst:995 +#: ../../library/optparse.rst:1106 msgid "" "The :attr:`~Option.type` and :attr:`~Option.dest` option attributes are " "almost as important as :attr:`~Option.action`, but :attr:`~Option.action` is " "the only one that makes sense for *all* options." msgstr "" -#: ../../library/optparse.rst:1003 +#: ../../library/optparse.rst:1114 msgid "Option attributes" -msgstr "" +msgstr "選項屬性" -#: ../../library/optparse.rst:1007 +#: ../../library/optparse.rst:1118 msgid "" "A single command line argument, with various attributes passed by keyword to " "the constructor. Normally created with :meth:`OptionParser.add_option` " @@ -1578,7 +1951,7 @@ msgid "" "*option_class* argument to :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:1013 +#: ../../library/optparse.rst:1124 msgid "" "The following option attributes may be passed as keyword arguments to :meth:" "`OptionParser.add_option`. If you pass an option attribute that is not " @@ -1586,33 +1959,33 @@ msgid "" "attribute, :mod:`optparse` raises :exc:`OptionError`." msgstr "" -#: ../../library/optparse.rst:1020 +#: ../../library/optparse.rst:1131 msgid "(default: ``\"store\"``)" msgstr "(預設值: ``\"store\"`` )" -#: ../../library/optparse.rst:1022 +#: ../../library/optparse.rst:1133 msgid "" "Determines :mod:`optparse`'s behaviour when this option is seen on the " "command line; the available options are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1028 +#: ../../library/optparse.rst:1139 msgid "(default: ``\"string\"``)" msgstr "(預設值: ``\"string\"`` )" -#: ../../library/optparse.rst:1030 +#: ../../library/optparse.rst:1141 msgid "" "The argument type expected by this option (e.g., ``\"string\"`` or " "``\"int\"``); the available option types are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1036 ../../library/optparse.rst:1086 +#: ../../library/optparse.rst:1147 ../../library/optparse.rst:1197 msgid "(default: derived from option strings)" msgstr "" -#: ../../library/optparse.rst:1038 +#: ../../library/optparse.rst:1149 msgid "" "If the option's action implies writing or modifying a value somewhere, this " "tells :mod:`optparse` where to write it: :attr:`~Option.dest` names an " @@ -1620,47 +1993,47 @@ msgid "" "the command line." msgstr "" -#: ../../library/optparse.rst:1045 +#: ../../library/optparse.rst:1156 msgid "" "The value to use for this option's destination if the option is not seen on " "the command line. See also :meth:`OptionParser.set_defaults`." msgstr "" -#: ../../library/optparse.rst:1050 +#: ../../library/optparse.rst:1161 msgid "(default: 1)" msgstr "(預設值:1)" -#: ../../library/optparse.rst:1052 +#: ../../library/optparse.rst:1163 msgid "" "How many arguments of type :attr:`~Option.type` should be consumed when this " "option is seen. If > 1, :mod:`optparse` will store a tuple of values to :" "attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1058 +#: ../../library/optparse.rst:1169 msgid "For actions that store a constant value, the constant value to store." msgstr "" -#: ../../library/optparse.rst:1062 +#: ../../library/optparse.rst:1173 msgid "" "For options of type ``\"choice\"``, the list of strings the user may choose " "from." msgstr "" -#: ../../library/optparse.rst:1067 +#: ../../library/optparse.rst:1178 msgid "" "For options with action ``\"callback\"``, the callable to call when this " "option is seen. See section :ref:`optparse-option-callbacks` for detail on " "the arguments passed to the callable." msgstr "" -#: ../../library/optparse.rst:1074 +#: ../../library/optparse.rst:1185 msgid "" "Additional positional and keyword arguments to pass to ``callback`` after " "the four standard callback arguments." msgstr "" -#: ../../library/optparse.rst:1079 +#: ../../library/optparse.rst:1190 msgid "" "Help text to print for this option when listing all available options after " "the user supplies a :attr:`~Option.help` option (such as ``--help``). If no " @@ -1668,17 +2041,17 @@ msgid "" "this option, use the special value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1088 +#: ../../library/optparse.rst:1199 msgid "" "Stand-in for the option argument(s) to use when printing help text. See " "section :ref:`optparse-tutorial` for an example." msgstr "" -#: ../../library/optparse.rst:1095 +#: ../../library/optparse.rst:1206 msgid "Standard option actions" msgstr "" -#: ../../library/optparse.rst:1097 +#: ../../library/optparse.rst:1208 msgid "" "The various option actions all have slightly different requirements and " "effects. Most actions have several relevant option attributes which you may " @@ -1686,13 +2059,13 @@ msgid "" "attributes, which you must specify for any option using that action." msgstr "" -#: ../../library/optparse.rst:1102 +#: ../../library/optparse.rst:1213 msgid "" "``\"store\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1105 +#: ../../library/optparse.rst:1216 msgid "" "The option must be followed by an argument, which is converted to a value " "according to :attr:`~Option.type` and stored in :attr:`~Option.dest`. If :" @@ -1702,17 +2075,17 @@ msgid "" "option-types` section." msgstr "" -#: ../../library/optparse.rst:1112 +#: ../../library/optparse.rst:1223 msgid "" "If :attr:`~Option.choices` is supplied (a list or tuple of strings), the " "type defaults to ``\"choice\"``." msgstr "" -#: ../../library/optparse.rst:1115 +#: ../../library/optparse.rst:1226 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." msgstr "" -#: ../../library/optparse.rst:1117 +#: ../../library/optparse.rst:1228 msgid "" "If :attr:`~Option.dest` is not supplied, :mod:`optparse` derives a " "destination from the first long option string (e.g., ``--foo-bar`` implies " @@ -1720,13 +2093,13 @@ msgid "" "destination from the first short option string (e.g., ``-f`` implies ``f``)." msgstr "" -#: ../../library/optparse.rst:1122 ../../library/optparse.rst:1142 -#: ../../library/optparse.rst:1164 ../../library/optparse.rst:1182 -#: ../../library/optparse.rst:1221 ../../library/optparse.rst:1259 +#: ../../library/optparse.rst:1233 ../../library/optparse.rst:1253 +#: ../../library/optparse.rst:1275 ../../library/optparse.rst:1293 +#: ../../library/optparse.rst:1332 ../../library/optparse.rst:1370 msgid "Example::" msgstr "範例: ::" -#: ../../library/optparse.rst:1124 +#: ../../library/optparse.rst:1235 msgid "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" @@ -1734,19 +2107,19 @@ msgstr "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" -#: ../../library/optparse.rst:1127 +#: ../../library/optparse.rst:1238 msgid "As it parses the command line ::" msgstr "" -#: ../../library/optparse.rst:1129 +#: ../../library/optparse.rst:1240 msgid "-f foo.txt -p 1 -3.5 4 -fbar.txt" msgstr "-f foo.txt -p 1 -3.5 4 -fbar.txt" -#: ../../library/optparse.rst:1131 +#: ../../library/optparse.rst:1242 msgid ":mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1133 +#: ../../library/optparse.rst:1244 msgid "" "options.f = \"foo.txt\"\n" "options.point = (1.0, -3.5, 4.0)\n" @@ -1756,17 +2129,17 @@ msgstr "" "options.point = (1.0, -3.5, 4.0)\n" "options.f = \"bar.txt\"" -#: ../../library/optparse.rst:1137 +#: ../../library/optparse.rst:1248 msgid "" "``\"store_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1140 +#: ../../library/optparse.rst:1251 msgid "The value :attr:`~Option.const` is stored in :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1144 +#: ../../library/optparse.rst:1255 msgid "" "parser.add_option(\"-q\", \"--quiet\",\n" " action=\"store_const\", const=0, dest=\"verbose\")\n" @@ -1782,33 +2155,33 @@ msgstr "" "parser.add_option(\"--noisy\",\n" " action=\"store_const\", const=2, dest=\"verbose\")" -#: ../../library/optparse.rst:1151 +#: ../../library/optparse.rst:1262 msgid "If ``--noisy`` is seen, :mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1153 +#: ../../library/optparse.rst:1264 msgid "options.verbose = 2" msgstr "options.verbose = 2" -#: ../../library/optparse.rst:1155 +#: ../../library/optparse.rst:1266 msgid "``\"store_true\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1157 +#: ../../library/optparse.rst:1268 msgid "" "A special case of ``\"store_const\"`` that stores ``True`` to :attr:`~Option." "dest`." msgstr "" -#: ../../library/optparse.rst:1160 +#: ../../library/optparse.rst:1271 msgid "``\"store_false\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1162 +#: ../../library/optparse.rst:1273 msgid "Like ``\"store_true\"``, but stores ``False``." msgstr "" -#: ../../library/optparse.rst:1166 +#: ../../library/optparse.rst:1277 msgid "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" @@ -1816,13 +2189,13 @@ msgstr "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" -#: ../../library/optparse.rst:1169 +#: ../../library/optparse.rst:1280 msgid "" "``\"append\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1172 +#: ../../library/optparse.rst:1283 msgid "" "The option must be followed by an argument, which is appended to the list " "in :attr:`~Option.dest`. If no default value for :attr:`~Option.dest` is " @@ -1832,25 +2205,25 @@ msgid "" "is appended to :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1179 +#: ../../library/optparse.rst:1290 msgid "" "The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same " "as for the ``\"store\"`` action." msgstr "" -#: ../../library/optparse.rst:1184 +#: ../../library/optparse.rst:1295 msgid "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" msgstr "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" -#: ../../library/optparse.rst:1186 +#: ../../library/optparse.rst:1297 msgid "" "If ``-t3`` is seen on the command-line, :mod:`optparse` does the equivalent " "of::" msgstr "" -#: ../../library/optparse.rst:1189 +#: ../../library/optparse.rst:1300 msgid "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" @@ -1858,15 +2231,15 @@ msgstr "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" -#: ../../library/optparse.rst:1192 +#: ../../library/optparse.rst:1303 msgid "If, a little later on, ``--tracks=4`` is seen, it does::" msgstr "" -#: ../../library/optparse.rst:1194 +#: ../../library/optparse.rst:1305 msgid "options.tracks.append(int(\"4\"))" msgstr "options.tracks.append(int(\"4\"))" -#: ../../library/optparse.rst:1196 +#: ../../library/optparse.rst:1307 msgid "" "The ``append`` action calls the ``append`` method on the current value of " "the option. This means that any default value specified must have an " @@ -1875,7 +2248,7 @@ msgid "" "with any values from the command line appended after those default values::" msgstr "" -#: ../../library/optparse.rst:1202 +#: ../../library/optparse.rst:1313 msgid "" ">>> parser.add_option(\"--files\", action=\"append\", default=['~/.mypkg/" "defaults'])\n" @@ -1889,13 +2262,13 @@ msgstr "" ">>> opts.files\n" "['~/.mypkg/defaults', 'overrides.mypkg']" -#: ../../library/optparse.rst:1207 +#: ../../library/optparse.rst:1318 msgid "" "``\"append_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1210 +#: ../../library/optparse.rst:1321 msgid "" "Like ``\"store_const\"``, but the value :attr:`~Option.const` is appended " "to :attr:`~Option.dest`; as with ``\"append\"``, :attr:`~Option.dest` " @@ -1903,28 +2276,28 @@ msgid "" "time the option is encountered." msgstr "" -#: ../../library/optparse.rst:1215 +#: ../../library/optparse.rst:1326 msgid "``\"count\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1217 +#: ../../library/optparse.rst:1328 msgid "" "Increment the integer stored at :attr:`~Option.dest`. If no default value " "is supplied, :attr:`~Option.dest` is set to zero before being incremented " "the first time." msgstr "" -#: ../../library/optparse.rst:1223 +#: ../../library/optparse.rst:1334 msgid "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" msgstr "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" -#: ../../library/optparse.rst:1225 +#: ../../library/optparse.rst:1336 msgid "" "The first time ``-v`` is seen on the command line, :mod:`optparse` does the " "equivalent of::" msgstr "" -#: ../../library/optparse.rst:1228 +#: ../../library/optparse.rst:1339 msgid "" "options.verbosity = 0\n" "options.verbosity += 1" @@ -1932,36 +2305,36 @@ msgstr "" "options.verbosity = 0\n" "options.verbosity += 1" -#: ../../library/optparse.rst:1231 +#: ../../library/optparse.rst:1342 msgid "Every subsequent occurrence of ``-v`` results in ::" msgstr "" -#: ../../library/optparse.rst:1233 +#: ../../library/optparse.rst:1344 msgid "options.verbosity += 1" msgstr "options.verbosity += 1" -#: ../../library/optparse.rst:1235 +#: ../../library/optparse.rst:1346 msgid "" "``\"callback\"`` [required: :attr:`~Option.callback`; relevant: :attr:" "`~Option.type`, :attr:`~Option.nargs`, :attr:`~Option.callback_args`, :attr:" "`~Option.callback_kwargs`]" msgstr "" -#: ../../library/optparse.rst:1239 +#: ../../library/optparse.rst:1350 msgid "" "Call the function specified by :attr:`~Option.callback`, which is called " "as ::" msgstr "" -#: ../../library/optparse.rst:1241 ../../library/optparse.rst:1639 +#: ../../library/optparse.rst:1352 ../../library/optparse.rst:1750 msgid "func(option, opt_str, value, parser, *args, **kwargs)" msgstr "func(option, opt_str, value, parser, *args, **kwargs)" -#: ../../library/optparse.rst:1243 +#: ../../library/optparse.rst:1354 msgid "See section :ref:`optparse-option-callbacks` for more detail." msgstr "更多細節請見 :ref:`optparse-option-callbacks`。" -#: ../../library/optparse.rst:1247 +#: ../../library/optparse.rst:1358 msgid "" "Prints a complete help message for all the options in the current option " "parser. The help message is constructed from the ``usage`` string passed to " @@ -1969,20 +2342,20 @@ msgid "" "every option." msgstr "" -#: ../../library/optparse.rst:1252 +#: ../../library/optparse.rst:1363 msgid "" "If no :attr:`~Option.help` string is supplied for an option, it will still " "be listed in the help message. To omit an option entirely, use the special " "value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1256 +#: ../../library/optparse.rst:1367 msgid "" ":mod:`optparse` automatically adds a :attr:`~Option.help` option to all " "OptionParsers, so you do not normally need to create one." msgstr "" -#: ../../library/optparse.rst:1261 +#: ../../library/optparse.rst:1372 msgid "" "from optparse import OptionParser, SUPPRESS_HELP\n" "\n" @@ -1998,14 +2371,14 @@ msgid "" "parser.add_option(\"--secret\", help=SUPPRESS_HELP)" msgstr "" -#: ../../library/optparse.rst:1274 +#: ../../library/optparse.rst:1385 msgid "" "If :mod:`optparse` sees either ``-h`` or ``--help`` on the command line, it " "will print something like the following help message to stdout (assuming " "``sys.argv[0]`` is ``\"foo.py\"``):" msgstr "" -#: ../../library/optparse.rst:1278 +#: ../../library/optparse.rst:1389 msgid "" "Usage: foo.py [options]\n" "\n" @@ -2021,17 +2394,17 @@ msgstr "" " -v Be moderately verbose\n" " --file=FILENAME Input file to read data from" -#: ../../library/optparse.rst:1287 +#: ../../library/optparse.rst:1398 msgid "" "After printing the help message, :mod:`optparse` terminates your process " "with ``sys.exit(0)``." msgstr "" -#: ../../library/optparse.rst:1290 +#: ../../library/optparse.rst:1401 msgid "``\"version\"``" msgstr "``\"version\"``" -#: ../../library/optparse.rst:1292 +#: ../../library/optparse.rst:1403 msgid "" "Prints the version number supplied to the OptionParser to stdout and exits. " "The version number is actually formatted and printed by the " @@ -2041,58 +2414,58 @@ msgid "" "since :mod:`optparse` automatically adds them when needed." msgstr "" -#: ../../library/optparse.rst:1303 +#: ../../library/optparse.rst:1414 msgid "Standard option types" msgstr "" -#: ../../library/optparse.rst:1305 +#: ../../library/optparse.rst:1416 msgid "" ":mod:`optparse` has five built-in option types: ``\"string\"``, ``\"int\"``, " "``\"choice\"``, ``\"float\"`` and ``\"complex\"``. If you need to add new " "option types, see section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:1309 +#: ../../library/optparse.rst:1420 msgid "" "Arguments to string options are not checked or converted in any way: the " "text on the command line is stored in the destination (or passed to the " "callback) as-is." msgstr "" -#: ../../library/optparse.rst:1312 +#: ../../library/optparse.rst:1423 msgid "Integer arguments (type ``\"int\"``) are parsed as follows:" msgstr "" -#: ../../library/optparse.rst:1314 +#: ../../library/optparse.rst:1425 msgid "if the number starts with ``0x``, it is parsed as a hexadecimal number" msgstr "" -#: ../../library/optparse.rst:1316 +#: ../../library/optparse.rst:1427 msgid "if the number starts with ``0``, it is parsed as an octal number" msgstr "" -#: ../../library/optparse.rst:1318 +#: ../../library/optparse.rst:1429 msgid "if the number starts with ``0b``, it is parsed as a binary number" msgstr "" -#: ../../library/optparse.rst:1320 +#: ../../library/optparse.rst:1431 msgid "otherwise, the number is parsed as a decimal number" msgstr "" -#: ../../library/optparse.rst:1323 +#: ../../library/optparse.rst:1434 msgid "" "The conversion is done by calling :func:`int` with the appropriate base (2, " "8, 10, or 16). If this fails, so will :mod:`optparse`, although with a more " "useful error message." msgstr "" -#: ../../library/optparse.rst:1327 +#: ../../library/optparse.rst:1438 msgid "" "``\"float\"`` and ``\"complex\"`` option arguments are converted directly " "with :func:`float` and :func:`complex`, with similar error-handling." msgstr "" -#: ../../library/optparse.rst:1330 +#: ../../library/optparse.rst:1441 msgid "" "``\"choice\"`` options are a subtype of ``\"string\"`` options. The :attr:" "`~Option.choices` option attribute (a sequence of strings) defines the set " @@ -2101,63 +2474,63 @@ msgid "" "`OptionValueError` if an invalid string is given." msgstr "" -#: ../../library/optparse.rst:1340 +#: ../../library/optparse.rst:1451 msgid "Parsing arguments" msgstr "剖析引數" -#: ../../library/optparse.rst:1342 +#: ../../library/optparse.rst:1453 msgid "" "The whole point of creating and populating an OptionParser is to call its :" "meth:`~OptionParser.parse_args` method." msgstr "" -#: ../../library/optparse.rst:1347 +#: ../../library/optparse.rst:1458 msgid "Parse the command-line options found in *args*." msgstr "" -#: ../../library/optparse.rst:1349 +#: ../../library/optparse.rst:1460 msgid "The input parameters are" msgstr "" -#: ../../library/optparse.rst:1351 ../../library/optparse.rst:1365 -#: ../../library/optparse.rst:1683 +#: ../../library/optparse.rst:1462 ../../library/optparse.rst:1476 +#: ../../library/optparse.rst:1794 msgid "``args``" msgstr "``args``" -#: ../../library/optparse.rst:1352 +#: ../../library/optparse.rst:1463 msgid "the list of arguments to process (default: ``sys.argv[1:]``)" msgstr "" -#: ../../library/optparse.rst:1354 +#: ../../library/optparse.rst:1465 msgid "``values``" msgstr "``values``" -#: ../../library/optparse.rst:1355 +#: ../../library/optparse.rst:1466 msgid "" "a :class:`Values` object to store option arguments in (default: a new " "instance of :class:`Values`) -- if you give an existing object, the option " "defaults will not be initialized on it" msgstr "" -#: ../../library/optparse.rst:1359 +#: ../../library/optparse.rst:1470 msgid "and the return value is a pair ``(options, args)`` where" msgstr "" -#: ../../library/optparse.rst:1361 +#: ../../library/optparse.rst:1472 msgid "``options``" msgstr "``options``" -#: ../../library/optparse.rst:1362 +#: ../../library/optparse.rst:1473 msgid "" "the same object that was passed in as *values*, or the ``optparse.Values`` " "instance created by :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1366 +#: ../../library/optparse.rst:1477 msgid "the leftover positional arguments after all options have been processed" msgstr "" -#: ../../library/optparse.rst:1368 +#: ../../library/optparse.rst:1479 msgid "" "The most common usage is to supply neither keyword argument. If you supply " "``values``, it will be modified with repeated :func:`setattr` calls (roughly " @@ -2165,7 +2538,7 @@ msgid "" "by :meth:`~OptionParser.parse_args`." msgstr "" -#: ../../library/optparse.rst:1373 +#: ../../library/optparse.rst:1484 msgid "" "If :meth:`~OptionParser.parse_args` encounters any errors in the argument " "list, it calls the OptionParser's :meth:`error` method with an appropriate " @@ -2173,69 +2546,69 @@ msgid "" "status of 2 (the traditional Unix exit status for command-line errors)." msgstr "" -#: ../../library/optparse.rst:1382 +#: ../../library/optparse.rst:1493 msgid "Querying and manipulating your option parser" msgstr "" -#: ../../library/optparse.rst:1384 +#: ../../library/optparse.rst:1495 msgid "" "The default behavior of the option parser can be customized slightly, and " "you can also poke around your option parser and see what's there. " "OptionParser provides several methods to help you out:" msgstr "" -#: ../../library/optparse.rst:1390 +#: ../../library/optparse.rst:1501 msgid "" "Set parsing to stop on the first non-option. For example, if ``-a`` and ``-" "b`` are both simple options that take no arguments, :mod:`optparse` normally " "accepts this syntax::" msgstr "" -#: ../../library/optparse.rst:1394 +#: ../../library/optparse.rst:1505 msgid "prog -a arg1 -b arg2" msgstr "prog -a arg1 -b arg2" -#: ../../library/optparse.rst:1396 +#: ../../library/optparse.rst:1507 msgid "and treats it as equivalent to ::" msgstr "" -#: ../../library/optparse.rst:1398 +#: ../../library/optparse.rst:1509 msgid "prog -a -b arg1 arg2" msgstr "prog -a -b arg1 arg2" -#: ../../library/optparse.rst:1400 +#: ../../library/optparse.rst:1511 msgid "" "To disable this feature, call :meth:`disable_interspersed_args`. This " "restores traditional Unix syntax, where option parsing stops with the first " "non-option argument." msgstr "" -#: ../../library/optparse.rst:1404 +#: ../../library/optparse.rst:1515 msgid "" "Use this if you have a command processor which runs another command which " "has options of its own and you want to make sure these options don't get " "confused. For example, each command might have a different set of options." msgstr "" -#: ../../library/optparse.rst:1410 +#: ../../library/optparse.rst:1521 msgid "" "Set parsing to not stop on the first non-option, allowing interspersing " "switches with command arguments. This is the default behavior." msgstr "" -#: ../../library/optparse.rst:1415 +#: ../../library/optparse.rst:1526 msgid "" "Returns the Option instance with the option string *opt_str*, or ``None`` if " "no options have that option string." msgstr "" -#: ../../library/optparse.rst:1420 +#: ../../library/optparse.rst:1531 msgid "" "Return ``True`` if the OptionParser has an option with option string " "*opt_str* (e.g., ``-q`` or ``--verbose``)." msgstr "" -#: ../../library/optparse.rst:1425 +#: ../../library/optparse.rst:1536 msgid "" "If the :class:`OptionParser` has an option corresponding to *opt_str*, that " "option is removed. If that option provided any other option strings, all of " @@ -2243,17 +2616,17 @@ msgid "" "option belonging to this :class:`OptionParser`, raises :exc:`ValueError`." msgstr "" -#: ../../library/optparse.rst:1434 +#: ../../library/optparse.rst:1545 msgid "Conflicts between options" msgstr "" -#: ../../library/optparse.rst:1436 +#: ../../library/optparse.rst:1547 msgid "" "If you're not careful, it's easy to define options with conflicting option " "strings::" msgstr "" -#: ../../library/optparse.rst:1439 +#: ../../library/optparse.rst:1550 msgid "" "parser.add_option(\"-n\", \"--dry-run\", ...)\n" "...\n" @@ -2263,13 +2636,13 @@ msgstr "" "...\n" "parser.add_option(\"-n\", \"--noisy\", ...)" -#: ../../library/optparse.rst:1443 +#: ../../library/optparse.rst:1554 msgid "" "(This is particularly true if you've defined your own OptionParser subclass " "with some standard options.)" msgstr "" -#: ../../library/optparse.rst:1446 +#: ../../library/optparse.rst:1557 msgid "" "Every time you add an option, :mod:`optparse` checks for conflicts with " "existing options. If it finds any, it invokes the current conflict-handling " @@ -2277,47 +2650,47 @@ msgid "" "constructor::" msgstr "" -#: ../../library/optparse.rst:1450 +#: ../../library/optparse.rst:1561 msgid "parser = OptionParser(..., conflict_handler=handler)" msgstr "parser = OptionParser(..., conflict_handler=handler)" -#: ../../library/optparse.rst:1452 +#: ../../library/optparse.rst:1563 msgid "or with a separate call::" msgstr "" -#: ../../library/optparse.rst:1454 +#: ../../library/optparse.rst:1565 msgid "parser.set_conflict_handler(handler)" msgstr "parser.set_conflict_handler(handler)" -#: ../../library/optparse.rst:1456 +#: ../../library/optparse.rst:1567 msgid "The available conflict handlers are:" msgstr "" -#: ../../library/optparse.rst:1458 +#: ../../library/optparse.rst:1569 msgid "``\"error\"`` (default)" msgstr "" -#: ../../library/optparse.rst:1459 +#: ../../library/optparse.rst:1570 msgid "" "assume option conflicts are a programming error and raise :exc:" "`OptionConflictError`" msgstr "" -#: ../../library/optparse.rst:1462 +#: ../../library/optparse.rst:1573 msgid "``\"resolve\"``" msgstr "``\"resolve\"``" -#: ../../library/optparse.rst:1463 +#: ../../library/optparse.rst:1574 msgid "resolve option conflicts intelligently (see below)" msgstr "" -#: ../../library/optparse.rst:1466 +#: ../../library/optparse.rst:1577 msgid "" "As an example, let's define an :class:`OptionParser` that resolves conflicts " "intelligently and add conflicting options to it::" msgstr "" -#: ../../library/optparse.rst:1469 +#: ../../library/optparse.rst:1580 msgid "" "parser = OptionParser(conflict_handler=\"resolve\")\n" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" @@ -2327,7 +2700,7 @@ msgstr "" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" "parser.add_option(\"-n\", \"--noisy\", ..., help=\"be noisy\")" -#: ../../library/optparse.rst:1473 +#: ../../library/optparse.rst:1584 msgid "" "At this point, :mod:`optparse` detects that a previously added option is " "already using the ``-n`` option string. Since ``conflict_handler`` is " @@ -2337,7 +2710,7 @@ msgid "" "message will reflect that::" msgstr "" -#: ../../library/optparse.rst:1479 +#: ../../library/optparse.rst:1590 msgid "" "Options:\n" " --dry-run do no harm\n" @@ -2345,7 +2718,7 @@ msgid "" " -n, --noisy be noisy" msgstr "" -#: ../../library/optparse.rst:1484 +#: ../../library/optparse.rst:1595 msgid "" "It's possible to whittle away the option strings for a previously added " "option until there are none left, and the user has no way of invoking that " @@ -2354,17 +2727,17 @@ msgid "" "Carrying on with our existing OptionParser::" msgstr "" -#: ../../library/optparse.rst:1490 +#: ../../library/optparse.rst:1601 msgid "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" msgstr "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" -#: ../../library/optparse.rst:1492 +#: ../../library/optparse.rst:1603 msgid "" "At this point, the original ``-n``/``--dry-run`` option is no longer " "accessible, so :mod:`optparse` removes it, leaving this help text::" msgstr "" -#: ../../library/optparse.rst:1495 +#: ../../library/optparse.rst:1606 msgid "" "Options:\n" " ...\n" @@ -2376,11 +2749,11 @@ msgstr "" " -n, --noisy be noisy\n" " --dry-run new dry-run option" -#: ../../library/optparse.rst:1504 +#: ../../library/optparse.rst:1615 msgid "Cleanup" msgstr "" -#: ../../library/optparse.rst:1506 +#: ../../library/optparse.rst:1617 msgid "" "OptionParser instances have several cyclic references. This should not be a " "problem for Python's garbage collector, but you may wish to break the cyclic " @@ -2390,15 +2763,15 @@ msgid "" "OptionParser." msgstr "" -#: ../../library/optparse.rst:1517 +#: ../../library/optparse.rst:1628 msgid "Other methods" msgstr "其他方法" -#: ../../library/optparse.rst:1519 +#: ../../library/optparse.rst:1630 msgid "OptionParser supports several other public methods:" msgstr "" -#: ../../library/optparse.rst:1523 +#: ../../library/optparse.rst:1634 msgid "" "Set the usage string according to the rules described above for the " "``usage`` constructor keyword argument. Passing ``None`` sets the default " @@ -2406,7 +2779,7 @@ msgid "" "message." msgstr "" -#: ../../library/optparse.rst:1529 +#: ../../library/optparse.rst:1640 msgid "" "Print the usage message for the current program (``self.usage``) to *file* " "(default stdout). Any occurrence of the string ``%prog`` in ``self.usage`` " @@ -2414,13 +2787,13 @@ msgid "" "usage`` is empty or not defined." msgstr "" -#: ../../library/optparse.rst:1536 +#: ../../library/optparse.rst:1647 msgid "" "Same as :meth:`print_usage` but returns the usage string instead of printing " "it." msgstr "" -#: ../../library/optparse.rst:1541 +#: ../../library/optparse.rst:1652 msgid "" "Set default values for several option destinations at once. Using :meth:" "`set_defaults` is the preferred way to set default values for options, since " @@ -2429,7 +2802,7 @@ msgid "" "default, and the last one wins::" msgstr "" -#: ../../library/optparse.rst:1547 +#: ../../library/optparse.rst:1658 msgid "" "parser.add_option(\"--advanced\", action=\"store_const\",\n" " dest=\"mode\", const=\"advanced\",\n" @@ -2439,11 +2812,11 @@ msgid "" " default=\"advanced\") # overrides above setting" msgstr "" -#: ../../library/optparse.rst:1554 +#: ../../library/optparse.rst:1665 msgid "To avoid this confusion, use :meth:`set_defaults`::" msgstr "" -#: ../../library/optparse.rst:1556 +#: ../../library/optparse.rst:1667 msgid "" "parser.set_defaults(mode=\"advanced\")\n" "parser.add_option(\"--advanced\", action=\"store_const\",\n" @@ -2457,11 +2830,11 @@ msgstr "" "parser.add_option(\"--novice\", action=\"store_const\",\n" " dest=\"mode\", const=\"novice\")" -#: ../../library/optparse.rst:1566 +#: ../../library/optparse.rst:1677 msgid "Option Callbacks" msgstr "" -#: ../../library/optparse.rst:1568 +#: ../../library/optparse.rst:1679 msgid "" "When :mod:`optparse`'s built-in actions and types aren't quite enough for " "your needs, you have two choices: extend :mod:`optparse` or define a " @@ -2469,25 +2842,25 @@ msgid "" "a lot of simple cases. Quite often a simple callback is all you need." msgstr "" -#: ../../library/optparse.rst:1573 +#: ../../library/optparse.rst:1684 msgid "There are two steps to defining a callback option:" msgstr "" -#: ../../library/optparse.rst:1575 +#: ../../library/optparse.rst:1686 msgid "define the option itself using the ``\"callback\"`` action" msgstr "" -#: ../../library/optparse.rst:1577 +#: ../../library/optparse.rst:1688 msgid "" "write the callback; this is a function (or method) that takes at least four " "arguments, as described below" msgstr "" -#: ../../library/optparse.rst:1584 +#: ../../library/optparse.rst:1695 msgid "Defining a callback option" msgstr "" -#: ../../library/optparse.rst:1586 +#: ../../library/optparse.rst:1697 msgid "" "As always, the easiest way to define a callback option is by using the :meth:" "`OptionParser.add_option` method. Apart from :attr:`~Option.action`, the " @@ -2495,11 +2868,11 @@ msgid "" "call::" msgstr "" -#: ../../library/optparse.rst:1590 +#: ../../library/optparse.rst:1701 msgid "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" msgstr "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" -#: ../../library/optparse.rst:1592 +#: ../../library/optparse.rst:1703 msgid "" "``callback`` is a function (or other callable object), so you must have " "already defined ``my_callback()`` when you create this callback option. In " @@ -2511,7 +2884,7 @@ msgid "" "tricky; it's covered later in this section." msgstr "" -#: ../../library/optparse.rst:1601 +#: ../../library/optparse.rst:1712 msgid "" ":mod:`optparse` always passes four particular arguments to your callback, " "and it will only pass additional arguments if you specify them via :attr:" @@ -2519,25 +2892,25 @@ msgid "" "minimal callback function signature is::" msgstr "" -#: ../../library/optparse.rst:1606 +#: ../../library/optparse.rst:1717 msgid "def my_callback(option, opt, value, parser):" msgstr "def my_callback(option, opt, value, parser):" -#: ../../library/optparse.rst:1608 +#: ../../library/optparse.rst:1719 msgid "The four arguments to a callback are described below." msgstr "" -#: ../../library/optparse.rst:1610 +#: ../../library/optparse.rst:1721 msgid "" "There are several other option attributes that you can supply when you " "define a callback option:" msgstr "" -#: ../../library/optparse.rst:1613 +#: ../../library/optparse.rst:1724 msgid ":attr:`~Option.type`" msgstr ":attr:`~Option.type`" -#: ../../library/optparse.rst:1614 +#: ../../library/optparse.rst:1725 msgid "" "has its usual meaning: as with the ``\"store\"`` or ``\"append\"`` actions, " "it instructs :mod:`optparse` to consume one argument and convert it to :attr:" @@ -2545,11 +2918,11 @@ msgid "" "though, :mod:`optparse` passes it to your callback function." msgstr "" -#: ../../library/optparse.rst:1619 +#: ../../library/optparse.rst:1730 msgid ":attr:`~Option.nargs`" msgstr ":attr:`~Option.nargs`" -#: ../../library/optparse.rst:1620 +#: ../../library/optparse.rst:1731 msgid "" "also has its usual meaning: if it is supplied and > 1, :mod:`optparse` will " "consume :attr:`~Option.nargs` arguments, each of which must be convertible " @@ -2557,43 +2930,43 @@ msgid "" "callback." msgstr "" -#: ../../library/optparse.rst:1625 +#: ../../library/optparse.rst:1736 msgid ":attr:`~Option.callback_args`" msgstr ":attr:`~Option.callback_args`" -#: ../../library/optparse.rst:1626 +#: ../../library/optparse.rst:1737 msgid "a tuple of extra positional arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1628 +#: ../../library/optparse.rst:1739 msgid ":attr:`~Option.callback_kwargs`" msgstr ":attr:`~Option.callback_kwargs`" -#: ../../library/optparse.rst:1629 +#: ../../library/optparse.rst:1740 msgid "a dictionary of extra keyword arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1635 +#: ../../library/optparse.rst:1746 msgid "How callbacks are called" msgstr "" -#: ../../library/optparse.rst:1637 +#: ../../library/optparse.rst:1748 msgid "All callbacks are called as follows::" msgstr "" -#: ../../library/optparse.rst:1643 +#: ../../library/optparse.rst:1754 msgid "``option``" msgstr "``option``" -#: ../../library/optparse.rst:1644 +#: ../../library/optparse.rst:1755 msgid "is the Option instance that's calling the callback" msgstr "" -#: ../../library/optparse.rst:1646 +#: ../../library/optparse.rst:1757 msgid "``opt_str``" msgstr "``opt_str``" -#: ../../library/optparse.rst:1647 +#: ../../library/optparse.rst:1758 msgid "" "is the option string seen on the command-line that's triggering the " "callback. (If an abbreviated long option was used, ``opt_str`` will be the " @@ -2602,11 +2975,11 @@ msgid "" "``\"--foobar\"``.)" msgstr "" -#: ../../library/optparse.rst:1653 +#: ../../library/optparse.rst:1764 msgid "``value``" msgstr "``value``" -#: ../../library/optparse.rst:1654 +#: ../../library/optparse.rst:1765 msgid "" "is the argument to this option seen on the command-line. :mod:`optparse` " "will only expect an argument if :attr:`~Option.type` is set; the type of " @@ -2616,21 +2989,21 @@ msgid "" "of values of the appropriate type." msgstr "" -#: ../../library/optparse.rst:1660 +#: ../../library/optparse.rst:1771 msgid "``parser``" msgstr "``parser``" -#: ../../library/optparse.rst:1661 +#: ../../library/optparse.rst:1772 msgid "" "is the OptionParser instance driving the whole thing, mainly useful because " "you can access some other interesting data through its instance attributes:" msgstr "" -#: ../../library/optparse.rst:1664 +#: ../../library/optparse.rst:1775 msgid "``parser.largs``" msgstr "``parser.largs``" -#: ../../library/optparse.rst:1665 +#: ../../library/optparse.rst:1776 msgid "" "the current list of leftover arguments, ie. arguments that have been " "consumed but are neither options nor option arguments. Feel free to modify " @@ -2639,22 +3012,22 @@ msgid "" "parse_args`.)" msgstr "" -#: ../../library/optparse.rst:1670 +#: ../../library/optparse.rst:1781 msgid "``parser.rargs``" msgstr "``parser.rargs``" -#: ../../library/optparse.rst:1671 +#: ../../library/optparse.rst:1782 msgid "" "the current list of remaining arguments, ie. with ``opt_str`` and ``value`` " "(if applicable) removed, and only the arguments following them still there. " "Feel free to modify ``parser.rargs``, e.g. by consuming more arguments." msgstr "" -#: ../../library/optparse.rst:1676 +#: ../../library/optparse.rst:1787 msgid "``parser.values``" msgstr "``parser.values``" -#: ../../library/optparse.rst:1677 +#: ../../library/optparse.rst:1788 msgid "" "the object where option values are by default stored (an instance of " "optparse.OptionValues). This lets callbacks use the same mechanism as the " @@ -2663,27 +3036,27 @@ msgid "" "of any options already encountered on the command-line." msgstr "" -#: ../../library/optparse.rst:1684 +#: ../../library/optparse.rst:1795 msgid "" "is a tuple of arbitrary positional arguments supplied via the :attr:`~Option." "callback_args` option attribute." msgstr "" -#: ../../library/optparse.rst:1687 +#: ../../library/optparse.rst:1798 msgid "``kwargs``" msgstr "``kwargs``" -#: ../../library/optparse.rst:1688 +#: ../../library/optparse.rst:1799 msgid "" "is a dictionary of arbitrary keyword arguments supplied via :attr:`~Option." "callback_kwargs`." msgstr "" -#: ../../library/optparse.rst:1695 +#: ../../library/optparse.rst:1806 msgid "Raising errors in a callback" msgstr "" -#: ../../library/optparse.rst:1697 +#: ../../library/optparse.rst:1808 msgid "" "The callback function should raise :exc:`OptionValueError` if there are any " "problems with the option or its argument(s). :mod:`optparse` catches this " @@ -2693,17 +3066,17 @@ msgid "" "they did wrong." msgstr "" -#: ../../library/optparse.rst:1707 +#: ../../library/optparse.rst:1818 msgid "Callback example 1: trivial callback" msgstr "" -#: ../../library/optparse.rst:1709 +#: ../../library/optparse.rst:1820 msgid "" "Here's an example of a callback option that takes no arguments, and simply " "records that the option was seen::" msgstr "" -#: ../../library/optparse.rst:1712 +#: ../../library/optparse.rst:1823 msgid "" "def record_foo_seen(option, opt_str, value, parser):\n" " parser.values.saw_foo = True\n" @@ -2715,21 +3088,21 @@ msgstr "" "\n" "parser.add_option(\"--foo\", action=\"callback\", callback=record_foo_seen)" -#: ../../library/optparse.rst:1717 +#: ../../library/optparse.rst:1828 msgid "Of course, you could do that with the ``\"store_true\"`` action." msgstr "" -#: ../../library/optparse.rst:1723 +#: ../../library/optparse.rst:1834 msgid "Callback example 2: check option order" msgstr "" -#: ../../library/optparse.rst:1725 +#: ../../library/optparse.rst:1836 msgid "" "Here's a slightly more interesting example: record the fact that ``-a`` is " "seen, but blow up if it comes after ``-b`` in the command-line. ::" msgstr "" -#: ../../library/optparse.rst:1728 +#: ../../library/optparse.rst:1839 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2747,18 +3120,18 @@ msgstr "" "parser.add_option(\"-a\", action=\"callback\", callback=check_order)\n" "parser.add_option(\"-b\", action=\"store_true\", dest=\"b\")" -#: ../../library/optparse.rst:1740 +#: ../../library/optparse.rst:1851 msgid "Callback example 3: check option order (generalized)" msgstr "" -#: ../../library/optparse.rst:1742 +#: ../../library/optparse.rst:1853 msgid "" "If you want to reuse this callback for several similar options (set a flag, " "but blow up if ``-b`` has already been seen), it needs a bit of work: the " "error message and the flag that it sets must be generalized. ::" msgstr "" -#: ../../library/optparse.rst:1746 +#: ../../library/optparse.rst:1857 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2782,11 +3155,11 @@ msgstr "" "parser.add_option(\"-c\", action=\"callback\", callback=check_order, " "dest='c')" -#: ../../library/optparse.rst:1759 +#: ../../library/optparse.rst:1870 msgid "Callback example 4: check arbitrary condition" msgstr "" -#: ../../library/optparse.rst:1761 +#: ../../library/optparse.rst:1872 msgid "" "Of course, you could put any condition in there---you're not limited to " "checking the values of already-defined options. For example, if you have " @@ -2794,7 +3167,7 @@ msgid "" "is this::" msgstr "" -#: ../../library/optparse.rst:1765 +#: ../../library/optparse.rst:1876 msgid "" "def check_moon(option, opt_str, value, parser):\n" " if is_moon_full():\n" @@ -2814,16 +3187,16 @@ msgstr "" "parser.add_option(\"--foo\",\n" " action=\"callback\", callback=check_moon, dest=\"foo\")" -#: ../../library/optparse.rst:1774 +#: ../../library/optparse.rst:1885 msgid "" "(The definition of ``is_moon_full()`` is left as an exercise for the reader.)" msgstr "" -#: ../../library/optparse.rst:1780 +#: ../../library/optparse.rst:1891 msgid "Callback example 5: fixed arguments" msgstr "" -#: ../../library/optparse.rst:1782 +#: ../../library/optparse.rst:1893 msgid "" "Things get slightly more interesting when you define callback options that " "take a fixed number of arguments. Specifying that a callback option takes " @@ -2833,12 +3206,12 @@ msgid "" "nargs`, then the option takes :attr:`~Option.nargs` arguments." msgstr "" -#: ../../library/optparse.rst:1789 +#: ../../library/optparse.rst:1900 msgid "" "Here's an example that just emulates the standard ``\"store\"`` action::" msgstr "" -#: ../../library/optparse.rst:1791 +#: ../../library/optparse.rst:1902 msgid "" "def store_value(option, opt_str, value, parser):\n" " setattr(parser.values, option.dest, value)\n" @@ -2854,18 +3227,18 @@ msgstr "" " action=\"callback\", callback=store_value,\n" " type=\"int\", nargs=3, dest=\"foo\")" -#: ../../library/optparse.rst:1798 +#: ../../library/optparse.rst:1909 msgid "" "Note that :mod:`optparse` takes care of consuming 3 arguments and converting " "them to integers for you; all you have to do is store them. (Or whatever; " "obviously you don't need a callback for this example.)" msgstr "" -#: ../../library/optparse.rst:1806 +#: ../../library/optparse.rst:1917 msgid "Callback example 6: variable arguments" msgstr "" -#: ../../library/optparse.rst:1808 +#: ../../library/optparse.rst:1919 msgid "" "Things get hairy when you want an option to take a variable number of " "arguments. For this case, you must write a callback, as :mod:`optparse` " @@ -2875,23 +3248,23 @@ msgid "" "implement the conventional rules for bare ``--`` and ``-`` arguments:" msgstr "" -#: ../../library/optparse.rst:1815 +#: ../../library/optparse.rst:1926 msgid "either ``--`` or ``-`` can be option arguments" msgstr "" -#: ../../library/optparse.rst:1817 +#: ../../library/optparse.rst:1928 msgid "" "bare ``--`` (if not the argument to some option): halt command-line " "processing and discard the ``--``" msgstr "" -#: ../../library/optparse.rst:1820 +#: ../../library/optparse.rst:1931 msgid "" "bare ``-`` (if not the argument to some option): halt command-line " "processing but keep the ``-`` (append it to ``parser.largs``)" msgstr "" -#: ../../library/optparse.rst:1823 +#: ../../library/optparse.rst:1934 msgid "" "If you want an option that takes a variable number of arguments, there are " "several subtle, tricky issues to worry about. The exact implementation you " @@ -2900,13 +3273,13 @@ msgid "" "directly)." msgstr "" -#: ../../library/optparse.rst:1829 +#: ../../library/optparse.rst:1940 msgid "" "Nevertheless, here's a stab at a callback for an option with variable " "arguments::" msgstr "" -#: ../../library/optparse.rst:1832 +#: ../../library/optparse.rst:1943 msgid "" "def vararg_callback(option, opt_str, value, parser):\n" " assert value is None\n" @@ -2936,22 +3309,22 @@ msgid "" " action=\"callback\", callback=vararg_callback)" msgstr "" -#: ../../library/optparse.rst:1863 +#: ../../library/optparse.rst:1974 msgid "Extending :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1865 +#: ../../library/optparse.rst:1976 msgid "" "Since the two major controlling factors in how :mod:`optparse` interprets " "command-line options are the action and type of each option, the most likely " "direction of extension is to add new actions and new types." msgstr "" -#: ../../library/optparse.rst:1873 +#: ../../library/optparse.rst:1984 msgid "Adding new types" msgstr "" -#: ../../library/optparse.rst:1875 +#: ../../library/optparse.rst:1986 msgid "" "To add new types, you need to define your own subclass of :mod:`optparse`'s :" "class:`Option` class. This class has a couple of attributes that define :" @@ -2959,23 +3332,23 @@ msgid "" "TYPE_CHECKER`." msgstr "" -#: ../../library/optparse.rst:1881 +#: ../../library/optparse.rst:1992 msgid "" "A tuple of type names; in your subclass, simply define a new tuple :attr:" "`TYPES` that builds on the standard one." msgstr "" -#: ../../library/optparse.rst:1886 +#: ../../library/optparse.rst:1997 msgid "" "A dictionary mapping type names to type-checking functions. A type-checking " "function has the following signature::" msgstr "" -#: ../../library/optparse.rst:1889 +#: ../../library/optparse.rst:2000 msgid "def check_mytype(option, opt, value)" msgstr "def check_mytype(option, opt, value)" -#: ../../library/optparse.rst:1891 +#: ../../library/optparse.rst:2002 msgid "" "where ``option`` is an :class:`Option` instance, ``opt`` is an option string " "(e.g., ``-f``), and ``value`` is the string from the command line that must " @@ -2986,7 +3359,7 @@ msgid "" "``value`` parameter." msgstr "" -#: ../../library/optparse.rst:1899 +#: ../../library/optparse.rst:2010 msgid "" "Your type-checking function should raise :exc:`OptionValueError` if it " "encounters any problems. :exc:`OptionValueError` takes a single string " @@ -2995,7 +3368,7 @@ msgid "" "\"`` and prints everything to stderr before terminating the process." msgstr "" -#: ../../library/optparse.rst:1905 +#: ../../library/optparse.rst:2016 msgid "" "Here's a silly example that demonstrates adding a ``\"complex\"`` option " "type to parse Python-style complex numbers on the command line. (This is " @@ -3003,11 +3376,11 @@ msgid "" "support for complex numbers, but never mind.)" msgstr "" -#: ../../library/optparse.rst:1910 +#: ../../library/optparse.rst:2021 msgid "First, the necessary imports::" msgstr "" -#: ../../library/optparse.rst:1912 +#: ../../library/optparse.rst:2023 msgid "" "from copy import copy\n" "from optparse import Option, OptionValueError" @@ -3015,13 +3388,13 @@ msgstr "" "from copy import copy\n" "from optparse import Option, OptionValueError" -#: ../../library/optparse.rst:1915 +#: ../../library/optparse.rst:2026 msgid "" "You need to define your type-checker first, since it's referred to later (in " "the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::" msgstr "" -#: ../../library/optparse.rst:1918 +#: ../../library/optparse.rst:2029 msgid "" "def check_complex(option, opt, value):\n" " try:\n" @@ -3037,11 +3410,11 @@ msgstr "" " raise OptionValueError(\n" " \"option %s: invalid complex value: %r\" % (opt, value))" -#: ../../library/optparse.rst:1925 +#: ../../library/optparse.rst:2036 msgid "Finally, the Option subclass::" msgstr "" -#: ../../library/optparse.rst:1927 +#: ../../library/optparse.rst:2038 msgid "" "class MyOption (Option):\n" " TYPES = Option.TYPES + (\"complex\",)\n" @@ -3053,7 +3426,7 @@ msgstr "" " TYPE_CHECKER = copy(Option.TYPE_CHECKER)\n" " TYPE_CHECKER[\"complex\"] = check_complex" -#: ../../library/optparse.rst:1932 +#: ../../library/optparse.rst:2043 msgid "" "(If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would " "end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:" @@ -3061,14 +3434,14 @@ msgid "" "that except good manners and common sense.)" msgstr "" -#: ../../library/optparse.rst:1937 +#: ../../library/optparse.rst:2048 msgid "" "That's it! Now you can write a script that uses the new option type just " "like any other :mod:`optparse`\\ -based script, except you have to instruct " "your OptionParser to use MyOption instead of Option::" msgstr "" -#: ../../library/optparse.rst:1941 +#: ../../library/optparse.rst:2052 msgid "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" @@ -3076,14 +3449,14 @@ msgstr "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" -#: ../../library/optparse.rst:1944 +#: ../../library/optparse.rst:2055 msgid "" "Alternately, you can build your own option list and pass it to OptionParser; " "if you don't use :meth:`add_option` in the above way, you don't need to tell " "OptionParser which option class to use::" msgstr "" -#: ../../library/optparse.rst:1948 +#: ../../library/optparse.rst:2059 msgid "" "option_list = [MyOption(\"-c\", action=\"store\", type=\"complex\", " "dest=\"c\")]\n" @@ -3093,32 +3466,32 @@ msgstr "" "dest=\"c\")]\n" "parser = OptionParser(option_list=option_list)" -#: ../../library/optparse.rst:1955 +#: ../../library/optparse.rst:2066 msgid "Adding new actions" msgstr "" -#: ../../library/optparse.rst:1957 +#: ../../library/optparse.rst:2068 msgid "" "Adding new actions is a bit trickier, because you have to understand that :" "mod:`optparse` has a couple of classifications for actions:" msgstr "" -#: ../../library/optparse.rst:1960 +#: ../../library/optparse.rst:2071 msgid "\"store\" actions" msgstr "" -#: ../../library/optparse.rst:1961 +#: ../../library/optparse.rst:2072 msgid "" "actions that result in :mod:`optparse` storing a value to an attribute of " "the current OptionValues instance; these options require a :attr:`~Option." "dest` attribute to be supplied to the Option constructor." msgstr "" -#: ../../library/optparse.rst:1965 +#: ../../library/optparse.rst:2076 msgid "\"typed\" actions" msgstr "" -#: ../../library/optparse.rst:1966 +#: ../../library/optparse.rst:2077 msgid "" "actions that take a value from the command line and expect it to be of a " "certain type; or rather, a string that can be converted to a certain type. " @@ -3126,7 +3499,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/optparse.rst:1971 +#: ../../library/optparse.rst:2082 msgid "" "These are overlapping sets: some default \"store\" actions are " "``\"store\"``, ``\"store_const\"``, ``\"append\"``, and ``\"count\"``, while " @@ -3134,25 +3507,25 @@ msgid "" "``\"callback\"``." msgstr "" -#: ../../library/optparse.rst:1975 +#: ../../library/optparse.rst:2086 msgid "" "When you add an action, you need to categorize it by listing it in at least " "one of the following class attributes of Option (all are lists of strings):" msgstr "" -#: ../../library/optparse.rst:1980 +#: ../../library/optparse.rst:2091 msgid "All actions must be listed in ACTIONS." msgstr "" -#: ../../library/optparse.rst:1984 +#: ../../library/optparse.rst:2095 msgid "\"store\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1988 +#: ../../library/optparse.rst:2099 msgid "\"typed\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1992 +#: ../../library/optparse.rst:2103 msgid "" "Actions that always take a type (i.e. whose options always take a value) are " "additionally listed here. The only effect of this is that :mod:`optparse` " @@ -3160,13 +3533,13 @@ msgid "" "whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:1997 +#: ../../library/optparse.rst:2108 msgid "" "In order to actually implement your new action, you must override Option's :" "meth:`take_action` method and add a case that recognizes your action." msgstr "" -#: ../../library/optparse.rst:2000 +#: ../../library/optparse.rst:2111 msgid "" "For example, let's add an ``\"extend\"`` action. This is similar to the " "standard ``\"append\"`` action, but instead of taking a single value from " @@ -3176,23 +3549,23 @@ msgid "" "option of type ``\"string\"``, the command line ::" msgstr "" -#: ../../library/optparse.rst:2007 +#: ../../library/optparse.rst:2118 msgid "--names=foo,bar --names blah --names ding,dong" msgstr "--names=foo,bar --names blah --names ding,dong" -#: ../../library/optparse.rst:2009 +#: ../../library/optparse.rst:2120 msgid "would result in a list ::" msgstr "" -#: ../../library/optparse.rst:2011 +#: ../../library/optparse.rst:2122 msgid "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" msgstr "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" -#: ../../library/optparse.rst:2013 +#: ../../library/optparse.rst:2124 msgid "Again we define a subclass of Option::" msgstr "" -#: ../../library/optparse.rst:2015 +#: ../../library/optparse.rst:2126 msgid "" "class MyOption(Option):\n" "\n" @@ -3224,43 +3597,43 @@ msgstr "" " Option.take_action(\n" " self, action, dest, opt, value, values, parser)" -#: ../../library/optparse.rst:2030 +#: ../../library/optparse.rst:2141 msgid "Features of note:" msgstr "" -#: ../../library/optparse.rst:2032 +#: ../../library/optparse.rst:2143 msgid "" "``\"extend\"`` both expects a value on the command-line and stores that " "value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:" "`~Option.TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:2036 +#: ../../library/optparse.rst:2147 msgid "" "to ensure that :mod:`optparse` assigns the default type of ``\"string\"`` to " "``\"extend\"`` actions, we put the ``\"extend\"`` action in :attr:`~Option." "ALWAYS_TYPED_ACTIONS` as well." msgstr "" -#: ../../library/optparse.rst:2040 +#: ../../library/optparse.rst:2151 msgid "" ":meth:`MyOption.take_action` implements just this one new action, and passes " "control back to :meth:`Option.take_action` for the standard :mod:`optparse` " "actions." msgstr "" -#: ../../library/optparse.rst:2044 +#: ../../library/optparse.rst:2155 msgid "" "``values`` is an instance of the optparse_parser.Values class, which " "provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` " "is essentially :func:`getattr` with a safety valve; it is called as ::" msgstr "" -#: ../../library/optparse.rst:2048 +#: ../../library/optparse.rst:2159 msgid "values.ensure_value(attr, value)" msgstr "values.ensure_value(attr, value)" -#: ../../library/optparse.rst:2050 +#: ../../library/optparse.rst:2161 msgid "" "If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then " "ensure_value() first sets it to ``value``, and then returns ``value``. This " @@ -3273,28 +3646,28 @@ msgid "" "meth:`ensure_value` will take care of getting it right when it's needed." msgstr "" -#: ../../library/optparse.rst:2061 +#: ../../library/optparse.rst:2172 msgid "Exceptions" msgstr "例外" -#: ../../library/optparse.rst:2065 +#: ../../library/optparse.rst:2176 msgid "" "Raised if an :class:`Option` instance is created with invalid or " "inconsistent arguments." msgstr "" -#: ../../library/optparse.rst:2070 +#: ../../library/optparse.rst:2181 msgid "Raised if conflicting options are added to an :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:2074 +#: ../../library/optparse.rst:2185 msgid "Raised if an invalid option value is encountered on the command line." msgstr "" -#: ../../library/optparse.rst:2078 +#: ../../library/optparse.rst:2189 msgid "Raised if an invalid option is passed on the command line." msgstr "" -#: ../../library/optparse.rst:2082 +#: ../../library/optparse.rst:2193 msgid "Raised if an ambiguous option is passed on the command line." msgstr "" diff --git a/library/os.path.po b/library/os.path.po index 2019487b8c..0aa9f44b60 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -37,9 +37,9 @@ msgid "" "module. The path parameters can be passed as strings, or bytes, or any " "object implementing the :class:`os.PathLike` protocol." msgstr "" -"該模組實現了一些有用的路徑名操作函式。若要讀取或寫入檔案,請參閱 :func:" -"`open` 函數,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字串、位元" -"組或任何依照 :class:`os.PathLike` 協議實作的物件傳遞。" +"該模組實現了一些有用的路徑名操作函式。若要讀取或寫入檔案,請參" +"閱 :func:`open` 函式,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字" +"串、位元組或任何依照 :class:`os.PathLike` 協議實作的物件傳遞。" #: ../../library/os.path.rst:19 msgid "" @@ -49,7 +49,7 @@ msgid "" "the :mod:`glob` module.)" msgstr "" "與 Unix shell 不同,Python 不會\\ *自動*\\ 進行路徑展開 (path expansions)。當" -"應用程式需要進行類似 shell 的路徑展開時,可以明確地呼叫 :func:`expanduser` " +"應用程式需要進行類似 shell 的路徑展開時,可以明確地叫用 :func:`expanduser` " "和 :func:`expandvars` 等函式。(另請參閱 :mod:`glob` 模組。)" #: ../../library/os.path.rst:26 @@ -62,18 +62,18 @@ 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 "" "Since different operating systems have different path name conventions, " -"there are several versions of this module in the standard library. The :mod:" -"`os.path` module is always the path module suitable for the operating system " -"Python is running on, and therefore usable for local paths. However, you " -"can also import and use the individual modules if you want to manipulate a " -"path that is *always* in one of the different formats. They all have the " -"same interface:" +"there are several versions of this module in the standard library. " +"The :mod:`os.path` module is always the path module suitable for the " +"operating system Python is running on, and therefore usable for local " +"paths. However, you can also import and use the individual modules if you " +"want to manipulate a path that is *always* in one of the different formats. " +"They all have the same interface:" msgstr "" "由於不同的作業系統具有不同的路徑命名慣例,在標準函式庫中的路徑模組有數個版本" "可供使用,而 :mod:`os.path` 模組都會是運行 Python 之作業系統所適用本地路徑。" @@ -90,14 +90,13 @@ msgstr ":mod:`ntpath` 用於 Windows 的路徑" #: ../../library/os.path.rst:51 msgid "" -":func:`exists`, :func:`lexists`, :func:`isdir`, :func:`isfile`, :func:" -"`islink`, and :func:`ismount` now return ``False`` instead of raising an " -"exception for paths that contain characters or bytes unrepresentable at the " -"OS level." +":func:`exists`, :func:`lexists`, :func:`isdir`, :func:`isfile`, :func:`islink`, " +"and :func:`ismount` now return ``False`` instead of raising an exception for " +"paths that contain characters or bytes unrepresentable at the OS level." msgstr "" -"對於包含有作業系統層級無法表示之字元或位元組的路徑,:func:`exists`、:func:" -"`lexists`、:func:`isdir`、:func:`isfile`、:func:`islink` 和 :func:`ismount` " -"函式現在會回傳 ``False``,而不是引發例外。" +"對於包含有作業系統層級無法表示之字元或位元組的路" +"徑,:func:`exists`、:func:`lexists`、:func:`isdir`、:func:`isfile`、:func:`islink` " +"和 :func:`ismount` 函式現在會回傳 ``False``,而不是引發例外。" #: ../../library/os.path.rst:59 msgid "" @@ -105,8 +104,8 @@ msgid "" "platforms, this is equivalent to calling the function :func:`normpath` as " "follows: ``normpath(join(os.getcwd(), path))``." msgstr "" -"回傳經正規化的絕對路徑名 *path* 。在大多數平台上,這等效於按照以下方式呼叫 :" -"func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" +"回傳經正規化的絕對路徑名 *path* 。在大多數平台上,這等效於按照以下方式呼" +"叫 :func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" #: ../../library/os.path.rst:63 ../../library/os.path.rst:76 #: ../../library/os.path.rst:117 ../../library/os.path.rst:126 @@ -134,8 +133,8 @@ msgid "" msgstr "" "回傳路徑名 *path* 的基底名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳結" "果中的第二個元素。請注意,此函式的結果與 Unix 的 :program:`basename` 程式不" -"同;對於 ``'/foo/bar/'``,:program:`basename` 回傳 ``'bar'``,而 :func:" -"`basename` 函式回傳空字串(``''``)。" +"同;對於 ``'/foo/bar/'``,:program:`basename` 回傳 ``'bar'``," +"而 :func:`basename` 函式回傳空字串(``''``)。" #: ../../library/os.path.rst:82 #, fuzzy @@ -146,8 +145,8 @@ msgid "" "empty. Unlike :func:`commonprefix`, this returns a valid path." msgstr "" "回傳序列 *paths* 中每個路徑名的最長共同子路徑。如果 *paths* 同時包含絕對路徑" -"和相對路徑、*paths* 位於不同的驅動機或 *paths* 為空,則引發 :exc:" -"`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" +"和相對路徑、*paths* 位於不同的驅動機或 *paths* 為空,則引" +"發 :exc:`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" #: ../../library/os.path.rst:90 msgid "Accepts a sequence of :term:`path-like objects `." @@ -219,11 +218,11 @@ msgstr "" #: ../../library/os.path.rst:148 msgid "" "Return ``True`` if *path* refers to an existing path, including broken " -"symbolic links. Equivalent to :func:`exists` on platforms lacking :func:" -"`os.lstat`." +"symbolic links. Equivalent to :func:`exists` on platforms " +"lacking :func:`os.lstat`." msgstr "" -"如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺乏 :" -"func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" +"如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺" +"乏 :func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" #: ../../library/os.path.rst:160 msgid "" @@ -235,13 +234,14 @@ msgstr "" #: ../../library/os.path.rst:165 msgid "" -"On Unix, an initial ``~`` is replaced by the environment variable :envvar:" -"`HOME` if it is set; otherwise the current user's home directory is looked " -"up in the password directory through the built-in module :mod:`pwd`. An " -"initial ``~user`` is looked up directly in the password directory." +"On Unix, an initial ``~`` is replaced by the environment " +"variable :envvar:`HOME` if it is set; otherwise the current user's home " +"directory is looked up in the password directory through the built-in " +"module :mod:`pwd`. An initial ``~user`` is looked up directly in the " +"password directory." msgstr "" "在 Unix 上,如果環境變數 :envvar:`HOME` 有被設置,則將初始的 ``~`` 替換為該變" -"數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找當前使用者的家目錄。對" +"數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找目前使用者的家目錄。對" "於初始的 ``~user``,直接在密碼目錄中查找該使用者的家目錄。" #: ../../library/os.path.rst:170 @@ -254,7 +254,7 @@ msgid "" msgstr "" "在 Windows 上,如果 :envvar:`USERPROFILE` 有被設置,則使用該變數的值;否則將" "結合 :envvar:`HOMEPATH` 和 :envvar:`HOMEDRIVE`。對於初始的 ``~user``,會檢查" -"當前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" +"目前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" "則替換它。" #: ../../library/os.path.rst:175 @@ -289,9 +289,9 @@ msgstr "" #: ../../library/os.path.rst:204 msgid "" "Return the time of last access of *path*. The return value is a floating-" -"point number giving the number of seconds since the epoch (see the :mod:" -"`time` module). Raise :exc:`OSError` if the file does not exist or is " -"inaccessible." +"point number giving the number of seconds since the epoch (see " +"the :mod:`time` module). Raise :exc:`OSError` if the file does not exist " +"or is inaccessible." msgstr "" "回傳 *path* 的最後存取時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" @@ -324,18 +324,18 @@ msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." msgstr "" -"回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引發 :exc:" -"`OSError`。" +"回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引" +"發 :exc:`OSError`。" #: ../../library/os.path.rst:242 -#, fuzzy msgid "" "Return ``True`` if *path* is an absolute pathname. On Unix, that means it " "begins with a slash, on Windows that it begins with two (back)slashes, or a " "drive letter, colon, and (back)slash together." msgstr "" "如果 *path* 是絕對路徑名,則回傳 ``True``。在 Unix 上,這表示它以斜線開頭;" -"在 Windows 上,表示在去除可能的驅動機字母後,以(反)斜線開頭。" +"在 Windows 上,表示這是以兩個(反)斜線開頭或者以一個驅動機字母、冒號和(反)" +"斜線開頭。" #: ../../library/os.path.rst:249 msgid "" @@ -350,8 +350,8 @@ msgid "" "true for the same path." msgstr "" "如果 *path* 是一個\\ :func:`已存在的 `\\ 常規檔案,則回傳 ``True``。" -"這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:" -"`isfile` 的結果為真。" +"這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` " +"和 :func:`isfile` 的結果為真。" #: ../../library/os.path.rst:266 msgid "" @@ -394,12 +394,12 @@ msgid "" "called to see if it is different from the input path." msgstr "" "如果路徑名 *path* 是一個掛載點 (:dfn:`mount point`),則回傳 ``True``:即在檔" -"案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目錄 :" -"file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* 是否" -"指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的掛載" -"點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 Windows " -"上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他路徑,會" -"呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" +"案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目" +"錄 :file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* " +"是否指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的" +"掛載點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 " +"Windows 上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他" +"路徑,會呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" #: ../../library/os.path.rst:305 msgid "Added support for detecting non-root mount points on Windows." @@ -425,8 +425,9 @@ msgid "" "windows/dev-drive/>`_ for information on enabling and creating Dev Drives." msgstr "" "可能會對無效的路徑引發錯誤,例如,沒有可識別的驅動機的路徑,但在不支援 Dev 磁" -"碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的資訊。" +"碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的" +"資訊。" #: ../../library/os.path.rst:327 msgid "" @@ -479,14 +480,14 @@ msgid "" "On Windows, the drive is not reset when a rooted path segment (e.g., " "``r'\\foo'``) is encountered. If a segment is on a different drive or is an " "absolute path, all previous segments are ignored and the drive is reset. " -"Note that since there is a current directory for each drive, ``os.path." -"join(\"c:\", \"foo\")`` represents a path relative to the current directory " -"on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." +"Note that since there is a current directory for each drive, " +"``os.path.join(\"c:\", \"foo\")`` represents a path relative to the current " +"directory on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." msgstr "" "在 Windows 上,當遇到根路徑段(例如,``r'\\foo'``)時,驅動機不會被重置。如果" "一個段位於不同的驅動機上,或者是絕對路徑,則將忽略所有之前的段並重置驅動機。" -"請注意,由於每個驅動機都有當前目錄,``os.path.join(\"c:\", \"foo\")`` 表示相" -"對於驅動機 :file:`C:` 的當前目錄的路徑(即 :file:`c:foo`),而不是 :file:`c:" +"請注意,由於每個驅動機都有目前目錄,``os.path.join(\"c:\", \"foo\")`` 表示相" +"對於驅動機 :file:`C:` 的目前目錄的路徑(即 :file:`c:foo`),而不是 :file:`c:" "\\\\foo`。" #: ../../library/os.path.rst:370 @@ -525,10 +526,10 @@ msgid "" "leading characters shall be treated as a single character." msgstr "" "在 POSIX 系統中,根據 `IEEE Std 1003.1 2013 版; 4.13 Pathname Resolution " -"`_ 標準,如果一個路徑名恰好以兩個斜線開頭,則在前導字元後的第" -"一個部分可能會以由實作品自行定義的方式解釋,雖然多於兩個前導字元應該被視為單" -"個字元。" +"`_ 標準,如果一個路徑名恰好以兩個斜線開頭,則在前導" +"字元後的第一個部分可能會以由實作品自行定義的方式解釋,雖然多於兩個前導字元應" +"該被視為單個字元。" #: ../../library/os.path.rst:406 #, fuzzy @@ -549,9 +550,9 @@ msgid "" "``True``, :exc:`OSError` is raised. If *strict* is ``False`` these errors " "are ignored, and so the result might be missing or otherwise inaccessible." msgstr "" -"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" -"`OSError`。如果 *strict* 為 ``False``,則將路徑盡可能解析,並將任何剩餘部分附" -"加在後面,而不檢查其是否存在。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引" +"發 :exc:`OSError`。如果 *strict* 為 ``False``,則將路徑盡可能解析,並將任何剩" +"餘部分附加在後面,而不檢查其是否存在。" #: ../../library/os.path.rst:416 msgid "" @@ -584,8 +585,8 @@ msgid "" "*start*. On Windows, :exc:`ValueError` is raised when *path* and *start* " "are on different drives." msgstr "" -"從當前目錄或可選的 *start* 目錄回傳到 *path* 的相對檔案路徑。這是一個路徑計" -"算:不會訪問檔案系統來確認 *path* 或 *start* 的存在或屬性。在 Windows 上,當 " +"從目前目錄或可選的 *start* 目錄回傳到 *path* 的相對檔案路徑。這是一個路徑計" +"算:不會存取檔案系統來確認 *path* 或 *start* 的存在或屬性。在 Windows 上,當 " "*path* 和 *start* 在不同的驅動機上時,會引發 :exc:`ValueError`。" #: ../../library/os.path.rst:441 @@ -620,13 +621,14 @@ msgstr "如果文件描述符 *fp1* 和 *fp2* 指向同一個檔案,則回傳 #: ../../library/os.path.rst:476 msgid "" "Return ``True`` if the stat tuples *stat1* and *stat2* refer to the same " -"file. These structures may have been returned by :func:`os.fstat`, :func:`os." -"lstat`, or :func:`os.stat`. This function implements the underlying " -"comparison used by :func:`samefile` and :func:`sameopenfile`." +"file. These structures may have been returned " +"by :func:`os.fstat`, :func:`os.lstat`, or :func:`os.stat`. This function " +"implements the underlying comparison used by :func:`samefile` " +"and :func:`sameopenfile`." msgstr "" "如果 stat 值組 *stat1* 和 *stat2* 指向同一個檔案,則回傳 ``True``。這些結構可" -"能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使用 :" -"func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" +"能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使" +"用 :func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" #: ../../library/os.path.rst:490 msgid "" @@ -645,8 +647,8 @@ msgstr "" "結尾,則 *tail* 將為空。如果 *path* 中沒有斜線,則 *head* 將為空。如果 " "*path* 為空,則 *head* 和 *tail* 都為空。除非 *head* 是根目錄(僅有一個或多個" "斜線),否則從 *head* 中刪除尾部的斜線。在所有情況下,``join(head, tail)`` 回" -"傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函式 :func:" -"`dirname` 和 :func:`basename`。" +"傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函" +"式 :func:`dirname` 和 :func:`basename`。" #: ../../library/os.path.rst:506 msgid "" @@ -716,9 +718,8 @@ msgid "" msgstr "" "在 POSIX 系統上,*drive* 始終為空。*root* 可能為空(如果 *path* 是相對路" "徑),一個斜線(如果 *path* 是絕對路徑),或者兩個斜線(根據 `IEEE Std " -"1003.1-2017; 4.13 Pathname Resolution `_ 的實作定義)。例" -"如: ::" +"1003.1-2017; 4.13 Pathname Resolution `_ 的實作定義)。例如: ::" #: ../../library/os.path.rst:543 msgid "" diff --git a/library/os.po b/library/os.po index fadaf5b8a3..b2f2e44c90 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-09 00:13+0000\n" +"POT-Creation-Date: 2025-03-30 00:15+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -200,6 +200,8 @@ msgid "" ":func:`locale.getpreferredencoding` returns ``'utf-8'`` (the *do_setlocale* " "argument has no effect)." msgstr "" +":func:`locale.getpreferredencoding` 回傳 ``'utf-8'``\\ (*do_setlocale* 引數" +"並無任何效果)。" #: ../../library/os.rst:119 msgid "" @@ -214,7 +216,7 @@ msgstr "" msgid "" "On Unix, :func:`os.device_encoding` returns ``'utf-8'`` rather than the " "device encoding." -msgstr "" +msgstr "在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非裝置編碼。" #: ../../library/os.rst:127 msgid "" @@ -222,6 +224,8 @@ msgid "" "envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware " "mode)." msgstr "" +"請注意,在 UTF-8 模式中,標準的串流設定會被 :envvar:`PYTHONIOENCODING` 覆蓋" +"(如同在預設在地化覺察 模式一樣)。" #: ../../library/os.rst:131 msgid "" @@ -233,11 +237,11 @@ msgstr "" msgid "" "Command line arguments, environment variables and filenames are decoded to " "text using the UTF-8 encoding." -msgstr "" +msgstr "命令列引數、環境變數及檔案名稱會以 UTF-8 編碼形式來被解碼成文字。" #: ../../library/os.rst:136 msgid ":func:`os.fsdecode` and :func:`os.fsencode` use the UTF-8 encoding." -msgstr "" +msgstr ":func:`os.fsdecode` 和 :func:`os.fsencode` 使用 UTF-8 編碼。" #: ../../library/os.rst:137 msgid "" @@ -305,93 +309,93 @@ msgid "" "Return the filename corresponding to the controlling terminal of the process." msgstr "" -#: ../../library/os.rst:181 ../../library/os.rst:322 ../../library/os.rst:337 -#: ../../library/os.rst:358 ../../library/os.rst:367 ../../library/os.rst:376 -#: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:426 -#: ../../library/os.rst:434 ../../library/os.rst:442 ../../library/os.rst:462 -#: ../../library/os.rst:480 ../../library/os.rst:491 ../../library/os.rst:503 -#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:533 -#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586 -#: ../../library/os.rst:593 ../../library/os.rst:602 ../../library/os.rst:639 -#: ../../library/os.rst:652 ../../library/os.rst:661 ../../library/os.rst:678 -#: ../../library/os.rst:687 ../../library/os.rst:694 ../../library/os.rst:703 -#: ../../library/os.rst:712 ../../library/os.rst:719 ../../library/os.rst:726 -#: ../../library/os.rst:735 ../../library/os.rst:792 ../../library/os.rst:831 -#: ../../library/os.rst:953 ../../library/os.rst:979 ../../library/os.rst:992 -#: ../../library/os.rst:1009 ../../library/os.rst:1027 -#: ../../library/os.rst:1038 ../../library/os.rst:1061 -#: ../../library/os.rst:1082 ../../library/os.rst:1094 -#: ../../library/os.rst:1105 ../../library/os.rst:1118 -#: ../../library/os.rst:1139 ../../library/os.rst:1160 -#: ../../library/os.rst:1172 ../../library/os.rst:1183 -#: ../../library/os.rst:1244 ../../library/os.rst:1367 -#: ../../library/os.rst:1379 ../../library/os.rst:1393 -#: ../../library/os.rst:1403 ../../library/os.rst:1418 -#: ../../library/os.rst:1433 ../../library/os.rst:1446 -#: ../../library/os.rst:1463 ../../library/os.rst:1489 -#: ../../library/os.rst:1506 ../../library/os.rst:1520 -#: ../../library/os.rst:1535 ../../library/os.rst:1547 -#: ../../library/os.rst:1574 ../../library/os.rst:1586 -#: ../../library/os.rst:1596 ../../library/os.rst:1610 -#: ../../library/os.rst:1662 ../../library/os.rst:1682 -#: ../../library/os.rst:1691 ../../library/os.rst:1703 -#: ../../library/os.rst:1738 ../../library/os.rst:1762 -#: ../../library/os.rst:1772 ../../library/os.rst:1780 -#: ../../library/os.rst:1789 ../../library/os.rst:1800 -#: ../../library/os.rst:1837 ../../library/os.rst:1864 -#: ../../library/os.rst:1915 ../../library/os.rst:1921 -#: ../../library/os.rst:2087 ../../library/os.rst:2164 -#: ../../library/os.rst:2181 ../../library/os.rst:2195 -#: ../../library/os.rst:2221 ../../library/os.rst:2239 -#: ../../library/os.rst:2255 ../../library/os.rst:2271 -#: ../../library/os.rst:2334 ../../library/os.rst:2358 -#: ../../library/os.rst:2378 ../../library/os.rst:2514 -#: ../../library/os.rst:2536 ../../library/os.rst:2580 -#: ../../library/os.rst:2592 ../../library/os.rst:2614 -#: ../../library/os.rst:3322 ../../library/os.rst:3456 -#: ../../library/os.rst:3479 ../../library/os.rst:3493 -#: ../../library/os.rst:3713 ../../library/os.rst:3738 -#: ../../library/os.rst:3763 ../../library/os.rst:3817 -#: ../../library/os.rst:3826 ../../library/os.rst:3835 -#: ../../library/os.rst:3843 ../../library/os.rst:3852 -#: ../../library/os.rst:3861 ../../library/os.rst:3933 -#: ../../library/os.rst:3996 ../../library/os.rst:4006 -#: ../../library/os.rst:4024 ../../library/os.rst:4033 -#: ../../library/os.rst:4043 ../../library/os.rst:4053 -#: ../../library/os.rst:4063 ../../library/os.rst:4074 -#: ../../library/os.rst:4219 ../../library/os.rst:4288 -#: ../../library/os.rst:4323 ../../library/os.rst:4331 -#: ../../library/os.rst:4338 ../../library/os.rst:4345 -#: ../../library/os.rst:4352 ../../library/os.rst:4359 -#: ../../library/os.rst:4366 ../../library/os.rst:4373 -#: ../../library/os.rst:4381 ../../library/os.rst:4389 -#: ../../library/os.rst:4396 ../../library/os.rst:4403 -#: ../../library/os.rst:4412 ../../library/os.rst:4420 -#: ../../library/os.rst:4428 ../../library/os.rst:4435 -#: ../../library/os.rst:4442 ../../library/os.rst:4491 -#: ../../library/os.rst:4518 ../../library/os.rst:4541 -#: ../../library/os.rst:4557 ../../library/os.rst:4564 -#: ../../library/os.rst:4575 ../../library/os.rst:4585 -#: ../../library/os.rst:4594 ../../library/os.rst:4626 -#: ../../library/os.rst:4734 ../../library/os.rst:4750 -#: ../../library/os.rst:4783 ../../library/os.rst:4852 -#: ../../library/os.rst:4871 ../../library/os.rst:4882 -#: ../../library/os.rst:4894 ../../library/os.rst:4939 -#: ../../library/os.rst:4976 ../../library/os.rst:4999 -#: ../../library/os.rst:5020 ../../library/os.rst:5054 -#: ../../library/os.rst:5095 ../../library/os.rst:5115 -#: ../../library/os.rst:5129 ../../library/os.rst:5146 -#: ../../library/os.rst:5161 ../../library/os.rst:5172 -#: ../../library/os.rst:5184 ../../library/os.rst:5197 -#: ../../library/os.rst:5206 ../../library/os.rst:5216 -#: ../../library/os.rst:5229 ../../library/os.rst:5264 -#: ../../library/os.rst:5280 ../../library/os.rst:5291 -#: ../../library/os.rst:5303 ../../library/os.rst:5310 -#: ../../library/os.rst:5319 ../../library/os.rst:5328 -#: ../../library/os.rst:5337 ../../library/os.rst:5346 -#: ../../library/os.rst:5496 ../../library/os.rst:5505 -#: ../../library/os.rst:5529 ../../library/os.rst:5556 -#: ../../library/os.rst:5565 ../../library/os.rst:5688 +#: ../../library/os.rst:181 ../../library/os.rst:323 ../../library/os.rst:338 +#: ../../library/os.rst:359 ../../library/os.rst:368 ../../library/os.rst:377 +#: ../../library/os.rst:390 ../../library/os.rst:399 ../../library/os.rst:427 +#: ../../library/os.rst:435 ../../library/os.rst:443 ../../library/os.rst:463 +#: ../../library/os.rst:481 ../../library/os.rst:492 ../../library/os.rst:504 +#: ../../library/os.rst:513 ../../library/os.rst:523 ../../library/os.rst:534 +#: ../../library/os.rst:546 ../../library/os.rst:580 ../../library/os.rst:587 +#: ../../library/os.rst:594 ../../library/os.rst:603 ../../library/os.rst:640 +#: ../../library/os.rst:653 ../../library/os.rst:662 ../../library/os.rst:679 +#: ../../library/os.rst:688 ../../library/os.rst:695 ../../library/os.rst:704 +#: ../../library/os.rst:713 ../../library/os.rst:720 ../../library/os.rst:727 +#: ../../library/os.rst:736 ../../library/os.rst:793 ../../library/os.rst:832 +#: ../../library/os.rst:954 ../../library/os.rst:980 ../../library/os.rst:993 +#: ../../library/os.rst:1010 ../../library/os.rst:1028 +#: ../../library/os.rst:1039 ../../library/os.rst:1062 +#: ../../library/os.rst:1083 ../../library/os.rst:1095 +#: ../../library/os.rst:1106 ../../library/os.rst:1119 +#: ../../library/os.rst:1140 ../../library/os.rst:1161 +#: ../../library/os.rst:1173 ../../library/os.rst:1184 +#: ../../library/os.rst:1245 ../../library/os.rst:1368 +#: ../../library/os.rst:1380 ../../library/os.rst:1394 +#: ../../library/os.rst:1404 ../../library/os.rst:1419 +#: ../../library/os.rst:1434 ../../library/os.rst:1447 +#: ../../library/os.rst:1464 ../../library/os.rst:1490 +#: ../../library/os.rst:1507 ../../library/os.rst:1521 +#: ../../library/os.rst:1536 ../../library/os.rst:1548 +#: ../../library/os.rst:1575 ../../library/os.rst:1587 +#: ../../library/os.rst:1597 ../../library/os.rst:1611 +#: ../../library/os.rst:1663 ../../library/os.rst:1683 +#: ../../library/os.rst:1692 ../../library/os.rst:1704 +#: ../../library/os.rst:1739 ../../library/os.rst:1763 +#: ../../library/os.rst:1773 ../../library/os.rst:1781 +#: ../../library/os.rst:1790 ../../library/os.rst:1801 +#: ../../library/os.rst:1838 ../../library/os.rst:1865 +#: ../../library/os.rst:1916 ../../library/os.rst:1922 +#: ../../library/os.rst:2088 ../../library/os.rst:2165 +#: ../../library/os.rst:2182 ../../library/os.rst:2196 +#: ../../library/os.rst:2222 ../../library/os.rst:2240 +#: ../../library/os.rst:2256 ../../library/os.rst:2272 +#: ../../library/os.rst:2335 ../../library/os.rst:2359 +#: ../../library/os.rst:2379 ../../library/os.rst:2515 +#: ../../library/os.rst:2537 ../../library/os.rst:2581 +#: ../../library/os.rst:2593 ../../library/os.rst:2615 +#: ../../library/os.rst:3323 ../../library/os.rst:3457 +#: ../../library/os.rst:3480 ../../library/os.rst:3494 +#: ../../library/os.rst:3714 ../../library/os.rst:3739 +#: ../../library/os.rst:3764 ../../library/os.rst:3818 +#: ../../library/os.rst:3827 ../../library/os.rst:3836 +#: ../../library/os.rst:3844 ../../library/os.rst:3853 +#: ../../library/os.rst:3862 ../../library/os.rst:3934 +#: ../../library/os.rst:3997 ../../library/os.rst:4007 +#: ../../library/os.rst:4025 ../../library/os.rst:4034 +#: ../../library/os.rst:4044 ../../library/os.rst:4054 +#: ../../library/os.rst:4064 ../../library/os.rst:4075 +#: ../../library/os.rst:4220 ../../library/os.rst:4289 +#: ../../library/os.rst:4324 ../../library/os.rst:4332 +#: ../../library/os.rst:4339 ../../library/os.rst:4346 +#: ../../library/os.rst:4353 ../../library/os.rst:4360 +#: ../../library/os.rst:4367 ../../library/os.rst:4374 +#: ../../library/os.rst:4382 ../../library/os.rst:4390 +#: ../../library/os.rst:4397 ../../library/os.rst:4404 +#: ../../library/os.rst:4413 ../../library/os.rst:4421 +#: ../../library/os.rst:4429 ../../library/os.rst:4436 +#: ../../library/os.rst:4443 ../../library/os.rst:4492 +#: ../../library/os.rst:4519 ../../library/os.rst:4542 +#: ../../library/os.rst:4558 ../../library/os.rst:4565 +#: ../../library/os.rst:4576 ../../library/os.rst:4586 +#: ../../library/os.rst:4595 ../../library/os.rst:4627 +#: ../../library/os.rst:4735 ../../library/os.rst:4751 +#: ../../library/os.rst:4784 ../../library/os.rst:4853 +#: ../../library/os.rst:4872 ../../library/os.rst:4883 +#: ../../library/os.rst:4895 ../../library/os.rst:4940 +#: ../../library/os.rst:4977 ../../library/os.rst:5000 +#: ../../library/os.rst:5021 ../../library/os.rst:5055 +#: ../../library/os.rst:5096 ../../library/os.rst:5116 +#: ../../library/os.rst:5130 ../../library/os.rst:5147 +#: ../../library/os.rst:5162 ../../library/os.rst:5173 +#: ../../library/os.rst:5185 ../../library/os.rst:5198 +#: ../../library/os.rst:5207 ../../library/os.rst:5217 +#: ../../library/os.rst:5230 ../../library/os.rst:5265 +#: ../../library/os.rst:5281 ../../library/os.rst:5292 +#: ../../library/os.rst:5304 ../../library/os.rst:5311 +#: ../../library/os.rst:5320 ../../library/os.rst:5329 +#: ../../library/os.rst:5338 ../../library/os.rst:5347 +#: ../../library/os.rst:5499 ../../library/os.rst:5508 +#: ../../library/os.rst:5532 ../../library/os.rst:5559 +#: ../../library/os.rst:5568 ../../library/os.rst:5691 msgid "Availability" msgstr "" @@ -438,6 +442,8 @@ msgid "" "Calling :func:`putenv` directly does not change :data:`os.environ`, so it's " "better to modify :data:`os.environ`." msgstr "" +"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`,所以建議直接修改 :data:" +"`os.environ`。" #: ../../library/os.rst:216 msgid "" @@ -520,17 +526,17 @@ msgid "" "e.g. :class:`pathlib.PurePath`." msgstr "" -#: ../../library/os.rst:304 +#: ../../library/os.rst:305 msgid "Return the file system path representation of the object." msgstr "" -#: ../../library/os.rst:306 +#: ../../library/os.rst:307 msgid "" "The method should only return a :class:`str` or :class:`bytes` object, with " "the preference being for :class:`str`." msgstr "" -#: ../../library/os.rst:312 +#: ../../library/os.rst:313 msgid "" "Return the value of the environment variable *key* as a string if it exists, " "or *default* if it doesn't. *key* is a string. Note that since :func:" @@ -539,14 +545,14 @@ msgid "" "changes." msgstr "" -#: ../../library/os.rst:318 +#: ../../library/os.rst:319 msgid "" "On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` " "and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would " "like to use a different encoding." msgstr "" -#: ../../library/os.rst:327 +#: ../../library/os.rst:328 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " "*default* if it doesn't. *key* must be bytes. Note that since :func:" @@ -555,13 +561,13 @@ msgid "" "environment changes." msgstr "" -#: ../../library/os.rst:334 +#: ../../library/os.rst:335 msgid "" ":func:`getenvb` is only available if :const:`supports_bytes_environ` is " "``True``." msgstr "" -#: ../../library/os.rst:344 +#: ../../library/os.rst:345 msgid "" "Returns the list of directories that will be searched for a named " "executable, similar to a shell, when launching a process. *env*, when " @@ -569,28 +575,28 @@ msgid "" "in. By default, when *env* is ``None``, :data:`environ` is used." msgstr "" -#: ../../library/os.rst:355 +#: ../../library/os.rst:356 msgid "" "Return the effective group id of the current process. This corresponds to " "the \"set id\" bit on the file being executed in the current process." msgstr "" -#: ../../library/os.rst:365 +#: ../../library/os.rst:366 msgid "Return the current process's effective user id." msgstr "" -#: ../../library/os.rst:374 +#: ../../library/os.rst:375 msgid "Return the real group id of the current process." msgstr "" -#: ../../library/os.rst:378 ../../library/os.rst:451 ../../library/os.rst:535 -#: ../../library/os.rst:758 +#: ../../library/os.rst:379 ../../library/os.rst:452 ../../library/os.rst:536 +#: ../../library/os.rst:759 msgid "" "The function is a stub on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:384 +#: ../../library/os.rst:385 msgid "" "Return list of group ids that *user* belongs to. If *group* is not in the " "list, it is included; typically, *group* is specified as the group ID field " @@ -598,12 +604,12 @@ msgid "" "potentially omitted." msgstr "" -#: ../../library/os.rst:396 +#: ../../library/os.rst:397 msgid "" "Return list of supplemental group ids associated with the current process." msgstr "" -#: ../../library/os.rst:402 +#: ../../library/os.rst:403 msgid "" "On macOS, :func:`getgroups` behavior differs somewhat from other Unix " "platforms. If the Python interpreter was built with a deployment target of " @@ -620,7 +626,7 @@ msgid "" "get_config_var`." msgstr "" -#: ../../library/os.rst:419 +#: ../../library/os.rst:420 msgid "" "Return the name of the user logged in on the controlling terminal of the " "process. For most purposes, it is more useful to use :func:`getpass." @@ -629,32 +635,32 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: ../../library/os.rst:431 +#: ../../library/os.rst:432 msgid "" "Return the process group id of the process with process id *pid*. If *pid* " "is 0, the process group id of the current process is returned." msgstr "" -#: ../../library/os.rst:440 +#: ../../library/os.rst:441 msgid "Return the id of the current process group." msgstr "" -#: ../../library/os.rst:449 +#: ../../library/os.rst:450 msgid "Return the current process id." msgstr "" -#: ../../library/os.rst:458 +#: ../../library/os.rst:459 msgid "" "Return the parent's process id. When the parent process has exited, on Unix " "the id returned is the one of the init process (1), on Windows it is still " "the same id, which may be already reused by another process." msgstr "" -#: ../../library/os.rst:464 +#: ../../library/os.rst:465 msgid "Added support for Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:472 +#: ../../library/os.rst:473 msgid "" "Get program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -665,42 +671,42 @@ msgid "" "user ID of the calling process." msgstr "" -#: ../../library/os.rst:489 ../../library/os.rst:501 +#: ../../library/os.rst:490 ../../library/os.rst:502 msgid "" "Parameters for the :func:`getpriority` and :func:`setpriority` functions." msgstr "" -#: ../../library/os.rst:509 +#: ../../library/os.rst:510 msgid "" "Return a tuple (ruid, euid, suid) denoting the current process's real, " "effective, and saved user ids." msgstr "" -#: ../../library/os.rst:519 +#: ../../library/os.rst:520 msgid "" "Return a tuple (rgid, egid, sgid) denoting the current process's real, " "effective, and saved group ids." msgstr "" -#: ../../library/os.rst:531 +#: ../../library/os.rst:532 msgid "Return the current process's real user id." msgstr "" -#: ../../library/os.rst:541 +#: ../../library/os.rst:542 msgid "" "Call the system initgroups() to initialize the group access list with all of " "the groups of which the specified username is a member, plus the specified " "group id." msgstr "" -#: ../../library/os.rst:554 +#: ../../library/os.rst:555 msgid "" "Set the environment variable named *key* to the string *value*. Such " "changes to the environment affect subprocesses started with :func:`os." "system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:558 +#: ../../library/os.rst:559 msgid "" "Assignments to items in :data:`os.environ` are automatically translated into " "corresponding calls to :func:`putenv`; however, calls to :func:`putenv` " @@ -710,13 +716,13 @@ msgid "" "in their implementations." msgstr "" -#: ../../library/os.rst:566 +#: ../../library/os.rst:567 msgid "" "On some platforms, including FreeBSD and macOS, setting ``environ`` may " "cause memory leaks. Refer to the system documentation for :c:func:`!putenv`." msgstr "" -#: ../../library/os.rst:569 +#: ../../library/os.rst:570 msgid "" "Raises an :ref:`auditing event ` ``os.putenv`` with arguments " "``key``, ``value``." @@ -724,23 +730,23 @@ msgstr "" "引發一個附帶引數 ``key``、``value`` 的\\ :ref:`稽核事件 ` ``os." "putenv``。" -#: ../../library/os.rst:571 +#: ../../library/os.rst:572 msgid "The function is now always available." -msgstr "" +msgstr "此函式現在都會是可用的。" -#: ../../library/os.rst:577 +#: ../../library/os.rst:578 msgid "Set the current process's effective group id." msgstr "" -#: ../../library/os.rst:584 +#: ../../library/os.rst:585 msgid "Set the current process's effective user id." msgstr "" -#: ../../library/os.rst:591 +#: ../../library/os.rst:592 msgid "Set the current process' group id." msgstr "" -#: ../../library/os.rst:598 +#: ../../library/os.rst:599 msgid "" "Set the list of supplemental group ids associated with the current process " "to *groups*. *groups* must be a sequence, and each element must be an " @@ -748,7 +754,7 @@ msgid "" "the superuser." msgstr "" -#: ../../library/os.rst:604 +#: ../../library/os.rst:605 msgid "" "On macOS, the length of *groups* may not exceed the system-defined maximum " "number of effective group ids, typically 16. See the documentation for :func:" @@ -756,13 +762,13 @@ msgid "" "calling setgroups()." msgstr "" -#: ../../library/os.rst:611 +#: ../../library/os.rst:612 msgid "" "Reassociate the current thread with a Linux namespace. See the :manpage:" "`setns(2)` and :manpage:`namespaces(7)` man pages for more details." msgstr "" -#: ../../library/os.rst:615 +#: ../../library/os.rst:616 msgid "" "If *fd* refers to a :file:`/proc/{pid}/ns/` link, ``setns()`` reassociates " "the calling thread with the namespace associated with that link, and " @@ -771,7 +777,7 @@ msgid "" "constraints)." msgstr "" -#: ../../library/os.rst:622 +#: ../../library/os.rst:623 msgid "" "Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from :func:" "`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling thread " @@ -782,19 +788,19 @@ msgid "" "memberships in unspecified namespaces are left unchanged." msgstr "" -#: ../../library/os.rst:631 +#: ../../library/os.rst:632 msgid "" "*fd* can be any object with a :meth:`~io.IOBase.fileno` method, or a raw " "file descriptor." msgstr "" -#: ../../library/os.rst:633 +#: ../../library/os.rst:634 msgid "" "This example reassociates the thread with the ``init`` process's network " "namespace::" msgstr "" -#: ../../library/os.rst:635 +#: ../../library/os.rst:636 msgid "" "fd = os.open(\"/proc/1/ns/net\", os.O_RDONLY)\n" "os.setns(fd, os.CLONE_NEWNET)\n" @@ -804,25 +810,25 @@ msgstr "" "os.setns(fd, os.CLONE_NEWNET)\n" "os.close(fd)" -#: ../../library/os.rst:645 +#: ../../library/os.rst:646 msgid "The :func:`~os.unshare` function." msgstr ":func:`~os.unshare` 函式。" -#: ../../library/os.rst:649 +#: ../../library/os.rst:650 msgid "" "Call the system call :c:func:`!setpgrp` or ``setpgrp(0, 0)`` depending on " "which version is implemented (if any). See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:657 +#: ../../library/os.rst:658 msgid "" "Call the system call :c:func:`!setpgid` to set the process group id of the " "process with id *pid* to the process group with id *pgrp*. See the Unix " "manual for the semantics." msgstr "" -#: ../../library/os.rst:668 +#: ../../library/os.rst:669 msgid "" "Set program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -835,96 +841,96 @@ msgid "" "scheduling." msgstr "" -#: ../../library/os.rst:685 +#: ../../library/os.rst:686 msgid "Set the current process's real and effective group ids." msgstr "" -#: ../../library/os.rst:692 +#: ../../library/os.rst:693 msgid "Set the current process's real, effective, and saved group ids." msgstr "" -#: ../../library/os.rst:701 +#: ../../library/os.rst:702 msgid "Set the current process's real, effective, and saved user ids." msgstr "" -#: ../../library/os.rst:710 +#: ../../library/os.rst:711 msgid "Set the current process's real and effective user ids." msgstr "" -#: ../../library/os.rst:717 +#: ../../library/os.rst:718 msgid "" "Call the system call :c:func:`!getsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:724 +#: ../../library/os.rst:725 msgid "" "Call the system call :c:func:`!setsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:733 +#: ../../library/os.rst:734 msgid "Set the current process's user id." msgstr "" -#: ../../library/os.rst:741 +#: ../../library/os.rst:742 msgid "" "Return the error message corresponding to the error code in *code*. On " "platforms where :c:func:`!strerror` returns ``NULL`` when given an unknown " "error number, :exc:`ValueError` is raised." msgstr "" -#: ../../library/os.rst:748 +#: ../../library/os.rst:749 msgid "" "``True`` if the native OS type of the environment is bytes (eg. ``False`` on " "Windows)." msgstr "" -#: ../../library/os.rst:756 +#: ../../library/os.rst:757 msgid "Set the current numeric umask and return the previous umask." msgstr "" -#: ../../library/os.rst:768 +#: ../../library/os.rst:769 msgid "" "Returns information identifying the current operating system. The return " "value is an object with five attributes:" msgstr "" -#: ../../library/os.rst:771 +#: ../../library/os.rst:772 msgid ":attr:`sysname` - operating system name" msgstr ":attr:`sysname` - 作業系統名稱" -#: ../../library/os.rst:772 +#: ../../library/os.rst:773 msgid ":attr:`nodename` - name of machine on network (implementation-defined)" msgstr "" -#: ../../library/os.rst:773 +#: ../../library/os.rst:774 msgid ":attr:`release` - operating system release" msgstr "" -#: ../../library/os.rst:774 +#: ../../library/os.rst:775 msgid ":attr:`version` - operating system version" msgstr ":attr:`version` - 作業系統版本" -#: ../../library/os.rst:775 +#: ../../library/os.rst:776 msgid ":attr:`machine` - hardware identifier" msgstr "" -#: ../../library/os.rst:777 +#: ../../library/os.rst:778 msgid "" "For backwards compatibility, this object is also iterable, behaving like a " "five-tuple containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :" "attr:`version`, and :attr:`machine` in that order." msgstr "" -#: ../../library/os.rst:782 +#: ../../library/os.rst:783 msgid "" "Some systems truncate :attr:`nodename` to 8 characters or to the leading " "component; a better way to get the hostname is :func:`socket.gethostname` " "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: ../../library/os.rst:787 +#: ../../library/os.rst:788 msgid "" "On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " "``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." @@ -932,20 +938,20 @@ msgid "" "on iOS and Android." msgstr "" -#: ../../library/os.rst:794 ../../library/os.rst:5001 +#: ../../library/os.rst:795 ../../library/os.rst:5002 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: ../../library/os.rst:803 +#: ../../library/os.rst:804 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " "environment affect subprocesses started with :func:`os.system`, :func:" "`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:807 +#: ../../library/os.rst:808 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -953,18 +959,18 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: ../../library/os.rst:812 +#: ../../library/os.rst:813 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" "引發一個附帶引數 ``key`` 的\\ :ref:`稽核事件 ` ``os.unsetenv``。" -#: ../../library/os.rst:814 +#: ../../library/os.rst:815 msgid "The function is now always available and is also available on Windows." msgstr "" -#: ../../library/os.rst:820 +#: ../../library/os.rst:821 msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " @@ -975,28 +981,28 @@ msgid "" "are made to the calling process's execution context." msgstr "" -#: ../../library/os.rst:837 +#: ../../library/os.rst:838 msgid "The :func:`~os.setns` function." msgstr ":func:`~os.setns` 函式。" -#: ../../library/os.rst:841 +#: ../../library/os.rst:842 msgid "" "Flags to the :func:`unshare` function, if the implementation supports them. " "See :manpage:`unshare(2)` in the Linux manual for their exact effect and " "availability." msgstr "" -#: ../../library/os.rst:864 +#: ../../library/os.rst:865 msgid "File Object Creation" msgstr "" -#: ../../library/os.rst:866 +#: ../../library/os.rst:867 msgid "" "These functions create new :term:`file objects `. (See also :" "func:`~os.open` for opening file descriptors.)" msgstr "" -#: ../../library/os.rst:872 +#: ../../library/os.rst:873 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -1004,16 +1010,16 @@ msgid "" "must always be an integer." msgstr "" -#: ../../library/os.rst:881 +#: ../../library/os.rst:882 msgid "File Descriptor Operations" msgstr "" -#: ../../library/os.rst:883 +#: ../../library/os.rst:884 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: ../../library/os.rst:885 +#: ../../library/os.rst:886 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -1023,7 +1029,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: ../../library/os.rst:892 +#: ../../library/os.rst:893 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -1031,11 +1037,11 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: ../../library/os.rst:900 +#: ../../library/os.rst:901 msgid "Close file descriptor *fd*." msgstr "" -#: ../../library/os.rst:904 +#: ../../library/os.rst:905 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " @@ -1043,13 +1049,13 @@ msgid "" "`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: ../../library/os.rst:912 +#: ../../library/os.rst:913 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: ../../library/os.rst:915 +#: ../../library/os.rst:916 msgid "" "for fd in range(fd_low, fd_high):\n" " try:\n" @@ -1063,7 +1069,7 @@ msgstr "" " except OSError:\n" " pass" -#: ../../library/os.rst:924 +#: ../../library/os.rst:925 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1071,14 +1077,14 @@ msgid "" "respectively for *offset_dst*." msgstr "" -#: ../../library/os.rst:929 +#: ../../library/os.rst:930 msgid "" "In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " "reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" "attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:933 +#: ../../library/os.rst:934 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1088,19 +1094,19 @@ msgid "" "(in the case of NFS)." msgstr "" -#: ../../library/os.rst:940 +#: ../../library/os.rst:941 msgid "" "The function copies bytes between two file descriptors. Text options, like " "the encoding and the line ending, are ignored." msgstr "" -#: ../../library/os.rst:943 +#: ../../library/os.rst:944 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: ../../library/os.rst:948 +#: ../../library/os.rst:949 msgid "" "On Linux, :func:`os.copy_file_range` should not be used for copying a range " "of a pseudo file from a special filesystem like procfs and sysfs. It will " @@ -1108,39 +1114,39 @@ msgid "" "known Linux kernel issue." msgstr "" -#: ../../library/os.rst:960 +#: ../../library/os.rst:961 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: ../../library/os.rst:963 +#: ../../library/os.rst:964 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: ../../library/os.rst:966 +#: ../../library/os.rst:967 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: ../../library/os.rst:972 +#: ../../library/os.rst:973 msgid "" "Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" "`non-inheritable `." msgstr "" -#: ../../library/os.rst:975 +#: ../../library/os.rst:976 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:981 ../../library/os.rst:1266 +#: ../../library/os.rst:982 ../../library/os.rst:1267 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/os.rst:987 +#: ../../library/os.rst:988 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -1148,23 +1154,23 @@ msgid "" "``False``." msgstr "" -#: ../../library/os.rst:994 +#: ../../library/os.rst:995 msgid "Add the optional *inheritable* parameter." -msgstr "" +msgstr "新增可選用的參數 *inheritable*。" -#: ../../library/os.rst:997 +#: ../../library/os.rst:998 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: ../../library/os.rst:1003 +#: ../../library/os.rst:1004 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: ../../library/os.rst:1007 ../../library/os.rst:2136 -#: ../../library/os.rst:2237 +#: ../../library/os.rst:1008 ../../library/os.rst:2137 +#: ../../library/os.rst:2238 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -1172,28 +1178,28 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chmod``。" -#: ../../library/os.rst:1011 ../../library/os.rst:1029 -#: ../../library/os.rst:1120 ../../library/os.rst:1705 -#: ../../library/os.rst:2133 ../../library/os.rst:2166 -#: ../../library/os.rst:3458 +#: ../../library/os.rst:1012 ../../library/os.rst:1030 +#: ../../library/os.rst:1121 ../../library/os.rst:1706 +#: ../../library/os.rst:2134 ../../library/os.rst:2167 +#: ../../library/os.rst:3459 msgid "" "The function is limited on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:1014 ../../library/os.rst:2244 +#: ../../library/os.rst:1015 ../../library/os.rst:2245 msgid "Added support on Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:1020 +#: ../../library/os.rst:1021 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " "and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" "`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" -#: ../../library/os.rst:1025 ../../library/os.rst:2162 -#: ../../library/os.rst:2253 +#: ../../library/os.rst:1026 ../../library/os.rst:2163 +#: ../../library/os.rst:2254 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." @@ -1201,17 +1207,17 @@ msgstr "" "引發一個附帶引數 ``path``、``uid``、``gid``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chown``。" -#: ../../library/os.rst:1035 +#: ../../library/os.rst:1036 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: ../../library/os.rst:1041 +#: ../../library/os.rst:1042 msgid "This function is not available on MacOS." msgstr "" -#: ../../library/os.rst:1046 +#: ../../library/os.rst:1047 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1222,7 +1228,7 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:1054 ../../library/os.rst:2572 +#: ../../library/os.rst:1055 ../../library/os.rst:2573 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -1230,53 +1236,53 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:1059 +#: ../../library/os.rst:1060 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: ../../library/os.rst:1066 +#: ../../library/os.rst:1067 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: ../../library/os.rst:1069 +#: ../../library/os.rst:1070 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: ../../library/os.rst:1073 ../../library/os.rst:2400 +#: ../../library/os.rst:1074 ../../library/os.rst:2401 msgid "The :func:`.stat` function." msgstr "" -#: ../../library/os.rst:1078 +#: ../../library/os.rst:1079 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: ../../library/os.rst:1087 +#: ../../library/os.rst:1088 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` " "function." msgstr "" -#: ../../library/os.rst:1090 +#: ../../library/os.rst:1091 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: ../../library/os.rst:1099 +#: ../../library/os.rst:1100 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " "most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." "truncate(fd, length)``." msgstr "" -#: ../../library/os.rst:1103 +#: ../../library/os.rst:1104 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." @@ -1284,46 +1290,46 @@ msgstr "" "引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:1107 ../../library/os.rst:3497 +#: ../../library/os.rst:1108 ../../library/os.rst:3498 msgid "Added support for Windows" msgstr "新增對 Windows 的支援" -#: ../../library/os.rst:1113 +#: ../../library/os.rst:1114 msgid "" "Get the blocking mode of the file descriptor: ``False`` if the :data:" "`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: ../../library/os.rst:1116 +#: ../../library/os.rst:1117 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`set_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1123 ../../library/os.rst:1708 +#: ../../library/os.rst:1124 ../../library/os.rst:1709 msgid "On Windows, this function is limited to pipes." msgstr "" -#: ../../library/os.rst:1127 ../../library/os.rst:1712 +#: ../../library/os.rst:1128 ../../library/os.rst:1713 msgid "Added support for pipes on Windows." msgstr "新增對 Windows 上的 pipe 支援。" -#: ../../library/os.rst:1133 +#: ../../library/os.rst:1134 msgid "" "Grant access to the slave pseudo-terminal device associated with the master " "pseudo-terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1137 +#: ../../library/os.rst:1138 msgid "Calls the C standard library function :c:func:`grantpt`." msgstr "" -#: ../../library/os.rst:1146 +#: ../../library/os.rst:1147 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: ../../library/os.rst:1152 +#: ../../library/os.rst:1153 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " "open file descriptor. *cmd* specifies the command to use - one of :data:" @@ -1331,7 +1337,7 @@ msgid "" "specifies the section of the file to lock." msgstr "" -#: ../../library/os.rst:1158 +#: ../../library/os.rst:1159 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." @@ -1339,119 +1345,119 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len`` 的\\ :ref:`稽核事件 ` " "``os.lockf``。" -#: ../../library/os.rst:1170 +#: ../../library/os.rst:1171 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: ../../library/os.rst:1179 +#: ../../library/os.rst:1180 msgid "" "Prepare the tty of which fd is a file descriptor for a new login session. " "Make the calling process a session leader; make the tty the controlling tty, " "the stdin, the stdout, and the stderr of the calling process; close fd." msgstr "" -#: ../../library/os.rst:1190 +#: ../../library/os.rst:1191 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *whence*, and return the new position in bytes relative to the start of " "the file. Valid values for *whence* are:" msgstr "" -#: ../../library/os.rst:1195 +#: ../../library/os.rst:1196 msgid "" ":const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file" msgstr "" -#: ../../library/os.rst:1196 +#: ../../library/os.rst:1197 msgid "" ":const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position" msgstr "" -#: ../../library/os.rst:1197 +#: ../../library/os.rst:1198 msgid ":const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file" msgstr "" -#: ../../library/os.rst:1198 +#: ../../library/os.rst:1199 msgid "" ":const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*" msgstr "" -#: ../../library/os.rst:1199 +#: ../../library/os.rst:1200 msgid "" ":const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*" msgstr "" -#: ../../library/os.rst:1203 +#: ../../library/os.rst:1204 msgid "Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`." msgstr "" -#: ../../library/os.rst:1210 +#: ../../library/os.rst:1211 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for whence to adjust the " "file position indicator." msgstr "" -#: ../../library/os.rst:1214 +#: ../../library/os.rst:1215 msgid ":const:`SEEK_SET`" msgstr ":const:`SEEK_SET`" -#: ../../library/os.rst:1215 +#: ../../library/os.rst:1216 msgid "Adjust the file position relative to the beginning of the file." msgstr "" -#: ../../library/os.rst:1216 +#: ../../library/os.rst:1217 msgid ":const:`SEEK_CUR`" msgstr ":const:`SEEK_CUR`" -#: ../../library/os.rst:1217 +#: ../../library/os.rst:1218 msgid "Adjust the file position relative to the current file position." msgstr "" -#: ../../library/os.rst:1218 +#: ../../library/os.rst:1219 msgid ":const:`SEEK_END`" msgstr ":const:`SEEK_END`" -#: ../../library/os.rst:1219 +#: ../../library/os.rst:1220 msgid "Adjust the file position relative to the end of the file." msgstr "" -#: ../../library/os.rst:1221 +#: ../../library/os.rst:1222 msgid "Their values are 0, 1, and 2, respectively." msgstr "" -#: ../../library/os.rst:1227 +#: ../../library/os.rst:1228 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for seeking file data and " "holes on sparsely allocated files." msgstr "" -#: ../../library/os.rst:1231 +#: ../../library/os.rst:1232 msgid ":data:`!SEEK_DATA`" msgstr ":data:`!SEEK_DATA`" -#: ../../library/os.rst:1232 +#: ../../library/os.rst:1233 msgid "" "Adjust the file offset to the next location containing data, relative to the " "seek position." msgstr "" -#: ../../library/os.rst:1235 +#: ../../library/os.rst:1236 msgid ":data:`!SEEK_HOLE`" msgstr ":data:`!SEEK_HOLE`" -#: ../../library/os.rst:1236 +#: ../../library/os.rst:1237 msgid "" "Adjust the file offset to the next location containing a hole, relative to " "the seek position. A hole is defined as a sequence of zeros." msgstr "" -#: ../../library/os.rst:1242 +#: ../../library/os.rst:1243 msgid "These operations only make sense for filesystems that support them." msgstr "" -#: ../../library/os.rst:1251 +#: ../../library/os.rst:1252 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1459,7 +1465,7 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:1256 +#: ../../library/os.rst:1257 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " @@ -1467,13 +1473,13 @@ msgid "" "const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: ../../library/os.rst:1261 +#: ../../library/os.rst:1262 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/os.rst:1264 +#: ../../library/os.rst:1265 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -1481,7 +1487,7 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/os.rst:1271 +#: ../../library/os.rst:1272 msgid "" "This function is intended for low-level I/O. For normal usage, use the " "built-in function :func:`open`, which returns a :term:`file object` with :" @@ -1489,41 +1495,41 @@ msgid "" "a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: ../../library/os.rst:1276 ../../library/os.rst:2405 -#: ../../library/os.rst:2445 ../../library/os.rst:2516 -#: ../../library/os.rst:2538 ../../library/os.rst:2619 -#: ../../library/os.rst:2649 ../../library/os.rst:2756 -#: ../../library/os.rst:3513 +#: ../../library/os.rst:1277 ../../library/os.rst:2406 +#: ../../library/os.rst:2446 ../../library/os.rst:2517 +#: ../../library/os.rst:2539 ../../library/os.rst:2620 +#: ../../library/os.rst:2650 ../../library/os.rst:2757 +#: ../../library/os.rst:3514 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/os.rst:1279 ../../library/os.rst:1630 -#: ../../library/os.rst:1819 ../../library/os.rst:5097 +#: ../../library/os.rst:1280 ../../library/os.rst:1631 +#: ../../library/os.rst:1820 ../../library/os.rst:5098 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" "exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/os.rst:1284 ../../library/os.rst:2029 -#: ../../library/os.rst:2061 ../../library/os.rst:2092 -#: ../../library/os.rst:2142 ../../library/os.rst:2183 -#: ../../library/os.rst:2223 ../../library/os.rst:2241 -#: ../../library/os.rst:2257 ../../library/os.rst:2316 -#: ../../library/os.rst:2408 ../../library/os.rst:2448 -#: ../../library/os.rst:2492 ../../library/os.rst:2519 -#: ../../library/os.rst:2541 ../../library/os.rst:2582 -#: ../../library/os.rst:2652 ../../library/os.rst:2671 -#: ../../library/os.rst:2759 ../../library/os.rst:3049 -#: ../../library/os.rst:3336 ../../library/os.rst:3500 -#: ../../library/os.rst:3516 ../../library/os.rst:3556 -#: ../../library/os.rst:3656 ../../library/os.rst:3717 -#: ../../library/os.rst:4114 ../../library/os.rst:4294 -#: ../../library/os.rst:4859 +#: ../../library/os.rst:1285 ../../library/os.rst:2030 +#: ../../library/os.rst:2062 ../../library/os.rst:2093 +#: ../../library/os.rst:2143 ../../library/os.rst:2184 +#: ../../library/os.rst:2224 ../../library/os.rst:2242 +#: ../../library/os.rst:2258 ../../library/os.rst:2317 +#: ../../library/os.rst:2409 ../../library/os.rst:2449 +#: ../../library/os.rst:2493 ../../library/os.rst:2520 +#: ../../library/os.rst:2542 ../../library/os.rst:2583 +#: ../../library/os.rst:2653 ../../library/os.rst:2672 +#: ../../library/os.rst:2760 ../../library/os.rst:3050 +#: ../../library/os.rst:3337 ../../library/os.rst:3501 +#: ../../library/os.rst:3517 ../../library/os.rst:3557 +#: ../../library/os.rst:3657 ../../library/os.rst:3718 +#: ../../library/os.rst:4115 ../../library/os.rst:4295 +#: ../../library/os.rst:4860 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1287 +#: ../../library/os.rst:1288 msgid "" "The following constants are options for the *flags* parameter to the :func:" "`~os.open` function. They can be combined using the bitwise OR operator ``|" @@ -1533,45 +1539,45 @@ msgid "" "on Windows." msgstr "" -#: ../../library/os.rst:1302 +#: ../../library/os.rst:1303 msgid "The above constants are available on Unix and Windows." msgstr "" -#: ../../library/os.rst:1313 +#: ../../library/os.rst:1314 msgid "The above constants are only available on Unix." msgstr "" -#: ../../library/os.rst:1315 +#: ../../library/os.rst:1316 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: ../../library/os.rst:1326 +#: ../../library/os.rst:1327 msgid "The above constants are only available on Windows." msgstr "" -#: ../../library/os.rst:1333 +#: ../../library/os.rst:1334 msgid "The above constants are only available on macOS." msgstr "" -#: ../../library/os.rst:1335 +#: ../../library/os.rst:1336 msgid "" "Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" "`O_NOFOLLOW_ANY` constants." msgstr "" -#: ../../library/os.rst:1349 +#: ../../library/os.rst:1350 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: ../../library/os.rst:1352 +#: ../../library/os.rst:1353 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: ../../library/os.rst:1362 +#: ../../library/os.rst:1363 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1579,18 +1585,18 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: ../../library/os.rst:1369 ../../library/os.rst:1381 +#: ../../library/os.rst:1370 ../../library/os.rst:1382 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: ../../library/os.rst:1375 +#: ../../library/os.rst:1376 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: ../../library/os.rst:1387 +#: ../../library/os.rst:1388 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " "ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" @@ -1598,13 +1604,13 @@ msgid "" "and writing, respectively." msgstr "" -#: ../../library/os.rst:1400 +#: ../../library/os.rst:1401 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: ../../library/os.rst:1410 +#: ../../library/os.rst:1411 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " @@ -1615,43 +1621,43 @@ msgid "" "`POSIX_FADV_DONTNEED`." msgstr "" -#: ../../library/os.rst:1430 +#: ../../library/os.rst:1431 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: ../../library/os.rst:1440 +#: ../../library/os.rst:1441 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1443 ../../library/os.rst:1619 +#: ../../library/os.rst:1444 ../../library/os.rst:1620 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: ../../library/os.rst:1453 +#: ../../library/os.rst:1454 msgid "Open and return a file descriptor for a master pseudo-terminal device." msgstr "" -#: ../../library/os.rst:1455 +#: ../../library/os.rst:1456 msgid "" "Calls the C standard library function :c:func:`posix_openpt`. The *oflag* " "argument is used to set file status flags and file access modes as specified " "in the manual page of :c:func:`posix_openpt` of your system." msgstr "" -#: ../../library/os.rst:1459 +#: ../../library/os.rst:1460 msgid "" "The returned file descriptor is :ref:`non-inheritable `. If " "the value :data:`O_CLOEXEC` is available on the system, it is added to " "*oflag*." msgstr "" -#: ../../library/os.rst:1470 +#: ../../library/os.rst:1471 msgid "" "Read from a file descriptor *fd* at a position of *offset* into mutable :" "term:`bytes-like objects ` *buffers*, leaving the file " @@ -1659,92 +1665,92 @@ msgid "" "move on to the next buffer in the sequence to hold the rest of the data." msgstr "" -#: ../../library/os.rst:1475 ../../library/os.rst:1560 +#: ../../library/os.rst:1476 ../../library/os.rst:1561 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: ../../library/os.rst:1478 +#: ../../library/os.rst:1479 msgid ":data:`RWF_HIPRI`" msgstr ":data:`RWF_HIPRI`" -#: ../../library/os.rst:1479 +#: ../../library/os.rst:1480 msgid ":data:`RWF_NOWAIT`" msgstr ":data:`RWF_NOWAIT`" -#: ../../library/os.rst:1481 ../../library/os.rst:1756 +#: ../../library/os.rst:1482 ../../library/os.rst:1757 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: ../../library/os.rst:1484 ../../library/os.rst:1569 -#: ../../library/os.rst:1759 ../../library/os.rst:1834 +#: ../../library/os.rst:1485 ../../library/os.rst:1570 +#: ../../library/os.rst:1760 ../../library/os.rst:1835 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: ../../library/os.rst:1487 +#: ../../library/os.rst:1488 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1491 ../../library/os.rst:1576 +#: ../../library/os.rst:1492 ../../library/os.rst:1577 msgid "Using flags requires Linux >= 4.6." msgstr "" -#: ../../library/os.rst:1498 +#: ../../library/os.rst:1499 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: ../../library/os.rst:1502 +#: ../../library/os.rst:1503 msgid "" "If some data was successfully read, it will return the number of bytes read. " "If no bytes were read, it will return ``-1`` and set errno to :const:`errno." "EAGAIN`." msgstr "" -#: ../../library/os.rst:1513 +#: ../../library/os.rst:1514 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: ../../library/os.rst:1517 +#: ../../library/os.rst:1518 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1527 +#: ../../library/os.rst:1528 msgid "" "Return the name of the slave pseudo-terminal device associated with the " "master pseudo-terminal device to which the file descriptor *fd* refers. The " "file descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1531 +#: ../../library/os.rst:1532 msgid "" "Calls the reentrant C standard library function :c:func:`ptsname_r` if it is " "available; otherwise, the C standard library function :c:func:`ptsname`, " "which is not guaranteed to be thread-safe, is called." msgstr "" -#: ../../library/os.rst:1542 +#: ../../library/os.rst:1543 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1545 ../../library/os.rst:1809 +#: ../../library/os.rst:1546 ../../library/os.rst:1810 msgid "Return the number of bytes actually written." msgstr "" -#: ../../library/os.rst:1554 +#: ../../library/os.rst:1555 msgid "" "Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " "leaving the file offset unchanged. *buffers* must be a sequence of :term:" @@ -1753,39 +1759,39 @@ msgid "" "the second, and so on." msgstr "" -#: ../../library/os.rst:1563 +#: ../../library/os.rst:1564 msgid ":data:`RWF_DSYNC`" msgstr ":data:`RWF_DSYNC`" -#: ../../library/os.rst:1564 +#: ../../library/os.rst:1565 msgid ":data:`RWF_SYNC`" msgstr ":data:`RWF_SYNC`" -#: ../../library/os.rst:1565 +#: ../../library/os.rst:1566 msgid ":data:`RWF_APPEND`" msgstr ":data:`RWF_APPEND`" -#: ../../library/os.rst:1567 +#: ../../library/os.rst:1568 msgid "Return the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1572 +#: ../../library/os.rst:1573 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: ../../library/os.rst:1583 +#: ../../library/os.rst:1584 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1593 +#: ../../library/os.rst:1594 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1603 +#: ../../library/os.rst:1604 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1795,11 +1801,11 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1617 +#: ../../library/os.rst:1618 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1624 +#: ../../library/os.rst:1625 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " @@ -1808,26 +1814,26 @@ msgid "" "`~file.readline` methods." msgstr "" -#: ../../library/os.rst:1639 +#: ../../library/os.rst:1640 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: ../../library/os.rst:1643 +#: ../../library/os.rst:1644 msgid "" "The first function notation is supported by all platforms that define :func:" "`sendfile`." msgstr "" -#: ../../library/os.rst:1646 +#: ../../library/os.rst:1647 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: ../../library/os.rst:1649 +#: ../../library/os.rst:1650 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1835,58 +1841,58 @@ msgid "" "case." msgstr "" -#: ../../library/os.rst:1653 +#: ../../library/os.rst:1654 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: ../../library/os.rst:1656 +#: ../../library/os.rst:1657 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: ../../library/os.rst:1659 +#: ../../library/os.rst:1660 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: ../../library/os.rst:1666 +#: ../../library/os.rst:1667 msgid "" "For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." "sendfile`." msgstr "" -#: ../../library/os.rst:1671 +#: ../../library/os.rst:1672 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: ../../library/os.rst:1679 +#: ../../library/os.rst:1680 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: ../../library/os.rst:1688 +#: ../../library/os.rst:1689 msgid "" "Parameter to the :func:`sendfile` function, if the implementation supports " "it. The data won't be cached in the virtual memory and will be freed " "afterwards." msgstr "" -#: ../../library/os.rst:1698 +#: ../../library/os.rst:1699 msgid "" "Set the blocking mode of the specified file descriptor. Set the :data:" "`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" -#: ../../library/os.rst:1701 +#: ../../library/os.rst:1702 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`get_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1718 +#: ../../library/os.rst:1719 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1898,7 +1904,7 @@ msgid "" "`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:1727 +#: ../../library/os.rst:1728 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1906,7 +1912,7 @@ msgid "" "files are opened as binary." msgstr "" -#: ../../library/os.rst:1732 +#: ../../library/os.rst:1733 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1915,7 +1921,7 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1751 +#: ../../library/os.rst:1752 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1923,41 +1929,41 @@ msgid "" "rest of the data." msgstr "" -#: ../../library/os.rst:1769 +#: ../../library/os.rst:1770 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: ../../library/os.rst:1777 +#: ../../library/os.rst:1778 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: ../../library/os.rst:1785 +#: ../../library/os.rst:1786 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: ../../library/os.rst:1794 +#: ../../library/os.rst:1795 msgid "" "Unlock the slave pseudo-terminal device associated with the master pseudo-" "terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1798 +#: ../../library/os.rst:1799 msgid "Calls the C standard library function :c:func:`unlockpt`." msgstr "" -#: ../../library/os.rst:1807 +#: ../../library/os.rst:1808 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1813 +#: ../../library/os.rst:1814 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " @@ -1966,7 +1972,7 @@ msgid "" "its :meth:`~file.write` method." msgstr "" -#: ../../library/os.rst:1827 +#: ../../library/os.rst:1828 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1974,70 +1980,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1832 +#: ../../library/os.rst:1833 msgid "Returns the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1845 +#: ../../library/os.rst:1846 msgid "Querying the size of a terminal" msgstr "" -#: ../../library/os.rst:1851 +#: ../../library/os.rst:1852 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: ../../library/os.rst:1854 +#: ../../library/os.rst:1855 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: ../../library/os.rst:1857 +#: ../../library/os.rst:1858 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: ../../library/os.rst:1860 +#: ../../library/os.rst:1861 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: ../../library/os.rst:1868 +#: ../../library/os.rst:1869 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: ../../library/os.rst:1872 +#: ../../library/os.rst:1873 msgid "Width of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1876 +#: ../../library/os.rst:1877 msgid "Height of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1882 +#: ../../library/os.rst:1883 msgid "Inheritance of File Descriptors" msgstr "" -#: ../../library/os.rst:1886 +#: ../../library/os.rst:1887 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: ../../library/os.rst:1890 +#: ../../library/os.rst:1891 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: ../../library/os.rst:1893 +#: ../../library/os.rst:1894 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -2048,38 +2054,38 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: ../../library/os.rst:1901 +#: ../../library/os.rst:1902 msgid "On WebAssembly platforms, the file descriptor cannot be modified." msgstr "" -#: ../../library/os.rst:1905 +#: ../../library/os.rst:1906 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: ../../library/os.rst:1909 +#: ../../library/os.rst:1910 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: ../../library/os.rst:1913 +#: ../../library/os.rst:1914 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1919 +#: ../../library/os.rst:1920 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: ../../library/os.rst:1927 +#: ../../library/os.rst:1928 msgid "Files and Directories" msgstr "" -#: ../../library/os.rst:1929 +#: ../../library/os.rst:1930 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: ../../library/os.rst:1934 +#: ../../library/os.rst:1935 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " @@ -2090,7 +2096,7 @@ msgid "" "``chdir``).)" msgstr "" -#: ../../library/os.rst:1942 +#: ../../library/os.rst:1943 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " @@ -2098,13 +2104,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1947 +#: ../../library/os.rst:1948 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: ../../library/os.rst:1952 +#: ../../library/os.rst:1953 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " @@ -2115,14 +2121,14 @@ msgid "" "``access``)." msgstr "" -#: ../../library/os.rst:1959 +#: ../../library/os.rst:1960 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1965 +#: ../../library/os.rst:1966 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " @@ -2131,14 +2137,14 @@ msgid "" "function.)" msgstr "" -#: ../../library/os.rst:1971 +#: ../../library/os.rst:1972 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1979 +#: ../../library/os.rst:1980 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " @@ -2150,13 +2156,13 @@ msgid "" "manpage:`access(2)` for more information." msgstr "" -#: ../../library/os.rst:1988 +#: ../../library/os.rst:1989 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1991 +#: ../../library/os.rst:1992 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -2165,7 +2171,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1999 +#: ../../library/os.rst:2000 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -2174,7 +2180,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/os.rst:2005 +#: ../../library/os.rst:2006 msgid "" "if os.access(\"myfile\", os.R_OK):\n" " with open(\"myfile\") as fp:\n" @@ -2186,11 +2192,11 @@ msgstr "" " return fp.read()\n" "return \"some default data\"" -#: ../../library/os.rst:2010 +#: ../../library/os.rst:2011 msgid "is better written as::" msgstr "" -#: ../../library/os.rst:2012 +#: ../../library/os.rst:2013 msgid "" "try:\n" " fp = open(\"myfile\")\n" @@ -2208,113 +2214,113 @@ msgstr "" " with fp:\n" " return fp.read()" -#: ../../library/os.rst:2022 +#: ../../library/os.rst:2023 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: ../../library/os.rst:2026 +#: ../../library/os.rst:2027 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "新增 *dir_fd*、*effective_ids* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2038 +#: ../../library/os.rst:2039 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: ../../library/os.rst:2047 +#: ../../library/os.rst:2048 msgid "Change the current working directory to *path*." msgstr "" -#: ../../library/os.rst:2049 +#: ../../library/os.rst:2050 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: ../../library/os.rst:2052 +#: ../../library/os.rst:2053 msgid "" "This function can raise :exc:`OSError` and subclasses such as :exc:" "`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" -#: ../../library/os.rst:2055 ../../library/os.rst:2193 +#: ../../library/os.rst:2056 ../../library/os.rst:2194 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.chdir``。" -#: ../../library/os.rst:2057 +#: ../../library/os.rst:2058 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: ../../library/os.rst:2067 +#: ../../library/os.rst:2068 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " "combination (bitwise OR) of the following values (as defined in the :mod:" "`stat` module):" msgstr "" -#: ../../library/os.rst:2070 +#: ../../library/os.rst:2071 msgid ":const:`stat.UF_NODUMP`" msgstr ":const:`stat.UF_NODUMP`" -#: ../../library/os.rst:2071 +#: ../../library/os.rst:2072 msgid ":const:`stat.UF_IMMUTABLE`" msgstr ":const:`stat.UF_IMMUTABLE`" -#: ../../library/os.rst:2072 +#: ../../library/os.rst:2073 msgid ":const:`stat.UF_APPEND`" msgstr ":const:`stat.UF_APPEND`" -#: ../../library/os.rst:2073 +#: ../../library/os.rst:2074 msgid ":const:`stat.UF_OPAQUE`" msgstr ":const:`stat.UF_OPAQUE`" -#: ../../library/os.rst:2074 +#: ../../library/os.rst:2075 msgid ":const:`stat.UF_NOUNLINK`" msgstr ":const:`stat.UF_NOUNLINK`" -#: ../../library/os.rst:2075 +#: ../../library/os.rst:2076 msgid ":const:`stat.UF_COMPRESSED`" msgstr ":const:`stat.UF_COMPRESSED`" -#: ../../library/os.rst:2076 +#: ../../library/os.rst:2077 msgid ":const:`stat.UF_HIDDEN`" msgstr ":const:`stat.UF_HIDDEN`" -#: ../../library/os.rst:2077 +#: ../../library/os.rst:2078 msgid ":const:`stat.SF_ARCHIVED`" msgstr ":const:`stat.SF_ARCHIVED`" -#: ../../library/os.rst:2078 +#: ../../library/os.rst:2079 msgid ":const:`stat.SF_IMMUTABLE`" msgstr ":const:`stat.SF_IMMUTABLE`" -#: ../../library/os.rst:2079 +#: ../../library/os.rst:2080 msgid ":const:`stat.SF_APPEND`" msgstr ":const:`stat.SF_APPEND`" -#: ../../library/os.rst:2080 +#: ../../library/os.rst:2081 msgid ":const:`stat.SF_NOUNLINK`" msgstr ":const:`stat.SF_NOUNLINK`" -#: ../../library/os.rst:2081 +#: ../../library/os.rst:2082 msgid ":const:`stat.SF_SNAPSHOT`" msgstr ":const:`stat.SF_SNAPSHOT`" -#: ../../library/os.rst:2083 +#: ../../library/os.rst:2084 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2085 ../../library/os.rst:2219 +#: ../../library/os.rst:2086 ../../library/os.rst:2220 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." @@ -2322,102 +2328,102 @@ msgstr "" "引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` ``os." "chflags``。" -#: ../../library/os.rst:2089 +#: ../../library/os.rst:2090 msgid "Added the *follow_symlinks* parameter." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/os.rst:2098 +#: ../../library/os.rst:2099 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: ../../library/os.rst:2102 +#: ../../library/os.rst:2103 msgid ":const:`stat.S_ISUID`" msgstr ":const:`stat.S_ISUID`" -#: ../../library/os.rst:2103 +#: ../../library/os.rst:2104 msgid ":const:`stat.S_ISGID`" msgstr ":const:`stat.S_ISGID`" -#: ../../library/os.rst:2104 +#: ../../library/os.rst:2105 msgid ":const:`stat.S_ENFMT`" msgstr ":const:`stat.S_ENFMT`" -#: ../../library/os.rst:2105 +#: ../../library/os.rst:2106 msgid ":const:`stat.S_ISVTX`" msgstr ":const:`stat.S_ISVTX`" -#: ../../library/os.rst:2106 +#: ../../library/os.rst:2107 msgid ":const:`stat.S_IREAD`" msgstr ":const:`stat.S_IREAD`" -#: ../../library/os.rst:2107 +#: ../../library/os.rst:2108 msgid ":const:`stat.S_IWRITE`" msgstr ":const:`stat.S_IWRITE`" -#: ../../library/os.rst:2108 +#: ../../library/os.rst:2109 msgid ":const:`stat.S_IEXEC`" msgstr ":const:`stat.S_IEXEC`" -#: ../../library/os.rst:2109 +#: ../../library/os.rst:2110 msgid ":const:`stat.S_IRWXU`" msgstr ":const:`stat.S_IRWXU`" -#: ../../library/os.rst:2110 +#: ../../library/os.rst:2111 msgid ":const:`stat.S_IRUSR`" msgstr ":const:`stat.S_IRUSR`" -#: ../../library/os.rst:2111 +#: ../../library/os.rst:2112 msgid ":const:`stat.S_IWUSR`" msgstr ":const:`stat.S_IWUSR`" -#: ../../library/os.rst:2112 +#: ../../library/os.rst:2113 msgid ":const:`stat.S_IXUSR`" msgstr ":const:`stat.S_IXUSR`" -#: ../../library/os.rst:2113 +#: ../../library/os.rst:2114 msgid ":const:`stat.S_IRWXG`" msgstr ":const:`stat.S_IRWXG`" -#: ../../library/os.rst:2114 +#: ../../library/os.rst:2115 msgid ":const:`stat.S_IRGRP`" msgstr ":const:`stat.S_IRGRP`" -#: ../../library/os.rst:2115 +#: ../../library/os.rst:2116 msgid ":const:`stat.S_IWGRP`" msgstr ":const:`stat.S_IWGRP`" -#: ../../library/os.rst:2116 +#: ../../library/os.rst:2117 msgid ":const:`stat.S_IXGRP`" msgstr ":const:`stat.S_IXGRP`" -#: ../../library/os.rst:2117 +#: ../../library/os.rst:2118 msgid ":const:`stat.S_IRWXO`" msgstr ":const:`stat.S_IRWXO`" -#: ../../library/os.rst:2118 +#: ../../library/os.rst:2119 msgid ":const:`stat.S_IROTH`" msgstr ":const:`stat.S_IROTH`" -#: ../../library/os.rst:2119 +#: ../../library/os.rst:2120 msgid ":const:`stat.S_IWOTH`" msgstr ":const:`stat.S_IWOTH`" -#: ../../library/os.rst:2120 +#: ../../library/os.rst:2121 msgid ":const:`stat.S_IXOTH`" msgstr ":const:`stat.S_IXOTH`" -#: ../../library/os.rst:2122 ../../library/os.rst:2155 -#: ../../library/os.rst:3546 +#: ../../library/os.rst:2123 ../../library/os.rst:2156 +#: ../../library/os.rst:3547 msgid "" "This function can support :ref:`specifying a file descriptor `, :" "ref:`paths relative to directory descriptors ` and :ref:`not " "following symlinks `." msgstr "" -#: ../../library/os.rst:2128 +#: ../../library/os.rst:2129 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " @@ -2425,68 +2431,68 @@ msgid "" "value of *follow_symlinks* is ``False`` on Windows." msgstr "" -#: ../../library/os.rst:2138 ../../library/os.rst:2169 +#: ../../library/os.rst:2139 ../../library/os.rst:2170 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: ../../library/os.rst:2145 +#: ../../library/os.rst:2146 msgid "" "Added support for a file descriptor and the *follow_symlinks* argument on " "Windows." msgstr "" -#: ../../library/os.rst:2152 +#: ../../library/os.rst:2153 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: ../../library/os.rst:2159 +#: ../../library/os.rst:2160 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: ../../library/os.rst:2173 +#: ../../library/os.rst:2174 msgid "Supports a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2179 +#: ../../library/os.rst:2180 msgid "Change the root directory of the current process to *path*." msgstr "" -#: ../../library/os.rst:2189 +#: ../../library/os.rst:2190 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: ../../library/os.rst:2200 +#: ../../library/os.rst:2201 msgid "Return a string representing the current working directory." msgstr "" -#: ../../library/os.rst:2205 +#: ../../library/os.rst:2206 msgid "Return a bytestring representing the current working directory." msgstr "" -#: ../../library/os.rst:2207 +#: ../../library/os.rst:2208 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: ../../library/os.rst:2215 +#: ../../library/os.rst:2216 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " "not follow symbolic links. As of Python 3.3, this is equivalent to ``os." "chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2229 +#: ../../library/os.rst:2230 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " @@ -2494,31 +2500,31 @@ msgid "" "chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2234 +#: ../../library/os.rst:2235 msgid "" "``lchmod()`` is not part of POSIX, but Unix implementations may have it if " "changing the mode of symbolic links is supported." msgstr "" -#: ../../library/os.rst:2249 +#: ../../library/os.rst:2250 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2263 +#: ../../library/os.rst:2264 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:2265 +#: ../../library/os.rst:2266 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `, and :ref:" "`not following symlinks `." msgstr "" -#: ../../library/os.rst:2269 +#: ../../library/os.rst:2270 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2526,20 +2532,20 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.link``。" -#: ../../library/os.rst:2273 ../../library/os.rst:4543 +#: ../../library/os.rst:2274 ../../library/os.rst:4544 msgid "Added Windows support." msgstr "新支援 Windows。" -#: ../../library/os.rst:2276 +#: ../../library/os.rst:2277 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* parameters." msgstr "新增 *src_dir_fd*、*dst_dir_fd* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2279 ../../library/os.rst:2703 -#: ../../library/os.rst:2740 ../../library/os.rst:3468 +#: ../../library/os.rst:2280 ../../library/os.rst:2704 +#: ../../library/os.rst:2741 ../../library/os.rst:3469 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: ../../library/os.rst:2285 +#: ../../library/os.rst:2286 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2548,7 +2554,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: ../../library/os.rst:2291 +#: ../../library/os.rst:2292 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2556,42 +2562,42 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2296 ../../library/os.rst:2788 +#: ../../library/os.rst:2297 ../../library/os.rst:2789 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: ../../library/os.rst:2299 +#: ../../library/os.rst:2300 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listdir``。" -#: ../../library/os.rst:2302 +#: ../../library/os.rst:2303 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: ../../library/os.rst:2306 +#: ../../library/os.rst:2307 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: ../../library/os.rst:2310 +#: ../../library/os.rst:2311 msgid "The *path* parameter became optional." msgstr "" -#: ../../library/os.rst:2313 ../../library/os.rst:3327 +#: ../../library/os.rst:2314 ../../library/os.rst:3328 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: ../../library/os.rst:2322 +#: ../../library/os.rst:2323 msgid "Return a list containing the names of drives on a Windows system." msgstr "" -#: ../../library/os.rst:2324 +#: ../../library/os.rst:2325 msgid "" "A drive name typically looks like ``'C:\\\\'``. Not every drive name will be " "associated with a volume, and some may be inaccessible for a variety of " @@ -2599,22 +2605,22 @@ msgid "" "function does not test for access." msgstr "" -#: ../../library/os.rst:2329 +#: ../../library/os.rst:2330 msgid "May raise :exc:`OSError` if an error occurs collecting the drive names." msgstr "" -#: ../../library/os.rst:2332 +#: ../../library/os.rst:2333 msgid "" "Raises an :ref:`auditing event ` ``os.listdrives`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listdrives``。" -#: ../../library/os.rst:2341 +#: ../../library/os.rst:2342 msgid "" "Return a list containing the mount points for a volume on a Windows system." msgstr "" -#: ../../library/os.rst:2344 +#: ../../library/os.rst:2345 msgid "" "*volume* must be represented as a GUID path, like those returned by :func:" "`os.listvolumes`. Volumes may be mounted in multiple locations or not at " @@ -2622,19 +2628,19 @@ msgid "" "associated with a volume will not be returned by this function." msgstr "" -#: ../../library/os.rst:2350 +#: ../../library/os.rst:2351 msgid "" "The mount points return by this function will be absolute paths, and may be " "longer than the drive name." msgstr "" -#: ../../library/os.rst:2353 +#: ../../library/os.rst:2354 msgid "" "Raises :exc:`OSError` if the volume is not recognized or if an error occurs " "collecting the paths." msgstr "" -#: ../../library/os.rst:2356 +#: ../../library/os.rst:2357 msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." @@ -2642,11 +2648,11 @@ msgstr "" "引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` ``os." "listmounts``。" -#: ../../library/os.rst:2365 +#: ../../library/os.rst:2366 msgid "Return a list containing the volumes in the system." msgstr "" -#: ../../library/os.rst:2367 +#: ../../library/os.rst:2368 msgid "" "Volumes are typically represented as a GUID path that looks like ``\\\\?" "\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\``. Files can usually be " @@ -2655,49 +2661,49 @@ msgid "" "function is to retrieve mount points using :func:`os.listmounts`." msgstr "" -#: ../../library/os.rst:2374 +#: ../../library/os.rst:2375 msgid "May raise :exc:`OSError` if an error occurs collecting the volumes." msgstr "" -#: ../../library/os.rst:2376 +#: ../../library/os.rst:2377 msgid "" "Raises an :ref:`auditing event ` ``os.listvolumes`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listvolumes``。" -#: ../../library/os.rst:2385 +#: ../../library/os.rst:2386 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " "Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" "class:`stat_result` object." msgstr "" -#: ../../library/os.rst:2389 +#: ../../library/os.rst:2390 msgid "" "On platforms that do not support symbolic links, this is an alias for :func:" "`~os.stat`." msgstr "" -#: ../../library/os.rst:2392 +#: ../../library/os.rst:2393 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2395 ../../library/os.rst:2437 -#: ../../library/os.rst:2505 ../../library/os.rst:2533 -#: ../../library/os.rst:2607 +#: ../../library/os.rst:2396 ../../library/os.rst:2438 +#: ../../library/os.rst:2506 ../../library/os.rst:2534 +#: ../../library/os.rst:2608 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2402 ../../library/os.rst:2616 -#: ../../library/os.rst:3461 +#: ../../library/os.rst:2403 ../../library/os.rst:2617 +#: ../../library/os.rst:3462 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: ../../library/os.rst:2411 +#: ../../library/os.rst:2412 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " @@ -2705,18 +2711,18 @@ msgid "" "stat`." msgstr "" -#: ../../library/os.rst:2420 +#: ../../library/os.rst:2421 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: ../../library/os.rst:2422 +#: ../../library/os.rst:2423 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: ../../library/os.rst:2427 +#: ../../library/os.rst:2428 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2725,20 +2731,20 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: ../../library/os.rst:2433 +#: ../../library/os.rst:2434 msgid "" "On Windows, a *mode* of ``0o700`` is specifically handled to apply access " "control to the new directory such that only the current user and " "administrators have access. Other values of *mode* are ignored." msgstr "" -#: ../../library/os.rst:2440 +#: ../../library/os.rst:2441 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: ../../library/os.rst:2443 ../../library/os.rst:2480 +#: ../../library/os.rst:2444 ../../library/os.rst:2481 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -2746,17 +2752,17 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.mkdir``。" -#: ../../library/os.rst:2451 +#: ../../library/os.rst:2452 msgid "Windows now handles a *mode* of ``0o700``." msgstr "" -#: ../../library/os.rst:2461 +#: ../../library/os.rst:2462 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: ../../library/os.rst:2464 +#: ../../library/os.rst:2465 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2765,27 +2771,27 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: ../../library/os.rst:2470 +#: ../../library/os.rst:2471 msgid "" "If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " "if the target directory already exists." msgstr "" -#: ../../library/os.rst:2475 +#: ../../library/os.rst:2476 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: ../../library/os.rst:2478 +#: ../../library/os.rst:2479 msgid "This function handles UNC paths correctly." msgstr "" -#: ../../library/os.rst:2482 +#: ../../library/os.rst:2483 msgid "Added the *exist_ok* parameter." msgstr "新增 *exist_ok* 參數。" -#: ../../library/os.rst:2487 +#: ../../library/os.rst:2488 msgid "" "Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" "func:`makedirs` would still raise an error if *mode* did not match the mode " @@ -2793,19 +2799,19 @@ msgid "" "safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: ../../library/os.rst:2495 +#: ../../library/os.rst:2496 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: ../../library/os.rst:2502 +#: ../../library/os.rst:2503 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: ../../library/os.rst:2508 +#: ../../library/os.rst:2509 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2815,7 +2821,7 @@ msgid "" "rendezvous point." msgstr "" -#: ../../library/os.rst:2525 +#: ../../library/os.rst:2526 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " @@ -2826,23 +2832,23 @@ msgid "" "`os.makedev`), otherwise it is ignored." msgstr "" -#: ../../library/os.rst:2547 +#: ../../library/os.rst:2548 msgid "" "Extract the device major number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2553 +#: ../../library/os.rst:2554 msgid "" "Extract the device minor number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2559 +#: ../../library/os.rst:2560 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: ../../library/os.rst:2564 +#: ../../library/os.rst:2565 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2853,20 +2859,20 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:2577 ../../library/os.rst:3320 -#: ../../library/os.rst:3489 +#: ../../library/os.rst:2578 ../../library/os.rst:3321 +#: ../../library/os.rst:3490 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: ../../library/os.rst:2588 +#: ../../library/os.rst:2589 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:2597 +#: ../../library/os.rst:2598 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " @@ -2874,7 +2880,7 @@ msgid "" "join(os.path.dirname(path), result)``." msgstr "" -#: ../../library/os.rst:2602 +#: ../../library/os.rst:2603 msgid "" "If the *path* is a string object (directly or indirectly through a :class:" "`PathLike` interface), the result will also be a string object, and the call " @@ -2882,42 +2888,42 @@ msgid "" "indirectly), the result will be a bytes object." msgstr "" -#: ../../library/os.rst:2610 +#: ../../library/os.rst:2611 msgid "" "When trying to resolve a path that may contain links, use :func:`~os.path." "realpath` to properly handle recursion and platform differences." msgstr "" -#: ../../library/os.rst:2622 +#: ../../library/os.rst:2623 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: ../../library/os.rst:2625 +#: ../../library/os.rst:2626 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: ../../library/os.rst:2628 +#: ../../library/os.rst:2629 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: ../../library/os.rst:2634 +#: ../../library/os.rst:2635 msgid "" "Remove (delete) the file *path*. If *path* is a directory, an :exc:" "`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " "does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/os.rst:2638 ../../library/os.rst:2751 -#: ../../library/os.rst:3440 +#: ../../library/os.rst:2639 ../../library/os.rst:2752 +#: ../../library/os.rst:3441 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2641 +#: ../../library/os.rst:2642 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2925,12 +2931,12 @@ msgid "" "longer in use." msgstr "" -#: ../../library/os.rst:2645 +#: ../../library/os.rst:2646 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: ../../library/os.rst:2647 ../../library/os.rst:2669 -#: ../../library/os.rst:3511 +#: ../../library/os.rst:2648 ../../library/os.rst:2670 +#: ../../library/os.rst:3512 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." @@ -2938,7 +2944,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "remove``。" -#: ../../library/os.rst:2660 +#: ../../library/os.rst:2661 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2950,20 +2956,20 @@ msgid "" "could not be successfully removed." msgstr "" -#: ../../library/os.rst:2677 +#: ../../library/os.rst:2678 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: ../../library/os.rst:2680 +#: ../../library/os.rst:2681 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " "operation may fail if *src* and *dst* are on different filesystems. Use :" "func:`shutil.move` to support moves to a different filesystem." msgstr "" -#: ../../library/os.rst:2684 +#: ../../library/os.rst:2685 msgid "" "On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" "`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " @@ -2975,20 +2981,20 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2693 ../../library/os.rst:2733 +#: ../../library/os.rst:2694 ../../library/os.rst:2734 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: ../../library/os.rst:2696 +#: ../../library/os.rst:2697 msgid "" "If you want cross-platform overwriting of the destination, use :func:" "`replace`." msgstr "" -#: ../../library/os.rst:2698 ../../library/os.rst:2719 -#: ../../library/os.rst:2736 +#: ../../library/os.rst:2699 ../../library/os.rst:2720 +#: ../../library/os.rst:2737 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2996,11 +3002,11 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.rename``。" -#: ../../library/os.rst:2700 +#: ../../library/os.rst:2701 msgid "Added the *src_dir_fd* and *dst_dir_fd* parameters." msgstr "新增 *src_dir_fd* 與 *dst_dir_fd* 參數。" -#: ../../library/os.rst:2709 +#: ../../library/os.rst:2710 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -3009,17 +3015,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: ../../library/os.rst:2716 +#: ../../library/os.rst:2717 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: ../../library/os.rst:2721 +#: ../../library/os.rst:2722 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: ../../library/os.rst:2727 +#: ../../library/os.rst:2728 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -3028,7 +3034,7 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2746 +#: ../../library/os.rst:2747 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " @@ -3036,7 +3042,7 @@ msgid "" "rmtree` can be used." msgstr "" -#: ../../library/os.rst:2754 +#: ../../library/os.rst:2755 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." @@ -3044,7 +3050,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "rmdir``。" -#: ../../library/os.rst:2765 +#: ../../library/os.rst:2766 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -3054,7 +3060,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:2772 +#: ../../library/os.rst:2773 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " @@ -3066,7 +3072,7 @@ msgid "" "Unix but only requires one for symbolic links on Windows." msgstr "" -#: ../../library/os.rst:2782 +#: ../../library/os.rst:2783 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -3075,31 +3081,31 @@ msgid "" "they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2791 +#: ../../library/os.rst:2792 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.scandir``。" -#: ../../library/os.rst:2793 +#: ../../library/os.rst:2794 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" msgstr "" -#: ../../library/os.rst:2798 +#: ../../library/os.rst:2799 msgid "Close the iterator and free acquired resources." msgstr "" -#: ../../library/os.rst:2800 +#: ../../library/os.rst:2801 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:2807 +#: ../../library/os.rst:2808 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -3107,7 +3113,7 @@ msgid "" "system call::" msgstr "" -#: ../../library/os.rst:2812 +#: ../../library/os.rst:2813 msgid "" "with os.scandir(path) as it:\n" " for entry in it:\n" @@ -3119,7 +3125,7 @@ msgstr "" " if not entry.name.startswith('.') and entry.is_file():\n" " print(entry.name)" -#: ../../library/os.rst:2819 +#: ../../library/os.rst:2820 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " @@ -3130,7 +3136,7 @@ msgid "" "desktop/aa364428(v=vs.85).aspx>`_ functions." msgstr "" -#: ../../library/os.rst:2831 +#: ../../library/os.rst:2832 msgid "" "Added support for the :term:`context manager` protocol and the :func:" "`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " @@ -3138,28 +3144,28 @@ msgid "" "destructor." msgstr "" -#: ../../library/os.rst:2837 +#: ../../library/os.rst:2838 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2839 +#: ../../library/os.rst:2840 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "" -#: ../../library/os.rst:2845 +#: ../../library/os.rst:2846 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: ../../library/os.rst:2848 +#: ../../library/os.rst:2849 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: ../../library/os.rst:2852 +#: ../../library/os.rst:2853 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -3167,7 +3173,7 @@ msgid "" "up-to-date information." msgstr "" -#: ../../library/os.rst:2857 +#: ../../library/os.rst:2858 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -3175,29 +3181,29 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: ../../library/os.rst:2862 +#: ../../library/os.rst:2863 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: ../../library/os.rst:2865 +#: ../../library/os.rst:2866 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: ../../library/os.rst:2869 +#: ../../library/os.rst:2870 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: ../../library/os.rst:2872 +#: ../../library/os.rst:2873 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2878 +#: ../../library/os.rst:2879 msgid "" "The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." "name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " @@ -3207,51 +3213,51 @@ msgid "" "attribute." msgstr "" -#: ../../library/os.rst:2885 +#: ../../library/os.rst:2886 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2891 +#: ../../library/os.rst:2892 msgid "Return the inode number of the entry." msgstr "" -#: ../../library/os.rst:2893 +#: ../../library/os.rst:2894 msgid "" "The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." "path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2897 +#: ../../library/os.rst:2898 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: ../../library/os.rst:2902 +#: ../../library/os.rst:2903 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2906 +#: ../../library/os.rst:2907 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2910 +#: ../../library/os.rst:2911 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2914 +#: ../../library/os.rst:2915 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -3261,46 +3267,46 @@ msgid "" "is ``False``." msgstr "" -#: ../../library/os.rst:2921 ../../library/os.rst:2951 +#: ../../library/os.rst:2922 ../../library/os.rst:2952 msgid "" "This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" "exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: ../../library/os.rst:2926 +#: ../../library/os.rst:2927 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2930 +#: ../../library/os.rst:2931 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2934 +#: ../../library/os.rst:2935 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: ../../library/os.rst:2939 +#: ../../library/os.rst:2940 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2943 +#: ../../library/os.rst:2944 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "islink` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2946 +#: ../../library/os.rst:2947 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -3308,48 +3314,48 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: ../../library/os.rst:2956 +#: ../../library/os.rst:2957 msgid "" "Return ``True`` if this entry is a junction (even if broken); return " "``False`` if the entry points to a regular directory, any kind of file, a " "symlink, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2960 +#: ../../library/os.rst:2961 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "isjunction` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2967 +#: ../../library/os.rst:2968 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: ../../library/os.rst:2971 +#: ../../library/os.rst:2972 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: ../../library/os.rst:2976 +#: ../../library/os.rst:2977 msgid "" "On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" "class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: ../../library/os.rst:2980 +#: ../../library/os.rst:2981 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: ../../library/os.rst:2984 +#: ../../library/os.rst:2985 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -3357,13 +3363,13 @@ msgid "" "``is_file()``, ``is_symlink()``, ``is_junction()``, and ``stat()`` methods." msgstr "" -#: ../../library/os.rst:2992 +#: ../../library/os.rst:2993 msgid "" "Added support for the :class:`~os.PathLike` interface. Added support for :" "class:`bytes` paths on Windows." msgstr "" -#: ../../library/os.rst:2996 +#: ../../library/os.rst:2997 msgid "" "The ``st_ctime`` attribute of a stat result is deprecated on Windows. The " "file creation time is properly available as ``st_birthtime``, and in the " @@ -3371,7 +3377,7 @@ msgid "" "time, if available." msgstr "" -#: ../../library/os.rst:3005 +#: ../../library/os.rst:3006 msgid "" "Get the status of a file or a file descriptor. Perform the equivalent of a :" "c:func:`stat` system call on the given path. *path* may be specified as " @@ -3380,21 +3386,21 @@ msgid "" "`stat_result` object." msgstr "" -#: ../../library/os.rst:3011 +#: ../../library/os.rst:3012 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:3014 ../../library/os.rst:4093 -#: ../../library/os.rst:4109 ../../library/os.rst:4125 -#: ../../library/os.rst:4145 +#: ../../library/os.rst:3015 ../../library/os.rst:4094 +#: ../../library/os.rst:4110 ../../library/os.rst:4126 +#: ../../library/os.rst:4146 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:3017 +#: ../../library/os.rst:3018 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -3408,11 +3414,11 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:3030 ../../library/os.rst:3800 +#: ../../library/os.rst:3031 ../../library/os.rst:3801 msgid "Example::" msgstr "範例: ::" -#: ../../library/os.rst:3032 +#: ../../library/os.rst:3033 msgid "" ">>> import os\n" ">>> statinfo = os.stat('somefile.txt')\n" @@ -3432,17 +3438,17 @@ msgstr "" ">>> statinfo.st_size\n" "264" -#: ../../library/os.rst:3043 +#: ../../library/os.rst:3044 msgid ":func:`fstat` and :func:`lstat` functions." msgstr ":func:`fstat` 和 :func:`lstat` 函式。" -#: ../../library/os.rst:3045 +#: ../../library/os.rst:3046 msgid "" "Added the *dir_fd* and *follow_symlinks* parameters, specifying a file " "descriptor instead of a path." msgstr "新增 *dir_fd* 與 *follow_symlinks* 參數,指定一個檔案描述器而非路徑。" -#: ../../library/os.rst:3052 +#: ../../library/os.rst:3053 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -3452,122 +3458,122 @@ msgid "" "of raising an error." msgstr "" -#: ../../library/os.rst:3063 +#: ../../library/os.rst:3064 msgid "" "Object whose attributes correspond roughly to the members of the :c:struct:" "`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." "fstat` and :func:`os.lstat`." msgstr "" -#: ../../library/os.rst:3067 +#: ../../library/os.rst:3068 msgid "Attributes:" msgstr "屬性:" -#: ../../library/os.rst:3071 +#: ../../library/os.rst:3072 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: ../../library/os.rst:3075 +#: ../../library/os.rst:3076 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: ../../library/os.rst:3078 +#: ../../library/os.rst:3079 msgid "the inode number on Unix," msgstr "" -#: ../../library/os.rst:3079 +#: ../../library/os.rst:3080 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: ../../library/os.rst:3085 +#: ../../library/os.rst:3086 msgid "Identifier of the device on which this file resides." msgstr "" -#: ../../library/os.rst:3089 +#: ../../library/os.rst:3090 msgid "Number of hard links." msgstr "" -#: ../../library/os.rst:3093 +#: ../../library/os.rst:3094 msgid "User identifier of the file owner." msgstr "" -#: ../../library/os.rst:3097 +#: ../../library/os.rst:3098 msgid "Group identifier of the file owner." msgstr "" -#: ../../library/os.rst:3101 +#: ../../library/os.rst:3102 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: ../../library/os.rst:3105 +#: ../../library/os.rst:3106 msgid "Timestamps:" msgstr "" -#: ../../library/os.rst:3109 +#: ../../library/os.rst:3110 msgid "Time of most recent access expressed in seconds." msgstr "" -#: ../../library/os.rst:3113 +#: ../../library/os.rst:3114 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: ../../library/os.rst:3117 +#: ../../library/os.rst:3118 msgid "Time of most recent metadata change expressed in seconds." msgstr "" -#: ../../library/os.rst:3119 +#: ../../library/os.rst:3120 msgid "" "``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for the file " "creation time. In the future, ``st_ctime`` will contain the time of the most " "recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3126 +#: ../../library/os.rst:3127 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3132 +#: ../../library/os.rst:3133 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: ../../library/os.rst:3139 +#: ../../library/os.rst:3140 msgid "" "Time of most recent metadata change expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3144 +#: ../../library/os.rst:3145 msgid "" "``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` for the " "file creation time. In the future, ``st_ctime`` will contain the time of the " "most recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3151 +#: ../../library/os.rst:3152 msgid "" "Time of file creation expressed in seconds. This attribute is not always " "available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3154 +#: ../../library/os.rst:3155 msgid "``st_birthtime`` is now available on Windows." msgstr "" -#: ../../library/os.rst:3159 +#: ../../library/os.rst:3160 msgid "" "Time of file creation expressed in nanoseconds as an integer. This attribute " "is not always available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3167 +#: ../../library/os.rst:3168 msgid "" "The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" "attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " @@ -3577,7 +3583,7 @@ msgid "" "details." msgstr "" -#: ../../library/os.rst:3174 +#: ../../library/os.rst:3175 msgid "" "Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" "`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " @@ -3590,74 +3596,74 @@ msgid "" "`st_birthtime_ns`." msgstr "" -#: ../../library/os.rst:3184 +#: ../../library/os.rst:3185 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: ../../library/os.rst:3189 +#: ../../library/os.rst:3190 msgid "" "Number of 512-byte blocks allocated for file. This may be smaller than :attr:" "`st_size`/512 when the file has holes." msgstr "" -#: ../../library/os.rst:3194 +#: ../../library/os.rst:3195 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: ../../library/os.rst:3199 +#: ../../library/os.rst:3200 msgid "Type of device if an inode device." msgstr "" -#: ../../library/os.rst:3203 +#: ../../library/os.rst:3204 msgid "User defined flags for file." msgstr "" -#: ../../library/os.rst:3205 +#: ../../library/os.rst:3206 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: ../../library/os.rst:3210 +#: ../../library/os.rst:3211 msgid "File generation number." msgstr "" -#: ../../library/os.rst:3212 +#: ../../library/os.rst:3213 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3217 +#: ../../library/os.rst:3218 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: ../../library/os.rst:3220 +#: ../../library/os.rst:3221 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3224 +#: ../../library/os.rst:3225 msgid "Real size of the file." msgstr "" -#: ../../library/os.rst:3228 +#: ../../library/os.rst:3229 msgid "Creator of the file." msgstr "" -#: ../../library/os.rst:3232 +#: ../../library/os.rst:3233 msgid "File type." msgstr "" -#: ../../library/os.rst:3234 +#: ../../library/os.rst:3235 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: ../../library/os.rst:3238 +#: ../../library/os.rst:3239 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" @@ -3665,7 +3671,7 @@ msgid "" "FILE_ATTRIBUTE_ARCHIVE>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3248 +#: ../../library/os.rst:3249 msgid "" "When :attr:`st_file_attributes` has the :const:`~stat." "FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " @@ -3673,14 +3679,14 @@ msgid "" "IO_REPARSE_TAG_SYMLINK>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3253 +#: ../../library/os.rst:3254 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:struct:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: ../../library/os.rst:3257 +#: ../../library/os.rst:3258 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " @@ -3692,49 +3698,49 @@ msgid "" "class:`stat_result` as a tuple always returns integers." msgstr "" -#: ../../library/os.rst:3266 +#: ../../library/os.rst:3267 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: ../../library/os.rst:3270 +#: ../../library/os.rst:3271 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: ../../library/os.rst:3273 +#: ../../library/os.rst:3274 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "在 Windows 上新增 :attr:`st_reparse_tag` 成員。" -#: ../../library/os.rst:3276 +#: ../../library/os.rst:3277 msgid "" "On Windows, the :attr:`st_mode` member now identifies special files as :" "const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: ../../library/os.rst:3281 +#: ../../library/os.rst:3282 msgid "" "On Windows, :attr:`st_ctime` is deprecated. Eventually, it will contain the " "last metadata change time, for consistency with other platforms, but for now " "still contains creation time. Use :attr:`st_birthtime` for the creation time." msgstr "" -#: ../../library/os.rst:3287 +#: ../../library/os.rst:3288 msgid "" "On Windows, :attr:`st_ino` may now be up to 128 bits, depending on the file " "system. Previously it would not be above 64 bits, and larger file " "identifiers would be arbitrarily packed." msgstr "" -#: ../../library/os.rst:3291 +#: ../../library/os.rst:3292 msgid "" "On Windows, :attr:`st_rdev` no longer returns a value. Previously it would " "contain the same as :attr:`st_dev`, which was incorrect." msgstr "" -#: ../../library/os.rst:3294 +#: ../../library/os.rst:3295 msgid "Added the :attr:`st_birthtime` member on Windows." msgstr "在 Windows 上新增 :attr:`st_birthtime` 成員。" -#: ../../library/os.rst:3299 +#: ../../library/os.rst:3300 msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " @@ -3744,7 +3750,7 @@ msgid "" "`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: ../../library/os.rst:3306 +#: ../../library/os.rst:3307 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3752,7 +3758,7 @@ msgid "" "are disabled or not supported." msgstr "" -#: ../../library/os.rst:3311 +#: ../../library/os.rst:3312 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " "These are :const:`ST_NODEV` (disallow access to device special files), :" @@ -3765,11 +3771,11 @@ msgid "" "relative to mtime/ctime)." msgstr "" -#: ../../library/os.rst:3324 +#: ../../library/os.rst:3325 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" -#: ../../library/os.rst:3330 +#: ../../library/os.rst:3331 msgid "" "The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" "`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" @@ -3777,11 +3783,11 @@ msgid "" "`ST_RELATIME` constants were added." msgstr "" -#: ../../library/os.rst:3339 +#: ../../library/os.rst:3340 msgid "Added the :attr:`f_fsid` attribute." msgstr "新增 :attr:`f_fsid` 屬性。" -#: ../../library/os.rst:3345 +#: ../../library/os.rst:3346 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3793,7 +3799,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: ../../library/os.rst:3355 +#: ../../library/os.rst:3356 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3801,17 +3807,17 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: ../../library/os.rst:3360 +#: ../../library/os.rst:3361 msgid "os.stat in os.supports_dir_fd" msgstr "os.stat in os.supports_dir_fd" -#: ../../library/os.rst:3362 +#: ../../library/os.rst:3363 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: ../../library/os.rst:3370 +#: ../../library/os.rst:3371 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " @@ -3820,23 +3826,23 @@ msgid "" "func:`os.access`; otherwise it will be empty." msgstr "" -#: ../../library/os.rst:3376 +#: ../../library/os.rst:3377 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: ../../library/os.rst:3379 +#: ../../library/os.rst:3380 msgid "os.access in os.supports_effective_ids" msgstr "os.access in os.supports_effective_ids" -#: ../../library/os.rst:3381 +#: ../../library/os.rst:3382 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: ../../library/os.rst:3389 +#: ../../library/os.rst:3390 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3845,7 +3851,7 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: ../../library/os.rst:3396 +#: ../../library/os.rst:3397 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " @@ -3854,11 +3860,11 @@ msgid "" "platform::" msgstr "" -#: ../../library/os.rst:3402 +#: ../../library/os.rst:3403 msgid "os.chdir in os.supports_fd" msgstr "os.chdir in os.supports_fd" -#: ../../library/os.rst:3409 +#: ../../library/os.rst:3410 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3871,7 +3877,7 @@ msgid "" "on all platforms.)" msgstr "" -#: ../../library/os.rst:3419 +#: ../../library/os.rst:3420 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " @@ -3880,15 +3886,15 @@ msgid "" "stat` on the local platform::" msgstr "" -#: ../../library/os.rst:3425 +#: ../../library/os.rst:3426 msgid "os.stat in os.supports_follow_symlinks" msgstr "os.stat in os.supports_follow_symlinks" -#: ../../library/os.rst:3432 +#: ../../library/os.rst:3433 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:3434 +#: ../../library/os.rst:3435 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3898,7 +3904,7 @@ msgid "" "ignored." msgstr "" -#: ../../library/os.rst:3445 +#: ../../library/os.rst:3446 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3906,12 +3912,12 @@ msgid "" "must be run as an administrator." msgstr "" -#: ../../library/os.rst:3451 +#: ../../library/os.rst:3452 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: ../../library/os.rst:3454 +#: ../../library/os.rst:3455 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." @@ -3919,27 +3925,27 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.symlink``。" -#: ../../library/os.rst:3464 +#: ../../library/os.rst:3465 msgid "" "Added the *dir_fd* parameter, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: ../../library/os.rst:3471 +#: ../../library/os.rst:3472 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: ../../library/os.rst:3477 +#: ../../library/os.rst:3478 msgid "Force write of everything to disk." msgstr "" -#: ../../library/os.rst:3486 +#: ../../library/os.rst:3487 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: ../../library/os.rst:3491 +#: ../../library/os.rst:3492 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." @@ -3947,46 +3953,46 @@ msgstr "" "引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:3506 +#: ../../library/os.rst:3507 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: ../../library/os.rst:3522 +#: ../../library/os.rst:3523 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: ../../library/os.rst:3524 +#: ../../library/os.rst:3525 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: ../../library/os.rst:3527 +#: ../../library/os.rst:3528 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: ../../library/os.rst:3530 +#: ../../library/os.rst:3531 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: ../../library/os.rst:3533 +#: ../../library/os.rst:3534 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: ../../library/os.rst:3537 +#: ../../library/os.rst:3538 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: ../../library/os.rst:3539 +#: ../../library/os.rst:3540 msgid "" "Note that the exact times you set here may not be returned by a subsequent :" "func:`~os.stat` call, depending on the resolution with which your operating " @@ -3996,7 +4002,7 @@ msgid "" "func:`utime`." msgstr "" -#: ../../library/os.rst:3550 +#: ../../library/os.rst:3551 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." @@ -4004,13 +4010,13 @@ msgstr "" "引發一個附帶引數 ``path``、``times``、``ns``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.utime``。" -#: ../../library/os.rst:3552 +#: ../../library/os.rst:3553 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: ../../library/os.rst:3566 +#: ../../library/os.rst:3567 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -4018,7 +4024,7 @@ msgid "" "filenames)``." msgstr "" -#: ../../library/os.rst:3571 +#: ../../library/os.rst:3572 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -4032,7 +4038,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:3582 +#: ../../library/os.rst:3583 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -4043,7 +4049,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: ../../library/os.rst:3590 +#: ../../library/os.rst:3591 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -4056,7 +4062,7 @@ msgid "" "itself is generated." msgstr "" -#: ../../library/os.rst:3599 +#: ../../library/os.rst:3600 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -4066,54 +4072,54 @@ msgid "" "object." msgstr "" -#: ../../library/os.rst:3605 +#: ../../library/os.rst:3606 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: ../../library/os.rst:3611 +#: ../../library/os.rst:3612 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: ../../library/os.rst:3617 +#: ../../library/os.rst:3618 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3621 ../../library/os.rst:3683 +#: ../../library/os.rst:3622 ../../library/os.rst:3684 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " -"under any CVS subdirectory::" +"under any ``__pycache__`` subdirectory::" msgstr "" -#: ../../library/os.rst:3625 +#: ../../library/os.rst:3626 msgid "" "import os\n" "from os.path import join, getsize\n" -"for root, dirs, files in os.walk('python/Lib/email'):\n" +"for root, dirs, files in os.walk('python/Lib/xml'):\n" " print(root, \"consumes\", end=\" \")\n" " print(sum(getsize(join(root, name)) for name in files), end=\" \")\n" " print(\"bytes in\", len(files), \"non-directory files\")\n" -" if 'CVS' in dirs:\n" -" dirs.remove('CVS') # don't visit CVS directories" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3634 +#: ../../library/os.rst:3635 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3638 +#: ../../library/os.rst:3639 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4128,7 +4134,7 @@ msgid "" "os.rmdir(top)" msgstr "" -#: ../../library/os.rst:3650 +#: ../../library/os.rst:3651 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." @@ -4136,25 +4142,25 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" "ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3652 +#: ../../library/os.rst:3653 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3666 +#: ../../library/os.rst:3667 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3669 +#: ../../library/os.rst:3670 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3672 +#: ../../library/os.rst:3673 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4162,32 +4168,32 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3679 +#: ../../library/os.rst:3680 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3687 +#: ../../library/os.rst:3688 msgid "" "import os\n" -"for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\n" +"for root, dirs, files, rootfd in os.fwalk('python/Lib/xml'):\n" " print(root, \"consumes\", end=\"\")\n" " print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),\n" " end=\"\")\n" " print(\"bytes in\", len(files), \"non-directory files\")\n" -" if 'CVS' in dirs:\n" -" dirs.remove('CVS') # don't visit CVS directories" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3696 +#: ../../library/os.rst:3697 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3700 +#: ../../library/os.rst:3701 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4201,7 +4207,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3711 +#: ../../library/os.rst:3712 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4209,11 +4215,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3720 +#: ../../library/os.rst:3721 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3726 +#: ../../library/os.rst:3727 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4221,7 +4227,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3731 +#: ../../library/os.rst:3732 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4231,15 +4237,15 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3761 +#: ../../library/os.rst:3762 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3765 +#: ../../library/os.rst:3766 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3772 +#: ../../library/os.rst:3773 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -4248,7 +4254,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3778 +#: ../../library/os.rst:3779 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4256,39 +4262,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3783 +#: ../../library/os.rst:3784 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3786 +#: ../../library/os.rst:3787 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3789 +#: ../../library/os.rst:3790 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3793 +#: ../../library/os.rst:3794 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3796 +#: ../../library/os.rst:3797 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3802 +#: ../../library/os.rst:3803 msgid "" "import os\n" "\n" @@ -4306,64 +4312,64 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3823 +#: ../../library/os.rst:3824 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3832 +#: ../../library/os.rst:3833 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3841 +#: ../../library/os.rst:3842 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3849 +#: ../../library/os.rst:3850 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3858 +#: ../../library/os.rst:3859 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3869 +#: ../../library/os.rst:3870 msgid "Timer File Descriptors" msgstr "" -#: ../../library/os.rst:3873 +#: ../../library/os.rst:3874 msgid "" "These functions provide support for Linux's *timer file descriptor* API. " "Naturally, they are all only available on Linux." msgstr "" -#: ../../library/os.rst:3878 +#: ../../library/os.rst:3879 msgid "Create and return a timer file descriptor (*timerfd*)." msgstr "" -#: ../../library/os.rst:3880 +#: ../../library/os.rst:3881 msgid "The file descriptor returned by :func:`timerfd_create` supports:" msgstr "" -#: ../../library/os.rst:3882 +#: ../../library/os.rst:3883 msgid ":func:`read`" msgstr ":func:`read`" -#: ../../library/os.rst:3883 +#: ../../library/os.rst:3884 msgid ":func:`~select.select`" msgstr ":func:`~select.select`" -#: ../../library/os.rst:3884 +#: ../../library/os.rst:3885 msgid ":func:`~select.poll`" msgstr ":func:`~select.poll`" -#: ../../library/os.rst:3886 +#: ../../library/os.rst:3887 msgid "" "The file descriptor's :func:`read` method can be called with a buffer size " "of 8. If the timer has already expired one or more times, :func:`read` " @@ -4372,31 +4378,31 @@ msgid "" "byteorder)``." msgstr "" -#: ../../library/os.rst:3891 +#: ../../library/os.rst:3892 msgid "" ":func:`~select.select` and :func:`~select.poll` can be used to wait until " "timer expires and the file descriptor is readable." msgstr "" -#: ../../library/os.rst:3894 +#: ../../library/os.rst:3895 msgid "" "*clockid* must be a valid :ref:`clock ID `, as " "defined in the :py:mod:`time` module:" msgstr "" -#: ../../library/os.rst:3897 +#: ../../library/os.rst:3898 msgid ":const:`time.CLOCK_REALTIME`" msgstr ":const:`time.CLOCK_REALTIME`" -#: ../../library/os.rst:3898 +#: ../../library/os.rst:3899 msgid ":const:`time.CLOCK_MONOTONIC`" msgstr ":const:`time.CLOCK_MONOTONIC`" -#: ../../library/os.rst:3899 +#: ../../library/os.rst:3900 msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" msgstr "" -#: ../../library/os.rst:3901 +#: ../../library/os.rst:3902 msgid "" "If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" "time clock is used. If system clock is changed, timer setting need to be " @@ -4404,35 +4410,35 @@ msgid "" "`TFD_TIMER_CANCEL_ON_SET`." msgstr "" -#: ../../library/os.rst:3906 +#: ../../library/os.rst:3907 msgid "" "If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " "increasing clock is used. Even if the system clock is changed, the timer " "setting will not be affected." msgstr "" -#: ../../library/os.rst:3910 +#: ../../library/os.rst:3911 msgid "" "If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." "CLOCK_MONOTONIC` except it includes any time that the system is suspended." msgstr "" -#: ../../library/os.rst:3913 +#: ../../library/os.rst:3914 msgid "" "The file descriptor's behaviour can be modified by specifying a *flags* " "value. Any of the following variables may used, combined using bitwise OR " "(the ``|`` operator):" msgstr "" -#: ../../library/os.rst:3917 +#: ../../library/os.rst:3918 msgid ":const:`TFD_NONBLOCK`" msgstr ":const:`TFD_NONBLOCK`" -#: ../../library/os.rst:3918 +#: ../../library/os.rst:3919 msgid ":const:`TFD_CLOEXEC`" msgstr ":const:`TFD_CLOEXEC`" -#: ../../library/os.rst:3920 +#: ../../library/os.rst:3921 msgid "" "If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " "timer expires. If it is set as a flag, :func:`read` doesn't block, but If " @@ -4440,46 +4446,46 @@ msgid "" "raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." msgstr "" -#: ../../library/os.rst:3926 +#: ../../library/os.rst:3927 msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." msgstr "" -#: ../../library/os.rst:3928 +#: ../../library/os.rst:3929 msgid "" "The file descriptor must be closed with :func:`os.close` when it is no " "longer needed, or else the file descriptor will be leaked." msgstr "" -#: ../../library/os.rst:3931 +#: ../../library/os.rst:3932 msgid "The :manpage:`timerfd_create(2)` man page." msgstr ":manpage:`timerfd_create(2)` 手冊頁。" -#: ../../library/os.rst:3940 +#: ../../library/os.rst:3941 msgid "" "Alter a timer file descriptor's internal timer. This function operates the " "same interval timer as :func:`timerfd_settime_ns`." msgstr "" -#: ../../library/os.rst:3943 +#: ../../library/os.rst:3944 msgid "*fd* must be a valid timer file descriptor." msgstr "" -#: ../../library/os.rst:3945 +#: ../../library/os.rst:3946 msgid "" "The timer's behaviour can be modified by specifying a *flags* value. Any of " "the following variables may used, combined using bitwise OR (the ``|`` " "operator):" msgstr "" -#: ../../library/os.rst:3949 +#: ../../library/os.rst:3950 msgid ":const:`TFD_TIMER_ABSTIME`" msgstr ":const:`TFD_TIMER_ABSTIME`" -#: ../../library/os.rst:3950 +#: ../../library/os.rst:3951 msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" -#: ../../library/os.rst:3952 +#: ../../library/os.rst:3953 msgid "" "The timer is disabled by setting *initial* to zero (``0``). If *initial* is " "equal to or greater than zero, the timer is enabled. If *initial* is less " @@ -4487,20 +4493,20 @@ msgid "" "const:`errno.EINVAL`" msgstr "" -#: ../../library/os.rst:3957 +#: ../../library/os.rst:3958 msgid "" "By default the timer will fire when *initial* seconds have elapsed. (If " "*initial* is zero, timer will fire immediately.)" msgstr "" -#: ../../library/os.rst:3960 +#: ../../library/os.rst:3961 msgid "" "However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " "when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " "*initial* seconds." msgstr "" -#: ../../library/os.rst:3964 +#: ../../library/os.rst:3965 msgid "" "The timer's interval is set by the *interval* :py:class:`float`. If " "*interval* is zero, the timer only fires once, on the initial expiration. If " @@ -4510,7 +4516,7 @@ msgid "" "EINVAL`" msgstr "" -#: ../../library/os.rst:3971 +#: ../../library/os.rst:3972 msgid "" "If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" "`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." @@ -4519,86 +4525,86 @@ msgid "" "ECANCELED." msgstr "" -#: ../../library/os.rst:3977 +#: ../../library/os.rst:3978 msgid "" "Linux manages system clock as UTC. A daylight-savings time transition is " "done by changing time offset only and doesn't cause discontinuous system " "clock change." msgstr "" -#: ../../library/os.rst:3981 +#: ../../library/os.rst:3982 msgid "" "Discontinuous system clock change will be caused by the following events:" msgstr "" -#: ../../library/os.rst:3983 +#: ../../library/os.rst:3984 msgid "``settimeofday``" msgstr "``settimeofday``" -#: ../../library/os.rst:3984 +#: ../../library/os.rst:3985 msgid "``clock_settime``" msgstr "``clock_settime``" -#: ../../library/os.rst:3985 +#: ../../library/os.rst:3986 msgid "set the system date and time by ``date`` command" msgstr "" -#: ../../library/os.rst:3987 +#: ../../library/os.rst:3988 msgid "" "Return a two-item tuple of (``next_expiration``, ``interval``) from the " "previous timer state, before this function executed." msgstr "" -#: ../../library/os.rst:3992 +#: ../../library/os.rst:3993 msgid "" ":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" "`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." msgstr "" -#: ../../library/os.rst:4003 +#: ../../library/os.rst:4004 msgid "" "Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " "function operates the same interval timer as :func:`timerfd_settime`." msgstr "" -#: ../../library/os.rst:4013 +#: ../../library/os.rst:4014 msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." msgstr "" -#: ../../library/os.rst:4015 +#: ../../library/os.rst:4016 msgid "" "``next_expiration`` denotes the relative time until next the timer next " "fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." msgstr "" -#: ../../library/os.rst:4018 +#: ../../library/os.rst:4019 msgid "" "``interval`` denotes the timer's interval. If zero, the timer will only fire " "once, after ``next_expiration`` seconds have elapsed." msgstr "" -#: ../../library/os.rst:4022 +#: ../../library/os.rst:4023 msgid ":manpage:`timerfd_gettime(2)`" msgstr ":manpage:`timerfd_gettime(2)`" -#: ../../library/os.rst:4031 +#: ../../library/os.rst:4032 msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." msgstr "" -#: ../../library/os.rst:4039 +#: ../../library/os.rst:4040 msgid "" "A flag for the :func:`timerfd_create` function, which sets the :const:" "`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" "`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." msgstr "" -#: ../../library/os.rst:4049 +#: ../../library/os.rst:4050 msgid "" "A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " "set as a flag, set close-on-exec flag for new file descriptor." msgstr "" -#: ../../library/os.rst:4059 +#: ../../library/os.rst:4060 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions. If this flag is set, *initial* is interpreted as an absolute " @@ -4606,22 +4612,22 @@ msgid "" "Epoch)." msgstr "" -#: ../../library/os.rst:4069 +#: ../../library/os.rst:4070 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " "the time of the underlying clock changes discontinuously." msgstr "" -#: ../../library/os.rst:4080 +#: ../../library/os.rst:4081 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:4084 +#: ../../library/os.rst:4085 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:4088 +#: ../../library/os.rst:4089 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4629,7 +4635,7 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:4096 +#: ../../library/os.rst:4097 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4637,12 +4643,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:4098 ../../library/os.rst:4130 -#: ../../library/os.rst:4155 +#: ../../library/os.rst:4099 ../../library/os.rst:4131 +#: ../../library/os.rst:4156 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:4104 +#: ../../library/os.rst:4105 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4650,14 +4656,14 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:4112 +#: ../../library/os.rst:4113 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:4120 +#: ../../library/os.rst:4121 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4665,7 +4671,7 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:4128 +#: ../../library/os.rst:4129 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4673,7 +4679,7 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:4136 +#: ../../library/os.rst:4137 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4685,13 +4691,13 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:4150 +#: ../../library/os.rst:4151 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:4153 +#: ../../library/os.rst:4154 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4699,33 +4705,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:4161 +#: ../../library/os.rst:4162 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:4167 +#: ../../library/os.rst:4168 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:4173 +#: ../../library/os.rst:4174 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:4180 +#: ../../library/os.rst:4181 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:4182 +#: ../../library/os.rst:4183 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:4184 +#: ../../library/os.rst:4185 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4736,7 +4742,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:4195 +#: ../../library/os.rst:4196 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4745,31 +4751,31 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:4204 +#: ../../library/os.rst:4205 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:4206 +#: ../../library/os.rst:4207 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:4210 +#: ../../library/os.rst:4211 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:4213 +#: ../../library/os.rst:4214 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:4217 +#: ../../library/os.rst:4218 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." @@ -4777,7 +4783,7 @@ msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." "add_dll_directory``。" -#: ../../library/os.rst:4221 +#: ../../library/os.rst:4222 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4785,14 +4791,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:4228 +#: ../../library/os.rst:4229 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:4243 +#: ../../library/os.rst:4244 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4800,7 +4806,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:4248 +#: ../../library/os.rst:4249 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4808,7 +4814,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:4254 +#: ../../library/os.rst:4255 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4821,7 +4827,7 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:4263 +#: ../../library/os.rst:4264 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4835,7 +4841,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: ../../library/os.rst:4274 +#: ../../library/os.rst:4275 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4845,7 +4851,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:4281 +#: ../../library/os.rst:4282 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4854,7 +4860,7 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:4286 +#: ../../library/os.rst:4287 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4862,25 +4868,25 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4290 +#: ../../library/os.rst:4291 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:4299 +#: ../../library/os.rst:4300 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4304 +#: ../../library/os.rst:4305 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4307 +#: ../../library/os.rst:4308 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4888,139 +4894,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4313 +#: ../../library/os.rst:4314 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4320 +#: ../../library/os.rst:4321 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4328 +#: ../../library/os.rst:4329 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4336 +#: ../../library/os.rst:4337 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4343 +#: ../../library/os.rst:4344 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4350 +#: ../../library/os.rst:4351 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4357 +#: ../../library/os.rst:4358 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4364 +#: ../../library/os.rst:4365 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4371 +#: ../../library/os.rst:4372 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4378 +#: ../../library/os.rst:4379 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4386 +#: ../../library/os.rst:4387 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4394 +#: ../../library/os.rst:4395 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4401 +#: ../../library/os.rst:4402 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4408 +#: ../../library/os.rst:4409 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4417 +#: ../../library/os.rst:4418 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4425 +#: ../../library/os.rst:4426 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4433 +#: ../../library/os.rst:4434 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4440 +#: ../../library/os.rst:4441 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4447 +#: ../../library/os.rst:4448 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4450 +#: ../../library/os.rst:4451 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4453 +#: ../../library/os.rst:4454 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4457 +#: ../../library/os.rst:4458 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4462 ../../library/os.rst:4506 +#: ../../library/os.rst:4463 ../../library/os.rst:4507 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4465 +#: ../../library/os.rst:4466 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4469 +#: ../../library/os.rst:4470 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4473 +#: ../../library/os.rst:4474 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -5031,21 +5037,21 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4482 +#: ../../library/os.rst:4483 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4486 +#: ../../library/os.rst:4487 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4496 +#: ../../library/os.rst:4497 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -5054,31 +5060,31 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4502 +#: ../../library/os.rst:4503 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4509 +#: ../../library/os.rst:4510 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4513 +#: ../../library/os.rst:4514 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: ../../library/os.rst:4527 +#: ../../library/os.rst:4528 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4530 +#: ../../library/os.rst:4531 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " @@ -5088,11 +5094,11 @@ msgid "" "be set to *sig*." msgstr "" -#: ../../library/os.rst:4537 +#: ../../library/os.rst:4538 msgid "See also :func:`signal.pthread_kill`." msgstr "另請參閱 :func:`signal.pthread_kill`。" -#: ../../library/os.rst:4539 +#: ../../library/os.rst:4540 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." @@ -5100,11 +5106,11 @@ msgstr "" "引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "kill``。" -#: ../../library/os.rst:4553 +#: ../../library/os.rst:4554 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: ../../library/os.rst:4555 +#: ../../library/os.rst:4556 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." @@ -5112,23 +5118,23 @@ msgstr "" "引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "killpg``。" -#: ../../library/os.rst:4562 +#: ../../library/os.rst:4563 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: ../../library/os.rst:4569 +#: ../../library/os.rst:4570 msgid "" "Return a file descriptor referring to the process *pid* with *flags* set. " "This descriptor can be used to perform process management without races and " "signals." msgstr "" -#: ../../library/os.rst:4573 +#: ../../library/os.rst:4574 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:4580 +#: ../../library/os.rst:4581 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " "process referred to by the file descriptor has not yet terminated, then an " @@ -5136,13 +5142,13 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: ../../library/os.rst:4591 +#: ../../library/os.rst:4592 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: ../../library/os.rst:4599 +#: ../../library/os.rst:4600 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " @@ -5152,7 +5158,7 @@ msgid "" "rather than bytes." msgstr "" -#: ../../library/os.rst:4607 +#: ../../library/os.rst:4608 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -5164,57 +5170,57 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: ../../library/os.rst:4617 +#: ../../library/os.rst:4618 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: ../../library/os.rst:4622 +#: ../../library/os.rst:4623 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: ../../library/os.rst:4629 +#: ../../library/os.rst:4630 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " "and pipe contents." msgstr "" -#: ../../library/os.rst:4632 +#: ../../library/os.rst:4633 msgid "" ":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" "class:`subprocess.Popen` or :func:`subprocess.run` to control options like " "encodings." msgstr "" -#: ../../library/os.rst:4641 +#: ../../library/os.rst:4642 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4643 +#: ../../library/os.rst:4644 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4645 +#: ../../library/os.rst:4646 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" "`execve`. *env* is allowed to be ``None``, in which case current process' " "environment is used." msgstr "" -#: ../../library/os.rst:4649 +#: ../../library/os.rst:4650 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:4653 +#: ../../library/os.rst:4654 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -5223,39 +5229,39 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4661 +#: ../../library/os.rst:4662 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4663 +#: ../../library/os.rst:4664 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4667 +#: ../../library/os.rst:4668 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4669 +#: ../../library/os.rst:4670 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4673 +#: ../../library/os.rst:4674 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4675 +#: ../../library/os.rst:4676 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4679 +#: ../../library/os.rst:4680 msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" -#: ../../library/os.rst:4681 +#: ../../library/os.rst:4682 msgid "Performs ``os.closerange(fd, INF)``." msgstr "" -#: ../../library/os.rst:4683 +#: ../../library/os.rst:4684 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" @@ -5265,7 +5271,7 @@ msgid "" "c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4690 +#: ../../library/os.rst:4691 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -5274,7 +5280,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4696 +#: ../../library/os.rst:4697 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -5285,7 +5291,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4704 +#: ../../library/os.rst:4705 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" @@ -5293,7 +5299,7 @@ msgid "" "is raised." msgstr "" -#: ../../library/os.rst:4709 +#: ../../library/os.rst:4710 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -5301,14 +5307,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4714 +#: ../../library/os.rst:4715 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4718 +#: ../../library/os.rst:4719 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5318,7 +5324,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4725 ../../library/os.rst:4746 +#: ../../library/os.rst:4726 ../../library/os.rst:4747 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5326,79 +5332,79 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4729 +#: ../../library/os.rst:4730 msgid "" "*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " "on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " "exists." msgstr "" -#: ../../library/os.rst:4740 +#: ../../library/os.rst:4741 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4742 +#: ../../library/os.rst:4743 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4752 +#: ../../library/os.rst:4753 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4758 +#: ../../library/os.rst:4759 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4763 +#: ../../library/os.rst:4764 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4764 +#: ../../library/os.rst:4765 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4766 +#: ../../library/os.rst:4767 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4768 +#: ../../library/os.rst:4769 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4772 +#: ../../library/os.rst:4773 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4777 +#: ../../library/os.rst:4778 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4781 +#: ../../library/os.rst:4782 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4797 +#: ../../library/os.rst:4798 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4799 +#: ../../library/os.rst:4800 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -5406,7 +5412,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4804 +#: ../../library/os.rst:4805 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -5415,13 +5421,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4810 +#: ../../library/os.rst:4811 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4813 +#: ../../library/os.rst:4814 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5433,7 +5439,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4822 +#: ../../library/os.rst:4823 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -5446,7 +5452,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4832 +#: ../../library/os.rst:4833 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -5458,13 +5464,13 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4841 +#: ../../library/os.rst:4842 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4844 +#: ../../library/os.rst:4845 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5478,7 +5484,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4850 +#: ../../library/os.rst:4851 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5486,7 +5492,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4854 +#: ../../library/os.rst:4855 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5494,7 +5500,7 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4866 +#: ../../library/os.rst:4867 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -5502,7 +5508,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4876 +#: ../../library/os.rst:4877 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5511,7 +5517,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4888 +#: ../../library/os.rst:4889 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -5521,11 +5527,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4899 +#: ../../library/os.rst:4900 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4901 +#: ../../library/os.rst:4902 msgid "" "When *operation* is not specified, this acts like double-clicking the file " "in Windows Explorer, or giving the file name as an argument to the :program:" @@ -5533,7 +5539,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4906 +#: ../../library/os.rst:4907 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -5541,28 +5547,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4911 +#: ../../library/os.rst:4912 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:4915 +#: ../../library/os.rst:4916 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:4919 +#: ../../library/os.rst:4920 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: ../../library/os.rst:4923 +#: ../../library/os.rst:4924 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -5573,14 +5579,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:4931 +#: ../../library/os.rst:4932 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:4935 +#: ../../library/os.rst:4936 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5588,7 +5594,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:4937 +#: ../../library/os.rst:4938 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5596,13 +5602,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:4941 +#: ../../library/os.rst:4942 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:4948 +#: ../../library/os.rst:4949 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -5613,13 +5619,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:4956 +#: ../../library/os.rst:4957 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:4959 +#: ../../library/os.rst:4960 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -5628,7 +5634,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:4965 +#: ../../library/os.rst:4966 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is preferable " @@ -5636,54 +5642,54 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:4970 +#: ../../library/os.rst:4971 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:4974 +#: ../../library/os.rst:4975 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:4981 +#: ../../library/os.rst:4982 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:4984 +#: ../../library/os.rst:4985 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:4986 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:4986 +#: ../../library/os.rst:4987 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:4987 +#: ../../library/os.rst:4988 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:4988 +#: ../../library/os.rst:4989 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:4990 +#: ../../library/os.rst:4991 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:4994 +#: ../../library/os.rst:4995 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5693,7 +5699,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:5008 +#: ../../library/os.rst:5009 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5702,87 +5708,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:5014 +#: ../../library/os.rst:5015 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:5017 ../../library/os.rst:5092 +#: ../../library/os.rst:5018 ../../library/os.rst:5093 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:5024 +#: ../../library/os.rst:5025 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " "the completion of a specific child process and have more options. :func:" "`waitpid` is the only one also available on Windows." msgstr "" -#: ../../library/os.rst:5031 +#: ../../library/os.rst:5032 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:5033 +#: ../../library/os.rst:5034 msgid "" "*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" "data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: ../../library/os.rst:5036 +#: ../../library/os.rst:5037 msgid "" "*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" "data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" "`WNOWAIT` are additional optional flags." msgstr "" -#: ../../library/os.rst:5040 +#: ../../library/os.rst:5041 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure with the following attributes:" msgstr "" -#: ../../library/os.rst:5043 +#: ../../library/os.rst:5044 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:5044 +#: ../../library/os.rst:5045 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:5045 +#: ../../library/os.rst:5046 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:5046 +#: ../../library/os.rst:5047 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:5047 +#: ../../library/os.rst:5048 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:5049 +#: ../../library/os.rst:5050 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: ../../library/os.rst:5058 +#: ../../library/os.rst:5059 msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:5064 +#: ../../library/os.rst:5065 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:5066 +#: ../../library/os.rst:5067 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5791,7 +5797,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:5071 +#: ../../library/os.rst:5072 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5801,7 +5807,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:5078 +#: ../../library/os.rst:5079 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5810,7 +5816,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:5084 +#: ../../library/os.rst:5085 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -5822,7 +5828,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:5105 +#: ../../library/os.rst:5106 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5831,13 +5837,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:5112 ../../library/os.rst:5126 +#: ../../library/os.rst:5113 ../../library/os.rst:5127 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:5120 +#: ../../library/os.rst:5121 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5846,118 +5852,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:5137 +#: ../../library/os.rst:5138 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:5140 +#: ../../library/os.rst:5141 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:5141 +#: ../../library/os.rst:5142 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:5142 +#: ../../library/os.rst:5143 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:5143 +#: ../../library/os.rst:5144 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: ../../library/os.rst:5148 +#: ../../library/os.rst:5149 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:5151 +#: ../../library/os.rst:5152 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:5157 +#: ../../library/os.rst:5158 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" "func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: ../../library/os.rst:5166 +#: ../../library/os.rst:5167 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:5169 +#: ../../library/os.rst:5170 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:5179 +#: ../../library/os.rst:5180 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: ../../library/os.rst:5182 ../../library/os.rst:5214 +#: ../../library/os.rst:5183 ../../library/os.rst:5215 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:5191 +#: ../../library/os.rst:5192 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:5195 +#: ../../library/os.rst:5196 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:5202 +#: ../../library/os.rst:5203 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: ../../library/os.rst:5211 +#: ../../library/os.rst:5212 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: ../../library/os.rst:5226 +#: ../../library/os.rst:5227 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:5233 +#: ../../library/os.rst:5234 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "" -#: ../../library/os.rst:5239 +#: ../../library/os.rst:5240 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:5241 +#: ../../library/os.rst:5242 msgid "On Unix:" msgstr "" -#: ../../library/os.rst:5243 +#: ../../library/os.rst:5244 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:5246 +#: ../../library/os.rst:5247 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -5965,15 +5971,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:5250 +#: ../../library/os.rst:5251 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "" -#: ../../library/os.rst:5252 +#: ../../library/os.rst:5253 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:5254 +#: ../../library/os.rst:5255 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -5981,225 +5987,226 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:5261 +#: ../../library/os.rst:5262 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:5269 +#: ../../library/os.rst:5270 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:5275 +#: ../../library/os.rst:5276 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:5278 ../../library/os.rst:5344 +#: ../../library/os.rst:5279 ../../library/os.rst:5345 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:5285 +#: ../../library/os.rst:5286 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :const:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5289 +#: ../../library/os.rst:5290 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:5296 +#: ../../library/os.rst:5297 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5299 +#: ../../library/os.rst:5300 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:5307 +#: ../../library/os.rst:5308 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5315 +#: ../../library/os.rst:5316 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5324 +#: ../../library/os.rst:5325 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5326 +#: ../../library/os.rst:5327 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5333 +#: ../../library/os.rst:5334 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5335 +#: ../../library/os.rst:5336 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5342 +#: ../../library/os.rst:5343 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5350 +#: ../../library/os.rst:5351 msgid "Interface to the scheduler" msgstr "" -#: ../../library/os.rst:5352 +#: ../../library/os.rst:5353 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:5358 +#: ../../library/os.rst:5359 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5363 +#: ../../library/os.rst:5366 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5367 +#: ../../library/os.rst:5370 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5372 +#: ../../library/os.rst:5375 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5376 +#: ../../library/os.rst:5379 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5380 +#: ../../library/os.rst:5383 msgid "A First In First Out scheduling policy." msgstr "" -#: ../../library/os.rst:5384 +#: ../../library/os.rst:5387 msgid "A round-robin scheduling policy." msgstr "" -#: ../../library/os.rst:5388 +#: ../../library/os.rst:5391 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:5395 +#: ../../library/os.rst:5398 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: ../../library/os.rst:5399 +#: ../../library/os.rst:5402 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5403 +#: ../../library/os.rst:5406 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5408 +#: ../../library/os.rst:5411 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5414 +#: ../../library/os.rst:5417 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5420 +#: ../../library/os.rst:5423 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5427 +#: ../../library/os.rst:5430 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:5434 +#: ../../library/os.rst:5437 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5440 +#: ../../library/os.rst:5443 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5446 +#: ../../library/os.rst:5449 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5452 -msgid "Voluntarily relinquish the CPU." +#: ../../library/os.rst:5455 +msgid "" +"Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: ../../library/os.rst:5457 +#: ../../library/os.rst:5460 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:5464 +#: ../../library/os.rst:5467 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5466 +#: ../../library/os.rst:5469 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5469 +#: ../../library/os.rst:5472 msgid "See also the :func:`process_cpu_count` function." msgstr "也請見 :func:`process_cpu_count` 函式。" -#: ../../library/os.rst:5475 +#: ../../library/os.rst:5478 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5480 +#: ../../library/os.rst:5483 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -6210,13 +6217,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5488 +#: ../../library/os.rst:5491 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5491 +#: ../../library/os.rst:5494 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -6224,62 +6231,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5501 +#: ../../library/os.rst:5504 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5510 +#: ../../library/os.rst:5513 msgid "" "Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5513 +#: ../../library/os.rst:5516 msgid "" "The :func:`process_cpu_count` function can be used to get the number of " "logical CPUs usable by the calling thread of the **current process**." msgstr "" -#: ../../library/os.rst:5518 +#: ../../library/os.rst:5521 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5525 +#: ../../library/os.rst:5528 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:5534 +#: ../../library/os.rst:5537 msgid "" "Get the number of logical CPUs usable by the calling thread of the **current " "process**. Returns ``None`` if undetermined. It can be less than :func:" "`cpu_count` depending on the CPU affinity." msgstr "" -#: ../../library/os.rst:5538 +#: ../../library/os.rst:5541 msgid "" "The :func:`cpu_count` function can be used to get the number of logical CPUs " "in the **system**." msgstr "" -#: ../../library/os.rst:5541 +#: ../../library/os.rst:5544 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`process_cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5544 +#: ../../library/os.rst:5547 msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" -#: ../../library/os.rst:5551 +#: ../../library/os.rst:5554 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -6288,44 +6295,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5561 +#: ../../library/os.rst:5564 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5567 +#: ../../library/os.rst:5570 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: ../../library/os.rst:5570 +#: ../../library/os.rst:5573 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5573 +#: ../../library/os.rst:5576 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5579 +#: ../../library/os.rst:5582 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5587 +#: ../../library/os.rst:5590 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5596 +#: ../../library/os.rst:5599 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6334,7 +6341,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5606 +#: ../../library/os.rst:5609 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6342,27 +6349,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5615 +#: ../../library/os.rst:5618 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5623 +#: ../../library/os.rst:5626 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5630 +#: ../../library/os.rst:5633 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:" "`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5637 +#: ../../library/os.rst:5640 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -6371,36 +6378,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5646 +#: ../../library/os.rst:5649 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5657 +#: ../../library/os.rst:5660 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: ../../library/os.rst:5665 +#: ../../library/os.rst:5668 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5670 +#: ../../library/os.rst:5673 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5673 +#: ../../library/os.rst:5676 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5676 +#: ../../library/os.rst:5679 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6408,32 +6415,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5681 +#: ../../library/os.rst:5684 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:5685 +#: ../../library/os.rst:5688 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5694 +#: ../../library/os.rst:5697 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5696 +#: ../../library/os.rst:5699 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:5700 +#: ../../library/os.rst:5703 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6443,206 +6450,206 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5707 +#: ../../library/os.rst:5710 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:5711 +#: ../../library/os.rst:5714 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5714 +#: ../../library/os.rst:5717 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:5718 +#: ../../library/os.rst:5721 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:5724 +#: ../../library/os.rst:5727 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:5728 +#: ../../library/os.rst:5731 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5732 +#: ../../library/os.rst:5735 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5738 +#: ../../library/os.rst:5741 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:5742 +#: ../../library/os.rst:5745 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:5749 +#: ../../library/os.rst:5752 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." msgstr "" -#: ../../library/os.rst:363 ../../library/os.rst:529 ../../library/os.rst:731 +#: ../../library/os.rst:364 ../../library/os.rst:530 ../../library/os.rst:732 msgid "user" msgstr "user(使用者)" -#: ../../library/os.rst:363 +#: ../../library/os.rst:364 msgid "effective id" msgstr "" -#: ../../library/os.rst:372 ../../library/os.rst:438 ../../library/os.rst:447 -#: ../../library/os.rst:456 ../../library/os.rst:470 ../../library/os.rst:666 -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:373 ../../library/os.rst:439 ../../library/os.rst:448 +#: ../../library/os.rst:457 ../../library/os.rst:471 ../../library/os.rst:667 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "process" msgstr "process" -#: ../../library/os.rst:372 ../../library/os.rst:438 +#: ../../library/os.rst:373 ../../library/os.rst:439 msgid "group" msgstr "group(群組)" -#: ../../library/os.rst:447 ../../library/os.rst:529 +#: ../../library/os.rst:448 ../../library/os.rst:530 msgid "id" msgstr "id" -#: ../../library/os.rst:456 +#: ../../library/os.rst:457 msgid "id of parent" msgstr "" -#: ../../library/os.rst:470 ../../library/os.rst:666 +#: ../../library/os.rst:471 ../../library/os.rst:667 msgid "scheduling priority" msgstr "scheduling priority(排程優先權)" -#: ../../library/os.rst:552 ../../library/os.rst:801 +#: ../../library/os.rst:553 ../../library/os.rst:802 msgid "environment variables" msgstr "environment variables(環境變數)" -#: ../../library/os.rst:552 +#: ../../library/os.rst:553 msgid "setting" msgstr "setting(設定)" -#: ../../library/os.rst:731 +#: ../../library/os.rst:732 msgid "id, setting" msgstr "id, setting(設定)" -#: ../../library/os.rst:764 +#: ../../library/os.rst:765 msgid "gethostname() (in module socket)" msgstr "gethostname()(於 socket 模組)" -#: ../../library/os.rst:764 +#: ../../library/os.rst:765 msgid "gethostbyaddr() (in module socket)" msgstr "gethostbyaddr()(於 socket 模組)" -#: ../../library/os.rst:801 ../../library/os.rst:2658 +#: ../../library/os.rst:802 ../../library/os.rst:2659 msgid "deleting" msgstr "deleting(刪除)" -#: ../../library/os.rst:1360 ../../library/os.rst:3028 +#: ../../library/os.rst:1361 ../../library/os.rst:3029 msgid "module" msgstr "module(模組)" -#: ../../library/os.rst:1360 +#: ../../library/os.rst:1361 msgid "pty" msgstr "pty" -#: ../../library/os.rst:2045 ../../library/os.rst:2457 -#: ../../library/os.rst:2658 ../../library/os.rst:3562 -#: ../../library/os.rst:3662 +#: ../../library/os.rst:2046 ../../library/os.rst:2458 +#: ../../library/os.rst:2659 ../../library/os.rst:3563 +#: ../../library/os.rst:3663 msgid "directory" msgstr "directory(目錄)" -#: ../../library/os.rst:2045 +#: ../../library/os.rst:2046 msgid "changing" msgstr "changing(改變)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "creating" msgstr "creating(建立)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "UNC paths" msgstr "UNC paths(UNC 路徑)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "and os.makedirs()" msgstr "以及 os.makedirs()" -#: ../../library/os.rst:3028 +#: ../../library/os.rst:3029 msgid "stat" msgstr "stat" -#: ../../library/os.rst:3562 ../../library/os.rst:3662 +#: ../../library/os.rst:3563 ../../library/os.rst:3663 msgid "walking" msgstr "" -#: ../../library/os.rst:3562 ../../library/os.rst:3662 +#: ../../library/os.rst:3563 ../../library/os.rst:3663 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "killing" msgstr "" -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5576 ../../library/os.rst:5612 +#: ../../library/os.rst:5579 ../../library/os.rst:5615 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5576 ../../library/os.rst:5584 -#: ../../library/os.rst:5592 ../../library/os.rst:5603 -#: ../../library/os.rst:5612 +#: ../../library/os.rst:5579 ../../library/os.rst:5587 +#: ../../library/os.rst:5595 ../../library/os.rst:5606 +#: ../../library/os.rst:5615 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5584 +#: ../../library/os.rst:5587 msgid ".." msgstr ".." -#: ../../library/os.rst:5592 ../../library/os.rst:5603 +#: ../../library/os.rst:5595 ../../library/os.rst:5606 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5593 +#: ../../library/os.rst:5596 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5593 +#: ../../library/os.rst:5596 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5619 +#: ../../library/os.rst:5622 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5619 +#: ../../library/os.rst:5622 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5619 +#: ../../library/os.rst:5622 msgid "; (semicolon)" msgstr "; (分號)" diff --git a/library/pathlib.po b/library/pathlib.po index 4db35f669b..86e5df8c15 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2024-02-29 20:49+0800\n" +"PO-Revision-Date: 2024-12-23 19:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -48,6 +48,12 @@ msgid "" "PosixPath subclasses PurePosixPath and Path, and WindowsPath\n" "subclasses PureWindowsPath and Path." msgstr "" +"顯示 pathlib 中可用類別的繼承圖。\n" +"最基礎的類別是 PurePath,它有三個直接子類別:\n" +"PurePosixPath、PureWindowsPath 和 Path。除了這四個類別之外,\n" +"還有兩個類別使用多重繼承:\n" +"PosixPath 繼承自 PurePosixPath 和 Path,而 WindowsPath 繼承自 " +"PureWindowsPath 和 Path。" #: ../../library/pathlib.rst:31 msgid "" @@ -70,8 +76,8 @@ msgid "" "You cannot instantiate a :class:`WindowsPath` when running on Unix, but you " "can instantiate :class:`PureWindowsPath`." msgstr "" -"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例化 :" -"class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" +"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例" +"化 :class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" #: ../../library/pathlib.rst:40 msgid "" @@ -88,8 +94,8 @@ msgstr ":pep:`428`:pathlib 模組 -- 物件導向檔案系統路徑。" #: ../../library/pathlib.rst:48 msgid "" -"For low-level path manipulation on strings, you can also use the :mod:`os." -"path` module." +"For low-level path manipulation on strings, you can also use " +"the :mod:`os.path` module." msgstr "針對字串上的底層路徑操作,你也可以使用 :mod:`os.path` 模組。" #: ../../library/pathlib.rst:53 @@ -122,7 +128,7 @@ msgstr "" #: ../../library/pathlib.rst:66 msgid "Listing Python source files in this directory tree::" -msgstr "在當前目錄樹下列出 Python 原始碼檔案: ::" +msgstr "在目前目錄樹下列出 Python 原始碼檔案: ::" #: ../../library/pathlib.rst:68 msgid "" @@ -195,6 +201,8 @@ msgid "" "An exception inheriting :exc:`NotImplementedError` that is raised when an " "unsupported operation is called on a path object." msgstr "" +"繼承自 :exc:`NotImplementedError` 的例外,當在路徑物件上呼叫不支援的操作時會" +"被引發。" #: ../../library/pathlib.rst:110 msgid "Pure paths" @@ -214,14 +222,16 @@ msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" msgstr "" -"一個通用的類別,表示系統的路徑類型(實例化時會建立一個 :class:" -"`PurePosixPath` 或 :class:`PureWindowsPath`): ::" +"一個通用的類別,表示系統的路徑類型(實例化時會建立一" +"個 :class:`PurePosixPath` 或 :class:`PureWindowsPath`): ::" #: ../../library/pathlib.rst:121 msgid "" ">>> PurePath('setup.py') # Running on a Unix machine\n" "PurePosixPath('setup.py')" msgstr "" +">>> PurePath('setup.py') # 執行在 Unix 機器上\n" +"PurePosixPath('setup.py')" #: ../../library/pathlib.rst:124 msgid "" @@ -231,8 +241,8 @@ msgid "" "path object::" msgstr "" "*pathsegments* 中的每個元素可以是以下的其中一種:一個表示路徑片段的字串,或一" -"個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." -"__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" +"個物件,它實作了 :class:`os.PathLike` 介面且其中" +"的 :meth:`~os.PathLike.__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" #: ../../library/pathlib.rst:129 msgid "" @@ -260,11 +270,11 @@ msgstr "" #: ../../library/pathlib.rst:139 msgid "" -"If a segment is an absolute path, all previous segments are ignored (like :" -"func:`os.path.join`)::" +"If a segment is an absolute path, all previous segments are ignored " +"(like :func:`os.path.join`)::" msgstr "" -"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." -"join`): ::" +"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類" +"似 :func:`os.path.join`): ::" #: ../../library/pathlib.rst:142 msgid "" @@ -280,8 +290,8 @@ msgstr "" #: ../../library/pathlib.rst:147 msgid "" -"On Windows, the drive is not reset when a rooted relative path segment (e." -"g., ``r'\\foo'``) is encountered::" +"On Windows, the drive is not reset when a rooted relative path segment " +"(e.g., ``r'\\foo'``) is encountered::" msgstr "" "在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁" "碟機 (drive) 部分不會被重置: ::" @@ -494,8 +504,8 @@ msgstr "" #: ../../library/pathlib.rst:251 msgid "" -"A path object can be used anywhere an object implementing :class:`os." -"PathLike` is accepted::" +"A path object can be used anywhere an object " +"implementing :class:`os.PathLike` is accepted::" msgstr "" "路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" @@ -609,6 +619,8 @@ msgid "" "The implementation of the :mod:`os.path` module used for low-level path " "parsing and joining: either :mod:`posixpath` or :mod:`ntpath`." msgstr "" +"用於底層路徑剖析和結合的 :mod:`os.path` 模組的實作:可能是 :mod:`posixpath` " +"或 :mod:`ntpath`。" #: ../../library/pathlib.rst:320 msgid "A string representing the drive letter or name, if any::" @@ -678,8 +690,8 @@ msgstr "" #: ../../library/pathlib.rst:350 msgid "" -"If the path starts with more than two successive slashes, :class:`~pathlib." -"PurePosixPath` collapses them::" +"If the path starts with more than two successive " +"slashes, :class:`~pathlib.PurePosixPath` collapses them::" msgstr "" "如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" "們: ::" @@ -703,12 +715,12 @@ msgstr "" #: ../../library/pathlib.rst:362 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " -"paragraph `4.11 Pathname Resolution `_:" +"paragraph `4.11 Pathname Resolution `_:" msgstr "" "此行為符合 *The Open Group Base Specifications Issue 6*,章節 `4.11 路徑名稱" -"解析 `_:" +"解析 `_:" #: ../../library/pathlib.rst:366 msgid "" @@ -1015,12 +1027,16 @@ msgid "" "Windows path names that contain a colon, or end with a dot or a space, are " "considered reserved. UNC paths may be reserved." msgstr "" +"Windows 路徑名稱中包含冒號或結尾為點或空格會被視為保留。UNC 路徑可能被視為保" +"留。" #: ../../library/pathlib.rst:547 msgid "" "This method is deprecated; use :func:`os.path.isreserved` to detect reserved " "paths on Windows." msgstr "" +"此方法已被棄用;請使用 :func:`os.path.isreserved` 來檢測 Windows 上的保留路" +"徑。" #: ../../library/pathlib.rst:553 msgid "" @@ -1053,7 +1069,7 @@ msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise. For example::" msgstr "" -"將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " +"將路徑與 glob 形式的模式 (glob-style pattern) 做比對。如果比對成功則回傳 " "``True``,否則回傳 ``False``,例如: ::" #: ../../library/pathlib.rst:571 @@ -1078,7 +1094,7 @@ msgstr "" #: ../../library/pathlib.rst:581 ../../library/pathlib.rst:1291 msgid ":ref:`pathlib-pattern-language` documentation." -msgstr "" +msgstr ":ref:`pathlib-pattern-language` 文件。" #: ../../library/pathlib.rst:583 msgid "As with other methods, case-sensitivity follows platform defaults::" @@ -1106,7 +1122,7 @@ msgid "" "Match this path against the provided non-recursive glob-style pattern. " "Return ``True`` if matching is successful, ``False`` otherwise." msgstr "" -"將路徑與非遞迴 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回" +"將路徑與非遞迴 glob 形式的模式 (glob-style pattern) 做比對。如果比對成功則回" "傳 ``True``,否則回傳 ``False``。" #: ../../library/pathlib.rst:600 @@ -1116,6 +1132,9 @@ msgid "" "\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " "relative pattern is provided, then matching is done from the right::" msgstr "" +"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引" +"發 :exc:`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 " +"\"``*``\" 一樣),且如果提供相對模式,則會從右邊進行比對: ::" #: ../../library/pathlib.rst:605 msgid "" @@ -1136,7 +1155,7 @@ msgstr "" #: ../../library/pathlib.rst:612 ../../library/pathlib.rst:1310 #: ../../library/pathlib.rst:1335 msgid "The *pattern* parameter accepts a :term:`path-like object`." -msgstr "" +msgstr "*pattern* 參數接受\\ :term:`類路徑物件 `。" #: ../../library/pathlib.rst:615 ../../library/pathlib.rst:1304 #: ../../library/pathlib.rst:1329 @@ -1148,8 +1167,8 @@ msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" msgstr "" -"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" -"`ValueError`: ::" +"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引" +"發 :exc:`ValueError`: ::" #: ../../library/pathlib.rst:624 msgid "" @@ -1183,8 +1202,8 @@ msgstr "" msgid "" "When *walk_up* is false (the default), the path must start with *other*. " "When the argument is true, ``..`` entries may be added to form the relative " -"path. In all other cases, such as the paths referencing different drives, :" -"exc:`ValueError` is raised.::" +"path. In all other cases, such as the paths referencing different " +"drives, :exc:`ValueError` is raised.::" msgstr "" "當 *walk_up* 是 False(預設值),路徑必須以 *other* 為開始。當此引數是 True," "可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," @@ -1353,7 +1372,7 @@ msgid "" "such as from :attr:`parent` and :meth:`relative_to`. Subclasses may override " "this method to pass information to derivative paths, for example::" msgstr "" -"透過結合給定的 *pathsegments* 建立一個相同類型的新路徑物件,當一個衍生路徑被" +"透過結合給定的 *pathsegments* 建立一個相同型別的新路徑物件,當一個衍生路徑被" "建立的時候會呼叫這個方法,例如從 :attr:`parent` 和 :meth:`relative_to` 建立衍" "生路徑。子類別可以覆寫此方法來傳遞資訊給衍生路徑,例如: ::" @@ -1435,9 +1454,11 @@ msgstr "" #: ../../library/pathlib.rst:778 msgid "" -"Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" -"`NotImplementedError` was raised instead." +"Raises :exc:`UnsupportedOperation` on Windows. In previous " +"versions, :exc:`NotImplementedError` was raised instead." msgstr "" +"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引" +"發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:785 msgid "" @@ -1460,6 +1481,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` on non-Windows platforms. In previous " "versions, :exc:`NotImplementedError` was raised instead." msgstr "" +"在非 Windows 平台上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引" +"發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:798 msgid "" @@ -1505,27 +1528,31 @@ msgid "" "Some concrete path methods can raise an :exc:`OSError` if a system call " "fails (for example because the path doesn't exist)." msgstr "" -"有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`" +"有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`。" #: ../../library/pathlib.rst:821 msgid "Parsing and generating URIs" -msgstr "" +msgstr "剖析和產生 URI" #: ../../library/pathlib.rst:823 msgid "" "Concrete path objects can be created from, and represented as, 'file' URIs " "conforming to :rfc:`8089`." msgstr "" +"實體路徑物件可以從符合 :rfc:`8089` 中的 'file' URI 建立,也可以以該形式來表" +"示。" #: ../../library/pathlib.rst:828 msgid "" "File URIs are not portable across machines with different :ref:`filesystem " "encodings `." msgstr "" +"檔案 URI 在跨不同\\ :ref:`檔案系統編碼 `\\ 的機器上是無" +"法移植的。" #: ../../library/pathlib.rst:833 msgid "Return a new path object from parsing a 'file' URI. For example::" -msgstr "" +msgstr "從剖析 'file' URI 回傳新的路徑物件。例如: ::" #: ../../library/pathlib.rst:835 msgid "" @@ -1537,7 +1564,7 @@ msgstr "" #: ../../library/pathlib.rst:838 msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" -msgstr "" +msgstr "在 Windows 上,從 URI 可以剖析 DOS 裝置和 UNC 路徑: ::" #: ../../library/pathlib.rst:840 msgid "" @@ -1553,7 +1580,7 @@ msgstr "" #: ../../library/pathlib.rst:845 msgid "Several variant forms are supported::" -msgstr "" +msgstr "支援多種變形: ::" #: ../../library/pathlib.rst:847 msgid "" @@ -1566,20 +1593,29 @@ msgid "" ">>> p = Path.from_uri('file:/c|/windows')\n" "WindowsPath('c:/windows')" msgstr "" +">>> p = Path.from_uri('file:////server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file://///server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file:c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file:/c|/windows')\n" +"WindowsPath('c:/windows')" #: ../../library/pathlib.rst:856 msgid "" ":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " "parsed path isn't absolute." msgstr "" +"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引" +"發 :exc:`ValueError`。" #: ../../library/pathlib.rst:864 msgid "" "Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " "isn't absolute." msgstr "" -"以 ``file`` URI 來表示一個路徑。如果路徑不是絕對的則會引發 :exc:" -"`ValueError`。" +"以 'file' URI 來表示路徑。如果路徑不是絕對的則會引發 :exc:`ValueError`。" #: ../../library/pathlib.rst:867 msgid "" @@ -1602,10 +1638,12 @@ msgid "" "For historical reasons, this method is also available from :class:`PurePath` " "objects. However, its use of :func:`os.fsencode` makes it strictly impure." msgstr "" +"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使" +"用 :func:`os.fsencode` 而讓它完全不純粹。" #: ../../library/pathlib.rst:882 msgid "Expanding and resolving paths" -msgstr "" +msgstr "擴展和解析路徑" #: ../../library/pathlib.rst:886 msgid "" @@ -1613,8 +1651,9 @@ msgid "" "by :func:`os.path.expanduser` with ``~`` construct). If the home directory " "can't be resolved, :exc:`RuntimeError` is raised." msgstr "" -"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成的 :func:`os.path." -"expanduser` 的回傳一樣)。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" +"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成" +"的 :func:`os.path.expanduser` 的回傳一樣)。如果無法解析家目錄,會引" +"發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:892 msgid "" @@ -1627,8 +1666,8 @@ msgstr "" #: ../../library/pathlib.rst:900 msgid "" "Return a new path with expanded ``~`` and ``~user`` constructs, as returned " -"by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" -"`RuntimeError` is raised." +"by :meth:`os.path.expanduser`. If a home directory can't be " +"resolved, :exc:`RuntimeError` is raised." msgstr "" "回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " "回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" @@ -1645,8 +1684,8 @@ msgstr "" #: ../../library/pathlib.rst:915 msgid "" -"Return a new path object representing the current directory (as returned by :" -"func:`os.getcwd`)::" +"Return a new path object representing the current directory (as returned " +"by :func:`os.getcwd`)::" msgstr "" "回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" @@ -1722,9 +1761,9 @@ msgid "" "resolved as far as possible and any remainder is appended without checking " "whether it exists." msgstr "" -"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" -"`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分" -"追加到路徑中,而不檢查其是否存在。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引" +"發 :exc:`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何" +"剩餘部分追加到路徑中,而不檢查其是否存在。" #: ../../library/pathlib.rst:956 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." @@ -1736,11 +1775,14 @@ msgid "" "strict mode, and no exception is raised in non-strict mode. In previous " "versions, :exc:`RuntimeError` is raised no matter the value of *strict*." msgstr "" +"在嚴格模式下,符號連結迴圈會像其他錯誤一樣來處理::exc:`OSError` 會被引發,而" +"在非嚴格模式下,不會引發任何例外。在先前版本中,不管 *strict* 的值是什麼,都" +"會引發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:967 msgid "" -"Return the path to which the symbolic link points (as returned by :func:`os." -"readlink`)::" +"Return the path to which the symbolic link points (as returned " +"by :func:`os.readlink`)::" msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" #: ../../library/pathlib.rst:970 @@ -1760,22 +1802,20 @@ msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.readlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :func:`os.readlink` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版" +"本中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:983 msgid "Querying file type and status" -msgstr "" +msgstr "查詢檔案類型和狀態" #: ../../library/pathlib.rst:987 msgid "" -":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:" -"`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :" -"meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " +":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " "now return ``False`` instead of raising an exception for paths that contain " "characters unrepresentable at the OS level." msgstr "" -":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:" -"`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:" -"meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " +":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " "遇到路徑包含 OS 層無法表示的字元時現在會回傳 ``False`` 而不是引發例外。" #: ../../library/pathlib.rst:997 @@ -1976,12 +2016,12 @@ msgstr "" #: ../../library/pathlib.rst:1144 msgid "" "Return whether this path points to the same file as *other_path*, which can " -"be either a Path object, or a string. The semantics are similar to :func:" -"`os.path.samefile` and :func:`os.path.samestat`." +"be either a Path object, or a string. The semantics are similar " +"to :func:`os.path.samefile` and :func:`os.path.samestat`." msgstr "" "回傳此路徑是否指向與 *other_path* 相同的檔案,*other_path* 可以是路徑 (Path) " -"物件或字串。其語義類似於 :func:`os.path.samefile` 和 :func:`os.path." -"samestat`。" +"物件或字串。其語義類似於 :func:`os.path.samefile` " +"和 :func:`os.path.samestat`。" #: ../../library/pathlib.rst:1148 msgid "" @@ -2007,7 +2047,7 @@ msgstr "" #: ../../library/pathlib.rst:1164 msgid "Reading and writing files" -msgstr "" +msgstr "讀取和寫入檔案" #: ../../library/pathlib.rst:1169 msgid "" @@ -2147,7 +2187,7 @@ msgstr "" msgid "" "If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " "raised." -msgstr "" +msgstr "如果路徑不是目錄或無法存取,則會引發 :exc:`OSError`。" #: ../../library/pathlib.rst:1276 msgid "" @@ -2160,8 +2200,8 @@ msgstr "" #: ../../library/pathlib.rst:1279 msgid "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), " +"PosixPath('test_pathlib.py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2172,8 +2212,8 @@ msgid "" " PosixPath('test_pathlib.py')]" msgstr "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), " +"PosixPath('test_pathlib.py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2201,6 +2241,9 @@ msgid "" "``False``, this method follows symlinks except when expanding \"``**``\" " "wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks." msgstr "" +"預設情況下,或者當 *recurse_symlinks* 僅限關鍵字引數被設定為 ``False`` 的時" +"候,此方法會跟隨符號連結,除非在擴展 \"``**``\" 萬用字元時。將 " +"*recurse_symlinks* 設成 ``True`` 以總是跟隨符號連結。" #: ../../library/pathlib.rst:1302 msgid "" @@ -2220,11 +2263,13 @@ msgid "" "suppressed. In previous versions, such exceptions are suppressed in many " "cases, but not all." msgstr "" +"從掃描檔案系統引發的任何 :exc:`OSError` 例外都會被抑制。在先前版本中,在許多" +"情況下這種例外都會被抑制,但不是所有情況。" #: ../../library/pathlib.rst:1321 msgid "" -"Glob the given relative *pattern* recursively. This is like calling :func:" -"`Path.glob` with \"``**/``\" added in front of the *pattern*." +"Glob the given relative *pattern* recursively. This is like " +"calling :func:`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " "\"``**/``\" 並呼叫 :func:`Path.glob`。" @@ -2290,19 +2335,20 @@ msgstr "" #: ../../library/pathlib.rst:1364 msgid "" "When *top_down* is true, the caller can modify the *dirnames* list in-place " -"(for example, using :keyword:`del` or slice assignment), and :meth:`Path." -"walk` will only recurse into the subdirectories whose names remain in " -"*dirnames*. This can be used to prune the search, or to impose a specific " -"order of visiting, or even to inform :meth:`Path.walk` about directories the " -"caller creates or renames before it resumes :meth:`Path.walk` again. " -"Modifying *dirnames* when *top_down* is false has no effect on the behavior " -"of :meth:`Path.walk` since the directories in *dirnames* have already been " -"generated by the time *dirnames* is yielded to the caller." +"(for example, using :keyword:`del` or slice assignment), " +"and :meth:`Path.walk` will only recurse into the subdirectories whose names " +"remain in *dirnames*. This can be used to prune the search, or to impose a " +"specific order of visiting, or even to inform :meth:`Path.walk` about " +"directories the caller creates or renames before it " +"resumes :meth:`Path.walk` again. Modifying *dirnames* when *top_down* is " +"false has no effect on the behavior of :meth:`Path.walk` since the " +"directories in *dirnames* have already been generated by the time *dirnames* " +"is yielded to the caller." msgstr "" "當 *top_down* 是 true,呼叫者可以原地 (in-place) 修改 *dirnames* 串列(例如使" "用 :keyword:`del` 或切片賦值 (slice assignment)),且 :meth:`Path.walk` 只會" "遞迴進名稱依然留在 *dirnames* 裡的子目錄。這可以用來修剪搜尋,或者強加特定順" -"序的訪問,或者甚至在繼續 :meth:`Path.walk` 之前,用來告訴 :meth:`Path.walk` " +"序的瀏覽,或者甚至在繼續 :meth:`Path.walk` 之前,用來告訴 :meth:`Path.walk` " "關於呼叫者建立或重新命名的目錄。當 *top_down* 是 false 的時候,修改 " "*dirnames* 對 :meth:`Path.walk` 的行為沒有影響,因為 *dirnames* 裡的目錄已經" "在 *dirnames* yield 給呼叫者之前被產生。" @@ -2330,17 +2376,18 @@ msgid "" msgstr "" "預設 :meth:`Path.walk` 不會跟隨符號連結,而是會把它們加到 *filenames* 串列。" "將 *follow_symlinks* 設定為 true 會解析符號連結,並將它們根據其指向的目標放在" -"適當的 *dirnames* 和 *filenames*,而因此訪問到符號連結指向的目錄(在有支援符" +"適當的 *dirnames* 和 *filenames*,而因此瀏覽到符號連結指向的目錄(在有支援符" "號連結的地方)。" #: ../../library/pathlib.rst:1387 msgid "" "Be aware that setting *follow_symlinks* to true can lead to infinite " -"recursion if a link points to a parent directory of itself. :meth:`Path." -"walk` does not keep track of the directories it has already visited." +"recursion if a link points to a parent directory of " +"itself. :meth:`Path.walk` does not keep track of the directories it has " +"already visited." msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" -"為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經訪問過的目錄。" +"為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經瀏覽過的目錄。" #: ../../library/pathlib.rst:1392 msgid "" @@ -2351,17 +2398,17 @@ msgid "" "*dirnames* as appropriate." msgstr "" ":meth:`Path.walk` 假設其走訪的目錄在執行過程中不會被修改。舉例來說,如果在 " -"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 false,:" -"meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 *dirnames* " -"適當地移除目錄。" +"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 " +"false,:meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 " +"*dirnames* 適當地移除目錄。" #: ../../library/pathlib.rst:1400 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." msgstr "" -"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的是 :meth:`Path." -"walk` 會將指向目錄的符號連結放在 *filenames* 串列。" +"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的" +"是 :meth:`Path.walk` 會將指向目錄的符號連結放在 *filenames* 串列。" #: ../../library/pathlib.rst:1403 msgid "" @@ -2374,8 +2421,8 @@ msgstr "" #: ../../library/pathlib.rst:1406 msgid "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." -"walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/" +"concurrent\").walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2388,8 +2435,8 @@ msgid "" " dirs.remove('__pycache__')" msgstr "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." -"walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/" +"concurrent\").walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2421,18 +2468,26 @@ msgid "" " for name in dirs:\n" " (root / name).rmdir()" msgstr "" +"# 刪除可從 \"top\" 目錄到達的所有東西。\n" +"# 注意:這是危險的!例如,如果 top == Path('/'),\n" +"# 它可能會刪除你所有的檔案。\n" +"for root, dirs, files in top.walk(top_down=False):\n" +" for name in files:\n" +" (root / name).unlink()\n" +" for name in dirs:\n" +" (root / name).rmdir()" #: ../../library/pathlib.rst:1436 msgid "Creating files and directories" -msgstr "建立檔案與目錄" +msgstr "建立檔案和目錄" #: ../../library/pathlib.rst:1440 msgid "" "Create a file at this given path. If *mode* is given, it is combined with " "the process's ``umask`` value to determine the file mode and access flags. " "If the file already exists, the function succeeds when *exist_ok* is true " -"(and its modification time is updated to the current time), otherwise :exc:" -"`FileExistsError` is raised." +"(and its modification time is updated to the current time), " +"otherwise :exc:`FileExistsError` is raised." msgstr "" "根據給定路徑來建立一個檔案。如果 *mode* 有給定,它會與行程的 ``umask`` 值結" "合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" @@ -2440,9 +2495,11 @@ msgstr "" #: ../../library/pathlib.rst:1447 msgid "" -"The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." -"write_bytes` methods are often used to create files." +"The :meth:`~Path.open`, :meth:`~Path.write_text` " +"and :meth:`~Path.write_bytes` methods are often used to create files." msgstr "" +":meth:`~Path.open`、:meth:`~Path.write_text` 和 :meth:`~Path.write_bytes` 方" +"法通常用於建立檔案。" #: ../../library/pathlib.rst:1453 msgid "" @@ -2465,19 +2522,19 @@ msgstr "" #: ../../library/pathlib.rst:1462 msgid "" -"If *parents* is false (the default), a missing parent raises :exc:" -"`FileNotFoundError`." +"If *parents* is false (the default), a missing parent " +"raises :exc:`FileNotFoundError`." msgstr "" -"如果 *parents* 是 false(預設值),缺少的父路徑會引發 :exc:" -"`FileNotFoundError`。" +"如果 *parents* 是 false(預設值),缺少的父路徑會引" +"發 :exc:`FileNotFoundError`。" #: ../../library/pathlib.rst:1465 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." msgstr "" -"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引發 :exc:" -"`FileExistsError`。" +"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引" +"發 :exc:`FileExistsError`。" #: ../../library/pathlib.rst:1468 msgid "" @@ -2485,8 +2542,9 @@ msgid "" "given path already exists in the file system and is not a directory (same " "behavior as the POSIX ``mkdir -p`` command)." msgstr "" -"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔案,:" -"exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相同)。" +"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔" +"案,:exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相" +"同)。" #: ../../library/pathlib.rst:1472 msgid "The *exist_ok* parameter was added." @@ -2539,6 +2597,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.symlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :func:`os.symlink` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版" +"本中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1508 msgid "Make this path a hard link to the same file as *target*." @@ -2554,18 +2614,20 @@ msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.link` is not available. In " "previous versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :func:`os.link` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" +"中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1522 msgid "Renaming and deleting" -msgstr "" +msgstr "重新命名和刪除" #: ../../library/pathlib.rst:1526 msgid "" -"Rename this file or directory to the given *target*, and return a new :class:" -"`!Path` instance pointing to *target*. On Unix, if *target* exists and is a " -"file, it will be replaced silently if the user has permission. On Windows, " -"if *target* exists, :exc:`FileExistsError` will be raised. *target* can be " -"either a string or another path object::" +"Rename this file or directory to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*. On Unix, if *target* " +"exists and is a file, it will be replaced silently if the user has " +"permission. On Windows, if *target* exists, :exc:`FileExistsError` will be " +"raised. *target* can be either a string or another path object::" msgstr "" "將此檔案或目錄重新命名為給定的 *target* ,並回傳一個新的 :class:`!Path` 實例" "指向該 *target*。在 Unix 系統上,若 *target* 存在且為一個檔案,若使用者有權" @@ -2595,10 +2657,10 @@ msgstr "" #: ../../library/pathlib.rst:1541 ../../library/pathlib.rst:1557 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " -"relative to the current working directory, *not* the directory of the :class:" -"`!Path` object." +"relative to the current working directory, *not* the directory of " +"the :class:`!Path` object." msgstr "" -"目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於當前的工作目錄進行解釋,*而" +"目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於目前的工作目錄進行解釋,*而" "不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" #: ../../library/pathlib.rst:1545 @@ -2613,17 +2675,18 @@ msgstr "新增了回傳值,回傳新的 :class:`!Path` 實例。" #: ../../library/pathlib.rst:1553 msgid "" -"Rename this file or directory to the given *target*, and return a new :class:" -"`!Path` instance pointing to *target*. If *target* points to an existing " -"file or empty directory, it will be unconditionally replaced." +"Rename this file or directory to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*. If *target* points to an " +"existing file or empty directory, it will be unconditionally replaced." msgstr "" -"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的新 :class:" -"`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" +"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" +"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" +"件地取代。" #: ../../library/pathlib.rst:1567 msgid "" -"Remove this file or symbolic link. If the path points to a directory, use :" -"func:`Path.rmdir` instead." +"Remove this file or symbolic link. If the path points to a directory, " +"use :func:`Path.rmdir` instead." msgstr "移除這個檔案或符號連結。如果路徑指向目錄,請改用 :func:`Path.rmdir`。" #: ../../library/pathlib.rst:1570 @@ -2652,7 +2715,7 @@ msgstr "移除此目錄。該目錄必須為空。" #: ../../library/pathlib.rst:1586 msgid "Permissions and ownership" -msgstr "" +msgstr "權限和所有權" #: ../../library/pathlib.rst:1590 msgid "" @@ -2675,6 +2738,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :mod:`pwd` 模組不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" +"中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1606 msgid "" @@ -2697,6 +2762,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :mod:`grp` 模組不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" +"中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1622 msgid "Change the file mode and permissions, like :func:`os.chmod`." @@ -2737,37 +2804,39 @@ msgstr "" #: ../../library/pathlib.rst:1650 msgid "Pattern language" -msgstr "" +msgstr "模式語言 (pattern language)" #: ../../library/pathlib.rst:1652 msgid "" -"The following wildcards are supported in patterns for :meth:`~PurePath." -"full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" +"The following wildcards are supported in patterns " +"for :meth:`~PurePath.full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" msgstr "" +"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` " +"和 :meth:`~Path.rglob` 的模式中被支援:" #: ../../library/pathlib.rst:1655 msgid "``**`` (entire segment)" -msgstr "" +msgstr "``**``\\(整個片段)" #: ../../library/pathlib.rst:1656 msgid "Matches any number of file or directory segments, including zero." -msgstr "" +msgstr "匹配任何數量的檔案或目錄片段,包括零個。" #: ../../library/pathlib.rst:1657 msgid "``*`` (entire segment)" -msgstr "" +msgstr "``*``\\(整個片段)" #: ../../library/pathlib.rst:1658 msgid "Matches one file or directory segment." -msgstr "" +msgstr "匹配一個檔案或目錄的片段。" #: ../../library/pathlib.rst:1659 msgid "``*`` (part of a segment)" -msgstr "" +msgstr "``*``\\(片段的一部分)" #: ../../library/pathlib.rst:1660 msgid "Matches any number of non-separator characters, including zero." -msgstr "" +msgstr "匹配任意數量的非分隔字元,包括零個。" #: ../../library/pathlib.rst:1661 msgid "``?``" @@ -2775,7 +2844,7 @@ msgstr "``?``" #: ../../library/pathlib.rst:1662 msgid "Matches one non-separator character." -msgstr "" +msgstr "匹配一個非分隔字元。" #: ../../library/pathlib.rst:1663 msgid "``[seq]``" @@ -2783,7 +2852,7 @@ msgstr "``[seq]``" #: ../../library/pathlib.rst:1664 msgid "Matches one character in *seq*." -msgstr "" +msgstr "匹配一個在 *seq* 中的字元。" #: ../../library/pathlib.rst:1665 msgid "``[!seq]``" @@ -2791,21 +2860,23 @@ msgstr "``[!seq]``" #: ../../library/pathlib.rst:1666 msgid "Matches one character not in *seq*." -msgstr "" +msgstr "匹配一個不在 *seq* 中的字元。" #: ../../library/pathlib.rst:1668 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``\"[?]\"`` matches the character ``\"?\"``." msgstr "" +"對於文本 (literal) 匹配,可以用方括號包裝元字元 (meta-characters)。例如," +"``\"[?]\"`` 會匹配字元 ``\"?\"``。" #: ../../library/pathlib.rst:1671 msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" -msgstr "" +msgstr "\"``**``\" 萬用字元讓它可以做遞迴 glob。例如:" #: ../../library/pathlib.rst:1674 msgid "Pattern" -msgstr "" +msgstr "模式" #: ../../library/pathlib.rst:1674 msgid "Meaning" @@ -2817,7 +2888,7 @@ msgstr "\"``**/*``\"" #: ../../library/pathlib.rst:1676 msgid "Any path with at least one segment." -msgstr "" +msgstr "至少有一個片段的路徑。" #: ../../library/pathlib.rst:1677 msgid "\"``**/*.py``\"" @@ -2825,7 +2896,7 @@ msgstr "\"``**/*.py``\"" #: ../../library/pathlib.rst:1677 msgid "Any path with a final segment ending \"``.py``\"." -msgstr "" +msgstr "最後一個片段以 \"``.py``\" 結尾的任何路徑。" #: ../../library/pathlib.rst:1678 msgid "\"``assets/**``\"" @@ -2833,7 +2904,7 @@ msgstr "\"``assets/**``\"" #: ../../library/pathlib.rst:1678 msgid "Any path starting with \"``assets/``\"." -msgstr "" +msgstr "任何以 \"``assets/``\" 開頭的路徑。" #: ../../library/pathlib.rst:1679 msgid "\"``assets/**/*``\"" @@ -2842,33 +2913,39 @@ msgstr "\"``assets/**/*``\"" #: ../../library/pathlib.rst:1679 msgid "" "Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." -msgstr "" +msgstr "任何以 \"``assets/``\" 開頭的路徑,不包括 \"``assets/``\" 本身。" #: ../../library/pathlib.rst:1683 msgid "" "Globbing with the \"``**``\" wildcard visits every directory in the tree. " "Large directory trees may take a long time to search." msgstr "" +"Glob 使用 ``**`` 萬用字元會訪問目錄樹中的每個目錄。對於大型的目錄樹,搜尋可能" +"需要花費很長的時間。" #: ../../library/pathlib.rst:1686 msgid "" "Globbing with a pattern that ends with \"``**``\" returns both files and " "directories. In previous versions, only directories were returned." msgstr "" +"Glob 使用結尾為 ``**`` 的模式會同時回傳檔案和目錄。在先前版本中,只會回傳目" +"錄。" #: ../../library/pathlib.rst:1690 msgid "" "In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added " "to the pattern to match only directories." msgstr "" +"在 :meth:`Path.glob` 和 :meth:`~Path.rglob` 中,可以在模式後面加上斜線以只匹" +"配目錄。" #: ../../library/pathlib.rst:1693 msgid "" -"Globbing with a pattern that ends with a pathname components separator (:" -"data:`~os.sep` or :data:`~os.altsep`) returns only directories." +"Globbing with a pattern that ends with a pathname components separator " +"(:data:`~os.sep` or :data:`~os.altsep`) returns only directories." msgstr "" -"如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." -"altsep`)作結尾來 glob 則只會回傳目錄。" +"Glob 使用以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os.altsep`)作" +"結尾的模式則只會回傳目錄。" #: ../../library/pathlib.rst:1699 msgid "Comparison to the :mod:`glob` module" @@ -2876,21 +2953,27 @@ msgstr "與 :mod:`glob` 模組的比較" #: ../../library/pathlib.rst:1701 msgid "" -"The patterns accepted and results generated by :meth:`Path.glob` and :meth:" -"`Path.rglob` differ slightly from those by the :mod:`glob` module:" +"The patterns accepted and results generated by :meth:`Path.glob` " +"and :meth:`Path.rglob` differ slightly from those by the :mod:`glob` module:" msgstr "" +":meth:`Path.glob` 和 :meth:`Path.rglob` 接受的模式和產生的結果與 :mod:`glob` " +"模組略有不同:" #: ../../library/pathlib.rst:1704 msgid "" "Files beginning with a dot are not special in pathlib. This is like passing " "``include_hidden=True`` to :func:`glob.glob`." msgstr "" +"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞" +"給 :func:`glob.glob` 相同。" #: ../../library/pathlib.rst:1706 msgid "" "\"``**``\" pattern components are always recursive in pathlib. This is like " "passing ``recursive=True`` to :func:`glob.glob`." msgstr "" +"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞" +"給 :func:`glob.glob` 相同。" #: ../../library/pathlib.rst:1708 msgid "" @@ -2898,19 +2981,26 @@ msgid "" "This behaviour has no equivalent in :func:`glob.glob`, but you can pass " "``recurse_symlinks=True`` to :meth:`Path.glob` for compatible behaviour." msgstr "" +"在 pathlib 中,``**`` 模式組成預設不跟隨符號連結。這在 :func:`glob.glob` 中沒" +"有等效的行為,但你可以將 ``recurse_symlinks=True`` 傳遞給 :meth:`Path.glob` " +"以獲得相容的行為。" #: ../../library/pathlib.rst:1711 msgid "" "Like all :class:`PurePath` and :class:`Path` objects, the values returned " "from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." msgstr "" +"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` " +"和 :meth:`Path.rglob` 回傳的值不包含結尾斜線。" #: ../../library/pathlib.rst:1714 msgid "" "The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` " -"include the *path* as a prefix, unlike the results of ``glob." -"glob(root_dir=path)``." +"include the *path* as a prefix, unlike the results of " +"``glob.glob(root_dir=path)``." msgstr "" +"pathlib 的 ``path.glob()`` 和 ``path.rglob()`` 回傳的值包含了 *path* 作為前" +"綴,而 ``glob.glob(root_dir=path)`` 的結果則不會如此。" #: ../../library/pathlib.rst:1717 msgid "" @@ -2919,6 +3009,9 @@ msgid "" "results of ``glob.glob(root_dir=path)`` never include an empty string that " "would correspond to *path*." msgstr "" +"pathlib 的 ``path.glob()`` 和 ``path.rglob()`` 回傳的值可能包含 *path* 本身," +"例如當使用 \"``**``\" 做 glob 的時候,然而 ``glob.glob(root_dir=path)`` 的結" +"果則永遠不會包含一個對應到 *path* 的空字串。" #: ../../library/pathlib.rst:1724 msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" @@ -2927,25 +3020,35 @@ msgstr "與 :mod:`os` 和 :mod:`os.path` 模組的比較" #: ../../library/pathlib.rst:1726 msgid "" "pathlib implements path operations using :class:`PurePath` and :class:`Path` " -"objects, and so it's said to be *object-oriented*. On the other hand, the :" -"mod:`os` and :mod:`os.path` modules supply functions that work with low-" +"objects, and so it's said to be *object-oriented*. On the other hand, " +"the :mod:`os` and :mod:`os.path` modules supply functions that work with low-" "level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " "Some users consider the object-oriented style to be more readable." msgstr "" +"pathlib 使用 :class:`PurePath` 和 :class:`Path` 物件來實作路徑操作,因此它被" +"稱為是\\ *物件導向*\\ 的。另一方面,:mod:`os` 和 :mod:`os.path` 模組提供能夠" +"與底層 ``str`` 和 ``bytes`` 物件互動的函式,這是一種更\\ *程序式*\\ 的方法。" +"有些使用者認為物件導向的風格更易讀。" #: ../../library/pathlib.rst:1732 msgid "" -"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :" -"ref:`paths relative to directory descriptors `. These features " +"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths " +"and :ref:`paths relative to directory descriptors `. These features " "aren't available in pathlib." msgstr "" +":mod:`os` 和 :mod:`os.path` 中的許多函式支援 ``bytes`` 路徑和\\ :ref:`相對路" +"徑的目錄描述器 (paths relative to directory descriptors) `。這些功能" +"在 pathlib 中不可用。" #: ../../library/pathlib.rst:1736 msgid "" -"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and :mod:" -"`os.path` modules, are written in C and are very speedy. pathlib is written " -"in pure Python and is often slower, but rarely slow enough to matter." +"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` " +"and :mod:`os.path` modules, are written in C and are very speedy. pathlib is " +"written in pure Python and is often slower, but rarely slow enough to matter." msgstr "" +"Python 的 ``str`` 和 ``bytes`` 型別,以及 :mod:`os` 和 :mod:`os.path` 模組的" +"一些部分,是用 C 寫的且非常快速。pathlib 是用純 Python 寫的且通常比較慢,但很" +"少會慢到足以產生影響。" #: ../../library/pathlib.rst:1740 msgid "" @@ -2955,11 +3058,14 @@ msgid "" "are involved, :meth:`Path.absolute` preserves these segments for greater " "safety." msgstr "" +"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘" +"管 :func:`os.path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的" +"話這可能會改變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" #: ../../library/pathlib.rst:1745 msgid "" "pathlib's path normalization may render it unsuitable for some applications:" -msgstr "" +msgstr "pathlib 的路徑正規化可能會使它不適合某些應用程式:" #: ../../library/pathlib.rst:1747 msgid "" @@ -2969,6 +3075,9 @@ msgid "" "separator may allow the path to be resolved as either a file or directory, " "rather than a directory only." msgstr "" +"pathlib 將 ``Path(\"my_folder/\")`` 正規化為 ``Path(\"my_folder\")``,這會在" +"提供給各種操作系統 API 和命令列工具時改變路徑的意義。具體來說,缺少結尾分隔符" +"號可能會允許該路徑被解析為檔案或目錄,而不只是目錄。" #: ../../library/pathlib.rst:1752 msgid "" @@ -2978,24 +3087,28 @@ msgid "" "a separator in the path may force it to be looked up in :envvar:`PATH` " "rather than the current directory." msgstr "" +"pathlib 將 ``Path(\"./my_program\")`` 正規化為 ``Path(\"my_program\")``,這會" +"在作為執行檔搜尋路徑使用時改變路徑的意義,例如在 shell 或在衍生 (spawn) 子行" +"程時。具體來說,在路徑中缺少分隔符號可能會使其強制在 :envvar:`PATH` 中尋找," +"而不是目前目錄。" #: ../../library/pathlib.rst:1758 msgid "" "As a consequence of these differences, pathlib is not a drop-in replacement " "for :mod:`os.path`." -msgstr "" +msgstr "因為這些差異,pathlib 不是 :mod:`os.path` 的直接替代品。" #: ../../library/pathlib.rst:1763 msgid "Corresponding tools" -msgstr "" +msgstr "對應工具" #: ../../library/pathlib.rst:1765 msgid "" -"Below is a table mapping various :mod:`os` functions to their corresponding :" -"class:`PurePath`/:class:`Path` equivalent." +"Below is a table mapping various :mod:`os` functions to their " +"corresponding :class:`PurePath`/:class:`Path` equivalent." msgstr "" -"以下是一張表格,對應許多 :mod:`os` 函式及其相符於 :class:`PurePath`/:class:" -"`Path` 的項目。" +"以下是一張表格,對應許多 :mod:`os` 函式及其相符" +"於 :class:`PurePath`/:class:`Path` 的項目。" #: ../../library/pathlib.rst:1769 msgid ":mod:`os` and :mod:`os.path`" @@ -3255,7 +3368,7 @@ msgstr ":meth:`Path.lchmod`" #: ../../library/pathlib.rst:1805 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/pathlib.rst:1806 msgid "" @@ -3264,20 +3377,28 @@ msgid "" "is a lexical operation that raises :exc:`ValueError` when its inputs' " "anchors differ (e.g. if one path is absolute and the other relative.)" msgstr "" +":func:`os.path.relpath` 會呼叫 :func:`~os.path.abspath` 來將路徑變成絕對路徑" +"並移除 \"``..``\" 部分,而 :meth:`PurePath.relative_to` 是一個文本上的操作," +"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引" +"發 :exc:`ValueError`。" #: ../../library/pathlib.rst:1810 msgid "" ":func:`os.path.expanduser` returns the path unchanged if the home directory " -"can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" -"`RuntimeError`." +"can't be resolved, whereas :meth:`Path.expanduser` " +"raises :exc:`RuntimeError`." msgstr "" +":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑," +"而 :meth:`Path.expanduser` 則會引發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:1813 msgid "" ":func:`os.path.abspath` removes \"``..``\" components without resolving " -"symlinks, which may change the meaning of the path, whereas :meth:`Path." -"absolute` leaves any \"``..``\" components in the path." +"symlinks, which may change the meaning of the path, " +"whereas :meth:`Path.absolute` leaves any \"``..``\" components in the path." msgstr "" +":func:`os.path.abspath` 將 \"``..``\" 組成移除而不解析符號連結,這可能會改變" +"路徑的意義,而 :meth:`Path.absolute` 則會保留路徑中任何 \"``..``\" 組成。" #: ../../library/pathlib.rst:1816 msgid "" @@ -3285,6 +3406,9 @@ msgid "" "*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all " "symlinks into *filenames* when *follow_symlinks* is false (the default.)" msgstr "" +"當分類路徑成 *dirnames* 和 *filenames* 時 :func:`os.walk` 總是跟隨符號連結," +"而 :meth:`Path.walk` 在 *follow_symlinks* 為 false(預設值)時,會將所有符號" +"連結都分類為 *filenames*。" #: ../../library/pathlib.rst:11 msgid "path" @@ -3293,99 +3417,3 @@ msgstr "path(路徑)" #: ../../library/pathlib.rst:11 msgid "operations" msgstr "operations(操作)" - -#~ msgid "" -#~ "File system calls on reserved paths can fail mysteriously or have " -#~ "unintended effects." -#~ msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" - -#~ msgid "" -#~ "If *pattern* is relative, the path can be either relative or absolute, " -#~ "and matching is done from the right::" -#~ msgstr "" -#~ "如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" -#~ "對: ::" - -#~ msgid "" -#~ "If *pattern* is absolute, the path must be absolute, and the whole path " -#~ "must match::" -#~ msgstr "" -#~ "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" - -#~ msgid "" -#~ ">>> PurePath('/a.py').match('/*.py')\n" -#~ "True\n" -#~ ">>> PurePath('a/b.py').match('/*.py')\n" -#~ "False" -#~ msgstr "" -#~ ">>> PurePath('/a.py').match('/*.py')\n" -#~ "True\n" -#~ ">>> PurePath('a/b.py').match('/*.py')\n" -#~ "False" - -#~ msgid "" -#~ "The *pattern* may be another path object; this speeds up matching the " -#~ "same pattern against multiple files::" -#~ msgstr "" -#~ "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" - -#~ msgid "" -#~ ">>> pattern = PurePath('*.py')\n" -#~ ">>> PurePath('a/b.py').match(pattern)\n" -#~ "True" -#~ msgstr "" -#~ ">>> pattern = PurePath('*.py')\n" -#~ ">>> PurePath('a/b.py').match(pattern)\n" -#~ "True" - -#~ msgid "Accepts an object implementing the :class:`os.PathLike` interface." -#~ msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" - -#~ msgid "" -#~ ">>> sorted(Path('.').glob('*.py'))\n" -#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -#~ "py')]\n" -#~ ">>> sorted(Path('.').glob('*/*.py'))\n" -#~ "[PosixPath('docs/conf.py')]" -#~ msgstr "" -#~ ">>> sorted(Path('.').glob('*.py'))\n" -#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -#~ "py')]\n" -#~ ">>> sorted(Path('.').glob('*/*.py'))\n" -#~ "[PosixPath('docs/conf.py')]" - -#~ msgid "" -#~ "Patterns are the same as for :mod:`fnmatch`, with the addition of " -#~ "\"``**``\" which means \"this directory and all subdirectories, " -#~ "recursively\". In other words, it enables recursive globbing::" -#~ msgstr "" -#~ "模式 (pattern) 和給 :mod:`fnmatch` 的一樣,加上 \"``**``\" 代表「目前目錄" -#~ "及所有遞迴的子目錄」。也就是說它能夠做遞迴的 glob 比對: ::" - -#~ msgid "" -#~ "This method calls :meth:`Path.is_dir` on the top-level directory and " -#~ "propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" -#~ "`OSError` exceptions from scanning directories are suppressed." -#~ msgstr "" -#~ "此方法在頂層目錄上呼叫 :meth:`Path.is_dir` 並傳遞引發的任何 :exc:" -#~ "`OSError` 例外。將會抑制在目錄對於 :exc:`OSError` 例外的後續掃描。" - -#~ msgid "" -#~ "Using the \"``**``\" pattern in large directory trees may consume an " -#~ "inordinate amount of time." -#~ msgstr "在很大的目錄樹裡使用 \"``**``\" 可能會耗費過多的時間。" - -#~ msgid "" -#~ ">>> sorted(Path().rglob(\"*.py\"))\n" -#~ "[PosixPath('build/lib/pathlib.py'),\n" -#~ " PosixPath('docs/conf.py'),\n" -#~ " PosixPath('pathlib.py'),\n" -#~ " PosixPath('setup.py'),\n" -#~ " PosixPath('test_pathlib.py')]" -#~ msgstr "" -#~ ">>> sorted(Path().rglob(\"*.py\"))\n" -#~ "[PosixPath('build/lib/pathlib.py'),\n" -#~ " PosixPath('docs/conf.py'),\n" -#~ " PosixPath('pathlib.py'),\n" -#~ " PosixPath('setup.py'),\n" -#~ " PosixPath('test_pathlib.py')]" diff --git a/library/pdb.po b/library/pdb.po index 82e3ec7697..2cdb572a06 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2024-10-19 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,13 +43,14 @@ msgstr "" #: ../../library/pdb.rst:26 msgid "" -"The debugger is extensible -- it is actually defined as the class :class:" -"`Pdb`. This is currently undocumented but easily understood by reading the " -"source. The extension interface uses the modules :mod:`bdb` and :mod:`cmd`." +"The debugger is extensible -- it is actually defined as the " +"class :class:`Pdb`. This is currently undocumented but easily understood by " +"reading the source. The extension interface uses the modules :mod:`bdb` " +"and :mod:`cmd`." msgstr "" "偵錯器是可擴充的 —— 偵錯器實際被定義為 :class:`Pdb` 類別。該類別目前沒有文" -"件,但可以很容易地透過閱讀原始碼來理解它。擴充套件介面使用了 :mod:`bdb` 和 :" -"mod:`cmd` 模組。" +"件,但可以很容易地透過閱讀原始碼來理解它。擴充套件介面使用了 :mod:`bdb` " +"和 :mod:`cmd` 模組。" #: ../../library/pdb.rst:32 msgid "Module :mod:`faulthandler`" @@ -149,19 +150,19 @@ msgid "" "arguments of the ``p`` command." msgstr "" "透過 :mod:`readline` 模組達成的 tab 補全可用於補全本模組的命令和命令的引數," -"例如會提供當前的全域和區域名稱以作為 ``p`` 命令的引數。" +"例如會提供目前的全域和區域名稱以作為 ``p`` 命令的引數。" -#: ../../library/pdb.rst:78 +#: ../../library/pdb.rst:80 msgid "" "You can also invoke :mod:`pdb` from the command line to debug other " "scripts. For example::" -msgstr "你還可以從命令列調用 :mod:`pdb` 來偵錯其他腳本。例如: ::" - -#: ../../library/pdb.rst:81 -msgid "python -m pdb myscript.py" -msgstr "python -m pdb myscript.py" +msgstr "你還可以從命令列叫用 :mod:`pdb` 來偵錯其他腳本。例如: ::" #: ../../library/pdb.rst:83 +msgid "python -m pdb [-c command] (-m module | pyfile) [args ...]" +msgstr "python -m pdb [-c command] (-m module | pyfile) [args ...]" + +#: ../../library/pdb.rst:85 msgid "" "When invoked as a module, pdb will automatically enter post-mortem debugging " "if the program being debugged exits abnormally. After post-mortem debugging " @@ -169,32 +170,39 @@ msgid "" "Automatic restarting preserves pdb's state (such as breakpoints) and in most " "cases is more useful than quitting the debugger upon program's exit." msgstr "" -"當作為模組調用時,如果被偵錯的程序不正常地退出,pdb 將自動進入事後偵錯。事後" +"當作為模組叫用時,如果被偵錯的程序不正常地退出,pdb 將自動進入事後偵錯。事後" "偵錯後(或程式正常退出後),pdb 將重新啟動程式。自動重新啟動會保留 pdb 的狀態" "(例如斷點),並且在大多數情況下比在程式退出時退出偵錯器更有用。" -#: ../../library/pdb.rst:89 +#: ../../library/pdb.rst:93 msgid "" -"Added the ``-c`` option to execute commands as if given in a :file:`.pdbrc` " -"file; see :ref:`debugger-commands`." +"To execute commands as if given in a :file:`.pdbrc` file; see :ref:`debugger-" +"commands`." msgstr "" -"新增了 ``-c`` 選項來執行命令,就像能在 :file:`.pdbrc` 檔案中給定的那樣;請參" -"閱\\ :ref:`偵錯器命令 `。" +"就像在 :file:`.pdbrc` 檔案中給定的那樣來執行命令;請參閱\\ :ref:`偵錯器命令 " +"`。" -#: ../../library/pdb.rst:93 +#: ../../library/pdb.rst:96 +msgid "Added the ``-c`` option." +msgstr "新增了 ``-c`` 選項。" + +#: ../../library/pdb.rst:101 msgid "" -"Added the ``-m`` option to execute modules similar to the way ``python -m`` " -"does. As with a script, the debugger will pause execution just before the " -"first line of the module." +"To execute modules similar to the way ``python -m`` does. As with a script, " +"the debugger will pause execution just before the first line of the module." msgstr "" -"新增了 ``-m`` 選項以類似於 ``python -m`` 的方式來執行模組。與腳本一樣,偵錯器" -"將在模組的第一列之前暫停執行。" +"以類似於 ``python -m`` 的方式來執行模組。與腳本一樣,偵錯器將在模組的第一列之" +"前暫停執行。" + +#: ../../library/pdb.rst:104 +msgid "Added the ``-m`` option." +msgstr "新增了 ``-m`` 選項。" -#: ../../library/pdb.rst:98 +#: ../../library/pdb.rst:107 msgid "Typical usage to execute a statement under control of the debugger is::" msgstr "在偵錯器控制下執行陳述式的典型用法是: ::" -#: ../../library/pdb.rst:100 +#: ../../library/pdb.rst:109 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -214,11 +222,11 @@ msgstr "" "0.5\n" ">>>" -#: ../../library/pdb.rst:109 +#: ../../library/pdb.rst:118 msgid "The typical usage to inspect a crashed program is::" msgstr "檢查一個損壞程式的典型用法: ::" -#: ../../library/pdb.rst:111 +#: ../../library/pdb.rst:120 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -250,7 +258,7 @@ msgstr "" "0\n" "(Pdb)" -#: ../../library/pdb.rst:126 +#: ../../library/pdb.rst:135 msgid "" "The implementation of :pep:`667` means that name assignments made via " "``pdb`` will immediately affect the active scope, even when running inside " @@ -260,13 +268,13 @@ msgstr "" "影響有效作用域,即使在\\ :term:`最佳化作用域 `\\ 內運作也是" "如此。" -#: ../../library/pdb.rst:132 +#: ../../library/pdb.rst:141 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" msgstr "本模組定義了下列函式,每個函式進入偵錯器的方式略有不同:" -#: ../../library/pdb.rst:137 +#: ../../library/pdb.rst:146 msgid "" "Execute the *statement* (given as a string or a code object) under debugger " "control. The debugger prompt appears before any code is executed; you can " @@ -274,38 +282,38 @@ msgid "" "statement using :pdbcmd:`step` or :pdbcmd:`next` (all these commands are " "explained below). The optional *globals* and *locals* arguments specify the " "environment in which the code is executed; by default the dictionary of the " -"module :mod:`__main__` is used. (See the explanation of the built-in :func:" -"`exec` or :func:`eval` functions.)" +"module :mod:`__main__` is used. (See the explanation of the built-" +"in :func:`exec` or :func:`eval` functions.)" msgstr "" "在偵錯器控制下執行 *statement*\\ (以字串或程式碼物件形式給定)。偵錯提示字元" "會在執行任何程式碼前出現;你可以設定斷點並輸入 :pdbcmd:`continue`,或也可以使" "用 :pdbcmd:`step` 或 :pdbcmd:`next` 逐步執行陳述式(這些命令在下面都有說" -"明)。可選引數 *globals* 和 *locals* 指定程式碼執行的環境;預設使用 :mod:" -"`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` 的說" -"明。)" +"明)。可選引數 *globals* 和 *locals* 指定程式碼執行的環境;預設使" +"用 :mod:`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` " +"的說明。)" -#: ../../library/pdb.rst:149 +#: ../../library/pdb.rst:158 msgid "" "Evaluate the *expression* (given as a string or a code object) under " "debugger control. When :func:`runeval` returns, it returns the value of the " "*expression*. Otherwise this function is similar to :func:`run`." msgstr "" -"在偵錯器控制下為 *expression* 求值(以字串或程式碼物件形式給定)。當 :func:" -"`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式與 :func:`run` 類" -"似。" +"在偵錯器控制下為 *expression* 求值(以字串或程式碼物件形式給定)。" +"當 :func:`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式" +"與 :func:`run` 類似。" -#: ../../library/pdb.rst:156 +#: ../../library/pdb.rst:165 msgid "" "Call the *function* (a function or method object, not a string) with the " "given arguments. When :func:`runcall` returns, it returns whatever the " "function call returned. The debugger prompt appears as soon as the function " "is entered." msgstr "" -"使用給定的引數呼叫 *function*\\ (只可以是函式或方法物件,不能是字串)。:" -"func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式後立即出" -"現。" +"使用給定的引數呼叫 *function*\\ (只可以是函式或方法物件,不能是字" +"串)。:func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式" +"後立即出現。" -#: ../../library/pdb.rst:164 +#: ../../library/pdb.rst:173 msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " @@ -316,45 +324,49 @@ msgstr "" "一個斷點,即便該程式碼不在偵錯狀態(如斷言失敗時)。如有給定 *header*,它將在" "偵錯正要開始前被印出到控制台。" -#: ../../library/pdb.rst:169 +#: ../../library/pdb.rst:178 msgid "The keyword-only argument *header*." msgstr "僅限關鍵字引數 *header*。" -#: ../../library/pdb.rst:172 +#: ../../library/pdb.rst:181 msgid "" ":func:`set_trace` will enter the debugger immediately, rather than on the " "next line of code to be executed." msgstr ":func:`set_trace` 將立即進入偵錯器,而不是在下一列要執行的程式碼中。" -#: ../../library/pdb.rst:178 +#: ../../library/pdb.rst:187 msgid "" -"Enter post-mortem debugging of the given *traceback* object. If no " -"*traceback* is given, it uses the one of the exception that is currently " -"being handled (an exception must be being handled if the default is to be " -"used)." +"Enter post-mortem debugging of the given exception or :ref:`traceback object " +"`. If no value is given, it uses the exception that is " +"currently being handled, or raises ``ValueError`` if there isn’t one." msgstr "" -"進入所給定 *traceback* 物件的事後偵錯。如果沒有給定 *traceback*,預設使用當前" -"正在處理的例外之一(使用預設情況時,必須要有正在處理的例外存在)。" +"進入所給定例外或\\ :ref:`回溯物件 `\\ 的事後偵錯。如果沒有" +"給定,預設使用目前正在處理的例外,或如果沒有例外則會引發 ``ValueError``。" + +#: ../../library/pdb.rst:192 +msgid "Support for exception objects was added." +msgstr "新增對例外物件的支援。" -#: ../../library/pdb.rst:186 +#: ../../library/pdb.rst:197 msgid "" "Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." msgstr "進入在 :data:`sys.last_exc` 中發現的例外的事後偵錯。" -#: ../../library/pdb.rst:190 +#: ../../library/pdb.rst:201 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " "to access further features, you have to do this yourself:" msgstr "" -"``run*`` 函式和 :func:`set_trace` 都是別名,用於實例化 (instantiate) :class:" -"`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己執行以下操作:" +"``run*`` 函式和 :func:`set_trace` 都是別名,用於實例化 " +"(instantiate) :class:`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己" +"執行以下操作:" -#: ../../library/pdb.rst:197 +#: ../../library/pdb.rst:208 msgid ":class:`Pdb` is the debugger class." msgstr ":class:`Pdb` 是偵錯器類別。" -#: ../../library/pdb.rst:199 +#: ../../library/pdb.rst:210 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." @@ -362,7 +374,7 @@ msgstr "" "*completekey*、*stdin* 與 *stdout* 引數會被傳到底層的 :class:`cmd.Cmd` 類別;" "請於該文件閱讀相關敘述。" -#: ../../library/pdb.rst:202 +#: ../../library/pdb.rst:213 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " @@ -371,63 +383,63 @@ msgstr "" "如果給定 *skip* 引數,則它必須是一個給出 glob 樣式之模組名稱的疊代器。如果遇" "到匹配這些樣式的模組,偵錯器將不會進入來自該模組的 frame。 [1]_" -#: ../../library/pdb.rst:206 +#: ../../library/pdb.rst:217 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " -"user presses :kbd:`Ctrl-C` on the console) when you give a :pdbcmd:" -"`continue` command. This allows you to break into the debugger again by " -"pressing :kbd:`Ctrl-C`. If you want Pdb not to touch the SIGINT handler, " -"set *nosigint* to true." +"user presses :kbd:`Ctrl-C` on the console) when you give " +"a :pdbcmd:`continue` command. This allows you to break into the debugger " +"again by pressing :kbd:`Ctrl-C`. If you want Pdb not to touch the SIGINT " +"handler, set *nosigint* to true." msgstr "" "預設情況下,當你發出 :pdbcmd:`continue` 命令時,Pdb 會為 SIGINT 訊號(即使用" "者在控制台上按下 :kbd:`Ctrl-C` 時會發送的訊號)設定一個處理程式 (handler),這" "允許你透過按下 :kbd:`Ctrl-C` 再次切入偵錯器。如果你希望 Pdb 不影響到 SIGINT " "處理程式,請將 *nosigint* 設定為 true。" -#: ../../library/pdb.rst:211 +#: ../../library/pdb.rst:222 msgid "" -"The *readrc* argument defaults to true and controls whether Pdb will load ." -"pdbrc files from the filesystem." +"The *readrc* argument defaults to true and controls whether Pdb will " +"load .pdbrc files from the filesystem." msgstr "*readrc* 引數預設為 true,它控制 Pdb 是否從檔案系統載入 .pdbrc 檔案。" -#: ../../library/pdb.rst:214 +#: ../../library/pdb.rst:225 msgid "Example call to enable tracing with *skip*::" msgstr "啟用追蹤 (tracing) 且帶有 *skip* 引數的呼叫示範: ::" -#: ../../library/pdb.rst:216 +#: ../../library/pdb.rst:227 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" -#: ../../library/pdb.rst:218 +#: ../../library/pdb.rst:229 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." msgstr "" -"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` ``pdb." -"Pdb``。" +"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` " +"``pdb.Pdb``。" -#: ../../library/pdb.rst:220 +#: ../../library/pdb.rst:231 msgid "Added the *skip* parameter." msgstr "新增了 *skip* 參數。" -#: ../../library/pdb.rst:223 +#: ../../library/pdb.rst:234 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "新增了 *nosigint* 參數。以前 SIGINT 處理程式從未被 Pdb 設定過。" -#: ../../library/pdb.rst:227 +#: ../../library/pdb.rst:238 msgid "The *readrc* argument." msgstr "*readrc* 引數。" -#: ../../library/pdb.rst:235 +#: ../../library/pdb.rst:246 msgid "See the documentation for the functions explained above." msgstr "請見上面關於這些函式的文件說明。" -#: ../../library/pdb.rst:241 +#: ../../library/pdb.rst:252 msgid "Debugger Commands" msgstr "偵錯器命令" -#: ../../library/pdb.rst:243 +#: ../../library/pdb.rst:254 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -444,15 +456,15 @@ msgstr "" "空格(空格符 (spaces) 或製表符 (tabs))分隔。在命令語法中,可選引數被括在方括" "號 (``[]``) 中;使用時請勿輸入方括號。命令語法中的選擇項由豎線 (``|``) 分隔。" -#: ../../library/pdb.rst:252 +#: ../../library/pdb.rst:263 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." msgstr "" -"輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令是 :" -"pdbcmd:`list` 命令,則會列出接下來的 11 列。" +"輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令" +"是 :pdbcmd:`list` 命令,則會列出接下來的 11 列。" -#: ../../library/pdb.rst:255 +#: ../../library/pdb.rst:266 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -467,13 +479,13 @@ msgstr "" "大方法,甚至可以修改變數或呼叫函式。當此類陳述式發生例外,將印出例外名稱,但" "偵錯器的狀態不會改變。" -#: ../../library/pdb.rst:263 +#: ../../library/pdb.rst:274 msgid "" "Expressions/Statements whose prefix is a pdb command are now correctly " "identified and executed." msgstr "現在可以正確辨識並執行前綴為 pdb 命令的運算式/陳述式。" -#: ../../library/pdb.rst:267 +#: ../../library/pdb.rst:278 msgid "" "The debugger supports :ref:`aliases `. Aliases can have " "parameters which allows one a certain level of adaptability to the context " @@ -482,7 +494,7 @@ msgstr "" "偵錯器有支援設定\\ :ref:`別名 `。別名可以有參數,使得偵錯器" "對被檢查的情境有一定程度的適應性。" -#: ../../library/pdb.rst:271 +#: ../../library/pdb.rst:282 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -497,7 +509,7 @@ msgstr "" "總是在第一處 ``;;`` 被切分開,即使它位於引號內的字串之中。對於具有雙分號字串" "的一個變通解法,是使用隱式字串連接 ``';'';'`` 或 ``\";\"\";\"``。" -#: ../../library/pdb.rst:278 +#: ../../library/pdb.rst:289 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -511,27 +523,27 @@ msgstr "" "可以在偵錯器會話 (debugger session) 中使用它。當程式恢復執行時,*便利變數*\\ " "將被清除,因此與使用 ``foo = 1`` 等普通變數相比,它不太會去干擾你的程式。" -#: ../../library/pdb.rst:285 +#: ../../library/pdb.rst:296 msgid "There are three preset *convenience variables*:" msgstr "共有三個預先設定的\\ *便利變數*:" -#: ../../library/pdb.rst:287 +#: ../../library/pdb.rst:298 msgid "``$_frame``: the current frame you are debugging" -msgstr "``$_frame``:當前正在偵錯的 frame" +msgstr "``$_frame``:目前正在偵錯的 frame" -#: ../../library/pdb.rst:288 +#: ../../library/pdb.rst:299 msgid "``$_retval``: the return value if the frame is returning" msgstr "``$_retval``:frame 回傳時的回傳值" -#: ../../library/pdb.rst:289 +#: ../../library/pdb.rst:300 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "``$_exception``:frame 引發例外時的例外" -#: ../../library/pdb.rst:293 +#: ../../library/pdb.rst:304 msgid "Added the *convenience variable* feature." msgstr "新增了\\ *便利變數*\\ 功能。" -#: ../../library/pdb.rst:299 +#: ../../library/pdb.rst:310 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " @@ -540,21 +552,21 @@ msgid "" "useful for aliases. If both files exist, the one in the home directory is " "read first and aliases defined there can be overridden by the local file." msgstr "" -"如果 :file:`.pdbrc` 檔案存在於使用者的家目錄或當前目錄中,則會使用 " +"如果 :file:`.pdbrc` 檔案存在於使用者的家目錄或目前目錄中,則會使用 " "``'utf-8'`` 編碼讀取並執行該檔案,就像在偵錯器提示字元下鍵入該檔案一樣,除了" "空列和以 ``#`` 開頭的列會被忽略之外。這對於別名設定特別有用。如果兩個檔案都存" "在,則先讀取家目錄中的檔案,且定義於其中的別名可以被本地檔案覆蓋。" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:317 msgid "" -":file:`.pdbrc` can now contain commands that continue debugging, such as :" -"pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " +":file:`.pdbrc` can now contain commands that continue debugging, such " +"as :pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" -":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` 或 :pdbcmd:" -"`next`。以前檔案中的這些命令是無效的。" +":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` " +"或 :pdbcmd:`next`。以前檔案中的這些命令是無效的。" -#: ../../library/pdb.rst:311 +#: ../../library/pdb.rst:322 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." @@ -562,7 +574,7 @@ msgstr "" ":file:`.pdbrc` 現在使用 ``'utf-8'`` 編碼讀取。以前它是使用系統區域設定編碼讀" "取的。" -#: ../../library/pdb.rst:318 +#: ../../library/pdb.rst:329 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -572,49 +584,49 @@ msgid "" msgstr "" "如不帶引數,印出可用的命令列表。引數為 *command* 時,印出有關該命令的幫助訊" "息,``help pdb`` 會顯示完整文件(即 :mod:`pdb` 模組的說明字串 (docstring))。" -"由於 *command* 引數必須是一個識別字 (identifier),若要獲取 ``!`` 命令的幫助訊" +"由於 *command* 引數必須是一個識別字 (identifier),若要取得 ``!`` 命令的幫助訊" "息則必須輸入 ``help exec``。" -#: ../../library/pdb.rst:326 +#: ../../library/pdb.rst:337 msgid "" "Print a stack trace, with the most recent frame at the bottom. An arrow " "(``>``) indicates the current frame, which determines the context of most " "commands." msgstr "" -"印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示當前的 frame,它" +"印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示目前的 frame,它" "也決定了大多數命令的情境。" -#: ../../library/pdb.rst:331 +#: ../../library/pdb.rst:342 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." msgstr "" -"在 stack trace 中,將當前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " +"在 stack trace 中,將目前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " "frame)。" -#: ../../library/pdb.rst:336 +#: ../../library/pdb.rst:347 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." msgstr "" -"在 stack trace 中,將當前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " +"在 stack trace 中,將目前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " "frame)。" -#: ../../library/pdb.rst:341 +#: ../../library/pdb.rst:352 msgid "" "With a *lineno* argument, set a break at line *lineno* in the current file. " "The line number may be prefixed with a *filename* and a colon, to specify a " "breakpoint in another file (possibly one that hasn't been loaded yet). The " "file is searched on :data:`sys.path`. Accepatable forms of *filename* are " -"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package." -"module``." +"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and " +"``package.module``." msgstr "" "如帶有 *lineno* 引數,則在目前檔案中的 *lineno* 列處設定中斷。列號可以以 " "*filename* 和冒號為前綴,以指定另一個檔案(可能是尚未載入的檔案)中的斷點。該" "檔案會在 :data:`sys.path` 上搜尋。可接受的 *filename* 形式為 ``/abspath/to/" "file.py``、``relpath/file.py``、``module`` 和 ``package.module``。" -#: ../../library/pdb.rst:348 +#: ../../library/pdb.rst:359 msgid "" "With a *function* argument, set a break at the first executable statement " "within that function. *function* can be any expression that evaluates to a " @@ -623,35 +635,35 @@ msgstr "" "如帶有 *function* 引數,在該函式內的第一個可執行陳述式處設定中斷。*function* " "可以是任何其求值結果為目前命名空間中函式的運算式。" -#: ../../library/pdb.rst:352 +#: ../../library/pdb.rst:363 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "如果第二個引數存在,它是一個運算式,在斷點生效前其必須求值為 true" -#: ../../library/pdb.rst:355 +#: ../../library/pdb.rst:366 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " "associated condition if any." msgstr "" -"如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、當前的忽" +"如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、目前的忽" "略次數以及關聯的條件(如存在)。" -#: ../../library/pdb.rst:359 +#: ../../library/pdb.rst:370 msgid "" "Each breakpoint is assigned a number to which all the other breakpoint " "commands refer." msgstr "每個斷點都有賦予一個編號,所有其他斷點命令都參照該編號。" -#: ../../library/pdb.rst:364 +#: ../../library/pdb.rst:375 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" "臨時斷點,在第一次遇見時會自動被刪除。它的引數與 :pdbcmd:`break` 相同。" -#: ../../library/pdb.rst:369 +#: ../../library/pdb.rst:380 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " @@ -660,7 +672,7 @@ msgstr "" "如帶有 *filename:lineno* 引數,則清除此列上的所有斷點。如果引數是空格分隔的斷" "點編號列表,則清除這些斷點。如果不帶引數則清除所有斷點(但會先提示確認)。" -#: ../../library/pdb.rst:375 +#: ../../library/pdb.rst:386 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -670,11 +682,11 @@ msgstr "" "停用斷點,斷點以空格分隔的斷點編號列表來給定。停用斷點表示它不會導致程式停止" "執行,但是與清除斷點不同,停用的斷點將保留在斷點列表中並且可以(重新)啟用。" -#: ../../library/pdb.rst:382 +#: ../../library/pdb.rst:393 msgid "Enable the breakpoints specified." msgstr "啟用指定的斷點。" -#: ../../library/pdb.rst:386 +#: ../../library/pdb.rst:397 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -686,7 +698,7 @@ msgstr "" "為 0 時,斷點將變為有效狀態。當非 0 時,每次到達斷點,且斷點沒有被禁用,且任" "何關聯的條件被求值為 true,則 *count* 就會遞減。" -#: ../../library/pdb.rst:394 +#: ../../library/pdb.rst:405 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " @@ -695,7 +707,7 @@ msgstr "" "為斷點設定一個新 *condition*,為一個運算式,且其求值結果為 true 時斷點才會起" "作用。如果沒有給定 *condition*,則刪除任何現有條件,也就是不為斷點設定條件。" -#: ../../library/pdb.rst:400 +#: ../../library/pdb.rst:411 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " @@ -704,7 +716,7 @@ msgstr "" "為編號是 *bpnumber* 的斷點指定一系列命令。命令內容出現在後續的幾列中。輸入僅" "包含 ``end`` 的一列來結束命令列表。例如: ::" -#: ../../library/pdb.rst:404 +#: ../../library/pdb.rst:415 msgid "" "(Pdb) commands 1\n" "(com) p some_variable\n" @@ -716,7 +728,7 @@ msgstr "" "(com) end\n" "(Pdb)" -#: ../../library/pdb.rst:409 +#: ../../library/pdb.rst:420 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." @@ -724,37 +736,37 @@ msgstr "" "要刪除斷點上的所有命令,請輸入 ``commands`` 並立即以 ``end`` 結尾,也就是不指" "定任何命令。" -#: ../../library/pdb.rst:412 +#: ../../library/pdb.rst:423 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "不帶有 *bpnumber* 引數則 ``commands`` 會關聯到上一個設定的斷點。" -#: ../../library/pdb.rst:414 +#: ../../library/pdb.rst:425 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" -"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` 或 :pdbcmd:" -"`step` 命令,或其他可以繼續執行程式的命令。" +"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` " +"或 :pdbcmd:`step` 命令,或其他可以繼續執行程式的命令。" -#: ../../library/pdb.rst:418 +#: ../../library/pdb.rst:429 msgid "" -"Specifying any command resuming execution (currently :pdbcmd:`continue`, :" -"pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:" -"`quit` and their abbreviations) terminates the command list (as if that " -"command was immediately followed by end). This is because any time you " -"resume execution (even with a simple next or step), you may encounter " -"another breakpoint—which could have its own command list, leading to " -"ambiguities about which list to execute." +"Specifying any command resuming execution " +"(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:`quit` " +"and their abbreviations) terminates the command list (as if that command was " +"immediately followed by end). This is because any time you resume execution " +"(even with a simple next or step), you may encounter another breakpoint—" +"which could have its own command list, leading to ambiguities about which " +"list to execute." msgstr "" -"如果指定了某個繼續執行程式的命令(目前包括 :pdbcmd:`continue`、:pdbcmd:" -"`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` 及它" -"們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續執行" -"下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有自己" -"的命令列表,這會導致無法確定要執行哪個列表。" +"如果指定了某個繼續執行程式的命令(目前包" +"括 :pdbcmd:`continue`、:pdbcmd:`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` " +"及它們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續" +"執行下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有" +"自己的命令列表,這會導致無法確定要執行哪個列表。" -#: ../../library/pdb.rst:427 +#: ../../library/pdb.rst:438 msgid "" "If you use the ``silent`` command in the command list, the usual message " "about stopping at a breakpoint is not printed. This may be desirable for " @@ -766,15 +778,15 @@ msgstr "" "息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。如果" "其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" -#: ../../library/pdb.rst:434 +#: ../../library/pdb.rst:445 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" -"執行當前列,在第一個可以停止的位置(在被呼叫的函式內部或在當前函式的下一列)" +"執行目前列,在第一個可以停止的位置(在被呼叫的函式內部或在目前函式的下一列)" "停止。" -#: ../../library/pdb.rst:439 +#: ../../library/pdb.rst:450 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -782,39 +794,39 @@ msgid "" "executes called functions at (nearly) full speed, only stopping at the next " "line in the current function.)" msgstr "" -"繼續執行,直至執行到當前函式的下一列或者當前函式回傳為止。(:pdbcmd:`next` " +"繼續執行,直至執行到目前函式的下一列或者目前函式回傳為止。(:pdbcmd:`next` " "和 :pdbcmd:`step` 之間的區別在於 :pdbcmd:`step` 會在被呼叫函式的內部停止、" -"而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在當前函式的下一列停" +"而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在目前函式的下一列停" "止。)" -#: ../../library/pdb.rst:447 +#: ../../library/pdb.rst:458 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." -msgstr "如果不帶引數則繼續執行,直到列號比當前的列大時停止。" +msgstr "如果不帶引數則繼續執行,直到列號比目前的列大時停止。" -#: ../../library/pdb.rst:450 +#: ../../library/pdb.rst:461 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " "frame returns." msgstr "" "如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" -"種情況下,當前 frame 回傳時也會停止。" +"種情況下,目前 frame 回傳時也會停止。" -#: ../../library/pdb.rst:454 +#: ../../library/pdb.rst:465 msgid "Allow giving an explicit line number." msgstr "允許明確給定一個列號。" -#: ../../library/pdb.rst:459 +#: ../../library/pdb.rst:470 msgid "Continue execution until the current function returns." msgstr "繼續執行,直到目前的函式回傳。" -#: ../../library/pdb.rst:463 +#: ../../library/pdb.rst:474 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "繼續執行,除非遇到斷點才停下來。" -#: ../../library/pdb.rst:467 +#: ../../library/pdb.rst:478 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " @@ -823,16 +835,16 @@ msgstr "" "設定即將執行的下一列,僅可用於堆疊中最底部的 frame。這讓你可以跳回去並再次執" "行程式碼,或者往前跳以跳過不想執行的程式碼。" -#: ../../library/pdb.rst:471 +#: ../../library/pdb.rst:482 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " -"possible to jump into the middle of a :keyword:`for` loop or out of a :" -"keyword:`finally` clause." +"possible to jump into the middle of a :keyword:`for` loop or out of " +"a :keyword:`finally` clause." msgstr "" "需要注意的是,不是所有的跳轉都是被允許的 -- 例如不能跳轉到 :keyword:`for` 迴" "圈的中間或跳出 :keyword:`finally` 子句。" -#: ../../library/pdb.rst:477 +#: ../../library/pdb.rst:488 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -840,49 +852,49 @@ msgid "" "lines around at that line. With two arguments, list the given range; if the " "second argument is less than the first, it is interpreted as a count." msgstr "" -"列出當前檔案的原始碼。如果不帶引數,則列出當前列周圍的 11 列,或繼續先前的列" -"表操作。如果用 ``.`` 作為引數,則列出當前列周圍的 11 列。如果帶有一個引數,則" +"列出目前檔案的原始碼。如果不帶引數,則列出目前列周圍的 11 列,或繼續先前的列" +"表操作。如果用 ``.`` 作為引數,則列出目前列周圍的 11 列。如果帶有一個引數,則" "列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" "個引數小於第一個引數,則將其直譯為要列出的列數。" -#: ../../library/pdb.rst:483 +#: ../../library/pdb.rst:494 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " "raised or propagated is indicated by ``>>``, if it differs from the current " "line." msgstr "" -"當前 frame 中的當前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" -"該例外的那一列不是當前列,則會用 ``>>`` 來標記該列。" +"目前 frame 中的目前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" +"該例外的那一列不是目前列,則會用 ``>>`` 來標記該列。" -#: ../../library/pdb.rst:488 +#: ../../library/pdb.rst:499 msgid "Added the ``>>`` marker." msgstr "新增了 ``>>`` 標記。" -#: ../../library/pdb.rst:493 +#: ../../library/pdb.rst:504 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" -"列出當前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" +"列出目前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" -#: ../../library/pdb.rst:500 +#: ../../library/pdb.rst:511 msgid "Print the arguments of the current function and their current values." -msgstr "印出當前函式的引數及它們當前的值。" +msgstr "印出目前函式的引數及它們目前的值。" -#: ../../library/pdb.rst:504 +#: ../../library/pdb.rst:515 msgid "Evaluate *expression* in the current context and print its value." -msgstr "在當前情境中為 *expression* 求值並印出其值。" +msgstr "在目前情境中為 *expression* 求值並印出其值。" -#: ../../library/pdb.rst:508 +#: ../../library/pdb.rst:519 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" -"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 Python :func:" -"`print` 函式。" +"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 " +"Python :func:`print` 函式。" -#: ../../library/pdb.rst:514 +#: ../../library/pdb.rst:525 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." @@ -890,39 +902,39 @@ msgstr "" "與 :pdbcmd:`p` 命令類似,除了 *expression* 的值是使用 :mod:`pprint` 模組美化" "後印出來的。" -#: ../../library/pdb.rst:519 +#: ../../library/pdb.rst:530 msgid "Print the type of *expression*." msgstr "印出 *expression* 的型別。" -#: ../../library/pdb.rst:523 +#: ../../library/pdb.rst:534 msgid "Try to get source code of *expression* and display it." -msgstr "嘗試獲取 *expression* 的原始碼並顯示它。" +msgstr "嘗試取得 *expression* 的原始碼並顯示它。" -#: ../../library/pdb.rst:529 +#: ../../library/pdb.rst:540 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." -msgstr "每次在當前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" +msgstr "每次在目前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" -#: ../../library/pdb.rst:532 +#: ../../library/pdb.rst:543 msgid "" "Without *expression*, list all display expressions for the current frame." -msgstr "如果不帶有 *expression*,則列出當前 frame 的所有運算式。" +msgstr "如果不帶有 *expression*,則列出目前 frame 的所有運算式。" -#: ../../library/pdb.rst:536 +#: ../../library/pdb.rst:547 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " "be able to pick up the changes." msgstr "" "display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" -"較,因此當結果可變時,display 可能無法獲取其變更。" +"較,因此當結果可變時,display 可能無法取得其變更。" -#: ../../library/pdb.rst:540 ../../library/pdb.rst:690 +#: ../../library/pdb.rst:551 ../../library/pdb.rst:701 msgid "Example::" msgstr "範例如下: ::" -#: ../../library/pdb.rst:542 +#: ../../library/pdb.rst:553 msgid "" "lst = []\n" "breakpoint()\n" @@ -936,15 +948,15 @@ msgstr "" "lst.append(1)\n" "print(lst)" -#: ../../library/pdb.rst:548 +#: ../../library/pdb.rst:559 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" -"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 ``lst." -"append(1)`` 原地 (in place) 修改: ::" +"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 " +"``lst.append(1)`` 原地 (in place) 修改: ::" -#: ../../library/pdb.rst:551 +#: ../../library/pdb.rst:562 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -970,11 +982,11 @@ msgstr "" "-> print(lst)\n" "(Pdb)" -#: ../../library/pdb.rst:563 +#: ../../library/pdb.rst:574 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "你可以運用複製機制的一些技巧來使其能夠運作: ::" -#: ../../library/pdb.rst:565 +#: ../../library/pdb.rst:576 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -1002,15 +1014,15 @@ msgstr "" "display lst[:]: [1] [old: []]\n" "(Pdb)" -#: ../../library/pdb.rst:582 +#: ../../library/pdb.rst:593 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." msgstr "" -"不再顯示當前 frame 中的 *expression*。如果不帶有 *expression*,則清除當前 " +"不再顯示目前 frame 中的 *expression*。如果不帶有 *expression*,則清除目前 " "frame 的所有顯示運算式。" -#: ../../library/pdb.rst:589 +#: ../../library/pdb.rst:600 msgid "" "Start an interactive interpreter (using the :mod:`code` module) in a new " "global namespace initialised from the local and global namespaces for the " @@ -1021,7 +1033,7 @@ msgstr "" "(使用 :mod:`code` 模組)。可使用 ``exit()`` 或 ``quit()`` 退出直譯器並回到偵" "錯器。" -#: ../../library/pdb.rst:596 +#: ../../library/pdb.rst:607 msgid "" "As ``interact`` creates a new dedicated namespace for code execution, " "assignments to variables will not affect the original namespaces. However, " @@ -1032,20 +1044,20 @@ msgstr "" "影響原始命名空間,但是對任何被參照的可變物件的修改將像往常一樣反映在原始命名" "空間中。" -#: ../../library/pdb.rst:603 +#: ../../library/pdb.rst:614 msgid "" "``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." msgstr "``exit()`` 和 ``quit()`` 可用來退出 :pdbcmd:`interact` 命令。" -#: ../../library/pdb.rst:607 +#: ../../library/pdb.rst:618 msgid "" ":pdbcmd:`interact` directs its output to the debugger's output channel " "rather than :data:`sys.stderr`." msgstr "" -":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不是 :" -"data:`sys.stderr`。" +":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不" +"是 :data:`sys.stderr`。" -#: ../../library/pdb.rst:615 +#: ../../library/pdb.rst:626 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " @@ -1058,7 +1070,7 @@ msgstr "" "有參數替換。如果省略 *command*,則顯示 *name* 的目前別名。如果未給定引數,則" "列出所有別名。" -#: ../../library/pdb.rst:621 +#: ../../library/pdb.rst:632 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -1070,14 +1082,14 @@ msgstr "" "部 pdb 命令\\ *可以*\\ 被別名所覆蓋。這樣的命令在別名被移除前都將被隱藏。別名" "會遞迴地應用到命令列的第一個單詞;該列內的其他單詞則不會受影響。" -#: ../../library/pdb.rst:627 +#: ../../library/pdb.rst:638 msgid "" -"As an example, here are two useful aliases (especially when placed in the :" -"file:`.pdbrc` file)::" +"As an example, here are two useful aliases (especially when placed in " +"the :file:`.pdbrc` file)::" msgstr "" "作為範例,這裡列出了兩個有用的別名(特別是放在 :file:`.pdbrc` 檔案中時): ::" -#: ../../library/pdb.rst:630 +#: ../../library/pdb.rst:641 msgid "" "# Print instance variables (usage \"pi classInst\")\n" "alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" @@ -1089,20 +1101,20 @@ msgstr "" "# 印出 self 中的實例變數\n" "alias ps pi self" -#: ../../library/pdb.rst:637 +#: ../../library/pdb.rst:648 msgid "Delete the specified alias *name*." msgstr "刪除指定的別名 *name*。" -#: ../../library/pdb.rst:641 +#: ../../library/pdb.rst:652 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " "statement resembles a debugger command, e.g.:" msgstr "" -"在當前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" +"在目前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" "類似於偵錯器命令,否則可以省略驚嘆號,例如:" -#: ../../library/pdb.rst:645 +#: ../../library/pdb.rst:656 msgid "" "(Pdb) ! n=42\n" "(Pdb)" @@ -1110,15 +1122,15 @@ msgstr "" "(Pdb) ! n=42\n" "(Pdb)" -#: ../../library/pdb.rst:650 +#: ../../library/pdb.rst:661 msgid "" -"To set a global variable, you can prefix the assignment command with a :" -"keyword:`global` statement on the same line, e.g.:" +"To set a global variable, you can prefix the assignment command with " +"a :keyword:`global` statement on the same line, e.g.:" msgstr "" "要設定全域變數,你可以在同一列的賦值命令前面加上 :keyword:`global` 陳述式,例" "如:" -#: ../../library/pdb.rst:653 +#: ../../library/pdb.rst:664 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" @@ -1126,49 +1138,49 @@ msgstr "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" -#: ../../library/pdb.rst:661 +#: ../../library/pdb.rst:672 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " -"History, breakpoints, actions and debugger options are preserved. :pdbcmd:" -"`restart` is an alias for :pdbcmd:`run`." +"History, breakpoints, actions and debugger options are " +"preserved. :pdbcmd:`restart` is an alias for :pdbcmd:`run`." msgstr "" "重新啟動已偵錯完畢的 Python 程式。如果提供了 *args*,它將以 :mod:`shlex` 分" "割,並將結果用作新的 :data:`sys.argv`。歷史記錄、斷點、操作和偵錯器選項均會被" "保留。:pdbcmd:`restart` 是 :pdbcmd:`run` 的別名。" -#: ../../library/pdb.rst:668 +#: ../../library/pdb.rst:679 msgid "Quit from the debugger. The program being executed is aborted." msgstr "離開偵錯器,執行中的程式會被中止。" -#: ../../library/pdb.rst:672 +#: ../../library/pdb.rst:683 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." msgstr "" -"進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在當前環境中執行的任意運算式或" +"進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在目前環境中執行的任意運算式或" "陳述式)。" -#: ../../library/pdb.rst:678 +#: ../../library/pdb.rst:689 msgid "Print the return value for the last return of the current function." -msgstr "印出當前函式最後一次回傳的回傳值。" +msgstr "印出目前函式最後一次回傳的回傳值。" -#: ../../library/pdb.rst:682 +#: ../../library/pdb.rst:693 msgid "List or jump between chained exceptions." msgstr "列出鏈接例外 (chained exceptions),或在其間跳轉。" -#: ../../library/pdb.rst:684 +#: ../../library/pdb.rst:695 msgid "" "When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " "exception instead of a traceback, it allows the user to move between the " "chained exceptions using ``exceptions`` command to list exceptions, and " -"``exception `` to switch to that exception." +"``exceptions `` to switch to that exception." msgstr "" "當使用 ``pdb.pm()`` 或 ``Pdb.post_mortem(...)`` 於鏈接例外而不是回溯時,它允" "許使用者在鏈接例外之間移動,使用 ``exceptions`` 命令以列出例外,並使用 " -"``exception `` 切換到該例外。" +"``exceptions `` 切換到該例外。" -#: ../../library/pdb.rst:692 +#: ../../library/pdb.rst:703 msgid "" "def out():\n" " try:\n" @@ -1204,11 +1216,11 @@ msgstr "" "\n" " out()" -#: ../../library/pdb.rst:709 +#: ../../library/pdb.rst:720 msgid "calling ``pdb.pm()`` will allow to move between exceptions::" msgstr "呼叫 ``pdb.pm()`` 將允許在例外之間移動: ::" -#: ../../library/pdb.rst:711 +#: ../../library/pdb.rst:722 msgid "" "> example.py(5)out()\n" "-> raise ValueError(\"reraise middle() error\") from e\n" @@ -1242,11 +1254,11 @@ msgstr "" "> example.py(10)middle()\n" "-> return inner(0)" -#: ../../library/pdb.rst:730 +#: ../../library/pdb.rst:741 msgid "Footnotes" msgstr "註腳" -#: ../../library/pdb.rst:731 +#: ../../library/pdb.rst:742 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -1274,18 +1286,21 @@ msgstr "bdb" msgid "cmd" msgstr "cmd" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:306 msgid ".pdbrc" msgstr ".pdbrc" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:306 msgid "file" msgstr "file(檔案)" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:306 msgid "debugger" msgstr "debugger(偵錯器)" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:306 msgid "configuration" msgstr "configuration(設定)" + +#~ msgid "python -m pdb myscript.py" +#~ msgstr "python -m pdb myscript.py" diff --git a/library/persistence.po b/library/persistence.po index b655269a25..7e6edefbbd 100644 --- a/library/persistence.po +++ b/library/persistence.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -30,6 +29,10 @@ msgid "" "objects from the bytes. The various DBM-related modules support a family of " "hash-based file formats that store a mapping of strings to other strings." msgstr "" +"本章節所描述的模組支援將 Python 資料以持久形式儲存在磁碟上。:mod:`pickle` " +"和 :mod:`marshal` 模組可以將許多 Python 資料型別轉換為位元串流,然後再從位元" +"串流重建物件。各種與 DBM 有關的模組支援一系列基於雜湊的檔案格式,用來儲存字串" +"對字串的對映。" #: ../../library/persistence.rst:13 msgid "The list of modules described in this chapter is:" diff --git a/library/pickle.po b/library/pickle.po index 4846877e33..5c8035fb3f 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -39,9 +39,9 @@ msgid "" "The :mod:`pickle` module implements binary protocols for serializing and de-" "serializing a Python object structure. *\"Pickling\"* is the process " "whereby a Python object hierarchy is converted into a byte stream, and " -"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a :" -"term:`binary file` or :term:`bytes-like object`) is converted back into an " -"object hierarchy. Pickling (and unpickling) is alternatively known as " +"*\"unpickling\"* is the inverse operation, whereby a byte stream (from " +"a :term:`binary file` or :term:`bytes-like object`) is converted back into " +"an object hierarchy. Pickling (and unpickling) is alternatively known as " "\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " "avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." msgstr "" @@ -55,7 +55,7 @@ msgstr "" #: ../../library/pickle.rst:33 msgid "The ``pickle`` module **is not secure**. Only unpickle data you trust." -msgstr "``pickle`` 模組**並不安全**,切記只拆封你信任的資料。" +msgstr "``pickle`` 模組\\ **並不安全**,切記只拆封你信任的資料。" #: ../../library/pickle.rst:35 msgid "" @@ -63,8 +63,8 @@ msgid "" "arbitrary code during unpickling**. Never unpickle data that could have come " "from an untrusted source, or that could have been tampered with." msgstr "" -"pickle 封包是有可能被建立來在拆封的時候**執行任意惡意程式碼**的。絕對不要拆封" -"任何你無法信任其來源、或可能被修改過的 pickle 封包。" +"pickle 封包是有可能被建立來在拆封的時候\\ **執行任意惡意程式碼**\\ 的。絕對不" +"要拆封任何你無法信任其來源、或可能被修改過的 pickle 封包。" #: ../../library/pickle.rst:39 msgid "" @@ -92,12 +92,12 @@ msgstr "和 ``marshal`` 的比較" msgid "" "Python has a more primitive serialization module called :mod:`marshal`, but " "in general :mod:`pickle` should always be the preferred way to serialize " -"Python objects. :mod:`marshal` exists primarily to support Python's :file:`." -"pyc` files." +"Python objects. :mod:`marshal` exists primarily to support " +"Python's :file:`.pyc` files." msgstr "" "Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" -"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使用 :mod:" -"`pickle`,沒事不要用 :mod:`marshal`。" +"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使" +"用 :mod:`pickle`,沒事不要用 :mod:`marshal`。" #: ../../library/pickle.rst:57 msgid "" @@ -128,9 +128,9 @@ msgid "" msgstr "" "這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " "marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" -"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照時。:mod:" -"`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。" -"共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" +"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照" +"時。:mod:`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主" +"要的版本。共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" #: ../../library/pickle.rst:72 msgid "" @@ -146,14 +146,14 @@ msgstr "" #: ../../library/pickle.rst:77 msgid "" "The :mod:`marshal` serialization format is not guaranteed to be portable " -"across Python versions. Because its primary job in life is to support :file:" -"`.pyc` files, the Python implementers reserve the right to change the " -"serialization format in non-backwards compatible ways should the need arise. " -"The :mod:`pickle` serialization format is guaranteed to be backwards " -"compatible across Python releases provided a compatible pickle protocol is " -"chosen and pickling and unpickling code deals with Python 2 to Python 3 type " -"differences if your data is crossing that unique breaking change language " -"boundary." +"across Python versions. Because its primary job in life is to " +"support :file:`.pyc` files, the Python implementers reserve the right to " +"change the serialization format in non-backwards compatible ways should the " +"need arise. The :mod:`pickle` serialization format is guaranteed to be " +"backwards compatible across Python releases provided a compatible pickle " +"protocol is chosen and pickling and unpickling code deals with Python 2 to " +"Python 3 type differences if your data is crossing that unique breaking " +"change language boundary." msgstr "" ":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的" "作用是支援 :file:`.pyc` 檔案的運作,Python 的實作人員會在需要時實作無法前向相" @@ -205,8 +205,8 @@ msgid "" "JSON, by default, can only represent a subset of the Python built-in types, " "and no custom classes; pickle can represent an extremely large number of " "Python types (many of them automatically, by clever usage of Python's " -"introspection facilities; complex cases can be tackled by implementing :ref:" -"`specific object APIs `);" +"introspection facilities; complex cases can be tackled by " +"implementing :ref:`specific object APIs `);" msgstr "" "預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" "透過 Python 的自省措施,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" @@ -258,8 +258,9 @@ msgid "" "generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " "comments about opcodes used by pickle protocols." msgstr "" -":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:" -"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" +":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料" +"流。:mod:`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼" +"(opcode)。" #: ../../library/pickle.rst:139 msgid "" @@ -295,9 +296,9 @@ msgstr "" #: ../../library/pickle.rst:153 msgid "" -"Protocol version 3 was added in Python 3.0. It has explicit support for :" -"class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " -"default protocol in Python 3.0--3.7." +"Protocol version 3 was added in Python 3.0. It has explicit support " +"for :class:`bytes` objects and cannot be unpickled by Python 2.x. This was " +"the default protocol in Python 3.0--3.7." msgstr "" "版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法" "被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" @@ -331,9 +332,9 @@ msgstr "" # persistence-layer/ #: ../../library/pickle.rst:168 msgid "" -"Serialization is a more primitive notion than persistence; although :mod:" -"`pickle` reads and writes file objects, it does not handle the issue of " -"naming persistent objects, nor the (even more complicated) issue of " +"Serialization is a more primitive notion than persistence; " +"although :mod:`pickle` reads and writes file objects, it does not handle the " +"issue of naming persistent objects, nor the (even more complicated) issue of " "concurrent access to persistent objects. The :mod:`pickle` module can " "transform a complex object into a byte stream and it can transform the byte " "stream into an object with the same internal structure. Perhaps the most " @@ -357,15 +358,15 @@ msgstr "模組介面" #: ../../library/pickle.rst:183 msgid "" "To serialize an object hierarchy, you simply call the :func:`dumps` " -"function. Similarly, to de-serialize a data stream, you call the :func:" -"`loads` function. However, if you want more control over serialization and " -"de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " -"object, respectively." +"function. Similarly, to de-serialize a data stream, you call " +"the :func:`loads` function. However, if you want more control over " +"serialization and de-serialization, you can create a :class:`Pickler` or " +"an :class:`Unpickler` object, respectively." msgstr "" "想要序列化一個物件,你只需要呼叫 :func:`dumps` 函式。而當你想要去序列化一個資" "料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" -"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" -"`Unpickler` 物件。" +"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` " +"或 :class:`Unpickler` 物件。" #: ../../library/pickle.rst:188 msgid "The :mod:`pickle` module provides the following constants:" @@ -374,12 +375,13 @@ msgstr ":mod:`pickle` 模組提供以下常數:" #: ../../library/pickle.rst:193 msgid "" "An integer, the highest :ref:`protocol version ` " -"available. This value can be passed as a *protocol* value to functions :" -"func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." +"available. This value can be passed as a *protocol* value to " +"functions :func:`dump` and :func:`dumps` as well as the :class:`Pickler` " +"constructor." msgstr "" "一個整數,表示可使用的最高\\ :ref:`協定版本 `。這個值可作" -"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以及 :class:" -"`Pickler` 建構式。" +"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以" +"及 :class:`Pickler` 建構式。" #: ../../library/pickle.rst:200 msgid "" @@ -419,8 +421,8 @@ msgid "" "Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " "same meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義與 :class:" -"`Pickler` 建構式中的相同。" +"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義" +"與 :class:`Pickler` 建構式中的相同。" #: ../../library/pickle.rst:225 ../../library/pickle.rst:236 #: ../../library/pickle.rst:328 @@ -440,8 +442,8 @@ msgid "" "Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " "meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義和 :class:" -"`Pickler` 建構式中的相同。" +"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義" +"和 :class:`Pickler` 建構式中的相同。" #: ../../library/pickle.rst:241 msgid "" @@ -487,8 +489,8 @@ msgid "" "Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " "the same meaning as in the :class:`Unpickler` constructor." msgstr "" -"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義與 :" -"class:`Unpickler` 建構式所用的相同。" +"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義" +"與 :class:`Unpickler` 建構式所用的相同。" #: ../../library/pickle.rst:271 msgid "The :mod:`pickle` module defines three exceptions:" @@ -496,8 +498,8 @@ msgstr ":mod:`pickle` 模組定義了以下三種例外:" #: ../../library/pickle.rst:275 msgid "" -"Common base class for the other pickling exceptions. It inherits from :exc:" -"`Exception`." +"Common base class for the other pickling exceptions. It inherits " +"from :exc:`Exception`." msgstr "" "繼承 :exc:`Exception` 類別。一個在封裝或拆封時遭遇其他例外時通用的基底類別。" @@ -520,8 +522,8 @@ msgid "" "Error raised when there is a problem unpickling an object, such as a data " "corruption or a security violation. It inherits from :exc:`PickleError`." msgstr "" -"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承自 :exc:" -"`PickleError` 類別。" +"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承" +"自 :exc:`PickleError` 類別。" #: ../../library/pickle.rst:291 msgid "" @@ -534,11 +536,11 @@ msgstr "" #: ../../library/pickle.rst:296 msgid "" -"The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" -"`Unpickler` and :class:`PickleBuffer`:" +"The :mod:`pickle` module exports three " +"classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:" msgstr "" -"引入模組 :mod:`pickle` 時會帶來三個類別::class:`Pickler`、:class:" -"`Unpickler` 和 :class:`PickleBuffer`:" +"引入模組 :mod:`pickle` 時會帶來三個類" +"別::class:`Pickler`、:class:`Unpickler` 和 :class:`PickleBuffer`:" #: ../../library/pickle.rst:301 msgid "This takes a binary file for writing a pickle data stream." @@ -552,19 +554,20 @@ msgid "" "number is specified, :data:`HIGHEST_PROTOCOL` is selected." msgstr "" "可選引數 *protocol* 接受整數,用來要求封裝器(pickler)使用指定的協定;支援" -"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設為 :data:" -"`DEFAULT_PROTOCOL`。若指定了負數,則視為選擇 :data:`HIGHEST_PROTOCOL`。" +"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設" +"為 :data:`DEFAULT_PROTOCOL`。若指定了負數,則視為選" +"擇 :data:`HIGHEST_PROTOCOL`。" #: ../../library/pickle.rst:308 msgid "" "The *file* argument must have a write() method that accepts a single bytes " -"argument. It can thus be an on-disk file opened for binary writing, an :" -"class:`io.BytesIO` instance, or any other custom object that meets this " +"argument. It can thus be an on-disk file opened for binary writing, " +"an :class:`io.BytesIO` instance, or any other custom object that meets this " "interface." msgstr "" -"傳予引數 *file* 的物件必須支援可寫入單一位元組的 write() 方法。只要滿足此條" -"件,傳入的物件可以是一個硬碟上二進位檔案、一個 :class:`io.BytesIO` 實例或任何" -"其他滿足這個介面要求的物件。" +"引數 *file* 必須支援可寫入單一位元組引數的 write() 方法。只要滿足此條件,傳入" +"的物件可以是一個硬碟上二進位檔案、一個 :class:`io.BytesIO` 實例或任何其他滿足" +"這個介面要求的物件。" #: ../../library/pickle.rst:313 msgid "" @@ -585,8 +588,8 @@ msgid "" "If *buffer_callback* is ``None`` (the default), buffer views are serialized " "into *file* as part of the pickle stream." msgstr "" -"如果 *buffer_callback* 是 ``None`` (預設值),緩衝區的視圖會作為 pickle 封裝" -"串流的一部分被序列化進 *file* 中。" +"如果 *buffer_callback* 是 ``None``\\ (預設值),緩衝區的視圖會作為 pickle 封" +"裝串流的一部分被序列化進 *file* 中。" #: ../../library/pickle.rst:320 msgid "" @@ -639,8 +642,8 @@ msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" #: ../../library/pickle.rst:348 msgid "" -"Add the default implementation of this method in the C implementation of :" -"class:`!Pickler`." +"Add the default implementation of this method in the C implementation " +"of :class:`!Pickler`." msgstr "在 C 的 :class:`!Pickler` 實作中的增加了這個方法的預設實作。" # SkyLull: [T] @@ -658,20 +661,20 @@ msgid "" "reduction function takes a single argument of the associated class and " "should conform to the same interface as a :meth:`~object.__reduce__` method." msgstr "" -"封裝器(pickler)物件含有的的調度表是一個 *縮減函式* (reduction function)的" -"註冊表,可以使用 :func:`copyreg.pickle` 來宣告這類縮減函式。它是一個以類別為" -"鍵、還原函式為值的映射表。縮減函式應準備接收一個對應類別的引數,並應遵循與 :" -"meth:`~object.__reduce__` 方法相同的介面。" +"封裝器(pickler)物件含有的的調度表是一個\\ *縮減函式*\\ (reduction " +"function)的註冊表,可以使用 :func:`copyreg.pickle` 來宣告這類縮減函式。它是" +"一個以類別為鍵、還原函式為值的映射表。縮減函式應準備接收一個對應類別的引數," +"並應遵循與 :meth:`~object.__reduce__` 方法相同的介面。" #: ../../library/pickle.rst:362 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " -"attribute, and it will instead use the global dispatch table managed by the :" -"mod:`copyreg` module. However, to customize the pickling for a specific " +"attribute, and it will instead use the global dispatch table managed by " +"the :mod:`copyreg` module. However, to customize the pickling for a specific " "pickler object one can set the :attr:`dispatch_table` attribute to a dict-" -"like object. Alternatively, if a subclass of :class:`Pickler` has a :attr:" -"`dispatch_table` attribute then this will be used as the default dispatch " -"table for instances of that class." +"like object. Alternatively, if a subclass of :class:`Pickler` has " +"a :attr:`dispatch_table` attribute then this will be used as the default " +"dispatch table for instances of that class." msgstr "" "預設情況下,封裝器(pickler)物件不會有 :attr:`dispatch_table` 屬性,而是會使" "用由 :mod:`copyreg` 模組管理的全域調度表。不過,若要自訂某個封裝器(pickler)" @@ -688,14 +691,14 @@ msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " "should conform to the same interface as a :meth:`~object.__reduce__` method, " -"and can optionally return :data:`NotImplemented` to fallback on :attr:" -"`dispatch_table`-registered reducers to pickle ``obj``." +"and can optionally return :data:`NotImplemented` to fallback " +"on :attr:`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" "一個可以在 :class:`Pickler` 子類別中被定義的縮減器(reducer)。這個方法的優先" -"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有和 :" -"meth:`~object.__reduce__` 方法相同的函數界面,且可以可選地回傳 :data:" -"`NotImplemented` 以退回(fallback)使用 :attr:`分派表 ` 中登" -"錄的縮減方法來封裝 ``obj``。" +"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有" +"和 :meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回" +"傳 :data:`NotImplemented` 以退回(fallback)使用 :attr:`分派表 " +"` 中登錄的縮減方法來封裝 ``obj``。" #: ../../library/pickle.rst:383 msgid "For a detailed example, see :ref:`reducer_override`." @@ -730,15 +733,15 @@ msgstr "協定版本號會被自動偵測,所以不需要在這邊手動輸入 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " -"readline() method that requires no arguments, as in the :class:`io." -"BufferedIOBase` interface. Thus *file* can be an on-disk file opened for " -"binary reading, an :class:`io.BytesIO` object, or any other custom object " -"that meets this interface." +"readline() method that requires no arguments, as in " +"the :class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk " +"file opened for binary reading, an :class:`io.BytesIO` object, or any other " +"custom object that meets this interface." msgstr "" "參數 *file* 必須擁有三個方法,分別是接受整數作為引數的 read() 方法、接受緩衝" -"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同在 :class:" -"`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取模式開啟的" -"檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" +"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同" +"在 :class:`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取" +"模式開啟的檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" #: ../../library/pickle.rst:412 msgid "" @@ -749,18 +752,18 @@ msgid "" "decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " "and 'strict', respectively. The *encoding* can be 'bytes' to read these 8-" "bit string instances as bytes objects. Using ``encoding='latin1'`` is " -"required for unpickling NumPy arrays and instances of :class:`~datetime." -"datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " -"Python 2." +"required for unpickling NumPy arrays and instances " +"of :class:`~datetime.datetime`, :class:`~datetime.date` " +"and :class:`~datetime.time` pickled by Python 2." msgstr "" "可選引數 *fix_imports*、*encoding* 和 *errors* 用來控制 Python 2 pickle 資料" "的相容性支援。如果 *fix_imports* 為 true,則 pickle 模組會嘗試將舊的 Python " "2 模組名稱映射到 Python 3 中使用的新名稱。*encoding* 和 *errors* 告訴 pickle " "模組如何解碼由 Python 2 pickle 封裝的 8 位元字串實例;*encoding* 和 *errors* " "預設分別為 'ASCII' 和 'strict'。*encoding* 可以設定為 'bytes' 以將這些 8 位元" -"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣列、:class:`~datetime." -"datetime`、:class:`~datetime.date` 和 :class:`~datetime.time` 的實例則必須使" -"用 ``encoding='latin1'`` 來拆封。" +"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣" +"列、:class:`~datetime.datetime`、:class:`~datetime.date` " +"和 :class:`~datetime.time` 的實例則必須使用 ``encoding='latin1'`` 來拆封。" #: ../../library/pickle.rst:423 msgid "" @@ -782,7 +785,7 @@ msgid "" msgstr "" "如果 *buffers* 不是 ``None``,則其應該是一個可疊代物件,內含數個支援緩衝區的" "物件,並且每當 pickle 串流引用一個\\ :ref:`帶外 `\\ 緩衝區視圖時" -"將會被照順序消耗。這些緩衝資料當初建立時應已按照順序給定予 Pickler 物件中的 " +"將會被照順序消耗。這些緩衝資料當初建立時應已按照順序給定於 Pickler 物件中的 " "*buffer_callback*。" #: ../../library/pickle.rst:438 @@ -796,22 +799,22 @@ msgstr "" #: ../../library/pickle.rst:445 msgid "Raise an :exc:`UnpicklingError` by default." -msgstr "預設會拋出 :exc:`UnpicklingError` 例外。" +msgstr "預設會引發 :exc:`UnpicklingError` 例外。" #: ../../library/pickle.rst:447 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " -"the persistent ID *pid*. If an invalid persistent ID is encountered, an :" -"exc:`UnpicklingError` should be raised." +"the persistent ID *pid*. If an invalid persistent ID is encountered, " +"an :exc:`UnpicklingError` should be raised." msgstr "" -"若有定義 :meth:`persistent_load`,則其將回傳符合持久化識別碼 `pid` 的物件。如" +"若有定義,則 :meth:`persistent_load` 將回傳符合持久化識別碼 *pid* 的物件。如" "果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。" #: ../../library/pickle.rst:453 msgid "" -"Add the default implementation of this method in the C implementation of :" -"class:`!Unpickler`." -msgstr "" +"Add the default implementation of this method in the C implementation " +"of :class:`!Unpickler`." +msgstr "在 C 的 :class:`!Unpickler` 實作中的增加了這個方法的預設實作。" #: ../../library/pickle.rst:459 msgid "" @@ -820,15 +823,15 @@ msgid "" "unlike its name suggests, :meth:`find_class` is also used for finding " "functions." msgstr "" -"如有需要將引入 *module* ,並從中返回名為 *name* 的物件,這裡的 *module* 和 " -"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :" -"meth:`find_class` 亦可被用於尋找其他函式。" +"如有需要將引入 *module*,並從中回傳名為 *name* 的物件,這裡的 *module* 和 " +"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像," +"但 :meth:`find_class` 亦可被用於尋找其他函式。" #: ../../library/pickle.rst:464 msgid "" "Subclasses may override this to gain control over what type of objects and " -"how they can be loaded, potentially reducing security risks. Refer to :ref:" -"`pickle-restrict` for details." +"how they can be loaded, potentially reducing security risks. Refer " +"to :ref:`pickle-restrict` for details." msgstr "" "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在" "地降低安全性風險。詳情請參考\\ :ref:`pickle-restrict`。" @@ -842,23 +845,23 @@ msgstr "" "``pickle.find_class``。" # SkyLull: [T] -# 參見 #729 +# 參見 #729 # wrapper -> 包裝器 #: ../../library/pickle.rst:472 msgid "" -"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" -"`buffer-providing ` object, such as a :term:`bytes-like " -"object` or a N-dimensional array." +"A wrapper for a buffer representing picklable data. *buffer* must be " +"a :ref:`buffer-providing ` object, such as a :term:`bytes-" +"like object` or a N-dimensional array." msgstr "" -"一個表示了含有可封裝數據緩衝區的包裝函數(wrapper function)。*buffer* 必須是" +"一個表示了含有可封裝資料緩衝區的包裝函式(wrapper function)。*buffer* 必須是" "一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件 " "` 或 N 維陣列。" #: ../../library/pickle.rst:476 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " -"to pass it to other APIs expecting a buffer-providing object, such as :class:" -"`memoryview`." +"to pass it to other APIs expecting a buffer-providing object, such " +"as :class:`memoryview`." msgstr "" ":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它" "「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。" @@ -883,7 +886,7 @@ msgid "" "``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is " "neither C- nor Fortran-contiguous." msgstr "" -"返回此緩衝區底層記憶體區域的 :class:`memoryview`。被返回的物件是一個(在 C 語" +"回傳此緩衝區底層記憶體區域的 :class:`memoryview`。被回傳的物件是一個(在 C 語" "言的 formatter 格式中)以 ``B`` (unsigned bytes) 二進位格式儲存、一維且列連續" "(C-contiguous)的 memoryview。如果緩衝區既不是列連續(C-contiguous)也不是行" "連續(Fortran-contiguous)的,則會引發 :exc:`BufferError`。" @@ -902,11 +905,11 @@ msgstr "下列型別可以被封裝:" #: ../../library/pickle.rst:505 msgid "" -"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" -"`NotImplemented`);" +"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, " +"and :data:`NotImplemented`);" msgstr "" -"內建常數(``None``、``True``、``False``、``Ellipsis`` 和 :data:" -"`NotImplemented`);" +"內建常數(``None``、``True``、``False``、``Ellipsis`` " +"和 :data:`NotImplemented`);" #: ../../library/pickle.rst:508 msgid "integers, floating-point numbers, complex numbers;" @@ -926,8 +929,8 @@ msgid "" "functions (built-in and user-defined) accessible from the top level of a " "module (using :keyword:`def`, not :keyword:`lambda`);" msgstr "" -"在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使用 :keyword:" -"`def` 定義的函式,:keyword:`lambda` 函式不適用);" +"在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使" +"用 :keyword:`def` 定義的函式,:keyword:`lambda` 函式不適用);" #: ../../library/pickle.rst:517 msgid "classes accessible from the top level of a module;" @@ -935,8 +938,9 @@ msgstr "在模組最表面的層級就能被存取的類別;" #: ../../library/pickle.rst:519 msgid "" -"instances of such classes whose the result of calling :meth:`~object." -"__getstate__` is picklable (see section :ref:`pickle-inst` for details)." +"instances of such classes whose the result of " +"calling :meth:`~object.__getstate__` is picklable (see section :ref:`pickle-" +"inst` for details)." msgstr "" "實例,只要在呼叫了 :meth:`~object.__getstate__` 後其回傳值全都是可封裝物件。" "(詳情請參閱 :ref:`pickle-inst`)。" @@ -946,9 +950,9 @@ msgid "" "Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " "exception; when this happens, an unspecified number of bytes may have " "already been written to the underlying file. Trying to pickle a highly " -"recursive data structure may exceed the maximum recursion depth, a :exc:" -"`RecursionError` will be raised in this case. You can carefully raise this " -"limit with :func:`sys.setrecursionlimit`." +"recursive data structure may exceed the maximum recursion depth, " +"a :exc:`RecursionError` will be raised in this case. You can carefully " +"raise this limit with :func:`sys.setrecursionlimit`." msgstr "" "嘗試封裝無法封裝的物件會引發 :exc:`PicklingError` 例外;注意當這種情況發生" "時,可能已經有未知數量的位元組已被寫入到檔案。嘗試封裝深度遞迴的資料結構可能" @@ -960,11 +964,11 @@ msgstr "" # qualified name -> 限定名稱 #: ../../library/pickle.rst:529 msgid "" -"Note that functions (built-in and user-defined) are pickled by fully :term:" -"`qualified name`, not by value. [#]_ This means that only the function name " -"is pickled, along with the name of the containing module and classes. " -"Neither the function's code, nor any of its function attributes are " -"pickled. Thus the defining module must be importable in the unpickling " +"Note that functions (built-in and user-defined) are pickled by " +"fully :term:`qualified name`, not by value. [#]_ This means that only the " +"function name is pickled, along with the name of the containing module and " +"classes. Neither the function's code, nor any of its function attributes " +"are pickled. Thus the defining module must be importable in the unpickling " "environment, and the module must contain the named object, otherwise an " "exception will be raised. [#]_" msgstr "" @@ -1011,12 +1015,12 @@ msgid "" "and still load objects that were created with an earlier version of the " "class. If you plan to have long-lived objects that will see many versions " "of a class, it may be worthwhile to put a version number in the objects so " -"that suitable conversions can be made by the class's :meth:`~object." -"__setstate__` method." +"that suitable conversions can be made by the " +"class's :meth:`~object.__setstate__` method." msgstr "" "同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有" "實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增" -"其他方法,且於此同時仍能夠載入使用較早期版本的類別所建立的物件實例。如果您預" +"其他方法,且於此同時仍能夠載入使用較早期版本的類別所建立的物件實例。如果你預" "計將有長期存在的物件、且該物件將經歷許多版本的更替,你可以在物件中存放一個版" "本號,以便未來能透過 :meth:`~object.__setstate__` 方法來進行適當的版本轉換。" @@ -1036,15 +1040,16 @@ msgstr "" msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " -"via introspection. When a class instance is unpickled, its :meth:`~object." -"__init__` method is usually *not* invoked. The default behaviour first " -"creates an uninitialized instance and then restores the saved attributes. " -"The following code shows an implementation of this behaviour::" +"via introspection. When a class instance is unpickled, " +"its :meth:`~object.__init__` method is usually *not* invoked. The default " +"behaviour first creates an uninitialized instance and then restores the " +"saved attributes. The following code shows an implementation of this " +"behaviour::" msgstr "" "大部分的實例不需要額外的程式碼就已經是可封裝的了。在這樣的預設狀況中,pickle " -"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時,其 :meth:" -"`~object.__init__` 方法通常*不會*被呼叫。預設行為首先會建立一個未初始化的實" -"例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為::" +"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時," +"其 :meth:`~object.__init__` 方法通常\\ *不會*\\ 被呼叫。預設行為首先會建立一" +"個未初始化的實例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為: ::" #: ../../library/pickle.rst:575 msgid "" @@ -1073,12 +1078,12 @@ msgstr "" #: ../../library/pickle.rst:588 msgid "" -"In protocols 2 and newer, classes that implements the :meth:" -"`__getnewargs_ex__` method can dictate the values passed to the :meth:" -"`__new__` method upon unpickling. The method must return a pair ``(args, " -"kwargs)`` where *args* is a tuple of positional arguments and *kwargs* a " -"dictionary of named arguments for constructing the object. Those will be " -"passed to the :meth:`__new__` method upon unpickling." +"In protocols 2 and newer, classes that implements " +"the :meth:`__getnewargs_ex__` method can dictate the values passed to " +"the :meth:`__new__` method upon unpickling. The method must return a pair " +"``(args, kwargs)`` where *args* is a tuple of positional arguments and " +"*kwargs* a dictionary of named arguments for constructing the object. Those " +"will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "在第 2 版協定或更新的版本中,有實作 :meth:`__getnewargs_ex__` 方法的類別,可" "以決定在拆封時要傳遞給 :meth:`__new__` 方法的值。該方法必須回傳一個 ``(args, " @@ -1105,8 +1110,8 @@ msgid "" "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "此方法與 :meth:`__getnewargs_ex__` 的目的一樣,但僅支援位置參數。它必須回傳一" -"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞給 :meth:" -"`__new__` 方法。" +"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞" +"給 :meth:`__new__` 方法。" #: ../../library/pickle.rst:610 msgid "" @@ -1117,8 +1122,8 @@ msgstr "" #: ../../library/pickle.rst:613 msgid "" -"Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" -"`__getnewargs_ex__` in protocols 2 and 3." +"Before Python 3.6, :meth:`__getnewargs__` was called instead " +"of :meth:`__getnewargs_ex__` in protocols 2 and 3." msgstr "" "在 Python 3.6 之前、版本 2 和版本 3 的協定中,會呼叫 :meth:`__getnewargs__` " "而非 :meth:`__getnewargs_ex__`。" @@ -1131,31 +1136,31 @@ msgid "" "are several cases:" msgstr "" "目標類別可以透過覆寫方法 :meth:`__getstate__` 進一步影響其實例被封裝的方式。" -"封裝時,呼叫該方法所返回的物件將作為該實例的內容被封裝、而非一個預設狀態。以" +"封裝時,呼叫該方法所回傳的物件將作為該實例的內容被封裝、而非一個預設狀態。以" "下列出幾種預設狀態:" #: ../../library/pickle.rst:625 msgid "" -"For a class that has no instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``None``." +"For a class that has no instance :attr:`~object.__dict__` and " +"no :attr:`~object.__slots__`, the default state is ``None``." msgstr "" "沒有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設" "狀態為 ``None``。" #: ../../library/pickle.rst:628 msgid "" -"For a class that has an instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``self.__dict__``." +"For a class that has an instance :attr:`~object.__dict__` and " +"no :attr:`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" "有 :attr:`~object.__dict__` 實例、但沒有 :attr:`~object.__slots__` 實例的類" "別,其預設狀態為 ``self.__dict__``。" #: ../../library/pickle.rst:631 msgid "" -"For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." -"__slots__`, the default state is a tuple consisting of two dictionaries: " -"``self.__dict__``, and a dictionary mapping slot names to slot values. Only " -"slots that have a value are included in the latter." +"For a class that has an instance :attr:`~object.__dict__` " +"and :attr:`~object.__slots__`, the default state is a tuple consisting of " +"two dictionaries: ``self.__dict__``, and a dictionary mapping slot names to " +"slot values. Only slots that have a value are included in the latter." msgstr "" "有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設狀" "態是一個含有兩個字典的元組(tuple),該二字典分別為 ``self.__dict__`` 本身," @@ -1164,10 +1169,10 @@ msgstr "" #: ../../library/pickle.rst:637 msgid "" -"For a class that has :attr:`~object.__slots__` and no instance :attr:" -"`~object.__dict__`, the default state is a tuple whose first item is " -"``None`` and whose second item is a dictionary mapping slot names to slot " -"values described in the previous bullet." +"For a class that has :attr:`~object.__slots__` and no " +"instance :attr:`~object.__dict__`, the default state is a tuple whose first " +"item is ``None`` and whose second item is a dictionary mapping slot names to " +"slot values described in the previous bullet." msgstr "" "沒有 :attr:`~object.__dict__` 但有 :attr:`~object.__slots__` 實例的類別,其預" "設狀態是一個二元組(tuple),元組中的第一個值是 ``None``,第二個值則是紀錄欄" @@ -1175,8 +1180,8 @@ msgstr "" #: ../../library/pickle.rst:642 msgid "" -"Added the default implementation of the ``__getstate__()`` method in the :" -"class:`object` class." +"Added the default implementation of the ``__getstate__()`` method in " +"the :class:`object` class." msgstr "在 :class:`object` 類別中增加預設的 ``__getstate__()`` 實作。" #: ../../library/pickle.rst:649 @@ -1192,61 +1197,64 @@ msgstr "" #: ../../library/pickle.rst:656 msgid "" -"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" -"meth:`__setstate__` method will not be called upon unpickling." +"If :meth:`__reduce__` returns a state with value ``None`` at pickling, " +"the :meth:`__setstate__` method will not be called upon unpickling." msgstr "" -"如果 :meth:`__reduce__` 在封裝時返回了 ``None`` 狀態,則拆封時就不會去呼叫 :" -"meth:`__setstate__`。" +"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼" +"叫 :meth:`__setstate__`。" #: ../../library/pickle.rst:660 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " -"use the methods :meth:`~object.__getstate__` and :meth:`~object." -"__setstate__`." +"use the methods :meth:`~object.__getstate__` " +"and :meth:`~object.__setstate__`." msgstr "" -"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` 和 :meth:" -"`~object.__setstate__` 的使用方法。" +"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` " +"和 :meth:`~object.__setstate__` 的使用方法。" #: ../../library/pickle.rst:665 msgid "" -"At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" -"`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " -"upon the instance. In case those methods rely on some internal invariant " -"being true, the type should implement :meth:`~object.__new__` to establish " -"such an invariant, as :meth:`~object.__init__` is not called when unpickling " -"an instance." +"At unpickling time, some methods " +"like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, " +"or :meth:`~object.__setattr__` may be called upon the instance. In case " +"those methods rely on some internal invariant being true, the type should " +"implement :meth:`~object.__new__` to establish such an invariant, " +"as :meth:`~object.__init__` is not called when unpickling an instance." msgstr "" -"在拆封時,某些方法如 :meth:`~object.__getattr__`、:meth:`~object." -"__getattribute__` 或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如" -"果這些方法依賴了某些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立" -"此不變性,因為在拆封實例時不會呼叫 :meth:`~object.__init__`。" +"在拆封時,某些方法" +"如 :meth:`~object.__getattr__`、:meth:`~object.__getattribute__` " +"或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如果這些方法依賴了某" +"些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立此不變性,因為在拆" +"封實例時不會呼叫 :meth:`~object.__init__`。" #: ../../library/pickle.rst:674 msgid "" "As we shall see, pickle does not use directly the methods described above. " -"In fact, these methods are part of the copy protocol which implements the :" -"meth:`~object.__reduce__` special method. The copy protocol provides a " +"In fact, these methods are part of the copy protocol which implements " +"the :meth:`~object.__reduce__` special method. The copy protocol provides a " "unified interface for retrieving the data necessary for pickling and copying " "objects. [#]_" msgstr "" -"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作了 :meth:" -"`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提供了統一" -"的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" +"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作" +"了 :meth:`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提" +"供了統一的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" #: ../../library/pickle.rst:680 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " -"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, :meth:" -"`~object.__getstate__` and :meth:`~object.__setstate__`) whenever possible. " -"We will show, however, cases where using :meth:`!__reduce__` is the only " -"option or leads to more efficient pickling or both." +"high-level interface " +"(i.e., :meth:`~object.__getnewargs_ex__`, :meth:`~object.__getstate__` " +"and :meth:`~object.__setstate__`) whenever possible. We will show, however, " +"cases where using :meth:`!__reduce__` is the only option or leads to more " +"efficient pickling or both." msgstr "" "直接在類別中實作 :meth:`~object.__reduce__` 雖然功能強大但卻容易導致出錯。因" -"此,設計類別者應盡可能使用高階介面(例如,:meth:`~object." -"__getnewargs_ex__`、:meth:`~object.__getstate__` 和 :meth:`~object." -"__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況中,使用 :meth:`!" -"__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼備。" +"此,設計類別者應盡可能使用高階介面(例" +"如,:meth:`~object.__getnewargs_ex__`、:meth:`~object.__getstate__` " +"和 :meth:`~object.__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況" +"中,使用 :meth:`!__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼" +"備。" #: ../../library/pickle.rst:689 msgid "" @@ -1274,14 +1282,14 @@ msgid "" "Optional items can either be omitted, or ``None`` can be provided as their " "value. The semantics of each item are in order:" msgstr "" -"當返回一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值" +"當回傳一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值" "可以被設為 ``None``。各項物件的語意依序為:" #: ../../library/pickle.rst:704 msgid "" "A callable object that will be called to create the initial version of the " "object." -msgstr "一個將會被呼叫來創建初始版本物件的可呼叫物件。" +msgstr "一個將會被呼叫來建立初始版本物件的可呼叫物件。" #: ../../library/pickle.rst:707 msgid "" @@ -1293,14 +1301,14 @@ msgstr "" #: ../../library/pickle.rst:710 msgid "" -"Optionally, the object's state, which will be passed to the object's :meth:" -"`__setstate__` method as previously described. If the object has no such " -"method then, the value must be a dictionary and it will be added to the " -"object's :attr:`~object.__dict__` attribute." +"Optionally, the object's state, which will be passed to the " +"object's :meth:`__setstate__` method as previously described. If the object " +"has no such method then, the value must be a dictionary and it will be added " +"to the object's :attr:`~object.__dict__` attribute." msgstr "" "可選項。物件狀態。如前所述,會被傳遞給該物件的 :meth:`__setstate__` 方法。如" -"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件的 :attr:" -"`~object.__dict__` 屬性中。" +"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件" +"的 :attr:`~object.__dict__` 屬性中。" # SkyLull: [T] # signature: https://jo-jo.medium.com/c-c-%E5%B9%BC%E5%B9%BC%E7%8F%AD-%E7%B0%BD%E7%AB%A0signature-fa9b04e1a3e2 @@ -1309,18 +1317,19 @@ msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " "or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " -"for list subclasses, but may be used by other classes as long as they have :" -"ref:`append and extend methods ` with the appropriate " +"for list subclasses, but may be used by other classes as long as they " +"have :ref:`append and extend methods ` with the appropriate " "signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " "which pickle protocol version is used as well as the number of items to " "append, so both must be supported.)" msgstr "" -"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." -"append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" -"物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " -"extend 方法 `\\ 以及相同的函式簽章(signature)就也可以使" -"用。 (是否會調用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " -"pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" +"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 " +"``obj.append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被" +"附加到物件中。主要用於串列(list)子類別,但只要其他類別具有相應" +"的 :ref:`append 和 extend 方法 `\\ 以及相同的函式簽章" +"(signature)就也可以使用。 (是否會呼叫 :meth:`!append` 或 :meth:`!extend` " +"方法將取決於所選用的 pickle 協定版本以及要附加的項目數量,因此必須同時支援這" +"兩種方法。)" #: ../../library/pickle.rst:725 msgid "" @@ -1338,8 +1347,8 @@ msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " "specific object, instead of using ``obj``'s static :meth:`__setstate__` " -"method. If not ``None``, this callable will have priority over ``obj``'s :" -"meth:`__setstate__`." +"method. If not ``None``, this callable will have priority over " +"``obj``'s :meth:`__setstate__`." msgstr "" "可選項。一個具有 ``(obj, state)`` 函式簽章(signature)的可呼叫物件。該物件允" "許使用者以可編寫的邏輯,而不是物件 ``obj`` 預設的 :meth:`__setstate__` 靜態方" @@ -1354,15 +1363,16 @@ msgstr "加入第六個可選項(一個 ``(obj, state)`` 元組)。" msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " -"protocol version. When defined, pickle will prefer it over the :meth:" -"`__reduce__` method. In addition, :meth:`__reduce__` automatically becomes " -"a synonym for the extended version. The main use for this method is to " -"provide backwards-compatible reduce values for older Python releases." +"protocol version. When defined, pickle will prefer it over " +"the :meth:`__reduce__` method. In addition, :meth:`__reduce__` " +"automatically becomes a synonym for the extended version. The main use for " +"this method is to provide backwards-compatible reduce values for older " +"Python releases." msgstr "" "另外,你也可以定義一個 :meth:`__reduce_ex__` 方法。唯一的不同的地方是此方法只" -"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先調用它而不是 :" -"meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個變體" -"版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" +"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先呼叫它而不" +"是 :meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個" +"變體版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" #: ../../library/pickle.rst:754 msgid "Persistence of External Objects" @@ -1385,8 +1395,8 @@ msgstr "" msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " -"pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler." -"persistent_load` respectively." +"pickler and unpickler, :meth:`~Pickler.persistent_id` " +"and :meth:`~Unpickler.persistent_load` respectively." msgstr "" ":mod:`pickle` 沒有定義要如何解決或分派這個持久化 ID 的問題;故其處理方式有賴" "使用者自行定義在封裝器(pickler)以及拆封器(unpickler)中。方法的名稱各自" @@ -1402,20 +1412,21 @@ msgid "" "object, along with a marker so that the unpickler will recognize it as a " "persistent ID." msgstr "" -"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方法 :" -"meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 `None` " -"或該物件的持久化 ID。當回傳 `None` 時,封裝器會正常地封裝該物件。當回傳一個持" -"久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器(unpikler)能識別" -"它是一個持久化 ID。" +"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方" +"法 :meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 " +"``None`` 或該物件的持久化 ID。當回傳 ``None`` 時,封裝器會正常地封裝該物件。" +"當回傳一個持久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器" +"(unpickler)能識別它是一個持久化 ID。" #: ../../library/pickle.rst:778 msgid "" -"To unpickle external objects, the unpickler must have a custom :meth:" -"`~Unpickler.persistent_load` method that takes a persistent ID object and " -"returns the referenced object." +"To unpickle external objects, the unpickler must have a " +"custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID " +"object and returns the referenced object." msgstr "" -"要拆封外部物件,拆封器(unpickler)必須有一個自訂的 :meth:`~Unpickler." -"persistent_load` 方法,該方法應接受一個持久化 ID 物件,並回傳相對應的物件。" +"要拆封外部物件,拆封器(unpickler)必須有一個自訂" +"的 :meth:`~Unpickler.persistent_load` 方法,該方法應接受一個持久化 ID 物件," +"並回傳相對應的物件。" #: ../../library/pickle.rst:782 msgid "" @@ -1487,8 +1498,8 @@ msgid "" " # Initialize and populate our database.\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " -"TEXT)\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" +"\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1539,7 +1550,7 @@ msgstr "" "庫中的特定紀錄。\n" " return (\"MemoRecord\", obj.key)\n" " else:\n" -" # 如果 obj 沒有持久 ID,則返回 None。這表示 obj 像平常那樣封裝即" +" # 如果 obj 沒有持久 ID,則回傳 None。這表示 obj 像平常那樣封裝即" "可。\n" " return None\n" "\n" @@ -1556,13 +1567,13 @@ msgstr "" " cursor = self.connection.cursor()\n" " type_tag, key_id = pid\n" " if type_tag == \"MemoRecord\":\n" -" # 從資料庫中抓取所引用的紀錄並返回。\n" +" # 從資料庫中抓取所引用的紀錄並回傳。\n" " cursor.execute(\"SELECT * FROM memos WHERE key=?\", " "(str(key_id),))\n" " key, task = cursor.fetchone()\n" " return MemoRecord(key, task)\n" " else:\n" -" # 如果無法返回正確的物件,則必須拋出錯誤。\n" +" # 如果無法回傳正確的物件,則必須引發錯誤。\n" " # 否則 unpickler 會誤認為 None 是持久 ID 所引用的物件。\n" " raise pickle.UnpicklingError(\"unsupported persistent object\")\n" "\n" @@ -1574,8 +1585,8 @@ msgstr "" " # 初始化資料庫。\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " -"TEXT)\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" +"\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1628,7 +1639,7 @@ msgid "" "modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." msgstr "" "由 :mod:`copyreg` 模組管理的全域調度表可以 :data:`!copyreg.dispatch_table` 呼" -"叫。你可以透過這個方式來基於原始 :data:`!copyreg.dispatch_table` 創建一個修改" +"叫。你可以透過這個方式來基於原始 :data:`!copyreg.dispatch_table` 建立一個修改" "過的版本,作為你的專屬用途的調度表。" #: ../../library/pickle.rst:801 @@ -1710,9 +1721,9 @@ msgid "" msgstr "" "以下的範例展示了如何修改針對特定類別封裝時的行為。下面的 :class:`!" "TextReader` 類別會開啟一個文字檔案,並在每次呼叫其 :meth:`!readline` 方法時返" -"回當前行編號與該行內容。如果 :class:`!TextReader` 實例被封裝,所有*除了檔案物" -"件之外*的屬性成員都會被保存。在該實例被拆封時,檔案將被重新開啟,並從上次的位" -"置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" +"回目前行編號與該行內容。如果 :class:`!TextReader` 實例被封裝,所有\\ *除了檔" +"案物件之外*\\ 的屬性成員都會被保存。在該實例被拆封時,檔案將被重新開啟,並從" +"上次的位置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" "__getstate__` 方法來實作的。::" #: ../../library/pickle.rst:844 @@ -1816,7 +1827,7 @@ msgstr "" #: ../../library/pickle.rst:896 msgid "Custom Reduction for Types, Functions, and Other Objects" -msgstr "針對型別、函數或特定物件定製縮減函數" +msgstr "針對型別、函式或特定物件定製縮減函式" #: ../../library/pickle.rst:900 msgid "" @@ -1837,15 +1848,16 @@ msgid "" "alternatively return :data:`NotImplemented` to fallback to the traditional " "behavior." msgstr "" -"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一個 :meth:`~Pickler." -"reducer_override` 方法。此方法可以回傳任意的縮減元組(參閱 :meth:`~object." -"__reduce__`)、也可以回傳 :data:`NotImplemented` 以回退至原始的行為。" +"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一" +"個 :meth:`~Pickler.reducer_override` 方法。此方法可以回傳任意的縮減元組(參" +"閱 :meth:`~object.__reduce__`)、也可以回傳 :data:`NotImplemented` 以回退至原" +"始的行為。" #: ../../library/pickle.rst:910 msgid "" -"If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." -"reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " -"takes priority." +"If both the :attr:`~Pickler.dispatch_table` " +"and :meth:`~Pickler.reducer_override` are defined, " +"then :meth:`~Pickler.reducer_override` method takes priority." msgstr "" "如果 :attr:`~Pickler.dispatch_table` 和 :meth:`~Pickler.reducer_override` 都" "被定義了的話,:meth:`~Pickler.reducer_override` 的優先度較高。" @@ -1854,14 +1866,14 @@ msgstr "" msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " -"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :" -"class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:" -"`tuple`." +"instances " +"of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` " +"and :class:`tuple`." msgstr "" "出於效能考量,處裡以下物件可能不會呼叫 :meth:`~Pickler.reducer_override`:" -"``None``、``True``、``False``,以及 :class:`int`、:class:`float`、:class:" -"`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:" -"class:`list` 和 :class:`tuple` 的實例。" +"``None``、``True``、``False``,以" +"及 :class:`int`、:class:`float`、:class:`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:class:`list` " +"和 :class:`tuple` 的實例。" #: ../../library/pickle.rst:921 msgid "" @@ -1907,7 +1919,7 @@ msgstr "" "\n" "class MyPickler(pickle.Pickler):\n" " def reducer_override(self, obj):\n" -" \"\"\"MyClass 的自訂縮減函數。\"\"\"\n" +" \"\"\"MyClass 的自訂縮減函式。\"\"\"\n" " if getattr(obj, \"__name__\", None) == \"MyClass\":\n" " return type, (obj.__name__, obj.__bases__,\n" " {'my_attribute': obj.my_attribute})\n" @@ -1952,8 +1964,9 @@ msgid "" "implementation of the communications system) support the out-of-band " "transfer facilities provided by pickle protocol 5 and higher." msgstr "" -"如果*供給者*(被傳遞物件的型別的實作)與*消費者*(資訊交換系統的實作)都支援" -"由 pickle 協定 5 或更高版本提供的帶外傳輸功能,則可以避免此一先天限制。" +"如果\\ *供給者*\\ (被傳遞物件的型別的實作)與\\ *消費者*\\ (資訊交換系統的" +"實作)都支援由 pickle 協定 5 或更高版本提供的帶外傳輸功能,則可以避免此一先天" +"限制。" #: ../../library/pickle.rst:973 msgid "Provider API" @@ -1961,14 +1974,15 @@ msgstr "供給者 API" #: ../../library/pickle.rst:975 msgid "" -"The large data objects to be pickled must implement a :meth:`~object." -"__reduce_ex__` method specialized for protocol 5 and higher, which returns " -"a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) " -"for any large data." +"The large data objects to be pickled must implement " +"a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and " +"higher, which returns a :class:`PickleBuffer` instance (instead of e.g. " +"a :class:`bytes` object) for any large data." msgstr "" -"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上的 :meth:`~object." -"__reduce_ex__` 方法,該方法應返回一個 :class:`PickleBuffer` 實例來處理任何大" -"型資料(而非返回如 :class:`bytes` 物件)。" +"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上" +"的 :meth:`~object.__reduce_ex__` 方法,該方法應回傳一" +"個 :class:`PickleBuffer` 實例來處理任何大型資料(而非回傳如 :class:`bytes` 物" +"件)。" #: ../../library/pickle.rst:980 msgid "" @@ -1978,9 +1992,9 @@ msgid "" "opt-in to tell :mod:`pickle` that they will handle those buffers by " "themselves." msgstr "" -"一個 :class:`PickleBuffer` 物件*指示*了當下底層的緩衝區狀態適合進行帶外資料傳" -"輸。這些物件仍然相容 :mod:`pickle` 模組的一般使用方式。消費者程式也可以選擇介" -"入,指示 :mod:`pickle` 他們將自行處理這些緩衝區。" +"一個 :class:`PickleBuffer` 物件\\ *指示*\\ 了當下底層的緩衝區狀態適合進行帶外" +"資料傳輸。這些物件仍然相容 :mod:`pickle` 模組的一般使用方式。消費者程式也可以" +"選擇介入,指示 :mod:`pickle` 他們將自行處理這些緩衝區。" #: ../../library/pickle.rst:987 msgid "Consumer API" @@ -1988,41 +2002,42 @@ msgstr "消費者 API" #: ../../library/pickle.rst:989 msgid "" -"A communications system can enable custom handling of the :class:" -"`PickleBuffer` objects generated when serializing an object graph." +"A communications system can enable custom handling of " +"the :class:`PickleBuffer` objects generated when serializing an object graph." msgstr "" "一個資訊交換系統可以決定要自行處裡序列化物件圖時產生的 :class:`PickleBuffer` " "物件。" #: ../../library/pickle.rst:992 msgid "" -"On the sending side, it needs to pass a *buffer_callback* argument to :class:" -"`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " -"called with each :class:`PickleBuffer` generated while pickling the object " -"graph. Buffers accumulated by the *buffer_callback* will not see their data " -"copied into the pickle stream, only a cheap marker will be inserted." +"On the sending side, it needs to pass a *buffer_callback* argument " +"to :class:`Pickler` (or to the :func:`dump` or :func:`dumps` function), " +"which will be called with each :class:`PickleBuffer` generated while " +"pickling the object graph. Buffers accumulated by the *buffer_callback* " +"will not see their data copied into the pickle stream, only a cheap marker " +"will be inserted." msgstr "" -"傳送端需要傳遞一個調用緩衝區的回呼函數給 :class:`Pickler`\\ (或 :func:" -"`dump` 或 :func:`dumps` 函數)的 *buffer_callback* 引數,使每次生成 :class:" -"`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " -"*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" +"傳送端需要傳遞一個呼叫緩衝區的回呼函式給 :class:`Pickler`\\ " +"(或 :func:`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生" +"成 :class:`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以" +"外,由 *buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" #: ../../library/pickle.rst:999 msgid "" -"On the receiving side, it needs to pass a *buffers* argument to :class:" -"`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " -"iterable of the buffers which were passed to *buffer_callback*. That " -"iterable should produce buffers in the same order as they were passed to " -"*buffer_callback*. Those buffers will provide the data expected by the " -"reconstructors of the objects whose pickling produced the original :class:" -"`PickleBuffer` objects." -msgstr "" -"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` 或 :" -"func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)緩衝" -"區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊代物" -"件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。這些" -"緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生了 :class:" -"`PickleBuffer` 的物件。" +"On the receiving side, it needs to pass a *buffers* argument " +"to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), " +"which is an iterable of the buffers which were passed to *buffer_callback*. " +"That iterable should produce buffers in the same order as they were passed " +"to *buffer_callback*. Those buffers will provide the data expected by the " +"reconstructors of the objects whose pickling produced the " +"original :class:`PickleBuffer` objects." +msgstr "" +"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` " +"或 :func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)" +"緩衝區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊" +"代物件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。" +"這些緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生" +"了 :class:`PickleBuffer` 的物件。" #: ../../library/pickle.rst:1007 msgid "" @@ -2043,8 +2058,8 @@ msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝的 :class:" -"`bytearray` 子類別:::" +"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝" +"的 :class:`bytearray` 子類別:::" #: ../../library/pickle.rst:1018 msgid "" @@ -2095,7 +2110,7 @@ msgid "" "providing object if it has the right type. This is an easy way to simulate " "zero-copy behaviour on this toy example." msgstr "" -"如果型別正確,重建器(``_reconstruct`` 類別方法)會返回當時提供緩衝區的物件。" +"如果型別正確,重建器(``_reconstruct`` 類別方法)會回傳當時提供緩衝區的物件。" "這個簡易實作可以模擬一個無複製行為的重建器。" #: ../../library/pickle.rst:1043 @@ -2125,7 +2140,7 @@ msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" -"但如果我們傳一個 *buffer_callback* 並在去序列化時正確返回積累的緩衝資料,我們" +"但如果我們傳一個 *buffer_callback* 並在去序列化時正確回傳積累的緩衝資料,我們" "就能拿回原始的物件:::" #: ../../library/pickle.rst:1055 @@ -2153,7 +2168,7 @@ msgid "" "making as few copies as possible) when transferring between distinct " "processes or systems." msgstr "" -"此範例是因為受限於 :class:`bytearray` 會自行分配記憶體:您無法創建以其他物件" +"此範例是因為受限於 :class:`bytearray` 會自行分配記憶體:你無法建立以其他物件" "的記憶體為基礎的 :class:`bytearray` 實例。不過第三方資料型態(如 NumPy 陣列)" "則可能沒有這個限制,而允許在不同程序或系統之間傳輸資料時使用零拷貝封裝(或儘" "可能地減少拷貝次數)。" @@ -2202,21 +2217,21 @@ msgstr "" #: ../../library/pickle.rst:1094 msgid "" -"For this reason, you may want to control what gets unpickled by customizing :" -"meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." -"find_class` is called whenever a global (i.e., a class or a function) is " -"requested. Thus it is possible to either completely forbid globals or " -"restrict them to a safe subset." +"For this reason, you may want to control what gets unpickled by " +"customizing :meth:`Unpickler.find_class`. Unlike its name " +"suggests, :meth:`Unpickler.find_class` is called whenever a global (i.e., a " +"class or a function) is requested. Thus it is possible to either completely " +"forbid globals or restrict them to a safe subset." msgstr "" -"基於以上原因,您可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" +"基於以上原因,你可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" "能夠被拆封的內容。與其名稱字面意義暗示的不同,實際上每當你請求一個全域物件" -"(例如,類別或函式)時,就會調用 :meth:`Unpickler.find_class`。因此,可以透過" +"(例如,類別或函式)時,就會呼叫 :meth:`Unpickler.find_class`。因此,可以透過" "這個方法完全禁止全域物件或將其限制在安全的子集合。" #: ../../library/pickle.rst:1100 msgid "" -"Here is an example of an unpickler allowing only few safe classes from the :" -"mod:`builtins` module to be loaded::" +"Here is an example of an unpickler allowing only few safe classes from " +"the :mod:`builtins` module to be loaded::" msgstr "" "以下是一個僅允許從 :mod:`builtins` 模組中載入少數安全類別的拆封器" "(unpickler)的例子:::" @@ -2272,7 +2287,7 @@ msgstr "" " (module, name))\n" "\n" "def restricted_loads(s):\n" -" \"\"\"一個模擬 pickle.loads() 的輔助函數\"\"\"\n" +" \"\"\"一個模擬 pickle.loads() 的輔助函式\"\"\"\n" " return RestrictedUnpickler(io.BytesIO(s)).load()" #: ../../library/pickle.rst:1129 @@ -2314,8 +2329,8 @@ msgid "" "alternatives such as the marshalling API in :mod:`xmlrpc.client` or third-" "party solutions." msgstr "" -"正如我們的範例所示,必須謹慎審視能被拆封的內容。因此,如果您的應用場景非常關" -"心安全性,您可能需要考慮其他選擇,例如 :mod:`xmlrpc.client` 中的 marshalling " +"正如我們的範例所示,必須謹慎審視能被拆封的內容。因此,如果你的應用場景非常關" +"心安全性,你可能需要考慮其他選擇,例如 :mod:`xmlrpc.client` 中的 marshalling " "API 或其他第三方解決方案。" #: ../../library/pickle.rst:1155 @@ -2339,7 +2354,7 @@ msgstr "範例" #: ../../library/pickle.rst:1167 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" -msgstr "最簡單的使用方式,調用 :func:`dump` 和 :func:`load` 函式。::" +msgstr "最簡單的使用方式,呼叫 :func:`dump` 和 :func:`load` 函式。::" #: ../../library/pickle.rst:1169 msgid "" @@ -2446,10 +2461,10 @@ msgstr "" #: ../../library/pickle.rst:1222 msgid "" -"The exception raised will likely be an :exc:`ImportError` or an :exc:" -"`AttributeError` but it could be something else." +"The exception raised will likely be an :exc:`ImportError` or " +"an :exc:`AttributeError` but it could be something else." msgstr "" -"拋出的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" +"引發的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" "例外。" #: ../../library/pickle.rst:1225 diff --git a/library/pkgutil.po b/library/pkgutil.po index 31147bebcb..3851b2c077 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -41,8 +41,8 @@ msgid "" "Extend the search path for the modules which comprise a package. Intended " "use is to place the following code in a package's :file:`__init__.py`::" msgstr "" -"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件的 :file:" -"`__init__.py`: ::" +"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件" +"的 :file:`__init__.py`: ::" #: ../../library/pkgutil.rst:25 msgid "" @@ -55,9 +55,10 @@ msgstr "" #: ../../library/pkgutil.rst:28 msgid "" "For each directory on :data:`sys.path` that has a subdirectory that matches " -"the package name, add the subdirectory to the package's :attr:`~module." -"__path__`. This is useful if one wants to distribute different parts of a " -"single logical package as multiple directories." +"the package name, add the subdirectory to the " +"package's :attr:`~module.__path__`. This is useful if one wants to " +"distribute different parts of a single logical package as multiple " +"directories." msgstr "" "對於 :data:`sys.path` 上具有與套件名稱相符的子目錄的每個目錄,將該子目錄新增" "至套件的 :attr:`~module.__path__` 中。如果想要將單一邏輯套件的不同部分給分配" @@ -66,12 +67,12 @@ msgstr "" #: ../../library/pkgutil.rst:34 msgid "" "It also looks for :file:`\\*.pkg` files beginning where ``*`` matches the " -"*name* argument. This feature is similar to :file:`\\*.pth` files (see the :" -"mod:`site` module for more information), except that it doesn't special-case " -"lines starting with ``import``. A :file:`\\*.pkg` file is trusted at face " -"value: apart from skipping blank lines and ignoring comments, all entries " -"found in a :file:`\\*.pkg` file are added to the path, regardless of whether " -"they exist on the filesystem (this is a feature)." +"*name* argument. This feature is similar to :file:`\\*.pth` files (see " +"the :mod:`site` module for more information), except that it doesn't special-" +"case lines starting with ``import``. A :file:`\\*.pkg` file is trusted at " +"face value: apart from skipping blank lines and ignoring comments, all " +"entries found in a :file:`\\*.pkg` file are added to the path, regardless of " +"whether they exist on the filesystem (this is a feature)." msgstr "" "它還會尋找 :file:`\\*.pkg` 檔案,其中開頭的 ``*`` 與 *name* 引數相符。此功能" "類似於 :file:`\\*.pth` 檔案(更多資訊請參閱 :mod:`site` 模組),但他不特別處" @@ -90,11 +91,11 @@ msgstr "" #: ../../library/pkgutil.rst:46 msgid "" -"It is assumed that :data:`sys.path` is a sequence. Items of :data:`sys." -"path` that are not strings referring to existing directories are ignored. " -"Unicode items on :data:`sys.path` that cause errors when used as filenames " -"may cause this function to raise an exception (in line with :func:`os.path." -"isdir` behavior)." +"It is assumed that :data:`sys.path` is a sequence. Items " +"of :data:`sys.path` that are not strings referring to existing directories " +"are ignored. Unicode items on :data:`sys.path` that cause errors when used " +"as filenames may cause this function to raise an exception (in line " +"with :func:`os.path.isdir` behavior)." msgstr "" ":data:`sys.path` 被假設是一個序列,:data:`sys.path` 中的項目裡,若不是代表現" "存目錄的字串則將被忽略。:data:`sys.path` 上用作檔案名稱時導致錯誤的 Unicode " @@ -106,14 +107,14 @@ msgstr "取得給定之 *fullname* 的模組 :term:`loader`。" #: ../../library/pkgutil.rst:56 msgid "" -"This is a backwards compatibility wrapper around :func:`importlib.util." -"find_spec` that converts most failures to :exc:`ImportError` and only " -"returns the loader rather than the full :class:`importlib.machinery." -"ModuleSpec`." +"This is a backwards compatibility wrapper " +"around :func:`importlib.util.find_spec` that converts most failures " +"to :exc:`ImportError` and only returns the loader rather than the " +"full :class:`importlib.machinery.ModuleSpec`." msgstr "" "這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失敗" -"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整的 :class:`importlib." -"machinery.ModuleSpec`。" +"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整" +"的 :class:`importlib.machinery.ModuleSpec`。" #: ../../library/pkgutil.rst:61 ../../library/pkgutil.rst:82 #: ../../library/pkgutil.rst:97 ../../library/pkgutil.rst:121 @@ -147,8 +148,8 @@ msgstr "" #: ../../library/pkgutil.rst:79 msgid "" -"The cache (or part of it) can be cleared manually if a rescan of :data:`sys." -"path_hooks` is necessary." +"The cache (or part of it) can be cleared manually if a rescan " +"of :data:`sys.path_hooks` is necessary." msgstr "" "如果需要重新掃描 :data:`sys.path_hooks`,可以手動清除快取(或部分快取)。" @@ -216,12 +217,12 @@ msgstr "*prefix* 是在輸出的每個模組名稱前面的輸出字串。" msgid "" "Only works for a :term:`finder` which defines an ``iter_modules()`` method. " "This interface is non-standard, so the module also provides implementations " -"for :class:`importlib.machinery.FileFinder` and :class:`zipimport." -"zipimporter`." +"for :class:`importlib.machinery.FileFinder` " +"and :class:`zipimport.zipimporter`." msgstr "" "僅適用於有定義 ``iter_modules()`` 方法的 :term:`finder`。此介面並非是標準的," -"因此該模組還提供了 :class:`importlib.machinery.FileFinder` 和 :class:" -"`zipimport.zipimporter` 的實作。" +"因此該模組還提供了 :class:`importlib.machinery.FileFinder` " +"和 :class:`zipimport.zipimporter` 的實作。" #: ../../library/pkgutil.rst:149 msgid "" @@ -244,13 +245,13 @@ msgstr "" msgid "" "*onerror* is a function which gets called with one argument (the name of the " "package which was being imported) if any exception occurs while trying to " -"import a package. If no *onerror* function is supplied, :exc:" -"`ImportError`\\s are caught and ignored, while all other exceptions are " -"propagated, terminating the search." +"import a package. If no *onerror* function is " +"supplied, :exc:`ImportError`\\s are caught and ignored, while all other " +"exceptions are propagated, terminating the search." msgstr "" "*onerror* 是一個函式,如果在嘗試引入套件時發生任何例外,則使用一個引數(正在" -"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽略 :exc:" -"`ImportError`,同時傳播所有其他例外並終止搜尋。" +"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽" +"略 :exc:`ImportError`,同時傳播所有其他例外並終止搜尋。" #: ../../library/pkgutil.rst:166 msgid "Examples::" @@ -264,6 +265,11 @@ msgid "" "# list all submodules of ctypes\n" "walk_packages(ctypes.__path__, ctypes.__name__ + '.')" msgstr "" +"# 列出 Python 可存取的所有模組\n" +"walk_packages()\n" +"\n" +"# 列出 ctypes 的所有子模組\n" +"walk_packages(ctypes.__path__, ctypes.__name__ + '.')" #: ../../library/pkgutil.rst:188 msgid "Get a resource from a package." @@ -271,12 +277,12 @@ msgstr "從套件中取得資源。" #: ../../library/pkgutil.rst:190 msgid "" -"This is a wrapper for the :term:`loader` :meth:`get_data ` API. The *package* argument should be the name of " -"a package, in standard module format (``foo.bar``). The *resource* argument " -"should be in the form of a relative filename, using ``/`` as the path " -"separator. The parent directory name ``..`` is not allowed, and nor is a " -"rooted name (starting with a ``/``)." +"This is a wrapper for the :term:`loader` :meth:`get_data " +"` API. The *package* argument should " +"be the name of a package, in standard module format (``foo.bar``). The " +"*resource* argument should be in the form of a relative filename, using ``/" +"`` as the path separator. The parent directory name ``..`` is not allowed, " +"and nor is a rooted name (starting with a ``/``)." msgstr "" "這是 :term:`loader` :meth:`get_data ` " "API 的包裝器。*package* 引數應該是採用標準模組格式 (``foo.bar``) 的套件名稱。" @@ -306,15 +312,16 @@ msgstr "" #: ../../library/pkgutil.rst:206 msgid "" "If the package cannot be located or loaded, or it uses a :term:`loader` " -"which does not support :meth:`get_data `, then ``None`` is returned. In particular, the :term:`loader` " -"for :term:`namespace packages ` does not support :meth:" -"`get_data `." +"which does not support :meth:`get_data " +"`, then ``None`` is returned. In " +"particular, the :term:`loader` for :term:`namespace packages ` does not support :meth:`get_data " +"`." msgstr "" -"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data ` 的 :term:`loader` 則回傳 ``None``。特別是\\ :term:`" -"命名空間套件 `\\ 的 :term:`loader` 不支援 :meth:`get_data " -"`。" +"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data " +"` 的 :term:`loader` 則回傳 ``None``。" +"特別是\\ :term:`命名空間套件 `\\ 的 :term:`loader` 不支" +"援 :meth:`get_data `。" #: ../../library/pkgutil.rst:215 msgid "Resolve a name to an object." @@ -322,9 +329,9 @@ msgstr "將名稱解析為物件。" #: ../../library/pkgutil.rst:217 msgid "" -"This functionality is used in numerous places in the standard library (see :" -"issue:`12915`) - and equivalent functionality is also in widely used third-" -"party packages such as setuptools, Django and Pyramid." +"This functionality is used in numerous places in the standard library " +"(see :issue:`12915`) - and equivalent functionality is also in widely used " +"third-party packages such as setuptools, Django and Pyramid." msgstr "" "標準函式庫中的許多地方都使用了此功能(請參閱 :issue:`12915`),且相同功能也被" "用於擁有廣大使用者的第三方套件,如 setuptools、Django 和 Pyramid。" diff --git a/library/platform.po b/library/platform.po index de5e532153..d7f235e812 100644 --- a/library/platform.po +++ b/library/platform.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-04 00:16+0000\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgid "" msgstr "特定平臺清單為按字母順序排列,Linux 包括在 Unix 小節之中。" #: ../../library/platform.rst:21 -msgid "Cross Platform" +msgid "Cross platform" msgstr "跨平台" #: ../../library/platform.rst:26 @@ -43,7 +43,7 @@ msgid "" "Queries the given executable (defaults to the Python interpreter binary) for " "various architecture information." msgstr "" -"查詢給定的可執行檔案(預設為 Python 直譯器二進位制檔案)來獲取各種架構資訊。" +"查詢給定的可執行檔案(預設為 Python 直譯器二進位制檔案)來取得各種架構資訊。" #: ../../library/platform.rst:29 msgid "" @@ -88,8 +88,8 @@ msgid "" "To get at the \"64-bitness\" of the current interpreter, it is more reliable " "to query the :data:`sys.maxsize` attribute::" msgstr "" -"要獲取當前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查詢 :data:`sys." -"maxsize` 屬性: ::" +"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查" +"詢 :data:`sys.maxsize` 屬性: ::" #: ../../library/platform.rst:51 msgid "is_64bits = sys.maxsize > 2**32" @@ -146,7 +146,7 @@ msgid "" "release string, to get the macOS version rather than the darwin version." msgstr "" "在 macOS 上,如果 :func:`mac_ver` 回傳的釋出版字串非空字串,此函式現在會使用" -"它以獲取 macOS 版本而非 darwin 版本。" +"它以取得 macOS 版本而非 darwin 版本。" #: ../../library/platform.rst:90 msgid "Returns the (real) processor name, e.g. ``'amdk6'``." @@ -264,12 +264,13 @@ msgstr "" #: ../../library/platform.rst:172 msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " -"containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" -"attr:`version`, :attr:`machine`, and :attr:`processor`." +"containing six " +"attributes: :attr:`system`, :attr:`node`, :attr:`release`, :attr:`version`, :attr:`machine`, " +"and :attr:`processor`." msgstr "" -"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性的 :func:" -"`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:" -"attr:`version`、:attr:`machine` 和 :attr:`processor`。" +"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性" +"的 :func:`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:attr:`version`、:attr:`machine` " +"和 :attr:`processor`。" #: ../../library/platform.rst:176 msgid ":attr:`processor` is resolved late, on demand." @@ -277,11 +278,12 @@ msgstr ":attr:`processor` 會延遲解析,有需求時才會解析" #: ../../library/platform.rst:178 msgid "" -"Note: the first two attribute names differ from the names presented by :func:" -"`os.uname`, where they are named :attr:`sysname` and :attr:`nodename`." +"Note: the first two attribute names differ from the names presented " +"by :func:`os.uname`, where they are named :attr:`sysname` " +"and :attr:`nodename`." msgstr "" -"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名為 :attr:" -"`sysname` 和 :attr:`nodename`。" +"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名" +"為 :attr:`sysname` 和 :attr:`nodename`。" #: ../../library/platform.rst:182 msgid "Entries which cannot be determined are set to ``''``." @@ -296,7 +298,7 @@ msgid ":attr:`processor` is resolved late instead of immediately." msgstr ":attr:`processor` 會延遲解析,並非立即解析。" #: ../../library/platform.rst:192 -msgid "Java Platform" +msgid "Java platform" msgstr "Java 平台" #: ../../library/platform.rst:197 @@ -322,7 +324,7 @@ msgid "" msgstr "" #: ../../library/platform.rst:210 -msgid "Windows Platform" +msgid "Windows platform" msgstr "Windows 平台" #: ../../library/platform.rst:215 @@ -333,7 +335,7 @@ msgid "" "Values which cannot be determined are set to the defaults given as " "parameters (which all default to an empty string)." msgstr "" -"從 Windows 登錄檔 (Window Registry) 獲取額外的版本資訊並回傳一個 tuple " +"從 Windows 登錄檔 (Window Registry) 取得額外的版本資訊並回傳一個 tuple " "``(release, version, csd, ptype)``,它代表 OS 發行版、版本號、CSD 級別 " "(service pack) 和 OS 類型(多個/單個處理器)。" @@ -342,8 +344,8 @@ msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " "``'Free'`` refers to the OS version being free of debugging code. It could " -"also state ``'Checked'`` which means the OS version uses debugging code, i." -"e. code that checks arguments, ranges, etc." +"also state ``'Checked'`` which means the OS version uses debugging code, " +"i.e. code that checks arguments, ranges, etc." msgstr "" "一點提示:*ptype* 在單個處理器的 NT 機器上為 ``'Uniprocessor Free'``,而在多" "個處理器的機器上為 ``'Multiprocessor Free'``。``'Free'`` 是指該 OS 版本沒有除" @@ -357,7 +359,7 @@ msgid "" "to ``'Enterprise'``, ``'IoTUAP'``, ``'ServerStandard'``, and " "``'nanoserver'``." msgstr "" -"回傳一個代表當前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" +"回傳一個代表目前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" "``'IoTUAP'``、``'ServerStandard'`` 和 ``'nanoserver'``。" #: ../../library/platform.rst:237 @@ -369,7 +371,7 @@ msgstr "" "``True``。" #: ../../library/platform.rst:244 -msgid "macOS Platform" +msgid "macOS platform" msgstr "macOS 平台" #: ../../library/platform.rst:248 @@ -378,7 +380,7 @@ msgid "" "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " "dev_stage, non_release_version)``." msgstr "" -"獲取 Mac OS 版本資訊並將其回傳為 tuple ``(release, versioninfo, machine)``," +"取得 Mac OS 版本資訊並將其回傳為 tuple ``(release, versioninfo, machine)``," "其中 *versioninfo* 是一個 tuple ``(version, dev_stage, " "non_release_version)``。" @@ -389,13 +391,13 @@ msgid "" msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" #: ../../library/platform.rst:256 -msgid "iOS Platform" +msgid "iOS platform" msgstr "iOS 平台" #: ../../library/platform.rst:260 msgid "" -"Get iOS version information and return it as a :func:`~collections." -"namedtuple` with the following attributes:" +"Get iOS version information and return it as " +"a :func:`~collections.namedtuple` with the following attributes:" msgstr "" #: ../../library/platform.rst:263 @@ -419,14 +421,13 @@ msgid "" msgstr "" #: ../../library/platform.rst:270 -#, fuzzy msgid "" "Entries which cannot be determined are set to the defaults given as " "parameters." -msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" +msgstr "無法確定的條目會被設定為以參數給定的預設值。" #: ../../library/platform.rst:275 -msgid "Unix Platforms" +msgid "Unix platforms" msgstr "Unix 平台" #: ../../library/platform.rst:279 @@ -453,7 +454,7 @@ msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "檔案會以 *chunksize* 位元組大小的分塊 (chunk) 來讀取和掃描。" #: ../../library/platform.rst:291 -msgid "Linux Platforms" +msgid "Linux platforms" msgstr "Linux 平台" #: ../../library/platform.rst:295 @@ -464,7 +465,7 @@ msgid "" "in most Linux distributions. A noticeable exception is Android and Android-" "based distributions." msgstr "" -"從 ``os-release`` 檔案獲取作業系統標識,並將其作為一個字典回傳。``os-" +"從 ``os-release`` 檔案取得作業系統標識,並將其作為一個字典回傳。``os-" "release`` 檔案為 `freedesktop.org 標準 `_、並在大多數 Linux 發行版上可用。一個重要的例外" "是 Android 和基於 Android 的發行版。" @@ -474,8 +475,8 @@ msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." msgstr "" -"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引發 :exc:" -"`OSError` 或其子類別。" +"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引" +"發 :exc:`OSError` 或其子類別。" #: ../../library/platform.rst:304 msgid "" @@ -517,7 +518,7 @@ msgid "" msgstr "" #: ../../library/platform.rst:329 -msgid "Android Platform" +msgid "Android platform" msgstr "Android 平台" #: ../../library/platform.rst:334 @@ -534,8 +535,8 @@ msgstr "" #: ../../library/platform.rst:340 msgid "" "``api_level`` - API level of the running device, as an integer (e.g. ``34`` " -"for Android 14). To get the API level which Python was built against, see :" -"func:`sys.getandroidapilevel`." +"for Android 14). To get the API level which Python was built against, " +"see :func:`sys.getandroidapilevel`." msgstr "" #: ../../library/platform.rst:344 @@ -564,6 +565,44 @@ msgstr "" #: ../../library/platform.rst:358 msgid "" -"Google maintains a `list of known model and device names `__." +"Google maintains a `list of known model and device names `__." +msgstr "" + +#: ../../library/platform.rst:366 +msgid "Command-line usage" +msgstr "命令列用法" + +#: ../../library/platform.rst:368 +msgid "" +":mod:`platform` can also be invoked directly using the :option:`-m` switch " +"of the interpreter::" +msgstr "" + +#: ../../library/platform.rst:371 +msgid "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" +msgstr "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" + +#: ../../library/platform.rst:373 +msgid "The following options are accepted:" +msgstr "可接受以下選項:" + +#: ../../library/platform.rst:379 +msgid "" +"Print terse information about the platform. This is equivalent to " +"calling :func:`platform.platform` with the *terse* argument set to ``True``." +msgstr "" + +#: ../../library/platform.rst:384 +msgid "" +"Print platform information without system/OS name aliasing. This is " +"equivalent to calling :func:`platform.platform` with the *aliased* argument " +"set to ``True``." +msgstr "" + +#: ../../library/platform.rst:388 +msgid "" +"You can also pass one or more positional arguments (``terse``, " +"``nonaliased``) to explicitly control the output format. These behave " +"similarly to their corresponding options." msgstr "" diff --git a/library/plistlib.po b/library/plistlib.po index 282baf27aa..be0ef2cf37 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,14 +42,14 @@ msgstr "" #: ../../library/plistlib.rst:27 msgid "" -"To write out and to parse a plist file, use the :func:`dump` and :func:" -"`load` functions." +"To write out and to parse a plist file, use the :func:`dump` " +"and :func:`load` functions." msgstr "" #: ../../library/plistlib.rst:30 msgid "" -"To work with plist data in bytes or string objects, use :func:`dumps` and :" -"func:`loads`." +"To work with plist data in bytes or string objects, use :func:`dumps` " +"and :func:`loads`." msgstr "" #: ../../library/plistlib.rst:33 @@ -85,7 +85,7 @@ msgstr "" #: ../../library/plistlib.rst:53 msgid "This module defines the following functions:" -msgstr "" +msgstr "此模組定義了以下函式:" #: ../../library/plistlib.rst:57 msgid "" @@ -119,7 +119,7 @@ msgstr "" msgid "" "When *aware_datetime* is true, fields with type ``datetime.datetime`` will " "be created as :ref:`aware object `, with :attr:`!" -"tzinfo` as :attr:`datetime.UTC`." +"tzinfo` as :const:`datetime.UTC`." msgstr "" #: ../../library/plistlib.rst:76 @@ -132,95 +132,93 @@ msgstr "" #: ../../library/plistlib.rst:81 msgid "" -"The parser for the binary format raises :exc:`InvalidFileException` when the " -"file cannot be parsed." +"The parser raises :exc:`InvalidFileException` when the file cannot be parsed." msgstr "" -#: ../../library/plistlib.rst:86 ../../library/plistlib.rst:131 +#: ../../library/plistlib.rst:85 ../../library/plistlib.rst:130 msgid "The keyword-only parameter *aware_datetime* has been added." msgstr "" -#: ../../library/plistlib.rst:92 +#: ../../library/plistlib.rst:91 msgid "" "Load a plist from a bytes or string object. See :func:`load` for an " "explanation of the keyword arguments." msgstr "" -#: ../../library/plistlib.rst:97 +#: ../../library/plistlib.rst:96 msgid "*data* can be a string when *fmt* equals :data:`FMT_XML`." msgstr "" -#: ../../library/plistlib.rst:102 +#: ../../library/plistlib.rst:101 msgid "" -"Write *value* to a plist file. *Fp* should be a writable, binary file object." +"Write *value* to a plist file. *fp* should be a writable, binary file object." msgstr "" -#: ../../library/plistlib.rst:105 +#: ../../library/plistlib.rst:104 msgid "" "The *fmt* argument specifies the format of the plist file and can be one of " "the following values:" msgstr "" -#: ../../library/plistlib.rst:108 +#: ../../library/plistlib.rst:107 msgid ":data:`FMT_XML`: XML formatted plist file" msgstr "" -#: ../../library/plistlib.rst:110 +#: ../../library/plistlib.rst:109 msgid ":data:`FMT_BINARY`: Binary formatted plist file" msgstr "" -#: ../../library/plistlib.rst:112 +#: ../../library/plistlib.rst:111 msgid "" "When *sort_keys* is true (the default) the keys for dictionaries will be " "written to the plist in sorted order, otherwise they will be written in the " "iteration order of the dictionary." msgstr "" -#: ../../library/plistlib.rst:116 +#: ../../library/plistlib.rst:115 msgid "" "When *skipkeys* is false (the default) the function raises :exc:`TypeError` " "when a key of a dictionary is not a string, otherwise such keys are skipped." msgstr "" -#: ../../library/plistlib.rst:119 +#: ../../library/plistlib.rst:118 msgid "" "When *aware_datetime* is true and any field with type ``datetime.datetime`` " "is set as an :ref:`aware object `, it will convert to " "UTC timezone before writing it." msgstr "" -#: ../../library/plistlib.rst:123 +#: ../../library/plistlib.rst:122 msgid "" "A :exc:`TypeError` will be raised if the object is of an unsupported type or " "a container that contains objects of unsupported types." msgstr "" -#: ../../library/plistlib.rst:126 +#: ../../library/plistlib.rst:125 msgid "" "An :exc:`OverflowError` will be raised for integer values that cannot be " "represented in (binary) plist files." msgstr "" -#: ../../library/plistlib.rst:137 +#: ../../library/plistlib.rst:136 msgid "" -"Return *value* as a plist-formatted bytes object. See the documentation for :" -"func:`dump` for an explanation of the keyword arguments of this function." +"Return *value* as a plist-formatted bytes object. See the documentation " +"for :func:`dump` for an explanation of the keyword arguments of this " +"function." msgstr "" -#: ../../library/plistlib.rst:144 +#: ../../library/plistlib.rst:143 msgid "The following classes are available:" msgstr "" -#: ../../library/plistlib.rst:148 +#: ../../library/plistlib.rst:147 msgid "" "Wraps an :class:`int`. This is used when reading or writing NSKeyedArchiver " "encoded data, which contains UID (see PList manual)." msgstr "" -#: ../../library/plistlib.rst:151 -msgid "" -"It has one attribute, :attr:`data`, which can be used to retrieve the int " -"value of the UID. :attr:`data` must be in the range ``0 <= data < 2**64``." +#: ../../library/plistlib.rst:152 +msgid "Int value of the UID. It must be in the range ``0 <= data < 2**64``." msgstr "" #: ../../library/plistlib.rst:157 @@ -235,15 +233,23 @@ msgstr "" msgid "The binary format for plist files" msgstr "" -#: ../../library/plistlib.rst:174 +#: ../../library/plistlib.rst:173 +msgid "The module defines the following exceptions:" +msgstr "" + +#: ../../library/plistlib.rst:177 +msgid "Raised when a file cannot be parsed." +msgstr "" + +#: ../../library/plistlib.rst:183 msgid "Examples" msgstr "範例" -#: ../../library/plistlib.rst:176 +#: ../../library/plistlib.rst:185 msgid "Generating a plist::" msgstr "" -#: ../../library/plistlib.rst:178 +#: ../../library/plistlib.rst:187 msgid "" "import datetime\n" "import plistlib\n" @@ -285,11 +291,11 @@ msgstr "" ")\n" "print(plistlib.dumps(pl).decode())" -#: ../../library/plistlib.rst:198 +#: ../../library/plistlib.rst:207 msgid "Parsing a plist::" msgstr "" -#: ../../library/plistlib.rst:200 +#: ../../library/plistlib.rst:209 msgid "" "import plistlib\n" "\n" diff --git a/library/profile.po b/library/profile.po index aa480c4282..5babd398ac 100644 --- a/library/profile.po +++ b/library/profile.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-02 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr "**原始碼:**\\ :source:`Lib/profile.py` 與 :source:`Lib/pstats.py`" #: ../../library/profile.rst:14 msgid "Introduction to the profilers" -msgstr "" +msgstr "分析器簡介" #: ../../library/profile.rst:20 msgid "" @@ -53,20 +53,21 @@ msgstr "" #: ../../library/profile.rst:33 msgid "" -":mod:`profile`, a pure Python module whose interface is imitated by :mod:" -"`cProfile`, but which adds significant overhead to profiled programs. If " -"you're trying to extend the profiler in some way, the task might be easier " -"with this module. Originally designed and written by Jim Roskind." +":mod:`profile`, a pure Python module whose interface is imitated " +"by :mod:`cProfile`, but which adds significant overhead to profiled " +"programs. If you're trying to extend the profiler in some way, the task " +"might be easier with this module. Originally designed and written by Jim " +"Roskind." msgstr "" #: ../../library/profile.rst:40 msgid "" "The profiler modules are designed to provide an execution profile for a " -"given program, not for benchmarking purposes (for that, there is :mod:" -"`timeit` for reasonably accurate results). This particularly applies to " -"benchmarking Python code against C code: the profilers introduce overhead " -"for Python code, but not for C-level functions, and so the C code would seem " -"faster than any Python one." +"given program, not for benchmarking purposes (for that, there " +"is :mod:`timeit` for reasonably accurate results). This particularly " +"applies to benchmarking Python code against C code: the profilers introduce " +"overhead for Python code, but not for C-level functions, and so the C code " +"would seem faster than any Python one." msgstr "" #: ../../library/profile.rst:51 @@ -223,48 +224,49 @@ msgid "" "formats them in various ways." msgstr "" -#: ../../library/profile.rst:126 +#: ../../library/profile.rst:128 msgid "" "The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script " "to profile another script. For example::" msgstr "" -#: ../../library/profile.rst:129 +#: ../../library/profile.rst:131 msgid "" "python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)" msgstr "" "python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)" -#: ../../library/profile.rst:131 -msgid "``-o`` writes the profile results to a file instead of to stdout" +#: ../../library/profile.rst:135 +msgid "Writes the profile results to a file instead of to stdout." msgstr "" -#: ../../library/profile.rst:133 +#: ../../library/profile.rst:139 msgid "" -"``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to " -"sort the output by. This only applies when ``-o`` is not supplied." +"Specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort " +"the output by. This only applies when :option:`-o ` is not " +"supplied." msgstr "" -#: ../../library/profile.rst:136 -msgid "``-m`` specifies that a module is being profiled instead of a script." +#: ../../library/profile.rst:145 +msgid "Specifies that a module is being profiled instead of a script." msgstr "" -#: ../../library/profile.rst:138 +#: ../../library/profile.rst:147 msgid "Added the ``-m`` option to :mod:`cProfile`." msgstr "新增 ``-m`` 選項到 :mod:`cProfile`。" -#: ../../library/profile.rst:141 +#: ../../library/profile.rst:150 msgid "Added the ``-m`` option to :mod:`profile`." msgstr "新增 ``-m`` 選項到 :mod:`profile`。" -#: ../../library/profile.rst:144 +#: ../../library/profile.rst:153 msgid "" "The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of " "methods for manipulating and printing the data saved into a profile results " "file::" msgstr "" -#: ../../library/profile.rst:147 +#: ../../library/profile.rst:156 msgid "" "import pstats\n" "from pstats import SortKey\n" @@ -276,7 +278,7 @@ msgstr "" "p = pstats.Stats('restats')\n" "p.strip_dirs().sort_stats(-1).print_stats()" -#: ../../library/profile.rst:152 +#: ../../library/profile.rst:161 msgid "" "The :meth:`~pstats.Stats.strip_dirs` method removed the extraneous path from " "all the module names. The :meth:`~pstats.Stats.sort_stats` method sorted all " @@ -285,7 +287,7 @@ msgid "" "statistics. You might try the following sort calls::" msgstr "" -#: ../../library/profile.rst:158 +#: ../../library/profile.rst:167 msgid "" "p.sort_stats(SortKey.NAME)\n" "p.print_stats()" @@ -293,60 +295,60 @@ msgstr "" "p.sort_stats(SortKey.NAME)\n" "p.print_stats()" -#: ../../library/profile.rst:161 +#: ../../library/profile.rst:170 msgid "" "The first call will actually sort the list by function name, and the second " "call will print out the statistics. The following are some interesting " "calls to experiment with::" msgstr "" -#: ../../library/profile.rst:165 +#: ../../library/profile.rst:174 msgid "p.sort_stats(SortKey.CUMULATIVE).print_stats(10)" msgstr "p.sort_stats(SortKey.CUMULATIVE).print_stats(10)" -#: ../../library/profile.rst:167 +#: ../../library/profile.rst:176 msgid "" "This sorts the profile by cumulative time in a function, and then only " "prints the ten most significant lines. If you want to understand what " "algorithms are taking time, the above line is what you would use." msgstr "" -#: ../../library/profile.rst:171 +#: ../../library/profile.rst:180 msgid "" "If you were looking to see what functions were looping a lot, and taking a " "lot of time, you would do::" msgstr "" -#: ../../library/profile.rst:174 +#: ../../library/profile.rst:183 msgid "p.sort_stats(SortKey.TIME).print_stats(10)" msgstr "p.sort_stats(SortKey.TIME).print_stats(10)" -#: ../../library/profile.rst:176 +#: ../../library/profile.rst:185 msgid "" "to sort according to time spent within each function, and then print the " "statistics for the top ten functions." msgstr "" -#: ../../library/profile.rst:179 +#: ../../library/profile.rst:188 msgid "You might also try::" msgstr "" -#: ../../library/profile.rst:181 +#: ../../library/profile.rst:190 msgid "p.sort_stats(SortKey.FILENAME).print_stats('__init__')" msgstr "p.sort_stats(SortKey.FILENAME).print_stats('__init__')" -#: ../../library/profile.rst:183 +#: ../../library/profile.rst:192 msgid "" "This will sort all the statistics by file name, and then print out " "statistics for only the class init methods (since they are spelled with " "``__init__`` in them). As one final example, you could try::" msgstr "" -#: ../../library/profile.rst:187 +#: ../../library/profile.rst:196 msgid "p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')" msgstr "p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')" -#: ../../library/profile.rst:189 +#: ../../library/profile.rst:198 msgid "" "This line sorts statistics with a primary key of time, and a secondary key " "of cumulative time, and then prints out some of the statistics. To be " @@ -355,27 +357,27 @@ msgid "" "list is printed." msgstr "" -#: ../../library/profile.rst:194 +#: ../../library/profile.rst:203 msgid "" "If you wondered what functions called the above functions, you could now " "(``p`` is still sorted according to the last criteria) do::" msgstr "" -#: ../../library/profile.rst:197 +#: ../../library/profile.rst:206 msgid "p.print_callers(.5, 'init')" msgstr "p.print_callers(.5, 'init')" -#: ../../library/profile.rst:199 +#: ../../library/profile.rst:208 msgid "and you would get a list of callers for each of the listed functions." msgstr "" -#: ../../library/profile.rst:201 +#: ../../library/profile.rst:210 msgid "" "If you want more functionality, you're going to have to read the manual, or " "guess what the following functions do::" msgstr "" -#: ../../library/profile.rst:204 +#: ../../library/profile.rst:213 msgid "" "p.print_callees()\n" "p.add('restats')" @@ -383,34 +385,34 @@ msgstr "" "p.print_callees()\n" "p.add('restats')" -#: ../../library/profile.rst:207 +#: ../../library/profile.rst:216 msgid "" "Invoked as a script, the :mod:`pstats` module is a statistics browser for " "reading and examining profile dumps. It has a simple line-oriented " "interface (implemented using :mod:`cmd`) and interactive help." msgstr "" -#: ../../library/profile.rst:212 +#: ../../library/profile.rst:221 msgid ":mod:`profile` and :mod:`cProfile` Module Reference" -msgstr "" +msgstr ":mod:`profile` 與 :mod:`cProfile` 模組參考文件" -#: ../../library/profile.rst:218 +#: ../../library/profile.rst:227 msgid "" "Both the :mod:`profile` and :mod:`cProfile` modules provide the following " "functions:" msgstr "" -#: ../../library/profile.rst:223 +#: ../../library/profile.rst:232 msgid "" "This function takes a single argument that can be passed to the :func:`exec` " "function, and an optional file name. In all cases this routine executes::" msgstr "" -#: ../../library/profile.rst:226 +#: ../../library/profile.rst:235 msgid "exec(command, __main__.__dict__, __main__.__dict__)" msgstr "exec(command, __main__.__dict__, __main__.__dict__)" -#: ../../library/profile.rst:228 +#: ../../library/profile.rst:237 msgid "" "and gathers profiling statistics from the execution. If no file name is " "present, then this function automatically creates a :class:`~pstats.Stats` " @@ -419,27 +421,27 @@ msgid "" "how the results are sorted." msgstr "" -#: ../../library/profile.rst:236 +#: ../../library/profile.rst:245 msgid "" "This function is similar to :func:`run`, with added arguments to supply the " "globals and locals mappings for the *command* string. This routine executes::" msgstr "" -#: ../../library/profile.rst:240 +#: ../../library/profile.rst:249 msgid "exec(command, globals, locals)" msgstr "exec(command, globals, locals)" -#: ../../library/profile.rst:242 +#: ../../library/profile.rst:251 msgid "and gathers profiling statistics as in the :func:`run` function above." msgstr "" -#: ../../library/profile.rst:246 +#: ../../library/profile.rst:255 msgid "" "This class is normally only used if more precise control over profiling is " "needed than what the :func:`cProfile.run` function provides." msgstr "" -#: ../../library/profile.rst:249 +#: ../../library/profile.rst:258 msgid "" "A custom timer can be supplied for measuring how long code takes to run via " "the *timer* argument. This must be a function that returns a single number " @@ -449,13 +451,13 @@ msgid "" "time unit would be ``.001``." msgstr "" -#: ../../library/profile.rst:256 +#: ../../library/profile.rst:265 msgid "" "Directly using the :class:`Profile` class allows formatting profile results " "without writing the profile data to a file::" msgstr "" -#: ../../library/profile.rst:259 +#: ../../library/profile.rst:268 msgid "" "import cProfile, pstats, io\n" "from pstats import SortKey\n" @@ -481,13 +483,13 @@ msgstr "" "ps.print_stats()\n" "print(s.getvalue())" -#: ../../library/profile.rst:271 +#: ../../library/profile.rst:280 msgid "" "The :class:`Profile` class can also be used as a context manager (supported " "only in :mod:`cProfile` module. see :ref:`typecontextmanager`)::" msgstr "" -#: ../../library/profile.rst:274 +#: ../../library/profile.rst:283 msgid "" "import cProfile\n" "\n" @@ -496,61 +498,67 @@ msgid "" "\n" " pr.print_stats()" msgstr "" +"import cProfile\n" +"\n" +"with cProfile.Profile() as pr:\n" +" # ... do something ...\n" +"\n" +" pr.print_stats()" -#: ../../library/profile.rst:281 +#: ../../library/profile.rst:290 msgid "Added context manager support." msgstr "新增情境管理器的支援。" -#: ../../library/profile.rst:286 +#: ../../library/profile.rst:295 msgid "Start collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:290 +#: ../../library/profile.rst:299 msgid "Stop collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:294 +#: ../../library/profile.rst:303 msgid "" "Stop collecting profiling data and record the results internally as the " "current profile." msgstr "" -#: ../../library/profile.rst:299 +#: ../../library/profile.rst:308 msgid "" "Create a :class:`~pstats.Stats` object based on the current profile and " "print the results to stdout." msgstr "" -#: ../../library/profile.rst:302 +#: ../../library/profile.rst:311 msgid "" "The *sort* parameter specifies the sorting order of the displayed " "statistics. It accepts a single key or a tuple of keys to enable multi-level " "sorting, as in :func:`Stats.sort_stats `." msgstr "" -#: ../../library/profile.rst:306 +#: ../../library/profile.rst:315 msgid ":meth:`~Profile.print_stats` now accepts a tuple of keys." msgstr "" -#: ../../library/profile.rst:311 +#: ../../library/profile.rst:320 msgid "Write the results of the current profile to *filename*." msgstr "" -#: ../../library/profile.rst:315 +#: ../../library/profile.rst:324 msgid "Profile the cmd via :func:`exec`." msgstr "" -#: ../../library/profile.rst:319 +#: ../../library/profile.rst:328 msgid "" "Profile the cmd via :func:`exec` with the specified global and local " "environment." msgstr "" -#: ../../library/profile.rst:324 +#: ../../library/profile.rst:333 msgid "Profile ``func(*args, **kwargs)``" msgstr "" -#: ../../library/profile.rst:326 +#: ../../library/profile.rst:335 msgid "" "Note that profiling will only work if the called command/function actually " "returns. If the interpreter is terminated (e.g. via a :func:`sys.exit` call " @@ -558,23 +566,23 @@ msgid "" "printed." msgstr "" -#: ../../library/profile.rst:334 +#: ../../library/profile.rst:343 msgid "The :class:`Stats` Class" -msgstr "" +msgstr ":class:`Stats` 類別" -#: ../../library/profile.rst:336 +#: ../../library/profile.rst:345 msgid "" "Analysis of the profiler data is done using the :class:`~pstats.Stats` class." msgstr "" -#: ../../library/profile.rst:343 +#: ../../library/profile.rst:352 msgid "" "This class constructor creates an instance of a \"statistics object\" from a " "*filename* (or list of filenames) or from a :class:`Profile` instance. " "Output will be printed to the stream specified by *stream*." msgstr "" -#: ../../library/profile.rst:347 +#: ../../library/profile.rst:356 msgid "" "The file selected by the above constructor must have been created by the " "corresponding version of :mod:`profile` or :mod:`cProfile`. To be specific, " @@ -588,40 +596,41 @@ msgid "" "can be used." msgstr "" -#: ../../library/profile.rst:358 +#: ../../library/profile.rst:367 msgid "" "Instead of reading the profile data from a file, a :class:`cProfile.Profile` " "or :class:`profile.Profile` object can be used as the profile data source." msgstr "" -#: ../../library/profile.rst:361 +#: ../../library/profile.rst:370 msgid ":class:`Stats` objects have the following methods:" -msgstr "" +msgstr ":class:`Stats` 物件有以下方法:" -#: ../../library/profile.rst:365 +#: ../../library/profile.rst:374 msgid "" "This method for the :class:`Stats` class removes all leading path " "information from file names. It is very useful in reducing the size of the " "printout to fit within (close to) 80 columns. This method modifies the " "object, and the stripped information is lost. After performing a strip " "operation, the object is considered to have its entries in a \"random\" " -"order, as it was just after object initialization and loading. If :meth:" -"`~pstats.Stats.strip_dirs` causes two function names to be indistinguishable " -"(they are on the same line of the same filename, and have the same function " -"name), then the statistics for these two entries are accumulated into a " -"single entry." +"order, as it was just after object initialization and loading. " +"If :meth:`~pstats.Stats.strip_dirs` causes two function names to be " +"indistinguishable (they are on the same line of the same filename, and have " +"the same function name), then the statistics for these two entries are " +"accumulated into a single entry." msgstr "" -#: ../../library/profile.rst:379 +#: ../../library/profile.rst:388 msgid "" "This method of the :class:`Stats` class accumulates additional profiling " "information into the current profiling object. Its arguments should refer " -"to filenames created by the corresponding version of :func:`profile.run` or :" -"func:`cProfile.run`. Statistics for identically named (re: file, line, name) " -"functions are automatically accumulated into single function statistics." +"to filenames created by the corresponding version of :func:`profile.run` " +"or :func:`cProfile.run`. Statistics for identically named (re: file, line, " +"name) functions are automatically accumulated into single function " +"statistics." msgstr "" -#: ../../library/profile.rst:389 +#: ../../library/profile.rst:398 msgid "" "Save the data loaded into the :class:`Stats` object to a file named " "*filename*. The file is created if it does not exist, and is overwritten if " @@ -629,7 +638,7 @@ msgid "" "the :class:`profile.Profile` and :class:`cProfile.Profile` classes." msgstr "" -#: ../../library/profile.rst:397 +#: ../../library/profile.rst:406 msgid "" "This method modifies the :class:`Stats` object by sorting it according to " "the supplied criteria. The argument can be either a string or a SortKey " @@ -639,7 +648,7 @@ msgid "" "prone." msgstr "" -#: ../../library/profile.rst:404 +#: ../../library/profile.rst:413 msgid "" "When more than one key is provided, then additional keys are used as " "secondary criteria when there is equality in all keys selected before them. " @@ -648,178 +657,178 @@ msgid "" "function names) by sorting by file name." msgstr "" -#: ../../library/profile.rst:410 +#: ../../library/profile.rst:419 msgid "" "For the string argument, abbreviations can be used for any key names, as " "long as the abbreviation is unambiguous." msgstr "" -#: ../../library/profile.rst:413 +#: ../../library/profile.rst:422 msgid "The following are the valid string and SortKey:" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Valid String Arg" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Valid enum Arg" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Meaning" msgstr "含義" -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:427 msgid "``'calls'``" msgstr "``'calls'``" -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:427 msgid "SortKey.CALLS" msgstr "SortKey.CALLS" -#: ../../library/profile.rst:418 ../../library/profile.rst:430 +#: ../../library/profile.rst:427 ../../library/profile.rst:439 msgid "call count" msgstr "" -#: ../../library/profile.rst:420 +#: ../../library/profile.rst:429 msgid "``'cumulative'``" msgstr "``'cumulative'``" -#: ../../library/profile.rst:420 +#: ../../library/profile.rst:429 msgid "SortKey.CUMULATIVE" msgstr "SortKey.CUMULATIVE" -#: ../../library/profile.rst:420 ../../library/profile.rst:422 +#: ../../library/profile.rst:429 ../../library/profile.rst:431 msgid "cumulative time" msgstr "" -#: ../../library/profile.rst:422 +#: ../../library/profile.rst:431 msgid "``'cumtime'``" msgstr "``'cumtime'``" -#: ../../library/profile.rst:422 ../../library/profile.rst:424 -#: ../../library/profile.rst:428 ../../library/profile.rst:430 -#: ../../library/profile.rst:444 +#: ../../library/profile.rst:431 ../../library/profile.rst:433 +#: ../../library/profile.rst:437 ../../library/profile.rst:439 +#: ../../library/profile.rst:453 msgid "N/A" msgstr "N/A" -#: ../../library/profile.rst:424 +#: ../../library/profile.rst:433 msgid "``'file'``" msgstr "``'file'``" -#: ../../library/profile.rst:424 ../../library/profile.rst:426 -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:433 ../../library/profile.rst:435 +#: ../../library/profile.rst:437 msgid "file name" msgstr "file name(檔案名稱)" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:435 msgid "``'filename'``" msgstr "``'filename'``" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:435 msgid "SortKey.FILENAME" msgstr "SortKey.FILENAME" -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:437 msgid "``'module'``" msgstr "``'module'``" -#: ../../library/profile.rst:430 +#: ../../library/profile.rst:439 msgid "``'ncalls'``" msgstr "``'ncalls'``" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "``'pcalls'``" msgstr "``'pcalls'``" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "SortKey.PCALLS" msgstr "SortKey.PCALLS" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "primitive call count" msgstr "" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "SortKey.LINE" msgstr "SortKey.LINE" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "line number" msgstr "列號" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "``'name'``" msgstr "``'name'``" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "SortKey.NAME" msgstr "SortKey.NAME" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "function name" msgstr "" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "``'nfl'``" msgstr "``'nfl'``" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "SortKey.NFL" msgstr "SortKey.NFL" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "name/file/line" msgstr "" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "``'stdname'``" msgstr "``'stdname'``" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "SortKey.STDNAME" msgstr "SortKey.STDNAME" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "standard name" msgstr "" -#: ../../library/profile.rst:442 +#: ../../library/profile.rst:451 msgid "``'time'``" msgstr "``'time'``" -#: ../../library/profile.rst:442 +#: ../../library/profile.rst:451 msgid "SortKey.TIME" msgstr "SortKey.TIME" -#: ../../library/profile.rst:442 ../../library/profile.rst:444 +#: ../../library/profile.rst:451 ../../library/profile.rst:453 msgid "internal time" msgstr "" -#: ../../library/profile.rst:444 +#: ../../library/profile.rst:453 msgid "``'tottime'``" msgstr "``'tottime'``" -#: ../../library/profile.rst:447 +#: ../../library/profile.rst:456 msgid "" "Note that all sorts on statistics are in descending order (placing most time " "consuming items first), where as name, file, and line number searches are in " -"ascending order (alphabetical). The subtle distinction between ``SortKey." -"NFL`` and ``SortKey.STDNAME`` is that the standard name is a sort of the " -"name as printed, which means that the embedded line numbers get compared in " -"an odd way. For example, lines 3, 20, and 40 would (if the file names were " -"the same) appear in the string order 20, 3 and 40. In contrast, ``SortKey." -"NFL`` does a numeric compare of the line numbers. In fact, " +"ascending order (alphabetical). The subtle distinction between " +"``SortKey.NFL`` and ``SortKey.STDNAME`` is that the standard name is a sort " +"of the name as printed, which means that the embedded line numbers get " +"compared in an odd way. For example, lines 3, 20, and 40 would (if the file " +"names were the same) appear in the string order 20, 3 and 40. In contrast, " +"``SortKey.NFL`` does a numeric compare of the line numbers. In fact, " "``sort_stats(SortKey.NFL)`` is the same as ``sort_stats(SortKey.NAME, " "SortKey.FILENAME, SortKey.LINE)``." msgstr "" -#: ../../library/profile.rst:458 +#: ../../library/profile.rst:467 msgid "" "For backward-compatibility reasons, the numeric arguments ``-1``, ``0``, " "``1``, and ``2`` are permitted. They are interpreted as ``'stdname'``, " @@ -828,31 +837,32 @@ msgid "" "used, and additional arguments will be silently ignored." msgstr "" -#: ../../library/profile.rst:466 +#: ../../library/profile.rst:475 msgid "Added the SortKey enum." msgstr "" -#: ../../library/profile.rst:471 +#: ../../library/profile.rst:480 msgid "" "This method for the :class:`Stats` class reverses the ordering of the basic " "list within the object. Note that by default ascending vs descending order " "is properly selected based on the sort key of choice." msgstr "" -#: ../../library/profile.rst:481 +#: ../../library/profile.rst:490 msgid "" "This method for the :class:`Stats` class prints out a report as described in " "the :func:`profile.run` definition." msgstr "" -#: ../../library/profile.rst:484 +#: ../../library/profile.rst:493 msgid "" -"The order of the printing is based on the last :meth:`~pstats.Stats." -"sort_stats` operation done on the object (subject to caveats in :meth:" -"`~pstats.Stats.add` and :meth:`~pstats.Stats.strip_dirs`)." +"The order of the printing is based on the " +"last :meth:`~pstats.Stats.sort_stats` operation done on the object (subject " +"to caveats in :meth:`~pstats.Stats.add` " +"and :meth:`~pstats.Stats.strip_dirs`)." msgstr "" -#: ../../library/profile.rst:489 +#: ../../library/profile.rst:498 msgid "" "The arguments provided (if any) can be used to limit the list down to the " "significant entries. Initially, the list is taken to be the complete set of " @@ -864,28 +874,28 @@ msgid "" "example::" msgstr "" -#: ../../library/profile.rst:498 +#: ../../library/profile.rst:507 msgid "print_stats(.1, 'foo:')" msgstr "print_stats(.1, 'foo:')" -#: ../../library/profile.rst:500 +#: ../../library/profile.rst:509 msgid "" "would first limit the printing to first 10% of list, and then only print " "functions that were part of filename :file:`.\\*foo:`. In contrast, the " "command::" msgstr "" -#: ../../library/profile.rst:504 +#: ../../library/profile.rst:513 msgid "print_stats('foo:', .1)" msgstr "print_stats('foo:', .1)" -#: ../../library/profile.rst:506 +#: ../../library/profile.rst:515 msgid "" "would limit the list to all functions having file names :file:`.\\*foo:`, " "and then proceed to only print the first 10% of them." msgstr "" -#: ../../library/profile.rst:512 +#: ../../library/profile.rst:521 msgid "" "This method for the :class:`Stats` class prints a list of all functions that " "called each function in the profiled database. The ordering is identical to " @@ -895,7 +905,7 @@ msgid "" "produced the stats:" msgstr "" -#: ../../library/profile.rst:519 +#: ../../library/profile.rst:528 msgid "" "With :mod:`profile`, a number is shown in parentheses after each caller to " "show how many times this specific call was made. For convenience, a second " @@ -903,14 +913,14 @@ msgid "" "at the right." msgstr "" -#: ../../library/profile.rst:524 +#: ../../library/profile.rst:533 msgid "" "With :mod:`cProfile`, each caller is preceded by three numbers: the number " "of times this specific call was made, and the total and cumulative times " "spent in the current function while it was invoked by this specific caller." msgstr "" -#: ../../library/profile.rst:532 +#: ../../library/profile.rst:541 msgid "" "This method for the :class:`Stats` class prints a list of all function that " "were called by the indicated function. Aside from this reversal of " @@ -918,7 +928,7 @@ msgid "" "are identical to the :meth:`~pstats.Stats.print_callers` method." msgstr "" -#: ../../library/profile.rst:540 +#: ../../library/profile.rst:549 msgid "" "This method returns an instance of StatsProfile, which contains a mapping of " "function names to instances of FunctionProfile. Each FunctionProfile " @@ -926,17 +936,17 @@ msgid "" "long the function took to run, how many times it was called, etc..." msgstr "" -#: ../../library/profile.rst:545 +#: ../../library/profile.rst:554 msgid "" "Added the following dataclasses: StatsProfile, FunctionProfile. Added the " "following function: get_stats_profile." msgstr "" -#: ../../library/profile.rst:552 +#: ../../library/profile.rst:561 msgid "What Is Deterministic Profiling?" msgstr "" -#: ../../library/profile.rst:554 +#: ../../library/profile.rst:563 msgid "" ":dfn:`Deterministic profiling` is meant to reflect the fact that all " "*function call*, *function return*, and *exception* events are monitored, " @@ -949,7 +959,7 @@ msgid "" "being spent." msgstr "" -#: ../../library/profile.rst:563 +#: ../../library/profile.rst:572 msgid "" "In Python, since there is an interpreter active during execution, the " "presence of instrumented code is not required in order to do deterministic " @@ -961,7 +971,7 @@ msgid "" "time statistics about the execution of a Python program." msgstr "" -#: ../../library/profile.rst:572 +#: ../../library/profile.rst:581 msgid "" "Call count statistics can be used to identify bugs in code (surprising " "counts), and to identify possible inline-expansion points (high call " @@ -973,11 +983,11 @@ msgid "" "compared to iterative implementations." msgstr "" -#: ../../library/profile.rst:585 +#: ../../library/profile.rst:594 msgid "Limitations" msgstr "限制" -#: ../../library/profile.rst:587 +#: ../../library/profile.rst:596 msgid "" "One limitation has to do with accuracy of timing information. There is a " "fundamental problem with deterministic profilers involving accuracy. The " @@ -988,7 +998,7 @@ msgid "" "first error induces a second source of error." msgstr "" -#: ../../library/profile.rst:595 +#: ../../library/profile.rst:604 msgid "" "The second problem is that it \"takes a while\" from when an event is " "dispatched until the profiler's call to get the time actually *gets* the " @@ -1001,7 +1011,7 @@ msgid "" "clock tick), but it *can* accumulate and become very significant." msgstr "" -#: ../../library/profile.rst:605 +#: ../../library/profile.rst:614 msgid "" "The problem is more important with :mod:`profile` than with the lower-" "overhead :mod:`cProfile`. For this reason, :mod:`profile` provides a means " @@ -1015,11 +1025,11 @@ msgid "" "calibration." msgstr "" -#: ../../library/profile.rst:619 +#: ../../library/profile.rst:628 msgid "Calibration" msgstr "校正" -#: ../../library/profile.rst:621 +#: ../../library/profile.rst:630 msgid "" "The profiler of the :mod:`profile` module subtracts a constant from each " "event handling time to compensate for the overhead of calling the time " @@ -1028,7 +1038,7 @@ msgid "" "platform (see :ref:`profile-limitations`). ::" msgstr "" -#: ../../library/profile.rst:627 +#: ../../library/profile.rst:636 msgid "" "import profile\n" "pr = profile.Profile()\n" @@ -1040,7 +1050,7 @@ msgstr "" "for i in range(5):\n" " print(pr.calibrate(10000))" -#: ../../library/profile.rst:632 +#: ../../library/profile.rst:641 msgid "" "The method executes the number of Python calls given by the argument, " "directly and again under the profiler, measuring the time for both. It then " @@ -1050,19 +1060,19 @@ msgid "" "4.04e-6." msgstr "" -#: ../../library/profile.rst:638 +#: ../../library/profile.rst:647 msgid "" "The object of this exercise is to get a fairly consistent result. If your " "computer is *very* fast, or your timer function has poor resolution, you " "might have to pass 100000, or even 1000000, to get consistent results." msgstr "" -#: ../../library/profile.rst:642 +#: ../../library/profile.rst:651 msgid "" "When you have a consistent answer, there are three ways you can use it::" msgstr "" -#: ../../library/profile.rst:644 +#: ../../library/profile.rst:653 msgid "" "import profile\n" "\n" @@ -1077,40 +1087,40 @@ msgid "" "pr = profile.Profile(bias=your_computed_bias)" msgstr "" -#: ../../library/profile.rst:656 +#: ../../library/profile.rst:665 msgid "" "If you have a choice, you are better off choosing a smaller constant, and " "then your results will \"less often\" show up as negative in profile " "statistics." msgstr "" -#: ../../library/profile.rst:662 +#: ../../library/profile.rst:671 msgid "Using a custom timer" msgstr "" -#: ../../library/profile.rst:664 +#: ../../library/profile.rst:673 msgid "" "If you want to change how current time is determined (for example, to force " "use of wall-clock time or elapsed process time), pass the timing function " "you want to the :class:`Profile` class constructor::" msgstr "" -#: ../../library/profile.rst:668 +#: ../../library/profile.rst:677 msgid "pr = profile.Profile(your_time_func)" msgstr "pr = profile.Profile(your_time_func)" -#: ../../library/profile.rst:670 +#: ../../library/profile.rst:679 msgid "" "The resulting profiler will then call ``your_time_func``. Depending on " "whether you are using :class:`profile.Profile` or :class:`cProfile.Profile`, " "``your_time_func``'s return value will be interpreted differently:" msgstr "" -#: ../../library/profile.rst:674 +#: ../../library/profile.rst:683 msgid ":class:`profile.Profile`" msgstr ":class:`profile.Profile`" -#: ../../library/profile.rst:675 +#: ../../library/profile.rst:684 msgid "" "``your_time_func`` should return a single number, or a list of numbers whose " "sum is the current time (like what :func:`os.times` returns). If the " @@ -1119,7 +1129,7 @@ msgid "" "routine." msgstr "" -#: ../../library/profile.rst:681 +#: ../../library/profile.rst:690 msgid "" "Be warned that you should calibrate the profiler class for the timer " "function that you choose (see :ref:`profile-calibration`). For most " @@ -1131,11 +1141,11 @@ msgid "" "along with the appropriate calibration constant." msgstr "" -#: ../../library/profile.rst:690 +#: ../../library/profile.rst:699 msgid ":class:`cProfile.Profile`" msgstr ":class:`cProfile.Profile`" -#: ../../library/profile.rst:691 +#: ../../library/profile.rst:700 msgid "" "``your_time_func`` should return a single number. If it returns integers, " "you can also invoke the class constructor with a second argument specifying " @@ -1144,11 +1154,11 @@ msgid "" "you would construct the :class:`Profile` instance as follows::" msgstr "" -#: ../../library/profile.rst:697 +#: ../../library/profile.rst:706 msgid "pr = cProfile.Profile(your_integer_time_func, 0.001)" msgstr "pr = cProfile.Profile(your_integer_time_func, 0.001)" -#: ../../library/profile.rst:699 +#: ../../library/profile.rst:708 msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " @@ -1156,11 +1166,11 @@ msgid "" "in the C source of the internal :mod:`!_lsprof` module." msgstr "" -#: ../../library/profile.rst:704 +#: ../../library/profile.rst:713 msgid "" "Python 3.3 adds several new functions in :mod:`time` that can be used to " -"make precise measurements of process or wall-clock time. For example, see :" -"func:`time.perf_counter`." +"make precise measurements of process or wall-clock time. For example, " +"see :func:`time.perf_counter`." msgstr "" #: ../../library/profile.rst:16 diff --git a/library/pwd.po b/library/pwd.po index aac5275e62..4f4a5acc84 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -144,11 +144,10 @@ msgid "" "The uid and gid items are integers, all others are strings. :exc:`KeyError` " "is raised if the entry asked for cannot be found." msgstr "" -"uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引發 :exc:" -"`KeyError`。" +"uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引" +"發 :exc:`KeyError`。" #: ../../library/pwd.rst:42 -#, fuzzy msgid "" "In traditional Unix the field ``pw_passwd`` usually contains a password " "encrypted with a DES derived algorithm. However most modern unices use a " @@ -158,12 +157,11 @@ msgid "" "world readable. Whether the *pw_passwd* field contains anything useful is " "system-dependent." msgstr "" -"在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密碼" -"(參見模組 :mod:`crypt`)。然而,大多數現代 Unix 是使用所謂的 *shadow " -"password* 系統。在那些 Unix 上,*pw_passwd* 欄位僅包含一個星號 (``'*'``) 或字" -"母 ``'x'``,其中加密密碼存儲在非全域可讀的 (not world readable) :file:`/etc/" -"shadow` 文件中。 *pw_passwd* 欄位是否包含任何有用的內容取決於系統。如果可用," -"應該要在需要存取加密密碼的地方使用 :mod:`spwd` 模組。" +"在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密" +"碼。然而,大多數現代 Unix 是使用所謂的 *shadow password* 系統。在那些 Unix " +"上,*pw_passwd* 欄位僅包含一個星號 (``'*'``) 或字母 ``'x'``,其中加密密碼存儲" +"在非全域可讀的 (not world readable) :file:`/etc/shadow` 檔案中。*pw_passwd* " +"欄位是否包含任何有用的內容取決於系統。" #: ../../library/pwd.rst:50 msgid "It defines the following items:" diff --git a/library/python.po b/library/python.po index 804cb269c0..2c76635377 100644 --- a/library/python.po +++ b/library/python.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -28,3 +27,5 @@ msgid "" "related to the Python interpreter and its interaction with its environment. " "Here's an overview:" msgstr "" +"本章節所描述的模組提供了與 Python 直譯器及其與環境互動相關的廣泛服務。以下是" +"概觀:" diff --git a/library/queue.po b/library/queue.po index 489a62d536..601d813016 100644 --- a/library/queue.po +++ b/library/queue.po @@ -328,7 +328,7 @@ msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc: #: ../../library/queue.rst:199 msgid "Blocks until all items in the queue have been gotten and processed." -msgstr "持續阻塞直到佇列中的所有項目都已被獲取並處理完畢。" +msgstr "持續阻塞直到佇列中的所有項目都已被取得並處理完畢。" #: ../../library/queue.rst:201 msgid "" diff --git a/library/random.po b/library/random.po index 08679f4e90..b4196649ec 100644 --- a/library/random.po +++ b/library/random.po @@ -3,13 +3,14 @@ # # Translators: # Allen Wu , 2021 +# Dr.XYZ , 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-27 00:14+0000\n" -"PO-Revision-Date: 2023-01-23 22:47+0800\n" -"Last-Translator: Allen Wu \n" +"PO-Revision-Date: 2025-03-07 19:17+0800\n" +"Last-Translator: Dr.XYZ \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,11 +18,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.2.2\n" +"X-Generator: Poedit 3.5\n" #: ../../library/random.rst:2 msgid ":mod:`!random` --- Generate pseudo-random numbers" -msgstr ":mod:`!random` --- 生成偽隨機數" +msgstr ":mod:`!random` --- 產生偽隨機數" #: ../../library/random.rst:7 msgid "**Source code:** :source:`Lib/random.py`" @@ -41,7 +42,7 @@ msgid "" "replacement." msgstr "" "對於整數,可以從範圍中進行均勻選擇。對於序列,有一個隨機元素的均勻選擇,一個" -"用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機採樣不替換的函" +"用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機取樣不重置的函" "式。" #: ../../library/random.rst:19 @@ -51,7 +52,7 @@ msgid "" "generating distributions of angles, the von Mises distribution is available." msgstr "" "在實數線上,有一些函式用於處理均勻分佈、常態分佈(高斯分佈)、對數常態分佈、" -"負指數分佈、gamma 分佈和 Beta 分佈。對於生成角度分佈,可以使用馮·米塞斯分佈 " +"負指數分佈、gamma 分佈和 Beta 分佈。對於產生角度分佈,可以使用馮·米塞斯分佈 " "(von Mises distribution)。" #: ../../library/random.rst:23 @@ -66,7 +67,7 @@ msgid "" "purposes, and is completely unsuitable for cryptographic purposes." msgstr "" "幾乎所有 module 函式都相依於基本函式 :func:`.random`,此函式在半開放範圍 " -"``0.0 <= X < 1.0`` 內均勻地生成一個隨機 float(浮點數)。Python 使用 " +"``0.0 <= X < 1.0`` 內均勻地產生一個隨機 float(浮點數)。Python 使用 " "Mersenne Twister(梅森旋轉演算法)作為核心的產生器,它產生 53 位元精度 " "float,其週期為 2\\*\\*19937-1,透過 C 語言進行底層的實作既快速又支援執行緒安" "全 (threadsafe)。Mersenne Twister 是現存最廣泛被驗證的隨機數產生器之一,但是" @@ -137,6 +138,9 @@ msgid "" "contention and poor performance. Consider using separate instances of :class:" "`Random` per thread instead." msgstr "" +"全域隨機數產生器和 :class:`Random` 的實例是執行緒安全的。然而,在自由執行緒構" +"建中,對全域產生器或同一 :class:`Random` 實例的並行呼叫可能會遇到爭用和性能不" +"佳。請考慮改為每個執行緒使用單獨的 :class:`Random` 實例。" #: ../../library/random.rst:70 msgid "Bookkeeping functions" @@ -153,7 +157,7 @@ msgid "" "instead of the system time (see the :func:`os.urandom` function for details " "on availability)." msgstr "" -"如果 *a* 被省略或為 ``None``,則使用當前系統時間。如果隨機來源由作業系統提" +"如果 *a* 被省略或為 ``None``,則使用目前系統時間。如果隨機來源由作業系統提" "供,則使用它們而不是系統時間(有關可用性的詳細資訊,請參考 :func:`os." "urandom` 函式)。" @@ -177,7 +181,7 @@ msgid "" "generates a narrower range of seeds." msgstr "" "若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :" -"class:`bytes` 的演算法會生成範圍更窄的種子 (seed)。" +"class:`bytes` 的演算法會產生範圍更窄的種子 (seed)。" #: ../../library/random.rst:90 msgid "" @@ -197,7 +201,7 @@ msgid "" "Return an object capturing the current internal state of the generator. " "This object can be passed to :func:`setstate` to restore the state." msgstr "" -"回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以" +"回傳一個物件,捕獲產生器的目前內部狀態。此物件可以傳遞給 :func:`setstate` 以" "恢復狀態。" #: ../../library/random.rst:106 @@ -816,6 +820,31 @@ msgid "" ">>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement\n" "[40, 10, 50, 30]" msgstr "" +">>> random() # 隨機浮點數:0.0 <= x < 1.0\n" +"0.37444887175646646\n" +"\n" +">>> uniform(2.5, 10.0) # 隨機浮點數:2.5 <= x <= 10.0\n" +"3.1800146073117523\n" +"\n" +">>> expovariate(1 / 5) # 到達間隔平均為 5 秒\n" +"5.148957571865031\n" +"\n" +">>> randrange(10) # 0 到 9(含)的整數\n" +"7\\n\n" +"\n" +">>> randrange(0, 101, 2) # 0 到 100(含)的偶數整數\n" +"26\\n\n" +"\n" +">>> choice(['win', 'lose', 'draw']) # 從序列中隨機選取單一元素\n" +"'draw'\n" +"\n" +">>> deck = 'ace two three four'.split()\n" +">>> shuffle(deck) # 打亂串列\n" +">>> deck\n" +"['four', 'two', 'ace', 'three']\n" +"\n" +">>> sample([10, 20, 30, 40, 50], k=4) # 四個無重置的樣本\n" +"[40, 10, 50, 30]" #: ../../library/random.rst:510 msgid "Simulations::" @@ -846,6 +875,27 @@ msgid "" ">>> sum(trial() for i in range(10_000)) / 10_000\n" "0.7958" msgstr "" +">>> # 六次輪盤旋轉(有重置的加權抽樣)\n" +">>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n" +"['red', 'green', 'black', 'black', 'red', 'black']\n" +"\n" +">>> # 從一副 52 張撲克牌中無重置發 20 張牌\n" +">>> # 並確定具有十點值的牌的比例:十、傑克、王后或國王\n" +">>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20)\n" +">>> deal.count('tens') / 20\n" +"0.15\n" +"\n" +">>> # 估計從 7 次旋轉中得到 5 次或更多正面的概率\n" +">>> # 使用一枚 60% 概率為正面的偏幣\n" +">>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000\n" +"0.4169\n" +"\n" +">>> # 計算 5 個樣本的中位數位於中間兩個四分位數的概率\n" +">>> def trial():\n" +"... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500\n" +"...\n" +">>> sum(trial() for i in range(10_000)) / 10_000\n" +"0.7958" #: ../../library/random.rst:535 msgid "" @@ -916,6 +966,26 @@ msgid "" "print(f'hypothesis that there is no difference between the drug and the " "placebo.')" msgstr "" +"# 範例來自 Dennis Shasha 和 Manda Wilson 的 \"Statistics is Easy\"\n" +"from statistics import fmean as mean\n" +"from random import shuffle\n" +"\n" +"drug = [54, 73, 53, 70, 73, 68, 52, 65, 65]\n" +"placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46]\n" +"observed_diff = mean(drug) - mean(placebo)\n" +"\n" +"n = 10_000\n" +"count = 0\n" +"combined = drug + placebo\n" +"for i in range(n):\n" +" shuffle(combined)\n" +" new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):])\n" +" count += (new_diff >= observed_diff)\n" +"\n" +"print(f'{n} 次標籤重新洗牌僅產生 {count} 個差異實例')\n" +"print(f'至少與觀察到的差異 {observed_diff:.1f} 一樣極端。')\n" +"print(f'單邊 p 值 {count / n:.4f} 使我們拒絕無效假設')\n" +"print(f'即藥物與安慰劑之間沒有差異。')" #: ../../library/random.rst:575 msgid "" @@ -950,6 +1020,31 @@ msgid "" "print(f'Mean wait: {mean(waits):.1f} Max wait: {max(waits):.1f}')\n" "print('Quartiles:', [round(q, 1) for q in quantiles(waits)])" msgstr "" +"from heapq import heapify, heapreplace\n" +"from random import expovariate, gauss\n" +"from statistics import mean, quantiles\n" +"\n" +"average_arrival_interval = 5.6\n" +"average_service_time = 15.0\n" +"stdev_service_time = 3.5\n" +"num_servers = 3\n" +"\n" +"waits = []\n" +"arrival_time = 0.0\n" +"servers = [0.0] * num_servers # 每個伺服器可用的時間\n" +"heapify(servers)\n" +"for i in range(1_000_000):\n" +" arrival_time += expovariate(1.0 / average_arrival_interval)\n" +" next_server_available = servers[0]\n" +" wait = max(0.0, next_server_available - arrival_time)\n" +" waits.append(wait)\n" +" service_duration = max(0.0, gauss(average_service_time, " +"stdev_service_time))\n" +" service_completed = arrival_time + wait + service_duration\n" +" heapreplace(servers, service_completed)\n" +"\n" +"print(f'平均等待時間:{mean(waits):.1f} 最大等待時間:{max(waits):.1f}')\n" +"print('四分位數:', [round(q, 1) for q in quantiles(waits)])" #: ../../library/random.rst:604 msgid "" @@ -1028,6 +1123,31 @@ msgid "" " indices = sorted(random.choices(range(n), k=r))\n" " return tuple(pool[i] for i in indices)" msgstr "" +"def random_product(*args, repeat=1):\n" +" \"從 itertools.product(*args, **kwds) 中隨機選擇\"\n" +" pools = [tuple(pool) for pool in args] * repeat\n" +" return tuple(map(random.choice, pools))\n" +"\n" +"def random_permutation(iterable, r=None):\n" +" \"從 itertools.permutations(iterable, r) 中隨機選擇\"\n" +" pool = tuple(iterable)\n" +" r = len(pool) if r is None else r\n" +" return tuple(random.sample(pool, r))\n" +"\n" +"def random_combination(iterable, r):\n" +" \"從 itertools.combinations(iterable, r) 中隨機選擇\"\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.sample(range(n), r))\n" +" return tuple(pool[i] for i in indices)\n" +"\n" +"def random_combination_with_replacement(iterable, r):\n" +" \"有重置地選擇 r 個元素。結果按可疊代物件排序。\"\n" +" # 結果將在 set(itertools.combinations_with_replacement(iterable, r)) 中\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.choices(range(n), k=r))\n" +" return tuple(pool[i] for i in indices)" #: ../../library/random.rst:659 msgid "" @@ -1131,64 +1251,64 @@ msgstr "" #: ../../library/random.rst:713 msgid "Command-line usage" -msgstr "" +msgstr "命令列用法" #: ../../library/random.rst:717 msgid "The :mod:`!random` module can be executed from the command line." -msgstr "" +msgstr ":mod:`!random` 模組可以從命令列執行。" #: ../../library/random.rst:719 msgid "" "python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" msgstr "" +"python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" #: ../../library/random.rst:723 -#, fuzzy msgid "The following options are accepted:" -msgstr "以下函式產生離散分佈。" +msgstr "接受以下選項:" #: ../../library/random.rst:729 msgid "Show the help message and exit." -msgstr "" +msgstr "顯示幫助訊息並退出。" #: ../../library/random.rst:734 msgid "Print a random choice, using :meth:`choice`." -msgstr "" +msgstr "列印一個隨機選擇,使用 :meth:`choice`。" #: ../../library/random.rst:739 msgid "" "Print a random integer between 1 and N inclusive, using :meth:`randint`." -msgstr "" +msgstr "列印 1 到 N(含)之間的隨機整數,使用 :meth:`randint`。" #: ../../library/random.rst:744 msgid "" "Print a random floating-point number between 0 and N inclusive, using :meth:" "`uniform`." -msgstr "" +msgstr "列印 0 到 N(含)之間的隨機浮點數,使用 :meth:`uniform`。" #: ../../library/random.rst:747 msgid "If no options are given, the output depends on the input:" -msgstr "" +msgstr "如果未給定選項,則輸出取決於輸入:" #: ../../library/random.rst:749 msgid "String or multiple: same as :option:`--choice`." -msgstr "" +msgstr "字串或多個:與 :option:`--choice` 相同。" #: ../../library/random.rst:750 msgid "Integer: same as :option:`--integer`." -msgstr "" +msgstr "整數:與 :option:`--integer` 相同。" #: ../../library/random.rst:751 msgid "Float: same as :option:`--float`." -msgstr "" +msgstr "浮點數:與 :option:`--float` 相同。" #: ../../library/random.rst:756 msgid "Command-line example" -msgstr "" +msgstr "命令列範例" #: ../../library/random.rst:758 msgid "Here are some examples of the :mod:`!random` command-line interface:" -msgstr "" +msgstr "以下是 :mod:`!random` 命令列介面的一些範例:" #: ../../library/random.rst:760 msgid "" @@ -1222,3 +1342,32 @@ msgid "" "$ python -m random --float 6\n" "3.1942323316565915" msgstr "" +"$ # 隨機選擇一個\n" +"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux " +"crevettes with a Mornay sauce\"\n" +"Lobster Thermidor aux crevettes with a Mornay sauce\n" +"\n" +"$ # 隨機整數\n" +"$ python -m random 6\n" +"6\n" +"\n" +"$ # 隨機浮點數\n" +"$ python -m random 1.8\n" +"1.7080016272295635\n" +"\n" +"$ # 使用明確的引數\n" +"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor " +"aux crevettes with a Mornay sauce\"\n" +"egg\n" +"\n" +"$ python -m random --integer 6\n" +"3\n" +"\n" +"$ python -m random --float 1.8\n" +"1.5666339105010318\n" +"\n" +"$ python -m random --integer 6\n" +"5\n" +"\n" +"$ python -m random --float 6\n" +"3.1942323316565915" diff --git a/library/re.po b/library/re.po index c5ceb995d2..f62cafba70 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,7 +62,7 @@ msgid "" "future this will become a :exc:`SyntaxError`. This behaviour will happen " "even if it is a valid escape sequence for a regular expression." msgstr "" -"正規表示式使用反斜線字元 (``'\\'``) 表示特別的形式,或是使用特殊字元而不調用" +"正規表示式使用反斜線字元 (``'\\'``) 表示特別的形式,或是使用特殊字元而不呼叫" "它們的特殊意義。這與 Python 在字串文本 (literal) 中,為了一樣的目的使用同一個" "字元的目的相衝突;舉例來說,為了配對一個反斜線文字,一個人可能需要寫 ``'\\\\" "\\\\'`` 當作模式字串,因為正規表示式必須是 ``\\\\``,而且每個反斜線在一個普通" @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1649 +#: ../../library/re.rst:101 ../../library/re.rst:1658 msgid "``.``" msgstr "``.``" @@ -379,19 +379,24 @@ msgstr "" #: ../../library/re.rst:253 msgid "" -"Special characters lose their special meaning inside sets. For example, " -"``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, " -"``'*'``, or ``')'``." +"Special characters except backslash lose their special meaning inside sets. " +"For example, ``[(+*)]`` will match any of the literal characters ``'('``, " +"``'+'``, ``'*'``, or ``')'``." msgstr "" -#: ../../library/re.rst:259 +#: ../../library/re.rst:260 msgid "" -"Character classes such as ``\\w`` or ``\\S`` (defined below) are also " -"accepted inside a set, although the characters they match depend on the " -"flags_ used." +"Backslash either escapes characters which have special meaning in a set such " +"as ``'-'``, ``']'``, ``'^'`` and ``'\\\\'`` itself or signals a special " +"sequence which represents a single character such as ``\\xa0`` or ``\\n`` or " +"a character class such as ``\\w`` or ``\\S`` (defined below). Note that " +"``\\b`` represents a single \"backspace\" character, not a word boundary as " +"outside a set, and numeric escapes such as ``\\1`` are always octal escapes, " +"not group references. Special sequences which do not match a single " +"character such as ``\\A`` and ``\\Z`` are not allowed." msgstr "" -#: ../../library/re.rst:264 +#: ../../library/re.rst:273 msgid "" "Characters that are not within a range can be matched by :dfn:" "`complementing` the set. If the first character of the set is ``'^'``, all " @@ -401,7 +406,7 @@ msgid "" "first character in the set." msgstr "" -#: ../../library/re.rst:271 +#: ../../library/re.rst:280 msgid "" "To match a literal ``']'`` inside a set, precede it with a backslash, or " "place it at the beginning of the set. For example, both ``[()[\\]{}]`` and " @@ -409,7 +414,7 @@ msgid "" "and parentheses." msgstr "" -#: ../../library/re.rst:281 +#: ../../library/re.rst:290 msgid "" "Support of nested sets and set operations as in `Unicode Technical Standard " "#18`_ might be added in the future. This would change the syntax, so to " @@ -419,17 +424,17 @@ msgid "" "``'||'``. To avoid a warning escape them with a backslash." msgstr "" -#: ../../library/re.rst:291 +#: ../../library/re.rst:300 msgid "" ":exc:`FutureWarning` is raised if a character set contains constructs that " "will change semantically in the future." msgstr "" -#: ../../library/re.rst:297 +#: ../../library/re.rst:306 msgid "``|``" msgstr "``|``" -#: ../../library/re.rst:298 +#: ../../library/re.rst:307 msgid "" "``A|B``, where *A* and *B* can be arbitrary REs, creates a regular " "expression that will match either *A* or *B*. An arbitrary number of REs " @@ -442,11 +447,11 @@ msgid "" "use ``\\|``, or enclose it inside a character class, as in ``[|]``." msgstr "" -#: ../../library/re.rst:311 +#: ../../library/re.rst:320 msgid "``(...)``" msgstr "``(...)``" -#: ../../library/re.rst:312 +#: ../../library/re.rst:321 msgid "" "Matches whatever regular expression is inside the parentheses, and indicates " "the start and end of a group; the contents of a group can be retrieved after " @@ -456,11 +461,11 @@ msgid "" "character class: ``[(]``, ``[)]``." msgstr "" -#: ../../library/re.rst:320 +#: ../../library/re.rst:329 msgid "``(?...)``" msgstr "``(?...)``" -#: ../../library/re.rst:321 +#: ../../library/re.rst:330 msgid "" "This is an extension notation (a ``'?'`` following a ``'('`` is not " "meaningful otherwise). The first character after the ``'?'`` determines " @@ -469,46 +474,46 @@ msgid "" "rule. Following are the currently supported extensions." msgstr "" -#: ../../library/re.rst:327 +#: ../../library/re.rst:336 msgid "``(?aiLmsux)``" msgstr "``(?aiLmsux)``" -#: ../../library/re.rst:328 +#: ../../library/re.rst:337 msgid "" "(One or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``.) The group matches the empty string; the letters " "set the corresponding flags for the entire regular expression:" msgstr "" -#: ../../library/re.rst:333 ../../library/re.rst:365 +#: ../../library/re.rst:342 ../../library/re.rst:374 msgid ":const:`re.A` (ASCII-only matching)" msgstr "" -#: ../../library/re.rst:334 ../../library/re.rst:366 +#: ../../library/re.rst:343 ../../library/re.rst:375 msgid ":const:`re.I` (ignore case)" msgstr "" -#: ../../library/re.rst:335 ../../library/re.rst:367 +#: ../../library/re.rst:344 ../../library/re.rst:376 msgid ":const:`re.L` (locale dependent)" msgstr "" -#: ../../library/re.rst:336 ../../library/re.rst:368 +#: ../../library/re.rst:345 ../../library/re.rst:377 msgid ":const:`re.M` (multi-line)" msgstr "" -#: ../../library/re.rst:337 ../../library/re.rst:369 +#: ../../library/re.rst:346 ../../library/re.rst:378 msgid ":const:`re.S` (dot matches all)" msgstr "" -#: ../../library/re.rst:338 ../../library/re.rst:370 +#: ../../library/re.rst:347 ../../library/re.rst:379 msgid ":const:`re.U` (Unicode matching)" msgstr "" -#: ../../library/re.rst:339 ../../library/re.rst:371 +#: ../../library/re.rst:348 ../../library/re.rst:380 msgid ":const:`re.X` (verbose)" msgstr "" -#: ../../library/re.rst:341 +#: ../../library/re.rst:350 msgid "" "(The flags are described in :ref:`contents-of-module-re`.) This is useful if " "you wish to include the flags as part of the regular expression, instead of " @@ -516,15 +521,15 @@ msgid "" "be used first in the expression string." msgstr "" -#: ../../library/re.rst:347 +#: ../../library/re.rst:356 msgid "This construction can only be used at the start of the expression." msgstr "" -#: ../../library/re.rst:352 +#: ../../library/re.rst:361 msgid "``(?:...)``" msgstr "``(?:...)``" -#: ../../library/re.rst:353 +#: ../../library/re.rst:362 msgid "" "A non-capturing version of regular parentheses. Matches whatever regular " "expression is inside the parentheses, but the substring matched by the group " @@ -532,11 +537,11 @@ msgid "" "pattern." msgstr "" -#: ../../library/re.rst:358 +#: ../../library/re.rst:367 msgid "``(?aiLmsux-imsx:...)``" msgstr "``(?aiLmsux-imsx:...)``" -#: ../../library/re.rst:359 +#: ../../library/re.rst:368 msgid "" "(Zero or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``, optionally followed by ``'-'`` followed by one or " @@ -544,11 +549,11 @@ msgid "" "or remove the corresponding flags for the part of the expression:" msgstr "" -#: ../../library/re.rst:373 +#: ../../library/re.rst:382 msgid "(The flags are described in :ref:`contents-of-module-re`.)" msgstr "" -#: ../../library/re.rst:375 +#: ../../library/re.rst:384 msgid "" "The letters ``'a'``, ``'L'`` and ``'u'`` are mutually exclusive when used as " "inline flags, so they can't be combined or follow ``'-'``. Instead, when " @@ -561,15 +566,15 @@ msgid "" "restored outside of the group." msgstr "" -#: ../../library/re.rst:387 +#: ../../library/re.rst:396 msgid "The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group." msgstr "" -#: ../../library/re.rst:390 +#: ../../library/re.rst:399 msgid "``(?>...)``" msgstr "``(?>...)``" -#: ../../library/re.rst:391 +#: ../../library/re.rst:400 msgid "" "Attempts to match ``...`` as if it was a separate regular expression, and if " "successful, continues to match the rest of the pattern following it. If the " @@ -583,11 +588,11 @@ msgid "" "thus fail to match." msgstr "" -#: ../../library/re.rst:407 +#: ../../library/re.rst:416 msgid "``(?P...)``" msgstr "``(?P...)``" -#: ../../library/re.rst:408 +#: ../../library/re.rst:417 msgid "" "Similar to regular parentheses, but the substring matched by the group is " "accessible via the symbolic group name *name*. Group names must be valid " @@ -597,108 +602,108 @@ msgid "" "the group were not named." msgstr "" -#: ../../library/re.rst:415 +#: ../../library/re.rst:424 msgid "" "Named groups can be referenced in three contexts. If the pattern is ``(?" "P['\"]).*?(?P=quote)`` (i.e. matching a string quoted with either " "single or double quotes):" msgstr "" -#: ../../library/re.rst:420 +#: ../../library/re.rst:429 msgid "Context of reference to group \"quote\"" msgstr "" -#: ../../library/re.rst:420 +#: ../../library/re.rst:429 msgid "Ways to reference it" msgstr "" -#: ../../library/re.rst:422 +#: ../../library/re.rst:431 msgid "in the same pattern itself" msgstr "" -#: ../../library/re.rst:422 +#: ../../library/re.rst:431 msgid "``(?P=quote)`` (as shown)" msgstr "" -#: ../../library/re.rst:423 ../../library/re.rst:430 +#: ../../library/re.rst:432 ../../library/re.rst:439 msgid "``\\1``" msgstr "``\\1``" -#: ../../library/re.rst:425 +#: ../../library/re.rst:434 msgid "when processing match object *m*" msgstr "" -#: ../../library/re.rst:425 +#: ../../library/re.rst:434 msgid "``m.group('quote')``" msgstr "``m.group('quote')``" -#: ../../library/re.rst:426 +#: ../../library/re.rst:435 msgid "``m.end('quote')`` (etc.)" msgstr "" -#: ../../library/re.rst:428 +#: ../../library/re.rst:437 msgid "in a string passed to the *repl* argument of ``re.sub()``" msgstr "" -#: ../../library/re.rst:428 +#: ../../library/re.rst:437 msgid "``\\g``" msgstr "``\\g``" -#: ../../library/re.rst:429 +#: ../../library/re.rst:438 msgid "``\\g<1>``" msgstr "``\\g<1>``" -#: ../../library/re.rst:433 +#: ../../library/re.rst:442 msgid "" "In :class:`bytes` patterns, group *name* can only contain bytes in the ASCII " "range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:439 +#: ../../library/re.rst:448 msgid "``(?P=name)``" msgstr "``(?P=name)``" -#: ../../library/re.rst:440 +#: ../../library/re.rst:449 msgid "" "A backreference to a named group; it matches whatever text was matched by " "the earlier group named *name*." msgstr "" -#: ../../library/re.rst:445 +#: ../../library/re.rst:454 msgid "``(?#...)``" msgstr "``(?#...)``" -#: ../../library/re.rst:446 +#: ../../library/re.rst:455 msgid "A comment; the contents of the parentheses are simply ignored." msgstr "" -#: ../../library/re.rst:450 +#: ../../library/re.rst:459 msgid "``(?=...)``" msgstr "``(?=...)``" -#: ../../library/re.rst:451 +#: ../../library/re.rst:460 msgid "" "Matches if ``...`` matches next, but doesn't consume any of the string. " "This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?" "=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:457 +#: ../../library/re.rst:466 msgid "``(?!...)``" msgstr "``(?!...)``" -#: ../../library/re.rst:458 +#: ../../library/re.rst:467 msgid "" "Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead " "assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only " "if it's *not* followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:464 +#: ../../library/re.rst:473 msgid "``(?<=...)``" msgstr "``(?<=...)``" -#: ../../library/re.rst:465 +#: ../../library/re.rst:474 msgid "" "Matches if the current position in the string is preceded by a match for " "``...`` that ends at the current position. This is called a :dfn:`positive " @@ -712,19 +717,19 @@ msgid "" "func:`match` function:" msgstr "" -#: ../../library/re.rst:480 +#: ../../library/re.rst:489 msgid "This example looks for a word following a hyphen:" msgstr "" -#: ../../library/re.rst:486 +#: ../../library/re.rst:495 msgid "Added support for group references of fixed length." msgstr "" -#: ../../library/re.rst:491 +#: ../../library/re.rst:500 msgid "``(?'``." msgstr "" -#: ../../library/re.rst:509 +#: ../../library/re.rst:518 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` patterns, group " "*name* can only contain bytes in the ASCII range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:517 +#: ../../library/re.rst:526 msgid "" "The special sequences consist of ``'\\'`` and a character from the list " "below. If the ordinary character is not an ASCII digit or an ASCII letter, " @@ -761,11 +766,11 @@ msgid "" "matches the character ``'$'``." msgstr "" -#: ../../library/re.rst:524 +#: ../../library/re.rst:533 msgid "``\\number``" msgstr "``\\number``" -#: ../../library/re.rst:525 +#: ../../library/re.rst:534 msgid "" "Matches the contents of the group of the same number. Groups are numbered " "starting from 1. For example, ``(.+) \\1`` matches ``'the the'`` or ``'55 " @@ -777,19 +782,19 @@ msgid "" "escapes are treated as characters." msgstr "" -#: ../../library/re.rst:536 +#: ../../library/re.rst:545 msgid "``\\A``" msgstr "``\\A``" -#: ../../library/re.rst:537 +#: ../../library/re.rst:546 msgid "Matches only at the start of the string." msgstr "" -#: ../../library/re.rst:541 +#: ../../library/re.rst:550 msgid "``\\b``" msgstr "``\\b``" -#: ../../library/re.rst:542 +#: ../../library/re.rst:551 msgid "" "Matches the empty string, but only at the beginning or end of a word. A word " "is defined as a sequence of word characters. Note that formally, ``\\b`` is " @@ -799,7 +804,7 @@ msgid "" "``'as at ay'`` but not ``'attempt'`` or ``'atlas'``." msgstr "" -#: ../../library/re.rst:550 +#: ../../library/re.rst:559 msgid "" "The default word characters in Unicode (str) patterns are Unicode " "alphanumerics and the underscore, but this can be changed by using the :py:" @@ -807,17 +812,17 @@ msgid "" "if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:558 +#: ../../library/re.rst:567 msgid "" "Inside a character range, ``\\b`` represents the backspace character, for " "compatibility with Python's string literals." msgstr "" -#: ../../library/re.rst:563 +#: ../../library/re.rst:572 msgid "``\\B``" msgstr "``\\B``" -#: ../../library/re.rst:564 +#: ../../library/re.rst:573 msgid "" "Matches the empty string, but only when it is *not* at the beginning or end " "of a word. This means that ``r'at\\B'`` matches ``'athens'``, ``'atom'``, " @@ -828,61 +833,61 @@ msgid "" "current locale if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:577 +#: ../../library/re.rst:586 msgid "" "Note that ``\\B`` does not match an empty string, which differs from RE " "implementations in other programming languages such as Perl. This behavior " "is kept for compatibility reasons." msgstr "" -#: ../../library/re.rst:583 +#: ../../library/re.rst:592 msgid "``\\d``" msgstr "``\\d``" -#: ../../library/re.rst:584 ../../library/re.rst:608 ../../library/re.rst:630 +#: ../../library/re.rst:593 ../../library/re.rst:617 ../../library/re.rst:639 msgid "For Unicode (str) patterns:" msgstr "" -#: ../../library/re.rst:585 +#: ../../library/re.rst:594 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category `[Nd]`__). This includes ``[0-9]``, and also many other " "digit characters." msgstr "" -#: ../../library/re.rst:589 +#: ../../library/re.rst:598 msgid "Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:593 ../../library/re.rst:615 ../../library/re.rst:638 +#: ../../library/re.rst:602 ../../library/re.rst:624 ../../library/re.rst:647 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: ../../library/re.rst:594 +#: ../../library/re.rst:603 msgid "" "Matches any decimal digit in the ASCII character set; this is equivalent to " "``[0-9]``." msgstr "" -#: ../../library/re.rst:599 +#: ../../library/re.rst:608 msgid "``\\D``" msgstr "``\\D``" -#: ../../library/re.rst:600 +#: ../../library/re.rst:609 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``." msgstr "" -#: ../../library/re.rst:603 +#: ../../library/re.rst:612 msgid "Matches ``[^0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:607 +#: ../../library/re.rst:616 msgid "``\\s``" msgstr "``\\s``" -#: ../../library/re.rst:609 +#: ../../library/re.rst:618 msgid "" "Matches Unicode whitespace characters (as defined by :py:meth:`str." "isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also many other " @@ -890,48 +895,48 @@ msgid "" "in many languages." msgstr "" -#: ../../library/re.rst:613 +#: ../../library/re.rst:622 msgid "" "Matches ``[ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:616 +#: ../../library/re.rst:625 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:621 +#: ../../library/re.rst:630 msgid "``\\S``" msgstr "``\\S``" -#: ../../library/re.rst:622 +#: ../../library/re.rst:631 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``." msgstr "" -#: ../../library/re.rst:625 +#: ../../library/re.rst:634 msgid "" "Matches ``[^ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:629 +#: ../../library/re.rst:638 msgid "``\\w``" msgstr "``\\w``" -#: ../../library/re.rst:631 +#: ../../library/re.rst:640 msgid "" "Matches Unicode word characters; this includes all Unicode alphanumeric " "characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " "(``_``)." msgstr "" -#: ../../library/re.rst:636 +#: ../../library/re.rst:645 msgid "Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:639 +#: ../../library/re.rst:648 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is " @@ -939,42 +944,42 @@ msgid "" "the underscore." msgstr "" -#: ../../library/re.rst:646 +#: ../../library/re.rst:655 msgid "``\\W``" msgstr "``\\W``" -#: ../../library/re.rst:647 +#: ../../library/re.rst:656 msgid "" "Matches any character which is not a word character. This is the opposite of " "``\\w``. By default, matches non-underscore (``_``) characters for which :py:" "meth:`str.isalnum` returns ``False``." msgstr "" -#: ../../library/re.rst:652 +#: ../../library/re.rst:661 msgid "Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:654 +#: ../../library/re.rst:663 msgid "" "If the :py:const:`~re.LOCALE` flag is used, matches characters which are " "neither alphanumeric in the current locale nor the underscore." msgstr "" -#: ../../library/re.rst:660 +#: ../../library/re.rst:669 msgid "``\\Z``" msgstr "``\\Z``" -#: ../../library/re.rst:661 +#: ../../library/re.rst:670 msgid "Matches only at the end of the string." msgstr "" -#: ../../library/re.rst:677 +#: ../../library/re.rst:686 msgid "" "Most of the :ref:`escape sequences ` supported by Python " "string literals are also accepted by the regular expression parser::" msgstr "" -#: ../../library/re.rst:680 +#: ../../library/re.rst:689 msgid "" "\\a \\b \\f \\n\n" "\\N \\r \\t \\u\n" @@ -984,20 +989,20 @@ msgstr "" "\\N \\r \\t \\u\n" "\\U \\v \\x \\\\" -#: ../../library/re.rst:684 +#: ../../library/re.rst:693 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: ../../library/re.rst:687 +#: ../../library/re.rst:696 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes " "of ASCII letters are reserved for future use and treated as errors." msgstr "" -#: ../../library/re.rst:693 +#: ../../library/re.rst:702 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -1005,27 +1010,27 @@ msgid "" "are always at most three digits in length." msgstr "" -#: ../../library/re.rst:698 +#: ../../library/re.rst:707 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: ../../library/re.rst:701 +#: ../../library/re.rst:710 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: ../../library/re.rst:704 +#: ../../library/re.rst:713 msgid "" "The :samp:`'\\\\N\\\\{{name}\\\\}'` escape sequence has been added. As in " "string literals, it expands to the named Unicode character (e.g. ``'\\N{EM " "DASH}'``)." msgstr "" -#: ../../library/re.rst:712 +#: ../../library/re.rst:721 msgid "Module Contents" msgstr "模組內容" -#: ../../library/re.rst:714 +#: ../../library/re.rst:723 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -1033,26 +1038,26 @@ msgid "" "compiled form." msgstr "" -#: ../../library/re.rst:721 +#: ../../library/re.rst:730 msgid "Flags" msgstr "旗標" -#: ../../library/re.rst:723 +#: ../../library/re.rst:732 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: ../../library/re.rst:730 +#: ../../library/re.rst:739 msgid "" "An :class:`enum.IntFlag` class containing the regex options listed below." msgstr "" -#: ../../library/re.rst:732 +#: ../../library/re.rst:741 msgid "- added to ``__all__``" msgstr "" -#: ../../library/re.rst:737 +#: ../../library/re.rst:746 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and " "``\\S`` perform ASCII-only matching instead of full Unicode matching. This " @@ -1060,11 +1065,11 @@ msgid "" "patterns." msgstr "" -#: ../../library/re.rst:741 +#: ../../library/re.rst:750 msgid "Corresponds to the inline flag ``(?a)``." msgstr "" -#: ../../library/re.rst:745 +#: ../../library/re.rst:754 msgid "" "The :py:const:`~re.U` flag still exists for backward compatibility, but is " "redundant in Python 3 since matches are Unicode by default for ``str`` " @@ -1072,15 +1077,15 @@ msgid "" "`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant." msgstr "" -#: ../../library/re.rst:754 +#: ../../library/re.rst:763 msgid "Display debug information about compiled expression." msgstr "" -#: ../../library/re.rst:756 +#: ../../library/re.rst:765 msgid "No corresponding inline flag." msgstr "" -#: ../../library/re.rst:762 +#: ../../library/re.rst:771 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -1089,33 +1094,33 @@ msgid "" "flag unless the :py:const:`~re.LOCALE` flag is also used." msgstr "" -#: ../../library/re.rst:770 +#: ../../library/re.rst:779 msgid "Corresponds to the inline flag ``(?i)``." msgstr "" -#: ../../library/re.rst:772 +#: ../../library/re.rst:781 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " "letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital " -"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), 'ſ' " -"(U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If the :" -"py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to 'Z' " -"are matched." +"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), " +"'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If " +"the :py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to " +"'Z' are matched." msgstr "" -#: ../../library/re.rst:783 +#: ../../library/re.rst:792 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " "patterns." msgstr "" -#: ../../library/re.rst:787 +#: ../../library/re.rst:796 msgid "Corresponds to the inline flag ``(?L)``." msgstr "" -#: ../../library/re.rst:791 +#: ../../library/re.rst:800 msgid "" "This flag is discouraged; consider Unicode matching instead. The locale " "mechanism is very unreliable as it only handles one \"culture\" at a time " @@ -1124,20 +1129,20 @@ msgid "" "languages." msgstr "" -#: ../../library/re.rst:798 +#: ../../library/re.rst:807 msgid "" ":py:const:`~re.LOCALE` can be used only with bytes patterns and is not " "compatible with :py:const:`~re.ASCII`." msgstr "" -#: ../../library/re.rst:802 +#: ../../library/re.rst:811 msgid "" "Compiled regular expression objects with the :py:const:`~re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: ../../library/re.rst:811 +#: ../../library/re.rst:820 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -1148,11 +1153,11 @@ msgid "" "the end of the string." msgstr "" -#: ../../library/re.rst:818 +#: ../../library/re.rst:827 msgid "Corresponds to the inline flag ``(?m)``." msgstr "" -#: ../../library/re.rst:822 +#: ../../library/re.rst:831 msgid "" "Indicates no flag being applied, the value is ``0``. This flag may be used " "as a default value for a function keyword argument or as a base value that " @@ -1160,35 +1165,35 @@ msgid "" "value::" msgstr "" -#: ../../library/re.rst:827 +#: ../../library/re.rst:836 msgid "" "def myfunc(text, flag=re.NOFLAG):\n" " return re.match(text, flag)" msgstr "" -#: ../../library/re.rst:835 +#: ../../library/re.rst:844 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -#: ../../library/re.rst:838 +#: ../../library/re.rst:847 msgid "Corresponds to the inline flag ``(?s)``." msgstr "" -#: ../../library/re.rst:844 +#: ../../library/re.rst:853 msgid "" "In Python 3, Unicode characters are matched by default for ``str`` patterns. " "This flag is therefore redundant with **no effect** and is only kept for " "backward compatibility." msgstr "" -#: ../../library/re.rst:849 +#: ../../library/re.rst:858 msgid "" "See :py:const:`~re.ASCII` to restrict matching to ASCII characters instead." msgstr "" -#: ../../library/re.rst:856 +#: ../../library/re.rst:865 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -1201,13 +1206,13 @@ msgid "" "ignored." msgstr "" -#: ../../library/re.rst:866 +#: ../../library/re.rst:875 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: ../../library/re.rst:869 +#: ../../library/re.rst:878 msgid "" "a = re.compile(r\"\"\"\\d + # the integral part\n" " \\. # the decimal point\n" @@ -1215,65 +1220,75 @@ msgid "" "b = re.compile(r\"\\d+\\.\\d*\")" msgstr "" -#: ../../library/re.rst:874 +#: ../../library/re.rst:883 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: ../../library/re.rst:878 +#: ../../library/re.rst:887 msgid "Functions" -msgstr "" +msgstr "函式" -#: ../../library/re.rst:882 +#: ../../library/re.rst:891 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " "`, which can be used for matching using its :func:`~Pattern." "match`, :func:`~Pattern.search` and other methods, described below." msgstr "" +"將正規表示式模式編譯成\\ :ref:`正規表示式物件 `,可以使用它的 :" +"func:`~Pattern.match`、:func:`~Pattern.search` 等方法來匹配,如下所述。" -#: ../../library/re.rst:887 ../../library/re.rst:919 ../../library/re.rst:937 -#: ../../library/re.rst:948 ../../library/re.rst:994 ../../library/re.rst:1028 -#: ../../library/re.rst:1043 ../../library/re.rst:1102 -#: ../../library/re.rst:1138 +#: ../../library/re.rst:896 ../../library/re.rst:928 ../../library/re.rst:946 +#: ../../library/re.rst:957 ../../library/re.rst:1003 ../../library/re.rst:1037 +#: ../../library/re.rst:1052 ../../library/re.rst:1111 +#: ../../library/re.rst:1147 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " "``|`` operator)." msgstr "" +"可以透過指定 *flags* 值來修改運算式的行為,值可以是任何 `flags`_ 變數,使用位" +"元 OR(bitwise OR、``|`` 運算子)組合。" -#: ../../library/re.rst:891 +#: ../../library/re.rst:900 msgid "The sequence ::" -msgstr "" +msgstr "順序為: ::" -#: ../../library/re.rst:893 +#: ../../library/re.rst:902 msgid "" "prog = re.compile(pattern)\n" "result = prog.match(string)" msgstr "" +"prog = re.compile(pattern)\n" +"result = prog.match(string)" -#: ../../library/re.rst:896 +#: ../../library/re.rst:905 msgid "is equivalent to ::" msgstr "等價於: ::" -#: ../../library/re.rst:898 +#: ../../library/re.rst:907 msgid "result = re.match(pattern, string)" -msgstr "" +msgstr "result = re.match(pattern, string)" -#: ../../library/re.rst:900 +#: ../../library/re.rst:909 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " "times in a single program." msgstr "" +"但是當表示式在單一程式中多次使用時,使用 :func:`re.compile` 並保存產生的正規" +"表示式物件以供重複使用會更有效率。" -#: ../../library/re.rst:906 +#: ../../library/re.rst:915 msgid "" "The compiled versions of the most recent patterns passed to :func:`re." "compile` and the module-level matching functions are cached, so programs " "that use only a few regular expressions at a time needn't worry about " "compiling regular expressions." msgstr "" +"傳遞給 :func:`re.compile` 之最新模式的編譯版本和模組層級匹配函式都會被快取," +"因此一次僅使用幾個正規表示式的程式不必去擔心編譯正規表示式。" -#: ../../library/re.rst:914 +#: ../../library/re.rst:923 msgid "" "Scan through *string* looking for the first location where the regular " "expression *pattern* produces a match, and return a corresponding :class:" @@ -1281,35 +1296,47 @@ msgid "" "pattern; note that this is different from finding a zero-length match at " "some point in the string." msgstr "" +"掃描 *string* 以尋找正規表示式 *pattern* 產生匹配的第一個位置,並回傳對應的 :" +"class:`~re.Match`。如果字串中沒有與模式匹配的位置則回傳 ``None``;請注意,這" +"與在字串中的某個點查找零長度匹配不同。" -#: ../../library/re.rst:926 +#: ../../library/re.rst:935 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " "``None`` if the string does not match the pattern; note that this is " "different from a zero-length match." msgstr "" +"如果 *string* 開頭的零個或多個字元與正規表示式 *pattern* 匹配,則回傳對應的 :" +"class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度" +"匹配不同。" -#: ../../library/re.rst:931 +#: ../../library/re.rst:940 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." msgstr "" +"請注意,即使在 :const:`MULTILINE` 模式 (mode) 下,:func:`re.match` 只會於字串" +"的開頭匹配,而非每行的開頭。" -#: ../../library/re.rst:934 +#: ../../library/re.rst:943 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." msgstr "" +"如果你想在 *string* 中的任何位置找到匹配項,請使用 :func:`search`\\ (另請參" +"閱 :ref:`search-vs-match`)。" -#: ../../library/re.rst:944 +#: ../../library/re.rst:953 msgid "" "If the whole *string* matches the regular expression *pattern*, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" +"如果整個 *string* 與正規表示式 *pattern* 匹配,則回傳對應的 :class:`~re." +"Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度匹配不同。" -#: ../../library/re.rst:957 +#: ../../library/re.rst:966 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1317,8 +1344,11 @@ msgid "" "*maxsplit* splits occur, and the remainder of the string is returned as the " "final element of the list. ::" msgstr "" +"依 *pattern* 的出現次數拆分 *string*。如果在 *pattern* 中使用捕獲括號,則模式" +"中所有群組的文字也會作為結果串列的一部分回傳。如果 *maxsplit* 非零,則最多發" +"生 *maxsplit* 次拆分,並且字串的其餘部分會作為串列的最終元素回傳。 ::" -#: ../../library/re.rst:963 +#: ../../library/re.rst:972 msgid "" ">>> re.split(r'\\W+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -1338,14 +1368,16 @@ msgstr "" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" -#: ../../library/re.rst:972 +#: ../../library/re.rst:981 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " "for the end of the string::" msgstr "" +"如果分隔符號中有捕獲群組並且它在字串的開頭匹配,則結果將以空字串開頭。這同樣" +"適用於字串的結尾: ::" -#: ../../library/re.rst:976 +#: ../../library/re.rst:985 msgid "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" @@ -1353,19 +1385,19 @@ msgstr "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" -#: ../../library/re.rst:979 +#: ../../library/re.rst:988 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." -msgstr "" +msgstr "如此一來,分隔符號元件始終可以在結果串列中的相同相對索引處找到。" -#: ../../library/re.rst:982 +#: ../../library/re.rst:991 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." -msgstr "" +msgstr "只有當與先前的空匹配不相鄰時,模式的空匹配才會拆分字串。" -#: ../../library/re.rst:985 +#: ../../library/re.rst:994 msgid "" ">>> re.split(r'\\b', 'Words, words, words.')\n" "['', 'Words', ', ', 'words', ', ', 'words', '.']\n" @@ -1383,30 +1415,34 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:998 ../../library/re.rst:1106 +#: ../../library/re.rst:1007 ../../library/re.rst:1115 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" -#: ../../library/re.rst:1001 +#: ../../library/re.rst:1010 msgid "" "Added support of splitting on a pattern that could match an empty string." -msgstr "" +msgstr "新增了對可以匹配空字串之模式進行拆分的支援。" -#: ../../library/re.rst:1004 +#: ../../library/re.rst:1013 msgid "" "Passing *maxsplit* and *flags* as positional arguments is deprecated. In " "future Python versions they will be :ref:`keyword-only parameters `." msgstr "" +"將 *maxsplit* 和 *flags* 作為位置引數傳遞的用法已被棄用。在未來的 Python 版本" +"中,它們將會是\\ :ref:`僅限關鍵字參數 `。" -#: ../../library/re.rst:1012 +#: ../../library/re.rst:1021 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" +"以字串或元組串列的形式回傳 *string* 中 *pattern* 的所有非重疊匹配項。從左到右" +"掃描 *string*,並按找到的順序回傳符合項目。結果中會包含空匹配項。" -#: ../../library/re.rst:1016 +#: ../../library/re.rst:1025 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1415,20 +1451,26 @@ msgid "" "matching the groups. Non-capturing groups do not affect the form of the " "result." msgstr "" +"結果取決於模式中捕獲群組的數量。如果沒有群組,則回傳與整個模式匹配的字串串" +"列。如果恰好存在一個群組,則回傳與該群組匹配的字串串列。如果存在多個群組,則" +"回傳與群組匹配的字串元組串列。非捕獲群組則不影響結果的形式。" -#: ../../library/re.rst:1032 ../../library/re.rst:1047 +#: ../../library/re.rst:1041 ../../library/re.rst:1056 msgid "Non-empty matches can now start just after a previous empty match." -msgstr "" +msgstr "非空匹配現在可以剛好在前一個空匹配的後面開始。" -#: ../../library/re.rst:1038 +#: ../../library/re.rst:1047 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " "scanned left-to-right, and matches are returned in the order found. Empty " "matches are included in the result." msgstr "" +"回傳一個 :term:`iterator`,在 *string* 中的 RE *pattern* 的所有非重疊匹配上 " +"yield :class:`~re.Match` 物件。從左到右掃描 *string*,並按找到的順序回傳匹配" +"項目。結果中包含空匹配項。" -#: ../../library/re.rst:1053 +#: ../../library/re.rst:1062 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1441,8 +1483,14 @@ msgid "" "``\\6``, are replaced with the substring matched by group 6 in the pattern. " "For example::" msgstr "" +"回傳透過以替換 *repl* 取代 *string* 中最左邊不重疊出現的 *pattern* 所獲得的字" +"串。如果未找到該模式,則不改變 *string* 並回傳。*repl* 可以是字串或函式;如果" +"它是字串,則處理其中的任何反斜線轉義。也就是說 ``\\n`` 會被轉換為單一換行符、" +"``\\r`` 會被轉換為回車符 (carriage return) 等等。ASCII 字母的未知轉義符會被保" +"留以供將來使用並被視為錯誤。其他未知轉義符例如 ``\\&`` 會被單獨保留。例如 " +"``\\6`` 的反向參照將被替換為模式中第 6 組匹配的子字串。例如: ::" -#: ../../library/re.rst:1064 +#: ../../library/re.rst:1073 msgid "" ">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" "... r'static PyObject*\\npy_\\1(void)\\n{',\n" @@ -1454,14 +1502,16 @@ msgstr "" "... 'def myfunc():')\n" "'static PyObject*\\npy_myfunc(void)\\n{'" -#: ../../library/re.rst:1069 +#: ../../library/re.rst:1078 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " "returns the replacement string. For example::" msgstr "" +"如果 *repl* 是一個函式,則 *pattern* 的每個不重疊出現之處都會呼叫它。此函式接" +"收單一 :class:`~re.Match` 引數,並回傳替換字串。例如: ::" -#: ../../library/re.rst:1073 +#: ../../library/re.rst:1082 msgid "" ">>> def dashrepl(matchobj):\n" "... if matchobj.group(0) == '-': return ' '\n" @@ -1483,11 +1533,11 @@ msgstr "" "IGNORECASE)\n" "'Baked Beans & Spam'" -#: ../../library/re.rst:1082 +#: ../../library/re.rst:1091 msgid "The pattern may be a string or a :class:`~re.Pattern`." -msgstr "" +msgstr "此模式可以是字串或 :class:`~re.Pattern`。" -#: ../../library/re.rst:1084 +#: ../../library/re.rst:1093 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1495,8 +1545,11 @@ msgid "" "only when not adjacent to a previous empty match, so ``sub('x*', '-', " "'abxd')`` returns ``'-a-b--d-'``." msgstr "" +"可選引數 *count* 是要替換的模式出現的最大次數;*count* 必須是非負整數。如果省" +"略或為零,則所有出現的內容都將被替換。只有當與先前的空匹配不相鄰時,模式的空" +"匹配才會被替換,因此 ``sub('x*', '-', 'abxd')`` 會回傳 ``'-a-b--d -'``。" -#: ../../library/re.rst:1092 +#: ../../library/re.rst:1101 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1508,52 +1561,69 @@ msgid "" "backreference ``\\g<0>`` substitutes in the entire substring matched by the " "RE." msgstr "" +"在字串型別 *repl* 引數中,除了上述字元轉義和反向參照之外,``\\g`` 將使" +"用名為 ``name`` 的群組所匹配到的子字串,如 ``(?P...)`` 所定義的語法。" +"``\\g`` 使用對應的群組編號;因此 ``\\g<2>`` 等價於 ``\\2``,但在諸如 " +"``\\g<2>0`` 之類的替換中並非模糊不清 (isn't ambiguous)。``\\20`` 將被直譯為對" +"群組 20 的參照,而不是對後面跟著字面字元 ``'0'`` 的群組 2 的參照。反向參照 " +"``\\g<0>`` 會取代以 RE 所匹配到的整個子字串。" -#: ../../library/re.rst:1109 ../../library/re.rst:1387 +#: ../../library/re.rst:1118 ../../library/re.rst:1396 msgid "Unmatched groups are replaced with an empty string." -msgstr "" +msgstr "不匹配的群組將被替換為空字串。" -#: ../../library/re.rst:1112 +#: ../../library/re.rst:1121 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" +"在由 ``'\\'`` 和一個 ASCII 字母組成之 *pattern* 中的未知轉義符現在為錯誤。" -#: ../../library/re.rst:1116 +#: ../../library/re.rst:1125 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " "errors. Empty matches for the pattern are replaced when adjacent to a " "previous non-empty match." msgstr "" +"由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知轉義符現在為錯誤。當與先前" +"的非空匹配相鄰時,模式的空匹配將被替換。" -#: ../../library/re.rst:1122 +#: ../../library/re.rst:1131 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " "(``b'\\x00'``-``b'\\x7f'``)." msgstr "" +"群組 *id* 只能包含 ASCII 數字。在 :class:`bytes` 替換字串中,群組 *name* 只能" +"包含 ASCII 範圍內的位元組 (``b'\\x00'``-``b'\\x7f'``)。" -#: ../../library/re.rst:1127 +#: ../../library/re.rst:1136 msgid "" "Passing *count* and *flags* as positional arguments is deprecated. In future " "Python versions they will be :ref:`keyword-only parameters `." msgstr "" +"將 *count* 和 *flags* 作為位置引數傳遞的用法已被棄用。在未來的 Python 版本" +"中,它們將會是\\ :ref:`僅限關鍵字參數 `。" -#: ../../library/re.rst:1135 +#: ../../library/re.rst:1144 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" +"執行與 :func:`sub` 相同的操作,但回傳一個元組 ``(new_string, " +"number_of_subs_made)``。" -#: ../../library/re.rst:1145 +#: ../../library/re.rst:1154 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" +"對 *pattern* 中的特殊字元進行轉義。如果你想要匹配其中可能包含正規表示式元字" +"元 (metacharacter) 的任意文本字串,這會非常有用。例如: ::" -#: ../../library/re.rst:1149 +#: ../../library/re.rst:1158 msgid "" ">>> print(re.escape('https://www.python.org'))\n" "https://www\\.python\\.org\n" @@ -1579,13 +1649,15 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1160 +#: ../../library/re.rst:1169 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" +"此函式不得用於 :func:`sub` 和 :func:`subn` 中的替換字串,僅應轉義反斜線。例" +"如: ::" -#: ../../library/re.rst:1163 +#: ../../library/re.rst:1172 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1597,11 +1669,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1168 +#: ../../library/re.rst:1177 msgid "The ``'_'`` character is no longer escaped." -msgstr "" +msgstr "``'_'`` 字元不再被轉義。" -#: ../../library/re.rst:1171 +#: ../../library/re.rst:1180 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1609,15 +1681,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1180 +#: ../../library/re.rst:1189 msgid "Clear the regular expression cache." -msgstr "" +msgstr "清除正規表示式快取。" -#: ../../library/re.rst:1184 +#: ../../library/re.rst:1193 msgid "Exceptions" msgstr "例外" -#: ../../library/re.rst:1188 +#: ../../library/re.rst:1197 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " @@ -1626,52 +1698,56 @@ msgid "" "pattern. The ``PatternError`` instance has the following additional " "attributes:" msgstr "" +"當傳遞給此處函式之一的字串不是有效的正規表示式(例如它可能包含不匹配的括號)" +"或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項," +"則絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" -#: ../../library/re.rst:1196 +#: ../../library/re.rst:1205 msgid "The unformatted error message." -msgstr "" +msgstr "未格式化的錯誤訊息。" -#: ../../library/re.rst:1200 +#: ../../library/re.rst:1209 msgid "The regular expression pattern." -msgstr "" +msgstr "正規表示式模式。" -#: ../../library/re.rst:1204 +#: ../../library/re.rst:1213 msgid "The index in *pattern* where compilation failed (may be ``None``)." -msgstr "" +msgstr "*pattern* 中編譯失敗的索引(可能是 ``None``)。" -#: ../../library/re.rst:1208 +#: ../../library/re.rst:1217 msgid "The line corresponding to *pos* (may be ``None``)." -msgstr "" +msgstr "對應 *pos* 的列(可能是 ``None``)。" -#: ../../library/re.rst:1212 +#: ../../library/re.rst:1221 msgid "The column corresponding to *pos* (may be ``None``)." -msgstr "" +msgstr "對應 *pos* 的欄(可能是 ``None``)。" -#: ../../library/re.rst:1214 +#: ../../library/re.rst:1223 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1217 +#: ../../library/re.rst:1226 msgid "" "``PatternError`` was originally named ``error``; the latter is kept as an " "alias for backward compatibility." msgstr "" +"``PatternError`` 最初被命名為 ``error``;後者為了向後相容性而被保留為別名。" -#: ../../library/re.rst:1224 +#: ../../library/re.rst:1233 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1228 +#: ../../library/re.rst:1237 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1230 +#: ../../library/re.rst:1239 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1236 +#: ../../library/re.rst:1245 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1680,7 +1756,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1241 +#: ../../library/re.rst:1250 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1689,7 +1765,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1247 +#: ../../library/re.rst:1256 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1699,7 +1775,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1254 +#: ../../library/re.rst:1263 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1707,7 +1783,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1262 +#: ../../library/re.rst:1271 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1715,13 +1791,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1267 ../../library/re.rst:1285 +#: ../../library/re.rst:1276 ../../library/re.rst:1294 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1270 +#: ../../library/re.rst:1279 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1731,20 +1807,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1275 +#: ../../library/re.rst:1284 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1281 +#: ../../library/re.rst:1290 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1288 +#: ../../library/re.rst:1297 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1755,72 +1831,72 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1299 +#: ../../library/re.rst:1308 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1304 +#: ../../library/re.rst:1313 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1311 +#: ../../library/re.rst:1320 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1318 +#: ../../library/re.rst:1327 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1323 +#: ../../library/re.rst:1332 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1328 +#: ../../library/re.rst:1337 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1335 +#: ../../library/re.rst:1344 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1340 +#: ../../library/re.rst:1349 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1347 +#: ../../library/re.rst:1356 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1350 +#: ../../library/re.rst:1359 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1358 +#: ../../library/re.rst:1367 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1360 +#: ../../library/re.rst:1369 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1365 +#: ../../library/re.rst:1374 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1830,17 +1906,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1371 +#: ../../library/re.rst:1380 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1373 +#: ../../library/re.rst:1382 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1379 +#: ../../library/re.rst:1388 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1850,7 +1926,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1392 +#: ../../library/re.rst:1401 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1865,7 +1941,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1404 +#: ../../library/re.rst:1413 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1878,7 +1954,7 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1414 +#: ../../library/re.rst:1423 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1886,11 +1962,11 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1419 +#: ../../library/re.rst:1428 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1421 +#: ../../library/re.rst:1430 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1906,11 +1982,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1427 +#: ../../library/re.rst:1436 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1429 +#: ../../library/re.rst:1438 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -1922,24 +1998,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1443 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1436 +#: ../../library/re.rst:1445 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1443 +#: ../../library/re.rst:1452 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1446 +#: ../../library/re.rst:1455 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -1950,11 +2026,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1454 +#: ../../library/re.rst:1463 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1456 +#: ../../library/re.rst:1465 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -1970,18 +2046,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1467 +#: ../../library/re.rst:1476 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1471 ../../library/re.rst:1696 +#: ../../library/re.rst:1480 ../../library/re.rst:1705 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1473 +#: ../../library/re.rst:1482 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -1991,14 +2067,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1477 +#: ../../library/re.rst:1486 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1481 +#: ../../library/re.rst:1490 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -2007,14 +2083,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1490 +#: ../../library/re.rst:1499 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1494 +#: ../../library/re.rst:1503 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2026,7 +2102,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1502 +#: ../../library/re.rst:1511 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2035,11 +2111,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1508 +#: ../../library/re.rst:1517 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1510 +#: ../../library/re.rst:1519 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -2047,11 +2123,11 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1515 +#: ../../library/re.rst:1524 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1517 +#: ../../library/re.rst:1526 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2063,28 +2139,28 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1525 +#: ../../library/re.rst:1534 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1532 +#: ../../library/re.rst:1541 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1539 +#: ../../library/re.rst:1548 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1546 +#: ../../library/re.rst:1555 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2093,43 +2169,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1555 +#: ../../library/re.rst:1564 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1561 +#: ../../library/re.rst:1570 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1567 +#: ../../library/re.rst:1576 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1570 +#: ../../library/re.rst:1579 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1578 +#: ../../library/re.rst:1587 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1582 +#: ../../library/re.rst:1591 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1584 +#: ../../library/re.rst:1593 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1587 +#: ../../library/re.rst:1596 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2141,7 +2217,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1592 +#: ../../library/re.rst:1601 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2149,11 +2225,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1597 +#: ../../library/re.rst:1606 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1599 +#: ../../library/re.rst:1608 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2164,14 +2240,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1607 +#: ../../library/re.rst:1616 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1610 +#: ../../library/re.rst:1619 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2181,13 +2257,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1617 +#: ../../library/re.rst:1626 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1620 +#: ../../library/re.rst:1629 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2205,11 +2281,11 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1636 +#: ../../library/re.rst:1645 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1640 +#: ../../library/re.rst:1649 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -2218,130 +2294,130 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1656 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1656 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1658 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1660 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1660 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1662 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1662 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1664 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1664 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1666 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1666 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1668 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1668 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1661 +#: ../../library/re.rst:1670 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1661 +#: ../../library/re.rst:1670 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1663 +#: ../../library/re.rst:1672 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1663 +#: ../../library/re.rst:1672 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1665 +#: ../../library/re.rst:1674 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1665 +#: ../../library/re.rst:1674 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1677 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1679 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1681 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1674 +#: ../../library/re.rst:1683 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1676 +#: ../../library/re.rst:1685 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1678 +#: ../../library/re.rst:1687 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1684 +#: ../../library/re.rst:1693 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1688 +#: ../../library/re.rst:1697 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1690 +#: ../../library/re.rst:1699 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1691 +#: ../../library/re.rst:1700 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1693 +#: ../../library/re.rst:1702 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1698 +#: ../../library/re.rst:1707 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2351,13 +2427,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1705 +#: ../../library/re.rst:1714 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1708 +#: ../../library/re.rst:1717 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2365,7 +2441,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1713 +#: ../../library/re.rst:1722 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2373,18 +2449,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1717 +#: ../../library/re.rst:1726 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1723 +#: ../../library/re.rst:1732 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1725 +#: ../../library/re.rst:1734 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2392,13 +2468,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1730 +#: ../../library/re.rst:1739 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1733 +#: ../../library/re.rst:1742 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2416,13 +2492,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1743 +#: ../../library/re.rst:1752 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1746 +#: ../../library/re.rst:1755 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2438,14 +2514,14 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1756 +#: ../../library/re.rst:1765 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1760 +#: ../../library/re.rst:1769 msgid "" ">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" @@ -2459,14 +2535,14 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1769 +#: ../../library/re.rst:1778 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1773 +#: ../../library/re.rst:1782 msgid "" ">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" @@ -2480,11 +2556,11 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1784 +#: ../../library/re.rst:1793 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1786 +#: ../../library/re.rst:1795 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2492,7 +2568,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1791 +#: ../../library/re.rst:1800 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2516,11 +2592,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1804 +#: ../../library/re.rst:1813 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1806 +#: ../../library/re.rst:1815 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2528,7 +2604,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1811 +#: ../../library/re.rst:1820 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2538,11 +2614,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1817 +#: ../../library/re.rst:1826 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1819 +#: ../../library/re.rst:1828 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2551,7 +2627,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1825 +#: ../../library/re.rst:1834 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2565,11 +2641,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1833 +#: ../../library/re.rst:1842 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1835 +#: ../../library/re.rst:1844 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2577,7 +2653,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1840 +#: ../../library/re.rst:1849 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2589,7 +2665,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1845 +#: ../../library/re.rst:1854 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2597,7 +2673,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1850 +#: ../../library/re.rst:1859 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2609,25 +2685,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1857 +#: ../../library/re.rst:1866 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1859 +#: ../../library/re.rst:1868 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1863 +#: ../../library/re.rst:1872 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1867 +#: ../../library/re.rst:1876 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2683,11 +2759,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1919 +#: ../../library/re.rst:1928 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1921 +#: ../../library/re.rst:1930 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2729,7 +2805,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1942 +#: ../../library/re.rst:1951 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2745,20 +2821,20 @@ msgstr ". (點)" #: ../../library/re.rst:123 ../../library/re.rst:130 ../../library/re.rst:137 #: ../../library/re.rst:143 ../../library/re.rst:157 ../../library/re.rst:181 #: ../../library/re.rst:220 ../../library/re.rst:235 ../../library/re.rst:244 -#: ../../library/re.rst:257 ../../library/re.rst:262 ../../library/re.rst:295 -#: ../../library/re.rst:308 ../../library/re.rst:318 ../../library/re.rst:350 -#: ../../library/re.rst:405 ../../library/re.rst:437 ../../library/re.rst:443 -#: ../../library/re.rst:448 ../../library/re.rst:455 ../../library/re.rst:462 -#: ../../library/re.rst:489 ../../library/re.rst:499 ../../library/re.rst:522 -#: ../../library/re.rst:534 ../../library/re.rst:539 ../../library/re.rst:561 -#: ../../library/re.rst:581 ../../library/re.rst:597 ../../library/re.rst:605 -#: ../../library/re.rst:619 ../../library/re.rst:627 ../../library/re.rst:644 -#: ../../library/re.rst:658 ../../library/re.rst:663 ../../library/re.rst:854 -#: ../../library/re.rst:1090 +#: ../../library/re.rst:258 ../../library/re.rst:271 ../../library/re.rst:304 +#: ../../library/re.rst:317 ../../library/re.rst:327 ../../library/re.rst:359 +#: ../../library/re.rst:414 ../../library/re.rst:446 ../../library/re.rst:452 +#: ../../library/re.rst:457 ../../library/re.rst:464 ../../library/re.rst:471 +#: ../../library/re.rst:498 ../../library/re.rst:508 ../../library/re.rst:531 +#: ../../library/re.rst:543 ../../library/re.rst:548 ../../library/re.rst:570 +#: ../../library/re.rst:590 ../../library/re.rst:606 ../../library/re.rst:614 +#: ../../library/re.rst:628 ../../library/re.rst:636 ../../library/re.rst:653 +#: ../../library/re.rst:667 ../../library/re.rst:672 ../../library/re.rst:863 +#: ../../library/re.rst:1099 msgid "in regular expressions" msgstr "於正規表示式中" -#: ../../library/re.rst:106 ../../library/re.rst:262 +#: ../../library/re.rst:106 ../../library/re.rst:271 msgid "^ (caret)" msgstr "^ (插入符號)" @@ -2806,7 +2882,7 @@ msgstr "?+" msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/re.rst:220 ../../library/re.rst:257 ../../library/re.rst:522 +#: ../../library/re.rst:220 ../../library/re.rst:258 ../../library/re.rst:531 msgid "\\ (backslash)" msgstr "\\ (反斜線)" @@ -2818,147 +2894,147 @@ msgstr "[] (方括號)" msgid "- (minus)" msgstr "- (減號)" -#: ../../library/re.rst:295 +#: ../../library/re.rst:304 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../library/re.rst:308 +#: ../../library/re.rst:317 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/re.rst:318 +#: ../../library/re.rst:327 msgid "(?" msgstr "(?" -#: ../../library/re.rst:350 +#: ../../library/re.rst:359 msgid "(?:" msgstr "(?:" -#: ../../library/re.rst:405 +#: ../../library/re.rst:414 msgid "(?P<" msgstr "(?P<" -#: ../../library/re.rst:437 +#: ../../library/re.rst:446 msgid "(?P=" msgstr "(?P=" -#: ../../library/re.rst:443 +#: ../../library/re.rst:452 msgid "(?#" msgstr "(?#" -#: ../../library/re.rst:448 +#: ../../library/re.rst:457 msgid "(?=" msgstr "(?=" -#: ../../library/re.rst:455 +#: ../../library/re.rst:464 msgid "(?!" msgstr "(?!" -#: ../../library/re.rst:462 +#: ../../library/re.rst:471 msgid "(?<=" msgstr "(?<=" -#: ../../library/re.rst:489 +#: ../../library/re.rst:498 msgid "(?\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,13 +109,13 @@ msgstr "" #: ../../library/readline.rst:67 msgid "" "Execute the init line provided in the *string* argument. This calls :c:func:" -"`rl_parse_and_bind` in the underlying library." +"`!rl_parse_and_bind` in the underlying library." msgstr "" #: ../../library/readline.rst:73 msgid "" "Execute a readline initialization file. The default filename is the last " -"filename used. This calls :c:func:`rl_read_init_file` in the underlying " +"filename used. This calls :c:func:`!rl_read_init_file` in the underlying " "library." msgstr "" @@ -129,20 +129,20 @@ msgstr "" #: ../../library/readline.rst:85 msgid "" -"Return the current contents of the line buffer (:c:data:`rl_line_buffer` in " +"Return the current contents of the line buffer (:c:data:`!rl_line_buffer` in " "the underlying library)." msgstr "" #: ../../library/readline.rst:91 msgid "" "Insert text into the line buffer at the cursor position. This calls :c:func:" -"`rl_insert_text` in the underlying library, but ignores the return value." +"`!rl_insert_text` in the underlying library, but ignores the return value." msgstr "" #: ../../library/readline.rst:98 msgid "" "Change what's displayed on the screen to reflect the current contents of the " -"line buffer. This calls :c:func:`rl_redisplay` in the underlying library." +"line buffer. This calls :c:func:`!rl_redisplay` in the underlying library." msgstr "" #: ../../library/readline.rst:103 @@ -156,22 +156,22 @@ msgstr "" #: ../../library/readline.rst:110 msgid "" "Load a readline history file, and append it to the history list. The default " -"filename is :file:`~/.history`. This calls :c:func:`read_history` in the " +"filename is :file:`~/.history`. This calls :c:func:`!read_history` in the " "underlying library." msgstr "" #: ../../library/readline.rst:117 msgid "" "Save the history list to a readline history file, overwriting any existing " -"file. The default filename is :file:`~/.history`. This calls :c:func:" -"`write_history` in the underlying library." +"file. The default filename is :file:`~/.history`. This calls :c:func:`!" +"write_history` in the underlying library." msgstr "" #: ../../library/readline.rst:124 msgid "" "Append the last *nelements* items of history to a file. The default " "filename is :file:`~/.history`. The file must already exist. This calls :c:" -"func:`append_history` in the underlying library. This function only exists " +"func:`!append_history` in the underlying library. This function only exists " "if Python was compiled for a version of the library that supports it." msgstr "" @@ -179,8 +179,8 @@ msgstr "" msgid "" "Set or return the desired number of lines to save in the history file. The :" "func:`write_history_file` function uses this value to truncate the history " -"file, by calling :c:func:`history_truncate_file` in the underlying library. " -"Negative values imply unlimited history file size." +"file, by calling :c:func:`!history_truncate_file` in the underlying " +"library. Negative values imply unlimited history file size." msgstr "" #: ../../library/readline.rst:144 @@ -193,7 +193,7 @@ msgstr "" #: ../../library/readline.rst:151 msgid "" -"Clear the current history. This calls :c:func:`clear_history` in the " +"Clear the current history. This calls :c:func:`!clear_history` in the " "underlying library. The Python function only exists if Python was compiled " "for a version of the library that supports it." msgstr "" @@ -208,32 +208,32 @@ msgstr "" #: ../../library/readline.rst:165 msgid "" "Return the current contents of history item at *index*. The item index is " -"one-based. This calls :c:func:`history_get` in the underlying library." +"one-based. This calls :c:func:`!history_get` in the underlying library." msgstr "" #: ../../library/readline.rst:171 msgid "" "Remove history item specified by its position from the history. The position " -"is zero-based. This calls :c:func:`remove_history` in the underlying " +"is zero-based. This calls :c:func:`!remove_history` in the underlying " "library." msgstr "" #: ../../library/readline.rst:178 msgid "" "Replace history item specified by its position with *line*. The position is " -"zero-based. This calls :c:func:`replace_history_entry` in the underlying " +"zero-based. This calls :c:func:`!replace_history_entry` in the underlying " "library." msgstr "" #: ../../library/readline.rst:185 msgid "" "Append *line* to the history buffer, as if it was the last line typed. This " -"calls :c:func:`add_history` in the underlying library." +"calls :c:func:`!add_history` in the underlying library." msgstr "" #: ../../library/readline.rst:191 msgid "" -"Enable or disable automatic calls to :c:func:`add_history` when reading " +"Enable or disable automatic calls to :c:func:`!add_history` when reading " "input via readline. The *enabled* argument should be a Boolean value that " "when true, enables auto history, and that when false, disables auto history." msgstr "" @@ -250,16 +250,16 @@ msgstr "" #: ../../library/readline.rst:209 msgid "" -"Set or remove the function invoked by the :c:data:`rl_startup_hook` callback " -"of the underlying library. If *function* is specified, it will be used as " -"the new hook function; if omitted or ``None``, any function already " +"Set or remove the function invoked by the :c:data:`!rl_startup_hook` " +"callback of the underlying library. If *function* is specified, it will be " +"used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments just before " "readline prints the first prompt." msgstr "" #: ../../library/readline.rst:218 msgid "" -"Set or remove the function invoked by the :c:data:`rl_pre_input_hook` " +"Set or remove the function invoked by the :c:data:`!rl_pre_input_hook` " "callback of the underlying library. If *function* is specified, it will be " "used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments after the first " @@ -295,9 +295,9 @@ msgstr "" #: ../../library/readline.rst:249 msgid "" "The installed completer function is invoked by the *entry_func* callback " -"passed to :c:func:`rl_completion_matches` in the underlying library. The " -"*text* string comes from the first parameter to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library." +"passed to :c:func:`!rl_completion_matches` in the underlying library. The " +"*text* string comes from the first parameter to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library." msgstr "" #: ../../library/readline.rst:258 @@ -308,15 +308,15 @@ msgstr "" #: ../../library/readline.rst:263 msgid "" -"Get the type of completion being attempted. This returns the :c:data:" -"`rl_completion_type` variable in the underlying library as an integer." +"Get the type of completion being attempted. This returns the :c:data:`!" +"rl_completion_type` variable in the underlying library as an integer." msgstr "" #: ../../library/readline.rst:271 msgid "" "Get the beginning or ending index of the completion scope. These indexes are " -"the *start* and *end* arguments passed to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library. The " +"the *start* and *end* arguments passed to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library. The " "values may be different in the same input editing scenario based on the " "underlying C readline implementation. Ex: libedit is known to behave " "differently than libreadline." @@ -326,7 +326,7 @@ msgstr "" msgid "" "Set or get the word delimiters for completion. These determine the start of " "the word to be considered for completion (the completion scope). These " -"functions access the :c:data:`rl_completer_word_break_characters` variable " +"functions access the :c:data:`!rl_completer_word_break_characters` variable " "in the underlying library." msgstr "" @@ -335,7 +335,7 @@ msgid "" "Set or remove the completion display function. If *function* is specified, " "it will be used as the new completion display function; if omitted or " "``None``, any completion display function already installed is removed. " -"This sets or clears the :c:data:`rl_completion_display_matches_hook` " +"This sets or clears the :c:data:`!rl_completion_display_matches_hook` " "callback in the underlying library. The completion display function is " "called as ``function(substitution, [matches], longest_match_length)`` once " "each time matches need to be displayed." diff --git a/library/sched.po b/library/sched.po index 3e6f6d458d..2fa14ca924 100644 --- a/library/sched.po +++ b/library/sched.po @@ -92,6 +92,33 @@ msgid "" "From print_time 1652342840.369612 default\n" "1652342840.3697174" msgstr "" +">>> import sched, time\n" +">>> s = sched.scheduler(time.time, time.sleep)\n" +">>> def print_time(a='default'):\n" +"... print(\"From print_time\", time.time(), a)\n" +"...\n" +">>> def print_some_times():\n" +"... print(time.time())\n" +"... s.enter(10, 1, print_time)\n" +"... s.enter(5, 2, print_time, argument=('positional',))\n" +"... # 儘管優先順序較高,但由於 enter() 是相對的,'keyword' 在 " +"'positional' 之後運行\n" +"... s.enter(5, 1, print_time, kwargs={'a': 'keyword'})\n" +"... s.enterabs(1_650_000_000, 10, print_time, argument=(\"first " +"enterabs\",))\n" +"... s.enterabs(1_650_000_000, 5, print_time, argument=(\"second " +"enterabs\",))\n" +"... s.run()\n" +"... print(time.time())\n" +"...\n" +">>> print_some_times()\n" +"1652342830.3640375\n" +"From print_time 1652342830.3642538 second enterabs\n" +"From print_time 1652342830.3643398 first enterabs\n" +"From print_time 1652342835.3694863 positional\n" +"From print_time 1652342835.3696074 keyword\n" +"From print_time 1652342840.369612 default\n" +"1652342840.3697174" #: ../../library/sched.rst:67 msgid "Scheduler Objects" @@ -149,8 +176,8 @@ msgid "" "Remove the event from the queue. If *event* is not an event currently in the " "queue, this method will raise a :exc:`ValueError`." msgstr "" -"從佇列中刪除該事件。如果 *event* 不是目前佇列中的事件,此方法將引發 :exc:" -"`ValueError`。" +"從佇列中刪除該事件。如果 *event* 不是目前佇列中的事件,此方法將引" +"發 :exc:`ValueError`。" #: ../../library/sched.rst:113 msgid "Return ``True`` if the event queue is empty." diff --git a/library/secrets.po b/library/secrets.po index d2bfde8612..4fd800964c 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,8 +66,8 @@ msgid "" "provided by the operating system. See :class:`random.SystemRandom` for " "additional details." msgstr "" -"一個用來產生亂數的類別,用的是作業系統提供的最高品質來源。 請參閱 :class:" -"`random.SystemRandom` 以獲取更多細節。" +"一個用來產生亂數的類別,用的是作業系統提供的最高品質來源。 請參" +"閱 :class:`random.SystemRandom` 以取得更多細節。" #: ../../library/secrets.rst:47 msgid "Return a randomly chosen element from a non-empty sequence." @@ -104,10 +104,10 @@ msgstr "" #: ../../library/secrets.rst:71 msgid "" -">>> token_bytes(16) \n" +">>> token_bytes(16)\n" "b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" msgstr "" -">>> token_bytes(16) \n" +">>> token_bytes(16)\n" "b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" #: ../../library/secrets.rst:79 @@ -122,10 +122,10 @@ msgstr "" #: ../../library/secrets.rst:83 msgid "" -">>> token_hex(16) \n" +">>> token_hex(16)\n" "'f9bf78b9a18ce6d46a0cd2b0b86df9da'" msgstr "" -">>> token_hex(16) \n" +">>> token_hex(16)\n" "'f9bf78b9a18ce6d46a0cd2b0b86df9da'" #: ../../library/secrets.rst:90 @@ -141,10 +141,10 @@ msgstr "" #: ../../library/secrets.rst:95 msgid "" -">>> token_urlsafe(16) \n" +">>> token_urlsafe(16)\n" "'Drmhze6EPcv0fN_81Bj-nA'" msgstr "" -">>> token_urlsafe(16) \n" +">>> token_urlsafe(16)\n" "'Drmhze6EPcv0fN_81Bj-nA'" #: ../../library/secrets.rst:102 @@ -174,9 +174,9 @@ msgid "" "argument to the various ``token_*`` functions. That argument is taken as " "the number of bytes of randomness to use." msgstr "" -"對於想自行管理權杖長度的使用者,你可以對各種 ``token_*`` 函式明白地指定 :" -"class:`int` 引數(argument)來指定權杖要使用的隨機性程度。 該引數以位元組數來" -"表示要使用的隨機性程度。" +"對於想自行管理權杖長度的使用者,你可以對各種 ``token_*`` 函式明白地指" +"定 :class:`int` 引數(argument)來指定權杖要使用的隨機性程度。 該引數以位元組" +"數來表示要使用的隨機性程度。" #: ../../library/secrets.rst:117 msgid "" @@ -289,6 +289,12 @@ msgid "" " words = [word.strip() for word in f]\n" " password = ' '.join(secrets.choice(words) for i in range(4))" msgstr "" +"import secrets\n" +"# 在標準 Linux 系統上,使用一個方便的字典檔案。\n" +"# 其他平台可能需要提供自己的字詞列表。\n" +"with open('/usr/share/dict/words') as f:\n" +" words = [word.strip() for word in f]\n" +" password = ' '.join(secrets.choice(words) for i in range(4))" #: ../../library/secrets.rst:192 msgid "" diff --git a/library/security_warnings.po b/library/security_warnings.po index 711aca08ae..243d024c02 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -123,7 +123,7 @@ msgid "" msgstr "" ":option:`-I` 命令列選項可用於在隔離模式下運行 Python。若其無法使用,可以改" "用 :option:`-P` 選項或 :envvar:`PYTHONSAFEPATH` 環境變數,避免 :data:`sys." -"path` 新增潛在的不安全路徑,例如當前目錄、腳本的目錄或空字串。" +"path` 新增潛在的不安全路徑,例如目前目錄、腳本的目錄或空字串。" #: ../../library/security_warnings.rst:3 msgid "security considerations" diff --git a/library/selectors.po b/library/selectors.po index 6b0f35f089..e231d00893 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -166,35 +166,35 @@ msgid "" "implementations support the :term:`context manager` protocol." msgstr "" -#: ../../library/selectors.rst:108 +#: ../../library/selectors.rst:109 msgid "Register a file object for selection, monitoring it for I/O events." msgstr "" -#: ../../library/selectors.rst:110 +#: ../../library/selectors.rst:111 msgid "" "*fileobj* is the file object to monitor. It may either be an integer file " "descriptor or an object with a ``fileno()`` method. *events* is a bitwise " "mask of events to monitor. *data* is an opaque object." msgstr "" -#: ../../library/selectors.rst:115 +#: ../../library/selectors.rst:116 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is already registered." msgstr "" -#: ../../library/selectors.rst:121 +#: ../../library/selectors.rst:123 msgid "" "Unregister a file object from selection, removing it from monitoring. A file " "object shall be unregistered prior to being closed." msgstr "" -#: ../../library/selectors.rst:124 +#: ../../library/selectors.rst:126 msgid "*fileobj* must be a file object previously registered." msgstr "" -#: ../../library/selectors.rst:126 +#: ../../library/selectors.rst:128 msgid "" "This returns the associated :class:`SelectorKey` instance, or raises a :exc:" "`KeyError` if *fileobj* is not registered. It will raise :exc:`ValueError` " @@ -202,30 +202,30 @@ msgid "" "``fileno()`` method has an invalid return value)." msgstr "" -#: ../../library/selectors.rst:133 +#: ../../library/selectors.rst:135 msgid "Change a registered file object's monitored events or attached data." msgstr "" -#: ../../library/selectors.rst:135 +#: ../../library/selectors.rst:137 msgid "" "This is equivalent to ``BaseSelector.unregister(fileobj)`` followed by " "``BaseSelector.register(fileobj, events, data)``, except that it can be " "implemented more efficiently." msgstr "" -#: ../../library/selectors.rst:139 +#: ../../library/selectors.rst:141 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:145 +#: ../../library/selectors.rst:148 msgid "" "Wait until some registered file objects become ready, or the timeout expires." msgstr "" -#: ../../library/selectors.rst:148 +#: ../../library/selectors.rst:151 msgid "" "If ``timeout > 0``, this specifies the maximum wait time, in seconds. If " "``timeout <= 0``, the call won't block, and will report the currently ready " @@ -233,26 +233,26 @@ msgid "" "monitored file object becomes ready." msgstr "" -#: ../../library/selectors.rst:154 +#: ../../library/selectors.rst:157 msgid "" "This returns a list of ``(key, events)`` tuples, one for each ready file " "object." msgstr "" -#: ../../library/selectors.rst:157 +#: ../../library/selectors.rst:160 msgid "" "*key* is the :class:`SelectorKey` instance corresponding to a ready file " "object. *events* is a bitmask of events ready on this file object." msgstr "" -#: ../../library/selectors.rst:162 +#: ../../library/selectors.rst:165 msgid "" "This method can return before any file object becomes ready or the timeout " "has elapsed if the current process receives a signal: in this case, an empty " "list will be returned." msgstr "" -#: ../../library/selectors.rst:166 +#: ../../library/selectors.rst:169 msgid "" "The selector is now retried with a recomputed timeout when interrupted by a " "signal if the signal handler did not raise an exception (see :pep:`475` for " @@ -260,90 +260,90 @@ msgid "" "timeout." msgstr "" -#: ../../library/selectors.rst:174 +#: ../../library/selectors.rst:177 msgid "Close the selector." msgstr "" -#: ../../library/selectors.rst:176 +#: ../../library/selectors.rst:179 msgid "" "This must be called to make sure that any underlying resource is freed. The " "selector shall not be used once it has been closed." msgstr "" -#: ../../library/selectors.rst:181 +#: ../../library/selectors.rst:184 msgid "Return the key associated with a registered file object." msgstr "" -#: ../../library/selectors.rst:183 +#: ../../library/selectors.rst:186 msgid "" "This returns the :class:`SelectorKey` instance associated to this file " "object, or raises :exc:`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:188 +#: ../../library/selectors.rst:192 msgid "Return a mapping of file objects to selector keys." msgstr "" -#: ../../library/selectors.rst:190 +#: ../../library/selectors.rst:194 msgid "" "This returns a :class:`~collections.abc.Mapping` instance mapping registered " "file objects to their associated :class:`SelectorKey` instance." msgstr "" -#: ../../library/selectors.rst:197 +#: ../../library/selectors.rst:201 msgid "" "The default selector class, using the most efficient implementation " "available on the current platform. This should be the default choice for " "most users." msgstr "" -#: ../../library/selectors.rst:204 +#: ../../library/selectors.rst:208 msgid ":func:`select.select`-based selector." msgstr "" -#: ../../library/selectors.rst:209 +#: ../../library/selectors.rst:213 msgid ":func:`select.poll`-based selector." msgstr "" -#: ../../library/selectors.rst:214 +#: ../../library/selectors.rst:218 msgid ":func:`select.epoll`-based selector." msgstr "" -#: ../../library/selectors.rst:218 +#: ../../library/selectors.rst:222 msgid "" "This returns the file descriptor used by the underlying :func:`select.epoll` " "object." msgstr "" -#: ../../library/selectors.rst:223 +#: ../../library/selectors.rst:227 msgid ":func:`select.devpoll`-based selector." msgstr "" -#: ../../library/selectors.rst:227 +#: ../../library/selectors.rst:231 msgid "" "This returns the file descriptor used by the underlying :func:`select." "devpoll` object." msgstr "" -#: ../../library/selectors.rst:234 +#: ../../library/selectors.rst:238 msgid ":func:`select.kqueue`-based selector." msgstr "" -#: ../../library/selectors.rst:238 +#: ../../library/selectors.rst:242 msgid "" "This returns the file descriptor used by the underlying :func:`select." "kqueue` object." msgstr "" -#: ../../library/selectors.rst:243 +#: ../../library/selectors.rst:247 msgid "Examples" msgstr "範例" -#: ../../library/selectors.rst:245 +#: ../../library/selectors.rst:249 msgid "Here is a simple echo server implementation::" msgstr "" -#: ../../library/selectors.rst:247 +#: ../../library/selectors.rst:251 msgid "" "import selectors\n" "import socket\n" diff --git a/library/shutil.po b/library/shutil.po index 633b582f04..2eac9779e4 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-04-20 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,8 +35,8 @@ msgstr "" #: ../../library/shutil.rst:25 msgid "" -"Even the higher-level file copying functions (:func:`shutil.copy`, :func:" -"`shutil.copy2`) cannot copy all file metadata." +"Even the higher-level file copying functions " +"(:func:`shutil.copy`, :func:`shutil.copy2`) cannot copy all file metadata." msgstr "" #: ../../library/shutil.rst:28 @@ -98,8 +98,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copyfile`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copyfile``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copyfile``。" #: ../../library/shutil.rst:72 msgid "" @@ -135,10 +135,10 @@ msgid "" "like object>` or path names given as strings. If *follow_symlinks* is false, " "and both *src* and *dst* are symbolic links, :func:`copymode` will attempt " "to modify the mode of *dst* itself (rather than the file it points to). " -"This functionality is not available on every platform; please see :func:" -"`copystat` for more information. If :func:`copymode` cannot modify symbolic " -"links on the local platform, and it is asked to do so, it will do nothing " -"and return." +"This functionality is not available on every platform; please " +"see :func:`copystat` for more information. If :func:`copymode` cannot " +"modify symbolic links on the local platform, and it is asked to do so, it " +"will do nothing and return." msgstr "" #: ../../library/shutil.rst:106 ../../library/shutil.rst:179 @@ -146,8 +146,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copymode`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copymode``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copymode``。" #: ../../library/shutil.rst:108 msgid "Added *follow_symlinks* argument." @@ -190,9 +190,9 @@ msgstr "" #: ../../library/shutil.rst:140 msgid "" -"If ``os.chflags in os.supports_follow_symlinks`` is ``True``, :func:" -"`copystat` can modify the flags of a symbolic link. (``os.chflags`` is not " -"available on all platforms.)" +"If ``os.chflags in os.supports_follow_symlinks`` is " +"``True``, :func:`copystat` can modify the flags of a symbolic link. " +"(``os.chflags`` is not available on all platforms.)" msgstr "" #: ../../library/shutil.rst:145 @@ -211,8 +211,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copystat`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copystat``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copystat``。" #: ../../library/shutil.rst:155 msgid "" @@ -260,15 +260,16 @@ msgid "" "attempts to copy all metadata from the *src* symbolic link to the newly " "created *dst* symbolic link. However, this functionality is not available on " "all platforms. On platforms where some or all of this functionality is " -"unavailable, :func:`copy2` will preserve all the metadata it can; :func:" -"`copy2` never raises an exception because it cannot preserve file metadata." +"unavailable, :func:`copy2` will preserve all the metadata it " +"can; :func:`copy2` never raises an exception because it cannot preserve file " +"metadata." msgstr "" #: ../../library/shutil.rst:204 msgid "" -":func:`copy2` uses :func:`copystat` to copy the file metadata. Please see :" -"func:`copystat` for more information about platform support for modifying " -"symbolic link metadata." +":func:`copy2` uses :func:`copystat` to copy the file metadata. Please " +"see :func:`copystat` for more information about platform support for " +"modifying symbolic link metadata." msgstr "" #: ../../library/shutil.rst:212 @@ -280,9 +281,9 @@ msgstr "" #: ../../library/shutil.rst:224 msgid "" -"This factory function creates a function that can be used as a callable for :" -"func:`copytree`\\'s *ignore* argument, ignoring files and directories that " -"match one of the glob-style *patterns* provided. See the example below." +"This factory function creates a function that can be used as a callable " +"for :func:`copytree`\\'s *ignore* argument, ignoring files and directories " +"that match one of the glob-style *patterns* provided. See the example below." msgstr "" #: ../../library/shutil.rst:233 @@ -309,9 +310,9 @@ msgstr "" #: ../../library/shutil.rst:245 msgid "" "When *symlinks* is false, if the file pointed to by the symlink doesn't " -"exist, an exception will be added in the list of errors raised in an :exc:" -"`Error` exception at the end of the copy process. You can set the optional " -"*ignore_dangling_symlinks* flag to true if you want to silence this " +"exist, an exception will be added in the list of errors raised in " +"an :exc:`Error` exception at the end of the copy process. You can set the " +"optional *ignore_dangling_symlinks* flag to true if you want to silence this " "exception. Notice that this option has no effect on platforms that don't " "support :func:`os.symlink`." msgstr "" @@ -344,8 +345,8 @@ msgstr "" #: ../../library/shutil.rst:269 msgid "" -"If *dirs_exist_ok* is false (the default) and *dst* already exists, a :exc:" -"`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " +"If *dirs_exist_ok* is false (the default) and *dst* already exists, " +"a :exc:`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " "operation will continue if it encounters existing directories, and files " "within the *dst* tree will be overwritten by corresponding files from the " "*src* tree." @@ -356,8 +357,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copytree`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copytree``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copytree``。" #: ../../library/shutil.rst:277 msgid "" @@ -452,8 +453,8 @@ msgstr "新增 *onexc* 參數並棄用 *onerror*。" #: ../../library/shutil.rst:346 msgid "" ":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " -"the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" -"exc:`!OSError` are now always propagated to the caller." +"the top-level path. Exceptions other than :exc:`OSError` and subclasses " +"of :exc:`!OSError` are now always propagated to the caller." msgstr "" #: ../../library/shutil.rst:354 @@ -494,9 +495,9 @@ msgstr "" msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " -"if :func:`os.rename` cannot be used. If the source is a directory, :func:" -"`copytree` is called, passing it the *copy_function*. The default " -"*copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " +"if :func:`os.rename` cannot be used. If the source is a " +"directory, :func:`copytree` is called, passing it the *copy_function*. The " +"default *copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " "*copy_function* allows the move to succeed when it is not possible to also " "copy the metadata, at the expense of not copying any of the metadata." msgstr "" @@ -506,8 +507,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"move``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.move``。" #: ../../library/shutil.rst:388 msgid "" @@ -586,9 +587,9 @@ msgstr "" #: ../../library/shutil.rst:452 msgid "" "*path* is a \"``PATH`` string\" specifying the directories to look in, " -"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" -"`PATH` environment variable is read from :data:`os.environ`, falling back " -"to :data:`os.defpath` if it is not set." +"delimited by :data:`os.pathsep`. When no *path* is specified, " +"the :envvar:`PATH` environment variable is read from :data:`os.environ`, " +"falling back to :data:`os.defpath` if it is not set." msgstr "" #: ../../library/shutil.rst:457 @@ -626,10 +627,10 @@ msgstr "" #: ../../library/shutil.rst:476 msgid "" -">> shutil.which(\"C:\\\\Python33\\\\python\")\n" +">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" -">> shutil.which(\"C:\\\\Python33\\\\python\")\n" +">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" #: ../../library/shutil.rst:481 @@ -662,12 +663,12 @@ msgstr "" #: ../../library/shutil.rst:505 msgid "" -"Starting from Python 3.8, all functions involving a file copy (:func:" -"`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" -"`move`) may use platform-specific \"fast-copy\" syscalls in order to copy " -"the file more efficiently (see :issue:`33671`). \"fast-copy\" means that the " -"copying operation occurs within the kernel, avoiding the use of userspace " -"buffers in Python as in \"``outfd.write(infd.read())``\"." +"Starting from Python 3.8, all functions involving a file copy " +"(:func:`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, " +"and :func:`move`) may use platform-specific \"fast-copy\" syscalls in order " +"to copy the file more efficiently (see :issue:`33671`). \"fast-copy\" means " +"that the copying operation occurs within the kernel, avoiding the use of " +"userspace buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" #: ../../library/shutil.rst:513 @@ -681,15 +682,15 @@ msgstr "" #: ../../library/shutil.rst:517 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " -"instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." -"copyfileobj` is used." +"instead of 64 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used." msgstr "" #: ../../library/shutil.rst:521 msgid "" "If the fast-copy operation fails and no data was written in the destination " -"file then shutil will silently fallback on using less efficient :func:" -"`copyfileobj` function internally." +"file then shutil will silently fallback on using less " +"efficient :func:`copyfileobj` function internally." msgstr "" #: ../../library/shutil.rst:530 @@ -785,8 +786,8 @@ msgstr "" msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " -"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if the :mod:" -"`lzma` module is available)." +"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if " +"the :mod:`lzma` module is available)." msgstr "" #: ../../library/shutil.rst:599 @@ -835,15 +836,15 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." msgstr "" -"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" -"ref:`稽核事件 ` ``shutil.make_archive``。" +"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的" +"\\ :ref:`稽核事件 ` ``shutil.make_archive``。" #: ../../library/shutil.rst:626 msgid "" -"This function is not thread-safe when custom archivers registered with :func:" -"`register_archive_format` do not support the *root_dir* argument. In this " -"case it temporarily changes the current working directory of the process to " -"*root_dir* to perform archiving." +"This function is not thread-safe when custom archivers registered " +"with :func:`register_archive_format` do not support the *root_dir* " +"argument. In this case it temporarily changes the current working directory " +"of the process to *root_dir* to perform archiving." msgstr "" #: ../../library/shutil.rst:632 @@ -950,10 +951,11 @@ msgstr "" #: ../../library/shutil.rst:695 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " -"\"bztar\", or \"xztar\". Or any other format registered with :func:" -"`register_unpack_format`. If not provided, :func:`unpack_archive` will use " -"the archive file name extension and see if an unpacker was registered for " -"that extension. In case none is found, a :exc:`ValueError` is raised." +"\"bztar\", or \"xztar\". Or any other format registered " +"with :func:`register_unpack_format`. If not " +"provided, :func:`unpack_archive` will use the archive file name extension " +"and see if an unpacker was registered for that extension. In case none is " +"found, a :exc:`ValueError` is raised." msgstr "" #: ../../library/shutil.rst:702 @@ -993,8 +995,8 @@ msgstr "新增 *filter* 引數。" #: ../../library/shutil.rst:727 msgid "" "Registers an unpack format. *name* is the name of the format and " -"*extensions* is a list of extensions corresponding to the format, like ``." -"zip`` for Zip files." +"*extensions* is a list of extensions corresponding to the format, like " +"``.zip`` for Zip files." msgstr "" #: ../../library/shutil.rst:731 @@ -1014,8 +1016,8 @@ msgstr "" #: ../../library/shutil.rst:736 msgid "" -"possibly a *filter* keyword argument, if it was given to :func:" -"`unpack_archive`;" +"possibly a *filter* keyword argument, if it was given " +"to :func:`unpack_archive`;" msgstr "" #: ../../library/shutil.rst:738 @@ -1133,8 +1135,8 @@ msgstr "" #: ../../library/shutil.rst:818 msgid "" -"In the final archive, :file:`please_add.txt` should be included, but :file:" -"`do_not_add.txt` should not. Therefore we use the following::" +"In the final archive, :file:`please_add.txt` should be included, " +"but :file:`do_not_add.txt` should not. Therefore we use the following::" msgstr "" #: ../../library/shutil.rst:821 @@ -1193,8 +1195,8 @@ msgstr "" #: ../../library/shutil.rst:852 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " -"terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" -"`os.get_terminal_size`." +"terminal connected to :data:`sys.__stdout__` is queried by " +"invoking :func:`os.get_terminal_size`." msgstr "" #: ../../library/shutil.rst:856 diff --git a/library/signal.po b/library/signal.po index 6119c47a3f..4eb34bd770 100644 --- a/library/signal.po +++ b/library/signal.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,8 +51,8 @@ msgstr "" msgid "" "A handler for a particular signal, once set, remains installed until it is " "explicitly reset (Python emulates the BSD style interface regardless of the " -"underlying implementation), with the exception of the handler for :const:" -"`SIGCHLD`, which follows the underlying implementation." +"underlying implementation), with the exception of the handler " +"for :const:`SIGCHLD`, which follows the underlying implementation." msgstr "" "特定訊號的處理程式一旦被設定,就會一直被安裝,直到被明確地重設為止 (不管底層" "的實作為何,Python 皆模擬出 BSD 風格的介面),但 :const:`SIGCHLD` 的處理程式除" @@ -86,12 +86,12 @@ msgstr "" #: ../../library/signal.rst:42 msgid "" -"It makes little sense to catch synchronous errors like :const:`SIGFPE` or :" -"const:`SIGSEGV` that are caused by an invalid operation in C code. Python " -"will return from the signal handler to the C code, which is likely to raise " -"the same signal again, causing Python to apparently hang. From Python 3.3 " -"onwards, you can use the :mod:`faulthandler` module to report on synchronous " -"errors." +"It makes little sense to catch synchronous errors like :const:`SIGFPE` " +"or :const:`SIGSEGV` that are caused by an invalid operation in C code. " +"Python will return from the signal handler to the C code, which is likely to " +"raise the same signal again, causing Python to apparently hang. From Python " +"3.3 onwards, you can use the :mod:`faulthandler` module to report on " +"synchronous errors." msgstr "" "捕捉像 :const:`SIGFPE` 或 :const:`SIGSEGV` 這類由 C 程式碼中無效操作所引起的" "同步錯誤是沒有意義的。Python 將從訊號處理程式中回傳到 C 程式碼,而 C 程式碼很" @@ -131,8 +131,8 @@ msgid "" "instead." msgstr "" "Python 訊號處理程式總是在主直譯器的主 Python 執行緒中執行,即使訊號是在另一個" -"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使用 :" -"mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" +"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使" +"用 :mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" #: ../../library/signal.rst:69 msgid "" @@ -146,20 +146,22 @@ msgstr "模組內容" #: ../../library/signal.rst:75 msgid "" -"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask (:" -"const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " -"constants listed below were turned into :class:`enums ` (:" -"class:`Signals`, :class:`Handlers` and :class:`Sigmasks` respectively). :" -"func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` and :func:" -"`sigwait` functions return human-readable :class:`enums ` as :" -"class:`Signals` objects." +"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask " +"(:const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " +"constants listed below were turned into :class:`enums ` " +"(:class:`Signals`, :class:`Handlers` and :class:`Sigmasks` " +"respectively). :func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` " +"and :func:`sigwait` functions return human-readable :class:`enums " +"` as :class:`Signals` objects." msgstr "" "下面列出的訊號 (SIG*)、處理器(:const:`SIG_DFL`、:const:`SIG_IGN`)和訊號遮" -"罩 (sigmask)(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:" -"`SIG_SETMASK`)的相關常數被轉換成 :class:`enums `\\ (:class:" -"`Signals`、:class:`Handlers` 和 :class:`Sigmasks`)。:func:`getsignal`、:" -"func:`pthread_sigmask`、:func:`sigpending` 和 :func:`sigwait` 函式會回傳可被" -"人類閱讀的\\ :class:`枚舉 `\\ 作為 :class:`Signals` 物件。" +"罩 (sigmask)" +"(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:`SIG_SETMASK`)的相關常數" +"被轉換成 :class:`enums `\\ " +"(:class:`Signals`、:class:`Handlers` " +"和 :class:`Sigmasks`)。:func:`getsignal`、:func:`pthread_sigmask`、:func:`sigpending` " +"和 :func:`sigwait` 函式會回傳可被人類閱讀的\\ :class:`枚舉 `\\ " +"作為 :class:`Signals` 物件。" #: ../../library/signal.rst:85 msgid "The signal module defines three enums:" @@ -172,18 +174,18 @@ msgstr "SIG* 常數和 CTRL_* 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:95 msgid "" -":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` and :const:" -"`SIG_IGN`." +":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` " +"and :const:`SIG_IGN`." msgstr "" ":const:`SIG_DFL` 和 :const:`SIG_IGN` 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:101 msgid "" -":class:`enum.IntEnum` collection the constants :const:`SIG_BLOCK`, :const:" -"`SIG_UNBLOCK` and :const:`SIG_SETMASK`." +":class:`enum.IntEnum` collection the " +"constants :const:`SIG_BLOCK`, :const:`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" -":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數的 :" -"class:`enum.IntEnum` 集合。" +":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數" +"的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:103 ../../library/signal.rst:136 #: ../../library/signal.rst:142 ../../library/signal.rst:148 @@ -196,9 +198,9 @@ msgstr "" #: ../../library/signal.rst:351 ../../library/signal.rst:390 #: ../../library/signal.rst:414 ../../library/signal.rst:437 #: ../../library/signal.rst:471 ../../library/signal.rst:501 -#: ../../library/signal.rst:508 ../../library/signal.rst:561 -#: ../../library/signal.rst:603 ../../library/signal.rst:618 -#: ../../library/signal.rst:644 ../../library/signal.rst:664 +#: ../../library/signal.rst:508 ../../library/signal.rst:563 +#: ../../library/signal.rst:605 ../../library/signal.rst:620 +#: ../../library/signal.rst:646 ../../library/signal.rst:666 msgid "Availability" msgstr "" @@ -222,8 +224,8 @@ msgid "" "default action for :const:`SIGCHLD` is to simply ignore it." msgstr "" "這是兩種標準訊號處理選項之一;它會簡單地執行訊號的預設功能。例如,在大多數系" -"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出,而 :const:" -"`SIGCHLD` 的預設動作是直接忽略。" +"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出," +"而 :const:`SIGCHLD` 的預設動作是直接忽略。" #: ../../library/signal.rst:124 msgid "" @@ -318,8 +320,8 @@ msgstr "" #: ../../library/signal.rst:219 msgid "" -"On architectures where the signal is available. See the man page :manpage:" -"`signal(7)` for further information." +"On architectures where the signal is available. See the man " +"page :manpage:`signal(7)` for further information." msgstr "" "在訊號可用的架構上。請參閱 :manpage:`signal(7)` 線上手冊以取得更多資訊。" @@ -345,23 +347,25 @@ msgid "" "signal is defined as :const:`signal.SIGHUP`; the variable names are " "identical to the names used in C programs, as found in ````. The " "Unix man page for ':c:func:`signal`' lists the existing signals (on some " -"systems this is :manpage:`signal(2)`, on others the list is in :manpage:" -"`signal(7)`). Note that not all systems define the same set of signal names; " -"only those names defined by the system are defined by this module." -msgstr "" -"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義為 :const:`signal." -"SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 ```` 中找到。Unix " -"線上手冊 ':c:func:`signal`' 列出了現有的訊號(在某些系統上是 :manpage:" -"`signal(2)`,在其他系統上是在 :manpage:`signal(7)` 中)。請注意,並非所有系統" -"都會定義同一套訊號名稱;只有那些由系統所定義的名稱才會由這個模組定義。" +"systems this is :manpage:`signal(2)`, on others the list is " +"in :manpage:`signal(7)`). Note that not all systems define the same set of " +"signal names; only those names defined by the system are defined by this " +"module." +msgstr "" +"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義" +"為 :const:`signal.SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 " +"```` 中找到。Unix 線上手冊 ':c:func:`signal`' 列出了現有的訊號(在" +"某些系統上是 :manpage:`signal(2)`,在其他系統上是在 :manpage:`signal(7)` " +"中)。請注意,並非所有系統都會定義同一套訊號名稱;只有那些由系統所定義的名稱" +"才會由這個模組定義。" #: ../../library/signal.rst:259 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能與 :func:`os." -"kill` 搭配使用。" +"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能" +"與 :func:`os.kill` 搭配使用。" #: ../../library/signal.rst:269 msgid "" @@ -373,8 +377,8 @@ msgstr "" #: ../../library/signal.rst:279 msgid "" -"One more than the number of the highest signal number. Use :func:" -"`valid_signals` to get valid signal numbers." +"One more than the number of the highest signal number. " +"Use :func:`valid_signals` to get valid signal numbers." msgstr "" "比最高編號訊號的編號多一。使用 :func:`valid_signals` 來取得有效的訊號編號。" @@ -427,10 +431,10 @@ msgstr ":mod:`signal` 模組定義了一個例外:" #: ../../library/signal.rst:329 msgid "" -"Raised to signal an error from the underlying :func:`setitimer` or :func:" -"`getitimer` implementation. Expect this error if an invalid interval timer " -"or a negative time is passed to :func:`setitimer`. This error is a subtype " -"of :exc:`OSError`." +"Raised to signal an error from the underlying :func:`setitimer` " +"or :func:`getitimer` implementation. Expect this error if an invalid " +"interval timer or a negative time is passed to :func:`setitimer`. This error " +"is a subtype of :exc:`OSError`." msgstr "" "當 :func:`setitimer` 或 :func:`getitimer` 底層實作發生錯誤時引發訊號。如果傳" "給 :func:`setitimer` 的是無效的間隔計時器或負數時間,則預期會發生此錯誤。這個" @@ -438,8 +442,8 @@ msgstr "" #: ../../library/signal.rst:334 msgid "" -"This error used to be a subtype of :exc:`IOError`, which is now an alias of :" -"exc:`OSError`." +"This error used to be a subtype of :exc:`IOError`, which is now an alias " +"of :exc:`OSError`." msgstr "此錯誤過去是 :exc:`IOError` 的子型別,現在是 :exc:`OSError` 的別名。" #: ../../library/signal.rst:339 @@ -469,28 +473,28 @@ msgstr "更多資訊請見 :manpage:`alarm(2)` 線上手冊。" #: ../../library/signal.rst:358 msgid "" "Return the current signal handler for the signal *signalnum*. The returned " -"value may be a callable Python object, or one of the special values :const:" -"`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. Here, :const:" -"`signal.SIG_IGN` means that the signal was previously ignored, :const:" -"`signal.SIG_DFL` means that the default way of handling the signal was " -"previously in use, and ``None`` means that the previous signal handler was " -"not installed from Python." +"value may be a callable Python object, or one of the special " +"values :const:`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. " +"Here, :const:`signal.SIG_IGN` means that the signal was previously " +"ignored, :const:`signal.SIG_DFL` means that the default way of handling the " +"signal was previously in use, and ``None`` means that the previous signal " +"handler was not installed from Python." msgstr "" "回傳訊號 *signalnum* 的目前訊號處理程式。回傳值可以是一個可呼叫的 Python 物" -"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` 或 :const:" -"`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽略,:const:" -"`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示先前的訊號處" -"理程式並未從 Python 安裝。" +"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` " +"或 :const:`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽" +"略,:const:`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示" +"先前的訊號處理程式並未從 Python 安裝。" #: ../../library/signal.rst:369 msgid "" -"Returns the description of signal *signalnum*, such as \"Interrupt\" for :" -"const:`SIGINT`. Returns :const:`None` if *signalnum* has no description. " -"Raises :exc:`ValueError` if *signalnum* is invalid." +"Returns the description of signal *signalnum*, such as \"Interrupt\" " +"for :const:`SIGINT`. Returns :const:`None` if *signalnum* has no " +"description. Raises :exc:`ValueError` if *signalnum* is invalid." msgstr "" "回傳訊號 *signalnum* 的描述,例如 :const:`SIGINT` 的 \"Interrupt\"。如果 " -"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引發 :" -"exc:`ValueError`。" +"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引" +"發 :exc:`ValueError`。" #: ../../library/signal.rst:378 msgid "" @@ -513,11 +517,11 @@ msgstr "更多資訊請見 :manpage:`signal(2)` 線上手冊。" #: ../../library/signal.rst:394 msgid "" -"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" -"func:`sigpending`." +"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` " +"and :func:`sigpending`." msgstr "" -"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` 和 :func:" -"`sigpending`。" +"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` " +"和 :func:`sigpending`。" #: ../../library/signal.rst:400 msgid "Sends a signal to the calling process. Returns nothing." @@ -559,8 +563,8 @@ msgid "" "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" -"`~threading.Thread.ident` 屬性來取得 *thread_id* 的適當值。" +"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件" +"的 :attr:`~threading.Thread.ident` 屬性來取得 *thread_id* 的適當值。" #: ../../library/signal.rst:432 msgid "" @@ -624,13 +628,13 @@ msgstr ":data:`SIG_SETMASK`:將被阻檔的訊號集合設定為 *mask* 引數 #: ../../library/signal.rst:462 msgid "" -"*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" -"`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " -"including all signals." +"*mask* is a set of signal numbers (e.g. " +"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`}). " +"Use :func:`~signal.valid_signals` for a full mask including all signals." msgstr "" -"*mask* 是一組訊號編號(例如 {:const:`signal.SIGINT`, :const:`signal." -"SIGTERM`})的集合。使用 :func:`~signal.valid_signals` 來取得包含所有訊號的完" -"整遮罩。" +"*mask* 是一組訊號編號(例如 " +"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`})的集合。使" +"用 :func:`~signal.valid_signals` 來取得包含所有訊號的完整遮罩。" #: ../../library/signal.rst:466 msgid "" @@ -650,68 +654,93 @@ msgstr "另請參閱 :func:`pause`、:func:`sigpending` 與 :func:`sigwait`。" #: ../../library/signal.rst:483 msgid "" -"Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" -"`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " -"to fire after *seconds* (float is accepted, different from :func:`alarm`) " -"and after that every *interval* seconds (if *interval* is non-zero). The " -"interval timer specified by *which* can be cleared by setting *seconds* to " -"zero." +"Sets given interval timer (one " +"of :const:`signal.ITIMER_REAL`, :const:`signal.ITIMER_VIRTUAL` " +"or :const:`signal.ITIMER_PROF`) specified by *which* to fire after *seconds* " +"(float is accepted, different from :func:`alarm`) and after that every " +"*interval* seconds (if *interval* is non-zero). The interval timer specified " +"by *which* can be cleared by setting *seconds* to zero." msgstr "" +"設定由 *which* 指定的間隔計時器" +"(:const:`signal.ITIMER_REAL`、:const:`signal.ITIMER_VIRTUAL` " +"或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮點數," +"與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如果 " +"*interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清除" +"它。" #: ../../library/signal.rst:490 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " -"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` sends :const:" -"`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." +"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` " +"sends :const:`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will " +"deliver :const:`SIGPROF`." msgstr "" +"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時" +"器;:const:`signal.ITIMER_REAL` 會傳" +"送 :const:`SIGALRM`,:const:`signal.ITIMER_VIRTUAL` 會傳" +"送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會傳" +"送 :const:`SIGPROF`。" #: ../../library/signal.rst:496 msgid "The old values are returned as a tuple: (delay, interval)." -msgstr "" +msgstr "舊值會以一個元組回傳:(delay, interval)。" #: ../../library/signal.rst:498 msgid "" -"Attempting to pass an invalid interval timer will cause an :exc:" -"`ItimerError`." -msgstr "" +"Attempting to pass an invalid interval timer will cause " +"an :exc:`ItimerError`." +msgstr "嘗試傳入無效的間隔計時器會導致 :exc:`ItimerError`。" #: ../../library/signal.rst:506 msgid "Returns current value of a given interval timer specified by *which*." -msgstr "" +msgstr "回傳由 *which* 指定之間隔計時器的目前值。" #: ../../library/signal.rst:513 msgid "" -"Set the wakeup file descriptor to *fd*. When a signal is received, the " -"signal number is written as a single byte into the fd. This can be used by " -"a library to wakeup a poll or select call, allowing the signal to be fully " -"processed." +"Set the wakeup file descriptor to *fd*. When a signal your program has " +"registered a signal handler for is received, the signal number is written as " +"a single byte into the fd. If you haven't registered a signal handler for " +"the signals you care about, then nothing will be written to the wakeup fd. " +"This can be used by a library to wakeup a poll or select call, allowing the " +"signal to be fully processed." msgstr "" +"設定喚醒檔案描述器為 *fd*。當接收到其處理程式已有被註冊的訊號時,訊號編號會以" +"單一位元組寫入 fd。如果你沒有為你在意的訊號註冊處理程式,就不會寫入到喚醒 " +"fd。這可被函式庫用來喚醒輪詢 (wakeup a poll) 或 select 呼叫,讓訊號得以完全處" +"理。" -#: ../../library/signal.rst:518 +#: ../../library/signal.rst:520 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " "*fd* must be non-blocking. It is up to the library to remove any bytes from " "*fd* before calling poll or select again." msgstr "" +"回傳舊的喚醒 fd(如果檔案描述器喚醒未啟用,則回傳 -1)。如果 *fd* 為 -1,則會" +"停用檔案描述器喚醒。如果不是 -1,*fd* 必須是非阻塞的。在再次呼叫輪詢或 " +"select 之前,由函式庫來決定是否移除 *fd* 中的任何位元組。" -#: ../../library/signal.rst:523 ../../library/signal.rst:578 +#: ../../library/signal.rst:525 ../../library/signal.rst:580 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " "call it from other threads will cause a :exc:`ValueError` exception to be " "raised." msgstr "" +"當啟用執行緒時,這個函式只能從\\ :ref:`主直譯器 `\\ 的主" +"執行緒來呼叫;嘗試從其他執行緒呼叫它將會引發 :exc:`ValueError` 例外。" -#: ../../library/signal.rst:528 +#: ../../library/signal.rst:530 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " "determine *which* signal or signals have arrived." msgstr "" +"使用這個函式有兩種常見的方式。在這兩種方法中,當訊號抵達時,你都要使用 fd 來" +"喚醒,但它們的不同之處在於如何判斷\\ *哪個或哪些*\\ 訊號有抵達。" -#: ../../library/signal.rst:533 +#: ../../library/signal.rst:535 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -721,8 +750,13 @@ msgid "" "you should set ``warn_on_full_buffer=True``, which will at least cause a " "warning to be printed to stderr when signals are lost." msgstr "" +"在第一種方法中,我們從 fd 的緩衝區中讀取資料,而位元組值則提供訊號編號。這個" +"方法很簡單,但在少數情況下可能會遇到問題:一般來說,fd 的緩衝區空間有限,如果" +"太多訊號來得太快,那麼緩衝區可能會滿,而有些訊號可能會遺失。如果你使用這種方" +"法,那麼你應該設定 ``warn_on_full_buffer=True``,這至少會在訊號丟失時將警告印" +"出到 stderr。" -#: ../../library/signal.rst:542 +#: ../../library/signal.rst:544 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -731,155 +765,197 @@ msgid "" "``warn_on_full_buffer=False``, so that your users are not confused by " "spurious warning messages." msgstr "" +"在第二種方法中,我們\\ *只會*\\ 將喚醒 fd 用於喚醒,而忽略實際的位元組值。在" +"這種情況下,我們只在乎 fd 的緩衝區是空或非空;即便緩衝區滿了也不代表有問題。" +"如果你使用這種方法,那麼你應該設定 ``warn_on_full_buffer=False``,這樣你的使" +"用者就不會被虛假的警告訊息所混淆。" -#: ../../library/signal.rst:549 +#: ../../library/signal.rst:551 msgid "On Windows, the function now also supports socket handles." -msgstr "" +msgstr "在 Windows 上,此功能現在也支援 socket 處理程式。" -#: ../../library/signal.rst:552 +#: ../../library/signal.rst:554 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "新增 ``warn_on_full_buffer`` 參數。" -#: ../../library/signal.rst:557 +#: ../../library/signal.rst:559 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " "system calls will be interrupted. Returns nothing." msgstr "" +"改變系統呼叫重新啟動的行為:如果 *flag* 是 :const:`False`,系統呼叫會在被訊" +"號 *signalnum* 中斷時重新啟動,否則系統呼叫會被中斷。不會回傳任何東西。" -#: ../../library/signal.rst:563 +#: ../../library/signal.rst:565 msgid "See the man page :manpage:`siginterrupt(3)` for further information." -msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 線上手冊。" -#: ../../library/signal.rst:565 +#: ../../library/signal.rst:567 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:`!" "siginterrupt` with a true *flag* value for the given signal." msgstr "" +"請注意,使用 :func:`signal` 安裝訊號處理程式,會透過隱式呼叫 :c:func:`!" +"siginterrupt` 來將重新啟動的行為重設為可中斷,且指定訊號的 *flag* 值為 true。" -#: ../../library/signal.rst:572 +#: ../../library/signal.rst:574 msgid "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " "the special values :const:`signal.SIG_IGN` or :const:`signal.SIG_DFL`. The " -"previous signal handler will be returned (see the description of :func:" -"`getsignal` above). (See the Unix man page :manpage:`signal(2)` for further " -"information.)" +"previous signal handler will be returned (see the description " +"of :func:`getsignal` above). (See the Unix man page :manpage:`signal(2)` " +"for further information.)" msgstr "" +"將訊號 *signalnum* 的處理程式設定為函式 *handler*。*handler* 可以是帶兩個引數" +"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` " +"或 :const:`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上" +"面 :func:`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手" +"冊 :manpage:`signal(2)`)。" -#: ../../library/signal.rst:583 +#: ../../library/signal.rst:585 msgid "" "The *handler* is called with two arguments: the signal number and the " "current stack frame (``None`` or a frame object; for a description of frame " "objects, see the :ref:`description in the type hierarchy ` or " "see the attribute descriptions in the :mod:`inspect` module)." msgstr "" +"*handler* 被呼叫時有兩個引數:訊號編號和目前的堆疊 frame(``None`` 或一個 " +"frame 物件;關於 frame 物件的描述,請參閱\\ :ref:`型別階層中的描述 `\\ 或 :mod:`inspect` 模組中的屬性描述)。" -#: ../../library/signal.rst:588 +#: ../../library/signal.rst:590 msgid "" -"On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" -"`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" -"`SIGTERM`, or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any " -"other case. Note that not all systems define the same set of signal names; " +"On Windows, :func:`signal` can only be called " +"with :const:`SIGABRT`, :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:`SIGTERM`, " +"or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any other case. " +"Note that not all systems define the same set of signal names; " "an :exc:`AttributeError` will be raised if a signal name is not defined as " "``SIG*`` module level constant." msgstr "" +"在 Windows 上,:func:`signal` 只能在使" +"用 :const:`SIGABRT`、:const:`SIGFPE`、:const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` " +"或 :const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並" +"非所有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常" +"數,則會引發 :exc:`AttributeError` 錯誤。" -#: ../../library/signal.rst:599 +#: ../../library/signal.rst:601 msgid "" "Examine the set of signals that are pending for delivery to the calling " "thread (i.e., the signals which have been raised while blocked). Return the " "set of the pending signals." msgstr "" +"檢查待傳送至呼叫執行緒的訊號集合(即阻檔時已被提出的訊號)。回傳待定訊號的集" +"合。" -#: ../../library/signal.rst:605 +#: ../../library/signal.rst:607 msgid "See the man page :manpage:`sigpending(2)` for further information." -msgstr "更多資訊請見 :manpage:`sigpending(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigpending(2)` 線上手冊。" -#: ../../library/signal.rst:607 +#: ../../library/signal.rst:609 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`、:func:`pthread_sigmask` 與 :func:`sigwait`。" -#: ../../library/signal.rst:614 +#: ../../library/signal.rst:616 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " "signal (removes it from the pending list of signals), and returns the signal " "number." msgstr "" +"暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。函式接受訊" +"號(將其從待定訊號清單中移除),並回傳訊號編號。" -#: ../../library/signal.rst:620 +#: ../../library/signal.rst:622 msgid "See the man page :manpage:`sigwait(3)` for further information." -msgstr "更多資訊請見 :manpage:`sigwait(3)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigwait(3)` 線上手冊。" -#: ../../library/signal.rst:622 +#: ../../library/signal.rst:624 msgid "" -"See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" -"`sigwaitinfo` and :func:`sigtimedwait`." +"See " +"also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:`sigwaitinfo` " +"and :func:`sigtimedwait`." msgstr "" +"另也請" +"見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:`sigwaitinfo` " +"和 :func:`sigtimedwait`。" -#: ../../library/signal.rst:630 +#: ../../library/signal.rst:632 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " "signal and removes it from the pending list of signals. If one of the " "signals in *sigset* is already pending for the calling thread, the function " "will return immediately with information about that signal. The signal " -"handler is not called for the delivered signal. The function raises an :exc:" -"`InterruptedError` if it is interrupted by a signal that is not in *sigset*." +"handler is not called for the delivered signal. The function raises " +"an :exc:`InterruptedError` if it is interrupted by a signal that is not in " +"*sigset*." msgstr "" +"暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。該函式接受" +"訊號,並將其從待定訊號清單中移除。如果 *sigset* 中的一個訊號已經是呼叫執行緒" +"的待定訊號,函式會立即回傳該訊號的相關資訊。對於已傳送的訊號,訊號處理程式不" +"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引" +"發 :exc:`InterruptedError`。" -#: ../../library/signal.rst:639 +#: ../../library/signal.rst:641 msgid "" -"The return value is an object representing the data contained in the :c:type:" -"`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`, :attr:" -"`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:" -"`si_band`." +"The return value is an object representing the data contained in " +"the :c:type:`siginfo_t` structure, " +"namely: :attr:`si_signo`, :attr:`si_code`, :attr:`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:`si_band`." msgstr "" +"回傳值是一個物件,代表 :c:type:`siginfo_t` 結構所包含的資料," +"即 :attr:`si_signo`、:attr:`si_code`、:attr:`si_errno`、:attr:`si_pid`、:attr:`si_uid`、:attr:`si_status`、:attr:`si_band`。" -#: ../../library/signal.rst:646 +#: ../../library/signal.rst:648 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." -msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 線上手冊。" -#: ../../library/signal.rst:648 +#: ../../library/signal.rst:650 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigtimedwait`。" -#: ../../library/signal.rst:652 +#: ../../library/signal.rst:654 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " "rationale)." msgstr "" +"現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會重試函" +"式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:660 +#: ../../library/signal.rst:662 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as ``0``, a poll is " "performed. Returns :const:`None` if a timeout occurs." msgstr "" +"類似 :func:`sigwaitinfo`,但需要額外的 *timeout* 引數指定逾時時間。如果 " +"*timeout* 指定為 ``0``,會執行輪詢。如果發生逾時則會回傳 :const:`None`。" -#: ../../library/signal.rst:666 +#: ../../library/signal.rst:668 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." -msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 線上手冊。" -#: ../../library/signal.rst:668 +#: ../../library/signal.rst:670 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigwaitinfo`。" -#: ../../library/signal.rst:672 +#: ../../library/signal.rst:674 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " "(see :pep:`475` for the rationale)." msgstr "" +"現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會使用重" +"新計算的 *timeout* 重試函式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:681 +#: ../../library/signal.rst:683 msgid "Examples" msgstr "範例" -#: ../../library/signal.rst:683 +#: ../../library/signal.rst:685 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -888,8 +964,12 @@ msgid "" "alarm before opening the file; if the operation takes too long, the alarm " "signal will be sent, and the handler raises an exception. ::" msgstr "" +"這是一個最小範例程式。它使用 :func:`alarm` 函式來限制等待開啟檔案的時間;如果" +"檔案是用於可能未開啟的序列裝置,這會很有用,因為這通常會導致 :func:`os.open` " +"無限期地被擱置。解決方法是在開啟檔案前設定一個 5 秒的警報;如果操作時間過長," +"警報訊號就會被送出,而處理程式會產生例外。 ::" -#: ../../library/signal.rst:690 +#: ../../library/signal.rst:692 msgid "" "import signal, os\n" "\n" @@ -907,21 +987,40 @@ msgid "" "\n" "signal.alarm(0) # Disable the alarm" msgstr "" +"import signal, os\n" +"\n" +"def handler(signum, frame):\n" +" signame = signal.Signals(signum).name\n" +" print(f'Signal handler called with signal {signame} ({signum})')\n" +" raise OSError(\"Couldn't open device!\")\n" +"\n" +"# 設定訊號處理程式與五秒警報\n" +"signal.signal(signal.SIGALRM, handler)\n" +"signal.alarm(5)\n" +"\n" +"# 這個 open() 可能無限期地被擱置\n" +"fd = os.open('/dev/ttyS0', os.O_RDWR)\n" +"\n" +"signal.alarm(0) # 停用警報" -#: ../../library/signal.rst:707 +#: ../../library/signal.rst:709 msgid "Note on SIGPIPE" -msgstr "" +msgstr "關於 SIGPIPE 的說明" -#: ../../library/signal.rst:709 +#: ../../library/signal.rst:711 msgid "" -"Piping output of your program to tools like :manpage:`head(1)` will cause a :" -"const:`SIGPIPE` signal to be sent to your process when the receiver of its " -"standard output closes early. This results in an exception like :code:" -"`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, wrap your " -"entry point to catch this exception as follows::" +"Piping output of your program to tools like :manpage:`head(1)` will cause " +"a :const:`SIGPIPE` signal to be sent to your process when the receiver of " +"its standard output closes early. This results in an exception " +"like :code:`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, " +"wrap your entry point to catch this exception as follows::" msgstr "" +"將程式的輸出管道化到 :manpage:`head(1)` 之類的工具,會在你的行程的標準輸出接" +"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類" +"似 :code:`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請" +"將你的進入點包裝成如下的樣子來捕捉這個例外: ::" -#: ../../library/signal.rst:715 +#: ../../library/signal.rst:717 msgid "" "import os\n" "import sys\n" @@ -945,20 +1044,43 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"import os\n" +"import sys\n" +"\n" +"def main():\n" +" try:\n" +" # 模擬大量輸出(你的程式取代此迴圈)\n" +" for x in range(10000):\n" +" print(\"y\")\n" +" # 在這裡清除輸出以強制 SIGPIPE 在這個 try 區塊\n" +" # 中被觸發\n" +" sys.stdout.flush()\n" +" except BrokenPipeError:\n" +" # Python 在退出時清除標準串流;為剩下的輸出重新導向\n" +" # 至 devnull 來避免關閉時的 BrokenPipeError\n" +" devnull = os.open(os.devnull, os.O_WRONLY)\n" +" os.dup2(devnull, sys.stdout.fileno())\n" +" sys.exit(1) # Python 在 EPIPE 時以錯誤碼 1 退出\n" +"\n" +"if __name__ == '__main__':\n" +" main()" -#: ../../library/signal.rst:736 +#: ../../library/signal.rst:738 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " "unexpectedly whenever any socket connection is interrupted while your " "program is still writing to it." msgstr "" +"不要為了避免 :exc:`BrokenPipeError` 而將 :const:`SIGPIPE` 之處置 " +"(disposition) 設定為 :const:`SIG_DFL`。這樣做會導致你的程式在寫入任何 socket " +"連線時被中斷而意外退出。" -#: ../../library/signal.rst:745 +#: ../../library/signal.rst:747 msgid "Note on Signal Handlers and Exceptions" -msgstr "" +msgstr "訊號處理程式與例外的說明" -#: ../../library/signal.rst:747 +#: ../../library/signal.rst:749 msgid "" "If a signal handler raises an exception, the exception will be propagated to " "the main thread and may be raised after any :term:`bytecode` instruction. " @@ -968,12 +1090,17 @@ msgid "" "exception resulting from a signal handler) may on rare occasions put the " "program in an unexpected state." msgstr "" +"如果訊號處理程式產生例外,例外會傳送到主執行緒並可能在任何 :term:`bytecode` " +"指令之後發生。最值得注意的是,:exc:`KeyboardInterrupt` 可能在執行過程中的任何" +"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因" +"此 :exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在" +"罕見的情況下使程式處於預期之外的狀態。" -#: ../../library/signal.rst:754 +#: ../../library/signal.rst:756 msgid "To illustrate this issue, consider the following code::" -msgstr "" +msgstr "為了說明這個問題,請參考以下程式碼: ::" -#: ../../library/signal.rst:756 +#: ../../library/signal.rst:758 msgid "" "class SpamContext:\n" " def __init__(self):\n" @@ -990,19 +1117,39 @@ msgid "" " ...\n" " self.lock.release()" msgstr "" +"class SpamContext:\n" +" def __init__(self):\n" +" self.lock = threading.Lock()\n" +"\n" +" def __enter__(self):\n" +" # 如果 KeyboardInterrupt 在此發生則一切正常\n" +" self.lock.acquire()\n" +" # 如果 KeyboardInterrupt 在此發生,__exit__ 將不會被呼叫\n" +" ...\n" +" # KeyboardInterrupt 可能在函式回傳之前發生\n" +"\n" +" def __exit__(self, exc_type, exc_val, exc_tb):\n" +" ...\n" +" self.lock.release()" -#: ../../library/signal.rst:771 +#: ../../library/signal.rst:773 msgid "" -"For many programs, especially those that merely want to exit on :exc:" -"`KeyboardInterrupt`, this is not a problem, but applications that are " -"complex or require high reliability should avoid raising exceptions from " +"For many programs, especially those that merely want to exit " +"on :exc:`KeyboardInterrupt`, this is not a problem, but applications that " +"are complex or require high reliability should avoid raising exceptions from " "signal handlers. They should also avoid catching :exc:`KeyboardInterrupt` as " "a means of gracefully shutting down. Instead, they should install their " "own :const:`SIGINT` handler. Below is an example of an HTTP server that " "avoids :exc:`KeyboardInterrupt`::" msgstr "" +"對許多程式來說,尤其是那些只想在 :exc:`KeyboardInterrupt` 時退出的程式,這並" +"不是問題,但是對於複雜或需要高可靠性的應用程式來說,應該避免從訊號處理程式產" +"生例外。它們也應該避免將捕獲 :exc:`KeyboardInterrupt` 作為一種優雅關閉 " +"(gracefully shutting down) 的方式。相反地,它們應該安裝自己" +"的 :const:`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` " +"的範例: ::" -#: ../../library/signal.rst:779 +#: ../../library/signal.rst:781 msgid "" "import signal\n" "import socket\n" @@ -1034,3 +1181,32 @@ msgid "" "serve_forever(httpd)\n" "print(\"Shutdown...\")" msgstr "" +"import signal\n" +"import socket\n" +"from selectors import DefaultSelector, EVENT_READ\n" +"from http.server import HTTPServer, SimpleHTTPRequestHandler\n" +"\n" +"interrupt_read, interrupt_write = socket.socketpair()\n" +"\n" +"def handler(signum, frame):\n" +" print('Signal handler called with signal', signum)\n" +" interrupt_write.send(b'\\0')\n" +"signal.signal(signal.SIGINT, handler)\n" +"\n" +"def serve_forever(httpd):\n" +" sel = DefaultSelector()\n" +" sel.register(interrupt_read, EVENT_READ)\n" +" sel.register(httpd, EVENT_READ)\n" +"\n" +" while True:\n" +" for key, _ in sel.select():\n" +" if key.fileobj == interrupt_read:\n" +" interrupt_read.recv(1)\n" +" return\n" +" if key.fileobj == httpd:\n" +" httpd.handle_request()\n" +"\n" +"print(\"Serving on port 8000\")\n" +"httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler)\n" +"serve_forever(httpd)\n" +"print(\"Shutdown...\")" diff --git a/library/site.po b/library/site.po index 89fbfeb209..9108089b60 100644 --- a/library/site.po +++ b/library/site.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -58,7 +58,7 @@ msgid "" "then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y[t]}/" "site-packages` (on Unix and macOS). (The optional suffix \"t\" indicates " "the :term:`free threading` build, and is appended if ``\"t\"`` is present in " -"the :attr:`sys.abiflags` constant.) For each of the distinct head-tail " +"the :data:`sys.abiflags` constant.) For each of the distinct head-tail " "combinations, it sees if it refers to an existing directory, and if so, adds " "it to ``sys.path`` and also inspects the newly added path for configuration " "files." diff --git a/library/smtplib.po b/library/smtplib.po index 5e46fd820e..921c053924 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -706,11 +706,11 @@ msgid "" "and *to_addrs*, ``send_message`` does not transmit any :mailheader:`Bcc` or :" "mailheader:`Resent-Bcc` headers that may appear in *msg*. If any of the " "addresses in *from_addr* and *to_addrs* contain non-ASCII characters and the " -"server does not advertise ``SMTPUTF8`` support, an :exc:`SMTPNotSupported` " -"error is raised. Otherwise the ``Message`` is serialized with a clone of " -"its :mod:`~email.policy` with the :attr:`~email.policy.EmailPolicy.utf8` " -"attribute set to ``True``, and ``SMTPUTF8`` and ``BODY=8BITMIME`` are added " -"to *mail_options*." +"server does not advertise ``SMTPUTF8`` support, an :exc:" +"`SMTPNotSupportedError` is raised. Otherwise the ``Message`` is serialized " +"with a clone of its :mod:`~email.policy` with the :attr:`~email.policy." +"EmailPolicy.utf8` attribute set to ``True``, and ``SMTPUTF8`` and " +"``BODY=8BITMIME`` are added to *mail_options*." msgstr "" #: ../../library/smtplib.rst:534 diff --git a/library/socket.po b/library/socket.po index c7e95f09c9..3f6e8c5fc1 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,9 +6,9 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" -"PO-Revision-Date: 2018-05-23 16:10+0000\n" -"Last-Translator: Adrian Liaw \n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" +"PO-Revision-Date: 2024-12-30 23:45+0800\n" +"Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -16,10 +16,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.5\n" #: ../../library/socket.rst:2 msgid ":mod:`!socket` --- Low-level networking interface" -msgstr ":mod:`!socket` --- 低階網路介面" +msgstr ":mod:`!socket` — 低階網路介面" #: ../../library/socket.rst:7 msgid "**Source code:** :source:`Lib/socket.py`" @@ -31,42 +32,44 @@ msgid "" "on all modern Unix systems, Windows, MacOS, and probably additional " "platforms." msgstr "" +"這個模組提供了操作 BSD *socket* 的介面。這在所有現代 Unix 系統、Windows、" +"MacOS,以及一些其他平台上都可用。" #: ../../library/socket.rst:16 msgid "" "Some behavior may be platform dependent, since calls are made to the " "operating system socket APIs." -msgstr "" - -#: ../../library/socket.rst:171 ../../library/socket.rst:181 -#: ../../library/socket.rst:209 ../../library/socket.rst:216 -#: ../../library/socket.rst:233 ../../library/socket.rst:383 -#: ../../library/socket.rst:461 ../../library/socket.rst:475 -#: ../../library/socket.rst:490 ../../library/socket.rst:501 -#: ../../library/socket.rst:510 ../../library/socket.rst:519 -#: ../../library/socket.rst:530 ../../library/socket.rst:542 -#: ../../library/socket.rst:553 ../../library/socket.rst:566 -#: ../../library/socket.rst:594 ../../library/socket.rst:606 -#: ../../library/socket.rst:612 ../../library/socket.rst:643 -#: ../../library/socket.rst:658 ../../library/socket.rst:667 -#: ../../library/socket.rst:684 ../../library/socket.rst:699 -#: ../../library/socket.rst:709 ../../library/socket.rst:898 -#: ../../library/socket.rst:1023 ../../library/socket.rst:1039 -#: ../../library/socket.rst:1052 ../../library/socket.rst:1067 -#: ../../library/socket.rst:1084 ../../library/socket.rst:1095 -#: ../../library/socket.rst:1106 ../../library/socket.rst:1117 -#: ../../library/socket.rst:1206 ../../library/socket.rst:1226 -#: ../../library/socket.rst:1252 ../../library/socket.rst:1275 -#: ../../library/socket.rst:1304 ../../library/socket.rst:1315 -#: ../../library/socket.rst:1342 ../../library/socket.rst:1359 -#: ../../library/socket.rst:1376 ../../library/socket.rst:1390 -#: ../../library/socket.rst:1441 ../../library/socket.rst:1488 -#: ../../library/socket.rst:1502 ../../library/socket.rst:1522 -#: ../../library/socket.rst:1569 ../../library/socket.rst:1614 -#: ../../library/socket.rst:1744 ../../library/socket.rst:1788 -#: ../../library/socket.rst:1896 ../../library/socket.rst:1914 -#: ../../library/socket.rst:1998 ../../library/socket.rst:2008 -#: ../../library/socket.rst:2020 ../../includes/wasm-notavail.rst:3 +msgstr "由於是呼叫作業系統的 socket API,某些行為可能會因平台而有所差異。" + +#: ../../library/socket.rst:176 ../../library/socket.rst:186 +#: ../../library/socket.rst:214 ../../library/socket.rst:221 +#: ../../library/socket.rst:238 ../../library/socket.rst:388 +#: ../../library/socket.rst:466 ../../library/socket.rst:483 +#: ../../library/socket.rst:498 ../../library/socket.rst:509 +#: ../../library/socket.rst:518 ../../library/socket.rst:527 +#: ../../library/socket.rst:538 ../../library/socket.rst:550 +#: ../../library/socket.rst:561 ../../library/socket.rst:574 +#: ../../library/socket.rst:602 ../../library/socket.rst:614 +#: ../../library/socket.rst:620 ../../library/socket.rst:650 +#: ../../library/socket.rst:665 ../../library/socket.rst:674 +#: ../../library/socket.rst:691 ../../library/socket.rst:706 +#: ../../library/socket.rst:716 ../../library/socket.rst:905 +#: ../../library/socket.rst:1030 ../../library/socket.rst:1046 +#: ../../library/socket.rst:1059 ../../library/socket.rst:1074 +#: ../../library/socket.rst:1091 ../../library/socket.rst:1102 +#: ../../library/socket.rst:1113 ../../library/socket.rst:1124 +#: ../../library/socket.rst:1213 ../../library/socket.rst:1233 +#: ../../library/socket.rst:1259 ../../library/socket.rst:1282 +#: ../../library/socket.rst:1311 ../../library/socket.rst:1322 +#: ../../library/socket.rst:1349 ../../library/socket.rst:1366 +#: ../../library/socket.rst:1383 ../../library/socket.rst:1397 +#: ../../library/socket.rst:1448 ../../library/socket.rst:1495 +#: ../../library/socket.rst:1509 ../../library/socket.rst:1529 +#: ../../library/socket.rst:1576 ../../library/socket.rst:1621 +#: ../../library/socket.rst:1746 ../../library/socket.rst:1790 +#: ../../library/socket.rst:1898 ../../library/socket.rst:1916 +#: ../../library/socket.rst:2000 ../../library/socket.rst:2010 +#: ../../library/socket.rst:2022 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" @@ -84,10 +87,15 @@ msgid "" "call and library interface for sockets to Python's object-oriented style: " "the :func:`~socket.socket` function returns a :dfn:`socket object` whose " "methods implement the various socket system calls. Parameter types are " -"somewhat higher-level than in the C interface: as with :meth:`read` and :" -"meth:`write` operations on Python files, buffer allocation on receive " +"somewhat higher-level than in the C interface: as with :meth:`read` " +"and :meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" +"Python 的介面是將 Unix 的系統呼叫和 socket 函式庫介面直接轉換成 Python 的物件" +"導向風格::func:`.socket` 函式會回傳一個 :dfn:`socket 物件`,這個物件的方法實" +"作了各種 socket 系統呼叫。與 C 語言介面相比,參數型別較為高階:就像 Python 文" +"件操作中的 :meth:`read` 和 :meth:`write` 一樣,接收操作時會自動分配緩衝區,而" +"發送操作時的緩衝區長度則是隱含的。" #: ../../library/socket.rst:35 msgid "Module :mod:`socketserver`" @@ -95,7 +103,7 @@ msgstr ":mod:`socketserver` 模組" #: ../../library/socket.rst:36 msgid "Classes that simplify writing network servers." -msgstr "" +msgstr "簡化編寫網路伺服器的類別。" #: ../../library/socket.rst:38 msgid "Module :mod:`ssl`" @@ -103,7 +111,7 @@ msgstr ":mod:`ssl` 模組" #: ../../library/socket.rst:39 msgid "A TLS/SSL wrapper for socket objects." -msgstr "" +msgstr "對 socket 物件的 TLS/SSL 的包裝器 (wrapper)。" #: ../../library/socket.rst:43 msgid "Socket families" @@ -139,8 +147,8 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:66 ../../library/socket.rst:1189 -#: ../../library/socket.rst:1231 ../../library/socket.rst:1992 +#: ../../library/socket.rst:66 ../../library/socket.rst:1196 +#: ../../library/socket.rst:1238 ../../library/socket.rst:1994 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -156,10 +164,10 @@ msgstr "" msgid "" "For IPv4 addresses, two special forms are accepted instead of a host " "address: ``''`` represents :const:`INADDR_ANY`, which is used to bind to all " -"interfaces, and the string ``''`` represents :const:" -"`INADDR_BROADCAST`. This behavior is not compatible with IPv6, therefore, " -"you may want to avoid these if you intend to support IPv6 with your Python " -"programs." +"interfaces, and the string ``''`` " +"represents :const:`INADDR_BROADCAST`. This behavior is not compatible with " +"IPv6, therefore, you may want to avoid these if you intend to support IPv6 " +"with your Python programs." msgstr "" #: ../../library/socket.rst:83 @@ -273,120 +281,132 @@ msgid "" msgstr "" #: ../../library/socket.rst:146 +msgid ":const:`BTPROTO_HCI` accepts a format that depends on your OS." +msgstr "" + +#: ../../library/socket.rst:148 +msgid "" +"On Linux it accepts a tuple ``(device_id,)`` where ``device_id`` is an " +"integer specifying the number of the Bluetooth device." +msgstr "" + +#: ../../library/socket.rst:150 msgid "" -":const:`BTPROTO_HCI` accepts ``(device_id,)`` where ``device_id`` is either " -"an integer or a string with the Bluetooth address of the interface. (This " -"depends on your OS; NetBSD and DragonFlyBSD expect a Bluetooth address while " -"everything else expects an integer.)" +"On FreeBSD, NetBSD and DragonFly BSD it accepts ``bdaddr`` where ``bdaddr`` " +"is the Bluetooth address as a string." msgstr "" -#: ../../library/socket.rst:151 +#: ../../library/socket.rst:153 msgid "NetBSD and DragonFlyBSD support added." msgstr "加入對 NetBSD 和 DragonFlyBSD 的支援。" -#: ../../library/socket.rst:154 +#: ../../library/socket.rst:156 +msgid "FreeBSD support added." +msgstr "新增對 FreeBSD 的支援。" + +#: ../../library/socket.rst:159 msgid "" -":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is a :class:`bytes` " -"object containing the Bluetooth address in a string format. (ex. " -"``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." +":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is the Bluetooth " +"address as a string or a :class:`bytes` object. (ex. ``'12:23:34:45:56:67'`` " +"or ``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." msgstr "" -#: ../../library/socket.rst:159 +#: ../../library/socket.rst:164 msgid "" ":const:`AF_ALG` is a Linux-only socket based interface to Kernel " "cryptography. An algorithm socket is configured with a tuple of two to four " "elements ``(type, name [, feat [, mask]])``, where:" msgstr "" -#: ../../library/socket.rst:163 +#: ../../library/socket.rst:168 msgid "" "*type* is the algorithm type as string, e.g. ``aead``, ``hash``, " "``skcipher`` or ``rng``." msgstr "" -#: ../../library/socket.rst:166 +#: ../../library/socket.rst:171 msgid "" "*name* is the algorithm name and operation mode as string, e.g. ``sha256``, " "``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``." msgstr "" -#: ../../library/socket.rst:169 +#: ../../library/socket.rst:174 msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:173 +#: ../../library/socket.rst:178 msgid "Some algorithm types require more recent Kernels." msgstr "" -#: ../../library/socket.rst:177 +#: ../../library/socket.rst:182 msgid "" ":const:`AF_VSOCK` allows communication between virtual machines and their " "hosts. The sockets are represented as a ``(CID, port)`` tuple where the " "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:183 +#: ../../library/socket.rst:188 msgid "See :manpage:`vsock(7)`" msgstr "請見 :manpage:`vsock(7)`" -#: ../../library/socket.rst:187 +#: ../../library/socket.rst:192 msgid "" ":const:`AF_PACKET` is a low-level interface directly to network devices. The " "addresses are represented by the tuple ``(ifname, proto[, pkttype[, hatype[, " "addr]]])`` where:" msgstr "" -#: ../../library/socket.rst:191 +#: ../../library/socket.rst:196 msgid "*ifname* - String specifying the device name." msgstr "" -#: ../../library/socket.rst:192 +#: ../../library/socket.rst:197 msgid "" "*proto* - The Ethernet protocol number. May be :data:`ETH_P_ALL` to capture " "all protocols, one of the :ref:`ETHERTYPE_* constants ` or any other Ethernet protocol number." msgstr "" -#: ../../library/socket.rst:196 +#: ../../library/socket.rst:201 msgid "*pkttype* - Optional integer specifying the packet type:" msgstr "" -#: ../../library/socket.rst:198 +#: ../../library/socket.rst:203 msgid "``PACKET_HOST`` (the default) - Packet addressed to the local host." msgstr "" -#: ../../library/socket.rst:199 +#: ../../library/socket.rst:204 msgid "``PACKET_BROADCAST`` - Physical-layer broadcast packet." msgstr "" -#: ../../library/socket.rst:200 +#: ../../library/socket.rst:205 msgid "" "``PACKET_MULTICAST`` - Packet sent to a physical-layer multicast address." msgstr "" -#: ../../library/socket.rst:201 +#: ../../library/socket.rst:206 msgid "" "``PACKET_OTHERHOST`` - Packet to some other host that has been caught by a " "device driver in promiscuous mode." msgstr "" -#: ../../library/socket.rst:203 +#: ../../library/socket.rst:208 msgid "" "``PACKET_OUTGOING`` - Packet originating from the local host that is looped " "back to a packet socket." msgstr "" -#: ../../library/socket.rst:205 +#: ../../library/socket.rst:210 msgid "*hatype* - Optional integer specifying the ARP hardware address type." msgstr "" -#: ../../library/socket.rst:206 +#: ../../library/socket.rst:211 msgid "" "*addr* - Optional bytes-like object specifying the hardware physical " "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:211 +#: ../../library/socket.rst:216 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " "with services running on co-processors in Qualcomm platforms. The address " @@ -394,7 +414,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:220 +#: ../../library/socket.rst:225 msgid "" ":const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify " "what portion of a packet is covered with the checksum. It adds two socket " @@ -405,14 +425,14 @@ msgid "" "of their data. In both cases ``length`` should be in ``range(8, 2**16, 8)``." msgstr "" -#: ../../library/socket.rst:229 +#: ../../library/socket.rst:234 msgid "" "Such a socket should be constructed with ``socket(AF_INET, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv4 or ``socket(AF_INET6, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv6." msgstr "" -#: ../../library/socket.rst:237 +#: ../../library/socket.rst:242 msgid "" ":const:`AF_HYPERV` is a Windows-only socket based interface for " "communicating with Hyper-V hosts and guests. The address family is " @@ -420,49 +440,49 @@ msgid "" "``service_id`` are UUID strings." msgstr "" -#: ../../library/socket.rst:242 +#: ../../library/socket.rst:247 msgid "" "The ``vm_id`` is the virtual machine identifier or a set of known VMID " "values if the target is not a specific virtual machine. Known VMID constants " "defined on ``socket`` are:" msgstr "" -#: ../../library/socket.rst:246 +#: ../../library/socket.rst:251 msgid "``HV_GUID_ZERO``" msgstr "``HV_GUID_ZERO``" -#: ../../library/socket.rst:247 +#: ../../library/socket.rst:252 msgid "``HV_GUID_BROADCAST``" msgstr "``HV_GUID_BROADCAST``" -#: ../../library/socket.rst:248 +#: ../../library/socket.rst:253 msgid "" "``HV_GUID_WILDCARD`` - Used to bind on itself and accept connections from " "all partitions." msgstr "" -#: ../../library/socket.rst:250 +#: ../../library/socket.rst:255 msgid "" "``HV_GUID_CHILDREN`` - Used to bind on itself and accept connection from " "child partitions." msgstr "" -#: ../../library/socket.rst:252 +#: ../../library/socket.rst:257 msgid "``HV_GUID_LOOPBACK`` - Used as a target to itself." msgstr "" -#: ../../library/socket.rst:253 +#: ../../library/socket.rst:258 msgid "" "``HV_GUID_PARENT`` - When used as a bind accepts connection from the parent " "partition. When used as an address target it will connect to the parent " "partition." msgstr "" -#: ../../library/socket.rst:256 +#: ../../library/socket.rst:261 msgid "The ``service_id`` is the service identifier of the registered service." msgstr "" -#: ../../library/socket.rst:260 +#: ../../library/socket.rst:265 msgid "" "If you use a hostname in the *host* portion of IPv4/v6 socket address, the " "program may show a nondeterministic behavior, as Python uses the first " @@ -472,56 +492,57 @@ msgid "" "deterministic behavior use a numeric address in *host* portion." msgstr "" -#: ../../library/socket.rst:267 +#: ../../library/socket.rst:272 msgid "" "All errors raise exceptions. The normal exceptions for invalid argument " "types and out-of-memory conditions can be raised. Errors related to socket " "or address semantics raise :exc:`OSError` or one of its subclasses." msgstr "" -#: ../../library/socket.rst:272 +#: ../../library/socket.rst:277 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " -"generalization of this based on timeouts is supported through :meth:`~socket." -"settimeout`." +"generalization of this based on timeouts is supported " +"through :meth:`~socket.settimeout`." msgstr "" -#: ../../library/socket.rst:278 +#: ../../library/socket.rst:283 msgid "Module contents" msgstr "模組內容" -#: ../../library/socket.rst:280 +#: ../../library/socket.rst:285 msgid "The module :mod:`socket` exports the following elements." msgstr "" -#: ../../library/socket.rst:284 +#: ../../library/socket.rst:289 msgid "Exceptions" msgstr "例外" -#: ../../library/socket.rst:288 +#: ../../library/socket.rst:293 msgid "A deprecated alias of :exc:`OSError`." msgstr "一個已棄用的 :exc:`OSError` 的別名。" -#: ../../library/socket.rst:290 +#: ../../library/socket.rst:295 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:296 +#: ../../library/socket.rst:301 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " -"errors, i.e. for functions that use *h_errno* in the POSIX C API, including :" -"func:`gethostbyname_ex` and :func:`gethostbyaddr`. The accompanying value is " -"a pair ``(h_errno, string)`` representing an error returned by a library " -"call. *h_errno* is a numeric value, while *string* represents the " -"description of *h_errno*, as returned by the :c:func:`hstrerror` C function." +"errors, i.e. for functions that use *h_errno* in the POSIX C API, " +"including :func:`gethostbyname_ex` and :func:`gethostbyaddr`. The " +"accompanying value is a pair ``(h_errno, string)`` representing an error " +"returned by a library call. *h_errno* is a numeric value, while *string* " +"represents the description of *h_errno*, as returned by " +"the :c:func:`hstrerror` C function." msgstr "" -#: ../../library/socket.rst:304 ../../library/socket.rst:317 -#: ../../library/socket.rst:330 +#: ../../library/socket.rst:309 ../../library/socket.rst:322 +#: ../../library/socket.rst:335 msgid "This class was made a subclass of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:309 +#: ../../library/socket.rst:314 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying " @@ -531,34 +552,34 @@ msgid "" "match one of the :const:`!EAI_\\*` constants defined in this module." msgstr "" -#: ../../library/socket.rst:322 +#: ../../library/socket.rst:327 msgid "A deprecated alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:324 +#: ../../library/socket.rst:329 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " -"on a socket which has had timeouts enabled via a prior call to :meth:" -"`~socket.settimeout` (or implicitly through :func:`~socket." -"setdefaulttimeout`). The accompanying value is a string whose value is " -"currently always \"timed out\"." +"on a socket which has had timeouts enabled via a prior call " +"to :meth:`~socket.settimeout` (or implicitly " +"through :func:`~socket.setdefaulttimeout`). The accompanying value is a " +"string whose value is currently always \"timed out\"." msgstr "" -#: ../../library/socket.rst:333 +#: ../../library/socket.rst:338 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:338 +#: ../../library/socket.rst:343 msgid "Constants" msgstr "常數" -#: ../../library/socket.rst:340 +#: ../../library/socket.rst:345 msgid "" -"The AF_* and SOCK_* constants are now :class:`AddressFamily` and :class:" -"`SocketKind` :class:`.IntEnum` collections." +"The AF_* and SOCK_* constants are now :class:`AddressFamily` " +"and :class:`SocketKind` :class:`.IntEnum` collections." msgstr "" -#: ../../library/socket.rst:349 +#: ../../library/socket.rst:354 msgid "" "These constants represent the address (and protocol) families, used for the " "first argument to :func:`~socket.socket`. If the :const:`AF_UNIX` constant " @@ -566,79 +587,79 @@ msgid "" "available depending on the system." msgstr "" -#: ../../library/socket.rst:356 +#: ../../library/socket.rst:361 msgid "" ":const:`AF_UNSPEC` means that :func:`getaddrinfo` should return socket " "addresses for any address family (either IPv4, IPv6, or any other) that can " "be used." msgstr "" -#: ../../library/socket.rst:366 +#: ../../library/socket.rst:371 msgid "" -"These constants represent the socket types, used for the second argument to :" -"func:`~socket.socket`. More constants may be available depending on the " +"These constants represent the socket types, used for the second argument " +"to :func:`~socket.socket`. More constants may be available depending on the " "system. (Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be " "generally useful.)" msgstr "" -#: ../../library/socket.rst:374 +#: ../../library/socket.rst:379 msgid "" "These two constants, if defined, can be combined with the socket types and " "allow you to set some flags atomically (thus avoiding possible race " "conditions and the need for separate calls)." msgstr "" -#: ../../library/socket.rst:380 +#: ../../library/socket.rst:385 msgid "" -"`Secure File Descriptor Handling `_ for a more thorough explanation." +"`Secure File Descriptor Handling `_ for a more thorough explanation." msgstr "" -#: ../../library/socket.rst:404 +#: ../../library/socket.rst:409 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " -"are generally used in arguments to the :meth:`~socket.setsockopt` and :meth:" -"`~socket.getsockopt` methods of socket objects. In most cases, only those " -"symbols that are defined in the Unix header files are defined; for a few " -"symbols, default values are provided." +"are generally used in arguments to the :meth:`~socket.setsockopt` " +"and :meth:`~socket.getsockopt` methods of socket objects. In most cases, " +"only those symbols that are defined in the Unix header files are defined; " +"for a few symbols, default values are provided." msgstr "" -#: ../../library/socket.rst:411 +#: ../../library/socket.rst:416 msgid "" "``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, " "``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added." msgstr "" -#: ../../library/socket.rst:415 +#: ../../library/socket.rst:420 msgid "" "On Windows, ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:419 +#: ../../library/socket.rst:424 msgid "``TCP_NOTSENT_LOWAT`` was added." msgstr "新增 ``TCP_NOTSENT_LOWAT``。" -#: ../../library/socket.rst:422 +#: ../../library/socket.rst:427 msgid "" "On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:425 +#: ../../library/socket.rst:430 msgid "" "``IP_RECVTOS`` was added. Added ``TCP_KEEPALIVE``. On MacOS this constant " "can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux." msgstr "" -#: ../../library/socket.rst:430 +#: ../../library/socket.rst:435 msgid "" "Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the " "same way that ``TCP_INFO`` is used on Linux and BSD." msgstr "" -#: ../../library/socket.rst:434 +#: ../../library/socket.rst:439 msgid "" "Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD and FreeBSD " "respectively those constants can be used in the same way that ``SO_MARK`` is " @@ -654,133 +675,137 @@ msgid "" "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" -#: ../../library/socket.rst:448 +#: ../../library/socket.rst:453 msgid "" "Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " "way that ``SO_BINDTODEVICE`` is used, but with the index of a network " "interface instead of its name." msgstr "" -#: ../../library/socket.rst:458 ../../library/socket.rst:539 -#: ../../library/socket.rst:563 +#: ../../library/socket.rst:463 ../../library/socket.rst:547 +#: ../../library/socket.rst:571 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:465 +#: ../../library/socket.rst:470 msgid "NetBSD support was added." msgstr "" -#: ../../library/socket.rst:471 +#: ../../library/socket.rst:473 +msgid "Restored missing ``CAN_RAW_ERR_FILTER`` on Linux." +msgstr "" + +#: ../../library/socket.rst:479 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:478 +#: ../../library/socket.rst:486 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: ../../library/socket.rst:484 +#: ../../library/socket.rst:492 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: ../../library/socket.rst:488 ../../library/socket.rst:499 +#: ../../library/socket.rst:496 ../../library/socket.rst:507 msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:496 +#: ../../library/socket.rst:504 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:507 +#: ../../library/socket.rst:515 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:516 +#: ../../library/socket.rst:524 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:527 +#: ../../library/socket.rst:535 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:547 +#: ../../library/socket.rst:555 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" -#: ../../library/socket.rst:551 +#: ../../library/socket.rst:559 msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: ../../library/socket.rst:576 +#: ../../library/socket.rst:584 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:579 ../../library/socket.rst:1604 +#: ../../library/socket.rst:587 ../../library/socket.rst:1611 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" -#: ../../library/socket.rst:585 +#: ../../library/socket.rst:593 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: ../../library/socket.rst:592 +#: ../../library/socket.rst:600 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: ../../library/socket.rst:604 +#: ../../library/socket.rst:612 msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:618 +#: ../../library/socket.rst:626 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: ../../library/socket.rst:624 +#: ../../library/socket.rst:632 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: ../../library/socket.rst:633 +#: ../../library/socket.rst:641 msgid "" -"For use with :const:`BTPROTO_HCI`. :const:`HCI_FILTER` is not available for " -"NetBSD or DragonFlyBSD. :const:`HCI_TIME_STAMP` and :const:`HCI_DATA_DIR` " -"are not available for FreeBSD, NetBSD, or DragonFlyBSD." +"For use with :const:`BTPROTO_HCI`. :const:`!HCI_FILTER` is only available on " +"Linux and FreeBSD. :const:`!HCI_TIME_STAMP` and :const:`!HCI_DATA_DIR` are " +"only available on Linux." msgstr "" -#: ../../library/socket.rst:640 +#: ../../library/socket.rst:647 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: ../../library/socket.rst:649 +#: ../../library/socket.rst:656 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -789,71 +814,71 @@ msgid "" "message type." msgstr "" -#: ../../library/socket.rst:662 +#: ../../library/socket.rst:669 msgid "" -"Constant to optimize CPU locality, to be used in conjunction with :data:" -"`SO_REUSEPORT`." +"Constant to optimize CPU locality, to be used in conjunction " +"with :data:`SO_REUSEPORT`." msgstr "" -#: ../../library/socket.rst:682 +#: ../../library/socket.rst:689 msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: ../../library/socket.rst:695 +#: ../../library/socket.rst:702 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: ../../library/socket.rst:707 +#: ../../library/socket.rst:714 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " "socket objects." msgstr "" -#: ../../library/socket.rst:712 +#: ../../library/socket.rst:719 msgid "Functions" msgstr "函式" -#: ../../library/socket.rst:715 +#: ../../library/socket.rst:722 msgid "Creating sockets" msgstr "建立 sockets" -#: ../../library/socket.rst:717 +#: ../../library/socket.rst:724 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: ../../library/socket.rst:722 +#: ../../library/socket.rst:729 msgid "" "Create a new socket using the given address family, socket type and protocol " -"number. The address family should be :const:`AF_INET` (the default), :const:" -"`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, or :const:" -"`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the default), :" -"const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_`` " -"constants. The protocol number is usually zero and may be omitted or in the " -"case where the address family is :const:`AF_CAN` the protocol should be one " -"of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` or :const:" -"`CAN_J1939`." +"number. The address family should be :const:`AF_INET` (the " +"default), :const:`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, " +"or :const:`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the " +"default), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other " +"``SOCK_`` constants. The protocol number is usually zero and may be omitted " +"or in the case where the address family is :const:`AF_CAN` the protocol " +"should be one of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` " +"or :const:`CAN_J1939`." msgstr "" -#: ../../library/socket.rst:732 +#: ../../library/socket.rst:739 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " "overruled by calling the function with explicit *family*, *type*, or *proto* " "arguments. This only affects how Python represents e.g. the return value " -"of :meth:`socket.getpeername` but not the actual OS resource. Unlike :func:" -"`socket.fromfd`, *fileno* will return the same socket and not a duplicate. " -"This may help close a detached socket using :meth:`socket.close`." +"of :meth:`socket.getpeername` but not the actual OS resource. " +"Unlike :func:`socket.fromfd`, *fileno* will return the same socket and not a " +"duplicate. This may help close a detached socket using :meth:`socket.close`." msgstr "" -#: ../../library/socket.rst:741 ../../library/socket.rst:887 -#: ../../library/socket.rst:1423 ../../library/socket.rst:1517 +#: ../../library/socket.rst:748 ../../library/socket.rst:894 +#: ../../library/socket.rst:1430 ../../library/socket.rst:1524 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:743 +#: ../../library/socket.rst:750 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." @@ -861,30 +886,30 @@ msgstr "" "引發一個附帶引數 ``self``、``family``、``type``、``protocol`` 的\\ :ref:`稽核" "事件 ` ``socket.__new__``。" -#: ../../library/socket.rst:745 +#: ../../library/socket.rst:752 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: ../../library/socket.rst:749 +#: ../../library/socket.rst:756 msgid "The CAN_BCM protocol was added." msgstr "新增 CAN_BCM 協定。" -#: ../../library/socket.rst:752 ../../library/socket.rst:889 +#: ../../library/socket.rst:759 ../../library/socket.rst:896 msgid "The returned socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:755 +#: ../../library/socket.rst:762 msgid "The CAN_ISOTP protocol was added." msgstr "新增 CAN_ISOTP 協定。" -#: ../../library/socket.rst:758 +#: ../../library/socket.rst:765 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" -#: ../../library/socket.rst:766 +#: ../../library/socket.rst:773 msgid "" "sock = socket.socket(\n" " socket.AF_INET,\n" @@ -894,21 +919,21 @@ msgstr "" " socket.AF_INET,\n" " socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" -#: ../../library/socket.rst:770 +#: ../../library/socket.rst:777 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: ../../library/socket.rst:774 +#: ../../library/socket.rst:781 msgid "The CAN_J1939 protocol was added." msgstr "新增 CAN_J1939 協定。" -#: ../../library/socket.rst:777 +#: ../../library/socket.rst:784 msgid "The IPPROTO_MPTCP protocol was added." msgstr "新增 IPPROTO_MPTCP 協定。" -#: ../../library/socket.rst:782 +#: ../../library/socket.rst:789 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -917,25 +942,25 @@ msgid "" "default is :const:`AF_INET`." msgstr "" -#: ../../library/socket.rst:787 +#: ../../library/socket.rst:794 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:789 +#: ../../library/socket.rst:796 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: ../../library/socket.rst:793 +#: ../../library/socket.rst:800 msgid "The returned sockets are now non-inheritable." msgstr "" -#: ../../library/socket.rst:796 +#: ../../library/socket.rst:803 msgid "Windows support added." msgstr "新增對 Windows 的支援。" -#: ../../library/socket.rst:802 +#: ../../library/socket.rst:809 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -946,21 +971,21 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:810 +#: ../../library/socket.rst:817 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: ../../library/socket.rst:815 +#: ../../library/socket.rst:822 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: ../../library/socket.rst:819 +#: ../../library/socket.rst:826 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " @@ -968,42 +993,42 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:824 +#: ../../library/socket.rst:831 msgid "*source_address* was added." msgstr "新增 *source_address*。" -#: ../../library/socket.rst:827 +#: ../../library/socket.rst:834 msgid "*all_errors* was added." msgstr "新增 *all_errors*。" -#: ../../library/socket.rst:833 +#: ../../library/socket.rst:840 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" -#: ../../library/socket.rst:836 +#: ../../library/socket.rst:843 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " -"reasonable value is chosen. *reuse_port* dictates whether to set the :data:" -"`SO_REUSEPORT` socket option." +"reasonable value is chosen. *reuse_port* dictates whether to set " +"the :data:`SO_REUSEPORT` socket option." msgstr "" -#: ../../library/socket.rst:841 +#: ../../library/socket.rst:848 msgid "" -"If *dualstack_ipv6* is true and the platform supports it the socket will be " -"able to accept both IPv4 and IPv6 connections, else it will raise :exc:" -"`ValueError`. Most POSIX platforms and Windows are supposed to support this " -"functionality. When this functionality is enabled the address returned by :" -"meth:`socket.getpeername` when an IPv4 connection occurs will be an IPv6 " -"address represented as an IPv4-mapped IPv6 address. If *dualstack_ipv6* is " -"false it will explicitly disable this functionality on platforms that enable " -"it by default (e.g. Linux). This parameter can be used in conjunction with :" -"func:`has_dualstack_ipv6`:" +"If *dualstack_ipv6* is true, *family* is :data:`AF_INET6` and the platform " +"supports it the socket will be able to accept both IPv4 and IPv6 " +"connections, else it will raise :exc:`ValueError`. Most POSIX platforms and " +"Windows are supposed to support this functionality. When this functionality " +"is enabled the address returned by :meth:`socket.getpeername` when an IPv4 " +"connection occurs will be an IPv6 address represented as an IPv4-mapped IPv6 " +"address. If *dualstack_ipv6* is false it will explicitly disable this " +"functionality on platforms that enable it by default (e.g. Linux). This " +"parameter can be used in conjunction with :func:`has_dualstack_ipv6`:" msgstr "" -#: ../../library/socket.rst:854 +#: ../../library/socket.rst:861 msgid "" "import socket\n" "\n" @@ -1023,65 +1048,65 @@ msgstr "" "else:\n" " s = socket.create_server(addr)" -#: ../../library/socket.rst:863 +#: ../../library/socket.rst:870 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: ../../library/socket.rst:871 +#: ../../library/socket.rst:878 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: ../../library/socket.rst:878 +#: ../../library/socket.rst:885 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " -"the result. Address family, socket type and protocol number are as for the :" -"func:`~socket.socket` function above. The file descriptor should refer to a " -"socket, but this is not checked --- subsequent operations on the object may " -"fail if the file descriptor is invalid. This function is rarely needed, but " -"can be used to get or set socket options on a socket passed to a program as " -"standard input or output (such as a server started by the Unix inet " +"the result. Address family, socket type and protocol number are as for " +"the :func:`~socket.socket` function above. The file descriptor should refer " +"to a socket, but this is not checked --- subsequent operations on the object " +"may fail if the file descriptor is invalid. This function is rarely needed, " +"but can be used to get or set socket options on a socket passed to a program " +"as standard input or output (such as a server started by the Unix inet " "daemon). The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:895 +#: ../../library/socket.rst:902 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:905 +#: ../../library/socket.rst:912 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: ../../library/socket.rst:910 +#: ../../library/socket.rst:917 msgid "Other functions" msgstr "其他函式" -#: ../../library/socket.rst:912 +#: ../../library/socket.rst:919 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: ../../library/socket.rst:917 +#: ../../library/socket.rst:924 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:925 +#: ../../library/socket.rst:932 msgid "" "This function wraps the C function ``getaddrinfo`` of the underlying system." msgstr "" -#: ../../library/socket.rst:927 +#: ../../library/socket.rst:934 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1091,7 +1116,7 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:934 +#: ../../library/socket.rst:941 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to provide options and limit the list of addresses returned. Pass " @@ -1099,35 +1124,36 @@ msgid "" "limit the results. See the note below for details." msgstr "" -#: ../../library/socket.rst:939 +#: ../../library/socket.rst:946 msgid "" "The *flags* argument can be one or several of the ``AI_*`` constants, and " -"will influence how results are computed and returned. For example, :const:" -"`AI_NUMERICHOST` will disable domain name resolution and will raise an error " -"if *host* is a domain name." +"will influence how results are computed and returned. For " +"example, :const:`AI_NUMERICHOST` will disable domain name resolution and " +"will raise an error if *host* is a domain name." msgstr "" -#: ../../library/socket.rst:944 +#: ../../library/socket.rst:951 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:946 +#: ../../library/socket.rst:953 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:948 +#: ../../library/socket.rst:955 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " -"string representing the canonical name of the *host* if :const:" -"`AI_CANONNAME` is part of the *flags* argument; else *canonname* will be " -"empty. *sockaddr* is a tuple describing a socket address, whose format " -"depends on the returned *family* (a ``(address, port)`` 2-tuple for :const:" -"`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple for :const:" -"`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." +"string representing the canonical name of the *host* " +"if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* " +"will be empty. *sockaddr* is a tuple describing a socket address, whose " +"format depends on the returned *family* (a ``(address, port)`` 2-tuple " +"for :const:`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple " +"for :const:`AF_INET6`), and is meant to be passed to " +"the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:960 +#: ../../library/socket.rst:967 msgid "" "If you intend to use results from :func:`!getaddrinfo` to create a socket " "(rather than, for example, retrieve *canonname*), consider limiting the " @@ -1136,13 +1162,13 @@ msgid "" "application can handle." msgstr "" -#: ../../library/socket.rst:966 +#: ../../library/socket.rst:973 msgid "" "The behavior with default values of *family*, *type*, *proto* and *flags* is " "system-specific." msgstr "" -#: ../../library/socket.rst:969 +#: ../../library/socket.rst:976 msgid "" "Many systems (for example, most Linux configurations) will return a sorted " "list of all matching addresses. These addresses should generally be tried in " @@ -1152,14 +1178,14 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:976 +#: ../../library/socket.rst:983 msgid "" "Some systems will, however, only return a single address. (For example, this " "was reported on Solaris and AIX configurations.) On these systems, limiting " "the *type* and/or *proto* helps ensure that this address is usable." msgstr "" -#: ../../library/socket.rst:981 +#: ../../library/socket.rst:988 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." @@ -1167,14 +1193,14 @@ msgstr "" "引發一個附帶引數 ``host``、``port``、``family``、``type``、``protocol`` 的" "\\ :ref:`稽核事件 ` ``socket.getaddrinfo``。" -#: ../../library/socket.rst:983 +#: ../../library/socket.rst:990 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:987 +#: ../../library/socket.rst:994 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1188,17 +1214,17 @@ msgstr "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" -#: ../../library/socket.rst:993 +#: ../../library/socket.rst:1000 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:996 +#: ../../library/socket.rst:1003 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:1004 +#: ../../library/socket.rst:1011 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1209,7 +1235,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:1015 +#: ../../library/socket.rst:1022 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1219,15 +1245,15 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1021 ../../library/socket.rst:1037 +#: ../../library/socket.rst:1028 ../../library/socket.rst:1044 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." msgstr "" -"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` ``socket." -"gethostbyname``。" +"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` " +"``socket.gethostbyname``。" -#: ../../library/socket.rst:1028 +#: ../../library/socket.rst:1035 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1239,45 +1265,45 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1044 +#: ../../library/socket.rst:1051 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:1047 +#: ../../library/socket.rst:1054 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``socket.gethostname``。" -#: ../../library/socket.rst:1049 +#: ../../library/socket.rst:1056 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:1057 +#: ../../library/socket.rst:1064 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " "(possibly empty) list of alternative host names for the same address, and " "*ipaddrlist* is a list of IPv4/v6 addresses for the same interface on the " "same host (most likely containing only a single address). To find the fully " -"qualified domain name, use the function :func:`getfqdn`. :func:" -"`gethostbyaddr` supports both IPv4 and IPv6." +"qualified domain name, use the " +"function :func:`getfqdn`. :func:`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:1065 +#: ../../library/socket.rst:1072 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." msgstr "" -"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` ``socket." -"gethostbyaddr``。" +"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` " +"``socket.gethostbyaddr``。" -#: ../../library/socket.rst:1072 +#: ../../library/socket.rst:1079 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1285,42 +1311,43 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:1077 +#: ../../library/socket.rst:1084 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:1080 +#: ../../library/socket.rst:1087 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:1082 +#: ../../library/socket.rst:1089 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." msgstr "" -"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` ``socket." -"getnameinfo``。" +"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` " +"``socket.getnameinfo``。" -#: ../../library/socket.rst:1089 +#: ../../library/socket.rst:1096 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " -"suitable for passing as the (optional) third argument to the :func:`~socket." -"socket` function. This is usually only needed for sockets opened in \"raw\" " -"mode (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol " -"is chosen automatically if the protocol is omitted or zero." +"suitable for passing as the (optional) third argument to " +"the :func:`~socket.socket` function. This is usually only needed for " +"sockets opened in \"raw\" mode (:const:`SOCK_RAW`); for the normal socket " +"modes, the correct protocol is chosen automatically if the protocol is " +"omitted or zero." msgstr "" -#: ../../library/socket.rst:1100 +#: ../../library/socket.rst:1107 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1104 +#: ../../library/socket.rst:1111 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." @@ -1328,14 +1355,14 @@ msgstr "" "引發一個附帶引數 ``sockaddr``、``protocolname`` 的\\ :ref:`稽核事件 " "` ``socket.getservbyname``。" -#: ../../library/socket.rst:1111 +#: ../../library/socket.rst:1118 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1115 +#: ../../library/socket.rst:1122 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." @@ -1343,40 +1370,40 @@ msgstr "" "引發一個附帶引數 ``port``、``protocolname`` 的\\ :ref:`稽核事件 ` " "``socket.getservbyport``。" -#: ../../library/socket.rst:1122 +#: ../../library/socket.rst:1129 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1129 +#: ../../library/socket.rst:1136 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1133 ../../library/socket.rst:1151 +#: ../../library/socket.rst:1140 ../../library/socket.rst:1158 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:1140 +#: ../../library/socket.rst:1147 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1147 +#: ../../library/socket.rst:1154 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1158 +#: ../../library/socket.rst:1165 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1385,26 +1412,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:1164 +#: ../../library/socket.rst:1171 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:1167 +#: ../../library/socket.rst:1174 msgid "" -"If the IPv4 address string passed to this function is invalid, :exc:" -"`OSError` will be raised. Note that exactly what is valid depends on the " -"underlying C implementation of :c:func:`inet_aton`." +"If the IPv4 address string passed to this function is " +"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " +"depends on the underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:1171 +#: ../../library/socket.rst:1178 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:1177 +#: ../../library/socket.rst:1184 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1414,7 +1441,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:1184 +#: ../../library/socket.rst:1191 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1422,28 +1449,28 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:1195 +#: ../../library/socket.rst:1202 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " -"protocol calls for an object of type :c:struct:`in_addr` (similar to :func:" -"`inet_aton`) or :c:struct:`in6_addr`." +"protocol calls for an object of type :c:struct:`in_addr` (similar " +"to :func:`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1200 +#: ../../library/socket.rst:1207 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" -"`OSError` will be raised. Note that exactly what is valid depends on both " -"the value of *address_family* and the underlying implementation of :c:func:" -"`inet_pton`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the IP address string *ip_string* is " +"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " +"depends on both the value of *address_family* and the underlying " +"implementation of :c:func:`inet_pton`." msgstr "" -#: ../../library/socket.rst:1208 ../../library/socket.rst:1228 +#: ../../library/socket.rst:1215 ../../library/socket.rst:1235 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1214 +#: ../../library/socket.rst:1221 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1452,31 +1479,32 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1221 +#: ../../library/socket.rst:1228 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " -"for the specified address family, :exc:`ValueError` will be raised. :exc:" -"`OSError` is raised for errors from the call to :func:`inet_ntop`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the bytes object *packed_ip* is not the correct " +"length for the specified address family, :exc:`ValueError` will be " +"raised. :exc:`OSError` is raised for errors from the call " +"to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1243 +#: ../../library/socket.rst:1250 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " "the buffer size for :meth:`~socket.recvmsg` to receive a single item of " -"ancillary data, but :rfc:`3542` requires portable applications to use :func:" -"`CMSG_SPACE` and thus include space for padding, even when the item will be " -"the last in the buffer. Raises :exc:`OverflowError` if *length* is outside " -"the permissible range of values." +"ancillary data, but :rfc:`3542` requires portable applications to " +"use :func:`CMSG_SPACE` and thus include space for padding, even when the " +"item will be the last in the buffer. Raises :exc:`OverflowError` if " +"*length* is outside the permissible range of values." msgstr "" -#: ../../library/socket.rst:1254 ../../library/socket.rst:1746 -#: ../../library/socket.rst:1790 ../../library/socket.rst:1898 +#: ../../library/socket.rst:1261 ../../library/socket.rst:1748 +#: ../../library/socket.rst:1792 ../../library/socket.rst:1900 msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1261 +#: ../../library/socket.rst:1268 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1486,7 +1514,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1269 +#: ../../library/socket.rst:1276 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1494,134 +1522,136 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1277 +#: ../../library/socket.rst:1284 msgid "most Unix platforms." msgstr "" -#: ../../library/socket.rst:1284 +#: ../../library/socket.rst:1291 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1291 +#: ../../library/socket.rst:1298 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " -"socket module is first imported, the default is ``None``. See :meth:" -"`~socket.settimeout` for possible values and their respective meanings." +"socket module is first imported, the default is ``None``. " +"See :meth:`~socket.settimeout` for possible values and their respective " +"meanings." msgstr "" -#: ../../library/socket.rst:1299 +#: ../../library/socket.rst:1306 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1302 +#: ../../library/socket.rst:1309 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." msgstr "" -"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." -"sethostname``。" +"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` " +"``socket.sethostname``。" -#: ../../library/socket.rst:1311 +#: ../../library/socket.rst:1318 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1319 ../../library/socket.rst:1346 -#: ../../library/socket.rst:1363 +#: ../../library/socket.rst:1326 ../../library/socket.rst:1353 +#: ../../library/socket.rst:1370 msgid "Windows support was added." msgstr "增加對 Windows 的支援。" -#: ../../library/socket.rst:1324 +#: ../../library/socket.rst:1331 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1327 +#: ../../library/socket.rst:1334 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1328 +#: ../../library/socket.rst:1335 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1329 +#: ../../library/socket.rst:1336 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1330 +#: ../../library/socket.rst:1337 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1332 +#: ../../library/socket.rst:1339 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1338 +#: ../../library/socket.rst:1345 msgid "" -"Return a network interface index number corresponding to an interface name. :" -"exc:`OSError` if no interface with the given name exists." +"Return a network interface index number corresponding to an interface " +"name. :exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1350 ../../library/socket.rst:1367 +#: ../../library/socket.rst:1357 ../../library/socket.rst:1374 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1355 +#: ../../library/socket.rst:1362 msgid "" -"Return a network interface name corresponding to an interface index number. :" -"exc:`OSError` if no interface with the given index exists." +"Return a network interface name corresponding to an interface index " +"number. :exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1372 +#: ../../library/socket.rst:1379 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " -"*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" -"`~socket.sendmsg` for the documentation of these parameters." +"*sock*. The *fds* parameter is a sequence of file descriptors. " +"Consult :meth:`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1378 ../../library/socket.rst:1392 +#: ../../library/socket.rst:1385 ../../library/socket.rst:1399 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1386 +#: ../../library/socket.rst:1393 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " -"*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." -"recvmsg` for the documentation of these parameters." +"*sock*. Return ``(msg, list(fds), flags, addr)``. " +"Consult :meth:`~socket.recvmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1399 +#: ../../library/socket.rst:1406 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1405 +#: ../../library/socket.rst:1412 msgid "Socket Objects" msgstr "Socket 物件" -#: ../../library/socket.rst:1407 +#: ../../library/socket.rst:1414 msgid "" -"Socket objects have the following methods. Except for :meth:`~socket." -"makefile`, these correspond to Unix system calls applicable to sockets." +"Socket objects have the following methods. Except " +"for :meth:`~socket.makefile`, these correspond to Unix system calls " +"applicable to sockets." msgstr "" -#: ../../library/socket.rst:1411 +#: ../../library/socket.rst:1418 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1418 +#: ../../library/socket.rst:1425 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1630,27 +1660,27 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1425 ../../library/socket.rst:1519 +#: ../../library/socket.rst:1432 ../../library/socket.rst:1526 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1428 ../../library/socket.rst:1659 -#: ../../library/socket.rst:1673 ../../library/socket.rst:1750 -#: ../../library/socket.rst:1823 ../../library/socket.rst:1842 -#: ../../library/socket.rst:1859 ../../library/socket.rst:1904 +#: ../../library/socket.rst:1435 ../../library/socket.rst:1661 +#: ../../library/socket.rst:1675 ../../library/socket.rst:1752 +#: ../../library/socket.rst:1825 ../../library/socket.rst:1844 +#: ../../library/socket.rst:1861 ../../library/socket.rst:1906 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the method now retries the system call instead of raising an :exc:" -"`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the method now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1436 +#: ../../library/socket.rst:1443 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1439 +#: ../../library/socket.rst:1446 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." @@ -1658,7 +1688,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.bind``。" -#: ../../library/socket.rst:1446 +#: ../../library/socket.rst:1453 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -1667,43 +1697,43 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1452 +#: ../../library/socket.rst:1459 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1456 +#: ../../library/socket.rst:1463 msgid "" -":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" -"`close` call is made." +":exc:`OSError` is now raised if an error occurs when the " +"underlying :c:func:`close` call is made." msgstr "" -#: ../../library/socket.rst:1462 +#: ../../library/socket.rst:1469 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: ../../library/socket.rst:1470 +#: ../../library/socket.rst:1477 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1473 +#: ../../library/socket.rst:1480 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " "signal handler doesn't raise an exception and the socket is blocking or has " -"a timeout. For non-blocking sockets, the method raises an :exc:" -"`InterruptedError` exception if the connection is interrupted by a signal " -"(or the exception raised by the signal handler)." +"a timeout. For non-blocking sockets, the method raises " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " +"signal (or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1480 ../../library/socket.rst:1500 +#: ../../library/socket.rst:1487 ../../library/socket.rst:1507 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." @@ -1711,15 +1741,15 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.connect``。" -#: ../../library/socket.rst:1482 +#: ../../library/socket.rst:1489 msgid "" -"The method now waits until the connection completes instead of raising an :" -"exc:`InterruptedError` exception if the connection is interrupted by a " +"The method now waits until the connection completes instead of raising " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " "signal, the signal handler doesn't raise an exception and the socket is " "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1493 +#: ../../library/socket.rst:1500 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1729,38 +1759,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1506 +#: ../../library/socket.rst:1513 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1515 +#: ../../library/socket.rst:1522 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1527 +#: ../../library/socket.rst:1534 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1530 +#: ../../library/socket.rst:1537 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1536 +#: ../../library/socket.rst:1543 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1545 +#: ../../library/socket.rst:1552 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1768,70 +1798,71 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1553 +#: ../../library/socket.rst:1560 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1560 +#: ../../library/socket.rst:1567 msgid "" -"Return the value of the given socket option (see the Unix man page :manpage:" -"`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `) are defined in this module. If *buflen* is absent, an " -"integer option is assumed and its integer value is returned by the " -"function. If *buflen* is present, it specifies the maximum length of the " -"buffer used to receive the option in, and this buffer is returned as a bytes " -"object. It is up to the caller to decode the contents of the buffer (see " -"the optional built-in module :mod:`struct` for a way to decode C structures " -"encoded as byte strings)." +"Return the value of the given socket option (see the Unix man " +"page :manpage:`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* " +"etc. `) are defined in this module. If *buflen* is " +"absent, an integer option is assumed and its integer value is returned by " +"the function. If *buflen* is present, it specifies the maximum length of " +"the buffer used to receive the option in, and this buffer is returned as a " +"bytes object. It is up to the caller to decode the contents of the buffer " +"(see the optional built-in module :mod:`struct` for a way to decode C " +"structures encoded as byte strings)." msgstr "" -#: ../../library/socket.rst:1574 +#: ../../library/socket.rst:1581 msgid "" "Return ``True`` if socket is in blocking mode, ``False`` if in non-blocking." msgstr "" -#: ../../library/socket.rst:1577 +#: ../../library/socket.rst:1584 msgid "This is equivalent to checking ``socket.gettimeout() != 0``." msgstr "這等同於檢查 ``socket.gettimeout() != 0``。" -#: ../../library/socket.rst:1584 +#: ../../library/socket.rst:1591 msgid "" "Return the timeout in seconds (float) associated with socket operations, or " -"``None`` if no timeout is set. This reflects the last call to :meth:" -"`setblocking` or :meth:`settimeout`." +"``None`` if no timeout is set. This reflects the last call " +"to :meth:`setblocking` or :meth:`settimeout`." msgstr "" #: ../../library/socket.rst:0 msgid "platform" msgstr "平台" -#: ../../library/socket.rst:1591 +#: ../../library/socket.rst:1598 msgid "Windows" msgstr "Windows" -#: ../../library/socket.rst:1593 +#: ../../library/socket.rst:1600 msgid "" "The :meth:`ioctl` method is a limited interface to the WSAIoctl system " -"interface. Please refer to the `Win32 documentation `_ for more information." +"interface. Please refer to the `Win32 documentation `_ for more " +"information." msgstr "" -#: ../../library/socket.rst:1598 +#: ../../library/socket.rst:1605 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: ../../library/socket.rst:1601 +#: ../../library/socket.rst:1608 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: ../../library/socket.rst:1609 +#: ../../library/socket.rst:1616 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1839,11 +1870,11 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: ../../library/socket.rst:1616 +#: ../../library/socket.rst:1623 msgid "The *backlog* parameter is now optional." msgstr "" -#: ../../library/socket.rst:1625 +#: ../../library/socket.rst:1632 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -1852,44 +1883,38 @@ msgid "" "``'b'``, or a combination of those." msgstr "" -#: ../../library/socket.rst:1631 +#: ../../library/socket.rst:1638 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: ../../library/socket.rst:1635 +#: ../../library/socket.rst:1642 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " -"original socket unless all other file objects have been closed and :meth:" -"`socket.close` has been called on the socket object." +"original socket unless all other file objects have been closed " +"and :meth:`socket.close` has been called on the socket object." msgstr "" -#: ../../library/socket.rst:1641 +#: ../../library/socket.rst:1648 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: ../../library/socket.rst:1648 +#: ../../library/socket.rst:1655 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " "at once is specified by *bufsize*. A returned empty bytes object indicates " -"that the client has disconnected. See the Unix manual page :manpage:" -"`recv(2)` for the meaning of the optional argument *flags*; it defaults to " -"zero." +"that the client has disconnected. See the Unix manual " +"page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it " +"defaults to zero." msgstr "" -#: ../../library/socket.rst:1656 -msgid "" -"For best match with hardware and network realities, the value of *bufsize* " -"should be a relatively small power of 2, for example, 4096." -msgstr "" - -#: ../../library/socket.rst:1667 +#: ../../library/socket.rst:1669 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1899,14 +1924,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1678 +#: ../../library/socket.rst:1680 msgid "" "For multicast IPv6 address, first item of *address* does not contain " -"``%scope_id`` part anymore. In order to get full IPv6 address use :func:" -"`getnameinfo`." +"``%scope_id`` part anymore. In order to get full IPv6 address " +"use :func:`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1685 +#: ../../library/socket.rst:1687 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1917,7 +1942,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1695 +#: ../../library/socket.rst:1697 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1932,38 +1957,39 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1709 +#: ../../library/socket.rst:1711 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " "this facility is used (it is often restricted to :const:`SOCK_STREAM` " "sockets), :meth:`recvmsg` will return, in its ancillary data, items of the " -"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is a :" -"class:`bytes` object representing the new file descriptors as a binary array " -"of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an exception " -"after the system call returns, it will first attempt to close any file " -"descriptors received via this mechanism." +"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is " +"a :class:`bytes` object representing the new file descriptors as a binary " +"array of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an " +"exception after the system call returns, it will first attempt to close any " +"file descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1720 +#: ../../library/socket.rst:1722 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " -"beyond the end of the buffer, :meth:`recvmsg` will issue a :exc:" -"`RuntimeWarning`, and will return the part of it which is inside the buffer " -"provided it has not been truncated before the start of its associated data." +"beyond the end of the buffer, :meth:`recvmsg` will issue " +"a :exc:`RuntimeWarning`, and will return the part of it which is inside the " +"buffer provided it has not been truncated before the start of its associated " +"data." msgstr "" -#: ../../library/socket.rst:1727 +#: ../../library/socket.rst:1729 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " "data and a list containing the descriptors (while ignoring unexpected " -"conditions such as unrelated control messages being received). See also :" -"meth:`sendmsg`. ::" +"conditions such as unrelated control messages being received). See " +"also :meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1733 +#: ../../library/socket.rst:1735 msgid "" "import socket, array\n" "\n" @@ -1972,28 +1998,29 @@ msgid "" " msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds " "* fds.itemsize))\n" " for cmsg_level, cmsg_type, cmsg_data in ancdata:\n" -" if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket." -"SCM_RIGHTS:\n" +" if cmsg_level == socket.SOL_SOCKET and cmsg_type == " +"socket.SCM_RIGHTS:\n" " # Append data, ignoring any truncated integers at the end.\n" -" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds." -"itemsize)])\n" +" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % " +"fds.itemsize)])\n" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1758 +#: ../../library/socket.rst:1760 msgid "" -"Receive normal data and ancillary data from the socket, behaving as :meth:" -"`recvmsg` would, but scatter the non-ancillary data into a series of buffers " -"instead of returning a new bytes object. The *buffers* argument must be an " -"iterable of objects that export writable buffers (e.g. :class:`bytearray` " -"objects); these will be filled with successive chunks of the non-ancillary " -"data until it has all been written or there are no more buffers. The " -"operating system may set a limit (:func:`~os.sysconf` value ``SC_IOV_MAX``) " -"on the number of buffers that can be used. The *ancbufsize* and *flags* " -"arguments have the same meaning as for :meth:`recvmsg`." +"Receive normal data and ancillary data from the socket, behaving " +"as :meth:`recvmsg` would, but scatter the non-ancillary data into a series " +"of buffers instead of returning a new bytes object. The *buffers* argument " +"must be an iterable of objects that export writable buffers " +"(e.g. :class:`bytearray` objects); these will be filled with successive " +"chunks of the non-ancillary data until it has all been written or there are " +"no more buffers. The operating system may set a limit (:func:`~os.sysconf` " +"value ``SC_IOV_MAX``) on the number of buffers that can be used. The " +"*ancbufsize* and *flags* arguments have the same meaning as " +"for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1769 +#: ../../library/socket.rst:1771 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -2001,11 +2028,11 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1774 +#: ../../library/socket.rst:1776 msgid "Example::" msgstr "範例: ::" -#: ../../library/socket.rst:1776 +#: ../../library/socket.rst:1778 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2031,7 +2058,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1797 +#: ../../library/socket.rst:1799 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -2041,7 +2068,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1807 +#: ../../library/socket.rst:1809 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2050,7 +2077,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1816 +#: ../../library/socket.rst:1818 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2060,7 +2087,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1831 +#: ../../library/socket.rst:1833 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2070,13 +2097,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1838 +#: ../../library/socket.rst:1840 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1851 +#: ../../library/socket.rst:1853 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2085,7 +2112,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1857 +#: ../../library/socket.rst:1859 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2093,13 +2120,13 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendto``。" -#: ../../library/socket.rst:1867 +#: ../../library/socket.rst:1869 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " -"The *buffers* argument specifies the non-ancillary data as an iterable of :" -"term:`bytes-like objects ` (e.g. :class:`bytes` objects); " -"the operating system may set a limit (:func:`~os.sysconf` value " +"The *buffers* argument specifies the non-ancillary data as an iterable " +"of :term:`bytes-like objects ` (e.g. :class:`bytes` " +"objects); the operating system may set a limit (:func:`~os.sysconf` value " "``SC_IOV_MAX``) on the number of buffers that can be used. The *ancdata* " "argument specifies the ancillary data (control messages) as an iterable of " "zero or more tuples ``(cmsg_level, cmsg_type, cmsg_data)``, where " @@ -2113,28 +2140,28 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1887 +#: ../../library/socket.rst:1889 msgid "" -"The following function sends the list of file descriptors *fds* over an :" -"const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " +"The following function sends the list of file descriptors *fds* over " +"an :const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1891 +#: ../../library/socket.rst:1893 msgid "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." -"array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " +"array.array(\"i\", fds))])" msgstr "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." -"array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " +"array.array(\"i\", fds))])" -#: ../../library/socket.rst:1900 +#: ../../library/socket.rst:1902 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2142,158 +2169,161 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1911 +#: ../../library/socket.rst:1913 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1920 +#: ../../library/socket.rst:1922 msgid "" -"Send a file until EOF is reached by using high-performance :mod:`os." -"sendfile` and return the total number of bytes which were sent. *file* must " -"be a regular file object opened in binary mode. If :mod:`os.sendfile` is not " -"available (e.g. Windows) or *file* is not a regular file :meth:`send` will " -"be used instead. *offset* tells from where to start reading the file. If " -"specified, *count* is the total number of bytes to transmit as opposed to " -"sending the file until EOF is reached. File position is updated on return or " -"also in case of error in which case :meth:`file.tell() ` can " -"be used to figure out the number of bytes which were sent. The socket must " -"be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." +"Send a file until EOF is reached by using high-" +"performance :mod:`os.sendfile` and return the total number of bytes which " +"were sent. *file* must be a regular file object opened in binary mode. " +"If :mod:`os.sendfile` is not available (e.g. Windows) or *file* is not a " +"regular file :meth:`send` will be used instead. *offset* tells from where to " +"start reading the file. If specified, *count* is the total number of bytes " +"to transmit as opposed to sending the file until EOF is reached. File " +"position is updated on return or also in case of error in which " +"case :meth:`file.tell() ` can be used to figure out the " +"number of bytes which were sent. The socket must be of :const:`SOCK_STREAM` " +"type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1936 +#: ../../library/socket.rst:1938 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1944 +#: ../../library/socket.rst:1946 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1947 +#: ../../library/socket.rst:1949 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1949 +#: ../../library/socket.rst:1951 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1951 +#: ../../library/socket.rst:1953 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1953 +#: ../../library/socket.rst:1955 msgid "" -"The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." -"type`." +"The method no longer applies :const:`SOCK_NONBLOCK` flag " +"on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1960 +#: ../../library/socket.rst:1962 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" -"zero value is given, subsequent socket operations will raise a :exc:" -"`timeout` exception if the timeout period *value* has elapsed before the " -"operation has completed. If zero is given, the socket is put in non-" +"zero value is given, subsequent socket operations will raise " +"a :exc:`timeout` exception if the timeout period *value* has elapsed before " +"the operation has completed. If zero is given, the socket is put in non-" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1967 +#: ../../library/socket.rst:1969 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1969 +#: ../../library/socket.rst:1971 msgid "" -"The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." -"type`." +"The method no longer toggles :const:`SOCK_NONBLOCK` flag " +"on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1982 +#: ../../library/socket.rst:1984 msgid "" -"Set the value of the given socket option (see the Unix manual page :manpage:" -"`setsockopt(2)`). The needed symbolic constants are defined in this module " -"(:ref:`!SO_\\* etc. `). The value can be an integer, " -"``None`` or a :term:`bytes-like object` representing a buffer. In the later " -"case it is up to the caller to ensure that the bytestring contains the " -"proper bits (see the optional built-in module :mod:`struct` for a way to " -"encode C structures as bytestrings). When *value* is set to ``None``, " -"*optlen* argument is required. It's equivalent to call :c:func:`setsockopt` " -"C function with ``optval=NULL`` and ``optlen=optlen``." +"Set the value of the given socket option (see the Unix manual " +"page :manpage:`setsockopt(2)`). The needed symbolic constants are defined " +"in this module (:ref:`!SO_\\* etc. `). The value can " +"be an integer, ``None`` or a :term:`bytes-like object` representing a " +"buffer. In the later case it is up to the caller to ensure that the " +"bytestring contains the proper bits (see the optional built-in " +"module :mod:`struct` for a way to encode C structures as bytestrings). When " +"*value* is set to ``None``, *optlen* argument is required. It's equivalent " +"to call :c:func:`setsockopt` C function with ``optval=NULL`` and " +"``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1995 +#: ../../library/socket.rst:1997 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:2003 +#: ../../library/socket.rst:2005 msgid "" -"Shut down one or both halves of the connection. If *how* is :const:" -"`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " -"further sends are disallowed. If *how* is :const:`SHUT_RDWR`, further sends " -"and receives are disallowed." +"Shut down one or both halves of the connection. If *how* " +"is :const:`SHUT_RD`, further receives are disallowed. If *how* " +"is :const:`SHUT_WR`, further sends are disallowed. If *how* " +"is :const:`SHUT_RDWR`, further sends and receives are disallowed." msgstr "" -#: ../../library/socket.rst:2013 +#: ../../library/socket.rst:2015 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " "object can then be passed to the target process using some form of " -"interprocess communication and the socket can be recreated there using :func:" -"`fromshare`. Once this method has been called, it is safe to close the " -"socket since the operating system has already duplicated it for the target " -"process." +"interprocess communication and the socket can be recreated there " +"using :func:`fromshare`. Once this method has been called, it is safe to " +"close the socket since the operating system has already duplicated it for " +"the target process." msgstr "" -#: ../../library/socket.rst:2025 +#: ../../library/socket.rst:2027 msgid "" -"Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" -"`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." +"Note that there are no methods :meth:`read` or :meth:`write`; " +"use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument " +"instead." msgstr "" -#: ../../library/socket.rst:2028 +#: ../../library/socket.rst:2030 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2034 +#: ../../library/socket.rst:2036 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2039 +#: ../../library/socket.rst:2041 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2044 +#: ../../library/socket.rst:2046 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2051 +#: ../../library/socket.rst:2053 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2053 +#: ../../library/socket.rst:2055 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2057 +#: ../../library/socket.rst:2059 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2060 +#: ../../library/socket.rst:2062 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2301,14 +2331,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2065 +#: ../../library/socket.rst:2067 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2070 +#: ../../library/socket.rst:2072 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2317,38 +2347,38 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2077 +#: ../../library/socket.rst:2079 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2079 +#: ../../library/socket.rst:2081 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " -"before calling :meth:`~socket.connect` or pass a timeout parameter to :meth:" -"`create_connection`. However, the system network stack may also return a " -"connection timeout error of its own regardless of any Python socket timeout " -"setting." +"before calling :meth:`~socket.connect` or pass a timeout parameter " +"to :meth:`create_connection`. However, the system network stack may also " +"return a connection timeout error of its own regardless of any Python socket " +"timeout setting." msgstr "" -#: ../../library/socket.rst:2087 +#: ../../library/socket.rst:2089 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2089 +#: ../../library/socket.rst:2091 msgid "" -"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" -"meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " -"depends on settings of the listening socket:" +"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by " +"the :meth:`~socket.accept` method inherit that timeout. Otherwise, the " +"behaviour depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2093 +#: ../../library/socket.rst:2095 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2096 +#: ../../library/socket.rst:2098 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2356,28 +2386,29 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2105 +#: ../../library/socket.rst:2107 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2107 +#: ../../library/socket.rst:2109 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " -"a client using it. Note that a server must perform the sequence :func:" -"`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:" -"`~socket.accept` (possibly repeating the :meth:`~socket.accept` to service " -"more than one client), while a client only needs the sequence :func:`~socket." -"socket`, :meth:`~socket.connect`. Also note that the server does not :meth:" -"`~socket.sendall`/:meth:`~socket.recv` on the socket it is listening on but " -"on the new socket returned by :meth:`~socket.accept`." +"a client using it. Note that a server must perform the " +"sequence :func:`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` " +"(possibly repeating the :meth:`~socket.accept` to service more than one " +"client), while a client only needs the " +"sequence :func:`~socket.socket`, :meth:`~socket.connect`. Also note that " +"the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on the " +"socket it is listening on but on the new socket returned " +"by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2117 +#: ../../library/socket.rst:2119 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2119 +#: ../../library/socket.rst:2121 msgid "" "# Echo server program\n" "import socket\n" @@ -2396,7 +2427,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2137 +#: ../../library/socket.rst:2139 msgid "" "# Echo client program\n" "import socket\n" @@ -2410,7 +2441,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2148 +#: ../../library/socket.rst:2150 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2420,7 +2451,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2155 +#: ../../library/socket.rst:2157 msgid "" "# Echo server program\n" "import socket\n" @@ -2457,7 +2488,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2191 +#: ../../library/socket.rst:2193 msgid "" "# Echo client program\n" "import socket\n" @@ -2466,8 +2497,8 @@ msgid "" "HOST = 'daring.cwi.nl' # The remote host\n" "PORT = 50007 # The same port as used by the server\n" "s = None\n" -"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket." -"SOCK_STREAM):\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, " +"socket.SOCK_STREAM):\n" " af, socktype, proto, canonname, sa = res\n" " try:\n" " s = socket.socket(af, socktype, proto)\n" @@ -2490,14 +2521,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2220 +#: ../../library/socket.rst:2222 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2224 +#: ../../library/socket.rst:2226 msgid "" "import socket\n" "\n" @@ -2521,29 +2552,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2245 +#: ../../library/socket.rst:2247 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2249 +#: ../../library/socket.rst:2251 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2251 +#: ../../library/socket.rst:2253 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2255 +#: ../../library/socket.rst:2257 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2257 +#: ../../library/socket.rst:2259 msgid "" "import socket\n" "import struct\n" @@ -2585,29 +2616,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2295 +#: ../../library/socket.rst:2297 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2298 +#: ../../library/socket.rst:2300 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2300 +#: ../../library/socket.rst:2302 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2303 +#: ../../library/socket.rst:2305 msgid "" -"There is a :mod:`socket` flag to set, in order to prevent this, :const:" -"`socket.SO_REUSEADDR`::" +"There is a :mod:`socket` flag to set, in order to prevent " +"this, :const:`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2306 +#: ../../library/socket.rst:2308 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2617,30 +2648,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2310 +#: ../../library/socket.rst:2312 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2316 +#: ../../library/socket.rst:2318 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2318 +#: ../../library/socket.rst:2320 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2320 +#: ../../library/socket.rst:2322 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2323 +#: ../../library/socket.rst:2325 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2659,18 +2690,18 @@ msgstr "object(物件)" msgid "socket" msgstr "socket" -#: ../../library/socket.rst:1623 +#: ../../library/socket.rst:1630 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/socket.rst:1623 +#: ../../library/socket.rst:1630 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1980 +#: ../../library/socket.rst:1982 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1980 +#: ../../library/socket.rst:1982 msgid "struct" msgstr "struct" diff --git a/library/socketserver.po b/library/socketserver.po index 4373fe8002..31b914a9a2 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-09 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -344,17 +344,20 @@ msgstr "" #: ../../library/socketserver.rst:263 msgid "" -"The family of protocols to which the server's socket belongs. Common " -"examples are :const:`socket.AF_INET` and :const:`socket.AF_UNIX`." +"The family of protocols to which the server's socket belongs. Common " +"examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and :const:" +"`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this module " +"with class attribute ``address_family = AF_INET6`` set if you want IPv6 " +"server classes." msgstr "" -#: ../../library/socketserver.rst:269 +#: ../../library/socketserver.rst:272 msgid "" "The user-provided request handler class; an instance of this class is " "created for each request." msgstr "" -#: ../../library/socketserver.rst:275 +#: ../../library/socketserver.rst:278 msgid "" "The address on which the server is listening. The format of addresses " "varies depending on the protocol family; see the documentation for the :mod:" @@ -363,22 +366,22 @@ msgid "" "``('127.0.0.1', 80)``, for example." msgstr "" -#: ../../library/socketserver.rst:284 +#: ../../library/socketserver.rst:287 msgid "" "The socket object on which the server will listen for incoming requests." msgstr "" -#: ../../library/socketserver.rst:287 +#: ../../library/socketserver.rst:290 msgid "The server classes support the following class variables:" msgstr "" -#: ../../library/socketserver.rst:293 +#: ../../library/socketserver.rst:296 msgid "" "Whether the server will allow the reuse of an address. This defaults to :" "const:`False`, and can be set in subclasses to change the policy." msgstr "" -#: ../../library/socketserver.rst:299 +#: ../../library/socketserver.rst:302 msgid "" "The size of the request queue. If it takes a long time to process a single " "request, any requests that arrive while the server is busy are placed into a " @@ -387,40 +390,40 @@ msgid "" "default value is usually 5, but this can be overridden by subclasses." msgstr "" -#: ../../library/socketserver.rst:308 +#: ../../library/socketserver.rst:311 msgid "" "The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" "const:`socket.SOCK_DGRAM` are two common values." msgstr "" -#: ../../library/socketserver.rst:314 +#: ../../library/socketserver.rst:317 msgid "" "Timeout duration, measured in seconds, or :const:`None` if no timeout is " "desired. If :meth:`handle_request` receives no incoming requests within the " "timeout period, the :meth:`handle_timeout` method is called." msgstr "" -#: ../../library/socketserver.rst:319 +#: ../../library/socketserver.rst:322 msgid "" "There are various server methods that can be overridden by subclasses of " "base server classes like :class:`TCPServer`; these methods aren't useful to " "external users of the server object." msgstr "" -#: ../../library/socketserver.rst:328 +#: ../../library/socketserver.rst:331 msgid "" "Actually processes the request by instantiating :attr:`RequestHandlerClass` " "and calling its :meth:`~BaseRequestHandler.handle` method." msgstr "" -#: ../../library/socketserver.rst:334 +#: ../../library/socketserver.rst:337 msgid "" "Must accept a request from the socket, and return a 2-tuple containing the " "*new* socket object to be used to communicate with the client, and the " "client's address." msgstr "" -#: ../../library/socketserver.rst:341 +#: ../../library/socketserver.rst:344 msgid "" "This function is called if the :meth:`~BaseRequestHandler.handle` method of " "a :attr:`RequestHandlerClass` instance raises an exception. The default " @@ -428,11 +431,11 @@ msgid "" "further requests." msgstr "" -#: ../../library/socketserver.rst:346 +#: ../../library/socketserver.rst:349 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" -#: ../../library/socketserver.rst:353 +#: ../../library/socketserver.rst:356 msgid "" "This function is called when the :attr:`timeout` attribute has been set to a " "value other than :const:`None` and the timeout period has passed with no " @@ -441,7 +444,7 @@ msgid "" "threading servers this method does nothing." msgstr "" -#: ../../library/socketserver.rst:362 +#: ../../library/socketserver.rst:365 msgid "" "Calls :meth:`finish_request` to create an instance of the :attr:" "`RequestHandlerClass`. If desired, this function can create a new process " @@ -449,20 +452,20 @@ msgid "" "`ThreadingMixIn` classes do this." msgstr "" -#: ../../library/socketserver.rst:374 +#: ../../library/socketserver.rst:377 msgid "" "Called by the server's constructor to activate the server. The default " "behavior for a TCP server just invokes :meth:`~socket.socket.listen` on the " "server's socket. May be overridden." msgstr "" -#: ../../library/socketserver.rst:381 +#: ../../library/socketserver.rst:384 msgid "" "Called by the server's constructor to bind the socket to the desired " "address. May be overridden." msgstr "" -#: ../../library/socketserver.rst:387 +#: ../../library/socketserver.rst:390 msgid "" "Must return a Boolean value; if the value is :const:`True`, the request will " "be processed, and if it's :const:`False`, the request will be denied. This " @@ -470,17 +473,17 @@ msgid "" "default implementation always returns :const:`True`." msgstr "" -#: ../../library/socketserver.rst:393 +#: ../../library/socketserver.rst:396 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`server_close`." msgstr "" -#: ../../library/socketserver.rst:399 +#: ../../library/socketserver.rst:402 msgid "Request Handler Objects" msgstr "" -#: ../../library/socketserver.rst:403 +#: ../../library/socketserver.rst:406 msgid "" "This is the superclass of all request handler objects. It defines the " "interface, given below. A concrete request handler subclass must define a " @@ -488,13 +491,13 @@ msgid "" "instance of the subclass is created for each request." msgstr "" -#: ../../library/socketserver.rst:412 +#: ../../library/socketserver.rst:415 msgid "" "Called before the :meth:`handle` method to perform any initialization " "actions required. The default implementation does nothing." msgstr "" -#: ../../library/socketserver.rst:418 +#: ../../library/socketserver.rst:421 msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " @@ -503,72 +506,72 @@ msgid "" "`server`, in case it needs access to per-server information." msgstr "" -#: ../../library/socketserver.rst:424 +#: ../../library/socketserver.rst:427 msgid "" "The type of :attr:`request` is different for datagram or stream services. " "For stream services, :attr:`request` is a socket object; for datagram " "services, :attr:`request` is a pair of string and socket." msgstr "" -#: ../../library/socketserver.rst:431 +#: ../../library/socketserver.rst:434 msgid "" "Called after the :meth:`handle` method to perform any clean-up actions " "required. The default implementation does nothing. If :meth:`setup` raises " "an exception, this function will not be called." msgstr "" -#: ../../library/socketserver.rst:438 +#: ../../library/socketserver.rst:441 msgid "" "The *new* :class:`socket.socket` object to be used to communicate with the " "client." msgstr "" -#: ../../library/socketserver.rst:444 +#: ../../library/socketserver.rst:447 msgid "Client address returned by :meth:`BaseServer.get_request`." msgstr "" -#: ../../library/socketserver.rst:449 +#: ../../library/socketserver.rst:452 msgid ":class:`BaseServer` object used for handling the request." msgstr "" -#: ../../library/socketserver.rst:455 +#: ../../library/socketserver.rst:458 msgid "" "These :class:`BaseRequestHandler` subclasses override the :meth:" "`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " "and provide :attr:`rfile` and :attr:`wfile` attributes." msgstr "" -#: ../../library/socketserver.rst:461 +#: ../../library/socketserver.rst:464 msgid "" "A file object from which receives the request is read. Support the :class:" "`io.BufferedIOBase` readable interface." msgstr "" -#: ../../library/socketserver.rst:466 +#: ../../library/socketserver.rst:469 msgid "" "A file object to which the reply is written. Support the :class:`io." "BufferedIOBase` writable interface" msgstr "" -#: ../../library/socketserver.rst:470 +#: ../../library/socketserver.rst:473 msgid "" ":attr:`wfile` also supports the :class:`io.BufferedIOBase` writable " "interface." msgstr "" -#: ../../library/socketserver.rst:476 +#: ../../library/socketserver.rst:479 msgid "Examples" msgstr "範例" -#: ../../library/socketserver.rst:479 +#: ../../library/socketserver.rst:482 msgid ":class:`socketserver.TCPServer` Example" msgstr ":class:`socketserver.TCPServer` 範例" -#: ../../library/socketserver.rst:481 ../../library/socketserver.rst:581 +#: ../../library/socketserver.rst:484 ../../library/socketserver.rst:595 msgid "This is the server side::" msgstr "" -#: ../../library/socketserver.rst:483 +#: ../../library/socketserver.rst:486 msgid "" "import socketserver\n" "\n" @@ -583,11 +586,17 @@ msgid "" "\n" " def handle(self):\n" " # self.request is the TCP socket connected to the client\n" -" self.data = self.request.recv(1024).strip()\n" -" print(\"Received from {}:\".format(self.client_address[0]))\n" -" print(self.data)\n" +" pieces = [b'']\n" +" total = 0\n" +" while b'\\n' not in pieces[-1] and total < 10_000:\n" +" pieces.append(self.request.recv(2000))\n" +" total += len(pieces[-1])\n" +" self.data = b''.join(pieces)\n" +" print(f\"Received from {self.client_address[0]}:\")\n" +" print(self.data.decode(\"utf-8\"))\n" " # just send back the same data, but upper-cased\n" " self.request.sendall(self.data.upper())\n" +" # after we return, the socket will be closed.\n" "\n" "if __name__ == \"__main__\":\n" " HOST, PORT = \"localhost\", 9999\n" @@ -599,42 +608,46 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:511 +#: ../../library/socketserver.rst:520 msgid "" "An alternative request handler class that makes use of streams (file-like " "objects that simplify communication by providing the standard file " "interface)::" msgstr "" -#: ../../library/socketserver.rst:514 +#: ../../library/socketserver.rst:523 msgid "" "class MyTCPHandler(socketserver.StreamRequestHandler):\n" "\n" " def handle(self):\n" -" # self.rfile is a file-like object created by the handler;\n" -" # we can now use e.g. readline() instead of raw recv() calls\n" -" self.data = self.rfile.readline().strip()\n" -" print(\"{} wrote:\".format(self.client_address[0]))\n" -" print(self.data)\n" +" # self.rfile is a file-like object created by the handler.\n" +" # We can now use e.g. readline() instead of raw recv() calls.\n" +" # We limit ourselves to 10000 bytes to avoid abuse by the sender.\n" +" self.data = self.rfile.readline(10000).rstrip()\n" +" print(f\"{self.client_address[0]} wrote:\")\n" +" print(self.data.decode(\"utf-8\"))\n" " # Likewise, self.wfile is a file-like object used to write back\n" " # to the client\n" " self.wfile.write(self.data.upper())" msgstr "" -#: ../../library/socketserver.rst:526 +#: ../../library/socketserver.rst:536 msgid "" "The difference is that the ``readline()`` call in the second handler will " "call ``recv()`` multiple times until it encounters a newline character, " -"while the single ``recv()`` call in the first handler will just return what " -"has been received so far from the client's ``sendall()`` call (typically all " -"of it, but this is not guaranteed by the TCP protocol)." +"while the the first handler had to use a ``recv()`` loop to accumulate data " +"until a newline itself. If it had just used a single ``recv()`` without the " +"loop it would just have returned what has been received so far from the " +"client. TCP is stream based: data arrives in the order it was sent, but " +"there no correlation between client ``send()`` or ``sendall()`` calls and " +"the number of ``recv()`` calls on the server required to receive it." msgstr "" -#: ../../library/socketserver.rst:533 ../../library/socketserver.rst:605 +#: ../../library/socketserver.rst:546 ../../library/socketserver.rst:619 msgid "This is the client side::" msgstr "" -#: ../../library/socketserver.rst:535 +#: ../../library/socketserver.rst:548 msgid "" "import socket\n" "import sys\n" @@ -646,24 +659,25 @@ msgid "" "with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n" " # Connect to server and send data\n" " sock.connect((HOST, PORT))\n" -" sock.sendall(bytes(data + \"\\n\", \"utf-8\"))\n" +" sock.sendall(bytes(data, \"utf-8\"))\n" +" sock.sendall(b\"\\n\")\n" "\n" " # Receive data from the server and shut down\n" " received = str(sock.recv(1024), \"utf-8\")\n" "\n" -"print(\"Sent: {}\".format(data))\n" -"print(\"Received: {}\".format(received))" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:554 ../../library/socketserver.rst:680 +#: ../../library/socketserver.rst:568 ../../library/socketserver.rst:694 msgid "The output of the example should look something like this:" msgstr "" -#: ../../library/socketserver.rst:556 +#: ../../library/socketserver.rst:570 msgid "Server:" msgstr "" -#: ../../library/socketserver.rst:558 +#: ../../library/socketserver.rst:572 msgid "" "$ python TCPServer.py\n" "127.0.0.1 wrote:\n" @@ -677,11 +691,11 @@ msgstr "" "127.0.0.1 wrote:\n" "b'python is nice'" -#: ../../library/socketserver.rst:566 +#: ../../library/socketserver.rst:580 msgid "Client:" msgstr "" -#: ../../library/socketserver.rst:568 +#: ../../library/socketserver.rst:582 msgid "" "$ python TCPClient.py hello world with TCP\n" "Sent: hello world with TCP\n" @@ -697,11 +711,11 @@ msgstr "" "Sent: python is nice\n" "Received: PYTHON IS NICE" -#: ../../library/socketserver.rst:579 +#: ../../library/socketserver.rst:593 msgid ":class:`socketserver.UDPServer` Example" msgstr ":class:`socketserver.UDPServer` 範例" -#: ../../library/socketserver.rst:583 +#: ../../library/socketserver.rst:597 msgid "" "import socketserver\n" "\n" @@ -716,7 +730,7 @@ msgid "" " def handle(self):\n" " data = self.request[0].strip()\n" " socket = self.request[1]\n" -" print(\"{} wrote:\".format(self.client_address[0]))\n" +" print(f\"{self.client_address[0]} wrote:\")\n" " print(data)\n" " socket.sendto(data.upper(), self.client_address)\n" "\n" @@ -726,7 +740,7 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:607 +#: ../../library/socketserver.rst:621 msgid "" "import socket\n" "import sys\n" @@ -742,31 +756,31 @@ msgid "" "sock.sendto(bytes(data + \"\\n\", \"utf-8\"), (HOST, PORT))\n" "received = str(sock.recv(1024), \"utf-8\")\n" "\n" -"print(\"Sent: {}\".format(data))\n" -"print(\"Received: {}\".format(received))" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:624 +#: ../../library/socketserver.rst:638 msgid "" "The output of the example should look exactly like for the TCP server " "example." msgstr "" -#: ../../library/socketserver.rst:628 +#: ../../library/socketserver.rst:642 msgid "Asynchronous Mixins" msgstr "" -#: ../../library/socketserver.rst:630 +#: ../../library/socketserver.rst:644 msgid "" "To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" "`ForkingMixIn` classes." msgstr "" -#: ../../library/socketserver.rst:633 +#: ../../library/socketserver.rst:647 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr "" -#: ../../library/socketserver.rst:635 +#: ../../library/socketserver.rst:649 msgid "" "import socket\n" "import threading\n" @@ -814,7 +828,7 @@ msgid "" " server.shutdown()" msgstr "" -#: ../../library/socketserver.rst:682 +#: ../../library/socketserver.rst:696 msgid "" "$ python ThreadedTCPServer.py\n" "Server loop running in thread: Thread-1\n" @@ -828,7 +842,7 @@ msgstr "" "Received: Thread-3: Hello World 2\n" "Received: Thread-4: Hello World 3" -#: ../../library/socketserver.rst:691 +#: ../../library/socketserver.rst:705 msgid "" "The :class:`ForkingMixIn` class is used in the same way, except that the " "server will spawn a new process for each request. Available only on POSIX " diff --git a/library/sqlite3.po b/library/sqlite3.po index 509dad97ff..2b9942a219 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 00:13+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/sqlite3.rst:32 msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " -"SQL interface compliant with the DB-API 2.0 specification described by :pep:" -"`249`, and requires SQLite 3.15.2 or newer." +"SQL interface compliant with the DB-API 2.0 specification described " +"by :pep:`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -128,8 +128,8 @@ msgstr "" #: ../../library/sqlite3.rst:89 msgid "" "In order to execute SQL statements and fetch results from SQL queries, we " -"will need to use a database cursor. Call :meth:`con.cursor() ` to create the :class:`Cursor`:" +"will need to use a database cursor. Call :meth:`con.cursor() " +"` to create the :class:`Cursor`:" msgstr "" #: ../../library/sqlite3.rst:93 @@ -142,8 +142,8 @@ msgid "" "database table ``movie`` with columns for title, release year, and review " "score. For simplicity, we can just use column names in the table declaration " "-- thanks to the `flexible typing`_ feature of SQLite, specifying the data " -"types is optional. Execute the ``CREATE TABLE`` statement by calling :meth:" -"`cur.execute(...) `:" +"types is optional. Execute the ``CREATE TABLE`` statement by " +"calling :meth:`cur.execute(...) `:" msgstr "" #: ../../library/sqlite3.rst:106 @@ -155,9 +155,9 @@ msgid "" "We can verify that the new table has been created by querying the " "``sqlite_master`` table built-in to SQLite, which should now contain an " "entry for the ``movie`` table definition (see `The Schema Table`_ for " -"details). Execute that query by calling :meth:`cur.execute(...) `, assign the result to ``res``, and call :meth:`res.fetchone() " -"` to fetch the resulting row:" +"details). Execute that query by calling :meth:`cur.execute(...) " +"`, assign the result to ``res``, and " +"call :meth:`res.fetchone() ` to fetch the resulting row:" msgstr "" #: ../../library/sqlite3.rst:121 @@ -172,9 +172,10 @@ msgstr "" #: ../../library/sqlite3.rst:127 msgid "" -"We can see that the table has been created, as the query returns a :class:" -"`tuple` containing the table's name. If we query ``sqlite_master`` for a non-" -"existent table ``spam``, :meth:`!res.fetchone` will return ``None``:" +"We can see that the table has been created, as the query returns " +"a :class:`tuple` containing the table's name. If we query ``sqlite_master`` " +"for a non-existent table ``spam``, :meth:`!res.fetchone` will return " +"``None``:" msgstr "" #: ../../library/sqlite3.rst:132 @@ -190,8 +191,8 @@ msgstr "" #: ../../library/sqlite3.rst:138 msgid "" "Now, add two rows of data supplied as SQL literals by executing an " -"``INSERT`` statement, once again by calling :meth:`cur.execute(...) `:" +"``INSERT`` statement, once again by calling :meth:`cur.execute(...) " +"`:" msgstr "" #: ../../library/sqlite3.rst:142 @@ -212,8 +213,8 @@ msgstr "" msgid "" "The ``INSERT`` statement implicitly opens a transaction, which needs to be " "committed before changes are saved in the database (see :ref:`sqlite3-" -"controlling-transactions` for details). Call :meth:`con.commit() ` on the connection object to commit the transaction:" +"controlling-transactions` for details). Call :meth:`con.commit() " +"` on the connection object to commit the transaction:" msgstr "" #: ../../library/sqlite3.rst:156 @@ -224,8 +225,8 @@ msgstr "con.commit()" msgid "" "We can verify that the data was inserted correctly by executing a ``SELECT`` " "query. Use the now-familiar :meth:`cur.execute(...) ` to " -"assign the result to ``res``, and call :meth:`res.fetchall() ` to return all resulting rows:" +"assign the result to ``res``, and call :meth:`res.fetchall() " +"` to return all resulting rows:" msgstr "" #: ../../library/sqlite3.rst:166 @@ -246,8 +247,8 @@ msgstr "" #: ../../library/sqlite3.rst:175 msgid "" -"Now, insert three more rows by calling :meth:`cur.executemany(...) `:" +"Now, insert three more rows by calling :meth:`cur.executemany(...) " +"`:" msgstr "" #: ../../library/sqlite3.rst:178 @@ -303,9 +304,10 @@ msgstr "" #: ../../library/sqlite3.rst:211 msgid "" -"Finally, verify that the database has been written to disk by calling :meth:" -"`con.close() ` to close the existing connection, opening a " -"new one, creating a new cursor, then querying the database:" +"Finally, verify that the database has been written to disk by " +"calling :meth:`con.close() ` to close the existing " +"connection, opening a new one, creating a new cursor, then querying the " +"database:" msgstr "" #: ../../library/sqlite3.rst:216 @@ -356,7 +358,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:618 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -394,9 +396,9 @@ msgstr "" #: ../../library/sqlite3.rst:277 msgid "" -"How many seconds the connection should wait before raising an :exc:" -"`OperationalError` when a table is locked. If another connection opens a " -"transaction to modify a table, that table will be locked until the " +"How many seconds the connection should wait before raising " +"an :exc:`OperationalError` when a table is locked. If another connection " +"opens a transaction to modify a table, that table will be locked until the " "transaction is committed. Default five seconds." msgstr "" @@ -405,25 +407,23 @@ msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " "converters registered with :func:`register_converter`. Set it to any " -"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" -"`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " -"types if both flags are set. Types cannot be detected for generated fields " -"(for example ``max(data)``), even when the *detect_types* parameter is set; :" -"class:`str` will be returned instead. By default (``0``), type detection is " -"disabled." +"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` " +"and :const:`PARSE_COLNAMES` to enable this. Column names takes precedence " +"over declared types if both flags are set. By default (``0``), type " +"detection is disabled." msgstr "" -#: ../../library/sqlite3.rst:298 +#: ../../library/sqlite3.rst:295 msgid "" -"Control legacy transaction handling behaviour. See :attr:`Connection." -"isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " -"more information. Can be ``\"DEFERRED\"`` (default), ``\"EXCLUSIVE\"`` or " -"``\"IMMEDIATE\"``; or ``None`` to disable opening transactions implicitly. " -"Has no effect unless :attr:`Connection.autocommit` is set to :const:" -"`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." +"Control legacy transaction handling behaviour. " +"See :attr:`Connection.isolation_level` and :ref:`sqlite3-transaction-control-" +"isolation-level` for more information. Can be ``\"DEFERRED\"`` (default), " +"``\"EXCLUSIVE\"`` or ``\"IMMEDIATE\"``; or ``None`` to disable opening " +"transactions implicitly. Has no effect unless :attr:`Connection.autocommit` " +"is set to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" -#: ../../library/sqlite3.rst:308 +#: ../../library/sqlite3.rst:305 msgid "" "If ``True`` (default), :exc:`ProgrammingError` will be raised if the " "database connection is used by a thread other than the one that created it. " @@ -432,19 +432,19 @@ msgid "" "See :attr:`threadsafety` for more information." msgstr "" -#: ../../library/sqlite3.rst:317 +#: ../../library/sqlite3.rst:314 msgid "" "A custom subclass of :class:`Connection` to create the connection with, if " "not the default :class:`Connection` class." msgstr "" -#: ../../library/sqlite3.rst:321 +#: ../../library/sqlite3.rst:318 msgid "" "The number of statements that :mod:`!sqlite3` should internally cache for " "this connection, to avoid parsing overhead. By default, 128 statements." msgstr "" -#: ../../library/sqlite3.rst:326 +#: ../../library/sqlite3.rst:323 msgid "" "If set to ``True``, *database* is interpreted as a :abbr:`URI (Uniform " "Resource Identifier)` with a file path and an optional query string. The " @@ -453,28 +453,28 @@ msgid "" "various :ref:`sqlite3-uri-tricks`." msgstr "" -#: ../../library/sqlite3.rst:335 +#: ../../library/sqlite3.rst:332 msgid "" -"Control :pep:`249` transaction handling behaviour. See :attr:`Connection." -"autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " -"information. *autocommit* currently defaults to :const:`~sqlite3." -"LEGACY_TRANSACTION_CONTROL`. The default will change to ``False`` in a " -"future Python release." +"Control :pep:`249` transaction handling behaviour. " +"See :attr:`Connection.autocommit` and :ref:`sqlite3-transaction-control-" +"autocommit` for more information. *autocommit* currently defaults " +"to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL`. The default will change to " +"``False`` in a future Python release." msgstr "" #: ../../library/sqlite3.rst:0 msgid "Return type" msgstr "" -#: ../../library/sqlite3.rst:346 +#: ../../library/sqlite3.rst:343 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` ``sqlite3." -"connect``。" +"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` " +"``sqlite3.connect``。" -#: ../../library/sqlite3.rst:347 +#: ../../library/sqlite3.rst:344 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." @@ -482,31 +482,31 @@ msgstr "" "引發一個附帶引數 ``connection_handle`` 的\\ :ref:`稽核事件 ` " "``sqlite3.connect/handle``。" -#: ../../library/sqlite3.rst:349 +#: ../../library/sqlite3.rst:346 msgid "Added the *uri* parameter." msgstr "新增 *uri* 參數。" -#: ../../library/sqlite3.rst:352 +#: ../../library/sqlite3.rst:349 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:355 +#: ../../library/sqlite3.rst:352 msgid "Added the ``sqlite3.connect/handle`` auditing event." msgstr "新增 ``sqlite3.connect/handle`` 稽核事件。" -#: ../../library/sqlite3.rst:358 +#: ../../library/sqlite3.rst:355 msgid "Added the *autocommit* parameter." msgstr "新增 *autocommit* 參數。" -#: ../../library/sqlite3.rst:361 +#: ../../library/sqlite3.rst:358 msgid "" "Positional use of the parameters *timeout*, *detect_types*, " "*isolation_level*, *check_same_thread*, *factory*, *cached_statements*, and " "*uri* is deprecated. They will become keyword-only parameters in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:369 +#: ../../library/sqlite3.rst:366 msgid "" "Return ``True`` if the string *statement* appears to contain one or more " "complete SQL statements. No syntactic verification or parsing of any kind is " @@ -514,11 +514,11 @@ msgid "" "and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:375 +#: ../../library/sqlite3.rst:372 msgid "For example:" msgstr "範例:" -#: ../../library/sqlite3.rst:377 +#: ../../library/sqlite3.rst:374 msgid "" ">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" "True\n" @@ -530,20 +530,20 @@ msgstr "" ">>> sqlite3.complete_statement(\"SELECT foo\")\n" "False" -#: ../../library/sqlite3.rst:384 +#: ../../library/sqlite3.rst:381 msgid "" "This function may be useful during command-line input to determine if the " "entered text seems to form a complete SQL statement, or if additional input " "is needed before calling :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:388 +#: ../../library/sqlite3.rst:385 msgid "" "See :func:`!runsource` in :source:`Lib/sqlite3/__main__.py` for real-world " "use." msgstr "" -#: ../../library/sqlite3.rst:393 +#: ../../library/sqlite3.rst:390 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -552,14 +552,14 @@ msgid "" "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:402 +#: ../../library/sqlite3.rst:399 msgid "" "Errors in user-defined function callbacks are logged as unraisable " "exceptions. Use an :func:`unraisable hook handler ` for " "introspection of the failed callback." msgstr "" -#: ../../library/sqlite3.rst:408 +#: ../../library/sqlite3.rst:405 msgid "" "Register an *adapter* :term:`callable` to adapt the Python type *type* into " "an SQLite type. The adapter is called with a Python object of type *type* as " @@ -567,7 +567,7 @@ msgid "" "natively understands `." msgstr "" -#: ../../library/sqlite3.rst:416 +#: ../../library/sqlite3.rst:413 msgid "" "Register the *converter* :term:`callable` to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -577,115 +577,122 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:424 +#: ../../library/sqlite3.rst:421 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:431 +#: ../../library/sqlite3.rst:428 msgid "Module constants" msgstr "" -#: ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:432 msgid "" "Set :attr:`~Connection.autocommit` to this constant to select old style (pre-" "Python 3.12) transaction control behaviour. See :ref:`sqlite3-transaction-" "control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:441 +#: ../../library/sqlite3.rst:438 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function by using the type name, parsed from the query " -"column name, as the converter dictionary key. The type name must be wrapped " -"in square brackets (``[]``)." +"look up a converter function using the declared types for each column. The " +"types are declared when the database table is created. :mod:`!sqlite3` will " +"look up a converter function using the first word of the declared type as " +"the converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:447 +#: ../../library/sqlite3.rst:446 msgid "" -"SELECT p as \"p [point]\" FROM test; ! will look up converter \"point\"" +"CREATE TABLE test(\n" +" i integer primary key, ! will look up a converter named \"integer\"\n" +" p point, ! will look up a converter named \"point\"\n" +" n number(10) ! will look up a converter named \"number\"\n" +" )" msgstr "" -#: ../../library/sqlite3.rst:451 +#: ../../library/sqlite3.rst:454 msgid "" -"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " +"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:456 +#: ../../library/sqlite3.rst:459 msgid "" -"Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function using the declared types for each column. The " -"types are declared when the database table is created. :mod:`!sqlite3` will " -"look up a converter function using the first word of the declared type as " -"the converter dictionary key. For example:" +"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. " +"Use :const:`!PARSE_COLNAMES` to enforce types for such queries." msgstr "" #: ../../library/sqlite3.rst:464 msgid "" -"CREATE TABLE test(\n" -" i integer primary key, ! will look up a converter named \"integer\"\n" -" p point, ! will look up a converter named \"point\"\n" -" n number(10) ! will look up a converter named \"number\"\n" -" )" +"Pass this flag value to the *detect_types* parameter of :func:`connect` to " +"look up a converter function by using the type name, parsed from the query " +"column name, as the converter dictionary key. The query column name must be " +"wrapped in double quotes (``\"``) and the type name must be wrapped in " +"square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:472 +#: ../../library/sqlite3.rst:471 msgid "" -"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " +"SELECT MAX(p) as \"p [point]\" FROM test; ! will look up converter \"point\"" +msgstr "" + +#: ../../library/sqlite3.rst:475 +msgid "" +"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:479 +#: ../../library/sqlite3.rst:482 msgid "" "Flags that should be returned by the *authorizer_callback* :term:`callable` " "passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" -#: ../../library/sqlite3.rst:482 +#: ../../library/sqlite3.rst:485 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: ../../library/sqlite3.rst:483 +#: ../../library/sqlite3.rst:486 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: ../../library/sqlite3.rst:484 +#: ../../library/sqlite3.rst:487 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: ../../library/sqlite3.rst:488 +#: ../../library/sqlite3.rst:491 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:493 +#: ../../library/sqlite3.rst:496 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`!sqlite3` module. Required by the DB-API. Hard-coded to " "``\"qmark\"``." msgstr "" -#: ../../library/sqlite3.rst:499 +#: ../../library/sqlite3.rst:502 msgid "The ``named`` DB-API parameter style is also supported." msgstr "" -#: ../../library/sqlite3.rst:503 +#: ../../library/sqlite3.rst:506 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:507 +#: ../../library/sqlite3.rst:510 msgid "" -"Version number of the runtime SQLite library as a :class:`tuple` of :class:" -"`integers `." +"Version number of the runtime SQLite library as a :class:`tuple` " +"of :class:`integers `." msgstr "" -#: ../../library/sqlite3.rst:512 +#: ../../library/sqlite3.rst:515 msgid "" "Integer constant required by the DB-API 2.0, stating the level of thread " "safety the :mod:`!sqlite3` module supports. This attribute is set based on " @@ -693,187 +700,189 @@ msgid "" "underlying SQLite library is compiled with. The SQLite threading modes are:" msgstr "" -#: ../../library/sqlite3.rst:517 +#: ../../library/sqlite3.rst:520 msgid "" "**Single-thread**: In this mode, all mutexes are disabled and SQLite is " "unsafe to use in more than a single thread at once." msgstr "" -#: ../../library/sqlite3.rst:519 +#: ../../library/sqlite3.rst:522 msgid "" "**Multi-thread**: In this mode, SQLite can be safely used by multiple " "threads provided that no single database connection is used simultaneously " "in two or more threads." msgstr "" -#: ../../library/sqlite3.rst:522 +#: ../../library/sqlite3.rst:525 msgid "" "**Serialized**: In serialized mode, SQLite can be safely used by multiple " "threads with no restriction." msgstr "" -#: ../../library/sqlite3.rst:525 +#: ../../library/sqlite3.rst:528 msgid "" "The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " "are as follows:" msgstr "" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "SQLite threading mode" msgstr "SQLite 執行緒模式" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid ":pep:`threadsafety <0249#threadsafety>`" msgstr ":pep:`執行緒安全 <0249#threadsafety>`" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "`SQLITE_THREADSAFE`_" msgstr "`SQLITE_THREADSAFE`_" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "DB-API 2.0 meaning" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "single-thread" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "0" msgstr "0" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "Threads may not share the module" msgstr "" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "multi-thread" msgstr "" -#: ../../library/sqlite3.rst:535 ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:538 ../../library/sqlite3.rst:541 msgid "1" msgstr "1" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "2" msgstr "2" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "Threads may share the module, but not connections" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "serialized" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "3" msgstr "3" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "Threads may share the module, connections and cursors" msgstr "" -#: ../../library/sqlite3.rst:544 +#: ../../library/sqlite3.rst:547 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:549 +#: ../../library/sqlite3.rst:552 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:552 ../../library/sqlite3.rst:562 +#: ../../library/sqlite3.rst:555 ../../library/sqlite3.rst:565 msgid "" "This constant used to reflect the version number of the ``pysqlite`` " "package, a third-party library which used to upstream changes to :mod:`!" "sqlite3`. Today, it carries no meaning or practical value." msgstr "" -#: ../../library/sqlite3.rst:559 +#: ../../library/sqlite3.rst:562 msgid "" "Version number of this module as a :class:`tuple` of :class:`integers " "`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:586 +#: ../../library/sqlite3.rst:589 msgid "" -"These constants are used for the :meth:`Connection.setconfig` and :meth:" -"`~Connection.getconfig` methods." +"These constants are used for the :meth:`Connection.setconfig` " +"and :meth:`~Connection.getconfig` methods." msgstr "" -#: ../../library/sqlite3.rst:589 +#: ../../library/sqlite3.rst:592 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: ../../library/sqlite3.rst:596 +#: ../../library/sqlite3.rst:599 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -#: ../../library/sqlite3.rst:597 +#: ../../library/sqlite3.rst:600 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: ../../library/sqlite3.rst:603 +#: ../../library/sqlite3.rst:606 msgid "Connection objects" msgstr "Connection 物件" -#: ../../library/sqlite3.rst:607 +#: ../../library/sqlite3.rst:610 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " -"is created using :func:`sqlite3.connect`. Their main purpose is creating :" -"class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." +"is created using :func:`sqlite3.connect`. Their main purpose is " +"creating :class:`Cursor` objects, and :ref:`sqlite3-controlling-" +"transactions`." msgstr "" -#: ../../library/sqlite3.rst:614 +#: ../../library/sqlite3.rst:617 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:620 +#: ../../library/sqlite3.rst:623 msgid "" -"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" -"class:`!Connection` object is deleted." +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before " +"a :class:`!Connection` object is deleted." msgstr "" -#: ../../library/sqlite3.rst:623 +#: ../../library/sqlite3.rst:626 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:627 +#: ../../library/sqlite3.rst:630 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " -"single optional parameter *factory*. If supplied, this must be a :term:" -"`callable` returning an instance of :class:`Cursor` or its subclasses." +"single optional parameter *factory*. If supplied, this must be " +"a :term:`callable` returning an instance of :class:`Cursor` or its " +"subclasses." msgstr "" -#: ../../library/sqlite3.rst:634 +#: ../../library/sqlite3.rst:637 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:637 +#: ../../library/sqlite3.rst:640 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:640 +#: ../../library/sqlite3.rst:643 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:643 +#: ../../library/sqlite3.rst:646 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:646 +#: ../../library/sqlite3.rst:649 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:651 +#: ../../library/sqlite3.rst:654 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -882,33 +891,33 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:655 +#: ../../library/sqlite3.rst:658 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:662 +#: ../../library/sqlite3.rst:665 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: ../../library/sqlite3.rst:669 +#: ../../library/sqlite3.rst:672 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was committed by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was committed by this method." msgstr "" -#: ../../library/sqlite3.rst:677 +#: ../../library/sqlite3.rst:680 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was rolled back by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was rolled back by this method." msgstr "" -#: ../../library/sqlite3.rst:685 +#: ../../library/sqlite3.rst:688 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -917,63 +926,63 @@ msgid "" "losing pending changes." msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:698 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:701 +#: ../../library/sqlite3.rst:704 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:707 +#: ../../library/sqlite3.rst:710 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:713 +#: ../../library/sqlite3.rst:716 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:715 +#: ../../library/sqlite3.rst:718 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:718 +#: ../../library/sqlite3.rst:721 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:722 +#: ../../library/sqlite3.rst:725 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:729 +#: ../../library/sqlite3.rst:732 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:734 +#: ../../library/sqlite3.rst:737 msgid "Added the *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:737 ../../library/sqlite3.rst:781 -#: ../../library/sqlite3.rst:849 ../../library/sqlite3.rst:1128 -#: ../../library/sqlite3.rst:1550 ../../library/sqlite3.rst:1593 +#: ../../library/sqlite3.rst:740 ../../library/sqlite3.rst:784 +#: ../../library/sqlite3.rst:852 ../../library/sqlite3.rst:1131 +#: ../../library/sqlite3.rst:1553 ../../library/sqlite3.rst:1596 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:739 +#: ../../library/sqlite3.rst:742 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -995,27 +1004,27 @@ msgstr "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" -#: ../../library/sqlite3.rst:753 +#: ../../library/sqlite3.rst:756 msgid "" "Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " "parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:759 +#: ../../library/sqlite3.rst:762 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:761 +#: ../../library/sqlite3.rst:764 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:764 +#: ../../library/sqlite3.rst:767 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:768 +#: ../../library/sqlite3.rst:771 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1024,31 +1033,31 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:772 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:771 +#: ../../library/sqlite3.rst:774 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:772 ../../library/sqlite3.rst:833 +#: ../../library/sqlite3.rst:775 ../../library/sqlite3.rst:836 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:775 +#: ../../library/sqlite3.rst:778 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:778 +#: ../../library/sqlite3.rst:781 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:783 +#: ../../library/sqlite3.rst:786 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1090,27 +1099,27 @@ msgstr "" "\n" "con.close()" -#: ../../library/sqlite3.rst:812 +#: ../../library/sqlite3.rst:815 msgid "" "Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " "deprecated. These parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:818 +#: ../../library/sqlite3.rst:821 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:820 +#: ../../library/sqlite3.rst:823 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:823 +#: ../../library/sqlite3.rst:826 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:827 +#: ../../library/sqlite3.rst:830 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -1122,39 +1131,39 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:828 +#: ../../library/sqlite3.rst:831 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:830 +#: ../../library/sqlite3.rst:833 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:831 +#: ../../library/sqlite3.rst:834 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:835 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:836 +#: ../../library/sqlite3.rst:839 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:839 +#: ../../library/sqlite3.rst:842 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:841 +#: ../../library/sqlite3.rst:844 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:851 +#: ../../library/sqlite3.rst:854 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1202,30 +1211,30 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:905 +#: ../../library/sqlite3.rst:908 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:909 +#: ../../library/sqlite3.rst:912 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:910 +#: ../../library/sqlite3.rst:913 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:911 +#: ../../library/sqlite3.rst:914 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:913 +#: ../../library/sqlite3.rst:916 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:915 +#: ../../library/sqlite3.rst:918 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1263,33 +1272,33 @@ msgstr "" " print(row)\n" "con.close()" -#: ../../library/sqlite3.rst:941 +#: ../../library/sqlite3.rst:944 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:943 +#: ../../library/sqlite3.rst:946 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:950 +#: ../../library/sqlite3.rst:953 msgid "" "Call this method from a different thread to abort any queries that might be " -"executing on the connection. Aborted queries will raise an :exc:" -"`OperationalError`." +"executing on the connection. Aborted queries will raise " +"an :exc:`OperationalError`." msgstr "" -#: ../../library/sqlite3.rst:957 +#: ../../library/sqlite3.rst:960 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " -"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:" -"`SQLITE_IGNORE` to signal how access to the column should be handled by the " -"underlying SQLite library." +"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, " +"or :const:`SQLITE_IGNORE` to signal how access to the column should be " +"handled by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:964 +#: ../../library/sqlite3.rst:967 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -1299,7 +1308,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:971 +#: ../../library/sqlite3.rst:974 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -1307,21 +1316,21 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:975 +#: ../../library/sqlite3.rst:978 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:977 +#: ../../library/sqlite3.rst:980 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:980 +#: ../../library/sqlite3.rst:983 msgid "" "Passing *authorizer_callback* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:987 +#: ../../library/sqlite3.rst:990 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -1329,59 +1338,60 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:992 +#: ../../library/sqlite3.rst:995 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:995 +#: ../../library/sqlite3.rst:998 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:999 +#: ../../library/sqlite3.rst:1002 msgid "" "Passing *progress_handler* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1006 +#: ../../library/sqlite3.rst:1009 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " "statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:1009 +#: ../../library/sqlite3.rst:1012 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " -"that the backend does not only run statements passed to the :meth:`Cursor." -"execute` methods. Other sources include the :ref:`transaction management " -"` of the :mod:`!sqlite3` module and the " -"execution of triggers defined in the current database." +"that the backend does not only run statements passed to " +"the :meth:`Cursor.execute` methods. Other sources include " +"the :ref:`transaction management ` of " +"the :mod:`!sqlite3` module and the execution of triggers defined in the " +"current database." msgstr "" -#: ../../library/sqlite3.rst:1017 +#: ../../library/sqlite3.rst:1020 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1020 +#: ../../library/sqlite3.rst:1023 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1027 +#: ../../library/sqlite3.rst:1030 msgid "" "Passing *trace_callback* as a keyword argument is deprecated. The parameter " "will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1034 +#: ../../library/sqlite3.rst:1037 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1390,16 +1400,16 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:1043 +#: ../../library/sqlite3.rst:1046 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " "are compiled without this feature. To get loadable extension support, you " -"must pass the :option:`--enable-loadable-sqlite-extensions` option to :" -"program:`configure`." +"must pass the :option:`--enable-loadable-sqlite-extensions` option " +"to :program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:1050 +#: ../../library/sqlite3.rst:1053 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1407,11 +1417,11 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:1054 +#: ../../library/sqlite3.rst:1057 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1060 +#: ../../library/sqlite3.rst:1063 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1441,24 +1451,24 @@ msgid "" " print(row)" msgstr "" -#: ../../library/sqlite3.rst:1086 +#: ../../library/sqlite3.rst:1089 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: ../../library/sqlite3.rst:1090 +#: ../../library/sqlite3.rst:1093 msgid "The path to the SQLite extension." msgstr "" -#: ../../library/sqlite3.rst:1094 +#: ../../library/sqlite3.rst:1097 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: ../../library/sqlite3.rst:1103 +#: ../../library/sqlite3.rst:1106 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1466,29 +1476,29 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1107 +#: ../../library/sqlite3.rst:1110 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1110 +#: ../../library/sqlite3.rst:1113 msgid "Added the *entrypoint* parameter." msgstr "新增 *entrypoint* 參數。" -#: ../../library/sqlite3.rst:1117 +#: ../../library/sqlite3.rst:1120 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " -"when saving an in-memory database for later restoration. Similar to the ``." -"dump`` command in the :program:`sqlite3` shell." +"when saving an in-memory database for later restoration. Similar to the " +"``.dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1121 +#: ../../library/sqlite3.rst:1124 msgid "" "An optional ``LIKE`` pattern for database objects to dump, e.g. " "``prefix_%``. If ``None`` (the default), all database objects will be " "included." msgstr "" -#: ../../library/sqlite3.rst:1130 +#: ../../library/sqlite3.rst:1133 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1498,35 +1508,35 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1141 ../../library/sqlite3.rst:1215 +#: ../../library/sqlite3.rst:1144 ../../library/sqlite3.rst:1218 msgid ":ref:`sqlite3-howto-encoding`" msgstr ":ref:`sqlite3-howto-encoding`" -#: ../../library/sqlite3.rst:1143 +#: ../../library/sqlite3.rst:1146 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/sqlite3.rst:1148 +#: ../../library/sqlite3.rst:1151 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1150 +#: ../../library/sqlite3.rst:1153 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1153 +#: ../../library/sqlite3.rst:1156 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1156 +#: ../../library/sqlite3.rst:1159 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1162 +#: ../../library/sqlite3.rst:1165 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1534,24 +1544,24 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1171 +#: ../../library/sqlite3.rst:1174 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1178 +#: ../../library/sqlite3.rst:1181 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1182 +#: ../../library/sqlite3.rst:1185 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1184 +#: ../../library/sqlite3.rst:1187 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1573,11 +1583,11 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1201 +#: ../../library/sqlite3.rst:1204 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1203 +#: ../../library/sqlite3.rst:1206 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1591,25 +1601,25 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1219 +#: ../../library/sqlite3.rst:1222 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1221 +#: ../../library/sqlite3.rst:1224 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1226 ../../library/sqlite3.rst:1263 +#: ../../library/sqlite3.rst:1229 ../../library/sqlite3.rst:1266 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1229 +#: ../../library/sqlite3.rst:1232 msgid "" -"Example, query the maximum length of an SQL statement for :class:" -"`Connection` ``con`` (the default is 1000000000):" +"Example, query the maximum length of an SQL statement " +"for :class:`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1239 +#: ../../library/sqlite3.rst:1242 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" @@ -1617,7 +1627,7 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" -#: ../../library/sqlite3.rst:1249 +#: ../../library/sqlite3.rst:1252 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1625,22 +1635,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1254 +#: ../../library/sqlite3.rst:1257 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1257 +#: ../../library/sqlite3.rst:1260 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1266 +#: ../../library/sqlite3.rst:1269 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1269 +#: ../../library/sqlite3.rst:1272 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" @@ -1652,25 +1662,25 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" -#: ../../library/sqlite3.rst:1287 +#: ../../library/sqlite3.rst:1290 msgid "Query a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1289 ../../library/sqlite3.rst:1300 +#: ../../library/sqlite3.rst:1292 ../../library/sqlite3.rst:1303 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: ../../library/sqlite3.rst:1298 +#: ../../library/sqlite3.rst:1301 msgid "Set a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1303 +#: ../../library/sqlite3.rst:1306 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: ../../library/sqlite3.rst:1311 +#: ../../library/sqlite3.rst:1314 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1679,114 +1689,114 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1317 +#: ../../library/sqlite3.rst:1320 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1325 +#: ../../library/sqlite3.rst:1328 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1333 +#: ../../library/sqlite3.rst:1336 msgid "" -"Deserialize a :meth:`serialized ` database into a :class:" -"`Connection`. This method causes the database connection to disconnect from " -"database *name*, and reopen *name* as an in-memory database based on the " -"serialization contained in *data*." +"Deserialize a :meth:`serialized ` database into " +"a :class:`Connection`. This method causes the database connection to " +"disconnect from database *name*, and reopen *name* as an in-memory database " +"based on the serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1339 +#: ../../library/sqlite3.rst:1342 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1342 +#: ../../library/sqlite3.rst:1345 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1346 +#: ../../library/sqlite3.rst:1349 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1350 +#: ../../library/sqlite3.rst:1353 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1353 +#: ../../library/sqlite3.rst:1356 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1358 +#: ../../library/sqlite3.rst:1361 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1365 +#: ../../library/sqlite3.rst:1368 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: ../../library/sqlite3.rst:1368 +#: ../../library/sqlite3.rst:1371 msgid "" -"``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" -"mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" -"meth:`rollback` to close transactions." +"``False``: Select :pep:`249`-compliant transaction behaviour, implying " +"that :mod:`!sqlite3` ensures a transaction is always open. " +"Use :meth:`commit` and :meth:`rollback` to close transactions." msgstr "" -#: ../../library/sqlite3.rst:1372 +#: ../../library/sqlite3.rst:1375 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1374 +#: ../../library/sqlite3.rst:1377 msgid "" -"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" -"`rollback` have no effect in this mode." +"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` " +"and :meth:`rollback` have no effect in this mode." msgstr "" -#: ../../library/sqlite3.rst:1377 +#: ../../library/sqlite3.rst:1380 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: ../../library/sqlite3.rst:1381 +#: ../../library/sqlite3.rst:1384 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1383 +#: ../../library/sqlite3.rst:1386 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: ../../library/sqlite3.rst:1386 +#: ../../library/sqlite3.rst:1389 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" -#: ../../library/sqlite3.rst:1390 +#: ../../library/sqlite3.rst:1393 msgid "" -"The :attr:`isolation_level` attribute has no effect unless :attr:" -"`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." +"The :attr:`isolation_level` attribute has no effect " +"unless :attr:`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: ../../library/sqlite3.rst:1397 +#: ../../library/sqlite3.rst:1400 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1400 +#: ../../library/sqlite3.rst:1403 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1407 +#: ../../library/sqlite3.rst:1410 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1796,13 +1806,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1415 +#: ../../library/sqlite3.rst:1418 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1420 +#: ../../library/sqlite3.rst:1423 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1810,57 +1820,57 @@ msgid "" "default)." msgstr "" -#: ../../library/sqlite3.rst:1427 +#: ../../library/sqlite3.rst:1430 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " -"from this connection. Assigning to this attribute does not affect the :attr:" -"`!row_factory` of existing cursors belonging to this connection, only new " -"ones. Is ``None`` by default, meaning each row is returned as a :class:" -"`tuple`." +"from this connection. Assigning to this attribute does not affect " +"the :attr:`!row_factory` of existing cursors belonging to this connection, " +"only new ones. Is ``None`` by default, meaning each row is returned as " +"a :class:`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1434 ../../library/sqlite3.rst:1720 -#: ../../library/sqlite3.rst:1743 +#: ../../library/sqlite3.rst:1437 ../../library/sqlite3.rst:1723 +#: ../../library/sqlite3.rst:1746 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" -#: ../../library/sqlite3.rst:1438 +#: ../../library/sqlite3.rst:1441 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:1443 +#: ../../library/sqlite3.rst:1446 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-encoding`。" -#: ../../library/sqlite3.rst:1447 +#: ../../library/sqlite3.rst:1450 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1454 +#: ../../library/sqlite3.rst:1457 msgid "Cursor objects" msgstr "Cursor 物件" -#: ../../library/sqlite3.rst:1456 +#: ../../library/sqlite3.rst:1459 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " -"created using :meth:`Connection.cursor`, or by using any of the :ref:" -"`connection shortcut methods `." +"created using :meth:`Connection.cursor`, or by using any of " +"the :ref:`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1463 +#: ../../library/sqlite3.rst:1466 msgid "" -"Cursor objects are :term:`iterators `, meaning that if you :meth:" -"`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " -"to fetch the resulting rows:" +"Cursor objects are :term:`iterators `, meaning that if " +"you :meth:`~Cursor.execute` a ``SELECT`` query, you can simply iterate over " +"the cursor to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1474 +#: ../../library/sqlite3.rst:1477 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" @@ -1868,78 +1878,79 @@ msgstr "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" -#: ../../library/sqlite3.rst:1488 +#: ../../library/sqlite3.rst:1491 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1495 +#: ../../library/sqlite3.rst:1498 msgid "" -"Execute a single SQL statement, optionally binding Python values using :ref:" -"`placeholders `." +"Execute a single SQL statement, optionally binding Python values " +"using :ref:`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1499 +#: ../../library/sqlite3.rst:1502 msgid "A single SQL statement." msgstr "單一個 SQL 陳述式。" -#: ../../library/sqlite3.rst:1502 +#: ../../library/sqlite3.rst:1505 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1509 +#: ../../library/sqlite3.rst:1512 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1512 +#: ../../library/sqlite3.rst:1515 msgid "" -"If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" -"attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " -"``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is no open " -"transaction, a transaction is implicitly opened before executing *sql*." +"If :attr:`~Connection.autocommit` " +"is :data:`LEGACY_TRANSACTION_CONTROL`, :attr:`~Connection.isolation_level` " +"is not ``None``, *sql* is an ``INSERT``, ``UPDATE``, ``DELETE``, or " +"``REPLACE`` statement, and there is no open transaction, a transaction is " +"implicitly opened before executing *sql*." msgstr "" -#: ../../library/sqlite3.rst:1521 +#: ../../library/sqlite3.rst:1524 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" -"`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be raised " -"instead." +"placeholders>` are used and *parameters* is a sequence instead of " +"a :class:`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be " +"raised instead." msgstr "" -#: ../../library/sqlite3.rst:1527 +#: ../../library/sqlite3.rst:1530 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1531 +#: ../../library/sqlite3.rst:1534 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1535 +#: ../../library/sqlite3.rst:1538 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1537 +#: ../../library/sqlite3.rst:1540 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1540 +#: ../../library/sqlite3.rst:1543 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1546 +#: ../../library/sqlite3.rst:1549 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statement." msgstr "" -#: ../../library/sqlite3.rst:1552 +#: ../../library/sqlite3.rst:1555 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -1955,13 +1966,13 @@ msgstr "" "# cur 是一個 sqlite3.Cursor 物件\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" -#: ../../library/sqlite3.rst:1567 +#: ../../library/sqlite3.rst:1570 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1574 +#: ../../library/sqlite3.rst:1577 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " @@ -1969,20 +1980,20 @@ msgid "" "be raised instead." msgstr "" -#: ../../library/sqlite3.rst:1583 +#: ../../library/sqlite3.rst:1586 msgid "" -"Execute the SQL statements in *sql_script*. If the :attr:`~Connection." -"autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " -"transaction, an implicit ``COMMIT`` statement is executed first. No other " -"implicit transaction control is performed; any transaction control must be " -"added to *sql_script*." +"Execute the SQL statements in *sql_script*. If " +"the :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and " +"there is a pending transaction, an implicit ``COMMIT`` statement is executed " +"first. No other implicit transaction control is performed; any transaction " +"control must be added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1591 +#: ../../library/sqlite3.rst:1594 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1595 +#: ../../library/sqlite3.rst:1598 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -2002,20 +2013,20 @@ msgstr "" " COMMIT;\n" "\"\"\")" -#: ../../library/sqlite3.rst:1608 +#: ../../library/sqlite3.rst:1611 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1616 +#: ../../library/sqlite3.rst:1619 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1619 +#: ../../library/sqlite3.rst:1622 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -2023,7 +2034,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1625 +#: ../../library/sqlite3.rst:1628 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -2031,44 +2042,44 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1632 +#: ../../library/sqlite3.rst:1635 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1639 +#: ../../library/sqlite3.rst:1642 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1641 +#: ../../library/sqlite3.rst:1644 msgid "" -"The cursor will be unusable from this point forward; a :exc:" -"`ProgrammingError` exception will be raised if any operation is attempted " -"with the cursor." +"The cursor will be unusable from this point forward; " +"a :exc:`ProgrammingError` exception will be raised if any operation is " +"attempted with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1646 ../../library/sqlite3.rst:1650 +#: ../../library/sqlite3.rst:1649 ../../library/sqlite3.rst:1653 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1654 +#: ../../library/sqlite3.rst:1657 msgid "" -"Read/write attribute that controls the number of rows returned by :meth:" -"`fetchmany`. The default value is 1 which means a single row would be " -"fetched per call." +"Read/write attribute that controls the number of rows returned " +"by :meth:`fetchmany`. The default value is 1 which means a single row would " +"be fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1659 +#: ../../library/sqlite3.rst:1662 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " -"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" -"`con.cursor() ` will have a :attr:`connection` attribute " -"that refers to *con*:" +"belonging to the cursor. A :class:`Cursor` object created by " +"calling :meth:`con.cursor() ` will have " +"a :attr:`connection` attribute that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1664 +#: ../../library/sqlite3.rst:1667 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2082,18 +2093,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1674 +#: ../../library/sqlite3.rst:1677 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1678 +#: ../../library/sqlite3.rst:1681 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1682 +#: ../../library/sqlite3.rst:1685 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2103,15 +2114,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1690 +#: ../../library/sqlite3.rst:1693 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1692 +#: ../../library/sqlite3.rst:1695 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1697 +#: ../../library/sqlite3.rst:1700 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2121,7 +2132,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1708 +#: ../../library/sqlite3.rst:1711 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2130,61 +2141,61 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1715 +#: ../../library/sqlite3.rst:1718 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" -"Cursor` was created. Assigning to this attribute does not affect :attr:" -"`Connection.row_factory` of the parent connection." +"Cursor` was created. Assigning to this attribute does not " +"affect :attr:`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1731 +#: ../../library/sqlite3.rst:1734 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1735 +#: ../../library/sqlite3.rst:1738 msgid "" -"A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." -"row_factory` for :class:`Connection` objects. It supports iteration, " -"equality testing, :func:`len`, and :term:`mapping` access by column name and " -"index." +"A :class:`!Row` instance serves as a highly " +"optimized :attr:`~Connection.row_factory` for :class:`Connection` objects. " +"It supports iteration, equality testing, :func:`len`, and :term:`mapping` " +"access by column name and index." msgstr "" -#: ../../library/sqlite3.rst:1740 +#: ../../library/sqlite3.rst:1743 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1747 +#: ../../library/sqlite3.rst:1750 msgid "" "Return a :class:`list` of column names as :class:`strings `. " -"Immediately after a query, it is the first member of each tuple in :attr:" -"`Cursor.description`." +"Immediately after a query, it is the first member of each tuple " +"in :attr:`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1751 +#: ../../library/sqlite3.rst:1754 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1758 +#: ../../library/sqlite3.rst:1761 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1764 +#: ../../library/sqlite3.rst:1767 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " -"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" -"`len(blob) ` to get the size (number of bytes) of the blob. Use indices " -"and :term:`slices ` for direct access to the blob data." +"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. " +"Call :func:`len(blob) ` to get the size (number of bytes) of the blob. " +"Use indices and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1769 +#: ../../library/sqlite3.rst:1772 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1772 +#: ../../library/sqlite3.rst:1775 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2206,37 +2217,37 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1800 +#: ../../library/sqlite3.rst:1803 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1802 +#: ../../library/sqlite3.rst:1805 msgid "" -"The blob will be unusable from this point onward. An :class:`~sqlite3." -"Error` (or subclass) exception will be raised if any further operation is " -"attempted with the blob." +"The blob will be unusable from this point onward. " +"An :class:`~sqlite3.Error` (or subclass) exception will be raised if any " +"further operation is attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1808 +#: ../../library/sqlite3.rst:1811 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " -"will be returned. When *length* is not specified, or is negative, :meth:" -"`~Blob.read` will read until the end of the blob." +"will be returned. When *length* is not specified, or is " +"negative, :meth:`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1816 +#: ../../library/sqlite3.rst:1819 msgid "" "Write *data* to the blob at the current offset. This function cannot change " -"the blob length. Writing beyond the end of the blob will raise :exc:" -"`ValueError`." +"the blob length. Writing beyond the end of the blob will " +"raise :exc:`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1822 +#: ../../library/sqlite3.rst:1825 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1826 +#: ../../library/sqlite3.rst:1829 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2244,26 +2255,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1834 +#: ../../library/sqlite3.rst:1837 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1838 +#: ../../library/sqlite3.rst:1841 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1846 +#: ../../library/sqlite3.rst:1849 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1848 +#: ../../library/sqlite3.rst:1851 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1852 +#: ../../library/sqlite3.rst:1855 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2271,39 +2282,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1859 +#: ../../library/sqlite3.rst:1862 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1863 +#: ../../library/sqlite3.rst:1866 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1868 +#: ../../library/sqlite3.rst:1871 msgid "" -"The numeric error code from the `SQLite API `_" +"The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1875 +#: ../../library/sqlite3.rst:1878 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1882 +#: ../../library/sqlite3.rst:1885 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1889 +#: ../../library/sqlite3.rst:1892 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2311,14 +2322,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1896 +#: ../../library/sqlite3.rst:1899 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1902 +#: ../../library/sqlite3.rst:1905 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2326,28 +2337,28 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1910 +#: ../../library/sqlite3.rst:1913 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1915 +#: ../../library/sqlite3.rst:1918 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1922 +#: ../../library/sqlite3.rst:1925 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " -"closed :class:`Connection`. ``ProgrammingError`` is a subclass of :exc:" -"`DatabaseError`." +"closed :class:`Connection`. ``ProgrammingError`` is a subclass " +"of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1929 +#: ../../library/sqlite3.rst:1932 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2356,78 +2367,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1939 +#: ../../library/sqlite3.rst:1942 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1941 +#: ../../library/sqlite3.rst:1944 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1944 +#: ../../library/sqlite3.rst:1947 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1955 +#: ../../library/sqlite3.rst:1958 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1955 ../../library/sqlite3.rst:1972 +#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1975 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1961 +#: ../../library/sqlite3.rst:1964 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1972 +#: ../../library/sqlite3.rst:1975 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1978 +#: ../../library/sqlite3.rst:1981 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2436,47 +2447,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1988 +#: ../../library/sqlite3.rst:1991 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1992 +#: ../../library/sqlite3.rst:1995 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1996 +#: ../../library/sqlite3.rst:1999 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1998 +#: ../../library/sqlite3.rst:2001 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:2000 +#: ../../library/sqlite3.rst:2003 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:2002 +#: ../../library/sqlite3.rst:2005 msgid "" -"A converter for :ref:`declared ` \"date\" types to :" -"class:`datetime.date` objects." +"A converter for :ref:`declared ` \"date\" types " +"to :class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:2004 +#: ../../library/sqlite3.rst:2007 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:2010 +#: ../../library/sqlite3.rst:2013 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2484,42 +2495,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:2023 +#: ../../library/sqlite3.rst:2026 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:2025 +#: ../../library/sqlite3.rst:2028 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:2030 +#: ../../library/sqlite3.rst:2033 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:2032 +#: ../../library/sqlite3.rst:2035 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:2038 +#: ../../library/sqlite3.rst:2041 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2042 +#: ../../library/sqlite3.rst:2045 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2050 +#: ../../library/sqlite3.rst:2053 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2055 +#: ../../library/sqlite3.rst:2058 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2057 +#: ../../library/sqlite3.rst:2060 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2527,7 +2538,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2062 +#: ../../library/sqlite3.rst:2065 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2538,7 +2549,7 @@ msgid "" ">>> cur.execute(sql)" msgstr "" -#: ../../library/sqlite3.rst:2070 +#: ../../library/sqlite3.rst:2073 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2546,7 +2557,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2075 +#: ../../library/sqlite3.rst:2078 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2557,7 +2568,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2086 +#: ../../library/sqlite3.rst:2089 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2578,24 +2589,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2113 +#: ../../library/sqlite3.rst:2116 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2120 +#: ../../library/sqlite3.rst:2123 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2122 +#: ../../library/sqlite3.rst:2125 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2126 +#: ../../library/sqlite3.rst:2129 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2605,11 +2616,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2138 +#: ../../library/sqlite3.rst:2141 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2140 +#: ../../library/sqlite3.rst:2143 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2619,7 +2630,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2148 +#: ../../library/sqlite3.rst:2151 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2651,18 +2662,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2172 +#: ../../library/sqlite3.rst:2175 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2174 +#: ../../library/sqlite3.rst:2177 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2178 +#: ../../library/sqlite3.rst:2181 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2696,36 +2707,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2205 +#: ../../library/sqlite3.rst:2208 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2207 +#: ../../library/sqlite3.rst:2210 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2212 +#: ../../library/sqlite3.rst:2215 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2215 +#: ../../library/sqlite3.rst:2218 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2220 +#: ../../library/sqlite3.rst:2223 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2223 +#: ../../library/sqlite3.rst:2226 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2735,32 +2746,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2229 +#: ../../library/sqlite3.rst:2232 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2233 +#: ../../library/sqlite3.rst:2236 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2234 +#: ../../library/sqlite3.rst:2237 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2235 +#: ../../library/sqlite3.rst:2238 msgid "" -"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." -"PARSE_COLNAMES``. Column names take precedence over declared types." +"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | " +"sqlite3.PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2239 +#: ../../library/sqlite3.rst:2242 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2241 +#: ../../library/sqlite3.rst:2244 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2802,15 +2813,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2292 +#: ../../library/sqlite3.rst:2295 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2294 +#: ../../library/sqlite3.rst:2297 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2296 +#: ../../library/sqlite3.rst:2299 msgid "" "import datetime\n" "import sqlite3\n" @@ -2848,23 +2859,23 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2356 +#: ../../library/sqlite3.rst:2359 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2358 +#: ../../library/sqlite3.rst:2361 msgid "" -"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" -"meth:`~Connection.executescript` methods of the :class:`Connection` class, " -"your code can be written more concisely because you don't have to create the " -"(often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" -"`Cursor` objects are created implicitly and these shortcut methods return " -"the cursor objects. This way, you can execute a ``SELECT`` statement and " -"iterate over it directly using only a single call on the :class:`Connection` " -"object." +"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, " +"and :meth:`~Connection.executescript` methods of the :class:`Connection` " +"class, your code can be written more concisely because you don't have to " +"create the (often superfluous) :class:`Cursor` objects explicitly. Instead, " +"the :class:`Cursor` objects are created implicitly and these shortcut " +"methods return the cursor objects. This way, you can execute a ``SELECT`` " +"statement and iterate over it directly using only a single call on " +"the :class:`Connection` object." msgstr "" -#: ../../library/sqlite3.rst:2367 +#: ../../library/sqlite3.rst:2370 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2888,11 +2899,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2399 +#: ../../library/sqlite3.rst:2402 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2401 +#: ../../library/sqlite3.rst:2404 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2904,25 +2915,25 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2412 +#: ../../library/sqlite3.rst:2415 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2417 +#: ../../library/sqlite3.rst:2420 msgid "" "The context manager neither implicitly opens a new transaction nor closes " -"the connection. If you need a closing context manager, consider using :meth:" -"`contextlib.closing`." +"the connection. If you need a closing context manager, consider " +"using :meth:`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2421 +#: ../../library/sqlite3.rst:2424 msgid "" "con = sqlite3.connect(\":memory:\")\n" -"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " -"UNIQUE)\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)" +"\")\n" "\n" "# Successful, con.commit() is called automatically afterwards\n" "with con:\n" @@ -2942,19 +2953,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2451 +#: ../../library/sqlite3.rst:2454 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2453 +#: ../../library/sqlite3.rst:2456 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2455 +#: ../../library/sqlite3.rst:2458 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2457 +#: ../../library/sqlite3.rst:2460 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2968,13 +2979,13 @@ msgstr "" "OperationalError: attempt to write a readonly database\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2465 +#: ../../library/sqlite3.rst:2468 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2468 +#: ../../library/sqlite3.rst:2471 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2984,11 +2995,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2475 +#: ../../library/sqlite3.rst:2478 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2477 +#: ../../library/sqlite3.rst:2480 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3014,32 +3025,32 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2491 +#: ../../library/sqlite3.rst:2494 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2500 +#: ../../library/sqlite3.rst:2503 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2502 +#: ../../library/sqlite3.rst:2505 msgid "" -"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" -"class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." -"Row` class or a custom :attr:`~Cursor.row_factory`." +"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If " +"a :class:`!tuple` does not suit your needs, you can use " +"the :class:`sqlite3.Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2510 msgid "" -"While :attr:`!row_factory` exists as an attribute both on the :class:" -"`Cursor` and the :class:`Connection`, it is recommended to set :class:" -"`Connection.row_factory`, so all cursors created from the connection will " -"use the same row factory." +"While :attr:`!row_factory` exists as an attribute both on " +"the :class:`Cursor` and the :class:`Connection`, it is recommended to " +"set :class:`Connection.row_factory`, so all cursors created from the " +"connection will use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2512 +#: ../../library/sqlite3.rst:2515 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3047,7 +3058,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2517 +#: ../../library/sqlite3.rst:2520 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3055,11 +3066,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2522 +#: ../../library/sqlite3.rst:2525 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2524 +#: ../../library/sqlite3.rst:2527 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3074,7 +3085,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2540 +#: ../../library/sqlite3.rst:2543 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3082,13 +3093,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2545 +#: ../../library/sqlite3.rst:2548 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2548 +#: ../../library/sqlite3.rst:2551 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3098,12 +3109,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2554 +#: ../../library/sqlite3.rst:2557 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2556 +#: ../../library/sqlite3.rst:2559 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3119,11 +3130,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2565 +#: ../../library/sqlite3.rst:2568 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2567 +#: ../../library/sqlite3.rst:2570 msgid "" "from collections import namedtuple\n" "\n" @@ -3139,11 +3150,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2576 +#: ../../library/sqlite3.rst:2579 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2578 +#: ../../library/sqlite3.rst:2581 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3169,69 +3180,69 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2592 +#: ../../library/sqlite3.rst:2595 msgid "" -"With some adjustments, the above recipe can be adapted to use a :class:" -"`~dataclasses.dataclass`, or any other custom class, instead of a :class:" -"`~collections.namedtuple`." +"With some adjustments, the above recipe can be adapted to use " +"a :class:`~dataclasses.dataclass`, or any other custom class, instead of " +"a :class:`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2600 +#: ../../library/sqlite3.rst:2603 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2602 +#: ../../library/sqlite3.rst:2605 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " -"fail for other encodings and invalid UTF-8. You can use a custom :attr:" -"`~Connection.text_factory` to handle such cases." +"fail for other encodings and invalid UTF-8. You can use a " +"custom :attr:`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2608 +#: ../../library/sqlite3.rst:2611 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " "even arbitrary data. To demonstrate, let's assume we have a database with " "ISO-8859-2 (Latin-2) encoded text, for example a table of Czech-English " -"dictionary entries. Assuming we now have a :class:`Connection` instance :py:" -"data:`!con` connected to this database, we can decode the Latin-2 encoded " -"text using this :attr:`~Connection.text_factory`:" +"dictionary entries. Assuming we now have a :class:`Connection` " +"instance :py:data:`!con` connected to this database, we can decode the " +"Latin-2 encoded text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2617 +#: ../../library/sqlite3.rst:2620 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2621 +#: ../../library/sqlite3.rst:2624 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2624 +#: ../../library/sqlite3.rst:2627 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2630 +#: ../../library/sqlite3.rst:2633 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2635 +#: ../../library/sqlite3.rst:2638 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2641 +#: ../../library/sqlite3.rst:2644 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2647 +#: ../../library/sqlite3.rst:2650 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2649 +#: ../../library/sqlite3.rst:2652 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3239,135 +3250,133 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2658 +#: ../../library/sqlite3.rst:2661 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2660 +#: ../../library/sqlite3.rst:2663 msgid "" -"The recommended way of controlling transaction behaviour is through the :" -"attr:`Connection.autocommit` attribute, which should preferably be set using " -"the *autocommit* parameter of :func:`connect`." +"The recommended way of controlling transaction behaviour is through " +"the :attr:`Connection.autocommit` attribute, which should preferably be set " +"using the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2665 +#: ../../library/sqlite3.rst:2668 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2669 +#: ../../library/sqlite3.rst:2672 msgid "" -":mod:`!sqlite3` ensures that a transaction is always open, so :func:" -"`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " -"implicitly open a new transaction (immediately after closing the pending " -"one, for the latter two). :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements " -"when opening transactions." +":mod:`!sqlite3` ensures that a transaction is always open, " +"so :func:`connect`, :meth:`Connection.commit`, " +"and :meth:`Connection.rollback` will implicitly open a new transaction " +"(immediately after closing the pending one, for the latter two). :mod:`!" +"sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2674 +#: ../../library/sqlite3.rst:2677 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2675 +#: ../../library/sqlite3.rst:2678 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2676 +#: ../../library/sqlite3.rst:2679 msgid "" -"An implicit rollback is performed if the database is :meth:`~Connection." -"close`-ed with pending changes." +"An implicit rollback is performed if the database " +"is :meth:`~Connection.close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2679 +#: ../../library/sqlite3.rst:2682 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " "effect. Note that SQLite's autocommit mode is distinct from the :pep:`249`-" -"compliant :attr:`Connection.autocommit` attribute; use :attr:`Connection." -"in_transaction` to query the low-level SQLite autocommit mode." +"compliant :attr:`Connection.autocommit` attribute; " +"use :attr:`Connection.in_transaction` to query the low-level SQLite " +"autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2687 +#: ../../library/sqlite3.rst:2690 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " -"control behaviour to the :attr:`Connection.isolation_level` attribute. See :" -"ref:`sqlite3-transaction-control-isolation-level` for more information." +"control behaviour to the :attr:`Connection.isolation_level` attribute. " +"See :ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2696 +#: ../../library/sqlite3.rst:2699 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2700 +#: ../../library/sqlite3.rst:2703 msgid "" -"The recommended way of controlling transactions is via the :attr:" -"`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" -"autocommit`." +"The recommended way of controlling transactions is via " +"the :attr:`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-" +"control-autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2704 +#: ../../library/sqlite3.rst:2707 msgid "" -"If :attr:`Connection.autocommit` is set to :data:" -"`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " -"controlled using the :attr:`Connection.isolation_level` attribute. " +"If :attr:`Connection.autocommit` is set " +"to :data:`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour " +"is controlled using the :attr:`Connection.isolation_level` attribute. " "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2710 +#: ../../library/sqlite3.rst:2713 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " -"``None``, new transactions are implicitly opened before :meth:`~Cursor." -"execute` and :meth:`~Cursor.executemany` executes ``INSERT``, ``UPDATE``, " -"``DELETE``, or ``REPLACE`` statements; for other statements, no implicit " -"transaction handling is performed. Use the :meth:`~Connection.commit` and :" -"meth:`~Connection.rollback` methods to respectively commit and roll back " -"pending transactions. You can choose the underlying `SQLite transaction " -"behaviour`_ — that is, whether and what type of ``BEGIN`` statements :mod:`!" -"sqlite3` implicitly executes – via the :attr:`~Connection.isolation_level` " -"attribute." +"``None``, new transactions are implicitly opened " +"before :meth:`~Cursor.execute` and :meth:`~Cursor.executemany` executes " +"``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statements; for other " +"statements, no implicit transaction handling is performed. Use " +"the :meth:`~Connection.commit` and :meth:`~Connection.rollback` methods to " +"respectively commit and roll back pending transactions. You can choose the " +"underlying `SQLite transaction behaviour`_ — that is, whether and what type " +"of ``BEGIN`` statements :mod:`!sqlite3` implicitly executes – via " +"the :attr:`~Connection.isolation_level` attribute." msgstr "" -#: ../../library/sqlite3.rst:2723 +#: ../../library/sqlite3.rst:2726 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " "`autocommit mode`_, but also allows the user to perform their own " "transaction handling using explicit SQL statements. The underlying SQLite " -"library autocommit mode can be queried using the :attr:`~Connection." -"in_transaction` attribute." +"library autocommit mode can be queried using " +"the :attr:`~Connection.in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2731 +#: ../../library/sqlite3.rst:2734 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2735 +#: ../../library/sqlite3.rst:2738 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2739 +#: ../../library/sqlite3.rst:2742 msgid "" -"The recommended way of controlling transactions is now via the :attr:" -"`~Connection.autocommit` attribute." +"The recommended way of controlling transactions is now via " +"the :attr:`~Connection.autocommit` attribute." msgstr "" -#: ../../library/sqlite3.rst:1490 +#: ../../library/sqlite3.rst:1493 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1490 ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1493 ../../library/sqlite3.rst:1494 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1494 msgid ": (colon)" msgstr ": (冒號)" - -#~ msgid "`threadsafety`_" -#~ msgstr "`threadsafety`_" diff --git a/library/ssl.po b/library/ssl.po index a00c5acbd3..8a3cf24926 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -89,15 +89,16 @@ msgid "" "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " "certificate of the other side of the connection, :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection or :meth:" -"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"retrieves the cipher being used for the secure connection " +"or :meth:`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " "certificate chain." msgstr "" "此模組提供了一個 :class:`ssl.SSLSocket` 類別,它是從 :class:`socket.socket` " "衍生出來的,並且提供類似 socket 的包裝器,讓使用 SSL 進行資料傳輸時,可以進行" "資料的加密及解密。它也提供了一些額外的方法,如 :meth:`getpeercert`,用於取得" -"連結另一端的憑證,以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " -"(cipher)。" +"連結另一端的憑證;以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " +"(cipher);和 :meth:`get_verified_chain`、:meth:`get_unverified_chain` 能用於" +"取得憑證鏈。" #: ../../library/ssl.rst:51 msgid "" @@ -142,9 +143,10 @@ msgstr "Socket 建立" #: ../../library/ssl.rst:79 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method. The helper function :func:`create_default_context` " -"returns a new context with secure default settings." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method. The helper " +"function :func:`create_default_context` returns a new context with secure " +"default settings." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`SSLContext.wrap_socket` 方法來建立。輔" "助函式 :func:`create_default_context` 會回傳有安全預設設定的新語境 " @@ -245,31 +247,31 @@ msgid "" "If all three are :const:`None`, this function can choose to trust the " "system's default CA certificates instead." msgstr "" -"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就像 :meth:" -"`SSLContext.load_verify_locations` 一樣。如果三個值都是 :const:`None`,此函式" -"會自動選擇系統預設的 CA 憑證。" +"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就" +"像 :meth:`SSLContext.load_verify_locations` 一樣。如果三個值都" +"是 :const:`None`,此函式會自動選擇系統預設的 CA 憑證。" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 #: ../../library/ssl.rst:141 msgid "" -"The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " -"high encryption cipher suites without RC4 and without unauthenticated cipher " -"suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* sets :data:" -"`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either loads CA " -"certificates (when at least one of *cafile*, *capath* or *cadata* is given) " -"or uses :meth:`SSLContext.load_default_certs` to load default CA " +"The settings are: :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` " +"with high encryption cipher suites without RC4 and without unauthenticated " +"cipher suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* " +"sets :data:`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either " +"loads CA certificates (when at least one of *cafile*, *capath* or *cadata* " +"is given) or uses :meth:`SSLContext.load_default_certs` to load default CA " "certificates." msgstr "" -"這些設定包含::data:`PROTOCOL_TLS_CLIENT` 或 :data:`PROTOCOL_TLS_SERVER`、:" -"data:`OP_NO_SSLv2`、以及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和" -"未經身份驗證的加密套件。如果將 *purpose* 設定為 :const:`~Purpose." -"SERVER_AUTH`,則會把 :data:`~SSLContext.verify_mode` 設為 :data:" -"`CERT_REQUIRED` 並使用設定的 CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一" -"個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." -"load_default_certs` 。" +"這些設定包含::data:`PROTOCOL_TLS_CLIENT` " +"或 :data:`PROTOCOL_TLS_SERVER`、:data:`OP_NO_SSLv2`、以" +"及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和未經身份驗證的加密套" +"件。如果將 *purpose* 設定為 :const:`~Purpose.SERVER_AUTH`,則會" +"把 :data:`~SSLContext.verify_mode` 設為 :data:`CERT_REQUIRED` 並使用設定的 " +"CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一個值有被設定時) 或使用預設的 " +"CA 憑證 :meth:`SSLContext.load_default_certs` 。" #: ../../library/ssl.rst:150 msgid "" @@ -277,16 +279,16 @@ msgid "" "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" -"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變數 :envvar:" -"`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " -"(logging)。" +"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變" +"數 :envvar:`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記" +"錄 (logging)。" #: ../../library/ssl.rst:154 msgid "" -"The default settings for this context include :data:" -"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " -"underlying OpenSSL implementation behave more like a conforming " -"implementation of :rfc:`5280`, in exchange for a small amount of " +"The default settings for this context " +"include :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. " +"These make the underlying OpenSSL implementation behave more like a " +"conforming implementation of :rfc:`5280`, in exchange for a small amount of " "incompatibility with older X.509 certificates." msgstr "" @@ -301,8 +303,8 @@ msgstr "" #: ../../library/ssl.rst:165 msgid "" -"If your application needs specific settings, you should create a :class:" -"`SSLContext` and apply the settings yourself." +"If your application needs specific settings, you should create " +"a :class:`SSLContext` and apply the settings yourself." msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" @@ -313,9 +315,9 @@ msgid "" "with a :class:`SSLContext` created by this function that they get an error " "stating \"Protocol or cipher suite mismatch\", it may be that they only " "support SSL3.0 which this function excludes using the :data:`OP_NO_SSLv3`. " -"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this function but " -"still allow SSL 3.0 connections you can re-enable them using::" +"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this " +"function but still allow SSL 3.0 connections you can re-enable them using::" msgstr "" "如果你發現某些舊的客戶端或伺服器常適用此函式建立的 :class:`SSLContext` 連線" "時,收到 \"Protocol or cipher suite mismatch\" 錯誤,這可能是因為他們的系統僅" @@ -340,13 +342,12 @@ msgid "" msgstr "" #: ../../library/ssl.rst:187 -#, fuzzy msgid "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" msgstr "" -"ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" -"ctx.options &= ~ssl.OP_NO_SSLv3" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" #: ../../library/ssl.rst:194 msgid "RC4 was dropped from the default cipher string." @@ -366,16 +367,17 @@ msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支 #: ../../library/ssl.rst:208 msgid "" -"The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." +"The context now uses :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol instead of " +"generic :data:`PROTOCOL_TLS`." msgstr "" -"當前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " +"目前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" #: ../../library/ssl.rst:214 msgid "" -"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" -"`VERIFY_X509_STRICT` in its default verify flags." +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` " +"and :data:`VERIFY_X509_STRICT` in its default verify flags." msgstr "" #: ../../library/ssl.rst:219 @@ -392,9 +394,9 @@ msgid "" "OpenSSL library." msgstr "" "引發由底層 SSL 實作(目前由 OpenSSL 函式庫提供)所引發的錯誤訊息。這表示在覆" -"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤是 :exc:" -"`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " -"函式庫提供。" +"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤" +"是 :exc:`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 " +"OpenSSL 函式庫提供。" #: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." @@ -490,16 +492,16 @@ msgstr "隨機產生" #: ../../library/ssl.rst:319 msgid "" -"Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" -"`SSLError` if the PRNG has not been seeded with enough data or if the " -"operation is not supported by the current RAND method. :func:`RAND_status` " -"can be used to check the status of the PRNG and :func:`RAND_add` can be used " -"to seed the PRNG." +"Return *num* cryptographically strong pseudo-random bytes. Raises " +"an :class:`SSLError` if the PRNG has not been seeded with enough data or if " +"the operation is not supported by the current RAND " +"method. :func:`RAND_status` can be used to check the status of the PRNG " +"and :func:`RAND_add` can be used to seed the PRNG." msgstr "" "回傳 *num* 個加密性強的偽隨機位元組。如果 PRNG 未使用足夠的資料做為隨機種子 " -"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯誤。:" -"func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" -"為 PRNG 設定隨機種子。" +"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯" +"誤。:func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可" +"以用來為 PRNG 設定隨機種子。" #: ../../library/ssl.rst:325 msgid "For almost all applications :func:`os.urandom` is preferable." @@ -512,20 +514,21 @@ msgid "" "Cryptographically_secure_pseudorandom_number_generator>`_, to get the " "requirements of a cryptographically strong generator." msgstr "" -"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了" -"解密碼學安全偽隨機數產生器的需求。" +"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了解密碼學" +"安全偽隨機數產生器的需求。" #: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " -"with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." -"RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of the pseudo-" -"random number generator." +"with 'enough' randomness, and ``False`` otherwise. You can " +"use :func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness " +"of the pseudo-random number generator." msgstr "" "如果 SSL 偽隨機數產生器已經使用「足夠的」隨機性進行隨機種子生成,則回傳 " -"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" -"`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" +"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式" +"和 :func:`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" #: ../../library/ssl.rst:343 msgid "" @@ -564,18 +567,18 @@ msgstr "以下是一個範例:" msgid "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" -">>> timestamp \n" +">>> timestamp\n" "1515144883\n" ">>> from datetime import datetime\n" -">>> print(datetime.utcfromtimestamp(timestamp)) \n" +">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" msgstr "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" -">>> timestamp \n" +">>> timestamp\n" "1515144883\n" ">>> from datetime import datetime\n" -">>> print(datetime.utcfromtimestamp(timestamp)) \n" +">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" #: ../../library/ssl.rst:377 @@ -598,19 +601,19 @@ msgid "" "PEM-encoded string. If ``ssl_version`` is specified, uses that version of " "the SSL protocol to attempt to connect to the server. If *ca_certs* is " "specified, it should be a file containing a list of root certificates, the " -"same format as used for the *cafile* parameter in :meth:`SSLContext." -"load_verify_locations`. The call will attempt to validate the server " -"certificate against that set of root certificates, and will fail if the " -"validation attempt fails. A timeout can be specified with the ``timeout`` " -"parameter." +"same format as used for the *cafile* parameter " +"in :meth:`SSLContext.load_verify_locations`. The call will attempt to " +"validate the server certificate against that set of root certificates, and " +"will fail if the validation attempt fails. A timeout can be specified with " +"the ``timeout`` parameter." msgstr "" "輸入使用 SSL 保護的伺服器的地址 ``addr``,輸入形式為一個 pair (*hostname*, " -"*port-number*),獲取該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " +"*port-number*),取得該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " "``ssl_version``,則使用指定的 SSL 協議來嘗試與伺服器連線。如果指定 " -"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並與 :meth:`SSLContext." -"load_verify_locations` 中的參數 *cafile* 所使用的格式相同。此呼叫將嘗試使用該" -"組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " -"參數指定超時時間。" +"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並" +"與 :meth:`SSLContext.load_verify_locations` 中的參數 *cafile* 所使用的格式相" +"同。此呼叫將嘗試使用該組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失" +"敗。可以使用 ``timeout`` 參數指定超時時間。" #: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." @@ -618,11 +621,11 @@ msgstr "此函式現在是與 IPv6 相容的。" #: ../../library/ssl.rst:402 msgid "" -"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" -"`PROTOCOL_TLS` for maximum compatibility with modern servers." +"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` " +"to :data:`PROTOCOL_TLS` for maximum compatibility with modern servers." msgstr "" -"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" -"`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" +"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改" +"為 :data:`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" #: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." @@ -649,9 +652,9 @@ msgid "" "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " "The return value is a :term:`named tuple` ``DefaultVerifyPaths``:" msgstr "" -"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑與 :" -"meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" -"`named tuple` ``DefaultVerifyPaths``:" +"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑" +"與 :meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一" +"個 :term:`named tuple` ``DefaultVerifyPaths``:" #: ../../library/ssl.rst:426 msgid "" @@ -697,15 +700,17 @@ msgstr "" #: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 " -"data. Trust specifies the purpose of the certificate as a set of OIDS or " -"exactly ``True`` if the certificate is trustworthy for all purposes." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data. Trust specifies the purpose of the certificate as a set " +"of OIDS or exactly ``True`` if the certificate is trustworthy for all " +"purposes." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" -"組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"Trust 通過一組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 " +"``True``。" #: ../../library/ssl.rst:448 ../../library/ssl.rst:1599 #: ../../library/ssl.rst:1898 @@ -733,12 +738,13 @@ msgstr "" #: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" #: ../../library/ssl.rst:475 msgid "Constants" @@ -753,10 +759,11 @@ msgstr "" #: ../../library/ssl.rst:483 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" -"`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " -"just about any cert is accepted. Validation errors, such as untrusted or " -"expired cert, are ignored and do not abort the TLS/SSL handshake." +"Possible value for :attr:`SSLContext.verify_mode`. Except " +"for :const:`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side " +"sockets, just about any cert is accepted. Validation errors, such as " +"untrusted or expired cert, are ignored and do not abort the TLS/SSL " +"handshake." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。除了 :attr:`SSLContext.verify_mode` " "外,這是預設的模式。對於客戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," @@ -776,13 +783,14 @@ msgstr "參閱下方 :ref:`ssl-security` 的討論。" #: ../../library/ssl.rst:496 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" -"`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " -"recommended to use :const:`CERT_REQUIRED` for client-side sockets instead." +"Possible value for :attr:`SSLContext.verify_mode`. In client " +"mode, :const:`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. " +"It is recommended to use :const:`CERT_REQUIRED` for client-side sockets " +"instead." msgstr "" -":attr:`SSLContext.verify_mode` 可能的值。在客戶端模式下,:const:" -"`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " -"推薦改用 :const:`CERT_REQUIRED`。" +":attr:`SSLContext.verify_mode` 可能的值。在客戶端模式" +"下,:const:`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶" +"端 sockets 推薦改用 :const:`CERT_REQUIRED`。" #: ../../library/ssl.rst:501 msgid "" @@ -798,29 +806,30 @@ msgstr "" #: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" -"Use of this setting requires a valid set of CA certificates to be passed to :" -"meth:`SSLContext.load_verify_locations`." +"Use of this setting requires a valid set of CA certificates to be passed " +"to :meth:`SSLContext.load_verify_locations`." msgstr "" -"使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." -"load_verify_locations`。" +"使用此設定需要將一組有效的 CA 憑證傳送" +"給 :meth:`SSLContext.load_verify_locations`。" #: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " -"certificates are required from the other side of the socket connection; an :" -"class:`SSLError` will be raised if no certificate is provided, or if its " +"certificates are required from the other side of the socket connection; " +"an :class:`SSLError` will be raised if no certificate is provided, or if its " "validation fails. This mode is **not** sufficient to verify a certificate in " -"client mode as it does not match hostnames. :attr:`~SSLContext." -"check_hostname` must be enabled as well to verify the authenticity of a " -"cert. :const:`PROTOCOL_TLS_CLIENT` uses :const:`CERT_REQUIRED` and enables :" -"attr:`~SSLContext.check_hostname` by default." +"client mode as it does not match " +"hostnames. :attr:`~SSLContext.check_hostname` must be enabled as well to " +"verify the authenticity of a cert. :const:`PROTOCOL_TLS_CLIENT` " +"uses :const:`CERT_REQUIRED` and enables :attr:`~SSLContext.check_hostname` " +"by default." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。在這個模式下,需要從 socket 連線的另" -"一端獲取憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" -"式 **不能** 在客戶端模式下對憑證進行驗證,因為它無法去配對主機名稱。:attr:" -"`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實性。:const:" -"`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" -"`~SSLContext.check_hostname`。" +"一端取得憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" +"式\\ **不能**\\ 在客戶端模式下對憑證進行驗證,因為它無法去配對主機名" +"稱。:attr:`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實" +"性。:const:`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開" +"啟 :attr:`~SSLContext.check_hostname`。" #: ../../library/ssl.rst:522 msgid "" @@ -849,8 +858,8 @@ msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " "requires a valid CRL that is signed by the peer cert's issuer (its direct " -"ancestor CA). If no proper CRL has been loaded with :attr:`SSLContext." -"load_verify_locations`, validation will fail." +"ancestor CA). If no proper CRL has been loaded " +"with :attr:`SSLContext.load_verify_locations`, validation will fail." msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,只會檢查同等的憑證而不" "會去檢查中間的 CA 憑證。此模式需要提供由對等憑證發行者 (它的直接上級 CA) 的有" @@ -916,8 +925,8 @@ msgstr "" #: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " -"communication. The generic TLS protocol constant is deprecated in favor of :" -"data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." +"communication. The generic TLS protocol constant is deprecated in favor " +"of :data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" "TLS 的客戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" @@ -963,13 +972,13 @@ msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" #: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " -"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" -"attr:`SSLContext.minimum_version` and :attr:`SSLContext.maximum_version` " -"instead." +"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` " +"with :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"OpenSSL 已經終止了所有特定版本的協定。請改用預設的 :data:" -"`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" -"`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" +"OpenSSL 已經終止了所有特定版本的協定。請改用預設" +"的 :data:`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` " +"和 :attr:`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" #: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." @@ -1042,11 +1051,13 @@ msgstr "" #: ../../library/ssl.rst:725 msgid "" -"The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." -"minimum_version` and :attr:`SSLContext.maximum_version` instead." +"The option is deprecated since OpenSSL 1.1.0, use the " +"new :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." -"minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" +"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新" +"的 :attr:`SSLContext.minimum_version` 及 :attr:`SSLContext.maximum_version` " +"代替。" #: ../../library/ssl.rst:732 msgid "" @@ -1196,16 +1207,16 @@ msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." msgstr "" -"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" -"rfc:`7301` 中。" +"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述" +"在 :rfc:`7301` 中。" #: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" -"OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." -"hostname_checks_common_name` 是否可寫。" +"OpenSSL 函式庫是否內建支援不檢查主題通用名稱" +"及 :attr:`SSLContext.hostname_checks_common_name` 是否可寫。" #: ../../library/ssl.rst:872 msgid "" @@ -1268,17 +1279,16 @@ msgid "" msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.3 協定。" #: ../../library/ssl.rst:933 -#, fuzzy msgid "Whether the OpenSSL library has built-in support for TLS-PSK." -msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" +msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" #: ../../library/ssl.rst:939 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." msgstr "" -"支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." -"get_channel_binding` 的參數。" +"支援的 TLS 通道綁定類型列表。列表中的字串可以作" +"為 :meth:`SSLSocket.get_channel_binding` 的參數。" #: ../../library/ssl.rst:946 msgid "The version string of the OpenSSL library loaded by the interpreter::" @@ -1329,14 +1339,14 @@ msgid "" "parameters-6>`_ contains this list and references to the RFCs where their " "meaning is defined." msgstr "" -"來自 :rfc:`5246` 和其他文檔的警報描述。`IANA TLS Alert Registry `_ 包" -"含了此列表以及其含義定義所在的 RFC 的引用。" +"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry `_ 包含了此列表以及其含義定義所在的 RFC 的引用。" #: ../../library/ssl.rst:982 msgid "" -"Used as the return value of the callback function in :meth:`SSLContext." -"set_servername_callback`." +"Used as the return value of the callback function " +"in :meth:`SSLContext.set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" @@ -1346,20 +1356,20 @@ msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合 #: ../../library/ssl.rst:995 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web servers (therefore, it will be used to create client-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web servers (therefore, it will be used " +"to create client-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" #: ../../library/ssl.rst:1004 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web clients (therefore, it will be used to create server-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web clients (therefore, it will be used " +"to create server-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " @@ -1371,11 +1381,13 @@ msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" #: ../../library/ssl.rst:1019 msgid "" -":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" -"`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." +":class:`enum.IntEnum` collection of SSL and TLS versions " +"for :attr:`SSLContext.maximum_version` " +"and :attr:`SSLContext.minimum_version`." msgstr "" -"用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." -"minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" +"用於 :attr:`SSLContext.maximum_version` " +"和 :attr:`SSLContext.minimum_version` 的 SSL 和 TLS 版" +"本 :class:`enum.IntEnum` 集合。" #: ../../library/ssl.rst:1027 msgid "" @@ -1392,11 +1404,11 @@ msgstr "SSL 3.0 到 TLS 1.3。" #: ../../library/ssl.rst:1041 msgid "" -"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" -"`TLSVersion.TLSv1_3` are deprecated." +"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` " +"and :attr:`TLSVersion.TLSv1_3` are deprecated." msgstr "" -"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" -"class:`TLSVersion` 成員都已被棄用。" +"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有" +"的 :class:`TLSVersion` 成員都已被棄用。" #: ../../library/ssl.rst:1046 msgid "SSL Sockets" @@ -1439,12 +1451,8 @@ msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" #: ../../library/ssl.rst:1060 -msgid "" -":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" -"`~socket.socket.setblocking`" -msgstr "" -":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" -"`~socket.socket.setblocking`" +msgid ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:`~socket.socket.setblocking`" +msgstr ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:`~socket.socket.setblocking`" #: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.listen`" @@ -1490,13 +1498,13 @@ msgid "" "on non-blocking sockets `." msgstr "" "然而,由於 SSL(和 TLS)協定在 TCP 之上有自己的框架,因此在某些方面,SSL " -"sockets 的抽象可能會與普通操作系統級別的 sockets 規範有所不同。特別是請參閱" +"sockets 的抽象可能會與普通作業系統級別的 sockets 規範有所不同。特別是請參閱" "\\ :ref:`關於 non-blocking sockets 的說明 `。" #: ../../library/ssl.rst:1077 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" @@ -1515,17 +1523,18 @@ msgstr "" #: ../../library/ssl.rst:1088 msgid "" -"It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" -"`SSLContext.wrap_socket` to wrap a socket." +"It is deprecated to create a :class:`SSLSocket` instance directly, " +"use :meth:`SSLContext.wrap_socket` to wrap a socket." msgstr "" -"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." -"wrap_socket` 來包裝 socket。" +"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使" +"用 :meth:`SSLContext.wrap_socket` 來包裝 socket。" #: ../../library/ssl.rst:1092 msgid "" -":class:`SSLSocket` instances must to created with :meth:`~SSLContext." -"wrap_socket`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLSocket` instances must to created " +"with :meth:`~SSLContext.wrap_socket`. In earlier versions, it was possible " +"to create instances directly. This was never documented or officially " +"supported." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" @@ -1554,11 +1563,12 @@ msgstr "" #: ../../library/ssl.rst:1111 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the read would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the read would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻" +"塞。" #: ../../library/ssl.rst:1114 msgid "" @@ -1590,11 +1600,12 @@ msgstr "" #: ../../library/ssl.rst:1130 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the write would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the write would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻" +"塞。" #: ../../library/ssl.rst:1133 msgid "" @@ -1620,8 +1631,8 @@ msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " "decrypt/encrypt it to encrypted, wire-level data. These methods require an " -"active SSL connection, i.e. the handshake was completed and :meth:`SSLSocket." -"unwrap` was not called." +"active SSL connection, i.e. the handshake was completed " +"and :meth:`SSLSocket.unwrap` was not called." msgstr "" ":meth:`~SSLSocket.read` 和 :meth:`~SSLSocket.write` 方法為低階層的方法,負責" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" @@ -1629,8 +1640,9 @@ msgstr "" #: ../../library/ssl.rst:1151 msgid "" -"Normally you should use the socket API methods like :meth:`~socket.socket." -"recv` and :meth:`~socket.socket.send` instead of these methods." +"Normally you should use the socket API methods " +"like :meth:`~socket.socket.recv` and :meth:`~socket.socket.send` instead of " +"these methods." msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" @@ -1641,12 +1653,13 @@ msgstr "執行 SSL 設定握手。" #: ../../library/ssl.rst:1159 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" -"`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." -"context` is true." +"The handshake method also performs :func:`match_hostname` when " +"the :attr:`~SSLContext.check_hostname` attribute of the " +"socket's :attr:`~SSLSocket.context` is true." msgstr "" -"當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." -"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" +"當 socket 的 :attr:`~SSLSocket.context` " +"的 :attr:`~SSLContext.check_hostname` 屬性質為 true 時,握手方法也會執" +"行 :func:`match_hostname`。" #: ../../library/ssl.rst:1164 msgid "" @@ -1658,23 +1671,23 @@ msgstr "" #: ../../library/ssl.rst:1168 msgid "" -"Hostname or IP address is matched by OpenSSL during handshake. The function :" -"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " -"or IP address, the handshake is aborted early and a TLS alert message is " -"sent to the peer." +"Hostname or IP address is matched by OpenSSL during handshake. The " +"function :func:`match_hostname` is no longer used. In case OpenSSL refuses a " +"hostname or IP address, the handshake is aborted early and a TLS alert " +"message is sent to the peer." msgstr "" -"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使用 :func:" -"`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" -"中止,並向對方發送 TLS 警報訊息。" +"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使" +"用 :func:`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手" +"將會提前中止,並向對方發送 TLS 警報訊息。" #: ../../library/ssl.rst:1176 msgid "" "If there is no certificate for the peer on the other end of the connection, " -"return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" -"`ValueError`." +"return ``None``. If the SSL handshake hasn't been done yet, " +"raise :exc:`ValueError`." msgstr "" -"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" -"`ValueError`。" +"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引" +"發 :exc:`ValueError`。" #: ../../library/ssl.rst:1180 msgid "" @@ -1755,8 +1768,8 @@ msgid "" "socket's role:" msgstr "" "如果 ``binary_form`` 參數設定為 :const:`True`,且對等提供了證書,則該方法會" -"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" -"const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" +"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回" +"傳 :const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" #: ../../library/ssl.rst:1219 msgid "" @@ -1767,13 +1780,13 @@ msgstr "對於客戶端 SSL socket,伺服器將永遠提供證書,無論是 #: ../../library/ssl.rst:1222 msgid "" "for a server SSL socket, the client will only provide a certificate when " -"requested by the server; therefore :meth:`getpeercert` will return :const:" -"`None` if you used :const:`CERT_NONE` (rather than :const:`CERT_OPTIONAL` " -"or :const:`CERT_REQUIRED`)." +"requested by the server; therefore :meth:`getpeercert` will " +"return :const:`None` if you used :const:`CERT_NONE` (rather " +"than :const:`CERT_OPTIONAL` or :const:`CERT_REQUIRED`)." msgstr "" "對於伺服器 SSL socket,客戶端僅在伺服器要求時才會提供證書;因此,如果你使用的" -"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" -"`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" +"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` " +"或 :const:`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" #: ../../library/ssl.rst:1227 msgid "See also :attr:`SSLContext.check_hostname`." @@ -1849,17 +1862,18 @@ msgstr "" msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " -"list. Currently only the 'tls-unique' channel binding, defined by :rfc:" -"`5929`, is supported. :exc:`ValueError` will be raised if an unsupported " -"channel binding type is requested." +"list. Currently only the 'tls-unique' channel binding, defined " +"by :rfc:`5929`, is supported. :exc:`ValueError` will be raised if an " +"unsupported channel binding type is requested." msgstr "" #: ../../library/ssl.rst:1299 msgid "" -"Return the protocol that was selected during the TLS handshake. If :meth:" -"`SSLContext.set_alpn_protocols` was not called, if the other party does not " -"support ALPN, if this socket does not support any of the client's proposed " -"protocols, or if the handshake has not happened yet, ``None`` is returned." +"Return the protocol that was selected during the TLS handshake. " +"If :meth:`SSLContext.set_alpn_protocols` was not called, if the other party " +"does not support ALPN, if this socket does not support any of the client's " +"proposed protocols, or if the handshake has not happened yet, ``None`` is " +"returned." msgstr "" #: ../../library/ssl.rst:1309 @@ -1887,8 +1901,8 @@ msgstr "" msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " -"the initial TLS handshake and with PHA enabled on both sides, see :attr:" -"`SSLContext.post_handshake_auth`." +"the initial TLS handshake and with PHA enabled on both sides, " +"see :attr:`SSLContext.post_handshake_auth`." msgstr "" #: ../../library/ssl.rst:1335 @@ -1900,8 +1914,8 @@ msgstr "" #: ../../library/ssl.rst:1339 msgid "" -"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" -"`SSLError` is raised." +"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), " +"an :exc:`SSLError` is raised." msgstr "" #: ../../library/ssl.rst:1343 @@ -1945,16 +1959,16 @@ msgstr "" msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " -"form (``\"xn--pythn-mua.org\"``), rather than the U-label form (``\"pythön." -"org\"``)." +"form (``\"xn--pythn-mua.org\"``), rather than the U-label form " +"(``\"pythön.org\"``)." msgstr "" #: ../../library/ssl.rst:1391 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " -"performed. For client sockets the session can be set before :meth:" -"`~SSLSocket.do_handshake` has been called to reuse a session." +"performed. For client sockets the session can be set " +"before :meth:`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" #: ../../library/ssl.rst:1404 @@ -2084,28 +2098,27 @@ msgstr "" #: ../../library/ssl.rst:1453 msgid "" -"The context is created with secure default values. The options :data:" -"`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" -"`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, and :" -"data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by default. " -"The initial cipher suite list contains only ``HIGH`` ciphers, no ``NULL`` " -"ciphers and no ``MD5`` ciphers." +"The context is created with secure default values. The " +"options :data:`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, " +"and :data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by " +"default. The initial cipher suite list contains only ``HIGH`` ciphers, no " +"``NULL`` ciphers and no ``MD5`` ciphers." msgstr "" #: ../../library/ssl.rst:1463 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " -"class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol in the future." +"class will either require :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" #: ../../library/ssl.rst:1469 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " -"2048 bits and ECC keys with less than 224 bits are prohibited. :data:" -"`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and :data:`PROTOCOL_TLS_SERVER` " -"use TLS 1.2 as minimum TLS version." +"2048 bits and ECC keys with less than 224 bits are " +"prohibited. :data:`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, " +"and :data:`PROTOCOL_TLS_SERVER` use TLS 1.2 as minimum TLS version." msgstr "" #: ../../library/ssl.rst:1477 @@ -2190,9 +2203,9 @@ msgstr "" msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " -"system stores. On all systems it calls :meth:`SSLContext." -"set_default_verify_paths`. In the future the method may load CA certificates " -"from other locations, too." +"system stores. On all systems it " +"calls :meth:`SSLContext.set_default_verify_paths`. In the future the method " +"may load CA certificates from other locations, too." msgstr "" #: ../../library/ssl.rst:1543 @@ -2207,8 +2220,9 @@ msgstr "" #: ../../library/ssl.rst:1553 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " -"other peers' certificates when :data:`verify_mode` is other than :data:" -"`CERT_NONE`. At least one of *cafile* or *capath* must be specified." +"other peers' certificates when :data:`verify_mode` is other " +"than :data:`CERT_NONE`. At least one of *cafile* or *capath* must be " +"specified." msgstr "" #: ../../library/ssl.rst:1557 @@ -2262,8 +2276,8 @@ msgstr "" #: ../../library/ssl.rst:1596 msgid "" -"Get a list of enabled ciphers. The list is in order of cipher priority. See :" -"meth:`SSLContext.set_ciphers`." +"Get a list of enabled ciphers. The list is in order of cipher priority. " +"See :meth:`SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1601 @@ -2351,16 +2365,16 @@ msgstr "" #: ../../library/ssl.rst:1653 msgid "" -"TLS 1.3 cipher suites cannot be disabled with :meth:`~SSLContext." -"set_ciphers`." +"TLS 1.3 cipher suites cannot be disabled " +"with :meth:`~SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1658 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " -"handshake. It should be a list of ASCII strings, like ``['http/1.1', " -"'spdy/2']``, ordered by preference. The selection of a protocol will happen " -"during the handshake, and will play out according to :rfc:`7301`. After a " +"handshake. It should be a list of ASCII strings, like ``['http/1.1', 'spdy/" +"2']``, ordered by preference. The selection of a protocol will happen during " +"the handshake, and will play out according to :rfc:`7301`. After a " "successful handshake, the :meth:`SSLSocket.selected_alpn_protocol` method " "will return the agreed-upon protocol." msgstr "" @@ -2378,9 +2392,9 @@ msgid "" "ordered by preference. The selection of a protocol will happen during the " "handshake, and will play out according to the `Application Layer Protocol " "Negotiation `_. After a successful handshake, the :meth:" -"`SSLSocket.selected_npn_protocol` method will return the agreed-upon " -"protocol." +"Layer_Protocol_Negotiation>`_. After a successful handshake, " +"the :meth:`SSLSocket.selected_npn_protocol` method will return the agreed-" +"upon protocol." msgstr "" #: ../../library/ssl.rst:1680 @@ -2417,37 +2431,37 @@ msgstr "" #: ../../library/ssl.rst:1708 msgid "" -"A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" -"attr:`SSLSocket.context` attribute to a new object of type :class:" -"`SSLContext` representing a certificate chain that matches the server name." +"A typical use of this callback is to change " +"the :class:`ssl.SSLSocket`'s :attr:`SSLSocket.context` attribute to a new " +"object of type :class:`SSLContext` representing a certificate chain that " +"matches the server name." msgstr "" #: ../../library/ssl.rst:1713 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " -"methods and attributes are usable like :meth:`SSLSocket." -"selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." -"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." -"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." -"compression` methods require that the TLS connection has progressed beyond " -"the TLS Client Hello and therefore will not return meaningful values nor can " -"they be called safely." +"methods and attributes are usable " +"like :meth:`SSLSocket.selected_alpn_protocol` and :attr:`SSLSocket.context`. " +"The :meth:`SSLSocket.getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket.get_unverified_chain` :meth:`SSLSocket.cipher` " +"and :meth:`SSLSocket.compression` methods require that the TLS connection " +"has progressed beyond the TLS Client Hello and therefore will not return " +"meaningful values nor can they be called safely." msgstr "" #: ../../library/ssl.rst:1722 msgid "" "The *sni_callback* function must return ``None`` to allow the TLS " -"negotiation to continue. If a TLS failure is required, a constant :const:" -"`ALERT_DESCRIPTION_* ` can be returned. " -"Other return values will result in a TLS fatal error with :const:" -"`ALERT_DESCRIPTION_INTERNAL_ERROR`." +"negotiation to continue. If a TLS failure is required, a " +"constant :const:`ALERT_DESCRIPTION_* ` can " +"be returned. Other return values will result in a TLS fatal error " +"with :const:`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" #: ../../library/ssl.rst:1728 msgid "" "If an exception is raised from the *sni_callback* function the TLS " -"connection will terminate with a fatal TLS alert message :const:" -"`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." +"connection will terminate with a fatal TLS alert " +"message :const:`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" #: ../../library/ssl.rst:1732 @@ -2483,8 +2497,8 @@ msgstr "" #: ../../library/ssl.rst:1759 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_DH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_DH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1766 @@ -2498,8 +2512,8 @@ msgstr "" #: ../../library/ssl.rst:1772 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_ECDH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1775 @@ -2518,10 +2532,11 @@ msgstr "" #: ../../library/ssl.rst:1787 msgid "" -"Wrap an existing Python socket *sock* and return an instance of :attr:" -"`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " -"socket is tied to the context, its settings and certificates. *sock* must be " -"a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." +"Wrap an existing Python socket *sock* and return an instance " +"of :attr:`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The " +"returned SSL socket is tied to the context, its settings and certificates. " +"*sock* must be a :const:`~socket.SOCK_STREAM` socket; other socket types are " +"unsupported." msgstr "" #: ../../library/ssl.rst:1793 @@ -2537,8 +2552,8 @@ msgid "" "after :meth:`connect` is called on the socket. For server-side sockets, if " "the socket has no remote peer, it is assumed to be a listening socket, and " "the server-side SSL wrapping is automatically performed on client " -"connections accepted via the :meth:`accept` method. The method may raise :" -"exc:`SSLError`." +"connections accepted via the :meth:`accept` method. The method may " +"raise :exc:`SSLError`." msgstr "" #: ../../library/ssl.rst:1804 @@ -2554,20 +2569,20 @@ msgstr "" msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " -"application program will call it explicitly, by invoking the :meth:" -"`SSLSocket.do_handshake` method. Calling :meth:`SSLSocket.do_handshake` " -"explicitly gives the program control over the blocking behavior of the " -"socket I/O involved in the handshake." +"application program will call it explicitly, by invoking " +"the :meth:`SSLSocket.do_handshake` method. " +"Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control " +"over the blocking behavior of the socket I/O involved in the handshake." msgstr "" #: ../../library/ssl.rst:1817 msgid "" -"The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." -"recv` method should signal unexpected EOF from the other end of the " -"connection. If specified as :const:`True` (the default), it returns a " -"normal EOF (an empty bytes object) in response to unexpected EOF errors " -"raised from the underlying socket; if :const:`False`, it will raise the " -"exceptions back to the caller." +"The parameter ``suppress_ragged_eofs`` specifies how " +"the :meth:`SSLSocket.recv` method should signal unexpected EOF from the " +"other end of the connection. If specified as :const:`True` (the default), " +"it returns a normal EOF (an empty bytes object) in response to unexpected " +"EOF errors raised from the underlying socket; if :const:`False`, it will " +"raise the exceptions back to the caller." msgstr "" #: ../../library/ssl.rst:1824 @@ -2576,8 +2591,8 @@ msgstr "" #: ../../library/ssl.rst:1826 msgid "" -"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" -"`SSLContext.wrap_bio`." +"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, " +"use :meth:`SSLContext.wrap_bio`." msgstr "" #: ../../library/ssl.rst:1829 @@ -2598,15 +2613,15 @@ msgstr "" #: ../../library/ssl.rst:1842 msgid "" -"The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" -"`SSLSocket`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLSocket`." +"The return type of :meth:`SSLContext.wrap_socket`, defaults " +"to :class:`SSLSocket`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLSocket`." msgstr "" #: ../../library/ssl.rst:1851 msgid "" -"Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" -"attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " +"Wrap the BIO objects *incoming* and *outgoing* and return an instance " +"of :attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " "routines will read input data from the incoming BIO and write data to the " "outgoing BIO." msgstr "" @@ -2625,9 +2640,9 @@ msgstr "" #: ../../library/ssl.rst:1868 msgid "" -"The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" -"`SSLObject`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLObject`." +"The return type of :meth:`SSLContext.wrap_bio`, defaults " +"to :class:`SSLObject`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLObject`." msgstr "" #: ../../library/ssl.rst:1876 @@ -2652,14 +2667,15 @@ msgstr "" #: ../../library/ssl.rst:1887 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " -"The context's :attr:`~SSLContext.verify_mode` must be set to :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " +"The context's :attr:`~SSLContext.verify_mode` must be set " +"to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " "*server_hostname* to :meth:`~SSLContext.wrap_socket` in order to match the " -"hostname. Enabling hostname checking automatically sets :attr:`~SSLContext." -"verify_mode` from :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be " -"set back to :data:`CERT_NONE` as long as hostname checking is enabled. The :" -"data:`PROTOCOL_TLS_CLIENT` protocol enables hostname checking by default. " -"With other protocols, hostname checking must be enabled explicitly." +"hostname. Enabling hostname checking automatically " +"sets :attr:`~SSLContext.verify_mode` from :data:`CERT_NONE` " +"to :data:`CERT_REQUIRED`. It cannot be set back to :data:`CERT_NONE` as " +"long as hostname checking is enabled. The :data:`PROTOCOL_TLS_CLIENT` " +"protocol enables hostname checking by default. With other protocols, " +"hostname checking must be enabled explicitly." msgstr "" #: ../../library/ssl.rst:1900 @@ -2688,10 +2704,10 @@ msgstr "" #: ../../library/ssl.rst:1915 msgid "" -":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" -"`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." -"verify_mode` is :data:`CERT_NONE`. Previously the same operation would have " -"failed with a :exc:`ValueError`." +":attr:`~SSLContext.verify_mode` is now automatically changed " +"to :data:`CERT_REQUIRED` when hostname checking is enabled " +"and :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously the " +"same operation would have failed with a :exc:`ValueError`." msgstr "" #: ../../library/ssl.rst:1922 @@ -2707,18 +2723,20 @@ msgstr "" msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " -"attribute is read-only for protocols other than :attr:`PROTOCOL_TLS`, :attr:" -"`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`." +"attribute is read-only for protocols other " +"than :const:`PROTOCOL_TLS`, :const:`PROTOCOL_TLS_CLIENT`, " +"and :const:`PROTOCOL_TLS_SERVER`." msgstr "" #: ../../library/ssl.rst:1937 msgid "" -"The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." -"minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " -"and TLS versions of the context. The implementation does not prevent invalid " -"combination. For example a context with :attr:`OP_NO_TLSv1_2` in :attr:" -"`~SSLContext.options` and :attr:`~SSLContext.maximum_version` set to :attr:" -"`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." +"The " +"attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext.minimum_version` " +"and :attr:`SSLContext.options` all affect the supported SSL and TLS versions " +"of the context. The implementation does not prevent invalid combination. For " +"example a context with :attr:`OP_NO_TLSv1_2` in :attr:`~SSLContext.options` " +"and :attr:`~SSLContext.maximum_version` set to :attr:`TLSVersion.TLSv1_2` " +"will not be able to establish a TLS 1.2 connection." msgstr "" #: ../../library/ssl.rst:1950 @@ -2729,16 +2747,16 @@ msgstr "" #: ../../library/ssl.rst:1957 msgid "" -"Control the number of TLS 1.3 session tickets of a :attr:" -"`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " -"connections." +"Control the number of TLS 1.3 session tickets of " +"a :const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 " +"to 1.2 connections." msgstr "" #: ../../library/ssl.rst:1965 msgid "" "An integer representing the set of SSL options enabled on this context. The " -"default value is :data:`OP_ALL`, but you can specify other options such as :" -"data:`OP_NO_SSLv2` by ORing them together." +"default value is :data:`OP_ALL`, but you can specify other options such " +"as :data:`OP_NO_SSLv2` by ORing them together." msgstr "" #: ../../library/ssl.rst:1969 @@ -2748,8 +2766,8 @@ msgstr "" #: ../../library/ssl.rst:1977 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " -"Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." -"maximum_version` instead." +"Python 3.7. Use :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" #: ../../library/ssl.rst:1983 @@ -2770,8 +2788,9 @@ msgstr "" msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " -"client cert exchange is delayed until :meth:`SSLSocket." -"verify_client_post_handshake` is called and some I/O is performed." +"client cert exchange is delayed " +"until :meth:`SSLSocket.verify_client_post_handshake` is called and some I/O " +"is performed." msgstr "" #: ../../library/ssl.rst:2001 @@ -2802,9 +2821,9 @@ msgstr "" #: ../../library/ssl.rst:2027 msgid "" -"The flags for certificate verification operations. You can set flags like :" -"data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " -"neither require nor verify certificate revocation lists (CRLs)." +"The flags for certificate verification operations. You can set flags " +"like :data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default " +"OpenSSL does neither require nor verify certificate revocation lists (CRLs)." msgstr "" #: ../../library/ssl.rst:2033 @@ -2814,8 +2833,8 @@ msgstr "" #: ../../library/ssl.rst:2041 msgid "" "Whether to try to verify other peers' certificates and how to behave if " -"verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." +"verification fails. This attribute must be one " +"of :data:`CERT_NONE`, :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" #: ../../library/ssl.rst:2045 @@ -2862,9 +2881,8 @@ msgid "client-identity must be a non-empty string." msgstr "" #: ../../library/ssl.rst:2075 ../../library/ssl.rst:2122 -#, fuzzy msgid "Example usage::" -msgstr "範例: ::" +msgstr "範例用法: ::" #: ../../library/ssl.rst:2077 msgid "" @@ -3051,9 +3069,9 @@ msgid "" "certificate chains for each issuer you are willing to trust. Again, this " "file just contains these chains concatenated together. For validation, " "Python will use the first chain it finds in the file which matches. The " -"platform's certificates file can be used by calling :meth:`SSLContext." -"load_default_certs`, this is done automatically with :func:`." -"create_default_context`." +"platform's certificates file can be used by " +"calling :meth:`SSLContext.load_default_certs`, this is done automatically " +"with :func:`.create_default_context`." msgstr "" #: ../../library/ssl.rst:2228 @@ -3200,8 +3218,8 @@ msgstr "" #: ../../library/ssl.rst:2320 msgid "" -"When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" -"attr:`~SSLContext.check_hostname` validate the server certificate: it " +"When you use the context to connect to a server, :const:`CERT_REQUIRED` " +"and :attr:`~SSLContext.check_hostname` validate the server certificate: it " "ensures that the server certificate was signed with one of the CA " "certificates, checks the signature for correctness, and verifies other " "properties like validity and identity of the hostname::" @@ -3237,10 +3255,10 @@ msgid "" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3281,10 +3299,10 @@ msgstr "" "{'OCSP': ('http://ocsp.digicert.com',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3405,8 +3423,9 @@ msgstr "" #: ../../library/ssl.rst:2421 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " -"new socket from the other end, and use the context's :meth:`SSLContext." -"wrap_socket` method to create a server-side SSL socket for the connection::" +"new socket from the other end, and use the " +"context's :meth:`SSLContext.wrap_socket` method to create a server-side SSL " +"socket for the connection::" msgstr "" #: ../../library/ssl.rst:2425 @@ -3473,10 +3492,10 @@ msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " "operation would block. :exc:`SSLWantReadError` will be raised if a read " -"operation on the underlying socket is necessary, and :exc:" -"`SSLWantWriteError` for a write operation on the underlying socket. Note " -"that attempts to *write* to an SSL socket may require *reading* from the " -"underlying socket first, and attempts to *read* from the SSL socket may " +"operation on the underlying socket is necessary, " +"and :exc:`SSLWantWriteError` for a write operation on the underlying socket. " +"Note that attempts to *write* to an SSL socket may require *reading* from " +"the underlying socket first, and attempts to *read* from the SSL socket may " "require a prior *write* to the underlying socket." msgstr "" @@ -3492,8 +3511,8 @@ msgid "" "read from (or written to), but it does not imply that there is sufficient " "data at the upper SSL layer. For example, only part of an SSL frame might " "have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` " -"and :meth:`SSLSocket.send` failures, and retry after another call to :func:" -"`~select.select`." +"and :meth:`SSLSocket.send` failures, and retry after another call " +"to :func:`~select.select`." msgstr "" #: ../../library/ssl.rst:2485 @@ -3507,16 +3526,16 @@ msgstr "" #: ../../library/ssl.rst:2491 msgid "" -"(of course, similar provisions apply when using other primitives such as :" -"func:`~select.poll`, or those in the :mod:`selectors` module)" +"(of course, similar provisions apply when using other primitives such " +"as :func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" #: ../../library/ssl.rst:2494 msgid "" -"The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." -"do_handshake` method has to be retried until it returns successfully. Here " -"is a synopsis using :func:`~select.select` to wait for the socket's " -"readiness::" +"The SSL handshake itself will be non-blocking: " +"the :meth:`SSLSocket.do_handshake` method has to be retried until it returns " +"successfully. Here is a synopsis using :func:`~select.select` to wait for " +"the socket's readiness::" msgstr "" #: ../../library/ssl.rst:2499 @@ -3542,10 +3561,11 @@ msgstr "" #: ../../library/ssl.rst:2510 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level API. It polls for events using " -"the :mod:`selectors` module and handles :exc:`SSLWantWriteError`, :exc:" -"`SSLWantReadError` and :exc:`BlockingIOError` exceptions. It runs the SSL " -"handshake asynchronously as well." +"nonblocking>` and provides a higher level :ref:`Streams API `. It polls for events using the :mod:`selectors` module and " +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` " +"and :exc:`BlockingIOError` exceptions. It runs the SSL handshake " +"asynchronously as well." msgstr "" #: ../../library/ssl.rst:2519 @@ -3554,8 +3574,8 @@ msgstr "" #: ../../library/ssl.rst:2523 msgid "" -"Ever since the SSL module was introduced in Python 2.6, the :class:" -"`SSLSocket` class has provided two related but distinct areas of " +"Ever since the SSL module was introduced in Python 2.6, " +"the :class:`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" @@ -3580,11 +3600,11 @@ msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " "to use a different IO multiplexing model than the \"select/poll on a file " -"descriptor\" (readiness based) model that is assumed by :class:`socket." -"socket` and by the internal OpenSSL socket IO routines. This is mostly " -"relevant for platforms like Windows where this model is not efficient. For " -"this purpose, a reduced scope variant of :class:`SSLSocket` called :class:" -"`SSLObject` is provided." +"descriptor\" (readiness based) model that is assumed " +"by :class:`socket.socket` and by the internal OpenSSL socket IO routines. " +"This is mostly relevant for platforms like Windows where this model is not " +"efficient. For this purpose, a reduced scope variant of :class:`SSLSocket` " +"called :class:`SSLObject` is provided." msgstr "" #: ../../library/ssl.rst:2545 @@ -3721,8 +3741,8 @@ msgstr "" #: ../../library/ssl.rst:2595 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " -"that are in violation of the protocol are reported via the :exc:" -"`SSLEOFError` exception." +"that are in violation of the protocol are reported via " +"the :exc:`SSLEOFError` exception." msgstr "" #: ../../library/ssl.rst:2599 @@ -3733,9 +3753,9 @@ msgstr "" #: ../../library/ssl.rst:2602 msgid "" -"The *server_name_callback* callback passed to :meth:`SSLContext." -"set_servername_callback` will get an :class:`SSLObject` instance instead of " -"a :class:`SSLSocket` instance as its first parameter." +"The *server_name_callback* callback passed " +"to :meth:`SSLContext.set_servername_callback` will get an :class:`SSLObject` " +"instance instead of a :class:`SSLSocket` instance as its first parameter." msgstr "" #: ../../library/ssl.rst:2606 @@ -3745,15 +3765,16 @@ msgstr "" #: ../../library/ssl.rst:2608 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " -"This means that for example :meth:`~SSLSocket.read` will raise an :exc:" -"`SSLWantReadError` if it needs more data than the incoming BIO has available." +"This means that for example :meth:`~SSLSocket.read` will raise " +"an :exc:`SSLWantReadError` if it needs more data than the incoming BIO has " +"available." msgstr "" #: ../../library/ssl.rst:2613 msgid "" -":class:`SSLObject` instances must be created with :meth:`~SSLContext." -"wrap_bio`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLObject` instances must be created " +"with :meth:`~SSLContext.wrap_bio`. In earlier versions, it was possible to " +"create instances directly. This was never documented or officially supported." msgstr "" #: ../../library/ssl.rst:2619 @@ -3823,11 +3844,11 @@ msgstr "" #: ../../library/ssl.rst:2681 msgid "" "For **client use**, if you don't have any special requirements for your " -"security policy, it is highly recommended that you use the :func:" -"`create_default_context` function to create your SSL context. It will load " -"the system's trusted CA certificates, enable certificate validation and " -"hostname checking, and try to choose reasonably secure protocol and cipher " -"settings." +"security policy, it is highly recommended that you use " +"the :func:`create_default_context` function to create your SSL context. It " +"will load the system's trusted CA certificates, enable certificate " +"validation and hostname checking, and try to choose reasonably secure " +"protocol and cipher settings." msgstr "" #: ../../library/ssl.rst:2688 @@ -3852,16 +3873,16 @@ msgstr "" #: ../../library/ssl.rst:2697 msgid "" -"If a client certificate is needed for the connection, it can be added with :" -"meth:`SSLContext.load_cert_chain`." +"If a client certificate is needed for the connection, it can be added " +"with :meth:`SSLContext.load_cert_chain`." msgstr "" #: ../../library/ssl.rst:2700 msgid "" -"By contrast, if you create the SSL context by calling the :class:" -"`SSLContext` constructor yourself, it will not have certificate validation " -"nor hostname checking enabled by default. If you do so, please read the " -"paragraphs below to achieve a good security level." +"By contrast, if you create the SSL context by calling " +"the :class:`SSLContext` constructor yourself, it will not have certificate " +"validation nor hostname checking enabled by default. If you do so, please " +"read the paragraphs below to achieve a good security level." msgstr "" #: ../../library/ssl.rst:2706 @@ -3874,23 +3895,23 @@ msgstr "驗證憑證" #: ../../library/ssl.rst:2711 msgid "" -"When calling the :class:`SSLContext` constructor directly, :const:" -"`CERT_NONE` is the default. Since it does not authenticate the other peer, " -"it can be insecure, especially in client mode where most of the time you " -"would like to ensure the authenticity of the server you're talking to. " -"Therefore, when in client mode, it is highly recommended to use :const:" -"`CERT_REQUIRED`. However, it is in itself not sufficient; you also have to " -"check that the server certificate, which can be obtained by calling :meth:" -"`SSLSocket.getpeercert`, matches the desired service. For many protocols " -"and applications, the service can be identified by the hostname. This common " -"check is automatically performed when :attr:`SSLContext.check_hostname` is " -"enabled." +"When calling the :class:`SSLContext` constructor " +"directly, :const:`CERT_NONE` is the default. Since it does not authenticate " +"the other peer, it can be insecure, especially in client mode where most of " +"the time you would like to ensure the authenticity of the server you're " +"talking to. Therefore, when in client mode, it is highly recommended to " +"use :const:`CERT_REQUIRED`. However, it is in itself not sufficient; you " +"also have to check that the server certificate, which can be obtained by " +"calling :meth:`SSLSocket.getpeercert`, matches the desired service. For " +"many protocols and applications, the service can be identified by the " +"hostname. This common check is automatically performed " +"when :attr:`SSLContext.check_hostname` is enabled." msgstr "" #: ../../library/ssl.rst:2723 msgid "" -"Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"Hostname matchings is now performed by OpenSSL. Python no longer " +"uses :func:`match_hostname`." msgstr "" #: ../../library/ssl.rst:2727 @@ -3909,9 +3930,9 @@ msgstr "協定版本" msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " -"recommended to use :const:`PROTOCOL_TLS_CLIENT` or :const:" -"`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are disabled " -"by default." +"recommended to use :const:`PROTOCOL_TLS_CLIENT` " +"or :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are " +"disabled by default." msgstr "" #: ../../library/ssl.rst:2743 @@ -3927,9 +3948,9 @@ msgstr "" #: ../../library/ssl.rst:2748 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " -"supported by your system) connections to a server. :const:" -"`PROTOCOL_TLS_CLIENT` implies certificate validation and hostname checks by " -"default. You have to load certificates into the context." +"supported by your system) connections to a " +"server. :const:`PROTOCOL_TLS_CLIENT` implies certificate validation and " +"hostname checks by default. You have to load certificates into the context." msgstr "" #: ../../library/ssl.rst:2755 @@ -3939,14 +3960,14 @@ msgstr "" #: ../../library/ssl.rst:2757 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " -"enabled when negotiating a SSL session is possible through the :meth:" -"`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " -"disables certain weak ciphers by default, but you may want to further " -"restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled by a given " -"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " -"command on your system." +"enabled when negotiating a SSL session is possible through " +"the :meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the " +"ssl module disables certain weak ciphers by default, but you may want to " +"further restrict the cipher choice. Be sure to read OpenSSL's documentation " +"about the `cipher list format `_. If you want to check which ciphers are enabled by a " +"given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " +"ciphers`` command on your system." msgstr "" #: ../../library/ssl.rst:2768 @@ -3977,9 +3998,9 @@ msgstr "" #: ../../library/ssl.rst:2789 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " -"cipher suites are enabled by default. The method :meth:`SSLContext." -"set_ciphers` cannot enable or disable any TLS 1.3 ciphers yet, but :meth:" -"`SSLContext.get_ciphers` returns them." +"cipher suites are enabled by default. The " +"method :meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3 " +"ciphers yet, but :meth:`SSLContext.get_ciphers` returns them." msgstr "" #: ../../library/ssl.rst:2793 diff --git a/library/statistics.po b/library/statistics.po index 1337bd2d8f..30c55ed953 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2023-07-22 21:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,19 +47,20 @@ msgstr "" #: ../../library/statistics.rst:31 msgid "" -"Unless explicitly noted, these functions support :class:`int`, :class:" -"`float`, :class:`~decimal.Decimal` and :class:`~fractions.Fraction`. " -"Behaviour with other types (whether in the numeric tower or not) is " -"currently unsupported. Collections with a mix of types are also undefined " -"and implementation-dependent. If your input data consists of mixed types, " -"you may be able to use :func:`map` to ensure a consistent result, for " -"example: ``map(float, input_data)``." -msgstr "" -"除非特別註明,這些函數支援 :class:`int`、:class:`float`、:class:`~decimal." -"Decimal` 以及 :class:`~fractions.Fraction`。目前不支援其他型別(無論是否為數" -"值型別)。含有混合型別的資料的集合亦是尚未定義,且取決於該型別的實作。若你的" -"輸入資料含有混合型別,你可以考慮使用 :func:`map` 來確保結果是一致的,例如:" -"``map(float, input_data)``。" +"Unless explicitly noted, these functions " +"support :class:`int`, :class:`float`, :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Behaviour with other types (whether in the " +"numeric tower or not) is currently unsupported. Collections with a mix of " +"types are also undefined and implementation-dependent. If your input data " +"consists of mixed types, you may be able to use :func:`map` to ensure a " +"consistent result, for example: ``map(float, input_data)``." +msgstr "" +"除非特別註明,這些函數支" +"援 :class:`int`、:class:`float`、:class:`~decimal.Decimal` 以" +"及 :class:`~fractions.Fraction`。目前不支援其他型別(無論是否為數值型別)。含" +"有混合型別的資料的集合亦是尚未定義,且取決於該型別的實作。若你的輸入資料含有" +"混合型別,你可以考慮使用 :func:`map` 來確保結果是一致的,例如:``map(float, " +"input_data)``。" #: ../../library/statistics.rst:39 msgid "" @@ -386,13 +387,13 @@ msgstr "將 *data* 轉換為浮點數並計算其算數平均數。" #: ../../library/statistics.rst:168 msgid "" -"This runs faster than the :func:`mean` function and it always returns a :" -"class:`float`. The *data* may be a sequence or iterable. If the input " +"This runs faster than the :func:`mean` function and it always returns " +"a :class:`float`. The *data* may be a sequence or iterable. If the input " "dataset is empty, raises a :exc:`StatisticsError`." msgstr "" "這個函式運算比 :func:`mean` 更快,並且它總是回傳一個 :class:`float`。*data* " -"可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引發 :exc:" -"`StatisticsError`。" +"可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:172 msgid "" @@ -425,11 +426,11 @@ msgstr "" #: ../../library/statistics.rst:188 msgid "" -"If *weights* is supplied, it must be the same length as the *data* or a :exc:" -"`ValueError` will be raised." +"If *weights* is supplied, it must be the same length as the *data* or " +"a :exc:`ValueError` will be raised." msgstr "" -"如果有提供 *weights*,它必須與 *data* 長度相同,否則將引發 :exc:" -"`ValueError`。" +"如果有提供 *weights*,它必須與 *data* 長度相同,否則將引" +"發 :exc:`ValueError`。" #: ../../library/statistics.rst:193 ../../library/statistics.rst:261 msgid "Added support for *weights*." @@ -536,8 +537,8 @@ msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." msgstr "" -"若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引發 :exc:" -"`StatisticsError`。" +"若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:255 msgid "" @@ -558,9 +559,9 @@ msgstr "" #: ../../library/statistics.rst:272 msgid "" -"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about a " -"population from a sample." +"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about " +"a population from a sample." msgstr "" #: ../../library/statistics.rst:276 @@ -596,13 +597,11 @@ msgid "" msgstr "" #: ../../library/statistics.rst:293 ../../library/statistics.rst:324 -#, fuzzy msgid "" "A :exc:`StatisticsError` will be raised if the *data* sequence is empty." msgstr "若 *data* 為空,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:295 -#, fuzzy msgid "" "`Wikipedia has an example `_ where we can use :func:`kde` to " @@ -610,11 +609,10 @@ msgid "" "sample:" msgstr "" "`維基百科有一個範例 `_,我們可以使用 ``kde_normal()`` 這個錦囊" -"妙計來生成並繪製從小樣本估計的機率密度函式:" +"Kernel_density_estimation#Example>`_,我們可以使用 :func:`kde` 來從一個小樣本" +"生成並繪製估計的機率密度函數:" #: ../../library/statistics.rst:300 -#, fuzzy msgid "" ">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" ">>> f_hat = kde(sample, h=1.5)\n" @@ -622,9 +620,9 @@ msgid "" ">>> yarr = [f_hat(x) for x in xarr]" msgstr "" ">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" -">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" +">>> f_hat = kde(sample, h=1.5)\n" ">>> xarr = [i/100 for i in range(-750, 1100)]\n" -">>> yarr = [pdf(x) for x in xarr]" +">>> yarr = [f_hat(x) for x in xarr]" #: ../../library/statistics.rst:307 msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" @@ -713,11 +711,12 @@ msgstr "" #: ../../library/statistics.rst:371 msgid "" -"Return the low median of numeric data. If *data* is empty, :exc:" -"`StatisticsError` is raised. *data* can be a sequence or iterable." +"Return the low median of numeric data. If *data* is " +"empty, :exc:`StatisticsError` is raised. *data* can be a sequence or " +"iterable." msgstr "" -"回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引發 :exc:" -"`StatisticsError`。*data* 可為 sequence 或者 iterable。" +"回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引" +"發 :exc:`StatisticsError`。*data* 可為 sequence 或者 iterable。" #: ../../library/statistics.rst:374 msgid "" @@ -753,8 +752,8 @@ msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -"回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引發 :exc:" -"`StatisticsError`。*data* 可為 sequence 或者 iterable。" +"回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引" +"發 :exc:`StatisticsError`。*data* 可為 sequence 或者 iterable。" #: ../../library/statistics.rst:394 msgid "" @@ -890,8 +889,8 @@ msgid "" msgstr "" "若有多個出現次數相同的眾數,則回傳在 *data* 中最先出現的眾數。如果希望回傳其" "中最小或最大的眾數,可以使用 ``min(multimode(data))`` 或 " -"``max(multimode(data))``。如果輸入的 *data* 為空,則會引發 :exc:" -"`StatisticsError`。" +"``max(multimode(data))``。如果輸入的 *data* 為空,則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:472 msgid "" @@ -968,8 +967,8 @@ msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." msgstr "" -"回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參見 :func:" -"`pvariance`。" +"回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參" +"見 :func:`pvariance`。" #: ../../library/statistics.rst:521 msgid "" @@ -1098,8 +1097,8 @@ msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." msgstr "" -"回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參見 :func:" -"`variance`。" +"回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參" +"見 :func:`variance`。" #: ../../library/statistics.rst:593 msgid "" @@ -1217,12 +1216,12 @@ msgstr "" #: ../../library/statistics.rst:656 msgid "" -"If you somehow know the actual population mean μ you should pass it to the :" -"func:`pvariance` function as the *mu* parameter to get the variance of a " -"sample." +"If you somehow know the actual population mean μ you should pass it to " +"the :func:`pvariance` function as the *mu* parameter to get the variance of " +"a sample." msgstr "" -"若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳入 :func:" -"`pvariance` 函式來計算樣本變異數。" +"若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳" +"入 :func:`pvariance` 函式來計算樣本變異數。" #: ../../library/statistics.rst:662 msgid "" @@ -1244,14 +1243,13 @@ msgstr "" "如果 *n* 不是至少為 1,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:670 -#, fuzzy msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " "Raises :exc:`StatisticsError` if there is not at least one data point." msgstr "" "*data* 可以是包含樣本資料的任何 iterable。為了取得有意義的結果,*data* 中的資" -"料點數量應大於 *n*。如果資料點少於兩個,則引發 :exc:`StatisticsError`。" +"料點數量應大於 *n*。如果連一個資料點都沒有,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:674 msgid "" @@ -1331,8 +1329,8 @@ msgstr "" #: ../../library/statistics.rst:722 msgid "" -"Both inputs must be of the same length (no less than two), otherwise :exc:" -"`StatisticsError` is raised." +"Both inputs must be of the same length (no less than two), " +"otherwise :exc:`StatisticsError` is raised." msgstr "" "兩輸入必須具有相同長度(至少兩個),否則會引發 :exc:`StatisticsError`。" @@ -1397,8 +1395,8 @@ msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." msgstr "" -"兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引發 :exc:" -"`StatisticsError`。" +"兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:762 msgid "" @@ -1439,8 +1437,8 @@ msgstr "新增了對 Spearman 等級相關係數的支援。" #: ../../library/statistics.rst:794 msgid "" -"Return the slope and intercept of `simple linear regression `_ parameters estimated using " +"Return the slope and intercept of `simple linear regression `_ parameters estimated using " "ordinary least squares. Simple linear regression describes the relationship " "between an independent variable *x* and a dependent variable *y* in terms of " "this linear function:" @@ -1468,11 +1466,11 @@ msgstr "" #: ../../library/statistics.rst:808 msgid "" "Both inputs must be of the same length (no less than two), and the " -"independent variable *x* cannot be constant; otherwise a :exc:" -"`StatisticsError` is raised." +"independent variable *x* cannot be constant; otherwise " +"a :exc:`StatisticsError` is raised." msgstr "" -"兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引發 :exc:" -"`StatisticsError`。" +"兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:812 msgid "" @@ -1481,9 +1479,9 @@ msgid "" "cumulative number of Monty Python films that would have been produced by " "2019 assuming that they had kept the pace." msgstr "" -"舉例來說,我們可以使用 `Monty Python 系列電影的上映日期 `_\\ 來預測至 2019 年為止,假設他們保持" -"固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" +"舉例來說,我們可以使用 `Monty Python 系列電影的上映日期 `_\\ 來預測至 2019 年為止,假設他們" +"保持固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" #: ../../library/statistics.rst:818 msgid "" @@ -1538,6 +1536,18 @@ msgid "" ">>> [5_906, 10_152, 6_796, 6_450, 414] # actual distance in million km\n" "[5906, 10152, 6796, 6450, 414]" msgstr "" +">>> model = linear_regression(period_squared, dist_cubed, " +"proportional=True)\n" +">>> slope = model.slope\n" +"\n" +">>> # 矮行星: 冥王星、 鬩神星、 鳥神星、 妊神星、 穀神星\n" +">>> orbital_periods = [90_560, 204_199, 111_845, 103_410, 1_680] # 天數\n" +">>> predicted_dist = [math.cbrt(slope * (p * p)) for p in orbital_periods]\n" +">>> list(map(round, predicted_dist))\n" +"[5912, 10166, 6806, 6459, 414]\n" +"\n" +">>> [5_906, 10_152, 6_796, 6_450, 414] # 以百萬公里為單位的實際距離\n" +"[5906, 10152, 6796, 6450, 414]" #: ../../library/statistics.rst:854 msgid "Added support for *proportional*." @@ -1562,9 +1572,9 @@ msgstr ":class:`NormalDist` 物件" #: ../../library/statistics.rst:870 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " -"distributions of a `random variable `_. It is a class that treats the mean and " -"standard deviation of data measurements as a single entity." +"distributions of a `random variable `_. It is a class that treats the mean and standard " +"deviation of data measurements as a single entity." msgstr "" ":class:`NormalDist` 是一種用於建立與操作\\ `隨機變數 (random variable) " "`_ 的常態分布的工" @@ -1572,12 +1582,12 @@ msgstr "" #: ../../library/statistics.rst:876 msgid "" -"Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " +"Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " "applications in statistics." msgstr "" -"常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" +"常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" #: ../../library/statistics.rst:882 msgid "" @@ -1658,8 +1668,8 @@ msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." msgstr "" -"給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成的 :" -"class:`list`。" +"給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成" +"的 :class:`list`。" #: ../../library/statistics.rst:935 msgid "" @@ -1683,9 +1693,9 @@ msgid "" "random variable *X* will be near the given value *x*. Mathematically, it is " "the limit of the ratio ``P(x <= X < x+dx) / dx`` as *dx* approaches zero." msgstr "" -"利用\\ `機率密度函數 (probability density function, pdf) `_ 計算隨機變數 *X* 接近給定" -"值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " +"利用\\ `機率密度函數 (probability density function, pdf) `_ 計算隨機變數 *X* 接近給" +"定值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " "x+dx) / dx`` 在 *dx* 趨近於零時的極限值。" #: ../../library/statistics.rst:952 @@ -1705,23 +1715,24 @@ msgid "" "random variable *X* will be less than or equal to *x*. Mathematically, it " "is written ``P(X <= x)``." msgstr "" -"利用\\ `累積分布函式 (cumulative distribution function, cdf) `_ 計算隨機變數 *X* 小於" -"或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" +"利用\\ `累積分布函式 (cumulative distribution function, cdf) `_ 計算隨機變數 *X* 小" +"於或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" #: ../../library/statistics.rst:966 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " -"the `percent-point `_ " +"the `percent-point `_ " "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" "計算反累計分布函式 (inverse cumulative distribution function),也稱為\\ `分位" "數函式 (quantile function) `_ 或者\\ `百分率點 (percent-point) `_ 函式。數學上記為 ``x : P(X <= x) = p``。" +"Quantile_function>`_ 或者\\ `百分率點 (percent-point) `_ " +"函式。數學上記為 ``x : P(X <= x) = p``。" #: ../../library/statistics.rst:972 msgid "" @@ -1784,6 +1795,9 @@ msgid "" ">>> temperature_february * (9/5) + 32 # Fahrenheit\n" "NormalDist(mu=41.0, sigma=4.5)" msgstr "" +">>> temperature_february = NormalDist(5, 2.5) # 攝氏\n" +">>> temperature_february * (9/5) + 32 # 華氏\n" +"NormalDist(mu=41.0, sigma=4.5)" #: ../../library/statistics.rst:1013 msgid "" @@ -1797,13 +1811,13 @@ msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " "distributed random variables `_ represented as instances of :" -"class:`NormalDist`. For example:" +"Sum_of_normally_distributed_random_variables>`_ represented as instances " +"of :class:`NormalDist`. For example:" msgstr "" "由於常態分布源自於自變數的加法效應 (additive effects),因此可以\\ `將兩個獨立" "的常態分布隨機變數相加與相減 `_,並且表示為 :class:" -"`NormalDist` 的實例。例如:" +"Sum_of_normally_distributed_random_variables>`_,並且表示" +"為 :class:`NormalDist` 的實例。例如:" #: ../../library/statistics.rst:1022 msgid "" @@ -1902,7 +1916,7 @@ msgid "" ">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" ">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" ">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" -">>> quantiles(map(model, X, Y, Z)) \n" +">>> quantiles(map(model, X, Y, Z))\n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" msgstr "" ">>> def model(x, y, z):\n" @@ -1912,7 +1926,7 @@ msgstr "" ">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" ">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" ">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" -">>> quantiles(map(model, X, Y, Z)) \n" +">>> quantiles(map(model, X, Y, Z))\n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" #: ../../library/statistics.rst:1088 @@ -1926,8 +1940,8 @@ msgid "" "size is large and when the probability of a successful trial is near 50%." msgstr "" "當樣本數量夠大,且試驗成功的機率接近 50%,可以使用常態分布來近似\\ `二項分布 " -"(Binomial distributions) `_。" +"(Binomial distributions) `_。" #: ../../library/statistics.rst:1095 msgid "" @@ -1976,8 +1990,8 @@ msgstr "常態分布常在機器學習問題中出現。" #: ../../library/statistics.rst:1130 msgid "" -"Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " +"Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " "challenge is to predict a person's gender from measurements of normally " "distributed features including height, weight, and foot size." msgstr "" @@ -2030,9 +2044,9 @@ msgid "" "the prior times the product of likelihoods for the feature measurements " "given the gender:" msgstr "" -"從可能為男性或女性的 50% `先驗機率 (prior probability) `_ 為開端,我們將後驗機率 (posterior probability) " -"計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" +"從可能為男性或女性的 50% `先驗機率 (prior probability) `_ 為開端,我們將後驗機率 (posterior " +"probability) 計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" #: ../../library/statistics.rst:1162 msgid "" @@ -2086,8 +2100,8 @@ msgstr "" #~ "smoothing is controlled by a scaling parameter, ``h``, which is called " #~ "the *bandwidth*." #~ msgstr "" -#~ "基本想法是使用\\ `一個核函式如常態分布、三角分布或均勻分布 `_\\ 來使資料更加平滑。" #~ "平滑程度由一個縮放參數 ``h`` 控制,被稱為 *bandwidth*。" diff --git a/library/stdtypes.po b/library/stdtypes.po index 332f14e2f5..44218436f1 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-30 00:13+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,7 +29,7 @@ msgstr "內建型別" msgid "" "The following sections describe the standard types that are built into the " "interpreter." -msgstr "以下章節描述了直譯器中内建的標準型別。" +msgstr "以下章節描述了直譯器中內建的標準型別。" #: ../../library/stdtypes.rst:15 msgid "" @@ -65,22 +65,24 @@ msgstr "真值檢測" #: ../../library/stdtypes.rst:41 msgid "" -"Any object can be tested for truth value, for use in an :keyword:`if` or :" -"keyword:`while` condition or as operand of the Boolean operations below." +"Any object can be tested for truth value, for use in an :keyword:`if` " +"or :keyword:`while` condition or as operand of the Boolean operations below." msgstr "" -"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` 或 :keyword:" -"`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元所用。" +"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` " +"或 :keyword:`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元" +"所用。" #: ../../library/stdtypes.rst:46 msgid "" -"By default, an object is considered true unless its class defines either a :" -"meth:`~object.__bool__` method that returns ``False`` or a :meth:`~object." -"__len__` method that returns zero, when called with the object. [1]_ Here " -"are most of the built-in objects considered false:" +"By default, an object is considered true unless its class defines either " +"a :meth:`~object.__bool__` method that returns ``False`` or " +"a :meth:`~object.__len__` method that returns zero, when called with the " +"object. [1]_ Here are most of the built-in objects considered false:" msgstr "" -"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` 的 :" -"meth:`~object.__bool__` method 或是定義了會回傳零的 :meth:`~object.__len__` " -"method。[1]_ 以下列出了大部分會被視為 false 的內建物件:" +"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` " +"的 :meth:`~object.__bool__` method 或是定義了會回傳零" +"的 :meth:`~object.__len__` method。[1]_ 以下列出了大部分會被視為 false 的內建" +"物件:" #: ../../library/stdtypes.rst:56 msgid "constants defined to be false: ``None`` and ``False``" @@ -135,8 +137,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2432 -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2578 +#: ../../library/stdtypes.rst:3797 msgid "Notes" msgstr "註解" @@ -150,7 +152,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +166,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:2444 -#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:2590 +#: ../../library/stdtypes.rst:3807 ../../library/stdtypes.rst:3809 msgid "\\(2)" msgstr "\\(2)" @@ -178,18 +180,18 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979 -#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2446 -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:2450 -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3665 -#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3669 -#: ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:2596 +#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3811 +#: ../../library/stdtypes.rst:3813 ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3817 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2478 -#: ../../library/stdtypes.rst:3701 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2624 +#: ../../library/stdtypes.rst:3847 msgid "Notes:" msgstr "註解:" @@ -236,9 +238,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2409 -#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3628 -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2410 +#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:2578 +#: ../../library/stdtypes.rst:3774 ../../library/stdtypes.rst:3797 msgid "Meaning" msgstr "含義" @@ -325,23 +327,24 @@ msgid "" "Non-identical instances of a class normally compare as non-equal unless the " "class defines the :meth:`~object.__eq__` method." msgstr "" -"一個 class 的非相同實例通常會比較為不相等,除非 class 有定義 :meth:`~object." -"__eq__` method。" +"一個 class 的非相同實例通常會比較為不相等,除非 class 有定" +"義 :meth:`~object.__eq__` method。" #: ../../library/stdtypes.rst:184 msgid "" "Instances of a class cannot be ordered with respect to other instances of " "the same class, or other types of object, unless the class defines enough of " -"the methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object." -"__gt__`, and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and :" -"meth:`~object.__eq__` are sufficient, if you want the conventional meanings " -"of the comparison operators)." +"the " +"methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` " +"and :meth:`~object.__eq__` are sufficient, if you want the conventional " +"meanings of the comparison operators)." msgstr "" "一個 class 的實例不可以與其他相同 class 的實例或其他物件型別進行排序,除非 " -"class 定義足夠的 method ,包含 :meth:`~object.__lt__`、:meth:`~object." -"__le__`、:meth:`~object.__gt__` 及 :meth:`~object.__ge__`\\ (一般來說,使" -"用 :meth:`~object.__lt__` 及 :meth:`~object.__eq__` 就可以滿足常規意義上的比" -"較運算子)。" +"class 定義足夠的 method ,包" +"含 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " +"及 :meth:`~object.__ge__`\\ (一般來說,使用 :meth:`~object.__lt__` " +"及 :meth:`~object.__eq__` 就可以滿足常規意義上的比較運算子)。" #: ../../library/stdtypes.rst:191 msgid "" @@ -354,8 +357,8 @@ msgstr "" #: ../../library/stdtypes.rst:199 msgid "" -"Two more operations with the same syntactic priority, :keyword:`in` and :" -"keyword:`not in`, are supported by types that are :term:`iterable` or " +"Two more operations with the same syntactic priority, :keyword:`in` " +"and :keyword:`not in`, are supported by types that are :term:`iterable` or " "implement the :meth:`~object.__contains__` method." msgstr "" "此外,擁有相同的語法優先序的 :keyword:`in` 及 :keyword:`not in` 兩種運算皆被" @@ -373,20 +376,21 @@ msgid "" "subtype of integers. Integers have unlimited precision. Floating-point " "numbers are usually implemented using :c:expr:`double` in C; information " "about the precision and internal representation of floating-point numbers " -"for the machine on which your program is running is available in :data:`sys." -"float_info`. Complex numbers have a real and imaginary part, which are each " -"a floating-point number. To extract these parts from a complex number *z*, " -"use ``z.real`` and ``z.imag``. (The standard library includes the additional " -"numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal." -"Decimal`, for floating-point numbers with user-definable precision.)" +"for the machine on which your program is running is available " +"in :data:`sys.float_info`. Complex numbers have a real and imaginary part, " +"which are each a floating-point number. To extract these parts from a " +"complex number *z*, use ``z.real`` and ``z.imag``. (The standard library " +"includes the additional numeric types :mod:`fractions.Fraction`, for " +"rationals, and :mod:`decimal.Decimal`, for floating-point numbers with user-" +"definable precision.)" msgstr "" "數值型別共有三種::dfn:`整數`、:dfn:`浮點數` 及 :dfn:`複數`。此外,Boolean 為" -"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面的 :c:expr:" -"`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示法可以在 :" -"data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分各自是一個" -"浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 ``z.imag``。" -"(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表示有理數," -"而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" +"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面" +"的 :c:expr:`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示" +"法可以在 :data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分" +"各自是一個浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 " +"``z.imag``。(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表" +"示有理數,而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" #: ../../library/stdtypes.rst:238 msgid "" @@ -429,8 +433,8 @@ msgid "" "All numeric types (except complex) support the following operations (for " "priorities of the operations, see :ref:`operator-summary`):" msgstr "" -"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳見 :ref:" -"`operator-summary`):" +"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳" +"見 :ref:`operator-summary`):" #: ../../library/stdtypes.rst:276 msgid "Full documentation" @@ -559,7 +563,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3834 msgid "\\(6)" msgstr "\\(6)" @@ -597,9 +601,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:2468 -#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3684 -#: ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:2611 ../../library/stdtypes.rst:2614 +#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3830 +#: ../../library/stdtypes.rst:3837 msgid "\\(5)" msgstr "\\(5)" @@ -620,11 +624,11 @@ msgid "" "always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is " "``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``." msgstr "" -"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會是 :" -"class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會是 :class:" -"`float`。一般來說,結果會是一個整數,但其型別不一定會是 :class:`int`。結果總" -"是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、``(-1)//2`` 為 ``-1``、" -"``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" +"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會" +"是 :class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會" +"是 :class:`float`。一般來說,結果會是一個整數,但其型別不一定會" +"是 :class:`int`。結果總是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、" +"``(-1)//2`` 為 ``-1``、``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" #: ../../library/stdtypes.rst:331 msgid "" @@ -638,8 +642,8 @@ msgid "" "fractional part. See functions :func:`math.floor` and :func:`math.ceil` for " "alternative conversions." msgstr "" -"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳見 :func:" -"`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" +"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳" +"見 :func:`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" #: ../../library/stdtypes.rst:347 msgid "" @@ -758,8 +762,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:2458 -#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:2604 +#: ../../library/stdtypes.rst:3819 ../../library/stdtypes.rst:3823 msgid "\\(4)" msgstr "\\(4)" @@ -829,13 +833,13 @@ msgstr "向右移動 *n* 個位元等同於向下除法除以 ``pow(2, n)``。" #: ../../library/stdtypes.rst:446 msgid "" "Performing these calculations with at least one extra sign extension bit in " -"a finite two's complement representation (a working bit-width of ``1 + max(x." -"bit_length(), y.bit_length())`` or more) is sufficient to get the same " +"a finite two's complement representation (a working bit-width of ``1 + " +"max(x.bit_length(), y.bit_length())`` or more) is sufficient to get the same " "result as if there were an infinite number of sign bits." msgstr "" -"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + max(x." -"bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位元,便足" -"以得到與無窮多個符號位元相同的結果。" +"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + " +"max(x.bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位" +"元,便足以得到與無窮多個符號位元相同的結果。" #: ../../library/stdtypes.rst:453 msgid "Additional Methods on Integer Types" @@ -874,13 +878,13 @@ msgid "" "More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique " "positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. " "Equivalently, when ``abs(x)`` is small enough to have a correctly rounded " -"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x." -"bit_length()`` returns ``0``." +"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then " +"``x.bit_length()`` returns ``0``." msgstr "" "更準確來說,若 ``x`` 非為零,則 ``x.bit_length()`` 會得出滿足 ``2**(k-1) <= " "abs(x) < 2**k`` 的單一正整數 ``k``。同樣地,當 ``abs(x)`` 足夠小到能正確地取" -"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 ``x." -"bit_length()`` 會回傳 ``0``。" +"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 " +"``x.bit_length()`` 會回傳 ``0``。" #: ../../library/stdtypes.rst:475 ../../library/stdtypes.rst:498 #: ../../library/stdtypes.rst:543 ../../library/stdtypes.rst:587 @@ -933,9 +937,9 @@ msgstr "回傳表示一個整數的一列位元組。" #: ../../library/stdtypes.rst:519 msgid "" -"The integer is represented using *length* bytes, and defaults to 1. An :exc:" -"`OverflowError` is raised if the integer is not representable with the given " -"number of bytes." +"The integer is represented using *length* bytes, and defaults to 1. " +"An :exc:`OverflowError` is raised if the integer is not representable with " +"the given number of bytes." msgstr "" "此整數會使用 *length* 位元組表示,並且預設為 1。如果該整數無法用給定的位元組" "數來表示,則會引發 :exc:`OverflowError`。" @@ -981,8 +985,8 @@ msgid "" "However, when using the default arguments, don't try to convert a value " "greater than 255 or you'll get an :exc:`OverflowError`." msgstr "" -"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一個 :exc:" -"`OverflowError`。" +"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一" +"個 :exc:`OverflowError`。" #: ../../library/stdtypes.rst:545 msgid "" @@ -1028,8 +1032,8 @@ msgid "" "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " "most significant byte is at the beginning of the byte array. If *byteorder* " "is ``\"little\"``, the most significant byte is at the end of the byte " -"array. To request the native byte order of the host system, use :data:`sys." -"byteorder` as the byte order value." +"array. To request the native byte order of the host system, " +"use :data:`sys.byteorder` as the byte order value." msgstr "" "*byteorder* 引數決定了用來表示整數的位元組順序並且預設為 ``\"big\"``。如果 " "*byteorder* 是 ``\"big\"``,最重要的位元組位於位元組陣列的開頭。如果 " @@ -1087,8 +1091,8 @@ msgstr "" #: ../../library/stdtypes.rst:618 msgid "" -"Returns ``True``. Exists for duck type compatibility with :meth:`float." -"is_integer`." +"Returns ``True``. Exists for duck type compatibility " +"with :meth:`float.is_integer`." msgstr "回傳 ``True``。為了與 :meth:`float.is_integer` 的鴨子型別相容而存在。" #: ../../library/stdtypes.rst:623 @@ -1106,8 +1110,8 @@ msgstr "" #: ../../library/stdtypes.rst:630 msgid "" "Return a pair of integers whose ratio is exactly equal to the original " -"float. The ratio is in lowest terms and has a positive denominator. Raises :" -"exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." +"float. The ratio is in lowest terms and has a positive denominator. " +"Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." msgstr "" "回傳一對整數,其比率完全等於原始浮點數。比率是在最低條件下並且有一個正分母。" "在無窮大時引發 :exc:`OverflowError`,在 NaN 時引發 :exc:`ValueError`。" @@ -1164,8 +1168,8 @@ msgstr "" #: ../../library/stdtypes.rst:669 msgid "" -"Note that :meth:`float.hex` is an instance method, while :meth:`float." -"fromhex` is a class method." +"Note that :meth:`float.hex` is an instance method, " +"while :meth:`float.fromhex` is a class method." msgstr "" "請注意 :meth:`float.hex` 是一個實例 method,而 :meth:`float.fromhex` 是一個 " "class method。" @@ -1194,10 +1198,10 @@ msgstr "" "其中可選的 ``sign`` 可以是 ``+`` 或 ``-``,``integer`` 和 ``fraction`` 是十六" "進位數字的字串,而 ``exponent`` 是一個十進位整數並且有一個可選的前導符號。大" "小寫不重要,並且整數或小數部分至少有一個十六進位數字。這個語法與 C99 標準的" -"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別是 :meth:" -"`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並且 C 的 " -"``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可被 :" -"meth:`float.fromhex` 接受。" +"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別" +"是 :meth:`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並" +"且 C 的 ``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可" +"被 :meth:`float.fromhex` 接受。" #: ../../library/stdtypes.rst:689 msgid "" @@ -1240,27 +1244,29 @@ msgstr "數值型別的雜湊" #: ../../library/stdtypes.rst:711 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " -"that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." -"__hash__` method documentation for more details). For ease of " -"implementation and efficiency across a variety of numeric types (including :" -"class:`int`, :class:`float`, :class:`decimal.Decimal` and :class:`fractions." -"Fraction`) Python's hash for numeric types is based on a single mathematical " -"function that's defined for any rational number, and hence applies to all " -"instances of :class:`int` and :class:`fractions.Fraction`, and all finite " -"instances of :class:`float` and :class:`decimal.Decimal`. Essentially, this " -"function is given by reduction modulo ``P`` for a fixed prime ``P``. The " -"value of ``P`` is made available to Python as the :attr:`~sys.hash_info." -"modulus` attribute of :data:`sys.hash_info`." +"that ``hash(x) == hash(y)`` whenever ``x == y`` (see " +"the :meth:`~object.__hash__` method documentation for more details). For " +"ease of implementation and efficiency across a variety of numeric types " +"(including :class:`int`, :class:`float`, :class:`decimal.Decimal` " +"and :class:`fractions.Fraction`) Python's hash for numeric types is based on " +"a single mathematical function that's defined for any rational number, and " +"hence applies to all instances of :class:`int` " +"and :class:`fractions.Fraction`, and all finite instances of :class:`float` " +"and :class:`decimal.Decimal`. Essentially, this function is given by " +"reduction modulo ``P`` for a fixed prime ``P``. The value of ``P`` is made " +"available to Python as the :attr:`~sys.hash_info.modulus` attribute " +"of :data:`sys.hash_info`." msgstr "" "對於數字 ``x`` 和 ``y``,可能是不同型別,當 ``x == y`` 時,``hash(x) == " "hash(y)`` 是一個要求( 詳見 :meth:`~object.__hash__` method 的文件以獲得更多" -"細節)。為了實作的便利性和效率跨越各種數值型別(包括 :class:`int`、:class:" -"`float`、:class:`decimal.Decimal` 和 :class:`fractions.Fraction`)Python 的數" -"值型別的雜湊是基於一個數學函式,它對於任何有理數都是定義的,因此適用於所有 :" -"class:`int` 和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:" -"`float` 和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo" -"(模數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys." -"hash_info` 的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" +"細節)。為了實作的便利性和效率跨越各種數值型別(包" +"括 :class:`int`、:class:`float`、:class:`decimal.Decimal` " +"和 :class:`fractions.Fraction`)Python 的數值型別的雜湊是基於一個數學函式,它" +"對於任何有理數都是定義的,因此適用於所有 :class:`int` " +"和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:`float` " +"和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo(模" +"數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys.hash_info` " +"的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" #: ../../library/stdtypes.rst:726 msgid "" @@ -1315,21 +1321,23 @@ msgstr "" #: ../../library/stdtypes.rst:748 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " -"imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." -"imag * hash(z.imag)``, reduced modulo ``2**sys.hash_info.width`` so that it " -"lies in ``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - " -"1))``. Again, if the result is ``-1``, it's replaced with ``-2``." +"imaginary parts are combined by computing ``hash(z.real) + " +"sys.hash_info.imag * hash(z.imag)``, reduced modulo " +"``2**sys.hash_info.width`` so that it lies in " +"``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))``. " +"Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" "對於一個 :class:`complex` 值 ``z``,實部和虛部的雜湊值藉由 ``hash(z.real) + " -"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 ``2**sys.hash_info." -"width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - 1), 2**(sys." -"hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 ``-2``。" +"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 " +"``2**sys.hash_info.width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - " +"1), 2**(sys.hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 " +"``-2``。" #: ../../library/stdtypes.rst:756 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " -"the built-in hash, for computing the hash of a rational number, :class:" -"`float`, or :class:`complex`::" +"the built-in hash, for computing the hash of a rational " +"number, :class:`float`, or :class:`complex`::" msgstr "" "為了闡明上述規則,這裡有一些 Python 程式碼範例,等同於內建的雜湊,用於計算有" "理數、:class:`float` 或 :class:`complex` 的雜湊: ::" @@ -1376,8 +1384,8 @@ msgid "" "def hash_complex(z):\n" " \"\"\"Compute the hash of a complex number z.\"\"\"\n" "\n" -" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." -"imag)\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * " +"hash_float(z.imag)\n" " # do a signed reduction modulo 2**sys.hash_info.width\n" " M = 2**(sys.hash_info.width - 1)\n" " hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" @@ -1453,8 +1461,8 @@ msgstr "" #: ../../library/stdtypes.rst:858 msgid "" -"One method needs to be defined for container objects to provide :term:" -"`iterable` support:" +"One method needs to be defined for container objects to " +"provide :term:`iterable` support:" msgstr "" "需要為容器物件定義一個 method 來提供\\ :term:`可疊代物件 `\\ 支援:" @@ -1465,15 +1473,15 @@ msgid "" "of iteration, additional methods can be provided to specifically request " "iterators for those iteration types. (An example of an object supporting " "multiple forms of iteration would be a tree structure which supports both " -"breadth-first and depth-first traversal.) This method corresponds to the :c:" -"member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects " -"in the Python/C API." +"breadth-first and depth-first traversal.) This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" "回傳一個\\ :term:`疊代器 `\\ 物件。該物件需要支援下述的疊代器協定。" "如果一個容器支援不同型別的疊代,則可以提供額外的 methods 來專門請求這些疊代型" "別的疊代器。(支援多種形式疊代的物件的一個例子是支援廣度優先和深度優先遍歷的" -"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構的 :c:member:" -"`~PyTypeObject.tp_iter` 插槽。" +"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構" +"的 :c:member:`~PyTypeObject.tp_iter` 插槽。" #: ../../library/stdtypes.rst:874 msgid "" @@ -1485,9 +1493,10 @@ msgstr "" #: ../../library/stdtypes.rst:880 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " -"containers and iterators to be used with the :keyword:`for` and :keyword:" -"`in` statements. This method corresponds to the :c:member:`~PyTypeObject." -"tp_iter` slot of the type structure for Python objects in the Python/C API." +"containers and iterators to be used with the :keyword:`for` " +"and :keyword:`in` statements. This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" "回傳\\ :term:`疊代器 `\\ 物件本身。這是為了允許容器和疊代器都可以" "與 :keyword:`for` 和 :keyword:`in` 在陳述式中使用。此 method 對應於 Python/C " @@ -1500,9 +1509,9 @@ msgid "" "the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for " "Python objects in the Python/C API." msgstr "" -"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引發 :" -"exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型別結" -"構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" +"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引" +"發 :exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型" +"別結構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" #: ../../library/stdtypes.rst:894 msgid "" @@ -1516,8 +1525,8 @@ msgstr "" #: ../../library/stdtypes.rst:899 msgid "" -"Once an iterator's :meth:`~iterator.__next__` method raises :exc:" -"`StopIteration`, it must continue to do so on subsequent calls. " +"Once an iterator's :meth:`~iterator.__next__` method " +"raises :exc:`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" "一旦疊代器的 :meth:`~iterator.__next__` method 引發 :exc:`StopIteration`,則" @@ -1530,12 +1539,12 @@ msgstr "" #: ../../library/stdtypes.rst:909 msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " -"iterator protocol. If a container object's :meth:`~iterator.__iter__` " -"method is implemented as a generator, it will automatically return an " -"iterator object (technically, a generator object) supplying the :meth:`!" -"__iter__` and :meth:`~generator.__next__` methods. More information about " -"generators can be found in :ref:`the documentation for the yield expression " -"`." +"iterator protocol. If a container object's :meth:`~object.__iter__` method " +"is implemented as a generator, it will automatically return an iterator " +"object (technically, a generator object) supplying " +"the :meth:`~iterator.__iter__` and :meth:`~generator.__next__` methods. More " +"information about generators can be found in :ref:`the documentation for the " +"yield expression `." msgstr "" #: ../../library/stdtypes.rst:921 @@ -1584,7 +1593,7 @@ msgstr "``x in s``" #: ../../library/stdtypes.rst:967 msgid "``True`` if an item of *s* is equal to *x*, else ``False``" -msgstr "" +msgstr "如果 *s* 的一個項目等於 *x* 則為 ``True``,否則為 ``False``" #: ../../library/stdtypes.rst:970 msgid "``x not in s``" @@ -1592,7 +1601,7 @@ msgstr "``x not in s``" #: ../../library/stdtypes.rst:970 msgid "``False`` if an item of *s* is equal to *x*, else ``True``" -msgstr "" +msgstr "如果 *s* 的一個項目等於 *x* 則為 ``False``,否則為 ``True``" #: ../../library/stdtypes.rst:973 msgid "``s + t``" @@ -1600,7 +1609,7 @@ msgstr "``s + t``" #: ../../library/stdtypes.rst:973 msgid "the concatenation of *s* and *t*" -msgstr "" +msgstr "*s* 和 *t* 的串接" #: ../../library/stdtypes.rst:973 msgid "(6)(7)" @@ -1612,7 +1621,7 @@ msgstr "``s * n`` 或 ``n * s``" #: ../../library/stdtypes.rst:976 msgid "equivalent to adding *s* to itself *n* times" -msgstr "" +msgstr "等同於將 *s* 加到自己 *n* 次" #: ../../library/stdtypes.rst:976 msgid "(2)(7)" @@ -1624,7 +1633,7 @@ msgstr "``s[i]``" #: ../../library/stdtypes.rst:979 msgid "*i*\\ th item of *s*, origin 0" -msgstr "" +msgstr "*s* 的第 *i* 項,起始為 0" #: ../../library/stdtypes.rst:981 msgid "``s[i:j]``" @@ -1684,7 +1693,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3805 msgid "\\(8)" msgstr "\\(8)" @@ -1694,7 +1703,7 @@ msgstr "``s.count(x)``" #: ../../library/stdtypes.rst:996 msgid "total number of occurrences of *x* in *s*" -msgstr "" +msgstr "*s* 中 *x* 的總出現次數" #: ../../library/stdtypes.rst:1000 msgid "" @@ -1709,9 +1718,9 @@ msgstr "" msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " -"underlying sequence is mutated. The iterator terminates only when an :exc:" -"`IndexError` or a :exc:`StopIteration` is encountered (or when the index " -"drops below zero)." +"underlying sequence is mutated. The iterator terminates only when " +"an :exc:`IndexError` or a :exc:`StopIteration` is encountered (or when the " +"index drops below zero)." msgstr "" #: ../../library/stdtypes.rst:1019 @@ -1823,17 +1832,17 @@ msgstr "" #: ../../library/stdtypes.rst:1084 msgid "" -"if concatenating :class:`str` objects, you can build a list and use :meth:" -"`str.join` at the end or else write to an :class:`io.StringIO` instance and " -"retrieve its value when complete" +"if concatenating :class:`str` objects, you can build a list and " +"use :meth:`str.join` at the end or else write to an :class:`io.StringIO` " +"instance and retrieve its value when complete" msgstr "" #: ../../library/stdtypes.rst:1088 msgid "" -"if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." -"join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" -"class:`bytearray` object. :class:`bytearray` objects are mutable and have " -"an efficient overallocation mechanism" +"if concatenating :class:`bytes` objects, you can similarly " +"use :meth:`bytes.join` or :class:`io.BytesIO`, or you can do in-place " +"concatenation with a :class:`bytearray` object. :class:`bytearray` objects " +"are mutable and have an efficient overallocation mechanism" msgstr "" #: ../../library/stdtypes.rst:1093 @@ -1868,15 +1877,15 @@ msgstr "" #: ../../library/stdtypes.rst:1122 msgid "" "The only operation that immutable sequence types generally implement that is " -"not also implemented by mutable sequence types is support for the :func:" -"`hash` built-in." +"not also implemented by mutable sequence types is support for " +"the :func:`hash` built-in." msgstr "" #: ../../library/stdtypes.rst:1126 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " -"to be used as :class:`dict` keys and stored in :class:`set` and :class:" -"`frozenset` instances." +"to be used as :class:`dict` keys and stored in :class:`set` " +"and :class:`frozenset` instances." msgstr "" #: ../../library/stdtypes.rst:1130 @@ -2048,9 +2057,9 @@ msgstr "" msgid "" ":meth:`clear` and :meth:`!copy` are included for consistency with the " "interfaces of mutable containers that don't support slicing operations (such " -"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of the :class:" -"`collections.abc.MutableSequence` ABC, but most concrete mutable sequence " -"classes provide it." +"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of " +"the :class:`collections.abc.MutableSequence` ABC, but most concrete mutable " +"sequence classes provide it." msgstr "" #: ../../library/stdtypes.rst:1245 @@ -2059,10 +2068,11 @@ msgstr "" #: ../../library/stdtypes.rst:1249 msgid "" -"The value *n* is an integer, or an object implementing :meth:`~object." -"__index__`. Zero and negative values of *n* clear the sequence. Items in " -"the sequence are not copied; they are referenced multiple times, as " -"explained for ``s * n`` under :ref:`typesseq-common`." +"The value *n* is an integer, or an object " +"implementing :meth:`~object.__index__`. Zero and negative values of *n* " +"clear the sequence. Items in the sequence are not copied; they are " +"referenced multiple times, as explained for ``s * n`` under :ref:`typesseq-" +"common`." msgstr "" #: ../../library/stdtypes.rst:1258 @@ -2131,8 +2141,8 @@ msgstr "" #: ../../library/stdtypes.rst:1298 msgid "" -":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" -"`keyword-only arguments `):" +":meth:`sort` accepts two arguments that can only be passed by keyword " +"(:ref:`keyword-only arguments `):" msgstr "" #: ../../library/stdtypes.rst:1301 @@ -2194,8 +2204,8 @@ msgid "" "Tuples are immutable sequences, typically used to store collections of " "heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " "built-in). Tuples are also used for cases where an immutable sequence of " -"homogeneous data is needed (such as allowing storage in a :class:`set` or :" -"class:`dict` instance)." +"homogeneous data is needed (such as allowing storage in a :class:`set` " +"or :class:`dict` instance)." msgstr "" #: ../../library/stdtypes.rst:1349 @@ -2263,8 +2273,8 @@ msgstr "" #: ../../library/stdtypes.rst:1392 msgid "" -"The arguments to the range constructor must be integers (either built-in :" -"class:`int` or any object that implements the :meth:`~object.__index__` " +"The arguments to the range constructor must be integers (either built-" +"in :class:`int` or any object that implements the :meth:`~object.__index__` " "special method). If the *step* argument is omitted, it defaults to ``1``. " "If the *start* argument is omitted, it defaults to ``0``. If *step* is " "zero, :exc:`ValueError` is raised." @@ -2293,8 +2303,8 @@ msgstr "" #: ../../library/stdtypes.rst:1411 msgid "" "Ranges containing absolute values larger than :data:`sys.maxsize` are " -"permitted but some features (such as :func:`len`) may raise :exc:" -"`OverflowError`." +"permitted but some features (such as :func:`len`) may " +"raise :exc:`OverflowError`." msgstr "" #: ../../library/stdtypes.rst:1415 @@ -2359,8 +2369,8 @@ msgstr "" #: ../../library/stdtypes.rst:1451 msgid "" -"The advantage of the :class:`range` type over a regular :class:`list` or :" -"class:`tuple` is that a :class:`range` object will always take the same " +"The advantage of the :class:`range` type over a regular :class:`list` " +"or :class:`tuple` is that a :class:`range` object will always take the same " "(small) amount of memory, no matter the size of the range it represents (as " "it only stores the ``start``, ``stop`` and ``step`` values, calculating " "individual items and subranges as needed)." @@ -2385,9 +2395,9 @@ msgstr "" #: ../../library/stdtypes.rst:1484 msgid "" -"Implement the Sequence ABC. Support slicing and negative indices. Test :" -"class:`int` objects for membership in constant time instead of iterating " -"through all items." +"Implement the Sequence ABC. Support slicing and negative indices. " +"Test :class:`int` objects for membership in constant time instead of " +"iterating through all items." msgstr "" #: ../../library/stdtypes.rst:1490 @@ -2415,9 +2425,9 @@ msgstr "" #: ../../library/stdtypes.rst:1514 msgid "" -"Textual data in Python is handled with :class:`str` objects, or :dfn:" -"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " -"points. String literals are written in a variety of ways:" +"Textual data in Python is handled with :class:`str` objects, " +"or :dfn:`strings`. Strings are immutable :ref:`sequences ` of " +"Unicode code points. String literals are written in a variety of ways:" msgstr "" #: ../../library/stdtypes.rst:1519 @@ -2468,9 +2478,9 @@ msgstr "" #: ../../library/stdtypes.rst:1543 msgid "" -"There is also no mutable string type, but :meth:`str.join` or :class:`io." -"StringIO` can be used to efficiently construct strings from multiple " -"fragments." +"There is also no mutable string type, but :meth:`str.join` " +"or :class:`io.StringIO` can be used to efficiently construct strings from " +"multiple fragments." msgstr "" #: ../../library/stdtypes.rst:1547 @@ -2489,24 +2499,24 @@ msgstr "" #: ../../library/stdtypes.rst:1563 msgid "" -"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" -"`type(object).__str__(object) `, which is the \"informal\" " -"or nicely printable string representation of *object*. For string objects, " -"this is the string itself. If *object* does not have a :meth:`~object." -"__str__` method, then :func:`str` falls back to returning :func:" -"`repr(object) `." +"If neither *encoding* nor *errors* is given, ``str(object)`` " +"returns :meth:`type(object).__str__(object) `, which is the " +"\"informal\" or nicely printable string representation of *object*. For " +"string objects, this is the string itself. If *object* does not have " +"a :meth:`~object.__str__` method, then :func:`str` falls back to " +"returning :func:`repr(object) `." msgstr "" #: ../../library/stdtypes.rst:1575 msgid "" -"If at least one of *encoding* or *errors* is given, *object* should be a :" -"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " +"If at least one of *encoding* or *errors* is given, *object* should be " +"a :term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " "this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " -"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." -"decode(encoding, errors) `. Otherwise, the bytes object " -"underlying the buffer object is obtained before calling :meth:`bytes." -"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " -"buffer objects." +"then ``str(bytes, encoding, errors)`` is equivalent " +"to :meth:`bytes.decode(encoding, errors) `. Otherwise, the " +"bytes object underlying the buffer object is obtained before " +"calling :meth:`bytes.decode`. See :ref:`binaryseq` and :ref:`bufferobjects` " +"for information on buffer objects." msgstr "" #: ../../library/stdtypes.rst:1584 @@ -2527,10 +2537,10 @@ msgstr "" #: ../../library/stdtypes.rst:1592 msgid "" -"For more information on the ``str`` class and its methods, see :ref:" -"`textseq` and the :ref:`string-methods` section below. To output formatted " -"strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " -"addition, see the :ref:`stringservices` section." +"For more information on the ``str`` class and its methods, " +"see :ref:`textseq` and the :ref:`string-methods` section below. To output " +"formatted strings, see the :ref:`f-strings` and :ref:`formatstrings` " +"sections. In addition, see the :ref:`stringservices` section." msgstr "" #: ../../library/stdtypes.rst:1604 @@ -2546,11 +2556,11 @@ msgstr "" #: ../../library/stdtypes.rst:1612 msgid "" "Strings also support two styles of string formatting, one providing a large " -"degree of flexibility and customization (see :meth:`str.format`, :ref:" -"`formatstrings` and :ref:`string-formatting`) and the other based on C " -"``printf`` style formatting that handles a narrower range of types and is " -"slightly harder to use correctly, but is often faster for the cases it can " -"handle (:ref:`old-string-formatting`)." +"degree of flexibility and customization " +"(see :meth:`str.format`, :ref:`formatstrings` and :ref:`string-formatting`) " +"and the other based on C ``printf`` style formatting that handles a narrower " +"range of types and is slightly harder to use correctly, but is often faster " +"for the cases it can handle (:ref:`old-string-formatting`)." msgstr "" #: ../../library/stdtypes.rst:1619 @@ -2584,8 +2594,8 @@ msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " "German lowercase letter ``'ß'`` is equivalent to ``\"ss\"``. Since it is " -"already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:" -"`casefold` converts it to ``\"ss\"``." +"already lowercase, :meth:`lower` would do nothing to " +"``'ß'``; :meth:`casefold` converts it to ``\"ss\"``." msgstr "" #: ../../library/stdtypes.rst:1644 @@ -2619,7 +2629,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2824 +#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2970 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2630,25 +2640,25 @@ msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " "are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, " -"``'backslashreplace'`` and any other name registered via :func:`codecs." -"register_error`. See :ref:`error-handlers` for details." +"``'backslashreplace'`` and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" #: ../../library/stdtypes.rst:1683 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" -"ref:`debug build ` is used." +"unless an encoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2843 +#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2989 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2846 +#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2992 msgid "" -"The value of the *errors* argument is now checked in :ref:`devmode` and in :" -"ref:`debug mode `." +"The value of the *errors* argument is now checked in :ref:`devmode` and " +"in :ref:`debug mode `." msgstr "" #: ../../library/stdtypes.rst:1698 @@ -2685,8 +2695,8 @@ msgstr "" #: ../../library/stdtypes.rst:1733 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" #: ../../library/stdtypes.rst:1737 @@ -2715,13 +2725,14 @@ msgstr "" #: ../../library/stdtypes.rst:1757 msgid "" -"When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" -"class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." -"format(1234)``), the function temporarily sets the ``LC_CTYPE`` locale to " -"the ``LC_NUMERIC`` locale to decode ``decimal_point`` and ``thousands_sep`` " -"fields of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, " -"and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " -"This temporary change affects other threads." +"When formatting a number " +"(:class:`int`, :class:`float`, :class:`complex`, :class:`decimal.Decimal` " +"and subclasses) with the ``n`` type (ex: ``'{:n}'.format(1234)``), the " +"function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " +"locale to decode ``decimal_point`` and ``thousands_sep`` fields " +"of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, and the " +"``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. This " +"temporary change affects other threads." msgstr "" #: ../../library/stdtypes.rst:1766 @@ -2747,20 +2758,20 @@ msgstr "" msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " -"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c." -"isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." +"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, " +"``c.isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" #: ../../library/stdtypes.rst:1804 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " -"those characters defined in the Unicode character database as \"Letter\", i." -"e., those with general category property being one of \"Lm\", \"Lt\", " +"those characters defined in the Unicode character database as \"Letter\", " +"i.e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " -"of the Unicode Standard `_." +"of the Unicode Standard `_." msgstr "" #: ../../library/stdtypes.rst:1815 @@ -2839,29 +2850,42 @@ msgstr "" #: ../../library/stdtypes.rst:1879 msgid "" -"Return ``True`` if all characters in the string are printable or the string " -"is empty, ``False`` otherwise. Nonprintable characters are those characters " -"defined in the Unicode character database as \"Other\" or \"Separator\", " -"excepting the ASCII space (0x20) which is considered printable. (Note that " -"printable characters in this context are those which should not be escaped " -"when :func:`repr` is invoked on a string. It has no bearing on the handling " -"of strings written to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return true if all characters in the string are printable, false if it " +"contains at least one non-printable character." msgstr "" -#: ../../library/stdtypes.rst:1890 +#: ../../library/stdtypes.rst:1882 +msgid "" +"Here \"printable\" means the character is suitable for :func:`repr` to use " +"in its output; \"non-printable\" means that :func:`repr` on built-in types " +"will hex-escape the character. It has no bearing on the handling of strings " +"written to :data:`sys.stdout` or :data:`sys.stderr`." +msgstr "" + +#: ../../library/stdtypes.rst:1887 +msgid "" +"The printable characters are those which in the Unicode character database " +"(see :mod:`unicodedata`) have a general category in group Letter, Mark, " +"Number, Punctuation, or Symbol (L, M, N, P, or S); plus the ASCII space " +"0x20. Nonprintable characters are those in group Separator or Other (Z or " +"C), except the ASCII space." +msgstr "" + +#: ../../library/stdtypes.rst:1896 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1893 +#: ../../library/stdtypes.rst:1899 msgid "" -"A character is *whitespace* if in the Unicode character database (see :mod:" -"`unicodedata`), either its general category is ``Zs`` (\"Separator, " -"space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." +"A character is *whitespace* if in the Unicode character database " +"(see :mod:`unicodedata`), either its general category is ``Zs`` " +"(\"Separator, space\"), or its bidirectional class is one of ``WS``, ``B``, " +"or ``S``." msgstr "" -#: ../../library/stdtypes.rst:1901 +#: ../../library/stdtypes.rst:1907 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -2869,41 +2893,41 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1908 +#: ../../library/stdtypes.rst:1914 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1926 +#: ../../library/stdtypes.rst:1932 msgid "" -"Return a string which is the concatenation of the strings in *iterable*. A :" -"exc:`TypeError` will be raised if there are any non-string values in " +"Return a string which is the concatenation of the strings in *iterable*. " +"A :exc:`TypeError` will be raised if there are any non-string values in " "*iterable*, including :class:`bytes` objects. The separator between " "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1934 +#: ../../library/stdtypes.rst:1940 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1941 +#: ../../library/stdtypes.rst:1947 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:1944 +#: ../../library/stdtypes.rst:1950 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:1951 +#: ../../library/stdtypes.rst:1957 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -2912,7 +2936,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:1956 +#: ../../library/stdtypes.rst:1962 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -2924,13 +2948,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:1961 +#: ../../library/stdtypes.rst:1967 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:1964 +#: ../../library/stdtypes.rst:1970 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -2942,13 +2966,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:1972 +#: ../../library/stdtypes.rst:1978 msgid "" -"This static method returns a translation table usable for :meth:`str." -"translate`." +"This static method returns a translation table usable " +"for :meth:`str.translate`." msgstr "" -#: ../../library/stdtypes.rst:1974 +#: ../../library/stdtypes.rst:1980 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -2956,7 +2980,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:1979 +#: ../../library/stdtypes.rst:1985 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in x will be mapped to the character at " @@ -2964,7 +2988,7 @@ msgid "" "whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:1987 +#: ../../library/stdtypes.rst:1993 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -2972,13 +2996,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:1995 +#: ../../library/stdtypes.rst:2001 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:1999 +#: ../../library/stdtypes.rst:2005 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -2990,14 +3014,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2009 +#: ../../library/stdtypes.rst:2015 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:2013 +#: ../../library/stdtypes.rst:2019 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3009,7 +3033,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2023 +#: ../../library/stdtypes.rst:2029 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3017,31 +3041,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2027 +#: ../../library/stdtypes.rst:2033 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2033 +#: ../../library/stdtypes.rst:2039 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2040 +#: ../../library/stdtypes.rst:2046 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2046 +#: ../../library/stdtypes.rst:2052 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2053 +#: ../../library/stdtypes.rst:2059 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3049,7 +3073,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2061 +#: ../../library/stdtypes.rst:2067 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3058,7 +3082,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2070 +#: ../../library/stdtypes.rst:2076 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3067,7 +3091,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2075 +#: ../../library/stdtypes.rst:2081 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3079,13 +3103,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2080 +#: ../../library/stdtypes.rst:2086 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2083 +#: ../../library/stdtypes.rst:2089 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3097,7 +3121,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2090 +#: ../../library/stdtypes.rst:2096 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3106,30 +3130,30 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2096 +#: ../../library/stdtypes.rst:2102 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " "``['1', '', '2']``). The *sep* argument may consist of multiple characters " -"as a single delimiter (to split with multiple delimiters, use :func:`re." -"split`). Splitting an empty string with a specified separator returns " -"``['']``." -msgstr "" - -#: ../../library/stdtypes.rst:2103 ../../library/stdtypes.rst:2121 -#: ../../library/stdtypes.rst:2173 ../../library/stdtypes.rst:2241 -#: ../../library/stdtypes.rst:2309 ../../library/stdtypes.rst:3161 -#: ../../library/stdtypes.rst:3179 ../../library/stdtypes.rst:3270 -#: ../../library/stdtypes.rst:3286 ../../library/stdtypes.rst:3311 -#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3353 -#: ../../library/stdtypes.rst:3367 ../../library/stdtypes.rst:3385 -#: ../../library/stdtypes.rst:3412 ../../library/stdtypes.rst:3435 -#: ../../library/stdtypes.rst:3462 ../../library/stdtypes.rst:3504 -#: ../../library/stdtypes.rst:3528 +"as a single delimiter (to split with multiple delimiters, " +"use :func:`re.split`). Splitting an empty string with a specified separator " +"returns ``['']``." +msgstr "" + +#: ../../library/stdtypes.rst:2109 ../../library/stdtypes.rst:2127 +#: ../../library/stdtypes.rst:2179 ../../library/stdtypes.rst:2247 +#: ../../library/stdtypes.rst:2315 ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3416 +#: ../../library/stdtypes.rst:3432 ../../library/stdtypes.rst:3457 +#: ../../library/stdtypes.rst:3471 ../../library/stdtypes.rst:3499 +#: ../../library/stdtypes.rst:3513 ../../library/stdtypes.rst:3531 +#: ../../library/stdtypes.rst:3558 ../../library/stdtypes.rst:3581 +#: ../../library/stdtypes.rst:3608 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:3674 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2105 +#: ../../library/stdtypes.rst:2111 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3149,7 +3173,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2114 +#: ../../library/stdtypes.rst:2120 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3159,7 +3183,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2123 +#: ../../library/stdtypes.rst:2129 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3175,120 +3199,120 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2136 +#: ../../library/stdtypes.rst:2142 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2140 +#: ../../library/stdtypes.rst:2146 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2144 +#: ../../library/stdtypes.rst:2150 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2144 +#: ../../library/stdtypes.rst:2150 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2146 +#: ../../library/stdtypes.rst:2152 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2146 +#: ../../library/stdtypes.rst:2152 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2148 +#: ../../library/stdtypes.rst:2154 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2148 +#: ../../library/stdtypes.rst:2154 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2156 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2156 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2158 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2158 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2160 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2160 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2162 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2162 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2164 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2164 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2166 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2166 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2168 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2168 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2170 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2170 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2172 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2172 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2171 +#: ../../library/stdtypes.rst:2177 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2175 +#: ../../library/stdtypes.rst:2181 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3300,14 +3324,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2180 +#: ../../library/stdtypes.rst:2186 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2184 +#: ../../library/stdtypes.rst:2190 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3319,11 +3343,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2189 +#: ../../library/stdtypes.rst:2195 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2191 +#: ../../library/stdtypes.rst:2197 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3335,7 +3359,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2199 +#: ../../library/stdtypes.rst:2205 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3343,7 +3367,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2207 +#: ../../library/stdtypes.rst:2213 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3352,7 +3376,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2213 +#: ../../library/stdtypes.rst:2219 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3364,7 +3388,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2218 +#: ../../library/stdtypes.rst:2224 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3372,7 +3396,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2224 +#: ../../library/stdtypes.rst:2230 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3382,20 +3406,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2237 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " -"and vice versa. Note that it is not necessarily true that ``s.swapcase()." -"swapcase() == s``." +"and vice versa. Note that it is not necessarily true that " +"``s.swapcase().swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2238 +#: ../../library/stdtypes.rst:2244 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2243 +#: ../../library/stdtypes.rst:2249 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3403,7 +3427,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2246 ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:2252 ../../library/stdtypes.rst:3618 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3411,7 +3435,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2257 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3419,19 +3443,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2254 +#: ../../library/stdtypes.rst:2260 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2257 +#: ../../library/stdtypes.rst:2263 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2260 +#: ../../library/stdtypes.rst:2266 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3451,31 +3475,31 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2272 +#: ../../library/stdtypes.rst:2278 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " -"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` or :" -"term:`sequence`. When indexed by a Unicode ordinal (an integer), the table " -"object can do any of the following: return a Unicode ordinal or a string, to " -"map the character to one or more other characters; return ``None``, to " -"delete the character from the return string; or raise a :exc:`LookupError` " -"exception, to map the character to itself." +"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` " +"or :term:`sequence`. When indexed by a Unicode ordinal (an integer), the " +"table object can do any of the following: return a Unicode ordinal or a " +"string, to map the character to one or more other characters; return " +"``None``, to delete the character from the return string; or raise " +"a :exc:`LookupError` exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2281 +#: ../../library/stdtypes.rst:2287 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2284 +#: ../../library/stdtypes.rst:2290 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2290 +#: ../../library/stdtypes.rst:2296 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3484,14 +3508,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2296 +#: ../../library/stdtypes.rst:2302 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2303 +#: ../../library/stdtypes.rst:2309 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3499,7 +3523,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2311 +#: ../../library/stdtypes.rst:2317 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3511,11 +3535,197 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2321 +#: ../../library/stdtypes.rst:2338 +msgid "Formatted String Literals (f-strings)" +msgstr "" + +#: ../../library/stdtypes.rst:2341 +msgid "" +"The :keyword:`await` and :keyword:`async for` can be used in expressions " +"within f-strings." +msgstr "" + +#: ../../library/stdtypes.rst:2344 +msgid "Added the debugging operator (``=``)" +msgstr "" + +#: ../../library/stdtypes.rst:2346 +msgid "" +"Many restrictions on expressions within f-strings have been removed. " +"Notably, nested strings, comments, and backslashes are now permitted." +msgstr "" + +#: ../../library/stdtypes.rst:2350 +msgid "" +"An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " +"literal that is prefixed with ``f`` or ``F``. This type of string literal " +"allows embedding arbitrary Python expressions within *replacement fields*, " +"which are delimited by curly brackets (``{}``). These expressions are " +"evaluated at runtime, similarly to :meth:`str.format`, and are converted " +"into regular :class:`str` objects. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2358 +msgid "" +">>> who = 'nobody'\n" +">>> nationality = 'Spanish'\n" +">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +"'Nobody expects the Spanish Inquisition!'" +msgstr "" + +#: ../../library/stdtypes.rst:2365 +msgid "It is also possible to use a multi line f-string:" +msgstr "" + +#: ../../library/stdtypes.rst:2367 +msgid "" +">>> f'''This is a string\n" +"... on two lines'''\n" +"'This is a string\\non two lines'" +msgstr "" + +#: ../../library/stdtypes.rst:2373 +msgid "" +"A single opening curly bracket, ``'{'``, marks a *replacement field* that " +"can contain any Python expression:" +msgstr "" + +#: ../../library/stdtypes.rst:2376 +msgid "" +">>> nationality = 'Spanish'\n" +">>> f'The {nationality} Inquisition!'\n" +"'The Spanish Inquisition!'" +msgstr "" + +#: ../../library/stdtypes.rst:2382 +msgid "To include a literal ``{`` or ``}``, use a double bracket:" +msgstr "" + +#: ../../library/stdtypes.rst:2384 +msgid "" +">>> x = 42\n" +">>> f'{{x}} is {x}'\n" +"'{x} is 42'" +msgstr "" + +#: ../../library/stdtypes.rst:2390 +msgid "" +"Functions can also be used, and :ref:`format specifiers `:" +msgstr "" + +#: ../../library/stdtypes.rst:2392 +msgid "" +">>> from math import sqrt\n" +">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +"'√2 ≈ 1.41421'" +msgstr "" + +#: ../../library/stdtypes.rst:2398 +msgid "Any non-string expression is converted using :func:`str`, by default:" +msgstr "" + +#: ../../library/stdtypes.rst:2400 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)}'\n" +"'1/3'" +msgstr "" + +#: ../../library/stdtypes.rst:2406 +msgid "" +"To use an explicit conversion, use the ``!`` (exclamation mark) operator, " +"followed by any of the valid formats, which are:" +msgstr "" + +#: ../../library/stdtypes.rst:2410 ../../library/stdtypes.rst:2578 +#: ../../library/stdtypes.rst:3797 +msgid "Conversion" +msgstr "" + +#: ../../library/stdtypes.rst:2412 +msgid "``!a``" +msgstr "``!a``" + +#: ../../library/stdtypes.rst:2412 +msgid ":func:`ascii`" +msgstr ":func:`ascii`" + +#: ../../library/stdtypes.rst:2413 +msgid "``!r``" +msgstr "``!r``" + +#: ../../library/stdtypes.rst:2413 +msgid ":func:`repr`" +msgstr ":func:`repr`" + +#: ../../library/stdtypes.rst:2414 +msgid "``!s``" +msgstr "``!s``" + +#: ../../library/stdtypes.rst:2414 +msgid ":func:`str`" +msgstr ":func:`str`" + +#: ../../library/stdtypes.rst:2417 +msgid "For example:" +msgstr "舉例來說:" + +#: ../../library/stdtypes.rst:2419 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)!s}'\n" +"'1/3'\n" +">>> f'{Fraction(1, 3)!r}'\n" +"'Fraction(1, 3)'\n" +">>> question = '¿Dónde está el Presidente?'\n" +">>> print(f'{question!a}')\n" +"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" +msgstr "" + +#: ../../library/stdtypes.rst:2430 +msgid "" +"While debugging it may be helpful to see both the expression and its value, " +"by using the equals sign (``=``) after the expression. This preserves spaces " +"within the brackets, and can be used with a converter. By default, the " +"debugging operator uses the :func:`repr` (``!r``) conversion. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2436 +msgid "" +">>> from fractions import Fraction\n" +">>> calculation = Fraction(1, 3)\n" +">>> f'{calculation=}'\n" +"'calculation=Fraction(1, 3)'\n" +">>> f'{calculation = }'\n" +"'calculation = Fraction(1, 3)'\n" +">>> f'{calculation = !s}'\n" +"'calculation = 1/3'" +msgstr "" + +#: ../../library/stdtypes.rst:2447 +msgid "" +"Once the output has been evaluated, it can be formatted using a :ref:`format " +"specifier ` following a colon (``':'``). After the expression " +"has been evaluated, and possibly converted to a string, the :meth:`!" +"__format__` method of the result is called with the format specifier, or the " +"empty string if no format specifier is given. The formatted result is then " +"used as the final value for the replacement field. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2455 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 7):.6f}'\n" +"'0.142857'\n" +">>> f'{Fraction(1, 7):_^+10}'\n" +"'___+1/7___'" +msgstr "" + +#: ../../library/stdtypes.rst:2467 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2334 +#: ../../library/stdtypes.rst:2480 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3526,7 +3736,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2342 +#: ../../library/stdtypes.rst:2488 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3536,13 +3746,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2349 +#: ../../library/stdtypes.rst:2495 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2354 +#: ../../library/stdtypes.rst:2500 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3550,36 +3760,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2364 ../../library/stdtypes.rst:3583 +#: ../../library/stdtypes.rst:2510 ../../library/stdtypes.rst:3729 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3586 +#: ../../library/stdtypes.rst:2513 ../../library/stdtypes.rst:3732 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2369 ../../library/stdtypes.rst:3588 +#: ../../library/stdtypes.rst:2515 ../../library/stdtypes.rst:3734 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:3591 +#: ../../library/stdtypes.rst:2518 ../../library/stdtypes.rst:3737 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 +#: ../../library/stdtypes.rst:2521 ../../library/stdtypes.rst:3740 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2379 ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:2525 ../../library/stdtypes.rst:3744 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3587,15 +3797,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2384 ../../library/stdtypes.rst:3603 +#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3749 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2386 ../../library/stdtypes.rst:3605 +#: ../../library/stdtypes.rst:2532 ../../library/stdtypes.rst:3751 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2388 +#: ../../library/stdtypes.rst:2534 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3603,297 +3813,293 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2397 ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:2543 ../../library/stdtypes.rst:3762 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:3619 +#: ../../library/stdtypes.rst:2546 ../../library/stdtypes.rst:3765 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:3774 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:2557 ../../library/stdtypes.rst:3776 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:2557 ../../library/stdtypes.rst:3776 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:2562 ../../library/stdtypes.rst:3781 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:2562 ../../library/stdtypes.rst:3781 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 +#: ../../library/stdtypes.rst:2565 ../../library/stdtypes.rst:3784 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 +#: ../../library/stdtypes.rst:2565 ../../library/stdtypes.rst:3784 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2568 ../../library/stdtypes.rst:3787 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2568 ../../library/stdtypes.rst:3787 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2426 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3791 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2575 ../../library/stdtypes.rst:3794 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 -msgid "Conversion" -msgstr "" - -#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:3653 +#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:3799 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:2436 -#: ../../library/stdtypes.rst:3653 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:2582 +#: ../../library/stdtypes.rst:3799 ../../library/stdtypes.rst:3801 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:2582 ../../library/stdtypes.rst:3801 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3805 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3805 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:3669 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:2452 -#: ../../library/stdtypes.rst:3669 ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:2598 +#: ../../library/stdtypes.rst:3815 ../../library/stdtypes.rst:3817 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3817 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:3827 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2462 +#: ../../library/stdtypes.rst:2608 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:2611 ../../library/stdtypes.rst:3840 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2465 +#: ../../library/stdtypes.rst:2611 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2614 ../../library/stdtypes.rst:3834 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2468 +#: ../../library/stdtypes.rst:2614 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3837 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2471 +#: ../../library/stdtypes.rst:2617 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 +#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3843 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 +#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3843 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:2627 ../../library/stdtypes.rst:3850 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2485 ../../library/stdtypes.rst:3708 +#: ../../library/stdtypes.rst:2631 ../../library/stdtypes.rst:3854 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2489 ../../library/stdtypes.rst:3712 +#: ../../library/stdtypes.rst:2635 ../../library/stdtypes.rst:3858 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2492 ../../library/stdtypes.rst:3715 +#: ../../library/stdtypes.rst:2638 ../../library/stdtypes.rst:3861 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2496 ../../library/stdtypes.rst:3719 +#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:3865 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2499 ../../library/stdtypes.rst:3722 +#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3868 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2503 ../../library/stdtypes.rst:3726 +#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3872 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2506 ../../library/stdtypes.rst:3735 +#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:3881 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2508 +#: ../../library/stdtypes.rst:2654 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2513 +#: ../../library/stdtypes.rst:2659 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2524 +#: ../../library/stdtypes.rst:2670 msgid "" -"Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" -"`memoryview`" +"Binary Sequence Types " +"--- :class:`bytes`, :class:`bytearray`, :class:`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2532 +#: ../../library/stdtypes.rst:2678 msgid "" -"The core built-in types for manipulating binary data are :class:`bytes` and :" -"class:`bytearray`. They are supported by :class:`memoryview` which uses the :" -"ref:`buffer protocol ` to access the memory of other binary " -"objects without needing to make a copy." +"The core built-in types for manipulating binary data are :class:`bytes` " +"and :class:`bytearray`. They are supported by :class:`memoryview` which uses " +"the :ref:`buffer protocol ` to access the memory of other " +"binary objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2537 +#: ../../library/stdtypes.rst:2683 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2543 +#: ../../library/stdtypes.rst:2689 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2547 +#: ../../library/stdtypes.rst:2693 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -3901,40 +4107,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2554 +#: ../../library/stdtypes.rst:2700 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2557 +#: ../../library/stdtypes.rst:2703 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2558 +#: ../../library/stdtypes.rst:2704 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2559 +#: ../../library/stdtypes.rst:2705 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2561 +#: ../../library/stdtypes.rst:2707 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2565 +#: ../../library/stdtypes.rst:2711 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2569 +#: ../../library/stdtypes.rst:2715 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3947,29 +4153,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2725 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2582 +#: ../../library/stdtypes.rst:2728 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2583 +#: ../../library/stdtypes.rst:2729 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2584 +#: ../../library/stdtypes.rst:2730 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2586 +#: ../../library/stdtypes.rst:2732 msgid "Also see the :ref:`bytes ` built-in." -msgstr "" +msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2588 +#: ../../library/stdtypes.rst:2734 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3977,32 +4183,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2594 +#: ../../library/stdtypes.rst:2740 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2601 +#: ../../library/stdtypes.rst:2747 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2605 +#: ../../library/stdtypes.rst:2751 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:2695 +#: ../../library/stdtypes.rst:2756 ../../library/stdtypes.rst:2841 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2616 +#: ../../library/stdtypes.rst:2762 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4011,13 +4217,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2633 +#: ../../library/stdtypes.rst:2779 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2637 +#: ../../library/stdtypes.rst:2783 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4025,58 +4231,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2642 +#: ../../library/stdtypes.rst:2788 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2796 msgid "Bytearray Objects" -msgstr "" +msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2800 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2659 +#: ../../library/stdtypes.rst:2805 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2808 msgid "Creating an empty instance: ``bytearray()``" -msgstr "" +msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2663 +#: ../../library/stdtypes.rst:2809 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2664 +#: ../../library/stdtypes.rst:2810 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2665 +#: ../../library/stdtypes.rst:2811 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2667 +#: ../../library/stdtypes.rst:2813 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2671 +#: ../../library/stdtypes.rst:2817 msgid "Also see the :ref:`bytearray ` built-in." -msgstr "" +msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2673 +#: ../../library/stdtypes.rst:2819 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4084,33 +4290,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2679 +#: ../../library/stdtypes.rst:2825 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2832 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2836 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2703 +#: ../../library/stdtypes.rst:2849 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2708 +#: ../../library/stdtypes.rst:2854 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4118,7 +4324,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2713 +#: ../../library/stdtypes.rst:2859 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4126,11 +4332,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:2868 msgid "Bytes and Bytearray Operations" -msgstr "" +msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2727 +#: ../../library/stdtypes.rst:2873 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4139,14 +4345,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2735 +#: ../../library/stdtypes.rst:2881 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2739 +#: ../../library/stdtypes.rst:2885 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4154,11 +4360,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2742 +#: ../../library/stdtypes.rst:2888 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2744 +#: ../../library/stdtypes.rst:2890 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4166,60 +4372,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2747 +#: ../../library/stdtypes.rst:2893 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2898 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2755 +#: ../../library/stdtypes.rst:2901 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2761 +#: ../../library/stdtypes.rst:2907 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2765 ../../library/stdtypes.rst:2870 -#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:2958 -#: ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:3016 +#: ../../library/stdtypes.rst:3038 ../../library/stdtypes.rst:3104 +#: ../../library/stdtypes.rst:3117 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2768 +#: ../../library/stdtypes.rst:2914 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2771 ../../library/stdtypes.rst:2882 -#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:2961 -#: ../../library/stdtypes.rst:2974 +#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:3028 +#: ../../library/stdtypes.rst:3041 ../../library/stdtypes.rst:3107 +#: ../../library/stdtypes.rst:3120 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2778 +#: ../../library/stdtypes.rst:2924 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2782 +#: ../../library/stdtypes.rst:2928 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4231,32 +4437,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2787 +#: ../../library/stdtypes.rst:2933 msgid "The *prefix* may be any :term:`bytes-like object`." -msgstr "" - -#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:2813 -#: ../../library/stdtypes.rst:2946 ../../library/stdtypes.rst:3039 -#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:3084 -#: ../../library/stdtypes.rst:3098 ../../library/stdtypes.rst:3140 -#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3229 -#: ../../library/stdtypes.rst:3257 ../../library/stdtypes.rst:3396 -#: ../../library/stdtypes.rst:3451 ../../library/stdtypes.rst:3494 -#: ../../library/stdtypes.rst:3515 ../../library/stdtypes.rst:3537 -#: ../../library/stdtypes.rst:3739 +msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" + +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:2959 +#: ../../library/stdtypes.rst:3092 ../../library/stdtypes.rst:3185 +#: ../../library/stdtypes.rst:3199 ../../library/stdtypes.rst:3230 +#: ../../library/stdtypes.rst:3244 ../../library/stdtypes.rst:3286 +#: ../../library/stdtypes.rst:3357 ../../library/stdtypes.rst:3375 +#: ../../library/stdtypes.rst:3403 ../../library/stdtypes.rst:3542 +#: ../../library/stdtypes.rst:3597 ../../library/stdtypes.rst:3640 +#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:3885 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2946 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:2804 +#: ../../library/stdtypes.rst:2950 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4268,37 +4474,37 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2955 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2822 +#: ../../library/stdtypes.rst:2968 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2827 +#: ../../library/stdtypes.rst:2973 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " -"are ``'ignore'``, ``'replace'``, and any other name registered via :func:" -"`codecs.register_error`. See :ref:`error-handlers` for details." +"are ``'ignore'``, ``'replace'``, and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2833 +#: ../../library/stdtypes.rst:2979 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" -"`debug build ` is used." +"unless a decoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:2839 +#: ../../library/stdtypes.rst:2985 msgid "" -"Passing the *encoding* argument to :class:`str` allows decoding any :term:" -"`bytes-like object` directly, without needing to make a temporary :class:`!" -"bytes` or :class:`!bytearray` object." +"Passing the *encoding* argument to :class:`str` allows decoding " +"any :term:`bytes-like object` directly, without needing to make a " +"temporary :class:`!bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:3000 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4306,11 +4512,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2859 +#: ../../library/stdtypes.rst:3005 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2865 +#: ../../library/stdtypes.rst:3011 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4318,14 +4524,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:3021 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:2879 +#: ../../library/stdtypes.rst:3025 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4333,13 +4539,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:2889 +#: ../../library/stdtypes.rst:3035 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:2902 +#: ../../library/stdtypes.rst:3048 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4349,15 +4555,15 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:2913 +#: ../../library/stdtypes.rst:3059 msgid "" -"This static method returns a translation table usable for :meth:`bytes." -"translate` that will map each character in *from* into the character at the " -"same position in *to*; *from* and *to* must both be :term:`bytes-like " -"objects ` and have the same length." +"This static method returns a translation table usable " +"for :meth:`bytes.translate` that will map each character in *from* into the " +"character at the same position in *to*; *from* and *to* must both " +"be :term:`bytes-like objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:2924 +#: ../../library/stdtypes.rst:3070 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4366,24 +4572,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:2988 +#: ../../library/stdtypes.rst:3077 ../../library/stdtypes.rst:3134 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:3083 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:3087 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:2953 +#: ../../library/stdtypes.rst:3099 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4391,13 +4597,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:3114 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2981 +#: ../../library/stdtypes.rst:3127 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4406,7 +4612,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:2994 +#: ../../library/stdtypes.rst:3140 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4414,11 +4620,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2999 +#: ../../library/stdtypes.rst:3145 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3005 +#: ../../library/stdtypes.rst:3151 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4426,18 +4632,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3010 +#: ../../library/stdtypes.rst:3156 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3013 +#: ../../library/stdtypes.rst:3159 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3016 +#: ../../library/stdtypes.rst:3162 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4445,11 +4651,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3019 +#: ../../library/stdtypes.rst:3165 msgid "*delete* is now supported as a keyword argument." -msgstr "" +msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3169 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4458,7 +4664,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3032 +#: ../../library/stdtypes.rst:3178 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4466,7 +4672,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3046 +#: ../../library/stdtypes.rst:3192 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4474,7 +4680,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3060 +#: ../../library/stdtypes.rst:3206 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4484,7 +4690,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3067 +#: ../../library/stdtypes.rst:3213 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4496,14 +4702,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3072 +#: ../../library/stdtypes.rst:3218 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3077 +#: ../../library/stdtypes.rst:3223 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4515,7 +4721,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3091 +#: ../../library/stdtypes.rst:3237 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4523,7 +4729,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3105 +#: ../../library/stdtypes.rst:3251 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4533,7 +4739,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3116 +#: ../../library/stdtypes.rst:3262 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4543,7 +4749,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3123 +#: ../../library/stdtypes.rst:3269 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4555,14 +4761,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3128 +#: ../../library/stdtypes.rst:3274 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3133 +#: ../../library/stdtypes.rst:3279 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4574,7 +4780,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3147 +#: ../../library/stdtypes.rst:3293 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4583,7 +4789,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3153 +#: ../../library/stdtypes.rst:3299 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4594,7 +4800,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3163 +#: ../../library/stdtypes.rst:3309 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4614,7 +4820,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3172 +#: ../../library/stdtypes.rst:3318 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -4624,7 +4830,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3182 +#: ../../library/stdtypes.rst:3328 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -4640,7 +4846,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3193 +#: ../../library/stdtypes.rst:3339 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -4650,7 +4856,7 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3201 +#: ../../library/stdtypes.rst:3347 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -4662,13 +4868,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3206 +#: ../../library/stdtypes.rst:3352 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3215 +#: ../../library/stdtypes.rst:3361 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -4676,14 +4882,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3223 +#: ../../library/stdtypes.rst:3369 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3236 +#: ../../library/stdtypes.rst:3382 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -4699,7 +4905,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3396 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -4711,7 +4917,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3264 +#: ../../library/stdtypes.rst:3410 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4720,7 +4926,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3272 +#: ../../library/stdtypes.rst:3418 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -4732,7 +4938,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3427 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4740,7 +4946,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3434 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -4752,20 +4958,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3297 +#: ../../library/stdtypes.rst:3443 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3453 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3459 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -4777,13 +4983,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3322 +#: ../../library/stdtypes.rst:3468 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3327 +#: ../../library/stdtypes.rst:3473 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -4795,16 +5001,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3332 ../../library/stdtypes.rst:3374 -#: ../../library/stdtypes.rst:3390 ../../library/stdtypes.rst:3440 -#: ../../library/stdtypes.rst:3509 +#: ../../library/stdtypes.rst:3478 ../../library/stdtypes.rst:3520 +#: ../../library/stdtypes.rst:3536 ../../library/stdtypes.rst:3586 +#: ../../library/stdtypes.rst:3655 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3486 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -4812,14 +5018,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3349 +#: ../../library/stdtypes.rst:3495 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3501 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -4831,14 +5037,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3364 +#: ../../library/stdtypes.rst:3510 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3369 +#: ../../library/stdtypes.rst:3515 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -4850,13 +5056,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3382 +#: ../../library/stdtypes.rst:3528 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3387 +#: ../../library/stdtypes.rst:3533 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -4864,7 +5070,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3407 +#: ../../library/stdtypes.rst:3553 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -4872,7 +5078,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:3560 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -4884,14 +5090,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3419 +#: ../../library/stdtypes.rst:3565 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3423 +#: ../../library/stdtypes.rst:3569 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -4903,13 +5109,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3432 +#: ../../library/stdtypes.rst:3578 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3437 +#: ../../library/stdtypes.rst:3583 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -4917,22 +5123,22 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3444 +#: ../../library/stdtypes.rst:3590 msgid "" -"Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." -"swapcase() == bin`` for the binary versions. Case conversions are " -"symmetrical in ASCII, even though that is not generally true for arbitrary " -"Unicode code points." +"Unlike :func:`str.swapcase`, it is always the case that " +"``bin.swapcase().swapcase() == bin`` for the binary versions. Case " +"conversions are symmetrical in ASCII, even though that is not generally true " +"for arbitrary Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3604 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3464 +#: ../../library/stdtypes.rst:3610 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -4940,7 +5146,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3467 +#: ../../library/stdtypes.rst:3613 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -4948,7 +5154,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3477 +#: ../../library/stdtypes.rst:3623 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -4956,12 +5162,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3480 +#: ../../library/stdtypes.rst:3626 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3482 +#: ../../library/stdtypes.rst:3628 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4983,13 +5189,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3501 +#: ../../library/stdtypes.rst:3647 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3506 +#: ../../library/stdtypes.rst:3652 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -4997,7 +5203,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3522 +#: ../../library/stdtypes.rst:3668 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5006,7 +5212,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3530 +#: ../../library/stdtypes.rst:3676 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5018,11 +5224,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3544 +#: ../../library/stdtypes.rst:3690 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3561 +#: ../../library/stdtypes.rst:3707 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5030,17 +5236,17 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3566 +#: ../../library/stdtypes.rst:3712 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " "*interpolation* operator. Given ``format % values`` (where *format* is a " "bytes object), ``%`` conversion specifications in *format* are replaced with " -"zero or more elements of *values*. The effect is similar to using the :c:" -"func:`sprintf` in the C language." +"zero or more elements of *values*. The effect is similar to using " +"the :c:func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3573 +#: ../../library/stdtypes.rst:3719 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5048,7 +5254,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:3753 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5056,73 +5262,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:3827 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3830 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3830 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:3834 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:3837 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3840 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3840 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3729 +#: ../../library/stdtypes.rst:3875 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." -msgstr "" +msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3732 +#: ../../library/stdtypes.rst:3878 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." -msgstr "" +msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:3890 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3751 +#: ../../library/stdtypes.rst:3897 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3753 +#: ../../library/stdtypes.rst:3899 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3759 +#: ../../library/stdtypes.rst:3905 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:3909 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5130,32 +5336,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3768 +#: ../../library/stdtypes.rst:3914 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3918 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3775 +#: ../../library/stdtypes.rst:3921 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3778 +#: ../../library/stdtypes.rst:3924 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3781 +#: ../../library/stdtypes.rst:3927 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5177,7 +5383,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3937 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5188,11 +5394,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3800 +#: ../../library/stdtypes.rst:3946 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3802 +#: ../../library/stdtypes.rst:3948 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5214,13 +5420,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:3812 +#: ../../library/stdtypes.rst:3958 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3961 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5260,14 +5466,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:3833 +#: ../../library/stdtypes.rst:3979 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3983 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5285,40 +5491,41 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:3845 +#: ../../library/stdtypes.rst:3991 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:3995 msgid "" -"memoryview is now registered automatically with :class:`collections.abc." -"Sequence`" +"memoryview is now registered automatically " +"with :class:`collections.abc.Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3853 +#: ../../library/stdtypes.rst:3999 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:3856 +#: ../../library/stdtypes.rst:4002 msgid ":class:`memoryview` has several methods:" -msgstr "" +msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:3860 +#: ../../library/stdtypes.rst:4006 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:3864 +#: ../../library/stdtypes.rst:4010 msgid "" -"For the subset of :mod:`struct` format strings currently supported by :meth:" -"`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" +"For the subset of :mod:`struct` format strings currently supported " +"by :meth:`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == " +"w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:4013 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5352,14 +5559,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:3883 +#: ../../library/stdtypes.rst:4029 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:4033 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5385,25 +5592,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:4045 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:4048 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:4054 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:3911 +#: ../../library/stdtypes.rst:4057 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5417,7 +5624,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:4063 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5425,7 +5632,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:4068 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5434,13 +5641,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:3931 +#: ../../library/stdtypes.rst:4077 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:3934 +#: ../../library/stdtypes.rst:4080 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5450,18 +5657,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:3940 +#: ../../library/stdtypes.rst:4086 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3947 +#: ../../library/stdtypes.rst:4093 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:3949 +#: ../../library/stdtypes.rst:4095 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5479,19 +5686,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:3957 +#: ../../library/stdtypes.rst:4103 msgid "" -":meth:`tolist` now supports all single character native formats in :mod:" -"`struct` module syntax as well as multi-dimensional representations." +":meth:`tolist` now supports all single character native formats " +"in :mod:`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:3964 +#: ../../library/stdtypes.rst:4110 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:3967 +#: ../../library/stdtypes.rst:4113 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5517,23 +5724,23 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:3983 +#: ../../library/stdtypes.rst:4129 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " -"objects take special actions when a view is held on them (for example, a :" -"class:`bytearray` would temporarily forbid resizing); therefore, calling " +"objects take special actions when a view is held on them (for example, " +"a :class:`bytearray` would temporarily forbid resizing); therefore, calling " "release() is handy to remove these restrictions (and free any dangling " "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:3989 +#: ../../library/stdtypes.rst:4135 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:3993 +#: ../../library/stdtypes.rst:4139 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5549,13 +5756,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4000 +#: ../../library/stdtypes.rst:4146 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4003 +#: ../../library/stdtypes.rst:4149 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5575,7 +5782,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4162 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5584,19 +5791,19 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4022 +#: ../../library/stdtypes.rst:4168 msgid "" -"The destination format is restricted to a single element native format in :" -"mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " -"'c'). The byte length of the result must be the same as the original length. " -"Note that all byte lengths may depend on the operating system." +"The destination format is restricted to a single element native format " +"in :mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' " +"or 'c'). The byte length of the result must be the same as the original " +"length. Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:4174 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4030 +#: ../../library/stdtypes.rst:4176 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -5640,11 +5847,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4051 +#: ../../library/stdtypes.rst:4197 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:4199 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -5668,11 +5875,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4064 +#: ../../library/stdtypes.rst:4210 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4066 +#: ../../library/stdtypes.rst:4212 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -5722,11 +5929,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4090 +#: ../../library/stdtypes.rst:4236 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4092 +#: ../../library/stdtypes.rst:4238 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -5748,19 +5955,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:4250 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:4253 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4111 +#: ../../library/stdtypes.rst:4257 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4259 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -5772,14 +5979,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4122 +#: ../../library/stdtypes.rst:4268 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:4272 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -5811,11 +6018,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4287 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:4289 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -5839,11 +6046,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4304 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4162 +#: ../../library/stdtypes.rst:4308 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -5851,17 +6058,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:4313 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:4319 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:4321 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -5881,59 +6088,59 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4186 +#: ../../library/stdtypes.rst:4332 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:4337 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4194 ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4340 ../../library/stdtypes.rst:4348 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4199 +#: ../../library/stdtypes.rst:4345 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:4353 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:4357 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4217 +#: ../../library/stdtypes.rst:4363 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4223 +#: ../../library/stdtypes.rst:4369 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4231 +#: ../../library/stdtypes.rst:4377 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4235 +#: ../../library/stdtypes.rst:4381 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " "sequence, and computing mathematical operations such as intersection, union, " "difference, and symmetric difference. (For other containers see the built-" -"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:" -"`collections` module.)" +"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4242 +#: ../../library/stdtypes.rst:4388 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -5941,30 +6148,30 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4247 +#: ../../library/stdtypes.rst:4393 msgid "" -"There are currently two built-in set types, :class:`set` and :class:" -"`frozenset`. The :class:`set` type is mutable --- the contents can be " -"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " -"it is mutable, it has no hash value and cannot be used as either a " +"There are currently two built-in set types, :class:`set` " +"and :class:`frozenset`. The :class:`set` type is mutable --- the contents " +"can be changed using methods like :meth:`~set.add` and :meth:`~set.remove`. " +"Since it is mutable, it has no hash value and cannot be used as either a " "dictionary key or as an element of another set. The :class:`frozenset` type " "is immutable and :term:`hashable` --- its contents cannot be altered after " "it is created; it can therefore be used as a dictionary key or as an element " "of another set." msgstr "" -#: ../../library/stdtypes.rst:4255 +#: ../../library/stdtypes.rst:4401 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4259 +#: ../../library/stdtypes.rst:4405 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4264 +#: ../../library/stdtypes.rst:4410 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -5972,102 +6179,102 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4270 +#: ../../library/stdtypes.rst:4416 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4272 +#: ../../library/stdtypes.rst:4418 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4273 +#: ../../library/stdtypes.rst:4419 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4274 +#: ../../library/stdtypes.rst:4420 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4422 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4281 +#: ../../library/stdtypes.rst:4427 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4285 +#: ../../library/stdtypes.rst:4431 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4289 +#: ../../library/stdtypes.rst:4435 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4293 +#: ../../library/stdtypes.rst:4439 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4445 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4303 +#: ../../library/stdtypes.rst:4449 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4309 +#: ../../library/stdtypes.rst:4455 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4313 +#: ../../library/stdtypes.rst:4459 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4319 +#: ../../library/stdtypes.rst:4465 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4324 +#: ../../library/stdtypes.rst:4470 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4475 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4334 +#: ../../library/stdtypes.rst:4480 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4338 +#: ../../library/stdtypes.rst:4484 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4341 +#: ../../library/stdtypes.rst:4487 msgid "" -"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" -"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" -"`issuperset` methods will accept any iterable as an argument. In contrast, " -"their operator based counterparts require their arguments to be sets. This " -"precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " -"the more readable ``set('abc').intersection('cbs')``." +"Note, the non-operator versions " +"of :meth:`union`, :meth:`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, " +"and :meth:`issuperset` methods will accept any iterable as an argument. In " +"contrast, their operator based counterparts require their arguments to be " +"sets. This precludes error-prone constructions like ``set('abc') & 'cbs'`` " +"in favor of the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4348 +#: ../../library/stdtypes.rst:4494 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6077,14 +6284,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4501 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4359 +#: ../../library/stdtypes.rst:4505 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6092,134 +6299,136 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4364 +#: ../../library/stdtypes.rst:4510 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4367 +#: ../../library/stdtypes.rst:4513 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4515 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:4519 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:4525 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4384 +#: ../../library/stdtypes.rst:4530 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:4535 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4394 +#: ../../library/stdtypes.rst:4540 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4398 +#: ../../library/stdtypes.rst:4544 msgid "Add element *elem* to the set." -msgstr "" +msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4402 +#: ../../library/stdtypes.rst:4548 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:4553 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:4557 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4416 +#: ../../library/stdtypes.rst:4562 msgid "Remove all elements from the set." -msgstr "" +msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4419 +#: ../../library/stdtypes.rst:4565 msgid "" -"Note, the non-operator versions of the :meth:`update`, :meth:" -"`intersection_update`, :meth:`difference_update`, and :meth:" -"`symmetric_difference_update` methods will accept any iterable as an " -"argument." +"Note, the non-operator versions of " +"the :meth:`update`, :meth:`intersection_update`, :meth:`difference_update`, " +"and :meth:`symmetric_difference_update` methods will accept any iterable as " +"an argument." msgstr "" -#: ../../library/stdtypes.rst:4424 +#: ../../library/stdtypes.rst:4570 msgid "" -"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" -"`remove`, and :meth:`discard` methods may be a set. To support searching " -"for an equivalent frozenset, a temporary one is created from *elem*." +"Note, the *elem* argument to " +"the :meth:`~object.__contains__`, :meth:`remove`, and :meth:`discard` " +"methods may be a set. To support searching for an equivalent frozenset, a " +"temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4433 +#: ../../library/stdtypes.rst:4579 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4589 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " -"type, the :dfn:`dictionary`. (For other containers see the built-in :class:" -"`list`, :class:`set`, and :class:`tuple` classes, and the :mod:`collections` " -"module.)" +"type, the :dfn:`dictionary`. (For other containers see the built-" +"in :class:`list`, :class:`set`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4595 msgid "" -"A dictionary's keys are *almost* arbitrary values. Values that are not :" -"term:`hashable`, that is, values containing lists, dictionaries or other " -"mutable types (that are compared by value rather than by object identity) " -"may not be used as keys. Values that compare equal (such as ``1``, ``1.0``, " -"and ``True``) can be used interchangeably to index the same dictionary entry." +"A dictionary's keys are *almost* arbitrary values. Values that are " +"not :term:`hashable`, that is, values containing lists, dictionaries or " +"other mutable types (that are compared by value rather than by object " +"identity) may not be used as keys. Values that compare equal (such as ``1``, " +"``1.0``, and ``True``) can be used interchangeably to index the same " +"dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4460 +#: ../../library/stdtypes.rst:4606 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4463 +#: ../../library/stdtypes.rst:4609 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4465 +#: ../../library/stdtypes.rst:4611 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4467 +#: ../../library/stdtypes.rst:4613 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4468 +#: ../../library/stdtypes.rst:4614 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4617 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -6232,7 +6441,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:4627 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6240,13 +6449,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4486 +#: ../../library/stdtypes.rst:4632 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4489 +#: ../../library/stdtypes.rst:4635 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6266,44 +6475,44 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4498 +#: ../../library/stdtypes.rst:4644 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4502 +#: ../../library/stdtypes.rst:4648 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4507 +#: ../../library/stdtypes.rst:4653 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4511 +#: ../../library/stdtypes.rst:4657 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4515 +#: ../../library/stdtypes.rst:4661 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4520 +#: ../../library/stdtypes.rst:4666 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " "argument. The ``d[key]`` operation then returns or raises whatever is " "returned or raised by the ``__missing__(key)`` call. No other operations or " -"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not defined, :" -"exc:`KeyError` is raised. :meth:`__missing__` must be a method; it cannot be " -"an instance variable::" +"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not " +"defined, :exc:`KeyError` is raised. :meth:`__missing__` must be a method; it " +"cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4528 +#: ../../library/stdtypes.rst:4674 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6327,51 +6536,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4539 +#: ../../library/stdtypes.rst:4685 msgid "" -"The example above shows part of the implementation of :class:`collections." -"Counter`. A different ``__missing__`` method is used by :class:`collections." -"defaultdict`." +"The example above shows part of the implementation " +"of :class:`collections.Counter`. A different ``__missing__`` method is used " +"by :class:`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4691 msgid "Set ``d[key]`` to *value*." -msgstr "" +msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4549 +#: ../../library/stdtypes.rst:4695 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." -msgstr "" +msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:4554 +#: ../../library/stdtypes.rst:4700 msgid "Return ``True`` if *d* has a key *key*, else ``False``." -msgstr "" +msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4558 +#: ../../library/stdtypes.rst:4704 msgid "Equivalent to ``not key in d``." -msgstr "" +msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4562 +#: ../../library/stdtypes.rst:4708 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4567 +#: ../../library/stdtypes.rst:4713 msgid "Remove all items from the dictionary." -msgstr "" +msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4571 +#: ../../library/stdtypes.rst:4717 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4575 +#: ../../library/stdtypes.rst:4721 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4723 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6380,70 +6589,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4585 +#: ../../library/stdtypes.rst:4731 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4591 +#: ../../library/stdtypes.rst:4737 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4596 +#: ../../library/stdtypes.rst:4742 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4601 +#: ../../library/stdtypes.rst:4747 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " -"*default*. If *default* is not given and *key* is not in the dictionary, a :" -"exc:`KeyError` is raised." +"*default*. If *default* is not given and *key* is not in the dictionary, " +"a :exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4753 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4610 +#: ../../library/stdtypes.rst:4756 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " -"often used in set algorithms. If the dictionary is empty, calling :meth:" -"`popitem` raises a :exc:`KeyError`." +"often used in set algorithms. If the dictionary is empty, " +"calling :meth:`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4614 +#: ../../library/stdtypes.rst:4760 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4620 +#: ../../library/stdtypes.rst:4766 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4627 +#: ../../library/stdtypes.rst:4773 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4633 +#: ../../library/stdtypes.rst:4779 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4636 +#: ../../library/stdtypes.rst:4782 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6452,20 +6661,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4644 +#: ../../library/stdtypes.rst:4790 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4793 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4651 +#: ../../library/stdtypes.rst:4797 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6475,34 +6684,34 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4657 +#: ../../library/stdtypes.rst:4803 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4665 +#: ../../library/stdtypes.rst:4811 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4671 +#: ../../library/stdtypes.rst:4817 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4675 +#: ../../library/stdtypes.rst:4821 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4678 +#: ../../library/stdtypes.rst:4824 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6534,17 +6743,17 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4839 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4697 +#: ../../library/stdtypes.rst:4843 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4845 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6566,85 +6775,85 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4709 +#: ../../library/stdtypes.rst:4855 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4714 +#: ../../library/stdtypes.rst:4860 msgid "" -":class:`types.MappingProxyType` can be used to create a read-only view of a :" -"class:`dict`." +":class:`types.MappingProxyType` can be used to create a read-only view of " +"a :class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4721 +#: ../../library/stdtypes.rst:4867 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4723 +#: ../../library/stdtypes.rst:4869 msgid "" -"The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" -"`dict.items` are *view objects*. They provide a dynamic view on the " -"dictionary's entries, which means that when the dictionary changes, the view " -"reflects these changes." +"The objects returned by :meth:`dict.keys`, :meth:`dict.values` " +"and :meth:`dict.items` are *view objects*. They provide a dynamic view on " +"the dictionary's entries, which means that when the dictionary changes, the " +"view reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4728 +#: ../../library/stdtypes.rst:4874 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4733 +#: ../../library/stdtypes.rst:4879 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4737 +#: ../../library/stdtypes.rst:4883 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4740 +#: ../../library/stdtypes.rst:4886 msgid "" "Keys and values are iterated over in insertion order. This allows the " -"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." -"values(), d.keys())``. Another way to create the same list is ``pairs = " -"[(v, k) for (k, v) in d.items()]``." +"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = " +"zip(d.values(), d.keys())``. Another way to create the same list is ``pairs " +"= [(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4745 +#: ../../library/stdtypes.rst:4891 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4894 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4899 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4758 +#: ../../library/stdtypes.rst:4904 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4761 +#: ../../library/stdtypes.rst:4907 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4766 +#: ../../library/stdtypes.rst:4912 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4771 +#: ../../library/stdtypes.rst:4917 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -6658,11 +6867,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4783 +#: ../../library/stdtypes.rst:4929 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4785 +#: ../../library/stdtypes.rst:4931 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6703,11 +6912,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4827 +#: ../../library/stdtypes.rst:4973 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4834 +#: ../../library/stdtypes.rst:4980 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -6718,7 +6927,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:4842 +#: ../../library/stdtypes.rst:4988 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -6729,16 +6938,17 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:4847 +#: ../../library/stdtypes.rst:4993 msgid "" "An example of a context manager that returns itself is a :term:`file " -"object`. File objects return themselves from __enter__() to allow :func:" -"`open` to be used as the context expression in a :keyword:`with` statement." +"object`. File objects return themselves from __enter__() to " +"allow :func:`open` to be used as the context expression in a :keyword:`with` " +"statement." msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:4851 +#: ../../library/stdtypes.rst:4997 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -6749,10 +6959,10 @@ msgid "" msgstr "" "一個會回傳相關物件的情境管理器範例是由 :func:`decimal.localcontext` 回傳的管" "理器。這些管理器將有效的十進位情境設定為原始十進位情境的副本,然後回傳該副" -"本。這允許對 :keyword:`with` 陳述式主體中的當前十進位情境進行更改,而不會影" +"本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:4861 +#: ../../library/stdtypes.rst:5007 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -6760,11 +6970,11 @@ msgid "" "the exception type, value and traceback information. Otherwise, all three " "arguments are ``None``." msgstr "" -"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執行 :" -"keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " +"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執" +"行 :keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:4866 +#: ../../library/stdtypes.rst:5012 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -6774,24 +6984,24 @@ msgid "" "replace any exception that occurred in the body of the :keyword:`!with` " "statement." msgstr "" -"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接著 :" -"keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " -"(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" -"的任何例外。" +"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接" +"著 :keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續" +"傳播 (propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體" +"中發生的任何例外。" -#: ../../library/stdtypes.rst:4873 +#: ../../library/stdtypes.rst:5019 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " "successfully and does not want to suppress the raised exception. This allows " -"context management code to easily detect whether or not an :meth:`~object." -"__exit__` method has actually failed." +"context management code to easily detect whether or not " +"an :meth:`~object.__exit__` method has actually failed." msgstr "" "傳入的例外不應明確重新引發 - 取而代之的是,此方法應回傳 false 值以指示該方法" -"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" -"`__exit__` 方法是否曾實際失敗過。" +"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢" +"測 :meth:`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:4879 +#: ../../library/stdtypes.rst:5025 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -6803,22 +7013,23 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:4885 +#: ../../library/stdtypes.rst:5031 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " "generator function is decorated with the :class:`contextlib.contextmanager` " -"decorator, it will return a context manager implementing the necessary :meth:" -"`~contextmanager.__enter__` and :meth:`~contextmanager.__exit__` methods, " -"rather than the iterator produced by an undecorated generator function." +"decorator, it will return a context manager implementing the " +"necessary :meth:`~contextmanager.__enter__` " +"and :meth:`~contextmanager.__exit__` methods, rather than the iterator " +"produced by an undecorated generator function." msgstr "" "Python 的 :term:`generator` 和 :class:`contextlib.contextmanager` 裝飾器提供" -"了一種便捷的方法來實作這些協定。如果產生器函式以 :class:`contextlib." -"contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要的 :meth:" -"`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" -"理器,而不是由未裝飾產生器函式產生的疊代器。" +"了一種便捷的方法來實作這些協定。如果產生器函式" +"以 :class:`contextlib.contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要" +"的 :meth:`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法" +"的情境管理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:5038 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -6830,27 +7041,27 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:4900 +#: ../../library/stdtypes.rst:5046 msgid "" -"Type Annotation Types --- :ref:`Generic Alias `, :ref:" -"`Union `" +"Type Annotation Types --- :ref:`Generic Alias `, :ref:`Union `" msgstr "" -"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" -"ref:`聯合 (Union) `" +"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:5051 msgid "" -"The core built-in types for :term:`type annotations ` are :ref:" -"`Generic Alias ` and :ref:`Union `." +"The core built-in types for :term:`type annotations ` " +"are :ref:`Generic Alias ` and :ref:`Union `." msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:4912 +#: ../../library/stdtypes.rst:5058 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:4918 +#: ../../library/stdtypes.rst:5064 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -6866,7 +7077,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:4928 +#: ../../library/stdtypes.rst:5074 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -6874,7 +7085,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:4931 +#: ../../library/stdtypes.rst:5077 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -6882,19 +7093,19 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:4934 +#: ../../library/stdtypes.rst:5080 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " "object contains. For example, ``set[bytes]`` can be used in type annotations " -"to signify a :class:`set` in which all the elements are of type :class:" -"`bytes`." +"to signify a :class:`set` in which all the elements are of " +"type :class:`bytes`." msgstr "" "對於一個容器類別,提供給該類別的\\ :ref:`下標 `\\ 引數可以代表" -"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" -"`set`,其中所有元素的型別都是 :class:`bytes`。" +"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一" +"個 :class:`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:4940 +#: ../../library/stdtypes.rst:5086 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -6906,7 +7117,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:4946 +#: ../../library/stdtypes.rst:5092 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -6918,11 +7129,11 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:4952 +#: ../../library/stdtypes.rst:5098 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " -"``y`` will also be an instance of ``re.Match``, but the return values of ``y." -"group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " +"``y`` will also be an instance of ``re.Match``, but the return values of " +"``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " "annotations, we would represent this variety of :ref:`re.Match ` objects with ``re.Match[bytes]``." msgstr "" @@ -6931,26 +7142,26 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:4958 +#: ../../library/stdtypes.rst:5104 msgid "" -"``GenericAlias`` objects are instances of the class :class:`types." -"GenericAlias`, which can also be used to create ``GenericAlias`` objects " -"directly." +"``GenericAlias`` objects are instances of the " +"class :class:`types.GenericAlias`, which can also be used to create " +"``GenericAlias`` objects directly." msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:4964 +#: ../../library/stdtypes.rst:5110 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " "expecting a :class:`list` containing :class:`float` elements::" msgstr "" "建立一個 ``GenericAlias`` 來表示一個型別 ``T``,其以型別 *X*、*Y* 等(取決於" -"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" -"class:`list`: ::" +"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素" +"的 :class:`list`: ::" -#: ../../library/stdtypes.rst:4969 +#: ../../library/stdtypes.rst:5115 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -6958,7 +7169,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:4972 +#: ../../library/stdtypes.rst:5118 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -6969,7 +7180,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:4977 +#: ../../library/stdtypes.rst:5123 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -6977,7 +7188,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:5126 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -6985,7 +7196,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:4983 +#: ../../library/stdtypes.rst:5129 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -6997,7 +7208,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:5134 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7009,7 +7220,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:5140 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7019,13 +7230,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:4998 +#: ../../library/stdtypes.rst:5144 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5001 +#: ../../library/stdtypes.rst:5147 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7043,13 +7254,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5009 +#: ../../library/stdtypes.rst:5155 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5011 +#: ../../library/stdtypes.rst:5157 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7063,15 +7274,15 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5163 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." -"__getitem__` 方法會在這種情況下引發例外: ::" +"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器" +"的 :meth:`~object.__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5020 +#: ../../library/stdtypes.rst:5166 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7083,17 +7294,17 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5025 +#: ../../library/stdtypes.rst:5171 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" "然而當使用\\ :ref:`型別變數 (type variable) ` 時,此類運算式是有效" -"的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." -"__args__` 中的型別變數項目一樣多: ::" +"的。索引的元素數量必須與 ``GenericAlias`` 物件" +"的 :attr:`~genericalias.__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5029 +#: ../../library/stdtypes.rst:5175 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7105,245 +7316,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5182 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5184 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5187 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5188 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5189 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5190 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5045 +#: ../../library/stdtypes.rst:5191 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5192 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5193 +msgid ":class:`asyncio.Future`" +msgstr ":class:`asyncio.Future`" + +#: ../../library/stdtypes.rst:5194 +msgid ":class:`asyncio.Task`" +msgstr ":class:`asyncio.Task`" + +#: ../../library/stdtypes.rst:5195 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5196 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5197 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5198 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5199 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5200 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5053 +#: ../../library/stdtypes.rst:5201 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5202 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5203 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5204 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5057 +#: ../../library/stdtypes.rst:5205 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5206 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5207 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5208 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5209 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5062 +#: ../../library/stdtypes.rst:5210 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5063 +#: ../../library/stdtypes.rst:5211 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5212 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5213 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5214 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5215 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5216 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5217 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5218 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5219 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5220 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5221 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5222 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5223 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5224 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5225 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5226 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5227 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5080 +#: ../../library/stdtypes.rst:5228 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5229 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5230 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5231 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5232 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5085 +#: ../../library/stdtypes.rst:5233 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5086 +#: ../../library/stdtypes.rst:5234 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5087 +#: ../../library/stdtypes.rst:5235 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5088 +#: ../../library/stdtypes.rst:5236 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5237 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5238 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5091 +#: ../../library/stdtypes.rst:5239 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5092 +#: ../../library/stdtypes.rst:5240 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5241 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5094 +#: ../../library/stdtypes.rst:5242 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5247 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5101 +#: ../../library/stdtypes.rst:5249 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5253 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5255 msgid "" ">>> list[int].__origin__\n" "" @@ -7351,16 +7570,16 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5113 +#: ../../library/stdtypes.rst:5261 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " "class::" msgstr "" -"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" -"class:`tuple`\\ (長度可以為 1): ::" +"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型" +"別 :class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5117 +#: ../../library/stdtypes.rst:5265 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7368,7 +7587,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5123 +#: ../../library/stdtypes.rst:5271 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7376,7 +7595,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5274 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7390,89 +7609,90 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5282 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " -"have correct ``__parameters__`` after substitution because :class:`typing." -"ParamSpec` is intended primarily for static type checking." +"have correct ``__parameters__`` after substitution " +"because :class:`typing.ParamSpec` is intended primarily for static type " +"checking." msgstr "" "具有 :class:`typing.ParamSpec` 參數的一個 ``GenericAlias`` 物件在替換後可能沒" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5141 +#: ../../library/stdtypes.rst:5289 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" -"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" -"`~typing.TypeVarTuple`\\ )。" +"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參" +"閱 :data:`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5149 +#: ../../library/stdtypes.rst:5297 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5150 +#: ../../library/stdtypes.rst:5298 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5152 +#: ../../library/stdtypes.rst:5300 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5153 +#: ../../library/stdtypes.rst:5301 msgid "" "Introducing the ability to natively parameterize standard-library classes, " -"provided they implement the special class method :meth:`~object." -"__class_getitem__`." +"provided they implement the special class " +"method :meth:`~object.__class_getitem__`." msgstr "" -"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" -"`~object.__class_getitem__`。" +"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方" +"法 :meth:`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5305 msgid "" -":ref:`Generics`, :ref:`user-defined generics ` and :" -"class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics ` " +"and :class:`typing.Generic`" msgstr "" -":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" -"`typing.Generic`" +":ref:`Generics`、:ref:`使用者定義泛型 `\\ " +"和 :class:`typing.Generic`" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5306 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5167 +#: ../../library/stdtypes.rst:5315 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5173 +#: ../../library/stdtypes.rst:5321 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " "primarily for :term:`type annotations `. The union type " -"expression enables cleaner type hinting syntax compared to :data:`typing." -"Union`." +"expression enables cleaner type hinting syntax compared " +"to :data:`typing.Union`." msgstr "" "一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) `\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5328 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " -"example, the following function expects an argument of type :class:`int` or :" -"class:`float`::" +"example, the following function expects an argument of type :class:`int` " +"or :class:`float`::" msgstr "" "定義一個包含 *X*、*Y* 等型別的聯合物件。``X | Y`` 表示 X 或 Y。它相當於 " -"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" -"class:`float` 的引數: ::" +"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` " +"或 :class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5185 +#: ../../library/stdtypes.rst:5333 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7480,7 +7700,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5190 +#: ../../library/stdtypes.rst:5338 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7493,58 +7713,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5346 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5348 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5350 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5204 +#: ../../library/stdtypes.rst:5352 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5354 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5356 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5210 +#: ../../library/stdtypes.rst:5358 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5360 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5362 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5364 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5218 +#: ../../library/stdtypes.rst:5366 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5371 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5226 +#: ../../library/stdtypes.rst:5374 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7552,14 +7772,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5229 +#: ../../library/stdtypes.rst:5377 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5232 +#: ../../library/stdtypes.rst:5380 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7569,16 +7789,17 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5387 msgid "" -"The user-exposed type for the union object can be accessed from :data:`types." -"UnionType` and used for :func:`isinstance` checks. An object cannot be " -"instantiated from the type::" +"The user-exposed type for the union object can be accessed " +"from :data:`types.UnionType` and used for :func:`isinstance` checks. An " +"object cannot be instantiated from the type::" msgstr "" -"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." -"UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" +"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透" +"過 :data:`types.UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別" +"來實例化: ::" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5391 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7596,7 +7817,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5400 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7605,7 +7826,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5256 +#: ../../library/stdtypes.rst:5404 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7631,72 +7852,72 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5420 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5280 +#: ../../library/stdtypes.rst:5428 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5282 +#: ../../library/stdtypes.rst:5430 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5437 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5291 +#: ../../library/stdtypes.rst:5439 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " -"table. Module attributes can be assigned to. (Note that the :keyword:" -"`import` statement is not, strictly speaking, an operation on a module " -"object; ``import foo`` does not require a module object named *foo* to " -"exist, rather it requires an (external) *definition* for a module named " +"table. Module attributes can be assigned to. (Note that " +"the :keyword:`import` statement is not, strictly speaking, an operation on a " +"module object; ``import foo`` does not require a module object named *foo* " +"to exist, rather it requires an (external) *definition* for a module named " "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5446 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " "will actually change the module's symbol table, but direct assignment to " -"the :attr:`~object.__dict__` attribute is not possible (you can write ``m." -"__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write " -"``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not " -"recommended." +"the :attr:`~object.__dict__` attribute is not possible (you can write " +"``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't " +"write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is " +"not recommended." msgstr "" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5454 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5462 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5464 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5470 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5324 +#: ../../library/stdtypes.rst:5472 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5327 +#: ../../library/stdtypes.rst:5475 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7704,36 +7925,36 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5331 +#: ../../library/stdtypes.rst:5479 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5337 +#: ../../library/stdtypes.rst:5485 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5489 msgid "" "Methods are functions that are called using the attribute notation. There " -"are two flavors: :ref:`built-in methods ` (such as :meth:" -"`append` on lists) and :ref:`class instance method `. " -"Built-in methods are described with the types that support them." +"are two flavors: :ref:`built-in methods ` (such " +"as :meth:`append` on lists) and :ref:`class instance method `. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5346 +#: ../../library/stdtypes.rst:5494 msgid "" "If you access a method (a function defined in a class namespace) through an " -"instance, you get a special object: a :dfn:`bound method` (also called :ref:" -"`instance method `) object. When called, it will add the " -"``self`` argument to the argument list. Bound methods have two special read-" -"only attributes: :attr:`m.__self__ ` is the object on which " -"the method operates, and :attr:`m.__func__ ` is the " -"function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` " -"is completely equivalent to calling ``m.__func__(m.__self__, arg-1, " -"arg-2, ..., arg-n)``." +"instance, you get a special object: a :dfn:`bound method` (also " +"called :ref:`instance method `) object. When called, it " +"will add the ``self`` argument to the argument list. Bound methods have two " +"special read-only attributes: :attr:`m.__self__ ` is the " +"object on which the method operates, and :attr:`m.__func__ " +"` is the function implementing the method. Calling " +"``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling " +"``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5357 +#: ../../library/stdtypes.rst:5505 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7744,7 +7965,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5513 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -7772,25 +7993,25 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5528 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5536 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5542 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " "objects because they don't contain a reference to their global execution " "environment. Code objects are returned by the built-in :func:`compile` " -"function and can be extracted from function objects through their :attr:" -"`~function.__code__` attribute. See also the :mod:`code` module." +"function and can be extracted from function objects through " +"their :attr:`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5549 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -7799,21 +8020,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5408 +#: ../../library/stdtypes.rst:5556 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5411 +#: ../../library/stdtypes.rst:5559 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5417 +#: ../../library/stdtypes.rst:5565 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5423 +#: ../../library/stdtypes.rst:5571 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -7821,119 +8042,119 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5576 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5582 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5436 +#: ../../library/stdtypes.rst:5584 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5440 +#: ../../library/stdtypes.rst:5588 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5595 msgid "The Ellipsis Object" -msgstr "" +msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5449 +#: ../../library/stdtypes.rst:5597 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " -"no special operations. There is exactly one ellipsis object, named :const:" -"`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:" -"`Ellipsis` singleton." +"no special operations. There is exactly one ellipsis object, " +"named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " +"the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5454 +#: ../../library/stdtypes.rst:5602 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5460 +#: ../../library/stdtypes.rst:5608 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5462 +#: ../../library/stdtypes.rst:5610 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " -"more information. There is exactly one :data:`NotImplemented` object. :code:" -"`type(NotImplemented)()` produces the singleton instance." +"more information. There is exactly one :data:`NotImplemented` " +"object. :code:`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5615 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5621 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5475 +#: ../../library/stdtypes.rst:5623 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5631 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5485 +#: ../../library/stdtypes.rst:5633 msgid "" "The implementation adds a few special read-only attributes to several object " -"types, where they are relevant. Some of these are not reported by the :func:" -"`dir` built-in function." +"types, where they are relevant. Some of these are not reported by " +"the :func:`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5640 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5646 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5506 +#: ../../library/stdtypes.rst:5654 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5511 +#: ../../library/stdtypes.rst:5659 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5664 msgid "" -"The :ref:`type parameters ` of generic classes, functions, and :" -"ref:`type aliases `. For classes and functions that are not " -"generic, this will be an empty tuple." +"The :ref:`type parameters ` of generic classes, functions, " +"and :ref:`type aliases `. For classes and functions that are " +"not generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5674 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5676 msgid "" -"CPython has a global limit for converting between :class:`int` and :class:" -"`str` to mitigate denial of service attacks. This limit *only* applies to " -"decimal or other non-power-of-two number bases. Hexadecimal, octal, and " -"binary conversions are unlimited. The limit can be configured." +"CPython has a global limit for converting between :class:`int` " +"and :class:`str` to mitigate denial of service attacks. This limit *only* " +"applies to decimal or other non-power-of-two number bases. Hexadecimal, " +"octal, and binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5533 +#: ../../library/stdtypes.rst:5681 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7943,24 +8164,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5688 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5542 +#: ../../library/stdtypes.rst:5690 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5694 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5696 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -7984,19 +8205,19 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5716 msgid "" -"The default limit is 4300 digits as provided in :data:`sys.int_info." -"default_max_str_digits `. The lowest limit that can be " -"configured is 640 digits as provided in :data:`sys.int_info." -"str_digits_check_threshold `." +"The default limit is 4300 digits as provided " +"in :data:`sys.int_info.default_max_str_digits `. The lowest " +"limit that can be configured is 640 digits as provided " +"in :data:`sys.int_info.str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5573 +#: ../../library/stdtypes.rst:5721 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5575 +#: ../../library/stdtypes.rst:5723 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8014,84 +8235,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5736 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5738 msgid "" -"The limitation only applies to potentially slow conversions between :class:" -"`int` and :class:`str` or :class:`bytes`:" +"The limitation only applies to potentially slow conversions " +"between :class:`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5741 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5742 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5743 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5744 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5745 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5600 +#: ../../library/stdtypes.rst:5748 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5750 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5751 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5752 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5605 +#: ../../library/stdtypes.rst:5753 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5754 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5755 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5758 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5760 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5763 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5766 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8099,47 +8320,48 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5768 msgid "" -":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" -"`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " -"env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " -"value of *-1* indicates that both were unset, thus a value of :data:`sys." -"int_info.default_max_str_digits` was used during initialization." +":data:`sys.flags.int_max_str_digits` contains the value " +"of :envvar:`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. " +"If both the env var and the ``-X`` option are set, the ``-X`` option takes " +"precedence. A value of *-1* indicates that both were unset, thus a value " +"of :data:`sys.int_info.default_max_str_digits` was used during " +"initialization." msgstr "" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5774 msgid "" -"From code, you can inspect the current limit and set a new one using these :" -"mod:`sys` APIs:" +"From code, you can inspect the current limit and set a new one using " +"these :mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5777 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5781 msgid "" -"Information about the default and minimum can be found in :data:`sys." -"int_info`:" +"Information about the default and minimum can be found " +"in :data:`sys.int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:5783 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5637 +#: ../../library/stdtypes.rst:5785 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5792 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8151,7 +8373,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5653 +#: ../../library/stdtypes.rst:5801 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8159,11 +8381,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5659 +#: ../../library/stdtypes.rst:5807 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5809 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8171,11 +8393,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5666 +#: ../../library/stdtypes.rst:5814 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5668 +#: ../../library/stdtypes.rst:5816 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8197,38 +8419,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5826 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5830 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5683 +#: ../../library/stdtypes.rst:5831 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5686 +#: ../../library/stdtypes.rst:5834 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5837 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5839 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5694 +#: ../../library/stdtypes.rst:5842 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8241,13 +8463,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:5567 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "statement" msgstr "statement(陳述式)" @@ -8369,11 +8591,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1260 #: ../../library/stdtypes.rst:1339 ../../library/stdtypes.rst:1383 #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 -#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:2545 -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:4233 -#: ../../library/stdtypes.rst:4435 ../../library/stdtypes.rst:4914 -#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5339 -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2691 +#: ../../library/stdtypes.rst:2798 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:4581 ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5317 ../../library/stdtypes.rst:5487 +#: ../../library/stdtypes.rst:5531 msgid "object" msgstr "object(物件)" @@ -8465,9 +8687,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5390 ../../library/stdtypes.rst:5404 -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:5538 ../../library/stdtypes.rst:5552 +#: ../../library/stdtypes.rst:5567 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8483,8 +8705,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:3767 msgid "+ (plus)" msgstr "+ (加號)" @@ -8496,13 +8718,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:3767 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2359 -#: ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2505 +#: ../../library/stdtypes.rst:3724 msgid "* (asterisk)" msgstr "* (星號)" @@ -8514,8 +8736,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2323 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:3692 msgid "% (percent)" msgstr "% (百分號)" @@ -8525,7 +8747,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "operations on" msgstr "operations on(操作於)" @@ -8534,7 +8756,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:5567 msgid "module" msgstr "模組" @@ -8602,7 +8824,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4975 msgid "protocol" msgstr "protocol(協定)" @@ -8628,7 +8850,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4581 msgid "len" msgstr "len" @@ -8705,14 +8927,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2526 -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:2724 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2798 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:3692 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:5317 ../../library/stdtypes.rst:5567 msgid "type" msgstr "type(型別)" @@ -8720,7 +8942,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 msgid "del" msgstr "del" @@ -8762,6 +8984,7 @@ msgstr "range" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1553 #: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "string" msgstr "string(字串)" @@ -8782,17 +9005,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2518 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2664 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2526 -#: ../../library/stdtypes.rst:2545 ../../library/stdtypes.rst:2724 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2691 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:3692 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2724 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2870 msgid "methods" msgstr "methods(方法)" @@ -8800,183 +9023,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2131 ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:2137 ../../library/stdtypes.rst:3546 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2131 +#: ../../library/stdtypes.rst:2137 msgid "str.splitlines method" msgstr "str.splitlines 方法" #: ../../library/stdtypes.rst:2323 +msgid "! formatted string literal" +msgstr "! formatted string literals(! 格式化字串常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "formatted string literals" +msgstr "formatted string literals(格式化字串常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "! f-string" +msgstr "! f-string(! f 字串)" + +#: ../../library/stdtypes.rst:2323 +msgid "f-strings" +msgstr "f-string(f 字串)" + +#: ../../library/stdtypes.rst:2323 +msgid "fstring" +msgstr "fstring(f 字串)" + +#: ../../library/stdtypes.rst:2323 +msgid "interpolated string literal" +msgstr "interpolated string literal(插值字串常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "formatted literal" +msgstr "formatted literal(格式化常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "interpolated literal" +msgstr "interpolated literal(插值常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "{} (curly brackets)" +msgstr "{} (花括號)" + +#: ../../library/stdtypes.rst:2323 +msgid "in formatted string literal" +msgstr "於格式化字串常數中" + +#: ../../library/stdtypes.rst:2323 +msgid "! (exclamation mark)" +msgstr "! (驚嘆號)" + +#: ../../library/stdtypes.rst:2323 +msgid ": (colon)" +msgstr ": (冒號)" + +#: ../../library/stdtypes.rst:2323 +msgid "= (equals)" +msgstr "= (等號)" + +#: ../../library/stdtypes.rst:2323 +msgid "for help in debugging using string literals" +msgstr "" + +#: ../../library/stdtypes.rst:2469 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:2469 ../../library/stdtypes.rst:3692 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:2469 ../../library/stdtypes.rst:3692 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:3724 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3578 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:3724 ../../library/stdtypes.rst:3767 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:3724 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2548 ../../library/stdtypes.rst:3767 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2548 ../../library/stdtypes.rst:3767 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2518 +#: ../../library/stdtypes.rst:2664 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2672 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2672 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:3546 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:3546 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4379 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4518 +#: ../../library/stdtypes.rst:4664 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4975 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4975 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4975 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:5048 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:5048 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:5060 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:5060 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:5060 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5317 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5317 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5339 +#: ../../library/stdtypes.rst:5487 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5531 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5531 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5538 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5538 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5552 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5552 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5591 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5591 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/string.po b/library/string.po index 8e279ed304..91b6bcfecd 100644 --- a/library/string.po +++ b/library/string.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 00:13+0000\n" +"POT-Creation-Date: 2025-04-08 00:14+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,9 +44,9 @@ msgstr "此模組中定義的常數為:" #: ../../library/string.rst:26 msgid "" -"The concatenation of the :const:`ascii_lowercase` and :const:" -"`ascii_uppercase` constants described below. This value is not locale-" -"dependent." +"The concatenation of the :const:`ascii_lowercase` " +"and :const:`ascii_uppercase` constants described below. This value is not " +"locale-dependent." msgstr "" "下文描述的 :const:`ascii_lowercase` 和 :const:`ascii_uppercase` 常數的串接," "該值不依賴於區域設定。" @@ -64,15 +63,15 @@ msgid "" "The uppercase letters ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``. This value is not " "locale-dependent and will not change." msgstr "" -"大寫字母 ``’ABCDEFGHIJKLMNOPQRSTUVWXYZ’``。 此值與地區設定無關且不會改變。" +"大寫字母 ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``。此值與地區設定無關且不會改變。" #: ../../library/string.rst:44 msgid "The string ``'0123456789'``." -msgstr "字串 ``’0123456789’``。" +msgstr "字串 ``'0123456789'``。" #: ../../library/string.rst:49 msgid "The string ``'0123456789abcdefABCDEF'``." -msgstr "字串 ``’0123456789abcdefABCDEF’``。" +msgstr "字串 ``'0123456789abcdefABCDEF'``。" #: ../../library/string.rst:54 msgid "The string ``'01234567'``." @@ -83,20 +82,29 @@ msgid "" "String of ASCII characters which are considered punctuation characters in " "the ``C`` locale: ``!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~``." msgstr "" -"在 ``C`` 語言中被視為標點符號的 ASCII 字元的字串: ``!”#$%&’()*+,-./:;<=>?" +"在 ``C`` 語言中被視為標點符號的 ASCII 字元的字串:``!\"#$%&'()*+,-./:;<=>?" "@[\\]^_`{|}~``。" -#: ../../library/string.rst:64 +#: ../../library/string.rst:65 msgid "" -"String of ASCII characters which are considered printable. This is a " -"combination of :const:`digits`, :const:`ascii_letters`, :const:" -"`punctuation`, and :const:`whitespace`." +"String of ASCII characters which are considered printable by Python. This is " +"a combination " +"of :const:`digits`, :const:`ascii_letters`, :const:`punctuation`, " +"and :const:`whitespace`." msgstr "" -"ASCII 字元的字串是可被列印輸出的。 這是 :const:`digits`、:const:" -"`ascii_letters`、:const:`punctuation` 和 :const:`whitespace` 的組合。" +"ASCII 字元的字串被 Python 是為可被列印輸出的。這" +"是 :const:`digits`、:const:`ascii_letters`、:const:`punctuation` " +"和 :const:`whitespace` 的組合。" #: ../../library/string.rst:71 msgid "" +"By design, :meth:`string.printable.isprintable() ` " +"returns :const:`False`. In particular, ``string.printable`` is not printable " +"in the POSIX sense (see :manpage:`LC_CTYPE `)." +msgstr "" + +#: ../../library/string.rst:78 +msgid "" "A string containing all ASCII characters that are considered whitespace. " "This includes the characters space, tab, linefeed, return, formfeed, and " "vertical tab." @@ -105,11 +113,11 @@ msgstr "" "符號 (tab)、換行符號 (linefeed)、return、換頁符號 (formfeed) 和垂直製表符號 " "(vertical tab) 這些字元。" -#: ../../library/string.rst:79 +#: ../../library/string.rst:86 msgid "Custom String Formatting" msgstr "自訂字串格式" -#: ../../library/string.rst:81 +#: ../../library/string.rst:88 msgid "" "The built-in string class provides the ability to do complex variable " "substitutions and value formatting via the :meth:`~str.format` method " @@ -123,42 +131,43 @@ msgstr "" "模組可讓你使用與內建 :meth:`~str.format` 方法相同的實作來建立和自訂你自己的字" "串格式化行為。" -#: ../../library/string.rst:90 +#: ../../library/string.rst:97 msgid "The :class:`Formatter` class has the following public methods:" msgstr ":class:`Formatter` 類別有以下的公開方法:" -#: ../../library/string.rst:94 +#: ../../library/string.rst:101 msgid "" "The primary API method. It takes a format string and an arbitrary set of " -"positional and keyword arguments. It is just a wrapper that calls :meth:" -"`vformat`." +"positional and keyword arguments. It is just a wrapper that " +"calls :meth:`vformat`." msgstr "" -"主要的 API 方法。它接收一個格式字串及一組任意的位置引數與關鍵字引數,是呼叫 :" -"meth:`vformat` 的包裝器 (wrapper)。" +"主要的 API 方法。它接收一個格式字串及一組任意的位置引數與關鍵字引數,是呼" +"叫 :meth:`vformat` 的包裝器 (wrapper)。" -#: ../../library/string.rst:98 +#: ../../library/string.rst:105 msgid "" "A format string argument is now :ref:`positional-only `." msgstr "現在格式字串引數是\\ :ref:`僅限位置參數 `。" -#: ../../library/string.rst:104 +#: ../../library/string.rst:111 msgid "" "This function does the actual work of formatting. It is exposed as a " "separate function for cases where you want to pass in a predefined " "dictionary of arguments, rather than unpacking and repacking the dictionary " -"as individual arguments using the ``*args`` and ``**kwargs`` syntax. :meth:" -"`vformat` does the work of breaking up the format string into character data " -"and replacement fields. It calls the various methods described below." +"as individual arguments using the ``*args`` and ``**kwargs`` " +"syntax. :meth:`vformat` does the work of breaking up the format string into " +"character data and replacement fields. It calls the various methods " +"described below." msgstr "" -#: ../../library/string.rst:112 +#: ../../library/string.rst:119 msgid "" "In addition, the :class:`Formatter` defines a number of methods that are " "intended to be replaced by subclasses:" msgstr "" -#: ../../library/string.rst:117 +#: ../../library/string.rst:124 msgid "" "Loop over the format_string and return an iterable of tuples " "(*literal_text*, *field_name*, *format_spec*, *conversion*). This is used " @@ -169,7 +178,7 @@ msgstr "" "*field_name*, *format_spec*, *conversion*)。這會被 :meth:`vformat` 用於將字串" "裁切為字面文本或替換欄位。" -#: ../../library/string.rst:122 +#: ../../library/string.rst:129 msgid "" "The values in the tuple conceptually represent a span of literal text " "followed by a single replacement field. If there is no literal text (which " @@ -179,17 +188,17 @@ msgid "" "be ``None``." msgstr "" -#: ../../library/string.rst:131 +#: ../../library/string.rst:138 msgid "" "Given *field_name* as returned by :meth:`parse` (see above), convert it to " "an object to be formatted. Returns a tuple (obj, used_key). The default " -"version takes strings of the form defined in :pep:`3101`, such as " -"\"0[name]\" or \"label.title\". *args* and *kwargs* are as passed in to :" -"meth:`vformat`. The return value *used_key* has the same meaning as the " +"version takes strings of the form defined in :pep:`3101`, such as \"0[name]" +"\" or \"label.title\". *args* and *kwargs* are as passed in " +"to :meth:`vformat`. The return value *used_key* has the same meaning as the " "*key* parameter to :meth:`get_value`." msgstr "" -#: ../../library/string.rst:140 +#: ../../library/string.rst:147 msgid "" "Retrieve a given field value. The *key* argument will be either an integer " "or a string. If it is an integer, it represents the index of the positional " @@ -197,62 +206,63 @@ msgid "" "in *kwargs*." msgstr "" -#: ../../library/string.rst:145 +#: ../../library/string.rst:152 msgid "" -"The *args* parameter is set to the list of positional arguments to :meth:" -"`vformat`, and the *kwargs* parameter is set to the dictionary of keyword " -"arguments." +"The *args* parameter is set to the list of positional arguments " +"to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of " +"keyword arguments." msgstr "" -#: ../../library/string.rst:149 +#: ../../library/string.rst:156 msgid "" "For compound field names, these functions are only called for the first " "component of the field name; subsequent components are handled through " "normal attribute and indexing operations." msgstr "" -#: ../../library/string.rst:153 +#: ../../library/string.rst:160 msgid "" "So for example, the field expression '0.name' would cause :meth:`get_value` " "to be called with a *key* argument of 0. The ``name`` attribute will be " -"looked up after :meth:`get_value` returns by calling the built-in :func:" -"`getattr` function." +"looked up after :meth:`get_value` returns by calling the built-" +"in :func:`getattr` function." msgstr "" -#: ../../library/string.rst:158 +#: ../../library/string.rst:165 msgid "" -"If the index or keyword refers to an item that does not exist, then an :exc:" -"`IndexError` or :exc:`KeyError` should be raised." +"If the index or keyword refers to an item that does not exist, then " +"an :exc:`IndexError` or :exc:`KeyError` should be raised." msgstr "" -#: ../../library/string.rst:163 +#: ../../library/string.rst:170 msgid "" "Implement checking for unused arguments if desired. The arguments to this " "function is the set of all argument keys that were actually referred to in " "the format string (integers for positional arguments, and strings for named " "arguments), and a reference to the *args* and *kwargs* that was passed to " -"vformat. The set of unused args can be calculated from these parameters. :" -"meth:`check_unused_args` is assumed to raise an exception if the check fails." +"vformat. The set of unused args can be calculated from these " +"parameters. :meth:`check_unused_args` is assumed to raise an exception if " +"the check fails." msgstr "" -#: ../../library/string.rst:173 +#: ../../library/string.rst:180 msgid "" ":meth:`format_field` simply calls the global :func:`format` built-in. The " "method is provided so that subclasses can override it." msgstr "" -#: ../../library/string.rst:178 +#: ../../library/string.rst:185 msgid "" "Converts the value (returned by :meth:`get_field`) given a conversion type " "(as in the tuple returned by the :meth:`parse` method). The default version " "understands 's' (str), 'r' (repr) and 'a' (ascii) conversion types." msgstr "" -#: ../../library/string.rst:187 +#: ../../library/string.rst:194 msgid "Format String Syntax" msgstr "格式化文字語法" -#: ../../library/string.rst:189 +#: ../../library/string.rst:196 msgid "" "The :meth:`str.format` method and the :class:`Formatter` class share the " "same syntax for format strings (although in the case of :class:`Formatter`, " @@ -262,7 +272,7 @@ msgid "" "expressions." msgstr "" -#: ../../library/string.rst:202 +#: ../../library/string.rst:209 msgid "" "Format strings contain \"replacement fields\" surrounded by curly braces ``{}" "``. Anything that is not contained in braces is considered literal text, " @@ -271,11 +281,11 @@ msgid "" "``." msgstr "" -#: ../../library/string.rst:207 +#: ../../library/string.rst:214 msgid "The grammar for a replacement field is as follows:" msgstr "" -#: ../../library/string.rst:219 +#: ../../library/string.rst:226 msgid "" "In less formal terms, the replacement field can start with a *field_name* " "that specifies the object whose value is to be formatted and inserted into " @@ -285,11 +295,11 @@ msgid "" "specify a non-default format for the replacement value." msgstr "" -#: ../../library/string.rst:226 +#: ../../library/string.rst:233 msgid "See also the :ref:`formatspec` section." msgstr "另請參閱 :ref:`formatspec` 部份。" -#: ../../library/string.rst:228 +#: ../../library/string.rst:235 msgid "" "The *field_name* itself begins with an *arg_name* that is either a number or " "a keyword. If it's a number, it refers to a positional argument, and if " @@ -301,27 +311,27 @@ msgid "" "not quote-delimited, it is not possible to specify arbitrary dictionary keys " "(e.g., the strings ``'10'`` or ``':-]'``) within a format string. The " "*arg_name* can be followed by any number of index or attribute expressions. " -"An expression of the form ``'.name'`` selects the named attribute using :" -"func:`getattr`, while an expression of the form ``'[index]'`` does an index " -"lookup using :meth:`~object.__getitem__`." +"An expression of the form ``'.name'`` selects the named attribute " +"using :func:`getattr`, while an expression of the form ``'[index]'`` does an " +"index lookup using :meth:`~object.__getitem__`." msgstr "" -#: ../../library/string.rst:242 +#: ../../library/string.rst:249 msgid "" "The positional argument specifiers can be omitted for :meth:`str.format`, so " "``'{} {}'.format(a, b)`` is equivalent to ``'{0} {1}'.format(a, b)``." msgstr "" -#: ../../library/string.rst:246 +#: ../../library/string.rst:253 msgid "" "The positional argument specifiers can be omitted for :class:`Formatter`." msgstr "" -#: ../../library/string.rst:249 +#: ../../library/string.rst:256 msgid "Some simple format string examples::" msgstr "" -#: ../../library/string.rst:251 +#: ../../library/string.rst:258 msgid "" "\"First, thou shalt count to {0}\" # References first positional argument\n" "\"Bring me a {}\" # Implicitly references the first " @@ -334,37 +344,37 @@ msgid "" "'players'." msgstr "" -#: ../../library/string.rst:258 +#: ../../library/string.rst:265 msgid "" "The *conversion* field causes a type coercion before formatting. Normally, " "the job of formatting a value is done by the :meth:`~object.__format__` " "method of the value itself. However, in some cases it is desirable to force " "a type to be formatted as a string, overriding its own definition of " -"formatting. By converting the value to a string before calling :meth:" -"`~object.__format__`, the normal formatting logic is bypassed." +"formatting. By converting the value to a string before " +"calling :meth:`~object.__format__`, the normal formatting logic is bypassed." msgstr "" -#: ../../library/string.rst:265 +#: ../../library/string.rst:272 msgid "" -"Three conversion flags are currently supported: ``'!s'`` which calls :func:" -"`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` which " -"calls :func:`ascii`." +"Three conversion flags are currently supported: ``'!s'`` which " +"calls :func:`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!" +"a'`` which calls :func:`ascii`." msgstr "" "目前支援三種轉換旗標:``'!s'`` 會對該值呼叫 :func:`str`,``'!r'`` 會對該值呼" "叫 :func:`repr`,而 ``'!a'`` 則會對該值呼叫 :func:`ascii`。" -#: ../../library/string.rst:269 +#: ../../library/string.rst:276 msgid "Some examples::" msgstr "一些範例: ::" -#: ../../library/string.rst:271 +#: ../../library/string.rst:278 msgid "" "\"Harold's a clever {0!s}\" # Calls str() on the argument first\n" "\"Bring out the holy {name!r}\" # Calls repr() on the argument first\n" "\"More {!a}\" # Calls ascii() on the argument first" msgstr "" -#: ../../library/string.rst:275 +#: ../../library/string.rst:282 msgid "" "The *format_spec* field contains a specification of how the value should be " "presented, including such details as field width, alignment, padding, " @@ -375,13 +385,13 @@ msgstr "" "數精度等細節資訊。每種值類型都可以定義自己的「格式化迷你語言 (formatting " "mini-language)」或對 *format_spec* 的解釋。" -#: ../../library/string.rst:280 +#: ../../library/string.rst:287 msgid "" "Most built-in types support a common formatting mini-language, which is " "described in the next section." msgstr "大多數內建型別都支援常見的格式化迷你語言,下一節將會詳細說明。" -#: ../../library/string.rst:283 +#: ../../library/string.rst:290 msgid "" "A *format_spec* field can also include nested replacement fields within it. " "These nested replacement fields may contain a field name, conversion flag " @@ -392,31 +402,31 @@ msgid "" msgstr "" "*format_spec* 欄位還可以在其內部包含巢狀的替換欄位。這些巢狀的替換欄位可能包" "含欄位名稱、轉換旗標、格式規格描述,但是不允許再更深層的巢狀結構。" -"format_spec 内部的替換欄位會在 *format_spec* 字串被直譯前被替換。這讓數值的格" +"format_spec 內部的替換欄位會在 *format_spec* 字串被直譯前被替換。這讓數值的格" "式能夠被動態地指定。" -#: ../../library/string.rst:290 +#: ../../library/string.rst:297 msgid "See the :ref:`formatexamples` section for some examples." msgstr "範例請見 :ref:`formatexamples`。" -#: ../../library/string.rst:296 +#: ../../library/string.rst:303 msgid "Format Specification Mini-Language" msgstr "格式規格 (Format Specification) 迷你語言" -#: ../../library/string.rst:298 +#: ../../library/string.rst:305 msgid "" "\"Format specifications\" are used within replacement fields contained " -"within a format string to define how individual values are presented (see :" -"ref:`formatstrings` and :ref:`f-strings`). They can also be passed directly " -"to the built-in :func:`format` function. Each formattable type may define " -"how the format specification is to be interpreted." +"within a format string to define how individual values are presented " +"(see :ref:`formatstrings` and :ref:`f-strings`). They can also be passed " +"directly to the built-in :func:`format` function. Each formattable type may " +"define how the format specification is to be interpreted." msgstr "" "「格式規格」在格式字串 (format string) 中包含的替換欄位中使用,以定義各個值如" "何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`\\ )。它們也能夠直" "接傳遞給內建的 :func:`format` 函式。每個可格式化型別 (formattable type) 可以" "定義格式規格如何被直譯。" -#: ../../library/string.rst:305 +#: ../../library/string.rst:312 msgid "" "Most built-in types implement the following options for format " "specifications, although some of the formatting options are only supported " @@ -424,7 +434,7 @@ msgid "" msgstr "" "大部分內建型別為了格式規格實作了下列選項,不過有些選項只被數值型別支援。" -#: ../../library/string.rst:308 +#: ../../library/string.rst:315 msgid "" "A general convention is that an empty format specification produces the same " "result as if you had called :func:`str` on the value. A non-empty format " @@ -433,11 +443,11 @@ msgstr "" "一般來說,輸入空格式規格會產生和對值呼叫 :func:`str` 函式相同的結果,非空的格" "式規格才會修改結果。" -#: ../../library/string.rst:312 +#: ../../library/string.rst:319 msgid "The general form of a *standard format specifier* is:" msgstr "*標準格式說明符號 (standard format specifier)* 的一般型式如下:" -#: ../../library/string.rst:324 +#: ../../library/string.rst:333 msgid "" "If a valid *align* value is specified, it can be preceded by a *fill* " "character that can be any character and defaults to a space if omitted. It " @@ -448,67 +458,68 @@ msgid "" "the :func:`format` function." msgstr "" "如果給定了一個有效的 *align* 值,則可以在它之前加一個 *fill* 字元,且該字元可" -"為任意字元,若不加的話預設為空格。使用\\ :ref:`格式字串 `\\ 或 :" -"meth:`str.format` 時是無法在其中使用大括號(\"``{``\" 或 \"``}``\")作為 " -"*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影響 :func:" -"`format` 函式。" +"為任意字元,若不加的話預設為空格。使用\\ :ref:`格式字串 `\\ " +"或 :meth:`str.format` 時是無法在其中使用大括號(\"``{``\" 或 \"``}``\")作為 " +"*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影" +"響 :func:`format` 函式。" -#: ../../library/string.rst:333 +#: ../../library/string.rst:342 msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: ../../library/string.rst:342 ../../library/string.rst:374 +#: ../../library/string.rst:351 ../../library/string.rst:383 +#: ../../library/string.rst:442 msgid "Option" msgstr "選項" -#: ../../library/string.rst:342 ../../library/string.rst:374 -#: ../../library/string.rst:457 ../../library/string.rst:468 -#: ../../library/string.rst:503 +#: ../../library/string.rst:351 ../../library/string.rst:383 +#: ../../library/string.rst:442 ../../library/string.rst:481 +#: ../../library/string.rst:492 ../../library/string.rst:527 msgid "Meaning" msgstr "含義" -#: ../../library/string.rst:344 +#: ../../library/string.rst:353 msgid "``'<'``" msgstr "``'<'``" -#: ../../library/string.rst:344 +#: ../../library/string.rst:353 msgid "" "Forces the field to be left-aligned within the available space (this is the " "default for most objects)." msgstr "強制欄位在可用空間內靠左對齊(這是大多數物件的預設值)。" -#: ../../library/string.rst:347 +#: ../../library/string.rst:356 msgid "``'>'``" msgstr "``'>'``" -#: ../../library/string.rst:347 +#: ../../library/string.rst:356 msgid "" "Forces the field to be right-aligned within the available space (this is the " "default for numbers)." msgstr "強制欄位在可用空間內靠右對齊(這是數字的預設值)。" -#: ../../library/string.rst:350 +#: ../../library/string.rst:359 msgid "``'='``" msgstr "``'='``" -#: ../../library/string.rst:350 +#: ../../library/string.rst:359 msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " -"alignment option is only valid for numeric types, excluding :class:" -"`complex`. It becomes the default for numbers when '0' immediately precedes " -"the field width." +"alignment option is only valid for numeric types, " +"excluding :class:`complex`. It becomes the default for numbers when '0' " +"immediately precedes the field width." msgstr "" -#: ../../library/string.rst:357 +#: ../../library/string.rst:366 msgid "``'^'``" msgstr "``'^'``" -#: ../../library/string.rst:357 +#: ../../library/string.rst:366 msgid "Forces the field to be centered within the available space." msgstr "強制欄位在可用空間內置中。" -#: ../../library/string.rst:361 +#: ../../library/string.rst:370 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " @@ -517,54 +528,54 @@ msgstr "" "請注意,除非有定義了最小欄位寬度,否則欄位寬度將始終與填充它的資料大小相同," "故在該情況下的對齊選項是沒有意義的。" -#: ../../library/string.rst:365 +#: ../../library/string.rst:374 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "*sign* 選項只適用於數字型別,並可為以下之一:" -#: ../../library/string.rst:376 +#: ../../library/string.rst:385 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:376 +#: ../../library/string.rst:385 msgid "" -"indicates that a sign should be used for both positive as well as negative " +"Indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "表示正數與負數均需使用符號。" -#: ../../library/string.rst:379 +#: ../../library/string.rst:388 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:379 +#: ../../library/string.rst:388 msgid "" -"indicates that a sign should be used only for negative numbers (this is the " +"Indicates that a sign should be used only for negative numbers (this is the " "default behavior)." -msgstr "" +msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:368 ../../library/string.rst:382 +#: ../../library/string.rst:377 ../../library/string.rst:391 msgid "space" -msgstr "" +msgstr "空格" -#: ../../library/string.rst:382 +#: ../../library/string.rst:391 msgid "" -"indicates that a leading space should be used on positive numbers, and a " +"Indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:389 +#: ../../library/string.rst:398 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: ../../library/string.rst:393 +#: ../../library/string.rst:402 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" -#: ../../library/string.rst:398 +#: ../../library/string.rst:407 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -578,60 +589,80 @@ msgid "" "and ``'G'`` conversions, trailing zeros are not removed from the result." msgstr "" -#: ../../library/string.rst:412 -msgid "" -"The ``','`` option signals the use of a comma for a thousands separator. For " -"a locale aware separator, use the ``'n'`` integer presentation type instead." -msgstr "" - -#: ../../library/string.rst:416 -msgid "Added the ``','`` option (see also :pep:`378`)." -msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" - -#: ../../library/string.rst:421 -msgid "" -"The ``'_'`` option signals the use of an underscore for a thousands " -"separator for floating-point presentation types and for integer presentation " -"type ``'d'``. For integer presentation types ``'b'``, ``'o'``, ``'x'``, and " -"``'X'``, underscores will be inserted every 4 digits. For other " -"presentation types, specifying this option is an error." -msgstr "" -"``'_'`` 選項表示對於浮點表示型別和整數表示型別 ``'d'`` 使用底線作為千位分隔符" -"號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" -"底線。對於其他表示型別,指定此選項會出錯。" - -#: ../../library/string.rst:428 -msgid "Added the ``'_'`` option (see also :pep:`515`)." -msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" - -#: ../../library/string.rst:431 +#: ../../library/string.rst:419 msgid "" -"*width* is a decimal integer defining the minimum total field width, " +"The *width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " "specified, then the field width will be determined by the content." msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:435 +#: ../../library/string.rst:423 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " "excluding :class:`complex`. This is equivalent to a *fill* character of " "``'0'`` with an *alignment* type of ``'='``." msgstr "" -"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會為 :" -"class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" +"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會" +"為 :class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" "padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:440 +#: ../../library/string.rst:428 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" +#: ../../library/string.rst:433 +msgid "" +"The *grouping* option after the *width* field specifies a digit group " +"separator for the integral part of a number. It can be one of the following:" +msgstr "" + +#: ../../library/string.rst:444 +msgid "``','``" +msgstr "``','``" + #: ../../library/string.rst:444 msgid "" +"Inserts a comma every 3 digits for integer presentation type ``'d'`` and " +"floating-point presentation types, excluding ``'n'``. For other presentation " +"types, this option is not supported." +msgstr "" + +#: ../../library/string.rst:450 +msgid "``'_'``" +msgstr "``'_'``" + +#: ../../library/string.rst:450 +msgid "" +"Inserts an underscore every 3 digits for integer presentation type ``'d'`` " +"and floating-point presentation types, excluding ``'n'``. For integer " +"presentation types ``'b'``, ``'o'``, ``'x'``, and ``'X'``, underscores are " +"inserted every 4 digits. For other presentation types, this option is not " +"supported." +msgstr "" +"在整數表示型別 ``'d'`` 和浮點數表示型別中,每 3 位數插入一個底線,這不包括 " +"``'n'``。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會" +"插入底線。對於其他表示型別來說此選項並不支援。" + +#: ../../library/string.rst:460 +msgid "" +"For a locale aware separator, use the ``'n'`` presentation type instead." +msgstr "" + +#: ../../library/string.rst:462 +msgid "Added the ``','`` option (see also :pep:`378`)." +msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" + +#: ../../library/string.rst:465 +msgid "Added the ``'_'`` option (see also :pep:`515`)." +msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" + +#: ../../library/string.rst:468 +msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " "``'F'``, or before and after the decimal point for presentation types " @@ -645,89 +676,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:452 +#: ../../library/string.rst:476 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:454 +#: ../../library/string.rst:478 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:457 ../../library/string.rst:468 -#: ../../library/string.rst:503 +#: ../../library/string.rst:481 ../../library/string.rst:492 +#: ../../library/string.rst:527 msgid "Type" msgstr "型別" -#: ../../library/string.rst:459 +#: ../../library/string.rst:483 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:459 +#: ../../library/string.rst:483 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:462 ../../library/string.rst:491 -#: ../../library/string.rst:576 +#: ../../library/string.rst:486 ../../library/string.rst:515 +#: ../../library/string.rst:601 msgid "None" msgstr "None" -#: ../../library/string.rst:462 +#: ../../library/string.rst:486 msgid "The same as ``'s'``." -msgstr "" +msgstr "與 ``'s'`` 相同。" -#: ../../library/string.rst:465 +#: ../../library/string.rst:489 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:470 +#: ../../library/string.rst:494 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:470 +#: ../../library/string.rst:494 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:472 +#: ../../library/string.rst:496 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:472 +#: ../../library/string.rst:496 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:475 +#: ../../library/string.rst:499 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:475 +#: ../../library/string.rst:499 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:477 +#: ../../library/string.rst:501 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:477 +#: ../../library/string.rst:501 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:479 +#: ../../library/string.rst:503 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:479 +#: ../../library/string.rst:503 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:482 +#: ../../library/string.rst:506 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:482 +#: ../../library/string.rst:506 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -736,21 +767,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:487 ../../library/string.rst:569 +#: ../../library/string.rst:511 ../../library/string.rst:593 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:487 +#: ../../library/string.rst:511 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators." msgstr "" -#: ../../library/string.rst:491 +#: ../../library/string.rst:515 msgid "The same as ``'d'``." -msgstr "" +msgstr "與 ``'d'`` 相同。" -#: ../../library/string.rst:494 +#: ../../library/string.rst:518 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -758,43 +789,43 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:499 +#: ../../library/string.rst:523 msgid "" -"The available presentation types for :class:`float` and :class:`~decimal." -"Decimal` values are:" +"The available presentation types for :class:`float` " +"and :class:`~decimal.Decimal` values are:" msgstr "" -#: ../../library/string.rst:505 +#: ../../library/string.rst:529 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:505 +#: ../../library/string.rst:529 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " "exponent. The coefficient has one digit before and ``p`` digits after the " "decimal point, for a total of ``p + 1`` significant digits. With no " "precision given, uses a precision of ``6`` digits after the decimal point " -"for :class:`float`, and shows all coefficient digits for :class:`~decimal." -"Decimal`. If ``p=0``, the decimal point is omitted unless the ``#`` option " -"is used." +"for :class:`float`, and shows all coefficient digits " +"for :class:`~decimal.Decimal`. If ``p=0``, the decimal point is omitted " +"unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:516 +#: ../../library/string.rst:540 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:516 +#: ../../library/string.rst:540 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:519 +#: ../../library/string.rst:543 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:519 +#: ../../library/string.rst:543 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -804,21 +835,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:528 +#: ../../library/string.rst:552 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:528 +#: ../../library/string.rst:552 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:531 +#: ../../library/string.rst:555 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:531 +#: ../../library/string.rst:555 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -826,7 +857,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:538 +#: ../../library/string.rst:562 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -839,50 +870,51 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:551 +#: ../../library/string.rst:575 msgid "" -"With no precision given, uses a precision of ``6`` significant digits for :" -"class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " -"is formed from the coefficient digits of the value; scientific notation is " -"used for values smaller than ``1e-6`` in absolute value and values where the " -"place value of the least significant digit is larger than 1, and fixed-point " -"notation is used otherwise." +"With no precision given, uses a precision of ``6`` significant digits " +"for :class:`float`. For :class:`~decimal.Decimal`, the coefficient of the " +"result is formed from the coefficient digits of the value; scientific " +"notation is used for values smaller than ``1e-6`` in absolute value and " +"values where the place value of the least significant digit is larger than " +"1, and fixed-point notation is used otherwise." msgstr "" -#: ../../library/string.rst:560 +#: ../../library/string.rst:584 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:565 +#: ../../library/string.rst:589 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:565 +#: ../../library/string.rst:589 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:569 +#: ../../library/string.rst:593 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators for the integral " +"part of a number." msgstr "" -#: ../../library/string.rst:573 +#: ../../library/string.rst:598 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:573 +#: ../../library/string.rst:598 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:576 +#: ../../library/string.rst:601 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -891,20 +923,28 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:584 +#: ../../library/string.rst:609 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:588 +#: ../../library/string.rst:613 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:592 +#: ../../library/string.rst:617 +msgid "" +"The result should be correctly rounded to a given precision ``p`` of digits " +"after the decimal point. The rounding mode for :class:`float` matches that " +"of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding " +"mode of the current :ref:`context ` will be used." +msgstr "" + +#: ../../library/string.rst:622 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -916,17 +956,17 @@ msgid "" "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" -#: ../../library/string.rst:605 +#: ../../library/string.rst:635 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:607 +#: ../../library/string.rst:637 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:610 +#: ../../library/string.rst:640 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -935,17 +975,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:614 +#: ../../library/string.rst:644 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:617 +#: ../../library/string.rst:647 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:619 +#: ../../library/string.rst:649 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -959,12 +999,22 @@ msgid "" "repeated\n" "'abracadabra'" msgstr "" +">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" +"'a, b, c'\n" +">>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\n" +"'a, b, c'\n" +">>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n" +"'c, b, a'\n" +">>> '{2}, {1}, {0}'.format(*'abc') # 解包引數序列\n" +"'c, b, a'\n" +">>> '{0}{1}{0}'.format('abra', 'cad') # 引數索引可以重複\n" +"'abracadabra'" -#: ../../library/string.rst:630 +#: ../../library/string.rst:660 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:632 +#: ../../library/string.rst:662 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -974,11 +1024,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:638 +#: ../../library/string.rst:668 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:640 +#: ../../library/string.rst:670 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -995,22 +1045,25 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:653 +#: ../../library/string.rst:683 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:655 +#: ../../library/string.rst:685 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" +">>> coord = (3, 5)\n" +">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" +"'X: 3; Y: 5'" -#: ../../library/string.rst:659 +#: ../../library/string.rst:689 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:661 +#: ../../library/string.rst:691 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1020,11 +1073,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:664 +#: ../../library/string.rst:694 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:666 +#: ../../library/string.rst:696 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1036,27 +1089,34 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:675 +#: ../../library/string.rst:705 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:677 +#: ../../library/string.rst:707 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" ">>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers\n" "' 3.140000; -3.140000'\n" -">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:" -"f}; {:f}'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as " +"'{:f}; {:f}'\n" "'3.140000; -3.140000'" msgstr "" +">>> '{:+f}; {:+f}'.format(3.14, -3.14) # 總會顯示\n" +"'+3.140000; -3.140000'\n" +">>> '{: f}; {: f}'.format(3.14, -3.14) # 若為正數則顯示空格\n" +"' 3.140000; -3.140000'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # 只顯示負號 -- 與 '{:f}; {:f}' 相" +"同\n" +"'3.140000; -3.140000'" -#: ../../library/string.rst:684 +#: ../../library/string.rst:714 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:686 +#: ../../library/string.rst:716 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1066,23 +1126,35 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:693 -msgid "Using the comma as a thousands separator::" -msgstr "使用逗號作為千位分隔符: ::" +#: ../../library/string.rst:723 +msgid "Using the comma or the underscore as a digit group separator::" +msgstr "使用逗號或底線作為數字分組分隔符號: ::" -#: ../../library/string.rst:695 +#: ../../library/string.rst:725 msgid "" ">>> '{:,}'.format(1234567890)\n" -"'1,234,567,890'" +"'1,234,567,890'\n" +">>> '{:_}'.format(1234567890)\n" +"'1_234_567_890'\n" +">>> '{:_b}'.format(1234567890)\n" +"'100_1001_1001_0110_0000_0010_1101_0010'\n" +">>> '{:_x}'.format(1234567890)\n" +"'4996_02d2'" msgstr "" ">>> '{:,}'.format(1234567890)\n" -"'1,234,567,890'" - -#: ../../library/string.rst:698 +"'1,234,567,890'\n" +">>> '{:_}'.format(1234567890)\n" +"'1_234_567_890'\n" +">>> '{:_b}'.format(1234567890)\n" +"'100_1001_1001_0110_0000_0010_1101_0010'\n" +">>> '{:_x}'.format(1234567890)\n" +"'4996_02d2'" + +#: ../../library/string.rst:734 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:700 +#: ../../library/string.rst:736 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1094,11 +1166,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:705 +#: ../../library/string.rst:741 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:707 +#: ../../library/string.rst:743 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1110,11 +1182,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:712 +#: ../../library/string.rst:748 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:714 +#: ../../library/string.rst:750 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1130,7 +1202,7 @@ msgid "" "3232235521\n" ">>>\n" ">>> width = 5\n" -">>> for num in range(5,12): \n" +">>> for num in range(5,12):\n" "... for base in 'dXob':\n" "... print('{0:{width}{base}}'.format(num, base=base, width=width), " "end=' ')\n" @@ -1158,7 +1230,7 @@ msgstr "" "3232235521\n" ">>>\n" ">>> width = 5\n" -">>> for num in range(5,12): \n" +">>> for num in range(5,12):\n" "... for base in 'dXob':\n" "... print('{0:{width}{base}}'.format(num, base=base, width=width), " "end=' ')\n" @@ -1172,35 +1244,36 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:746 +#: ../../library/string.rst:782 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:748 +#: ../../library/string.rst:784 msgid "" -"Template strings provide simpler string substitutions as described in :pep:" -"`292`. A primary use case for template strings is for internationalization " -"(i18n) since in that context, the simpler syntax and functionality makes it " -"easier to translate than other built-in string formatting facilities in " -"Python. As an example of a library built on template strings for i18n, see " -"the `flufl.i18n `_ package." +"Template strings provide simpler string substitutions as described " +"in :pep:`292`. A primary use case for template strings is for " +"internationalization (i18n) since in that context, the simpler syntax and " +"functionality makes it easier to translate than other built-in string " +"formatting facilities in Python. As an example of a library built on " +"template strings for i18n, see the `flufl.i18n `_ package." msgstr "" "模板字串提供如 :pep:`292` 所述更簡單的字串替換。模板字串的主要用例是國際化 " "(i18n),因為在這種情況下,更簡單的語法和功能使得它比其他 Python 內建字串格式" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:758 +#: ../../library/string.rst:794 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:760 +#: ../../library/string.rst:796 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:762 +#: ../../library/string.rst:798 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1210,30 +1283,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:769 +#: ../../library/string.rst:805 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:773 +#: ../../library/string.rst:809 msgid "" -"Any other appearance of ``$`` in the string will result in a :exc:" -"`ValueError` being raised." +"Any other appearance of ``$`` in the string will result in " +"a :exc:`ValueError` being raised." msgstr "" -#: ../../library/string.rst:776 +#: ../../library/string.rst:812 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:782 +#: ../../library/string.rst:818 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:787 +#: ../../library/string.rst:823 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1245,7 +1318,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:796 +#: ../../library/string.rst:832 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1258,7 +1331,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:838 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1272,26 +1345,26 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:812 +#: ../../library/string.rst:848 msgid "" -"Returns false if the template has invalid placeholders that will cause :meth:" -"`substitute` to raise :exc:`ValueError`." +"Returns false if the template has invalid placeholders that will " +"cause :meth:`substitute` to raise :exc:`ValueError`." msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:820 +#: ../../library/string.rst:856 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:825 +#: ../../library/string.rst:861 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:829 +#: ../../library/string.rst:865 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1299,11 +1372,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:832 +#: ../../library/string.rst:868 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:834 +#: ../../library/string.rst:870 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1337,7 +1410,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:850 +#: ../../library/string.rst:886 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1347,21 +1420,21 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:855 +#: ../../library/string.rst:891 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " -"*not* be a regular expression, as the implementation will call :meth:`re." -"escape` on this string as needed. Note further that you cannot change the " -"delimiter after class creation (i.e. a different delimiter must be set in " -"the subclass's class namespace)." +"*not* be a regular expression, as the implementation will " +"call :meth:`re.escape` on this string as needed. Note further that you " +"cannot change the delimiter after class creation (i.e. a different delimiter " +"must be set in the subclass's class namespace)." msgstr "" "*delimiter* -- 這是描述引入左右定界符的文字字串。預設值是 ``$``。請注意這\\ *" "不是*\\ 正規表示式,因為實作會在需要時對這個字串呼叫 :meth:`re.escape`。也請" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:862 +#: ../../library/string.rst:898 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1369,19 +1442,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:869 +#: ../../library/string.rst:905 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:873 +#: ../../library/string.rst:909 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:877 +#: ../../library/string.rst:913 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1390,7 +1463,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:885 +#: ../../library/string.rst:921 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1399,7 +1472,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:893 +#: ../../library/string.rst:929 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1408,13 +1481,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:899 +#: ../../library/string.rst:935 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:902 +#: ../../library/string.rst:938 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1422,7 +1495,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:905 +#: ../../library/string.rst:941 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1430,7 +1503,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:908 +#: ../../library/string.rst:944 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1438,103 +1511,102 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:911 +#: ../../library/string.rst:947 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." msgstr "" -"當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" -"`ValueError`。" +"當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引" +"發 :exc:`ValueError`。" -#: ../../library/string.rst:916 +#: ../../library/string.rst:952 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:920 +#: ../../library/string.rst:956 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " -"using :meth:`str.capitalize`, and join the capitalized words using :meth:" -"`str.join`. If the optional second argument *sep* is absent or ``None``, " -"runs of whitespace characters are replaced by a single space and leading and " -"trailing whitespace are removed, otherwise *sep* is used to split and join " -"the words." +"using :meth:`str.capitalize`, and join the capitalized words " +"using :meth:`str.join`. If the optional second argument *sep* is absent or " +"``None``, runs of whitespace characters are replaced by a single space and " +"leading and trailing whitespace are removed, otherwise *sep* is used to " +"split and join the words." msgstr "" "使用 :meth:`str.split` 將引數分割為字詞,使用 :meth:`str.capitalize` 將每個單" "字大寫,並使用 :meth:`str.join` 將大寫字詞連接起來。如果可選的第二引數 *sep* " "不存在或為 ``None``,則連續的空白字元將替換為單一空格,並且刪除前導和尾隨空" "白;在其他情況下則使用 *sep* 來分割和連接單字。" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/string.rst:195 ../../library/string.rst:335 -#: ../../library/string.rst:368 ../../library/string.rst:387 -#: ../../library/string.rst:396 ../../library/string.rst:410 -#: ../../library/string.rst:419 +#: ../../library/string.rst:202 ../../library/string.rst:344 +#: ../../library/string.rst:377 ../../library/string.rst:396 +#: ../../library/string.rst:405 ../../library/string.rst:437 msgid "in string formatting" msgstr "於字串格式化" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid ". (dot)" msgstr ". (點)" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid "[] (square brackets)" msgstr "[] (方括號)" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:344 msgid "< (less)" msgstr "< (小於)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:344 msgid "> (greater)" msgstr "> (大於)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:344 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:344 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/string.rst:368 +#: ../../library/string.rst:377 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/string.rst:368 +#: ../../library/string.rst:377 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/string.rst:387 +#: ../../library/string.rst:396 msgid "z" msgstr "z" -#: ../../library/string.rst:396 +#: ../../library/string.rst:405 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/string.rst:410 +#: ../../library/string.rst:437 msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:419 +#: ../../library/string.rst:437 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:756 +#: ../../library/string.rst:792 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:756 +#: ../../library/string.rst:792 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/stringprep.po b/library/stringprep.po index 7999df6a59..5abe72f6a6 100644 --- a/library/stringprep.po +++ b/library/stringprep.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Liang-Bo Wang , 2016 +# Matt Wang , 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" -"PO-Revision-Date: 2016-11-19 00:34+0000\n" -"Last-Translator: Liang-Bo Wang \n" +"PO-Revision-Date: 2025-02-17 00:34+0000\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 +21,7 @@ msgstr "" #: ../../library/stringprep.rst:2 msgid ":mod:`!stringprep` --- Internet String Preparation" -msgstr ":mod:`!stringprep` --- 網際網路字串準備" +msgstr ":mod:`!stringprep` --- 網際網路字串的準備" #: ../../library/stringprep.rst:10 msgid "**Source code:** :source:`Lib/stringprep.py`" @@ -35,6 +36,10 @@ msgid "" "possible identifications, to allow only identifications consisting of " "\"printable\" characters." msgstr "" +"在網際網路上識別事物(例如主機名稱)時,通常需要比較這些識別器的「相等性 " +"(equality)」。比較的具體執行方式可能取決於應用程式領域,例如是否應該不區分大" +"小寫。也可能有必要限制可能的識別器,只允許由「可列印 (printable)」字元組成的" +"識別器。" #: ../../library/stringprep.rst:21 msgid "" @@ -47,6 +52,11 @@ msgid "" "``stringprep`` profile is ``nameprep``, which is used for internationalized " "domain names." msgstr "" +":rfc:`3454` 定義了在網際網路通訊協定中「準備」Unicode 字串的程序。在傳送字串" +"到網路之前,先使用準備程序處理字串,之後字串就具有特定的規範化 (normalized) " +"形式。RFC 定義了一系列的表,這些表可以組合成設定檔 (profile)。每個設定檔必須" +"定義它使用哪些表以及 ``stringprep`` 程序的哪些其他可選部分是設定檔的一部分。" +"``stringprep`` 配置文件的一個例子是 ``nameprep``,它被用於國際化網域名稱。" #: ../../library/stringprep.rst:29 msgid "" @@ -55,110 +65,122 @@ msgid "" "module uses the Unicode character database internally. The module source " "code itself was generated using the ``mkstringprep.py`` utility." msgstr "" +":mod:`stringprep` 模組只開放 :rfc:`3454` 中的表。由於這些表如果以字典或串列的" +"方式來表示的話會非常大,因此模組內部使用 Unicode 字元資料庫。模組原始碼本身是" +"使用 ``mkstringprep.py`` 工具來產生的。" #: ../../library/stringprep.rst:34 msgid "" "As a result, these tables are exposed as functions, not as data structures. " -"There are two kinds of tables in the RFC: sets and mappings. For a set, :mod:" -"`stringprep` provides the \"characteristic function\", i.e. a function that " -"returns ``True`` if the parameter is part of the set. For mappings, it " -"provides the mapping function: given the key, it returns the associated " -"value. Below is a list of all functions available in the module." +"There are two kinds of tables in the RFC: sets and mappings. For a " +"set, :mod:`stringprep` provides the \"characteristic function\", i.e. a " +"function that returns ``True`` if the parameter is part of the set. For " +"mappings, it provides the mapping function: given the key, it returns the " +"associated value. Below is a list of all functions available in the module." msgstr "" +"因此,這些表是以函式而非資料結構的形式呈現。RFC 中有兩種表:集合 (sets) 和對" +"映 (mappings)。對於集合,:mod:`stringprep` 提供了「特徵函式 (characteristic " +"function)」,也就是如果參數是集合的一部分就回傳 ``True`` 的函式。對於對映,它" +"提供了對映函式:給定鍵,它會回傳相關的值。以下是模組中所有可用函式的清單。" #: ../../library/stringprep.rst:44 msgid "" "Determine whether *code* is in tableA.1 (Unassigned code points in Unicode " "3.2)." msgstr "" +"判斷 *code* 是否在 tableA.1(Unicode 3.2 中未指定的碼位 (code point))中。" #: ../../library/stringprep.rst:49 msgid "Determine whether *code* is in tableB.1 (Commonly mapped to nothing)." -msgstr "" +msgstr "判斷 *code* 是否在 tableB.1(通常沒有對映到任何東西)中。" #: ../../library/stringprep.rst:54 msgid "" "Return the mapped value for *code* according to tableB.2 (Mapping for case-" "folding used with NFKC)." msgstr "" +"根據 tableB.2(使用 NFKC 形式的大小寫折疊 (case-folding) 對映)回傳 *code* 的" +"對映值。" #: ../../library/stringprep.rst:60 msgid "" "Return the mapped value for *code* according to tableB.3 (Mapping for case-" "folding used with no normalization)." -msgstr "" +msgstr "根據 tableB.3(使用沒有規範化的大小寫折疊對映)回傳 *code* 的對映值。" #: ../../library/stringprep.rst:66 msgid "Determine whether *code* is in tableC.1.1 (ASCII space characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.1.1(ASCII 空格字元)中。" #: ../../library/stringprep.rst:71 msgid "" "Determine whether *code* is in tableC.1.2 (Non-ASCII space characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.1.2(非 ASCII 空格字元)中。" #: ../../library/stringprep.rst:76 msgid "" "Determine whether *code* is in tableC.1 (Space characters, union of C.1.1 " "and C.1.2)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.1(空格字元,為 C.1.1 和 C.1.2 的聯集)中。" #: ../../library/stringprep.rst:82 msgid "Determine whether *code* is in tableC.2.1 (ASCII control characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.2.1(ASCII 控制字元)中。" #: ../../library/stringprep.rst:87 msgid "" "Determine whether *code* is in tableC.2.2 (Non-ASCII control characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.2.2(非 ASCII 控制字元)中。" #: ../../library/stringprep.rst:92 msgid "" "Determine whether *code* is in tableC.2 (Control characters, union of C.2.1 " "and C.2.2)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.2(控制字元,為 C.2.1 和 C.2.2 的聯集)中。" #: ../../library/stringprep.rst:98 msgid "Determine whether *code* is in tableC.3 (Private use)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.3(私有使用)中。" #: ../../library/stringprep.rst:103 msgid "Determine whether *code* is in tableC.4 (Non-character code points)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.4(非字元碼位)中。" #: ../../library/stringprep.rst:108 msgid "Determine whether *code* is in tableC.5 (Surrogate codes)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.5(代理碼)中。" #: ../../library/stringprep.rst:113 msgid "" "Determine whether *code* is in tableC.6 (Inappropriate for plain text)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.6(不適用於純文字)中。" #: ../../library/stringprep.rst:118 msgid "" "Determine whether *code* is in tableC.7 (Inappropriate for canonical " "representation)." msgstr "" +"判斷 *code* 是否在 tableC.7(不適用於規範表示法 (canonical representation))" +"中。" #: ../../library/stringprep.rst:124 msgid "" "Determine whether *code* is in tableC.8 (Change display properties or are " "deprecated)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.8(變更顯示屬性或已棄用)中。" #: ../../library/stringprep.rst:130 msgid "Determine whether *code* is in tableC.9 (Tagging characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.9(標記字元 (tagging characters))中。" #: ../../library/stringprep.rst:135 msgid "" "Determine whether *code* is in tableD.1 (Characters with bidirectional " "property \"R\" or \"AL\")." -msgstr "" +msgstr "判斷 *code* 是否在 tableD.1(具有雙向屬性 \"R\" 或 \"AL\" 的字元)中。" #: ../../library/stringprep.rst:141 msgid "" "Determine whether *code* is in tableD.2 (Characters with bidirectional " "property \"L\")." -msgstr "" +msgstr "判斷 *code* 是否在 tableD.2(具有雙向屬性 \"L\" 的字元)中。" diff --git a/library/struct.po b/library/struct.po index 812644b7bc..690def85aa 100644 --- a/library/struct.po +++ b/library/struct.po @@ -52,12 +52,12 @@ msgstr "" #: ../../library/struct.rst:39 msgid "" "Several :mod:`struct` functions (and methods of :class:`Struct`) take a " -"*buffer* argument. This refers to objects that implement the :ref:" -"`bufferobjects` and provide either a readable or read-writable buffer. The " -"most common types used for that purpose are :class:`bytes` and :class:" -"`bytearray`, but many other types that can be viewed as an array of bytes " -"implement the buffer protocol, so that they can be read/filled without " -"additional copying from a :class:`bytes` object." +"*buffer* argument. This refers to objects that implement " +"the :ref:`bufferobjects` and provide either a readable or read-writable " +"buffer. The most common types used for that purpose are :class:`bytes` " +"and :class:`bytearray`, but many other types that can be viewed as an array " +"of bytes implement the buffer protocol, so that they can be read/filled " +"without additional copying from a :class:`bytes` object." msgstr "" #: ../../library/struct.rst:48 @@ -247,8 +247,8 @@ msgstr "" msgid "" "Native byte order is big-endian or little-endian, depending on the host " "system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are little-" -"endian; IBM z and many legacy architectures are big-endian. Use :data:`sys." -"byteorder` to check the endianness of your system." +"endian; IBM z and many legacy architectures are big-endian. " +"Use :data:`sys.byteorder` to check the endianness of your system." msgstr "" #: ../../library/struct.rst:183 @@ -259,8 +259,8 @@ msgstr "" #: ../../library/struct.rst:186 msgid "" -"Standard size depends only on the format character; see the table in the :" -"ref:`format-characters` section." +"Standard size depends only on the format character; see the table in " +"the :ref:`format-characters` section." msgstr "" #: ../../library/struct.rst:189 @@ -666,13 +666,13 @@ msgid "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " "count. The first byte stored is the length of the string, or 255, whichever " -"is smaller. The bytes of the string follow. If the string passed in to :" -"func:`pack` is too long (longer than the count minus 1), only the leading " -"``count-1`` bytes of the string are stored. If the string is shorter than " -"``count-1``, it is padded with null bytes so that exactly count bytes in all " -"are used. Note that for :func:`unpack`, the ``'p'`` format character " -"consumes ``count`` bytes, but that the string returned can never contain " -"more than 255 bytes." +"is smaller. The bytes of the string follow. If the string passed in " +"to :func:`pack` is too long (longer than the count minus 1), only the " +"leading ``count-1`` bytes of the string are stored. If the string is " +"shorter than ``count-1``, it is padded with null bytes so that exactly count " +"bytes in all are used. Note that for :func:`unpack`, the ``'p'`` format " +"character consumes ``count`` bytes, but that the string returned can never " +"contain more than 255 bytes." msgstr "" #: ../../library/struct.rst:339 @@ -706,8 +706,8 @@ msgstr "" msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " -"``'Q'``), if ``x`` is outside the valid range for that format then :exc:" -"`struct.error` is raised." +"``'Q'``), if ``x`` is outside the valid range for that format " +"then :exc:`struct.error` is raised." msgstr "" #: ../../library/struct.rst:363 @@ -1076,8 +1076,8 @@ msgstr "" #: ../../library/struct.rst:595 msgid "" "Identical to the :func:`unpack_from` function, using the compiled format. " -"The buffer's size in bytes, starting at position *offset*, must be at least :" -"attr:`size`." +"The buffer's size in bytes, starting at position *offset*, must be at " +"least :attr:`size`." msgstr "" #: ../../library/struct.rst:602 @@ -1135,7 +1135,7 @@ msgstr "於 struct format strings(結構格式字串)" #: ../../library/struct.rst:136 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" #: ../../library/struct.rst:136 msgid "< (less)" diff --git a/library/subprocess.po b/library/subprocess.po index a5a9086c53..8ee5e86cc5 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-05-06 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2082,41 +2082,68 @@ msgid "Notes" msgstr "註解" #: ../../library/subprocess.rst:1597 -msgid "Converting an argument sequence to a string on Windows" +msgid "Timeout Behavior" msgstr "" #: ../../library/subprocess.rst:1599 msgid "" +"When using the ``timeout`` parameter in functions like :func:`run`, :meth:" +"`Popen.wait`, or :meth:`Popen.communicate`, users should be aware of the " +"following behaviors:" +msgstr "" + +#: ../../library/subprocess.rst:1603 +msgid "" +"**Process Creation Delay**: The initial process creation itself cannot be " +"interrupted on many platform APIs. This means that even when specifying a " +"timeout, you are not guaranteed to see a timeout exception until at least " +"after however long process creation takes." +msgstr "" + +#: ../../library/subprocess.rst:1608 +msgid "" +"**Extremely Small Timeout Values**: Setting very small timeout values (such " +"as a few milliseconds) may result in almost immediate :exc:`TimeoutExpired` " +"exceptions because process creation and system scheduling inherently require " +"time." +msgstr "" + +#: ../../library/subprocess.rst:1615 +msgid "Converting an argument sequence to a string on Windows" +msgstr "" + +#: ../../library/subprocess.rst:1617 +msgid "" "On Windows, an *args* sequence is converted to a string that can be parsed " "using the following rules (which correspond to the rules used by the MS C " "runtime):" msgstr "" -#: ../../library/subprocess.rst:1603 +#: ../../library/subprocess.rst:1621 msgid "" "Arguments are delimited by white space, which is either a space or a tab." msgstr "" -#: ../../library/subprocess.rst:1606 +#: ../../library/subprocess.rst:1624 msgid "" "A string surrounded by double quotation marks is interpreted as a single " "argument, regardless of white space contained within. A quoted string can " "be embedded in an argument." msgstr "" -#: ../../library/subprocess.rst:1611 +#: ../../library/subprocess.rst:1629 msgid "" "A double quotation mark preceded by a backslash is interpreted as a literal " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1614 +#: ../../library/subprocess.rst:1632 msgid "" "Backslashes are interpreted literally, unless they immediately precede a " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1617 +#: ../../library/subprocess.rst:1635 msgid "" "If backslashes immediately precede a double quotation mark, every pair of " "backslashes is interpreted as a literal backslash. If the number of " @@ -2124,19 +2151,19 @@ msgid "" "mark as described in rule 3." msgstr "" -#: ../../library/subprocess.rst:1626 +#: ../../library/subprocess.rst:1644 msgid ":mod:`shlex`" msgstr ":mod:`shlex`" -#: ../../library/subprocess.rst:1627 +#: ../../library/subprocess.rst:1645 msgid "Module which provides function to parse and escape command lines." msgstr "" -#: ../../library/subprocess.rst:1634 +#: ../../library/subprocess.rst:1652 msgid "Disabling use of ``vfork()`` or ``posix_spawn()``" msgstr "停用 ``vfork()`` 或 ``posix_spawn()``" -#: ../../library/subprocess.rst:1636 +#: ../../library/subprocess.rst:1654 msgid "" "On Linux, :mod:`subprocess` defaults to using the ``vfork()`` system call " "internally when it is safe to do so rather than ``fork()``. This greatly " @@ -2145,7 +2172,7 @@ msgstr "" "在 Linux 上,:mod:`subprocess` 在安全的情況下預設會在內部使用 ``vfork()`` 系" "統呼叫,而不是 ``fork()``,這顯著地提高了性能。" -#: ../../library/subprocess.rst:1640 +#: ../../library/subprocess.rst:1658 msgid "" "If you ever encounter a presumed highly unusual situation where you need to " "prevent ``vfork()`` from being used by Python, you can set the :const:" @@ -2154,11 +2181,11 @@ msgstr "" "如果你遇到了一個推定為極異常的情況,需要防止 Python 使用 ``vfork()``,你可以" "將 :const:`subprocess._USE_VFORK` 屬性設為 false 值。" -#: ../../library/subprocess.rst:1646 +#: ../../library/subprocess.rst:1664 msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." msgstr "subprocess._USE_VFORK = False # 見 CPython 問題 gh-NNNNNN." -#: ../../library/subprocess.rst:1648 +#: ../../library/subprocess.rst:1666 msgid "" "Setting this has no impact on use of ``posix_spawn()`` which could use " "``vfork()`` internally within its libc implementation. There is a similar :" @@ -2169,11 +2196,11 @@ msgstr "" "``vfork()``。如果你需要封鎖該屬性的使用,則有一個類似的 :const:`subprocess." "_USE_POSIX_SPAWN` 屬性。" -#: ../../library/subprocess.rst:1655 +#: ../../library/subprocess.rst:1673 msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." msgstr "subprocess._USE_POSIX_SPAWN = False # 見 CPython 問題 gh-NNNNNN." -#: ../../library/subprocess.rst:1657 +#: ../../library/subprocess.rst:1675 msgid "" "It is safe to set these to false on any Python version. They will have no " "effect on older versions when unsupported. Do not assume the attributes are " @@ -2184,7 +2211,7 @@ msgstr "" "沒有影響。不要假設屬性可供讀取。儘管有它們的名稱,真實值並不表示將使用相應的" "函式,而只是表示可能會使用。" -#: ../../library/subprocess.rst:1662 +#: ../../library/subprocess.rst:1680 msgid "" "Please file issues any time you have to use these private knobs with a way " "to reproduce the issue you were seeing. Link to that issue from a comment in " @@ -2193,11 +2220,11 @@ msgstr "" "每當你需要使用這些私有開關以重現你所看到的問題時,請隨時提出問題 (file " "issues)。從程式碼中的註解連結到該問題。" -#: ../../library/subprocess.rst:1666 +#: ../../library/subprocess.rst:1684 msgid "``_USE_POSIX_SPAWN``" msgstr "``_USE_POSIX_SPAWN``" -#: ../../library/subprocess.rst:1667 +#: ../../library/subprocess.rst:1685 msgid "``_USE_VFORK``" msgstr "``_USE_VFORK``" diff --git a/library/superseded.po b/library/superseded.po index 179f3bcb8a..c9dd877050 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2022-02-15 20:45+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,11 +24,29 @@ msgid "Superseded Modules" msgstr "已被取代的模組" #: ../../library/superseded.rst:7 -#, fuzzy msgid "" -"The modules described in this chapter are deprecated or :term:`soft " -"deprecated` and only kept for backwards compatibility. They have been " -"superseded by other modules." +"The modules described in this chapter have been superseded by other modules " +"for most use cases, and are retained primarily to preserve backwards " +"compatibility." +msgstr "" +"此章節所描述的模組在大多數使用情況下已被其他模組取代,僅為了向後相容性而被保" +"留下來。" + +#: ../../library/superseded.rst:10 +msgid "" +"Modules may appear in this chapter because they only cover a limited subset " +"of a problem space, and a more generally applicable solution is available " +"elsewhere in the standard library (for example, :mod:`getopt` covers the " +"very specific task of \"mimic the C :c:func:`!getopt` API in Python\", " +"rather than the broader command line option parsing and argument parsing " +"capabilities offered by :mod:`optparse` and :mod:`argparse`)." +msgstr "" + +#: ../../library/superseded.rst:17 +msgid "" +"Alternatively, modules may appear in this chapter because they are " +"deprecated outright, and awaiting removal in a future release, or they are :" +"term:`soft deprecated` and their use is actively discouraged in new " +"projects. With the removal of various obsolete modules through :pep:`594`, " +"there are currently no modules in this latter category." msgstr "" -"此章節所描述的模組 (modules) 均已被棄用,僅為了向後相容性而被保留下來。它們已" -"經被其他模組所取代。" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index e09420449f..ff8a42a082 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Matt Wang , 2024 @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2024-10-21 17:51+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,8 +27,8 @@ msgid "" "``import sys`` and then use ``sys.monitoring``." msgstr "" ":mod:`sys.monitoring` 是 :mod:`sys` 模組內的一個命名空間,不是一個獨立的模" -"組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 ``sys." -"monitoring``。" +"組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 " +"``sys.monitoring``。" #: ../../library/sys.monitoring.rst:19 msgid "" @@ -221,8 +221,8 @@ msgstr "" #: ../../library/sys.monitoring.rst:142 msgid "" -"An exception is raised, except those that cause a :monitoring-event:" -"`STOP_ITERATION` event." +"An exception is raised, except those that cause a :monitoring-" +"event:`STOP_ITERATION` event." msgstr "" "例外被引發,除了那些會導致 :monitoring-event:`STOP_ITERATION` 的事件外。" @@ -248,12 +248,12 @@ msgstr "將來可能會新增更多事件。" msgid "" "These events are attributes of the :mod:`!sys.monitoring.events` namespace. " "Each event is represented as a power-of-2 integer constant. To define a set " -"of events, simply bitwise or the individual events together. For example, to " +"of events, simply bitwise OR the individual events together. For example, to " "specify both :monitoring-event:`PY_RETURN` and :monitoring-event:`PY_START` " "events, use the expression ``PY_RETURN | PY_START``." msgstr "" "這些事件是 :mod:`!sys.monitoring.events` 命名空間的屬性。每個事件以 2 次方的" -"整數常數表示。要定義一組事件,只要將個別事件以 bitwise or 相接即可。例如,若" +"整數常數表示。要定義一組事件,只要將個別事件以 bitwise OR 相接即可。例如,若" "要指定 :monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_START` 兩個事" "件,請使用運算式 ``PY_RETURN | PY_START``。" @@ -273,11 +273,11 @@ msgstr "" msgid "Events are divided into three groups:" msgstr "事件被分為三組:" -#: ../../library/sys.monitoring.rst:171 +#: ../../library/sys.monitoring.rst:173 msgid "Local events" msgstr "區域事件" -#: ../../library/sys.monitoring.rst:173 +#: ../../library/sys.monitoring.rst:175 msgid "" "Local events are associated with normal execution of the program and happen " "at clearly defined locations. All local events can be disabled. The local " @@ -286,114 +286,114 @@ msgstr "" "區域事件與程式的正常執行相關,並發生在明確定義的位置。所有區域事件都可以被停" "用。區域事件有:" -#: ../../library/sys.monitoring.rst:177 +#: ../../library/sys.monitoring.rst:179 msgid ":monitoring-event:`PY_START`" msgstr ":monitoring-event:`PY_START`" -#: ../../library/sys.monitoring.rst:178 +#: ../../library/sys.monitoring.rst:180 msgid ":monitoring-event:`PY_RESUME`" msgstr ":monitoring-event:`PY_RESUME`" -#: ../../library/sys.monitoring.rst:179 +#: ../../library/sys.monitoring.rst:181 msgid ":monitoring-event:`PY_RETURN`" msgstr ":monitoring-event:`PY_RETURN`" -#: ../../library/sys.monitoring.rst:180 +#: ../../library/sys.monitoring.rst:182 msgid ":monitoring-event:`PY_YIELD`" msgstr ":monitoring-event:`PY_YIELD`" -#: ../../library/sys.monitoring.rst:181 +#: ../../library/sys.monitoring.rst:183 msgid ":monitoring-event:`CALL`" msgstr ":monitoring-event:`CALL`" -#: ../../library/sys.monitoring.rst:182 +#: ../../library/sys.monitoring.rst:184 msgid ":monitoring-event:`LINE`" msgstr ":monitoring-event:`LINE`" -#: ../../library/sys.monitoring.rst:183 +#: ../../library/sys.monitoring.rst:185 msgid ":monitoring-event:`INSTRUCTION`" msgstr ":monitoring-event:`INSTRUCTION`" -#: ../../library/sys.monitoring.rst:184 +#: ../../library/sys.monitoring.rst:186 msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" -#: ../../library/sys.monitoring.rst:185 +#: ../../library/sys.monitoring.rst:187 msgid ":monitoring-event:`BRANCH`" msgstr ":monitoring-event:`BRANCH`" -#: ../../library/sys.monitoring.rst:186 +#: ../../library/sys.monitoring.rst:188 msgid ":monitoring-event:`STOP_ITERATION`" msgstr ":monitoring-event:`STOP_ITERATION`" -#: ../../library/sys.monitoring.rst:189 +#: ../../library/sys.monitoring.rst:191 msgid "Ancillary events" msgstr "附屬事件 (ancillary events)" -#: ../../library/sys.monitoring.rst:191 +#: ../../library/sys.monitoring.rst:193 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" msgstr "附屬事件可以像其他事件一樣被監控,但由另一個事件所控制:" -#: ../../library/sys.monitoring.rst:194 +#: ../../library/sys.monitoring.rst:196 msgid ":monitoring-event:`C_RAISE`" msgstr ":monitoring-event:`C_RAISE`" -#: ../../library/sys.monitoring.rst:195 +#: ../../library/sys.monitoring.rst:197 msgid ":monitoring-event:`C_RETURN`" msgstr ":monitoring-event:`C_RETURN`" -#: ../../library/sys.monitoring.rst:197 +#: ../../library/sys.monitoring.rst:199 msgid "" "The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are " -"controlled by the :monitoring-event:`CALL` event. :monitoring-event:" -"`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if the " -"corresponding :monitoring-event:`CALL` event is being monitored." +"controlled by the :monitoring-event:`CALL` event. :monitoring-" +"event:`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if " +"the corresponding :monitoring-event:`CALL` event is being monitored." msgstr "" -":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件由 :" -"monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` 事件" -"受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-event:" -"`C_RAISE` 事件。" +":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件" +"由 :monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` " +"事件受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-" +"event:`C_RAISE` 事件。" -#: ../../library/sys.monitoring.rst:203 +#: ../../library/sys.monitoring.rst:205 msgid "Other events" msgstr "其他事件" -#: ../../library/sys.monitoring.rst:205 +#: ../../library/sys.monitoring.rst:207 msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." msgstr "其他事件不一定與程式中的特定位置相關聯,也不能單獨停用。" -#: ../../library/sys.monitoring.rst:208 +#: ../../library/sys.monitoring.rst:210 msgid "The other events that can be monitored are:" msgstr "其他可以監控的事件有:" -#: ../../library/sys.monitoring.rst:210 +#: ../../library/sys.monitoring.rst:212 msgid ":monitoring-event:`PY_THROW`" msgstr ":monitoring-event:`PY_THROW`" -#: ../../library/sys.monitoring.rst:211 +#: ../../library/sys.monitoring.rst:213 msgid ":monitoring-event:`PY_UNWIND`" msgstr ":monitoring-event:`PY_UNWIND`" -#: ../../library/sys.monitoring.rst:212 +#: ../../library/sys.monitoring.rst:214 msgid ":monitoring-event:`RAISE`" msgstr ":monitoring-event:`RAISE`" -#: ../../library/sys.monitoring.rst:213 +#: ../../library/sys.monitoring.rst:215 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr ":monitoring-event:`EXCEPTION_HANDLED`" -#: ../../library/sys.monitoring.rst:217 +#: ../../library/sys.monitoring.rst:219 msgid "The STOP_ITERATION event" msgstr "STOP_ITERATION 事件" -#: ../../library/sys.monitoring.rst:219 +#: ../../library/sys.monitoring.rst:221 msgid "" -":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :" -"exc:`StopIteration` exception is raised when returning a value from a " +":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that " +"a :exc:`StopIteration` exception is raised when returning a value from a " "generator or coroutine. However, this is a very inefficient way to return a " "value, so some Python implementations, notably CPython 3.12+, do not raise " "an exception unless it would be visible to other code." @@ -403,7 +403,7 @@ msgstr "" "式,因此有一些 Python 實作(特別是 CPython 3.12+)不會引發例外,除非它對其他" "程式碼是可見的。" -#: ../../library/sys.monitoring.rst:225 +#: ../../library/sys.monitoring.rst:227 msgid "" "To allow tools to monitor for real exceptions without slowing down " "generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is " @@ -414,11 +414,11 @@ msgstr "" "event:`STOP_ITERATION` 事件。與 :monitoring-event:`RAISE` 不同,:monitoring-" "event:`STOP_ITERATION` 可以區域停用。" -#: ../../library/sys.monitoring.rst:231 +#: ../../library/sys.monitoring.rst:233 msgid "Turning events on and off" msgstr "開啟和關閉事件" -#: ../../library/sys.monitoring.rst:233 +#: ../../library/sys.monitoring.rst:235 msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " @@ -427,52 +427,52 @@ msgstr "" "為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域或只為" "特定程式碼物件來開啟或關閉事件。" -#: ../../library/sys.monitoring.rst:240 +#: ../../library/sys.monitoring.rst:242 msgid "Setting events globally" msgstr "全域設定事件" -#: ../../library/sys.monitoring.rst:242 +#: ../../library/sys.monitoring.rst:244 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." msgstr "可以透過修改正在監控的事件集合來全域地控制事件。" -#: ../../library/sys.monitoring.rst:246 +#: ../../library/sys.monitoring.rst:248 msgid "Returns the ``int`` representing all the active events." msgstr "回傳代表所有有效事件的 ``int``。" -#: ../../library/sys.monitoring.rst:250 +#: ../../library/sys.monitoring.rst:252 msgid "" -"Activates all events which are set in *event_set*. Raises a :exc:" -"`ValueError` if *tool_id* is not in use." +"Activates all events which are set in *event_set*. Raises " +"a :exc:`ValueError` if *tool_id* is not in use." msgstr "" -"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引發 :" -"exc:`ValueError`。" +"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引" +"發 :exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:253 +#: ../../library/sys.monitoring.rst:255 msgid "No events are active by default." msgstr "預設沒有有效事件。" -#: ../../library/sys.monitoring.rst:256 +#: ../../library/sys.monitoring.rst:258 msgid "Per code object events" msgstr "各別程式碼物件事件" -#: ../../library/sys.monitoring.rst:258 +#: ../../library/sys.monitoring.rst:260 msgid "" "Events can also be controlled on a per code object basis. The functions " "defined below which accept a :class:`types.CodeType` should be prepared to " "accept a look-alike object from functions which are not defined in Python " "(see :ref:`c-api-monitoring`)." msgstr "" -"事件還可以基於各別程式碼物件進行控制。下面定義的、接受 :class:`types." -"CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似物件(請參閱 :" -"ref:`c-api-monitoring`)。" +"事件還可以基於各別程式碼物件進行控制。下面定義的、接" +"受 :class:`types.CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似" +"物件(請參閱 :ref:`c-api-monitoring`)。" -#: ../../library/sys.monitoring.rst:265 +#: ../../library/sys.monitoring.rst:267 msgid "Returns all the local events for *code*" msgstr "回傳 *code* 的所有區域事件" -#: ../../library/sys.monitoring.rst:269 +#: ../../library/sys.monitoring.rst:271 msgid "" "Activates all the local events for *code* which are set in *event_set*. " "Raises a :exc:`ValueError` if *tool_id* is not in use." @@ -480,7 +480,7 @@ msgstr "" "啟動 *event_set* 中針對 *code* 設定的所有區域事件。如果 *tool_id* 並未正在被" "使用,則引發 :exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:272 +#: ../../library/sys.monitoring.rst:274 msgid "" "Local events add to global events, but do not mask them. In other words, all " "global events will trigger for a code object, regardless of the local events." @@ -488,26 +488,27 @@ msgstr "" "區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所有" "全域事件都將為程式碼物件觸發。" -#: ../../library/sys.monitoring.rst:278 +#: ../../library/sys.monitoring.rst:280 msgid "Disabling events" msgstr "停用事件" -#: ../../library/sys.monitoring.rst:282 +#: ../../library/sys.monitoring.rst:284 msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." -msgstr "可以從回呼函式回傳的特殊值,以停用當前程式碼位置的事件。" +msgstr "可以從回呼函式回傳的特殊值,以停用目前程式碼位置的事件。" -#: ../../library/sys.monitoring.rst:285 +#: ../../library/sys.monitoring.rst:287 msgid "" -"Local events can be disabled for a specific code location by returning :data:" -"`sys.monitoring.DISABLE` from a callback function. This does not change " -"which events are set, or any other code locations for the same event." +"Local events can be disabled for a specific code location by " +"returning :data:`sys.monitoring.DISABLE` from a callback function. This does " +"not change which events are set, or any other code locations for the same " +"event." msgstr "" "可透過回呼函式回傳 :data:`sys.monitoring.DISABLE` 來停用特定程式碼位置的區域" "事件。這不會改變被設定的事件,或相同事件的任何其他程式碼位置。" -#: ../../library/sys.monitoring.rst:289 +#: ../../library/sys.monitoring.rst:291 msgid "" "Disabling events for specific locations is very important for high " "performance monitoring. For example, a program can be run under a debugger " @@ -517,25 +518,25 @@ msgstr "" "停用特定位置的事件對於高效能監控非常重要。舉例來說,如果除少數斷點外,偵錯器" "可以停用所有監控,那麼在偵錯器下執行程式就不會有任何開銷 (overhead)。" -#: ../../library/sys.monitoring.rst:296 +#: ../../library/sys.monitoring.rst:298 msgid "" "Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` " "for all tools." msgstr "為所有工具啟用由 :data:`sys.monitoring.DISABLE` 停用的所有事件。" -#: ../../library/sys.monitoring.rst:303 +#: ../../library/sys.monitoring.rst:305 msgid "Registering callback functions" msgstr "註冊回呼函式" -#: ../../library/sys.monitoring.rst:305 +#: ../../library/sys.monitoring.rst:307 msgid "To register a callable for events call" msgstr "用來註冊對事件呼叫的可呼叫物件" -#: ../../library/sys.monitoring.rst:309 +#: ../../library/sys.monitoring.rst:311 msgid "Registers the callable *func* for the *event* with the given *tool_id*" msgstr "使用給定的 *tool_id* 來註冊對 *event* 的可呼叫物件 *func*" -#: ../../library/sys.monitoring.rst:311 +#: ../../library/sys.monitoring.rst:313 msgid "" "If another callback was registered for the given *tool_id* and *event*, it " "is unregistered and returned. Otherwise :func:`register_callback` returns " @@ -544,35 +545,35 @@ msgstr "" "如果給定的 *tool_id* 和 *event* 已經註冊了另一個回呼,則會取消註冊並回傳。否" "則 :func:`register_callback` 會回傳 ``None``。" -#: ../../library/sys.monitoring.rst:316 +#: ../../library/sys.monitoring.rst:318 msgid "" -"Functions can be unregistered by calling ``sys.monitoring." -"register_callback(tool_id, event, None)``." +"Functions can be unregistered by calling " +"``sys.monitoring.register_callback(tool_id, event, None)``." msgstr "" "可以透過呼叫 ``sys.monitoring.register_callback(tool_id, event, None)`` 來取" "消註冊函式。" -#: ../../library/sys.monitoring.rst:319 +#: ../../library/sys.monitoring.rst:321 msgid "Callback functions can be registered and unregistered at any time." msgstr "回呼函式可以隨時被註冊和取消註冊。" -#: ../../library/sys.monitoring.rst:321 +#: ../../library/sys.monitoring.rst:323 msgid "" -"Registering or unregistering a callback function will generate a :func:`sys." -"audit` event." +"Registering or unregistering a callback function will generate " +"a :func:`sys.audit` event." msgstr "註冊或取消註冊回呼函式將產生 :func:`sys.audit` 事件。" -#: ../../library/sys.monitoring.rst:325 +#: ../../library/sys.monitoring.rst:327 msgid "Callback function arguments" msgstr "回呼函式引數" -#: ../../library/sys.monitoring.rst:329 +#: ../../library/sys.monitoring.rst:331 msgid "" "A special value that is passed to a callback function to indicate that there " "are no arguments to the call." msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。" -#: ../../library/sys.monitoring.rst:332 +#: ../../library/sys.monitoring.rst:334 msgid "" "When an active event occurs, the registered callback function is called. " "Different events will provide the callback function with different " @@ -581,19 +582,19 @@ msgstr "" "當有效事件發生時,已註冊的回呼函式會被呼叫。不同的事件會為回呼函式提供不同的" "引數,如下所示:" -#: ../../library/sys.monitoring.rst:335 +#: ../../library/sys.monitoring.rst:337 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" msgstr ":monitoring-event:`PY_START` 和 :monitoring-event:`PY_RESUME`: ::" -#: ../../library/sys.monitoring.rst:337 ../../library/sys.monitoring.rst:368 +#: ../../library/sys.monitoring.rst:339 ../../library/sys.monitoring.rst:370 msgid "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" msgstr "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:339 +#: ../../library/sys.monitoring.rst:341 msgid ":monitoring-event:`PY_RETURN` and :monitoring-event:`PY_YIELD`::" msgstr ":monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_YIELD`: ::" -#: ../../library/sys.monitoring.rst:341 +#: ../../library/sys.monitoring.rst:343 msgid "" "func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " "Any" @@ -601,15 +602,15 @@ msgstr "" "func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " "Any" -#: ../../library/sys.monitoring.rst:343 +#: ../../library/sys.monitoring.rst:345 msgid "" -":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-event:" -"`C_RETURN`::" +":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-" +"event:`C_RETURN`::" msgstr "" -":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-event:" -"`C_RETURN`: ::" +":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-" +"event:`C_RETURN`: ::" -#: ../../library/sys.monitoring.rst:345 +#: ../../library/sys.monitoring.rst:347 msgid "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: object " "| MISSING) -> DISABLE | Any" @@ -617,22 +618,22 @@ msgstr "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: object " "| MISSING) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:347 +#: ../../library/sys.monitoring.rst:349 msgid "" "If there are no arguments, *arg0* is set to :data:`sys.monitoring.MISSING`." msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" -#: ../../library/sys.monitoring.rst:349 +#: ../../library/sys.monitoring.rst:351 msgid "" -":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-event:" -"`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-event:" -"`PY_THROW` and :monitoring-event:`STOP_ITERATION`::" +":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-" +"event:`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-" +"event:`PY_THROW` and :monitoring-event:`STOP_ITERATION`::" msgstr "" -":monitoring-event:`RAISE`、:monitoring-event:`RERAISE`、:monitoring-event:" -"`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-event:" -"`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" +":monitoring-event:`RAISE`、:monitoring-event:`RERAISE`、:monitoring-" +"event:`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-" +"event:`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" -#: ../../library/sys.monitoring.rst:352 +#: ../../library/sys.monitoring.rst:354 msgid "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "DISABLE | Any" @@ -640,19 +641,19 @@ msgstr "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:354 +#: ../../library/sys.monitoring.rst:356 msgid ":monitoring-event:`LINE`::" msgstr ":monitoring-event:`LINE`: ::" -#: ../../library/sys.monitoring.rst:356 +#: ../../library/sys.monitoring.rst:358 msgid "func(code: CodeType, line_number: int) -> DISABLE | Any" msgstr "func(code: CodeType, line_number: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:358 +#: ../../library/sys.monitoring.rst:360 msgid ":monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::" msgstr ":monitoring-event:`BRANCH` 和 :monitoring-event:`JUMP`: ::" -#: ../../library/sys.monitoring.rst:360 +#: ../../library/sys.monitoring.rst:362 msgid "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "DISABLE | Any" @@ -660,7 +661,7 @@ msgstr "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:362 +#: ../../library/sys.monitoring.rst:364 msgid "" "Note that the *destination_offset* is where the code will next execute. For " "an untaken branch this will be the offset of the instruction following the " @@ -669,6 +670,6 @@ msgstr "" "請注意,*destination_offset* 是程式碼接下來要執行的地方。對於未採用的分支,這" "將是該分支之後的指令的偏移量。" -#: ../../library/sys.monitoring.rst:366 +#: ../../library/sys.monitoring.rst:368 msgid ":monitoring-event:`INSTRUCTION`::" msgstr ":monitoring-event:`INSTRUCTION`: ::" diff --git a/library/sys.po b/library/sys.po index 0cafa0cde7..b4321d66db 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-13 00:13+0000\n" +"POT-Creation-Date: 2025-03-27 00:14+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,8 @@ msgstr ":mod:`!sys` --- 系統特定的參數與函式" msgid "" "This module provides access to some variables used or maintained by the " "interpreter and to functions that interact strongly with the interpreter. It " -"is always available." +"is always available. Unless explicitly noted otherwise, all variables are " +"read-only." msgstr "" #: ../../library/sys.rst:16 @@ -44,10 +45,10 @@ msgstr "" #: ../../library/sys.rst:25 ../../library/sys.rst:299 ../../library/sys.rst:369 #: ../../library/sys.rst:760 ../../library/sys.rst:778 -#: ../../library/sys.rst:1020 ../../library/sys.rst:1519 -#: ../../library/sys.rst:1760 ../../library/sys.rst:1775 -#: ../../library/sys.rst:1783 ../../library/sys.rst:1799 -#: ../../library/sys.rst:2043 +#: ../../library/sys.rst:1020 ../../library/sys.rst:1522 +#: ../../library/sys.rst:1763 ../../library/sys.rst:1778 +#: ../../library/sys.rst:1786 ../../library/sys.rst:1802 +#: ../../library/sys.rst:2046 msgid "Availability" msgstr "" @@ -995,8 +996,8 @@ msgstr "" #: ../../library/sys.rst:767 msgid "" -"Return the name of the current default string encoding used by the Unicode " -"implementation." +"Return ``'utf-8'``. This is the name of the default string encoding, used in " +"methods like :meth:`str.encode`." msgstr "" #: ../../library/sys.rst:773 @@ -1133,7 +1134,7 @@ msgstr "" #: ../../library/sys.rst:886 msgid "" -"Return the interpreter's \"thread switch interval\"; see :func:" +"Return the interpreter's \"thread switch interval\" in seconds; see :func:" "`setswitchinterval`." msgstr "" @@ -1324,7 +1325,7 @@ msgstr "" msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1043 ../../library/sys.rst:1731 +#: ../../library/sys.rst:1043 ../../library/sys.rst:1734 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" @@ -1336,7 +1337,7 @@ msgid "" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1055 ../../library/sys.rst:1752 +#: ../../library/sys.rst:1055 ../../library/sys.rst:1755 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." @@ -1546,17 +1547,21 @@ msgid "" "is disabled." msgstr "" -#: ../../library/sys.rst:1241 +#: ../../library/sys.rst:1240 ../../library/sys.rst:1272 +msgid "It is not guaranteed to exist in all implementations of Python." +msgstr "" + +#: ../../library/sys.rst:1244 msgid "" "Return :const:`True` if the main Python interpreter is :term:`shutting down " "`. Return :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1244 +#: ../../library/sys.rst:1247 msgid "See also the :exc:`PythonFinalizationError` exception." msgstr "" -#: ../../library/sys.rst:1250 +#: ../../library/sys.rst:1253 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1567,44 +1572,40 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1262 +#: ../../library/sys.rst:1265 msgid "" "Return :const:`True` if the given string is \"interned\", :const:`False` " "otherwise." msgstr "" -#: ../../library/sys.rst:1269 -msgid "It is not guaranteed to exist in all implementations of Python." -msgstr "" - -#: ../../library/sys.rst:1276 +#: ../../library/sys.rst:1279 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" -#: ../../library/sys.rst:1282 +#: ../../library/sys.rst:1285 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1289 +#: ../../library/sys.rst:1292 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1292 +#: ../../library/sys.rst:1295 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1300 +#: ../../library/sys.rst:1303 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1617,40 +1618,40 @@ msgid "" "``None`` if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1313 +#: ../../library/sys.rst:1316 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1314 +#: ../../library/sys.rst:1317 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1316 +#: ../../library/sys.rst:1319 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1317 +#: ../../library/sys.rst:1320 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1323 +#: ../../library/sys.rst:1326 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: ../../library/sys.rst:1328 +#: ../../library/sys.rst:1331 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: ../../library/sys.rst:1334 +#: ../../library/sys.rst:1337 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1662,13 +1663,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1346 +#: ../../library/sys.rst:1349 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1349 +#: ../../library/sys.rst:1352 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1676,68 +1677,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1361 +#: ../../library/sys.rst:1364 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1365 +#: ../../library/sys.rst:1368 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1369 +#: ../../library/sys.rst:1372 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1374 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1373 +#: ../../library/sys.rst:1376 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1376 +#: ../../library/sys.rst:1379 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1379 +#: ../../library/sys.rst:1382 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1385 +#: ../../library/sys.rst:1388 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1393 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1394 ../../library/sys.rst:1405 +#: ../../library/sys.rst:1397 ../../library/sys.rst:1408 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1399 +#: ../../library/sys.rst:1402 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1745,91 +1746,91 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1410 +#: ../../library/sys.rst:1413 msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1413 +#: ../../library/sys.rst:1416 msgid "System" msgstr "" -#: ../../library/sys.rst:1413 +#: ../../library/sys.rst:1416 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1415 +#: ../../library/sys.rst:1418 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1415 +#: ../../library/sys.rst:1418 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1419 msgid "Android" msgstr "Android" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1419 msgid "``'android'``" msgstr "``'android'``" -#: ../../library/sys.rst:1417 +#: ../../library/sys.rst:1420 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1417 +#: ../../library/sys.rst:1420 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1421 msgid "iOS" msgstr "iOS" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1421 msgid "``'ios'``" msgstr "``'ios'``" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1422 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1422 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1423 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1423 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1424 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1424 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1425 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1425 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1426 msgid "WASI" msgstr "WASI" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1426 msgid "``'wasi'``" msgstr "``'wasi'``" -#: ../../library/sys.rst:1426 +#: ../../library/sys.rst:1429 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " @@ -1838,81 +1839,81 @@ msgid "" "version, it is therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1432 +#: ../../library/sys.rst:1435 msgid "" "if sys.platform.startswith('freebsd'):\n" " # FreeBSD-specific code here..." msgstr "" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1438 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1439 +#: ../../library/sys.rst:1442 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1443 +#: ../../library/sys.rst:1446 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" -#: ../../library/sys.rst:1449 +#: ../../library/sys.rst:1452 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1452 +#: ../../library/sys.rst:1455 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1458 +#: ../../library/sys.rst:1461 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1461 +#: ../../library/sys.rst:1464 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1468 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1467 +#: ../../library/sys.rst:1470 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1470 +#: ../../library/sys.rst:1473 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1472 +#: ../../library/sys.rst:1475 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1480 +#: ../../library/sys.rst:1483 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1921,14 +1922,14 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1486 +#: ../../library/sys.rst:1489 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1501 +#: ../../library/sys.rst:1504 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1938,7 +1939,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1511 +#: ../../library/sys.rst:1514 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1949,14 +1950,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1523 +#: ../../library/sys.rst:1526 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1535 +#: ../../library/sys.rst:1538 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1971,14 +1972,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1547 +#: ../../library/sys.rst:1550 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1551 +#: ../../library/sys.rst:1554 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1986,71 +1987,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1556 ../../library/sys.rst:1643 +#: ../../library/sys.rst:1559 ../../library/sys.rst:1646 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1558 ../../library/sys.rst:1645 +#: ../../library/sys.rst:1561 ../../library/sys.rst:1648 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1559 +#: ../../library/sys.rst:1562 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1562 ../../library/sys.rst:1660 +#: ../../library/sys.rst:1565 ../../library/sys.rst:1663 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1566 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1567 +#: ../../library/sys.rst:1570 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1568 +#: ../../library/sys.rst:1571 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1571 +#: ../../library/sys.rst:1574 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1572 +#: ../../library/sys.rst:1575 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1574 +#: ../../library/sys.rst:1577 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1575 +#: ../../library/sys.rst:1578 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1577 +#: ../../library/sys.rst:1580 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1582 +#: ../../library/sys.rst:1585 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1586 +#: ../../library/sys.rst:1589 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -2058,19 +2059,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1591 +#: ../../library/sys.rst:1594 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1594 +#: ../../library/sys.rst:1597 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1601 +#: ../../library/sys.rst:1604 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2081,7 +2082,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1618 +#: ../../library/sys.rst:1621 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2090,7 +2091,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1623 +#: ../../library/sys.rst:1626 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2098,7 +2099,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1628 +#: ../../library/sys.rst:1631 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2106,36 +2107,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1633 +#: ../../library/sys.rst:1636 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1636 +#: ../../library/sys.rst:1639 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1640 +#: ../../library/sys.rst:1643 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1649 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1650 +#: ../../library/sys.rst:1653 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1651 +#: ../../library/sys.rst:1654 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2145,7 +2146,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1661 +#: ../../library/sys.rst:1664 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2153,22 +2154,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1666 +#: ../../library/sys.rst:1669 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1670 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1671 +#: ../../library/sys.rst:1674 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1672 +#: ../../library/sys.rst:1675 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2178,13 +2179,13 @@ msgid "" "objects>`." msgstr "" -#: ../../library/sys.rst:1679 +#: ../../library/sys.rst:1682 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1682 +#: ../../library/sys.rst:1685 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2198,17 +2199,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1693 +#: ../../library/sys.rst:1696 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1695 +#: ../../library/sys.rst:1698 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1699 +#: ../../library/sys.rst:1702 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2216,13 +2217,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1706 +#: ../../library/sys.rst:1709 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1711 +#: ../../library/sys.rst:1714 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2231,7 +2232,7 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1717 +#: ../../library/sys.rst:1720 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." @@ -2239,7 +2240,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1719 +#: ../../library/sys.rst:1722 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." @@ -2247,20 +2248,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1721 +#: ../../library/sys.rst:1724 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1724 +#: ../../library/sys.rst:1727 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1736 +#: ../../library/sys.rst:1739 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2269,111 +2270,111 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1743 +#: ../../library/sys.rst:1746 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1747 +#: ../../library/sys.rst:1750 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1757 +#: ../../library/sys.rst:1760 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1766 +#: ../../library/sys.rst:1769 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1767 +#: ../../library/sys.rst:1770 msgid "https://perf.wiki.kernel.org" msgstr "https://perf.wiki.kernel.org" -#: ../../library/sys.rst:1771 +#: ../../library/sys.rst:1774 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1773 +#: ../../library/sys.rst:1776 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1781 +#: ../../library/sys.rst:1784 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1789 +#: ../../library/sys.rst:1792 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1793 +#: ../../library/sys.rst:1796 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1796 +#: ../../library/sys.rst:1799 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1802 +#: ../../library/sys.rst:1805 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1806 +#: ../../library/sys.rst:1809 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1809 +#: ../../library/sys.rst:1812 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1816 +#: ../../library/sys.rst:1819 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1819 +#: ../../library/sys.rst:1822 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1821 +#: ../../library/sys.rst:1824 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1823 +#: ../../library/sys.rst:1826 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1825 +#: ../../library/sys.rst:1828 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1829 +#: ../../library/sys.rst:1832 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1832 +#: ../../library/sys.rst:1835 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2384,14 +2385,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1841 +#: ../../library/sys.rst:1844 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1846 +#: ../../library/sys.rst:1849 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2400,7 +2401,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1853 +#: ../../library/sys.rst:1856 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2409,19 +2410,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1859 +#: ../../library/sys.rst:1862 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1865 +#: ../../library/sys.rst:1868 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1869 +#: ../../library/sys.rst:1872 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2429,7 +2430,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1879 +#: ../../library/sys.rst:1882 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2437,7 +2438,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1884 +#: ../../library/sys.rst:1887 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2445,7 +2446,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1890 +#: ../../library/sys.rst:1893 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2453,12 +2454,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1898 +#: ../../library/sys.rst:1901 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1900 +#: ../../library/sys.rst:1903 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2466,7 +2467,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:1908 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2474,60 +2475,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1910 +#: ../../library/sys.rst:1913 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1917 +#: ../../library/sys.rst:1920 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1922 +#: ../../library/sys.rst:1925 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1924 +#: ../../library/sys.rst:1927 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1925 +#: ../../library/sys.rst:1928 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1926 +#: ../../library/sys.rst:1929 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1928 +#: ../../library/sys.rst:1931 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1932 +#: ../../library/sys.rst:1935 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1934 +#: ../../library/sys.rst:1937 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1935 +#: ../../library/sys.rst:1938 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1936 +#: ../../library/sys.rst:1939 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1940 +#: ../../library/sys.rst:1943 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1948 +#: ../../library/sys.rst:1951 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2536,73 +2537,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1956 +#: ../../library/sys.rst:1959 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1958 +#: ../../library/sys.rst:1961 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1962 +#: ../../library/sys.rst:1965 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1964 +#: ../../library/sys.rst:1967 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1965 +#: ../../library/sys.rst:1968 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1966 +#: ../../library/sys.rst:1969 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1967 +#: ../../library/sys.rst:1970 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1968 +#: ../../library/sys.rst:1971 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1970 +#: ../../library/sys.rst:1973 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1974 +#: ../../library/sys.rst:1977 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1979 +#: ../../library/sys.rst:1982 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1983 +#: ../../library/sys.rst:1986 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1987 +#: ../../library/sys.rst:1990 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1991 ../../library/sys.rst:1993 +#: ../../library/sys.rst:1994 ../../library/sys.rst:1996 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2610,7 +2611,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:2002 +#: ../../library/sys.rst:2005 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2619,13 +2620,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:2011 +#: ../../library/sys.rst:2014 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:2017 +#: ../../library/sys.rst:2020 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2636,18 +2637,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:2025 +#: ../../library/sys.rst:2028 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:2030 +#: ../../library/sys.rst:2033 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:2037 +#: ../../library/sys.rst:2040 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2656,20 +2657,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2049 +#: ../../library/sys.rst:2052 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:2055 +#: ../../library/sys.rst:2058 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:2059 +#: ../../library/sys.rst:2062 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2689,18 +2690,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2071 +#: ../../library/sys.rst:2074 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2079 +#: ../../library/sys.rst:2082 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2080 +#: ../../library/sys.rst:2083 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2721,50 +2722,50 @@ msgstr "object(物件)" msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:954 ../../library/sys.rst:1531 +#: ../../library/sys.rst:954 ../../library/sys.rst:1534 msgid "profile function" msgstr "" -#: ../../library/sys.rst:954 ../../library/sys.rst:1531 +#: ../../library/sys.rst:954 ../../library/sys.rst:1534 msgid "profiler" msgstr "" -#: ../../library/sys.rst:963 ../../library/sys.rst:1614 +#: ../../library/sys.rst:963 ../../library/sys.rst:1617 msgid "trace function" msgstr "" -#: ../../library/sys.rst:963 ../../library/sys.rst:1614 +#: ../../library/sys.rst:963 ../../library/sys.rst:1617 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "..." msgstr "..." diff --git a/library/sysconfig.po b/library/sysconfig.po index 7a2c3ec0df..f8b98b310e 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-29 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,9 +23,8 @@ msgid "" msgstr ":mod:`!sysconfig` --- 提供 Python 設定資訊的存取" #: ../../library/sysconfig.rst:12 -#, fuzzy msgid "**Source code:** :source:`Lib/sysconfig`" -msgstr "**原始碼:**\\ :source:`Lib/sysconfig.py`" +msgstr "**原始碼:**\\ :source:`Lib/sysconfig`" #: ../../library/sysconfig.rst:19 msgid "" @@ -110,10 +109,10 @@ msgstr "" #: ../../library/sysconfig.rst:70 msgid "" "Python uses an installation scheme that differs depending on the platform " -"and on the installation options. These schemes are stored in :mod:" -"`sysconfig` under unique identifiers based on the value returned by :const:" -"`os.name`. The schemes are used by package installers to determine where to " -"copy files to." +"and on the installation options. These schemes are stored " +"in :mod:`sysconfig` under unique identifiers based on the value returned " +"by :const:`os.name`. The schemes are used by package installers to determine " +"where to copy files to." msgstr "" #: ../../library/sysconfig.rst:75 @@ -135,8 +134,8 @@ msgstr "" #: ../../library/sysconfig.rst:81 msgid "" "*posix_user*: scheme for POSIX platforms, when the *user* option is used. " -"This scheme defines paths located under the user's home directory (:const:" -"`site.USER_BASE`)." +"This scheme defines paths located under the user's home directory " +"(:const:`site.USER_BASE`)." msgstr "" #: ../../library/sysconfig.rst:84 @@ -234,8 +233,8 @@ msgstr "" msgid "" "Files will be installed into subdirectories of :const:`site.USER_BASE` " "(written as :file:`{userbase}` hereafter). This scheme installs pure Python " -"modules and extension modules in the same location (also known as :const:" -"`site.USER_SITE`)." +"modules and extension modules in the same location (also known " +"as :const:`site.USER_SITE`)." msgstr "" #: ../../library/sysconfig.rst:126 @@ -358,8 +357,8 @@ msgid "" "The idea behind the \"home scheme\" is that you build and maintain a " "personal stash of Python modules. This scheme's name is derived from the " "idea of a \"home\" directory on Unix, since it's not unusual for a Unix user " -"to make their home directory have a layout similar to :file:`/usr/` or :file:" -"`/usr/local/`. This scheme can be used by anyone, regardless of the " +"to make their home directory have a layout similar to :file:`/usr/` " +"or :file:`/usr/local/`. This scheme can be used by anyone, regardless of the " "operating system they are installing for." msgstr "" @@ -480,8 +479,8 @@ msgstr "" #: ../../library/sysconfig.rst:265 msgid "" -"Return a tuple containing all schemes currently supported in :mod:" -"`sysconfig`." +"Return a tuple containing all schemes currently supported " +"in :mod:`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:271 @@ -533,14 +532,14 @@ msgstr "" #: ../../library/sysconfig.rst:307 msgid "" -"End users should not use this function, but :func:`get_default_scheme` and :" -"func:`get_preferred_scheme` instead." +"End users should not use this function, but :func:`get_default_scheme` " +"and :func:`get_preferred_scheme` instead." msgstr "" #: ../../library/sysconfig.rst:315 msgid "" -"Return a tuple containing all path names currently supported in :mod:" -"`sysconfig`." +"Return a tuple containing all path names currently supported " +"in :mod:`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:321 @@ -570,9 +569,9 @@ msgstr "" #: ../../library/sysconfig.rst:334 msgid "" -"If *scheme* is provided, it must be a value from the list returned by :func:" -"`get_scheme_names`. Otherwise, the default scheme for the current platform " -"is used." +"If *scheme* is provided, it must be a value from the list returned " +"by :func:`get_scheme_names`. Otherwise, the default scheme for the current " +"platform is used." msgstr "" #: ../../library/sysconfig.rst:338 @@ -615,8 +614,8 @@ msgstr "" #: ../../library/sysconfig.rst:360 msgid "" -"If *scheme* is not an existing scheme, :func:`get_paths` will raise a :exc:" -"`KeyError`." +"If *scheme* is not an existing scheme, :func:`get_paths` will raise " +"a :exc:`KeyError`." msgstr "" #: ../../library/sysconfig.rst:365 @@ -628,8 +627,8 @@ msgid "" "Return the ``MAJOR.MINOR`` Python version number as a string. Similar to " "``'%d.%d' % sys.version_info[:2]``." msgstr "" -"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % sys." -"version_info[:2]``。" +"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % " +"sys.version_info[:2]``。" #: ../../library/sysconfig.rst:375 msgid "Return a string that identifies the current platform." @@ -665,78 +664,82 @@ msgid "Windows will return one of:" msgstr "" #: ../../library/sysconfig.rst:391 -msgid "win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" +msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" msgstr "" #: ../../library/sysconfig.rst:392 +msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" +msgstr "" + +#: ../../library/sysconfig.rst:393 msgid "win32 (all others - specifically, sys.platform is returned)" msgstr "" -#: ../../library/sysconfig.rst:394 +#: ../../library/sysconfig.rst:395 msgid "macOS can return:" msgstr "" -#: ../../library/sysconfig.rst:396 +#: ../../library/sysconfig.rst:397 msgid "macosx-10.6-ppc" msgstr "macosx-10.6-ppc" -#: ../../library/sysconfig.rst:397 +#: ../../library/sysconfig.rst:398 msgid "macosx-10.4-ppc64" msgstr "macosx-10.4-ppc64" -#: ../../library/sysconfig.rst:398 +#: ../../library/sysconfig.rst:399 msgid "macosx-10.3-i386" msgstr "macosx-10.3-i386" -#: ../../library/sysconfig.rst:399 +#: ../../library/sysconfig.rst:400 msgid "macosx-10.4-fat" msgstr "macosx-10.4-fat" -#: ../../library/sysconfig.rst:401 +#: ../../library/sysconfig.rst:402 msgid "" "For other non-POSIX platforms, currently just returns :data:`sys.platform`." msgstr "" -#: ../../library/sysconfig.rst:406 +#: ../../library/sysconfig.rst:407 msgid "" "Return ``True`` if the running Python interpreter was built from source and " "is being run from its built location, and not from a location resulting from " "e.g. running ``make install`` or installing via a binary installer." msgstr "" -#: ../../library/sysconfig.rst:413 +#: ../../library/sysconfig.rst:414 msgid "Parse a :file:`config.h`\\-style file." msgstr "" -#: ../../library/sysconfig.rst:415 +#: ../../library/sysconfig.rst:416 msgid "" "*fp* is a file-like object pointing to the :file:`config.h`\\-like file." msgstr "" -#: ../../library/sysconfig.rst:417 +#: ../../library/sysconfig.rst:418 msgid "" "A dictionary containing name/value pairs is returned. If an optional " "dictionary is passed in as the second argument, it is used instead of a new " "dictionary, and updated with the values read in the file." msgstr "" -#: ../../library/sysconfig.rst:424 +#: ../../library/sysconfig.rst:425 msgid "Return the path of :file:`pyconfig.h`." msgstr "回傳 :file:`pyconfig.h` 的路徑。" -#: ../../library/sysconfig.rst:428 +#: ../../library/sysconfig.rst:429 msgid "Return the path of :file:`Makefile`." msgstr "回傳 :file:`Makefile` 的路徑。" -#: ../../library/sysconfig.rst:433 -msgid "Using :mod:`sysconfig` as a script" -msgstr "將 :mod:`sysconfig` 作為腳本使用" - #: ../../library/sysconfig.rst:435 +msgid "Command-line usage" +msgstr "命令列用法" + +#: ../../library/sysconfig.rst:437 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: ../../library/sysconfig.rst:437 +#: ../../library/sysconfig.rst:439 msgid "" "$ python -m sysconfig\n" "Platform: \"macosx-10.4-i386\"\n" @@ -782,13 +785,16 @@ msgstr "" " ARFLAGS = \"rc\"\n" " ..." -#: ../../library/sysconfig.rst:461 +#: ../../library/sysconfig.rst:463 msgid "" -"This call will print in the standard output the information returned by :" -"func:`get_platform`, :func:`get_python_version`, :func:`get_path` and :func:" -"`get_config_vars`." +"This call will print in the standard output the information returned " +"by :func:`get_platform`, :func:`get_python_version`, :func:`get_path` " +"and :func:`get_config_vars`." msgstr "" #: ../../library/sysconfig.rst:14 msgid "configuration information" msgstr "configuration information(設定資訊)" + +#~ msgid "Using :mod:`sysconfig` as a script" +#~ msgstr "將 :mod:`sysconfig` 作為腳本使用" diff --git a/library/tempfile.po b/library/tempfile.po index 1263ef9a43..e497bab54c 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -31,17 +31,18 @@ msgstr "**原始碼:**\\ :source:`Lib/tempfile.py`" #: ../../library/tempfile.rst:17 msgid "" "This module creates temporary files and directories. It works on all " -"supported platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :" -"class:`TemporaryDirectory`, and :class:`SpooledTemporaryFile` are high-level " -"interfaces which provide automatic cleanup and can be used as :term:`context " -"managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-" -"level functions which require manual cleanup." -msgstr "" -"該 module(模組)用於建立臨時檔案和目錄,它可以在所有有支援的平臺上使用。:" -"class:`TemporaryFile`、:class:`NamedTemporaryFile`、:class:" -"`TemporaryDirectory` 和 :class:`SpooledTemporaryFile` 是有自動清除功能的高階" -"介面,可作為\\ :term:`情境管理器 (context manager) ` 使用。:" -"func:`mkstemp` 和 :func:`mkdtemp` 是低階函式,使用完畢後需手動清理。" +"supported " +"platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :class:`TemporaryDirectory`, " +"and :class:`SpooledTemporaryFile` are high-level interfaces which provide " +"automatic cleanup and can be used as :term:`context managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-level functions " +"which require manual cleanup." +msgstr "" +"該 module(模組)用於建立臨時檔案和目錄,它可以在所有有支援的平臺上使" +"用。:class:`TemporaryFile`、:class:`NamedTemporaryFile`、:class:`TemporaryDirectory` " +"和 :class:`SpooledTemporaryFile` 是有自動清除功能的高階介面,可作為\\ :term:`" +"情境管理器 (context manager) ` 使用。:func:`mkstemp` " +"和 :func:`mkdtemp` 是低階函式,使用完畢後需手動清理。" #: ../../library/tempfile.rst:24 msgid "" @@ -82,13 +83,13 @@ msgstr "" #: ../../library/tempfile.rst:44 msgid "" -"The resulting object can be used as a :term:`context manager` (see :ref:" -"`tempfile-examples`). On completion of the context or destruction of the " -"file object the temporary file will be removed from the filesystem." +"The resulting object can be used as a :term:`context manager` " +"(see :ref:`tempfile-examples`). On completion of the context or destruction " +"of the file object the temporary file will be removed from the filesystem." msgstr "" -"生成的物件可以作為\\ :term:`情境管理器 `\\ 使用(參見 :ref:" -"`tempfile-examples`)。完成情境或銷毀臨時檔案物件後,臨時檔案將從檔案系統中刪" -"除。" +"生成的物件可以作為\\ :term:`情境管理器 `\\ 使用(參" +"見 :ref:`tempfile-examples`)。完成情境或銷毀臨時檔案物件後,臨時檔案將從檔案" +"系統中刪除。" #: ../../library/tempfile.rst:49 msgid "" @@ -171,8 +172,8 @@ msgid "" "with *delete* and *delete_on_close* parameters that determine whether and " "how the named file should be automatically deleted." msgstr "" -"為了管理指定檔案,它使用 *delete* 和 *delete_on_close* 參數擴充 :func:" -"`TemporaryFile` 來指定是否以及如何自動刪除指定檔案。" +"為了管理指定檔案,它使用 *delete* 和 *delete_on_close* 參數擴" +"充 :func:`TemporaryFile` 來指定是否以及如何自動刪除指定檔案。" #: ../../library/tempfile.rst:89 msgid "" @@ -186,7 +187,7 @@ msgid "" msgstr "" "回傳的物件始終是一個\\ :term:`類檔案物件 `,其 :attr:`!" "file` 屬性是底層的真實檔案物件。這個類檔案物件可以在 :keyword:`with` 陳述式中" -"使用,就像普通檔案一樣。臨時檔案的名稱可以從回傳的類檔案物件的 :attr:!name` " +"使用,就像普通檔案一樣。臨時檔案的名稱可以從回傳的類檔案物件的 :attr:`!name` " "屬性中取得。在 Unix 上則與 :func:`TemporaryFile` 不同,目錄條目不會在檔案建立" "後立即被取消鏈接 (unlink)。" @@ -202,8 +203,8 @@ msgstr "" "如果 *delete* 為 true(預設值)並且 *delete_on_close* 為 true(預設值),則檔" "案在關閉後會立即被刪除。如果 *delete* 為 true 並且 *delete_on_close* 為 " "false,則僅在情境管理器退出時刪除檔案,或者在\\ :term:`類檔案物件 `\\ 完結時刪除檔案。在這種情況下,並不總是保證能成功刪除(請參閱 :" -"meth:`object.__del__`\\ )。如果 *delete* 為 false,則會忽略 " +"object>`\\ 完結時刪除檔案。在這種情況下,並不總是保證能成功刪除(請參" +"閱 :meth:`object.__del__`\\ )。如果 *delete* 為 false,則會忽略 " "*delete_on_close* 的值。" #: ../../library/tempfile.rst:104 @@ -245,21 +246,21 @@ msgid "" "additional open shares delete access (e.g. by calling :func:`os.open` with " "the flag ``O_TEMPORARY``)" msgstr "" -"額外的 open 會共享刪除存取權限(例如,通過使用旗標 ``O_TEMPORARY`` 來呼叫 :" -"func:`os.open`\\ )" +"額外的 open 會共享刪除存取權限(例如,通過使用旗標 ``O_TEMPORARY`` 來呼" +"叫 :func:`os.open`\\ )" #: ../../library/tempfile.rst:121 msgid "" "*delete* is true but *delete_on_close* is false. Note, that in this case the " -"additional opens that do not share delete access (e.g. created via builtin :" -"func:`open`) must be closed before exiting the context manager, else the :" -"func:`os.unlink` call on context manager exit will fail with a :exc:" -"`PermissionError`." +"additional opens that do not share delete access (e.g. created via " +"builtin :func:`open`) must be closed before exiting the context manager, " +"else the :func:`os.unlink` call on context manager exit will fail with " +"a :exc:`PermissionError`." msgstr "" "*delete* 為 true 但 *delete_on_close* 為 false。請注意,在這種情況下不共享刪" "除存取權限的其他 open(例如透過內建的 :func:`open` 建立)必須在退出情境管理器" -"之前關閉,否則情境管理器上的 :func:`os.unlink` 呼叫退出將失敗並出現 :exc:" -"`PermissionError`。" +"之前關閉,否則情境管理器上的 :func:`os.unlink` 呼叫退出將失敗並出" +"現 :exc:`PermissionError`。" #: ../../library/tempfile.rst:127 msgid "" @@ -292,8 +293,8 @@ msgid "" "This class operates exactly as :func:`TemporaryFile` does, except that data " "is spooled in memory until the file size exceeds *max_size*, or until the " "file's :func:`~io.IOBase.fileno` method is called, at which point the " -"contents are written to disk and operation proceeds as with :func:" -"`TemporaryFile`." +"contents are written to disk and operation proceeds as " +"with :func:`TemporaryFile`." msgstr "" "此類別執行的操作與 :func:`TemporaryFile` 完全相同,但會將資料排存 (spool) 於" "在記憶體中,直到檔案大小超過 *max_size*,或檔案的 :func:`~io.IOBase.fileno` " @@ -316,10 +317,10 @@ msgid "" "depending on whether :meth:`rollover` has been called. This file-like " "object can be used in a :keyword:`with` statement, just like a normal file." msgstr "" -"回傳的物件是 file-like object,它的 :attr:`!_file` 屬性是 :class:`io." -"BytesIO` 或 :class:`io.TextIOWrapper` 物件(取決於指定的是二進位制模式還是文" -"字模式)或真實的檔案物件(取決於是否已呼叫 :meth:`rollover`)。file-like " -"object 可以像普通檔案一樣在 :keyword:`with` 陳述式中使用。" +"回傳的物件是 file-like object,它的 :attr:`!_file` 屬性" +"是 :class:`io.BytesIO` 或 :class:`io.TextIOWrapper` 物件(取決於指定的是二進" +"位制模式還是文字模式)或真實的檔案物件(取決於是否已呼叫 :meth:`rollover`)。" +"file-like object 可以像普通檔案一樣在 :keyword:`with` 陳述式中使用。" #: ../../library/tempfile.rst:166 msgid "the truncate method now accepts a *size* argument." @@ -336,8 +337,8 @@ msgstr "" #: ../../library/tempfile.rst:180 msgid "" -"This class securely creates a temporary directory using the same rules as :" -"func:`mkdtemp`. The resulting object can be used as a :term:`context " +"This class securely creates a temporary directory using the same rules " +"as :func:`mkdtemp`. The resulting object can be used as a :term:`context " "manager` (see :ref:`tempfile-examples`). On completion of the context or " "destruction of the temporary directory object, the newly created temporary " "directory and all its contents are removed from the filesystem." @@ -354,9 +355,9 @@ msgid "" "manager`, the :attr:`!name` will be assigned to the target of the :keyword:`!" "as` clause in the :keyword:`with` statement, if there is one." msgstr "" -"可以從回傳物件的 :attr:`!name` 屬性中找到的臨時目錄名稱。當回傳的物件用作\\ :" -"term:`情境管理器 `\\ 時,這個 :attr:`!name` 會作為 :keyword:" -"`with` 陳述句中 :keyword:`!as` 子句的目標(如果有 as 的話)。" +"可以從回傳物件的 :attr:`!name` 屬性中找到的臨時目錄名稱。當回傳的物件用作" +"\\ :term:`情境管理器 `\\ 時,這個 :attr:`!name` 會作" +"為 :keyword:`with` 陳述句中 :keyword:`!as` 子句的目標(如果有 as 的話)。" #: ../../library/tempfile.rst:195 msgid "" @@ -434,15 +435,15 @@ msgid "" "between the file name and the suffix; if you need one, put it at the " "beginning of *suffix*." msgstr "" -"如果 *suffix* 不是 ``None`` 則檔名將以該後綴結尾,若為 ``None`` 則沒有後綴。:" -"func:`mkstemp` 不會在檔名和後綴之間加點 (dot),如果需要加一個點號,請將其放" -"在 *suffix* 的開頭。" +"如果 *suffix* 不是 ``None`` 則檔名將以該後綴結尾,若為 ``None`` 則沒有後" +"綴。:func:`mkstemp` 不會在檔名和後綴之間加點 (dot),如果需要加一個點號,請將" +"其放在 *suffix* 的開頭。" #: ../../library/tempfile.rst:239 msgid "" "If *prefix* is not ``None``, the file name will begin with that prefix; " -"otherwise, a default prefix is used. The default is the return value of :" -"func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." +"otherwise, a default prefix is used. The default is the return value " +"of :func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." msgstr "" "如果 *prefix* 不是 ``None`` 則檔名將以該字首開頭,若為 ``None`` 則使用預設前" "綴。預設前綴是 :func:`gettempprefix` 或 :func:`gettempprefixb` 函式的回傳值" @@ -525,8 +526,8 @@ msgstr ":func:`mkdtemp` 的使用者用完臨時目錄後需要自行將其刪 #: ../../library/tempfile.rst:285 msgid "" -"The *prefix*, *suffix*, and *dir* arguments are the same as for :func:" -"`mkstemp`." +"The *prefix*, *suffix*, and *dir* arguments are the same as " +"for :func:`mkstemp`." msgstr "" "引數 *prefix*、*suffix* 和 *dir* 的含義與它們在 :func:`mkstemp` 中相同。" @@ -580,15 +581,15 @@ msgstr "" #: ../../library/tempfile.rst:325 msgid "" -"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and :" -"file:`/usr/tmp`, in that order." +"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, " +"and :file:`/usr/tmp`, in that order." msgstr "" "在所有其他平臺上,目錄依次為 :file:`/tmp`、:file:`/var/tmp` 和 :file:`/usr/" "tmp`。" #: ../../library/tempfile.rst:328 msgid "As a last resort, the current working directory." -msgstr "不得已時,使用當前工作目錄。" +msgstr "不得已時,使用目前工作目錄。" #: ../../library/tempfile.rst:330 msgid "" @@ -654,16 +655,16 @@ msgstr "" #: ../../library/tempfile.rst:375 msgid "" "Beware that if you set ``tempdir`` to a bytes value, there is a nasty side " -"effect: The global default return type of :func:`mkstemp` and :func:" -"`mkdtemp` changes to bytes when no explicit ``prefix``, ``suffix``, or " -"``dir`` arguments of type str are supplied. Please do not write code " -"expecting or depending on this. This awkward behavior is maintained for " -"compatibility with the historical implementation." +"effect: The global default return type of :func:`mkstemp` " +"and :func:`mkdtemp` changes to bytes when no explicit ``prefix``, " +"``suffix``, or ``dir`` arguments of type str are supplied. Please do not " +"write code expecting or depending on this. This awkward behavior is " +"maintained for compatibility with the historical implementation." msgstr "" -"請注意如果你將 ``tempdir`` 設為位元組串值,會有一個麻煩的副作用::func:" -"`mkstemp` 和 :func:`mkdtemp` 的全域性預設回傳型別會在沒有提供明顯字串型別的 " -"``prefix``、``suffix`` 或 ``dir`` 時被改為位元組串。請不要編寫預期此行為或依" -"賴於此行為的程式。這個奇怪的行為是為了維持與以往實作版本的相容性。" +"請注意如果你將 ``tempdir`` 設為位元組串值,會有一個麻煩的副作" +"用::func:`mkstemp` 和 :func:`mkdtemp` 的全域性預設回傳型別會在沒有提供明顯字" +"串型別的 ``prefix``、``suffix`` 或 ``dir`` 時被改為位元組串。請不要編寫預期此" +"行為或依賴於此行為的程式。這個奇怪的行為是為了維持與以往實作版本的相容性。" #: ../../library/tempfile.rst:386 msgid "Examples" @@ -715,6 +716,45 @@ msgid "" ">>>\n" "# directory and contents have been removed" msgstr "" +">>> import tempfile\n" +"\n" +"# 建立一個臨時檔案並寫入一些資料\n" +">>> fp = tempfile.TemporaryFile()\n" +">>> fp.write(b'Hello world!')\n" +"# read data from file\n" +">>> fp.seek(0)\n" +">>> fp.read()\n" +"b'Hello world!'\n" +"# 關閉檔案,檔案會被刪除\n" +">>> fp.close()\n" +"\n" +"# 使用情境管理器建立臨時檔案\n" +">>> with tempfile.TemporaryFile() as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.seek(0)\n" +"... fp.read()\n" +"b'Hello world!'\n" +">>>\n" +"# 檔案現在已關閉並刪除\n" +"\n" +"# 使用情境管理器建立臨時檔案\n" +"# 關閉檔案,使用名稱再次開啟檔案\n" +">>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.close()\n" +"... # 檔案已被關閉,但未被刪除\n" +"... # 透過其名稱再次開啟檔案\n" +"... with open(fp.name, mode='rb') as f:\n" +"... f.read()\n" +"b'Hello world!'\n" +">>>\n" +"# 現在檔案已被刪除\n" +"\n" +"# 使用情境管理器建立臨時目錄\n" +">>> with tempfile.TemporaryDirectory() as tmpdirname:\n" +"... print('created temporary directory', tmpdirname)\n" +">>>\n" +"# 目錄及其內容已被刪除" #: ../../library/tempfile.rst:433 msgid "Deprecated functions and variables" @@ -815,5 +855,5 @@ msgstr "file(檔案)" #~ "允許用檔名第二次開啟檔案,在各個平臺上是不同的(在 Unix 上可以;在 " #~ "Windows NT 版本以上不行)。如果 *delete* 為 true(預設值),則檔案會在關閉" #~ "後立即被刪除。該函式回傳的物件始終是 file-like object,它的 :attr:`!file` " -#~ "屬性是底層的真實檔案物件。file-like object 可以像普通檔案一樣在 :keyword:" -#~ "`with` 陳述句中使用。" +#~ "屬性是底層的真實檔案物件。file-like object 可以像普通檔案一樣" +#~ "在 :keyword:`with` 陳述句中使用。" diff --git a/library/threading.po b/library/threading.po index 4fc83a7965..17431fee17 100644 --- a/library/threading.po +++ b/library/threading.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-05-06 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,13 +68,14 @@ msgid "" "lock>`, only one thread can execute Python code at once (even though certain " "performance-oriented libraries might overcome this limitation). If you want " "your application to make better use of the computational resources of multi-" -"core machines, you are advised to use :mod:`multiprocessing` or :class:" -"`concurrent.futures.ProcessPoolExecutor`. However, threading is still an " -"appropriate model if you want to run multiple I/O-bound tasks simultaneously." +"core machines, you are advised to use :mod:`multiprocessing` " +"or :class:`concurrent.futures.ProcessPoolExecutor`. However, threading is " +"still an appropriate model if you want to run multiple I/O-bound tasks " +"simultaneously." msgstr "" #: ../../library/threading.rst:130 ../../library/threading.rst:229 -#: ../../library/threading.rst:468 ../../includes/wasm-notavail.rst:3 +#: ../../library/threading.rst:577 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" @@ -88,7 +89,7 @@ msgstr "" #: ../../library/threading.rst:50 msgid "This module defines the following functions:" -msgstr "" +msgstr "此模組定義了以下函式:" #: ../../library/threading.rst:55 msgid "" @@ -110,19 +111,19 @@ msgstr "" #: ../../library/threading.rst:68 msgid "The function ``currentThread`` is a deprecated alias for this function." -msgstr "" +msgstr "``currentThread`` 函式是此函式的已棄用別名。" #: ../../library/threading.rst:73 msgid "Handle uncaught exception raised by :func:`Thread.run`." -msgstr "" +msgstr "處理由 :func:`Thread.run` 引發且未被捕捉到的例外。" #: ../../library/threading.rst:75 msgid "The *args* argument has the following attributes:" -msgstr "" +msgstr "*args* 引數有下列屬性:" #: ../../library/threading.rst:77 msgid "*exc_type*: Exception type." -msgstr "" +msgstr "*exc_type*:例外型別。" #: ../../library/threading.rst:78 msgid "*exc_value*: Exception value, can be ``None``." @@ -134,7 +135,7 @@ msgstr "" #: ../../library/threading.rst:80 msgid "*thread*: Thread which raised the exception, can be ``None``." -msgstr "" +msgstr "*thread*:引發例外的執行緒,可以是 ``None``。" #: ../../library/threading.rst:82 msgid "" @@ -146,7 +147,7 @@ msgstr "" msgid "" "If this function raises an exception, :func:`sys.excepthook` is called to " "handle it." -msgstr "" +msgstr "如果這個函式引發例外,則會呼叫 :func:`sys.excepthook` 來處理它。" #: ../../library/threading.rst:88 msgid "" @@ -170,7 +171,7 @@ msgstr "" #: ../../library/threading.rst:100 msgid ":func:`sys.excepthook` handles uncaught exceptions." -msgstr "" +msgstr ":func:`sys.excepthook` 處理未被捕捉到的例外。" #: ../../library/threading.rst:106 msgid "" @@ -198,15 +199,15 @@ msgstr "" #: ../../library/threading.rst:134 msgid "Added support for GNU/kFreeBSD." -msgstr "" +msgstr "新增對 GNU/kFreeBSD 的支援。" #: ../../library/threading.rst:140 msgid "" "Return a list of all :class:`Thread` objects currently active. The list " -"includes daemonic threads and dummy thread objects created by :func:" -"`current_thread`. It excludes terminated threads and threads that have not " -"yet been started. However, the main thread is always part of the result, " -"even when terminated." +"includes daemonic threads and dummy thread objects created " +"by :func:`current_thread`. It excludes terminated threads and threads that " +"have not yet been started. However, the main thread is always part of the " +"result, even when terminated." msgstr "" #: ../../library/threading.rst:149 @@ -267,9 +268,9 @@ msgid "" "*size* argument specifies the stack size to be used for subsequently created " "threads, and must be 0 (use platform or configured default) or a positive " "integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is " -"used. If changing the thread stack size is unsupported, a :exc:" -"`RuntimeError` is raised. If the specified stack size is invalid, a :exc:" -"`ValueError` is raised and the stack size is unmodified. 32 KiB is " +"used. If changing the thread stack size is unsupported, " +"a :exc:`RuntimeError` is raised. If the specified stack size is invalid, " +"a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is " "currently the minimum supported stack size value to guarantee sufficient " "stack space for the interpreter itself. Note that some platforms may have " "particular restrictions on values for the stack size, such as requiring a " @@ -292,8 +293,8 @@ msgstr "" msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " -"Specifying a timeout greater than this value will raise an :exc:" -"`OverflowError`." +"Specifying a timeout greater than this value will raise " +"an :exc:`OverflowError`." msgstr "" #: ../../library/threading.rst:246 @@ -323,38 +324,273 @@ msgstr "" #: ../../library/threading.rst:263 msgid "" -"Thread-local data is data whose values are thread specific. To manage " -"thread-local data, just create an instance of :class:`local` (or a subclass) " -"and store attributes on it::" +"Thread-local data is data whose values are thread specific. If you have data " +"that you want to be local to a thread, create a :class:`local` object and " +"use its attributes::" msgstr "" #: ../../library/threading.rst:267 msgid "" -"mydata = threading.local()\n" -"mydata.x = 1" +">>> mydata = local()\n" +">>> mydata.number = 42\n" +">>> mydata.number\n" +"42" msgstr "" -"mydata = threading.local()\n" -"mydata.x = 1" +">>> mydata = local()\n" +">>> mydata.number = 42\n" +">>> mydata.number\n" +"42" -#: ../../library/threading.rst:270 -msgid "The instance's values will be different for separate threads." +#: ../../library/threading.rst:272 +msgid "You can also access the :class:`local`-object's dictionary::" msgstr "" -#: ../../library/threading.rst:275 -msgid "A class that represents thread-local data." +#: ../../library/threading.rst:274 +msgid "" +">>> mydata.__dict__\n" +"{'number': 42}\n" +">>> mydata.__dict__.setdefault('widgets', [])\n" +"[]\n" +">>> mydata.widgets\n" +"[]" +msgstr "" +">>> mydata.__dict__\n" +"{'number': 42}\n" +">>> mydata.__dict__.setdefault('widgets', [])\n" +"[]\n" +">>> mydata.widgets\n" +"[]" + +#: ../../library/threading.rst:281 +msgid "If we access the data in a different thread::" +msgstr "" + +#: ../../library/threading.rst:283 +msgid "" +">>> log = []\n" +">>> def f():\n" +"... items = sorted(mydata.__dict__.items())\n" +"... log.append(items)\n" +"... mydata.number = 11\n" +"... log.append(mydata.number)\n" +"\n" +">>> import threading\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[], 11]" +msgstr "" +">>> log = []\n" +">>> def f():\n" +"... items = sorted(mydata.__dict__.items())\n" +"... log.append(items)\n" +"... mydata.number = 11\n" +"... log.append(mydata.number)\n" +"\n" +">>> import threading\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[], 11]" + +#: ../../library/threading.rst:297 +msgid "" +"we get different data. Furthermore, changes made in the other thread don't " +"affect data seen in this thread::" msgstr "" -#: ../../library/threading.rst:277 +#: ../../library/threading.rst:300 msgid "" -"For more details and extensive examples, see the documentation string of " -"the :mod:`!_threading_local` module: :source:`Lib/_threading_local.py`." +">>> mydata.number\n" +"42" msgstr "" +">>> mydata.number\n" +"42" -#: ../../library/threading.rst:284 -msgid "Thread Objects" +#: ../../library/threading.rst:303 +msgid "" +"Of course, values you get from a :class:`local` object, including " +"their :attr:`~object.__dict__` attribute, are for whatever thread was " +"current at the time the attribute was read. For that reason, you generally " +"don't want to save these values across threads, as they apply only to the " +"thread they came from." +msgstr "" + +#: ../../library/threading.rst:309 +msgid "" +"You can create custom :class:`local` objects by subclassing " +"the :class:`local` class::" +msgstr "" + +#: ../../library/threading.rst:312 +msgid "" +">>> class MyLocal(local):\n" +"... number = 2\n" +"... def __init__(self, /, **kw):\n" +"... self.__dict__.update(kw)\n" +"... def squared(self):\n" +"... return self.number ** 2" +msgstr "" +">>> class MyLocal(local):\n" +"... number = 2\n" +"... def __init__(self, /, **kw):\n" +"... self.__dict__.update(kw)\n" +"... def squared(self):\n" +"... return self.number ** 2" + +#: ../../library/threading.rst:319 +msgid "" +"This can be useful to support default values, methods and initialization. " +"Note that if you define an :py:meth:`~object.__init__` method, it will be " +"called each time the :class:`local` object is used in a separate thread. " +"This is necessary to initialize each thread's dictionary." +msgstr "" + +#: ../../library/threading.rst:325 +msgid "Now if we create a :class:`local` object::" +msgstr "現在如果我們建立一個 :class:`local` 物件: ::" + +#: ../../library/threading.rst:327 +msgid ">>> mydata = MyLocal(color='red')" +msgstr ">>> mydata = MyLocal(color='red')" + +#: ../../library/threading.rst:329 +msgid "we have a default number::" +msgstr "會有一個預設的數字: ::" + +#: ../../library/threading.rst:331 +msgid "" +">>> mydata.number\n" +"2" +msgstr "" +">>> mydata.number\n" +"2" + +#: ../../library/threading.rst:334 +msgid "an initial color::" +msgstr "和一個初始顏色: ::" + +#: ../../library/threading.rst:336 +msgid "" +">>> mydata.color\n" +"'red'\n" +">>> del mydata.color" +msgstr "" +">>> mydata.color\n" +"'red'\n" +">>> del mydata.color" + +#: ../../library/threading.rst:340 +msgid "And a method that operates on the data::" +msgstr "和一個操作資料的方法: ::" + +#: ../../library/threading.rst:342 +msgid "" +">>> mydata.squared()\n" +"4" +msgstr "" +">>> mydata.squared()\n" +"4" + +#: ../../library/threading.rst:345 +msgid "As before, we can access the data in a separate thread::" +msgstr "" + +#: ../../library/threading.rst:347 +msgid "" +">>> log = []\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[('color', 'red')], 11]" +msgstr "" +">>> log = []\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[('color', 'red')], 11]" + +#: ../../library/threading.rst:354 +msgid "without affecting this thread's data::" +msgstr "" + +#: ../../library/threading.rst:356 +msgid "" +">>> mydata.number\n" +"2\n" +">>> mydata.color\n" +"Traceback (most recent call last):\n" +"...\n" +"AttributeError: 'MyLocal' object has no attribute 'color'" +msgstr "" +">>> mydata.number\n" +"2\n" +">>> mydata.color\n" +"Traceback (most recent call last):\n" +"...\n" +"AttributeError: 'MyLocal' object has no attribute 'color'" + +#: ../../library/threading.rst:363 +msgid "" +"Note that subclasses can define :term:`__slots__`, but they are not thread " +"local. They are shared across threads::" msgstr "" -#: ../../library/threading.rst:286 +#: ../../library/threading.rst:366 +msgid "" +">>> class MyLocal(local):\n" +"... __slots__ = 'number'\n" +"\n" +">>> mydata = MyLocal()\n" +">>> mydata.number = 42\n" +">>> mydata.color = 'red'" +msgstr "" +">>> class MyLocal(local):\n" +"... __slots__ = 'number'\n" +"\n" +">>> mydata = MyLocal()\n" +">>> mydata.number = 42\n" +">>> mydata.color = 'red'" + +#: ../../library/threading.rst:373 +msgid "So, the separate thread::" +msgstr "" + +#: ../../library/threading.rst:375 +msgid "" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()" +msgstr "" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()" + +#: ../../library/threading.rst:379 +msgid "affects what we see::" +msgstr "" + +#: ../../library/threading.rst:381 +msgid "" +">>> mydata.number\n" +"11" +msgstr "" +">>> mydata.number\n" +"11" + +#: ../../library/threading.rst:387 +msgid "A class that represents thread-local data." +msgstr "" + +#: ../../library/threading.rst:393 +msgid "Thread Objects" +msgstr "Thread 物件" + +#: ../../library/threading.rst:395 msgid "" "The :class:`Thread` class represents an activity that is run in a separate " "thread of control. There are two ways to specify the activity: by passing a " @@ -364,42 +600,42 @@ msgid "" "``__init__()`` and :meth:`~Thread.run` methods of this class." msgstr "" -#: ../../library/threading.rst:293 +#: ../../library/threading.rst:402 msgid "" "Once a thread object is created, its activity must be started by calling the " "thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run` " "method in a separate thread of control." msgstr "" -#: ../../library/threading.rst:297 +#: ../../library/threading.rst:406 msgid "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " -"normally, or by raising an unhandled exception. The :meth:`~Thread." -"is_alive` method tests whether the thread is alive." +"normally, or by raising an unhandled exception. " +"The :meth:`~Thread.is_alive` method tests whether the thread is alive." msgstr "" -#: ../../library/threading.rst:302 +#: ../../library/threading.rst:411 msgid "" "Other threads can call a thread's :meth:`~Thread.join` method. This blocks " "the calling thread until the thread whose :meth:`~Thread.join` method is " "called is terminated." msgstr "" -#: ../../library/threading.rst:306 +#: ../../library/threading.rst:415 msgid "" "A thread has a name. The name can be passed to the constructor, and read or " "changed through the :attr:`~Thread.name` attribute." msgstr "" -#: ../../library/threading.rst:309 +#: ../../library/threading.rst:418 msgid "" -"If the :meth:`~Thread.run` method raises an exception, :func:`threading." -"excepthook` is called to handle it. By default, :func:`threading.excepthook` " -"ignores silently :exc:`SystemExit`." +"If the :meth:`~Thread.run` method raises an " +"exception, :func:`threading.excepthook` is called to handle it. By " +"default, :func:`threading.excepthook` ignores silently :exc:`SystemExit`." msgstr "" -#: ../../library/threading.rst:313 +#: ../../library/threading.rst:422 msgid "" "A thread can be flagged as a \"daemon thread\". The significance of this " "flag is that the entire Python program exits when only daemon threads are " @@ -408,7 +644,7 @@ msgid "" "constructor argument." msgstr "" -#: ../../library/threading.rst:320 +#: ../../library/threading.rst:429 msgid "" "Daemon threads are abruptly stopped at shutdown. Their resources (such as " "open files, database transactions, etc.) may not be released properly. If " @@ -416,13 +652,13 @@ msgid "" "suitable signalling mechanism such as an :class:`Event`." msgstr "" -#: ../../library/threading.rst:325 +#: ../../library/threading.rst:434 msgid "" "There is a \"main thread\" object; this corresponds to the initial thread of " "control in the Python program. It is not a daemon thread." msgstr "" -#: ../../library/threading.rst:328 +#: ../../library/threading.rst:437 msgid "" "There is the possibility that \"dummy thread objects\" are created. These " "are thread objects corresponding to \"alien threads\", which are threads of " @@ -433,25 +669,25 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:339 +#: ../../library/threading.rst:448 msgid "" "This constructor should always be called with keyword arguments. Arguments " "are:" msgstr "" -#: ../../library/threading.rst:342 +#: ../../library/threading.rst:451 msgid "" "*group* should be ``None``; reserved for future extension when a :class:`!" "ThreadGroup` class is implemented." msgstr "" -#: ../../library/threading.rst:345 +#: ../../library/threading.rst:454 msgid "" "*target* is the callable object to be invoked by the :meth:`run` method. " "Defaults to ``None``, meaning nothing is called." msgstr "" -#: ../../library/threading.rst:348 +#: ../../library/threading.rst:457 msgid "" "*name* is the thread name. By default, a unique name is constructed of the " "form \"Thread-*N*\" where *N* is a small decimal number, or \"Thread-*N* " @@ -459,62 +695,62 @@ msgid "" "is specified." msgstr "" -#: ../../library/threading.rst:353 +#: ../../library/threading.rst:462 msgid "" "*args* is a list or tuple of arguments for the target invocation. Defaults " "to ``()``." msgstr "" -#: ../../library/threading.rst:355 +#: ../../library/threading.rst:464 msgid "" "*kwargs* is a dictionary of keyword arguments for the target invocation. " "Defaults to ``{}``." msgstr "" -#: ../../library/threading.rst:358 +#: ../../library/threading.rst:467 msgid "" "If not ``None``, *daemon* explicitly sets whether the thread is daemonic. If " "``None`` (the default), the daemonic property is inherited from the current " "thread." msgstr "" -#: ../../library/threading.rst:362 +#: ../../library/threading.rst:471 msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -#: ../../library/threading.rst:366 +#: ../../library/threading.rst:475 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/threading.rst:369 +#: ../../library/threading.rst:478 msgid "Use the *target* name if *name* argument is omitted." msgstr "" -#: ../../library/threading.rst:374 +#: ../../library/threading.rst:483 msgid "Start the thread's activity." msgstr "" -#: ../../library/threading.rst:376 +#: ../../library/threading.rst:485 msgid "" "It must be called at most once per thread object. It arranges for the " "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -#: ../../library/threading.rst:380 +#: ../../library/threading.rst:489 msgid "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -#: ../../library/threading.rst:385 +#: ../../library/threading.rst:494 msgid "Method representing the thread's activity." msgstr "" -#: ../../library/threading.rst:387 +#: ../../library/threading.rst:496 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the " @@ -522,17 +758,17 @@ msgid "" "the *args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/threading.rst:392 +#: ../../library/threading.rst:501 msgid "" -"Using list or tuple as the *args* argument which passed to the :class:" -"`Thread` could achieve the same effect." +"Using list or tuple as the *args* argument which passed to " +"the :class:`Thread` could achieve the same effect." msgstr "" -#: ../../library/threading.rst:395 +#: ../../library/threading.rst:504 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:397 +#: ../../library/threading.rst:506 msgid "" ">>> from threading import Thread\n" ">>> t = Thread(target=print, args=[1])\n" @@ -550,7 +786,7 @@ msgstr "" ">>> t.run()\n" "1" -#: ../../library/threading.rst:409 +#: ../../library/threading.rst:518 msgid "" "Wait until the thread terminates. This blocks the calling thread until the " "thread whose :meth:`~Thread.join` method is called terminates -- either " @@ -558,27 +794,27 @@ msgid "" "occurs." msgstr "" -#: ../../library/threading.rst:414 +#: ../../library/threading.rst:523 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof). As :meth:`~Thread.join` always returns ``None``, you " "must call :meth:`~Thread.is_alive` after :meth:`~Thread.join` to decide " -"whether a timeout happened -- if the thread is still alive, the :meth:" -"`~Thread.join` call timed out." +"whether a timeout happened -- if the thread is still alive, " +"the :meth:`~Thread.join` call timed out." msgstr "" -#: ../../library/threading.rst:421 +#: ../../library/threading.rst:530 msgid "" "When the *timeout* argument is not present or ``None``, the operation will " "block until the thread terminates." msgstr "" -#: ../../library/threading.rst:424 +#: ../../library/threading.rst:533 msgid "A thread can be joined many times." msgstr "" -#: ../../library/threading.rst:426 +#: ../../library/threading.rst:535 msgid "" ":meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made to " "join the current thread as that would cause a deadlock. It is also an error " @@ -586,20 +822,20 @@ msgid "" "do so raise the same exception." msgstr "" -#: ../../library/threading.rst:433 +#: ../../library/threading.rst:542 msgid "" "A string used for identification purposes only. It has no semantics. " "Multiple threads may be given the same name. The initial name is set by the " "constructor." msgstr "" -#: ../../library/threading.rst:440 +#: ../../library/threading.rst:549 msgid "" "Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a " "property instead." msgstr "" -#: ../../library/threading.rst:447 +#: ../../library/threading.rst:556 msgid "" "The 'thread identifier' of this thread or ``None`` if the thread has not " "been started. This is a nonzero integer. See the :func:`get_ident` " @@ -608,7 +844,7 @@ msgid "" "thread has exited." msgstr "" -#: ../../library/threading.rst:455 +#: ../../library/threading.rst:564 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -617,102 +853,102 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:464 +#: ../../library/threading.rst:573 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" -#: ../../library/threading.rst:474 +#: ../../library/threading.rst:583 msgid "Return whether the thread is alive." msgstr "" -#: ../../library/threading.rst:476 +#: ../../library/threading.rst:585 msgid "" "This method returns ``True`` just before the :meth:`~Thread.run` method " "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -#: ../../library/threading.rst:482 +#: ../../library/threading.rst:591 msgid "" "A boolean value indicating whether this thread is a daemon thread (``True``) " "or not (``False``). This must be set before :meth:`~Thread.start` is " "called, otherwise :exc:`RuntimeError` is raised. Its initial value is " "inherited from the creating thread; the main thread is not a daemon thread " -"and therefore all threads created in the main thread default to :attr:" -"`~Thread.daemon` = ``False``." +"and therefore all threads created in the main thread default " +"to :attr:`~Thread.daemon` = ``False``." msgstr "" -#: ../../library/threading.rst:489 +#: ../../library/threading.rst:598 msgid "" "The entire Python program exits when no alive non-daemon threads are left." msgstr "" -#: ../../library/threading.rst:494 +#: ../../library/threading.rst:603 msgid "" "Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as " "a property instead." msgstr "" -#: ../../library/threading.rst:503 +#: ../../library/threading.rst:612 msgid "Lock Objects" msgstr "Lock 物件" -#: ../../library/threading.rst:505 +#: ../../library/threading.rst:614 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " -"synchronization primitive available, implemented directly by the :mod:" -"`_thread` extension module." +"synchronization primitive available, implemented directly by " +"the :mod:`_thread` extension module." msgstr "" "原始鎖 (primitive lock) 是一種同步原語 (synchronization primitive),在鎖定時" -"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接由 :mod:" -"`_thread` 擴充模組實作。" +"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接" +"由 :mod:`_thread` 擴充模組實作。" -#: ../../library/threading.rst:510 +#: ../../library/threading.rst:619 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " -"created in the unlocked state. It has two basic methods, :meth:`~Lock." -"acquire` and :meth:`~Lock.release`. When the state is unlocked, :meth:" -"`~Lock.acquire` changes the state to locked and returns immediately. When " -"the state is locked, :meth:`~Lock.acquire` blocks until a call to :meth:" -"`~Lock.release` in another thread changes it to unlocked, then the :meth:" -"`~Lock.acquire` call resets it to locked and returns. The :meth:`~Lock." -"release` method should only be called in the locked state; it changes the " -"state to unlocked and returns immediately. If an attempt is made to release " -"an unlocked lock, a :exc:`RuntimeError` will be raised." +"created in the unlocked state. It has two basic " +"methods, :meth:`~Lock.acquire` and :meth:`~Lock.release`. When the state is " +"unlocked, :meth:`~Lock.acquire` changes the state to locked and returns " +"immediately. When the state is locked, :meth:`~Lock.acquire` blocks until a " +"call to :meth:`~Lock.release` in another thread changes it to unlocked, then " +"the :meth:`~Lock.acquire` call resets it to locked and returns. " +"The :meth:`~Lock.release` method should only be called in the locked state; " +"it changes the state to unlocked and returns immediately. If an attempt is " +"made to release an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" "原始鎖會處於兩種狀態之一:「鎖定 (locked)」或「未鎖定 (unclocked)」,建立時會" -"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` 和 :meth:`~Lock." -"release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變更為鎖定並立即回" -"傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直到另一個執行緒中" -"對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然後 :meth:`~Lock." -"acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方法只能在鎖定狀態" -"下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的鎖,則會引發 :" -"exc:`RuntimeError`。" - -#: ../../library/threading.rst:521 +"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` " +"和 :meth:`~Lock.release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變" +"更為鎖定並立即回傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直" +"到另一個執行緒中對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然" +"後 :meth:`~Lock.acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方" +"法只能在鎖定狀態下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的" +"鎖,則會引發 :exc:`RuntimeError`。" + +#: ../../library/threading.rst:630 msgid "Locks also support the :ref:`context management protocol `." msgstr "鎖也支援\\ :ref:`情境管理協定 `。" -#: ../../library/threading.rst:523 +#: ../../library/threading.rst:632 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " -"the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." -"release` call resets the state to unlocked; which one of the waiting threads " -"proceeds is not defined, and may vary across implementations." +"the state to turn to unlocked, only one thread proceeds when " +"a :meth:`~Lock.release` call resets the state to unlocked; which one of the " +"waiting threads proceeds is not defined, and may vary across implementations." msgstr "" -"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼叫 :" -"meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一個等" -"待執行緒會繼續進行是未定義的,並且可能因實作而異。" +"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼" +"叫 :meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一" +"個等待執行緒會繼續進行是未定義的,並且可能因實作而異。" -#: ../../library/threading.rst:528 +#: ../../library/threading.rst:637 msgid "All methods are executed atomically." msgstr "所有方法均以最小不可分割的操作方式 (atomically) 執行。" -#: ../../library/threading.rst:533 +#: ../../library/threading.rst:642 msgid "" "The class implementing primitive lock objects. Once a thread has acquired a " "lock, subsequent attempts to acquire it block, until it is released; any " @@ -721,7 +957,7 @@ msgstr "" "實作原始鎖物件的類別。一旦執行緒獲得了鎖,後續再嘗試獲得它就會被阻塞,直到鎖" "被釋放;任何執行緒都可以去釋放它。" -#: ../../library/threading.rst:537 +#: ../../library/threading.rst:646 msgid "" "``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " "which returned an instance of the underlying private lock type." @@ -729,29 +965,29 @@ msgstr "" "``Lock`` 現在是一個類別。在早期的 Python 中,``Lock`` 是一個會回傳底層私有鎖" "型別實例的工廠函式。" -#: ../../library/threading.rst:545 ../../library/threading.rst:636 +#: ../../library/threading.rst:654 ../../library/threading.rst:745 msgid "Acquire a lock, blocking or non-blocking." msgstr "阻塞或非阻塞地取得鎖。" -#: ../../library/threading.rst:547 +#: ../../library/threading.rst:656 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." msgstr "" -"當以 *blocking* 引數設為 ``True``\\ (預設值)來調用,將會阻塞直到鎖被解鎖," +"當以 *blocking* 引數設為 ``True``\\ (預設值)來叫用,將會阻塞直到鎖被解鎖," "然後將其設為鎖定並回傳 ``True``。" -#: ../../library/threading.rst:550 +#: ../../library/threading.rst:659 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. If " "a call with *blocking* set to ``True`` would block, return ``False`` " "immediately; otherwise, set the lock to locked and return ``True``." msgstr "" -"當以 *blocking* 引數設為 ``False`` 調用則不會阻塞。如果 *blocking* 設定為 " +"當以 *blocking* 引數設為 ``False`` 叫用則不會阻塞。如果 *blocking* 設定為 " "``True`` 的呼叫會阻塞,則立即回傳 ``False``;否則將鎖設為鎖定並回傳 " "``True``。" -#: ../../library/threading.rst:554 +#: ../../library/threading.rst:663 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -759,11 +995,11 @@ msgid "" "specifies an unbounded wait. It is forbidden to specify a *timeout* when " "*blocking* is ``False``." msgstr "" -"當使用設定為正值的浮點 *timeout* 引數進行調用,只要持續無法取得鎖,最多會阻" +"當使用設定為正值的浮點 *timeout* 引數進行叫用,只要持續無法取得鎖,最多會阻" "塞 *timeout* 指定的秒數。``-1`` 的 *timeout* 引數代表指定為不會停止的等待。" "當 *blocking* 為 ``False`` 時禁止指定 *timeout*。" -#: ../../library/threading.rst:560 +#: ../../library/threading.rst:669 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." @@ -771,24 +1007,24 @@ msgstr "" "如果成功取得鎖,則回傳值為 ``True``,否則回傳值為 ``False``\\ (例如像是 " "*timeout* 已逾期)。" -#: ../../library/threading.rst:563 ../../library/threading.rst:674 -#: ../../library/threading.rst:921 +#: ../../library/threading.rst:672 ../../library/threading.rst:783 +#: ../../library/threading.rst:1030 msgid "The *timeout* parameter is new." msgstr "新的 *timeout* 參數。" -#: ../../library/threading.rst:566 +#: ../../library/threading.rst:675 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." -msgstr "如果底層執行緒實作支援的話,鎖的獲取現在可以被 POSIX 上的訊號中斷。" +msgstr "如果底層執行緒實作支援的話,鎖的取得現在可以被 POSIX 上的訊號中斷。" -#: ../../library/threading.rst:573 +#: ../../library/threading.rst:682 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." msgstr "釋放鎖。這可以從任何執行緒呼叫,而不是只有獲得鎖的執行緒。" -#: ../../library/threading.rst:576 +#: ../../library/threading.rst:685 msgid "" "When the lock is locked, reset it to unlocked, and return. If any other " "threads are blocked waiting for the lock to become unlocked, allow exactly " @@ -797,23 +1033,23 @@ msgstr "" "當鎖被鎖定時,將其重置為未鎖定然後回傳。如果任何其他執行緒在等待鎖被解鎖時被" "阻塞,只允許其中一個執行緒繼續進行。" -#: ../../library/threading.rst:580 +#: ../../library/threading.rst:689 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." -msgstr "當在未鎖定的鎖上調用時,會引發 :exc:`RuntimeError`" +msgstr "當在未鎖定的鎖上叫用時,會引發 :exc:`RuntimeError`" -#: ../../library/threading.rst:582 ../../library/threading.rst:690 +#: ../../library/threading.rst:691 ../../library/threading.rst:799 msgid "There is no return value." msgstr "沒有回傳值。" -#: ../../library/threading.rst:586 +#: ../../library/threading.rst:695 msgid "Return ``True`` if the lock is acquired." msgstr "如果有取得了鎖,則回傳 ``True``。" -#: ../../library/threading.rst:593 +#: ../../library/threading.rst:702 msgid "RLock Objects" msgstr "RLock 物件" -#: ../../library/threading.rst:595 +#: ../../library/threading.rst:704 msgid "" "A reentrant lock is a synchronization primitive that may be acquired " "multiple times by the same thread. Internally, it uses the concepts of " @@ -826,26 +1062,26 @@ msgstr "" "「遞迴等級 (recursion level)」的概念。在鎖定狀態下,某個執行緒會擁有鎖;在未" "鎖定狀態下則沒有執行緒擁有它。" -#: ../../library/threading.rst:601 +#: ../../library/threading.rst:710 msgid "" -"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" -"meth:`~Lock.release` method to unlock it." +"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and " +"its :meth:`~Lock.release` method to unlock it." msgstr "" -"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它的 :meth:`~Lock." -"release` 方法來解鎖它。" +"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它" +"的 :meth:`~Lock.release` 方法來解鎖它。" -#: ../../library/threading.rst:606 +#: ../../library/threading.rst:715 msgid "" "Reentrant locks support the :ref:`context management protocol `, " -"so it is recommended to use :keyword:`with` instead of manually calling :" -"meth:`~RLock.acquire` and :meth:`~RLock.release` to handle acquiring and " -"releasing the lock for a block of code." +"so it is recommended to use :keyword:`with` instead of manually " +"calling :meth:`~RLock.acquire` and :meth:`~RLock.release` to handle " +"acquiring and releasing the lock for a block of code." msgstr "" "可重入鎖支援\\ :ref:`情境管理協定`,因此建議使用 :keyword:`with` " "而不是手動呼叫 :meth:`~RLock.acquire` 和 :meth:`~RLock.release` 來對程式碼區" "塊處理鎖的獲得和釋放。" -#: ../../library/threading.rst:611 +#: ../../library/threading.rst:720 msgid "" "RLock's :meth:`~RLock.acquire`/:meth:`~RLock.release` call pairs may be " "nested, unlike Lock's :meth:`~Lock.acquire`/:meth:`~Lock.release`. Only the " @@ -858,7 +1094,7 @@ msgstr "" "個 :meth:`~RLock.release`\\ (最外面一對的 :meth:`~Lock.release`)會將鎖重置" "為未鎖定狀態,並允許在 :meth:`~RLock.acquire` 中阻塞的另一個執行緒繼續進行。" -#: ../../library/threading.rst:617 +#: ../../library/threading.rst:726 msgid "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each " "acquire must have a release in the thread that has acquired the lock. " @@ -866,10 +1102,10 @@ msgid "" "deadlock." msgstr "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` 必須成對使用:每次獲得都必須在" -"已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和獲取的次數一樣的話,可能" +"已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和取得的次數一樣的話,可能" "會導致死鎖 (deadlock)。" -#: ../../library/threading.rst:624 +#: ../../library/threading.rst:733 msgid "" "This class implements reentrant lock objects. A reentrant lock must be " "released by the thread that acquired it. Once a thread has acquired a " @@ -880,7 +1116,7 @@ msgstr "" "得了可重入鎖,同一個執行緒可以再次獲得它而不會阻塞;執行緒每次獲得它也都必須" "釋放它一次。" -#: ../../library/threading.rst:629 +#: ../../library/threading.rst:738 msgid "" "Note that ``RLock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete RLock class that is supported " @@ -889,11 +1125,11 @@ msgstr "" "請注意,``RLock`` 實際上是一個工廠函式,它會回傳平台有支援的特定 RLock 類別的" "最高效率版本的實例。" -#: ../../library/threading.rst:640 +#: ../../library/threading.rst:749 msgid ":ref:`Using RLock as a context manager `" msgstr ":ref:`將 RLock 用作為情境管理器 `" -#: ../../library/threading.rst:641 +#: ../../library/threading.rst:750 msgid "" "Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " "practical." @@ -901,16 +1137,16 @@ msgstr "" "若是使用場景合理,和手動呼叫 :meth:`!acquire` 和 :meth:`release` 相比,會是更" "為推薦的使用方式。" -#: ../../library/threading.rst:645 +#: ../../library/threading.rst:754 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" -msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來調用:" +msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來呼叫:" -#: ../../library/threading.rst:647 ../../library/threading.rst:659 +#: ../../library/threading.rst:756 ../../library/threading.rst:768 msgid "If no thread owns the lock, acquire the lock and return immediately." msgstr "如果沒有執行緒擁有鎖,則獲得鎖並立即回傳。" -#: ../../library/threading.rst:649 +#: ../../library/threading.rst:758 msgid "" "If another thread owns the lock, block until we are able to acquire lock, or " "*timeout*, if set to a positive float value." @@ -918,32 +1154,32 @@ msgstr "" "如果另一個執行緒擁有鎖,則阻塞直到能夠取得鎖,或者達到 *timeout*\\ (如果設定" "為正浮點值)。" -#: ../../library/threading.rst:652 +#: ../../library/threading.rst:761 msgid "" "If the same thread owns the lock, acquire the lock again, and return " "immediately. This is the difference between :class:`Lock` and :class:`!" "RLock`; :class:`Lock` handles this case the same as the previous, blocking " "until the lock can be acquired." msgstr "" -"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` 和 :" -"class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞直到" -"能夠取得鎖。" +"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` " +"和 :class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞" +"直到能夠取得鎖。" -#: ../../library/threading.rst:657 +#: ../../library/threading.rst:766 msgid "When invoked with the *blocking* argument set to ``False``:" -msgstr "當以 *blocking* 引數設為 ``False`` 來調用:" +msgstr "當以 *blocking* 引數設為 ``False`` 來呼叫:" -#: ../../library/threading.rst:661 +#: ../../library/threading.rst:770 msgid "If another thread owns the lock, return immediately." msgstr "如果另一個執行緒擁有該鎖,則立即回傳。" -#: ../../library/threading.rst:663 +#: ../../library/threading.rst:772 msgid "" "If the same thread owns the lock, acquire the lock again and return " "immediately." msgstr "如果同一個執行緒擁有鎖,則再次取得鎖並立即回傳。" -#: ../../library/threading.rst:666 +#: ../../library/threading.rst:775 msgid "" "In all cases, if the thread was able to acquire the lock, return ``True``. " "If the thread was unable to acquire the lock (i.e. if not blocking or the " @@ -952,7 +1188,7 @@ msgstr "" "在所有情況下,如果執行緒能夠取得鎖則回傳 ``True``。如果執行緒無法取得鎖(即沒" "有阻塞或已達超時限制)則回傳 ``False``。" -#: ../../library/threading.rst:670 +#: ../../library/threading.rst:779 msgid "" "If called multiple times, failing to call :meth:`~RLock.release` as many " "times may lead to deadlock. Consider using :class:`!RLock` as a context " @@ -961,7 +1197,7 @@ msgstr "" "如果多次呼叫,又未能呼叫相同次數的 :meth:`~RLock.release`,則可能會導致死鎖。" "考慮將 :class:`!RLock` 作為情境管理器使用,而不是直接呼叫 acquire/release。" -#: ../../library/threading.rst:680 +#: ../../library/threading.rst:789 msgid "" "Release a lock, decrementing the recursion level. If after the decrement it " "is zero, reset the lock to unlocked (not owned by any thread), and if any " @@ -973,20 +1209,20 @@ msgstr "" "並且如果任何其他執行緒被阻塞以等待鎖變成未鎖定狀態,則僅允許其中一個執行緒繼" "續進行。如果遞減後遞迴等級仍然非零,則鎖會保持鎖定並由呼叫它的執行緒所擁有。" -#: ../../library/threading.rst:686 +#: ../../library/threading.rst:795 msgid "" -"Only call this method when the calling thread owns the lock. A :exc:" -"`RuntimeError` is raised if this method is called when the lock is not " -"acquired." +"Only call this method when the calling thread owns the lock. " +"A :exc:`RuntimeError` is raised if this method is called when the lock is " +"not acquired." msgstr "" -"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引發 :" -"exc:`RuntimeError`。" +"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引" +"發 :exc:`RuntimeError`。" -#: ../../library/threading.rst:696 +#: ../../library/threading.rst:805 msgid "Condition Objects" msgstr "" -#: ../../library/threading.rst:698 +#: ../../library/threading.rst:807 msgid "" "A condition variable is always associated with some kind of lock; this can " "be passed in or one will be created by default. Passing one in is useful " @@ -994,32 +1230,33 @@ msgid "" "of the condition object: you don't have to track it separately." msgstr "" -#: ../../library/threading.rst:703 +#: ../../library/threading.rst:812 msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " -"duration of the enclosed block. The :meth:`~Condition.acquire` and :meth:" -"`~Condition.release` methods also call the corresponding methods of the " -"associated lock." +"duration of the enclosed block. The :meth:`~Condition.acquire` " +"and :meth:`~Condition.release` methods also call the corresponding methods " +"of the associated lock." msgstr "" -#: ../../library/threading.rst:709 +#: ../../library/threading.rst:818 msgid "" -"Other methods must be called with the associated lock held. The :meth:" -"`~Condition.wait` method releases the lock, and then blocks until another " -"thread awakens it by calling :meth:`~Condition.notify` or :meth:`~Condition." -"notify_all`. Once awakened, :meth:`~Condition.wait` re-acquires the lock " -"and returns. It is also possible to specify a timeout." +"Other methods must be called with the associated lock held. " +"The :meth:`~Condition.wait` method releases the lock, and then blocks until " +"another thread awakens it by calling :meth:`~Condition.notify` " +"or :meth:`~Condition.notify_all`. Once awakened, :meth:`~Condition.wait` re-" +"acquires the lock and returns. It is also possible to specify a timeout." msgstr "" -#: ../../library/threading.rst:715 +#: ../../library/threading.rst:824 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " -"the condition variable, if any are waiting. The :meth:`~Condition." -"notify_all` method wakes up all threads waiting for the condition variable." +"the condition variable, if any are waiting. " +"The :meth:`~Condition.notify_all` method wakes up all threads waiting for " +"the condition variable." msgstr "" -#: ../../library/threading.rst:719 +#: ../../library/threading.rst:828 msgid "" "Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` " "methods don't release the lock; this means that the thread or threads " @@ -1028,19 +1265,19 @@ msgid "" "or :meth:`~Condition.notify_all` finally relinquishes ownership of the lock." msgstr "" -#: ../../library/threading.rst:725 +#: ../../library/threading.rst:834 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " "particular change of state call :meth:`~Condition.wait` repeatedly until " -"they see the desired state, while threads that modify the state call :meth:" -"`~Condition.notify` or :meth:`~Condition.notify_all` when they change the " -"state in such a way that it could possibly be a desired state for one of the " -"waiters. For example, the following code is a generic producer-consumer " -"situation with unlimited buffer capacity::" +"they see the desired state, while threads that modify the state " +"call :meth:`~Condition.notify` or :meth:`~Condition.notify_all` when they " +"change the state in such a way that it could possibly be a desired state for " +"one of the waiters. For example, the following code is a generic producer-" +"consumer situation with unlimited buffer capacity::" msgstr "" -#: ../../library/threading.rst:734 +#: ../../library/threading.rst:843 msgid "" "# Consume one item\n" "with cv:\n" @@ -1054,17 +1291,17 @@ msgid "" " cv.notify()" msgstr "" -#: ../../library/threading.rst:745 +#: ../../library/threading.rst:854 msgid "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " "the condition which prompted the :meth:`~Condition.notify` call may no " -"longer hold true. This is inherent to multi-threaded programming. The :" -"meth:`~Condition.wait_for` method can be used to automate the condition " +"longer hold true. This is inherent to multi-threaded programming. " +"The :meth:`~Condition.wait_for` method can be used to automate the condition " "checking, and eases the computation of timeouts::" msgstr "" -#: ../../library/threading.rst:752 +#: ../../library/threading.rst:861 msgid "" "# Consume an item\n" "with cv:\n" @@ -1072,54 +1309,54 @@ msgid "" " get_an_available_item()" msgstr "" -#: ../../library/threading.rst:757 +#: ../../library/threading.rst:866 msgid "" -"To choose between :meth:`~Condition.notify` and :meth:`~Condition." -"notify_all`, consider whether one state change can be interesting for only " -"one or several waiting threads. E.g. in a typical producer-consumer " -"situation, adding one item to the buffer only needs to wake up one consumer " -"thread." +"To choose between :meth:`~Condition.notify` " +"and :meth:`~Condition.notify_all`, consider whether one state change can be " +"interesting for only one or several waiting threads. E.g. in a typical " +"producer-consumer situation, adding one item to the buffer only needs to " +"wake up one consumer thread." msgstr "" -#: ../../library/threading.rst:765 +#: ../../library/threading.rst:874 msgid "" "This class implements condition variable objects. A condition variable " "allows one or more threads to wait until they are notified by another thread." msgstr "" -#: ../../library/threading.rst:768 +#: ../../library/threading.rst:877 msgid "" "If the *lock* argument is given and not ``None``, it must be a :class:`Lock` " "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -#: ../../library/threading.rst:772 ../../library/threading.rst:896 -#: ../../library/threading.rst:942 ../../library/threading.rst:994 -#: ../../library/threading.rst:1062 +#: ../../library/threading.rst:881 ../../library/threading.rst:1005 +#: ../../library/threading.rst:1051 ../../library/threading.rst:1103 +#: ../../library/threading.rst:1171 msgid "changed from a factory function to a class." msgstr "" -#: ../../library/threading.rst:777 +#: ../../library/threading.rst:886 msgid "" "Acquire the underlying lock. This method calls the corresponding method on " "the underlying lock; the return value is whatever that method returns." msgstr "" -#: ../../library/threading.rst:782 +#: ../../library/threading.rst:891 msgid "" "Release the underlying lock. This method calls the corresponding method on " "the underlying lock; there is no return value." msgstr "" -#: ../../library/threading.rst:787 +#: ../../library/threading.rst:896 msgid "" "Wait until notified or until a timeout occurs. If the calling thread has not " "acquired the lock when this method is called, a :exc:`RuntimeError` is " "raised." msgstr "" -#: ../../library/threading.rst:791 +#: ../../library/threading.rst:900 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " @@ -1127,41 +1364,41 @@ msgid "" "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -#: ../../library/threading.rst:796 +#: ../../library/threading.rst:905 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: ../../library/threading.rst:800 +#: ../../library/threading.rst:909 msgid "" -"When the underlying lock is an :class:`RLock`, it is not released using its :" -"meth:`release` method, since this may not actually unlock the lock when it " -"was acquired multiple times recursively. Instead, an internal interface of " -"the :class:`RLock` class is used, which really unlocks it even when it has " -"been recursively acquired several times. Another internal interface is then " -"used to restore the recursion level when the lock is reacquired." +"When the underlying lock is an :class:`RLock`, it is not released using " +"its :meth:`release` method, since this may not actually unlock the lock when " +"it was acquired multiple times recursively. Instead, an internal interface " +"of the :class:`RLock` class is used, which really unlocks it even when it " +"has been recursively acquired several times. Another internal interface is " +"then used to restore the recursion level when the lock is reacquired." msgstr "" -#: ../../library/threading.rst:808 +#: ../../library/threading.rst:917 msgid "" "The return value is ``True`` unless a given *timeout* expired, in which case " "it is ``False``." msgstr "" -#: ../../library/threading.rst:811 ../../library/threading.rst:1027 +#: ../../library/threading.rst:920 ../../library/threading.rst:1136 msgid "Previously, the method always returned ``None``." msgstr "" -#: ../../library/threading.rst:816 +#: ../../library/threading.rst:925 msgid "" "Wait until a condition evaluates to true. *predicate* should be a callable " "which result will be interpreted as a boolean value. A *timeout* may be " "provided giving the maximum time to wait." msgstr "" -#: ../../library/threading.rst:820 +#: ../../library/threading.rst:929 msgid "" "This utility method may call :meth:`wait` repeatedly until the predicate is " "satisfied, or until a timeout occurs. The return value is the last return " @@ -1169,13 +1406,13 @@ msgid "" "out." msgstr "" -#: ../../library/threading.rst:825 +#: ../../library/threading.rst:934 msgid "" "Ignoring the timeout feature, calling this method is roughly equivalent to " "writing::" msgstr "" -#: ../../library/threading.rst:828 +#: ../../library/threading.rst:937 msgid "" "while not predicate():\n" " cv.wait()" @@ -1183,27 +1420,27 @@ msgstr "" "while not predicate():\n" " cv.wait()" -#: ../../library/threading.rst:831 +#: ../../library/threading.rst:940 msgid "" "Therefore, the same rules apply as with :meth:`wait`: The lock must be held " "when called and is re-acquired on return. The predicate is evaluated with " "the lock held." msgstr "" -#: ../../library/threading.rst:839 +#: ../../library/threading.rst:948 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " -"calling thread has not acquired the lock when this method is called, a :exc:" -"`RuntimeError` is raised." +"calling thread has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:843 +#: ../../library/threading.rst:952 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -#: ../../library/threading.rst:846 +#: ../../library/threading.rst:955 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1211,52 +1448,52 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:851 +#: ../../library/threading.rst:960 msgid "" "Note: an awakened thread does not actually return from its :meth:`wait` call " "until it can reacquire the lock. Since :meth:`notify` does not release the " "lock, its caller should." msgstr "" -#: ../../library/threading.rst:857 +#: ../../library/threading.rst:966 msgid "" -"Wake up all threads waiting on this condition. This method acts like :meth:" -"`notify`, but wakes up all waiting threads instead of one. If the calling " -"thread has not acquired the lock when this method is called, a :exc:" -"`RuntimeError` is raised." +"Wake up all threads waiting on this condition. This method acts " +"like :meth:`notify`, but wakes up all waiting threads instead of one. If the " +"calling thread has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:862 +#: ../../library/threading.rst:971 msgid "The method ``notifyAll`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:868 +#: ../../library/threading.rst:977 msgid "Semaphore Objects" msgstr "" -#: ../../library/threading.rst:870 +#: ../../library/threading.rst:979 msgid "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " -"Dijkstra (he used the names ``P()`` and ``V()`` instead of :meth:`~Semaphore." -"acquire` and :meth:`~Semaphore.release`)." +"Dijkstra (he used the names ``P()`` and ``V()`` instead " +"of :meth:`~Semaphore.acquire` and :meth:`~Semaphore.release`)." msgstr "" -#: ../../library/threading.rst:875 +#: ../../library/threading.rst:984 msgid "" -"A semaphore manages an internal counter which is decremented by each :meth:" -"`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " -"call. The counter can never go below zero; when :meth:`~Semaphore.acquire` " -"finds that it is zero, it blocks, waiting until some other thread calls :" -"meth:`~Semaphore.release`." +"A semaphore manages an internal counter which is decremented by " +"each :meth:`~Semaphore.acquire` call and incremented by " +"each :meth:`~Semaphore.release` call. The counter can never go below zero; " +"when :meth:`~Semaphore.acquire` finds that it is zero, it blocks, waiting " +"until some other thread calls :meth:`~Semaphore.release`." msgstr "" -#: ../../library/threading.rst:881 +#: ../../library/threading.rst:990 msgid "" "Semaphores also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:886 +#: ../../library/threading.rst:995 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1265,75 +1502,75 @@ msgid "" "If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:892 +#: ../../library/threading.rst:1001 msgid "" "The optional argument gives the initial *value* for the internal counter; it " "defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is " "raised." msgstr "" -#: ../../library/threading.rst:901 +#: ../../library/threading.rst:1010 msgid "Acquire a semaphore." msgstr "" -#: ../../library/threading.rst:903 +#: ../../library/threading.rst:1012 msgid "When invoked without arguments:" msgstr "" -#: ../../library/threading.rst:905 +#: ../../library/threading.rst:1014 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" -#: ../../library/threading.rst:907 +#: ../../library/threading.rst:1016 msgid "" -"If the internal counter is zero on entry, block until awoken by a call to :" -"meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " -"decrement the counter by 1 and return ``True``. Exactly one thread will be " -"awoken by each call to :meth:`~Semaphore.release`. The order in which " +"If the internal counter is zero on entry, block until awoken by a call " +"to :meth:`~Semaphore.release`. Once awoken (and the counter is greater than " +"0), decrement the counter by 1 and return ``True``. Exactly one thread will " +"be awoken by each call to :meth:`~Semaphore.release`. The order in which " "threads are awoken should not be relied on." msgstr "" -#: ../../library/threading.rst:913 +#: ../../library/threading.rst:1022 msgid "" "When invoked with *blocking* set to ``False``, do not block. If a call " "without an argument would block, return ``False`` immediately; otherwise, do " "the same thing as when called without arguments, and return ``True``." msgstr "" -#: ../../library/threading.rst:917 +#: ../../library/threading.rst:1026 msgid "" "When invoked with a *timeout* other than ``None``, it will block for at most " "*timeout* seconds. If acquire does not complete successfully in that " "interval, return ``False``. Return ``True`` otherwise." msgstr "" -#: ../../library/threading.rst:926 +#: ../../library/threading.rst:1035 msgid "" "Release a semaphore, incrementing the internal counter by *n*. When it was " "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -#: ../../library/threading.rst:930 +#: ../../library/threading.rst:1039 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "" -#: ../../library/threading.rst:936 +#: ../../library/threading.rst:1045 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " -"make sure its current value doesn't exceed its initial value. If it does, :" -"exc:`ValueError` is raised. In most situations semaphores are used to guard " -"resources with limited capacity. If the semaphore is released too many " -"times it's a sign of a bug. If not given, *value* defaults to 1." +"make sure its current value doesn't exceed its initial value. If it " +"does, :exc:`ValueError` is raised. In most situations semaphores are used to " +"guard resources with limited capacity. If the semaphore is released too " +"many times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:949 +#: ../../library/threading.rst:1058 msgid ":class:`Semaphore` Example" msgstr ":class:`Semaphore` 範例" -#: ../../library/threading.rst:951 +#: ../../library/threading.rst:1060 msgid "" "Semaphores are often used to guard resources with limited capacity, for " "example, a database server. In any situation where the size of the resource " @@ -1341,7 +1578,7 @@ msgid "" "threads, your main thread would initialize the semaphore::" msgstr "" -#: ../../library/threading.rst:956 +#: ../../library/threading.rst:1065 msgid "" "maxconnections = 5\n" "# ...\n" @@ -1351,13 +1588,13 @@ msgstr "" "# ...\n" "pool_sema = BoundedSemaphore(value=maxconnections)" -#: ../../library/threading.rst:960 +#: ../../library/threading.rst:1069 msgid "" "Once spawned, worker threads call the semaphore's acquire and release " "methods when they need to connect to the server::" msgstr "" -#: ../../library/threading.rst:963 +#: ../../library/threading.rst:1072 msgid "" "with pool_sema:\n" " conn = connectdb()\n" @@ -1373,61 +1610,62 @@ msgstr "" " finally:\n" " conn.close()" -#: ../../library/threading.rst:970 +#: ../../library/threading.rst:1079 msgid "" "The use of a bounded semaphore reduces the chance that a programming error " "which causes the semaphore to be released more than it's acquired will go " "undetected." msgstr "" -#: ../../library/threading.rst:977 +#: ../../library/threading.rst:1086 msgid "Event Objects" msgstr "" -#: ../../library/threading.rst:979 +#: ../../library/threading.rst:1088 msgid "" "This is one of the simplest mechanisms for communication between threads: " "one thread signals an event and other threads wait for it." msgstr "" -#: ../../library/threading.rst:982 +#: ../../library/threading.rst:1091 msgid "" -"An event object manages an internal flag that can be set to true with the :" -"meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " -"method. The :meth:`~Event.wait` method blocks until the flag is true." +"An event object manages an internal flag that can be set to true with " +"the :meth:`~Event.set` method and reset to false with " +"the :meth:`~Event.clear` method. The :meth:`~Event.wait` method blocks " +"until the flag is true." msgstr "" -#: ../../library/threading.rst:989 +#: ../../library/threading.rst:1098 msgid "" "Class implementing event objects. An event manages a flag that can be set " -"to true with the :meth:`~Event.set` method and reset to false with the :meth:" -"`clear` method. The :meth:`wait` method blocks until the flag is true. The " -"flag is initially false." +"to true with the :meth:`~Event.set` method and reset to false with " +"the :meth:`clear` method. The :meth:`wait` method blocks until the flag is " +"true. The flag is initially false." msgstr "" -#: ../../library/threading.rst:999 +#: ../../library/threading.rst:1108 msgid "Return ``True`` if and only if the internal flag is true." msgstr "" -#: ../../library/threading.rst:1001 +#: ../../library/threading.rst:1110 msgid "The method ``isSet`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:1005 +#: ../../library/threading.rst:1114 msgid "" "Set the internal flag to true. All threads waiting for it to become true are " "awakened. Threads that call :meth:`wait` once the flag is true will not " "block at all." msgstr "" -#: ../../library/threading.rst:1011 +#: ../../library/threading.rst:1120 msgid "" "Reset the internal flag to false. Subsequently, threads calling :meth:`wait` " "will block until :meth:`.set` is called to set the internal flag to true " "again." msgstr "" -#: ../../library/threading.rst:1017 +#: ../../library/threading.rst:1126 msgid "" "Block as long as the internal flag is false and the timeout, if given, has " "not expired. The return value represents the reason that this blocking " @@ -1436,26 +1674,26 @@ msgid "" "become true within the given wait time." msgstr "" -#: ../../library/threading.rst:1023 +#: ../../library/threading.rst:1132 msgid "" "When the timeout argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds, or " "fractions thereof." msgstr "" -#: ../../library/threading.rst:1034 +#: ../../library/threading.rst:1143 msgid "Timer Objects" msgstr "" -#: ../../library/threading.rst:1036 +#: ../../library/threading.rst:1145 msgid "" "This class represents an action that should be run only after a certain " -"amount of time has passed --- a timer. :class:`Timer` is a subclass of :" -"class:`Thread` and as such also functions as an example of creating custom " -"threads." +"amount of time has passed --- a timer. :class:`Timer` is a subclass " +"of :class:`Thread` and as such also functions as an example of creating " +"custom threads." msgstr "" -#: ../../library/threading.rst:1040 +#: ../../library/threading.rst:1149 msgid "" "Timers are started, as with threads, by calling their :meth:`Timer.start " "` method. The timer can be stopped (before its action has " @@ -1464,11 +1702,11 @@ msgid "" "interval specified by the user." msgstr "" -#: ../../library/threading.rst:1046 +#: ../../library/threading.rst:1155 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:1048 +#: ../../library/threading.rst:1157 msgid "" "def hello():\n" " print(\"hello, world\")\n" @@ -1482,7 +1720,7 @@ msgstr "" "t = Timer(30.0, hello)\n" "t.start() # 30 秒後會印出 \"hello, world\"" -#: ../../library/threading.rst:1057 +#: ../../library/threading.rst:1166 msgid "" "Create a timer that will run *function* with arguments *args* and keyword " "arguments *kwargs*, after *interval* seconds have passed. If *args* is " @@ -1490,17 +1728,17 @@ msgid "" "``None`` (the default) then an empty dict will be used." msgstr "" -#: ../../library/threading.rst:1067 +#: ../../library/threading.rst:1176 msgid "" "Stop the timer, and cancel the execution of the timer's action. This will " "only work if the timer is still in its waiting stage." msgstr "" -#: ../../library/threading.rst:1072 +#: ../../library/threading.rst:1181 msgid "Barrier Objects" msgstr "" -#: ../../library/threading.rst:1076 +#: ../../library/threading.rst:1185 msgid "" "This class provides a simple synchronization primitive for use by a fixed " "number of threads that need to wait for each other. Each of the threads " @@ -1509,18 +1747,18 @@ msgid "" "calls. At this point, the threads are released simultaneously." msgstr "" -#: ../../library/threading.rst:1082 +#: ../../library/threading.rst:1191 msgid "" "The barrier can be reused any number of times for the same number of threads." msgstr "" -#: ../../library/threading.rst:1084 +#: ../../library/threading.rst:1193 msgid "" "As an example, here is a simple way to synchronize a client and server " "thread::" msgstr "" -#: ../../library/threading.rst:1086 +#: ../../library/threading.rst:1195 msgid "" "b = Barrier(2, timeout=5)\n" "\n" @@ -1552,7 +1790,7 @@ msgstr "" " connection = make_connection()\n" " process_client_connection(connection)" -#: ../../library/threading.rst:1104 +#: ../../library/threading.rst:1213 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " @@ -1560,7 +1798,7 @@ msgid "" "the :meth:`wait` method." msgstr "" -#: ../../library/threading.rst:1111 +#: ../../library/threading.rst:1220 msgid "" "Pass the barrier. When all the threads party to the barrier have called " "this function, they are all released simultaneously. If a *timeout* is " @@ -1568,14 +1806,14 @@ msgid "" "constructor." msgstr "" -#: ../../library/threading.rst:1116 +#: ../../library/threading.rst:1225 msgid "" "The return value is an integer in the range 0 to *parties* -- 1, different " "for each thread. This can be used to select a thread to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/threading.rst:1120 +#: ../../library/threading.rst:1229 msgid "" "i = barrier.wait()\n" "if i == 0:\n" @@ -1587,37 +1825,37 @@ msgstr "" " # 只會有一個執行緒會印出這個\n" " print(\"passed the barrier\")" -#: ../../library/threading.rst:1125 +#: ../../library/threading.rst:1234 msgid "" "If an *action* was provided to the constructor, one of the threads will have " "called it prior to being released. Should this call raise an error, the " "barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1129 +#: ../../library/threading.rst:1238 msgid "If the call times out, the barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1131 +#: ../../library/threading.rst:1240 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a thread is waiting." msgstr "" -#: ../../library/threading.rst:1136 +#: ../../library/threading.rst:1245 msgid "" "Return the barrier to the default, empty state. Any threads waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/threading.rst:1139 +#: ../../library/threading.rst:1248 msgid "" "Note that using this function may require some external synchronization if " "there are other threads whose state is unknown. If a barrier is broken it " "may be better to just leave it and create a new one." msgstr "" -#: ../../library/threading.rst:1145 +#: ../../library/threading.rst:1254 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " @@ -1625,36 +1863,36 @@ msgid "" "application." msgstr "" -#: ../../library/threading.rst:1150 +#: ../../library/threading.rst:1259 msgid "" "It may be preferable to simply create the barrier with a sensible *timeout* " "value to automatically guard against one of the threads going awry." msgstr "" -#: ../../library/threading.rst:1156 +#: ../../library/threading.rst:1265 msgid "The number of threads required to pass the barrier." msgstr "" -#: ../../library/threading.rst:1160 +#: ../../library/threading.rst:1269 msgid "The number of threads currently waiting in the barrier." msgstr "" -#: ../../library/threading.rst:1164 +#: ../../library/threading.rst:1273 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/threading.rst:1169 +#: ../../library/threading.rst:1278 msgid "" -"This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" -"`Barrier` object is reset or broken." +"This exception, a subclass of :exc:`RuntimeError`, is raised when " +"the :class:`Barrier` object is reset or broken." msgstr "" -#: ../../library/threading.rst:1176 +#: ../../library/threading.rst:1285 msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr "" -#: ../../library/threading.rst:1178 +#: ../../library/threading.rst:1287 msgid "" "All of the objects provided by this module that have ``acquire`` and " "``release`` methods can be used as context managers for a :keyword:`with` " @@ -1663,7 +1901,7 @@ msgid "" "following snippet::" msgstr "" -#: ../../library/threading.rst:1184 +#: ../../library/threading.rst:1293 msgid "" "with some_lock:\n" " # do something..." @@ -1671,11 +1909,11 @@ msgstr "" "with some_lock:\n" " # 做某些事情..." -#: ../../library/threading.rst:1187 +#: ../../library/threading.rst:1296 msgid "is equivalent to::" msgstr "" -#: ../../library/threading.rst:1189 +#: ../../library/threading.rst:1298 msgid "" "some_lock.acquire()\n" "try:\n" @@ -1689,11 +1927,11 @@ msgstr "" "finally:\n" " some_lock.release()" -#: ../../library/threading.rst:1195 +#: ../../library/threading.rst:1304 msgid "" -"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" -"`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" -"`with` statement context managers." +"Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:`Semaphore`, " +"and :class:`BoundedSemaphore` objects may be used as :keyword:`with` " +"statement context managers." msgstr "" #: ../../library/threading.rst:158 ../../library/threading.rst:176 @@ -1707,3 +1945,10 @@ msgstr "debugger(除錯器)" #: ../../library/threading.rst:187 ../../library/threading.rst:205 msgid "profile function" msgstr "" + +#~ msgid "" +#~ "mydata = threading.local()\n" +#~ "mydata.x = 1" +#~ msgstr "" +#~ "mydata = threading.local()\n" +#~ "mydata.x = 1" diff --git a/library/time.po b/library/time.po index db6badd4c8..8d53a79a3b 100644 --- a/library/time.po +++ b/library/time.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-12 00:13+0000\n" +"POT-Creation-Date: 2025-03-10 00:13+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -87,14 +86,13 @@ msgstr "" #: ../../library/time.rst:55 msgid "" -"UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, or " -"GMT). The acronym UTC is not a mistake but a compromise between English and " -"French." +"UTC is `Coordinated Universal Time`_ and superseded `Greenwich Mean Time`_ " +"or GMT as the basis of international timekeeping. The acronym UTC is not a " +"mistake but conforms to an earlier, language-agnostic naming scheme for time " +"standards such as UT0, UT1, and UT2." msgstr "" -"UTC 是 Coordinated Universal Time --- 世界協調時間(原稱為格林威治標準時間," -"或 GMT)。縮寫 UTC 並不是寫錯,而是英文和法文之間折衷的結果。" -#: ../../library/time.rst:61 +#: ../../library/time.rst:65 msgid "" "DST is Daylight Saving Time, an adjustment of the timezone by (usually) one " "hour during part of the year. DST rules are magic (determined by local law) " @@ -107,7 +105,7 @@ msgstr "" "含當地規則的表(通常會為了靈活性而從系統文件中讀取),在這方面是唯一的真正依" "據。" -#: ../../library/time.rst:67 +#: ../../library/time.rst:71 msgid "" "The precision of the various real-time functions may be less than suggested " "by the units in which their value or argument is expressed. E.g. on most " @@ -116,7 +114,7 @@ msgstr "" "各種即時 (real-time) 函式的精確度可能低於其值或引數所表示的單位所建議的精確" "度。例如,在大多數 Unix 系統上,時鐘每秒只「跳」50 次或 100 次。" -#: ../../library/time.rst:71 +#: ../../library/time.rst:75 msgid "" "On the other hand, the precision of :func:`.time` and :func:`sleep` is " "better than their Unix equivalents: times are expressed as floating-point " @@ -130,7 +128,7 @@ msgstr "" "Unix 的 :c:func:`!gettimeofday`\\ ),而 :func:`sleep` 可以接受帶有非零分數的" "時間(如果可以會使用 Unix 的 :c:func:`!select` 來實作)。" -#: ../../library/time.rst:78 +#: ../../library/time.rst:82 msgid "" "The time value as returned by :func:`gmtime`, :func:`localtime`, and :func:" "`strptime`, and accepted by :func:`asctime`, :func:`mktime` and :func:" @@ -143,11 +141,11 @@ msgstr "" "序列。:func:`gmtime`、:func:`localtime` 和 :func:`strptime` 的回傳值也為各個" "欄位提供屬性名稱。" -#: ../../library/time.rst:84 +#: ../../library/time.rst:88 msgid "See :class:`struct_time` for a description of these objects." msgstr "關於這些物件的敘述請見 :class:`struct_time`。" -#: ../../library/time.rst:86 +#: ../../library/time.rst:90 msgid "" "The :class:`struct_time` type was extended to provide the :attr:" "`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` attributes when " @@ -156,7 +154,7 @@ msgstr "" "當平台支援對應的 ``struct tm`` 成員時,:class:`struct_time` 型別被擴展以提" "供 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 屬性。" -#: ../../library/time.rst:92 +#: ../../library/time.rst:96 msgid "" "The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` and :attr:" "`~struct_time.tm_zone` are now available on all platforms." @@ -164,57 +162,57 @@ msgstr "" ":class:`struct_time` 的屬性 :attr:`~struct_time.tm_gmtoff` 和 :attr:" "`~struct_time.tm_zone` 現在在所有平台上都可用。" -#: ../../library/time.rst:97 +#: ../../library/time.rst:101 msgid "Use the following functions to convert between time representations:" msgstr "使用以下函式在時間表示之間進行轉換:" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "From" msgstr "轉換來源" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "To" msgstr "轉換目標" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "Use" msgstr "使用" -#: ../../library/time.rst:29 ../../library/time.rst:102 -#: ../../library/time.rst:105 ../../library/time.rst:108 -#: ../../library/time.rst:111 +#: ../../library/time.rst:29 ../../library/time.rst:106 +#: ../../library/time.rst:109 ../../library/time.rst:112 +#: ../../library/time.rst:115 msgid "seconds since the epoch" msgstr "紀元秒數" -#: ../../library/time.rst:102 ../../library/time.rst:108 +#: ../../library/time.rst:106 ../../library/time.rst:112 msgid ":class:`struct_time` in UTC" msgstr "世界協調時間的 :class:`struct_time`" -#: ../../library/time.rst:102 +#: ../../library/time.rst:106 msgid ":func:`gmtime`" msgstr ":func:`gmtime`" -#: ../../library/time.rst:105 ../../library/time.rst:111 +#: ../../library/time.rst:109 ../../library/time.rst:115 msgid ":class:`struct_time` in local time" msgstr "本地時間的 :class:`struct_time`" -#: ../../library/time.rst:105 +#: ../../library/time.rst:109 msgid ":func:`localtime`" msgstr ":func:`localtime`" -#: ../../library/time.rst:108 +#: ../../library/time.rst:112 msgid ":func:`calendar.timegm`" msgstr ":func:`calendar.timegm`" -#: ../../library/time.rst:111 +#: ../../library/time.rst:115 msgid ":func:`mktime`" msgstr ":func:`mktime`" -#: ../../library/time.rst:119 +#: ../../library/time.rst:123 msgid "Functions" msgstr "函式" -#: ../../library/time.rst:123 +#: ../../library/time.rst:127 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string of the following form: ``'Sun " @@ -226,36 +224,36 @@ msgstr "" "字元長,如果日期是個位數,則用空格填充,例如:``'Wed Jun 9 04:26:40 " "1993'``。" -#: ../../library/time.rst:129 +#: ../../library/time.rst:133 msgid "" "If *t* is not provided, the current time as returned by :func:`localtime` is " "used. Locale information is not used by :func:`asctime`." msgstr "" -"如果沒有提供 *t*,則使用由 :func:`localtime` 回傳的當前時間。:func:`asctime` " +"如果沒有提供 *t*,則使用由 :func:`localtime` 回傳的目前時間。:func:`asctime` " "不使用區域資訊。" -#: ../../library/time.rst:134 +#: ../../library/time.rst:138 msgid "" "Unlike the C function of the same name, :func:`asctime` does not add a " "trailing newline." msgstr "與同名的 C 函式不同,:func:`asctime` 不會添加結尾的換行字元。" -#: ../../library/time.rst:139 +#: ../../library/time.rst:143 msgid "" "Return the *clk_id* of the thread-specific CPU-time clock for the specified " "*thread_id*." msgstr "為指定的 *thread_id* 回傳執行緒專用 CPU-time 時鐘的 *clk_id*。" -#: ../../library/time.rst:141 +#: ../../library/time.rst:145 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" "使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" -"`~threading.Thread.ident` 屬性來獲取適用於 *thread_id* 的值。" +"`~threading.Thread.ident` 屬性來取得適用於 *thread_id* 的值。" -#: ../../library/time.rst:146 +#: ../../library/time.rst:150 msgid "" "Passing an invalid or expired *thread_id* may result in undefined behavior, " "such as segmentation fault." @@ -263,27 +261,27 @@ msgstr "" "傳遞無效或過期的 *thread_id* 可能會導致未定義的行為,例如分段錯誤 " "(segmentation fault)。" -#: ../../library/time.rst:149 ../../library/time.rst:161 -#: ../../library/time.rst:174 ../../library/time.rst:183 -#: ../../library/time.rst:196 ../../library/time.rst:205 -#: ../../library/time.rst:734 ../../library/time.rst:758 -#: ../../library/time.rst:854 ../../library/time.rst:865 -#: ../../library/time.rst:875 ../../library/time.rst:885 -#: ../../library/time.rst:894 ../../library/time.rst:903 -#: ../../library/time.rst:912 ../../library/time.rst:923 -#: ../../library/time.rst:931 ../../library/time.rst:942 -#: ../../library/time.rst:953 ../../library/time.rst:962 -#: ../../library/time.rst:975 +#: ../../library/time.rst:153 ../../library/time.rst:165 +#: ../../library/time.rst:178 ../../library/time.rst:187 +#: ../../library/time.rst:200 ../../library/time.rst:209 +#: ../../library/time.rst:747 ../../library/time.rst:771 +#: ../../library/time.rst:867 ../../library/time.rst:878 +#: ../../library/time.rst:888 ../../library/time.rst:898 +#: ../../library/time.rst:907 ../../library/time.rst:916 +#: ../../library/time.rst:925 ../../library/time.rst:936 +#: ../../library/time.rst:944 ../../library/time.rst:955 +#: ../../library/time.rst:966 ../../library/time.rst:975 +#: ../../library/time.rst:988 msgid "Availability" msgstr "" -#: ../../library/time.rst:151 +#: ../../library/time.rst:155 msgid "" "See the man page for :manpage:`pthread_getcpuclockid(3)` for further " "information." msgstr "若需更多資訊,請參閱 :manpage:`pthread_getcpuclockid(3)` 的說明文件。" -#: ../../library/time.rst:158 +#: ../../library/time.rst:162 msgid "" "Return the resolution (precision) of the specified clock *clk_id*. Refer " "to :ref:`time-clock-id-constants` for a list of accepted values for *clk_id*." @@ -291,7 +289,7 @@ msgstr "" "回傳指定時鐘 *clk_id* 的解析度(精確度)。有關 *clk_id* 可接受的值的串列,請" "參閱 :ref:`time-clock-id-constants`。" -#: ../../library/time.rst:168 +#: ../../library/time.rst:172 msgid "" "Return the time of the specified clock *clk_id*. Refer to :ref:`time-clock-" "id-constants` for a list of accepted values for *clk_id*." @@ -299,19 +297,19 @@ msgstr "" "回傳指定時鐘 *clk_id* 的時間。有關 *clk_id* 可接受的值的串列,請參閱 :ref:" "`time-clock-id-constants`。" -#: ../../library/time.rst:171 +#: ../../library/time.rst:175 msgid "" "Use :func:`clock_gettime_ns` to avoid the precision loss caused by the :" "class:`float` type." msgstr "" "使用 :func:`clock_gettime_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:181 +#: ../../library/time.rst:185 msgid "Similar to :func:`clock_gettime` but return time as nanoseconds." msgstr "" "類似於 :func:`clock_gettime`,但回傳以奈秒 (nanoseconds) 為單位的時間。" -#: ../../library/time.rst:190 +#: ../../library/time.rst:194 msgid "" "Set the time of the specified clock *clk_id*. Currently, :data:" "`CLOCK_REALTIME` is the only accepted value for *clk_id*." @@ -319,18 +317,18 @@ msgstr "" "設定指定時鐘 *clk_id* 的時間。目前,:data:`CLOCK_REALTIME` 是 *clk_id* 唯一可" "以接受的值。" -#: ../../library/time.rst:193 +#: ../../library/time.rst:197 msgid "" "Use :func:`clock_settime_ns` to avoid the precision loss caused by the :" "class:`float` type." msgstr "" "使用 :func:`clock_settime_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:203 +#: ../../library/time.rst:207 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." msgstr "類似於 :func:`clock_settime`,但設定以奈秒為單位的時間。" -#: ../../library/time.rst:212 +#: ../../library/time.rst:216 msgid "" "Convert a time expressed in seconds since the epoch_ to a string of a form: " "``'Sun Jun 20 23:21:05 1993'`` representing local time. The day field is two " @@ -341,50 +339,50 @@ msgstr "" "Jun 20 23:21:05 1993'``。日期欄位為兩個字元長,如果日期是個位數,則用空格填" "充,例如:``'Wed Jun 9 04:26:40 1993'``。" -#: ../../library/time.rst:217 +#: ../../library/time.rst:221 msgid "" "If *secs* is not provided or :const:`None`, the current time as returned by :" "func:`.time` is used. ``ctime(secs)`` is equivalent to " "``asctime(localtime(secs))``. Locale information is not used by :func:" "`ctime`." msgstr "" -"如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回傳的當前時" +"如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回傳的目前時" "間。``ctime(secs)`` 等同於 ``asctime(localtime(secs))``。:func:`ctime` 不使用" "區域資訊。" -#: ../../library/time.rst:225 +#: ../../library/time.rst:229 msgid "" "Get information on the specified clock as a namespace object. Supported " "clock names and the corresponding functions to read their value are:" msgstr "" -"獲取指定時鐘的資訊作為命名空間物件。支援的時鐘名稱及讀取他們的值的對應函式如" +"取得指定時鐘的資訊作為命名空間物件。支援的時鐘名稱及讀取他們的值的對應函式如" "下:" -#: ../../library/time.rst:229 +#: ../../library/time.rst:233 msgid "``'monotonic'``: :func:`time.monotonic`" msgstr "``'monotonic'``::func:`time.monotonic`" -#: ../../library/time.rst:230 +#: ../../library/time.rst:234 msgid "``'perf_counter'``: :func:`time.perf_counter`" msgstr "``'perf_counter'``::func:`time.perf_counter`" -#: ../../library/time.rst:231 +#: ../../library/time.rst:235 msgid "``'process_time'``: :func:`time.process_time`" msgstr "``'process_time'``::func:`time.process_time`" -#: ../../library/time.rst:232 +#: ../../library/time.rst:236 msgid "``'thread_time'``: :func:`time.thread_time`" msgstr "``'thread_time'``::func:`time.thread_time`" -#: ../../library/time.rst:233 +#: ../../library/time.rst:237 msgid "``'time'``: :func:`time.time`" msgstr "``'time'``::func:`time.time`" -#: ../../library/time.rst:235 +#: ../../library/time.rst:239 msgid "The result has the following attributes:" msgstr "其結果具有以下屬性:" -#: ../../library/time.rst:237 +#: ../../library/time.rst:241 msgid "" "*adjustable*: ``True`` if the clock can be changed automatically (e.g. by a " "NTP daemon) or manually by the system administrator, ``False`` otherwise" @@ -392,24 +390,24 @@ msgstr "" "*adjustable*: 如果時鐘可以自動(例如,透過 NTP 常駐程式)或由系統管理員手動更" "改,則為 ``True``,否則為 ``False``" -#: ../../library/time.rst:239 +#: ../../library/time.rst:243 msgid "" "*implementation*: The name of the underlying C function used to get the " "clock value. Refer to :ref:`time-clock-id-constants` for possible values." msgstr "" -"*implementation*: 用於獲取時鐘的值的底層 C 函式名稱。有關可能的值,請參閱 :" +"*implementation*: 用於取得時鐘的值的底層 C 函式名稱。有關可能的值,請參閱 :" "ref:`time-clock-id-constants`。" -#: ../../library/time.rst:241 +#: ../../library/time.rst:245 msgid "" "*monotonic*: ``True`` if the clock cannot go backward, ``False`` otherwise" msgstr "*monotonic*: 如果時鐘不能倒轉,則為 ``True``,否則為 ``False``" -#: ../../library/time.rst:243 +#: ../../library/time.rst:247 msgid "*resolution*: The resolution of the clock in seconds (:class:`float`)" msgstr "*resolution*: 以秒 (:class:`float`) 為單位的時鐘的解析度" -#: ../../library/time.rst:250 +#: ../../library/time.rst:254 msgid "" "Convert a time expressed in seconds since the epoch_ to a :class:" "`struct_time` in UTC in which the dst flag is always zero. If *secs* is not " @@ -420,20 +418,20 @@ msgid "" msgstr "" "將自 epoch_ 起以秒表示的時間轉換為 UTC 中的 :class:`struct_time`,其中 dst 旗" "標始終為零。如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回" -"傳的當前時間。忽略秒的分數部分。關於 :class:`struct_time` 物件的描述,請參閱" +"傳的目前時間。忽略秒的分數部分。關於 :class:`struct_time` 物件的描述,請參閱" "上文。此函式的反運算請參閱 :func:`calendar.timegm`。" -#: ../../library/time.rst:260 +#: ../../library/time.rst:264 msgid "" "Like :func:`gmtime` but converts to local time. If *secs* is not provided " "or :const:`None`, the current time as returned by :func:`.time` is used. " "The dst flag is set to ``1`` when DST applies to the given time." msgstr "" "類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其為 :const:" -"`None`,則使用由 :func:`.time` 回傳的當前時間。當 DST 適用於給定時間時,dst " +"`None`,則使用由 :func:`.time` 回傳的目前時間。當 DST 適用於給定時間時,dst " "旗標會被設定為 ``1``。" -#: ../../library/time.rst:264 +#: ../../library/time.rst:268 msgid "" ":func:`localtime` may raise :exc:`OverflowError`, if the timestamp is " "outside the range of values supported by the platform C :c:func:`localtime` " @@ -446,7 +444,7 @@ msgstr "" "`localtime` 或 :c:func:`gmtime` 失敗時,會引發 :exc:`OSError`。通常會把年份限" "制在 1970 年到 2038 年之間。" -#: ../../library/time.rst:273 +#: ../../library/time.rst:277 msgid "" "This is the inverse function of :func:`localtime`. Its argument is the :" "class:`struct_time` or full 9-tuple (since the dst flag is needed; use " @@ -465,7 +463,7 @@ msgstr "" "(取決於無效值是被 Python 還是底層 C 函式庫捕獲)。它能生成時間的最早日期根據" "平台而有所不同。" -#: ../../library/time.rst:285 +#: ../../library/time.rst:289 msgid "" "Return the value (in fractional seconds) of a monotonic clock, i.e. a clock " "that cannot go backwards. The clock is not affected by system clock " @@ -476,11 +474,11 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 ../../library/time.rst:700 +#: ../../library/time.rst:294 ../../library/time.rst:713 msgid "Clock:" msgstr "時鐘:" -#: ../../library/time.rst:292 +#: ../../library/time.rst:296 msgid "" "On Windows, call ``QueryPerformanceCounter()`` and " "``QueryPerformanceFrequency()``." @@ -488,42 +486,42 @@ msgstr "" "在 Windows 上,呼叫 ``QueryPerformanceCounter()`` 和 " "``QueryPerformanceFrequency()``。" -#: ../../library/time.rst:294 +#: ../../library/time.rst:298 msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." msgstr "" "在 macOS 上,呼叫 ``mach_absolute_time()`` 和 ``mach_timebase_info()``。" -#: ../../library/time.rst:295 +#: ../../library/time.rst:299 msgid "On HP-UX, call ``gethrtime()``." msgstr "在 HP-UX 上,呼叫 ``gethrtime()``。" -#: ../../library/time.rst:296 +#: ../../library/time.rst:300 msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_HIGHRES)``。" -#: ../../library/time.rst:297 +#: ../../library/time.rst:301 msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." msgstr "否則,呼叫 ``clock_gettime(CLOCK_MONOTONIC)``。" -#: ../../library/time.rst:299 +#: ../../library/time.rst:303 msgid "" "Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "使用 :func:`monotonic_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:304 +#: ../../library/time.rst:308 msgid "The function is now always available and always system-wide." msgstr "此函式現在始終可用且涵蓋整個系統。" -#: ../../library/time.rst:307 +#: ../../library/time.rst:311 msgid "On macOS, the function is now system-wide." msgstr "在 macOS 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:313 +#: ../../library/time.rst:317 msgid "Similar to :func:`monotonic`, but return time as nanoseconds." msgstr "類似於 :func:`monotonic`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:322 +#: ../../library/time.rst:326 msgid "" "Return the value (in fractional seconds) of a performance counter, i.e. a " "clock with the highest available resolution to measure a short duration. It " @@ -535,7 +533,7 @@ msgstr "" "間隔的時鐘。它包括睡眠時經過的時間,並且涵蓋整個系統。回傳值的參考點沒有定" "義,因此只有兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:330 +#: ../../library/time.rst:334 msgid "" "On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " "clock, i.e. a clock that cannot go backwards." @@ -543,26 +541,26 @@ msgstr "" "在 CPython 上,使用與 :func:`time.monotonic` 相同的時鐘,且其為單調時鐘(即不" "能倒轉的時鐘)。" -#: ../../library/time.rst:333 +#: ../../library/time.rst:337 msgid "" "Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" "使用 :func:`perf_counter_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:338 +#: ../../library/time.rst:342 msgid "On Windows, the function is now system-wide." msgstr "在 Windows 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:341 +#: ../../library/time.rst:345 msgid "Use the same clock as :func:`time.monotonic`." msgstr "使用與 :func:`time.monotonic` 相同的時鐘。" -#: ../../library/time.rst:347 +#: ../../library/time.rst:351 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." msgstr "類似於 :func:`perf_counter`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:359 +#: ../../library/time.rst:363 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current process. It does not include time elapsed during " @@ -570,22 +568,22 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls is valid." msgstr "" -"回傳當前行程的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠時" +"回傳目前行程的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠時" "經過的時間。根據定義,它涵蓋整個行程。回傳值的參考點沒有定義,因此只有兩次呼" "叫結果之間的差異才是有效的。" -#: ../../library/time.rst:365 +#: ../../library/time.rst:369 msgid "" "Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" "使用 :func:`process_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:372 +#: ../../library/time.rst:376 msgid "Similar to :func:`process_time` but return time as nanoseconds." msgstr "類似於 :func:`process_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:378 +#: ../../library/time.rst:382 msgid "" "Suspend execution of the calling thread for the given number of seconds. The " "argument may be a floating-point number to indicate a more precise sleep " @@ -594,7 +592,7 @@ msgstr "" "在一個給定的秒數內暫停呼叫執行緒 (calling thread) 的執行。引數可以是浮點數," "以表示更精確的睡眠時間。" -#: ../../library/time.rst:382 +#: ../../library/time.rst:386 msgid "" "If the sleep is interrupted by a signal and no exception is raised by the " "signal handler, the sleep is restarted with a recomputed timeout." @@ -602,13 +600,17 @@ msgstr "" "如果睡眠被訊號中斷且訊號處理器未引發例外,則睡眠將以重新計算過的逾時 " "(timeout) 重新開始。" -#: ../../library/time.rst:385 +#: ../../library/time.rst:389 msgid "" "The suspension time may be longer than requested by an arbitrary amount, " "because of the scheduling of other activity in the system." msgstr "由於系統中其他活動的調度,暫停時間可能會比請求的時間長任意的量。" -#: ../../library/time.rst:388 +#: ../../library/time.rst:393 +msgid "Windows implementation" +msgstr "Windows 實作" + +#: ../../library/time.rst:394 msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " @@ -624,23 +626,34 @@ msgstr "" "learn.microsoft.com/windows-hardware/drivers/kernel/high-resolution-" "timers>`_,其解析度為 100 奈秒。如果 *secs* 為零,則使用 ``Sleep(0)``。" -#: ../../library/time.rst:396 -msgid "Unix implementation:" -msgstr "Unix 實作:" +#: ../../library/time.rst:403 +msgid "Unix implementation" +msgstr "Unix 實作" -#: ../../library/time.rst:398 +#: ../../library/time.rst:404 msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "如果可以,使用 ``clock_nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:399 +#: ../../library/time.rst:405 msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "或者使用 ``nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:400 +#: ../../library/time.rst:406 msgid "Or use ``select()`` (resolution: 1 microsecond)." msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" -#: ../../library/time.rst:402 +#: ../../library/time.rst:410 +msgid "" +"To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." +msgstr "" + +#: ../../library/time.rst:412 +msgid "" +"To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling " +"policy ` and use :func:`os.sched_yield` instead." +msgstr "" + +#: ../../library/time.rst:415 msgid "" "Raises an :ref:`auditing event ` ``time.sleep`` with argument " "``secs``." @@ -648,7 +661,7 @@ msgstr "" "引發一個帶有引數 ``secs`` 的\\ :ref:`稽核事件 (auditing event) ` " "``time.sleep``。" -#: ../../library/time.rst:404 +#: ../../library/time.rst:417 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " @@ -657,7 +670,7 @@ msgstr "" "即使睡眠被訊號中斷,此函式現在至少還是會睡眠 *secs*,除非訊號處理器引發例外" "(理由請參閱 :pep:`475`)。" -#: ../../library/time.rst:409 +#: ../../library/time.rst:422 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." @@ -665,11 +678,11 @@ msgstr "" "在 Unix 上,如果可以的話現在會使用 ``clock_nanosleep()`` 和 ``nanosleep()`` " "函式。在 Windows 上,現在使用可等待的計時器。" -#: ../../library/time.rst:413 +#: ../../library/time.rst:426 msgid "Raises an auditing event." msgstr "引發一個稽核事件。" -#: ../../library/time.rst:421 +#: ../../library/time.rst:434 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string as specified by the *format* " @@ -679,10 +692,10 @@ msgid "" msgstr "" "將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組或 :class:" "`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則使用由 :" -"func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中的任何欄" +"func:`localtime` 回傳的目前時間。*format* 必須是一個字串。如果 *t* 中的任何欄" "位超出允許範圍,將會引發 :exc:`ValueError`。" -#: ../../library/time.rst:427 +#: ../../library/time.rst:440 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." @@ -690,7 +703,7 @@ msgstr "" "0 在時間元組中的任何位置都是合法引數;如果元組中出現常見的錯誤,該值將被強制" "更改為正確的值。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:443 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " @@ -699,151 +712,151 @@ msgstr "" "以下指令可以嵌入在 *format* 字串中。它們顯示時不帶可選的欄位寬度和精度規範," "並在 :func:`strftime` 的結果中被標示的字元替換:" -#: ../../library/time.rst:435 +#: ../../library/time.rst:448 msgid "Directive" msgstr "指令" -#: ../../library/time.rst:435 +#: ../../library/time.rst:448 msgid "Meaning" msgstr "意義" -#: ../../library/time.rst:435 +#: ../../library/time.rst:448 msgid "Notes" msgstr "註解" -#: ../../library/time.rst:437 +#: ../../library/time.rst:450 msgid "``%a``" msgstr "``%a``" -#: ../../library/time.rst:437 +#: ../../library/time.rst:450 msgid "Locale's abbreviated weekday name." msgstr "區域設定的週間日 (weekday) 縮寫名稱。" -#: ../../library/time.rst:440 +#: ../../library/time.rst:453 msgid "``%A``" msgstr "``%A``" -#: ../../library/time.rst:440 +#: ../../library/time.rst:453 msgid "Locale's full weekday name." msgstr "區域設定的完整週間日名稱。" -#: ../../library/time.rst:442 +#: ../../library/time.rst:455 msgid "``%b``" msgstr "``%b``" -#: ../../library/time.rst:442 +#: ../../library/time.rst:455 msgid "Locale's abbreviated month name." msgstr "區域設定的縮寫月份名稱。" -#: ../../library/time.rst:445 +#: ../../library/time.rst:458 msgid "``%B``" msgstr "``%B``" -#: ../../library/time.rst:445 +#: ../../library/time.rst:458 msgid "Locale's full month name." msgstr "區域設定的完整月份名稱。" -#: ../../library/time.rst:447 +#: ../../library/time.rst:460 msgid "``%c``" msgstr "``%c``" -#: ../../library/time.rst:447 +#: ../../library/time.rst:460 msgid "Locale's appropriate date and time representation." msgstr "區域設定的合適的日期和時間的表示法。" -#: ../../library/time.rst:450 +#: ../../library/time.rst:463 msgid "``%d``" msgstr "``%d``" -#: ../../library/time.rst:450 +#: ../../library/time.rst:463 msgid "Day of the month as a decimal number [01,31]." msgstr "月份中的日期,表示為十進位數 [01,31]。" -#: ../../library/time.rst:453 +#: ../../library/time.rst:466 msgid "``%f``" msgstr "``%f``" -#: ../../library/time.rst:453 +#: ../../library/time.rst:466 msgid "Microseconds as a decimal number" msgstr "微秒,表示為十進位數" -#: ../../library/time.rst:454 +#: ../../library/time.rst:467 msgid "[000000,999999]." msgstr "[000000,999999]。" -#: ../../library/time.rst:453 +#: ../../library/time.rst:466 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/time.rst:457 +#: ../../library/time.rst:470 msgid "``%H``" msgstr "``%H``" -#: ../../library/time.rst:457 +#: ../../library/time.rst:470 msgid "Hour (24-hour clock) as a decimal number [00,23]." msgstr "小時(24 小時制),表示為十進位數 [00,23]。" -#: ../../library/time.rst:460 +#: ../../library/time.rst:473 msgid "``%I``" msgstr "``%I``" -#: ../../library/time.rst:460 +#: ../../library/time.rst:473 msgid "Hour (12-hour clock) as a decimal number [01,12]." msgstr "小時(12 小時制),表示為十進位數 [01,12]。" -#: ../../library/time.rst:463 +#: ../../library/time.rst:476 msgid "``%j``" msgstr "``%j``" -#: ../../library/time.rst:463 +#: ../../library/time.rst:476 msgid "Day of the year as a decimal number [001,366]." msgstr "一年中的第幾天,表示為十進位數 [001,366]。" -#: ../../library/time.rst:466 +#: ../../library/time.rst:479 msgid "``%m``" msgstr "``%m``" -#: ../../library/time.rst:466 +#: ../../library/time.rst:479 msgid "Month as a decimal number [01,12]." msgstr "月份,表示為十進位數 [01,12]。" -#: ../../library/time.rst:469 +#: ../../library/time.rst:482 msgid "``%M``" msgstr "``%M``" -#: ../../library/time.rst:469 +#: ../../library/time.rst:482 msgid "Minute as a decimal number [00,59]." msgstr "分鐘,表示為十進位數 [00,59]。" -#: ../../library/time.rst:472 +#: ../../library/time.rst:485 msgid "``%p``" msgstr "``%p``" -#: ../../library/time.rst:472 +#: ../../library/time.rst:485 msgid "Locale's equivalent of either AM or PM." msgstr "區域設定中相當於 AM 或 PM 的表示。" -#: ../../library/time.rst:472 +#: ../../library/time.rst:485 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/time.rst:475 +#: ../../library/time.rst:488 msgid "``%S``" msgstr "``%S``" -#: ../../library/time.rst:475 +#: ../../library/time.rst:488 msgid "Second as a decimal number [00,61]." msgstr "秒,表示為十進位數 [00,61]。" -#: ../../library/time.rst:475 +#: ../../library/time.rst:488 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/time.rst:478 +#: ../../library/time.rst:491 msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:478 +#: ../../library/time.rst:491 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " @@ -852,31 +865,31 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:478 ../../library/time.rst:492 +#: ../../library/time.rst:491 ../../library/time.rst:505 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/time.rst:486 +#: ../../library/time.rst:499 msgid "``%u``" msgstr "``%u``" -#: ../../library/time.rst:486 +#: ../../library/time.rst:499 msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." msgstr "一週中的日期(周一為 1;週日為 7),表示為十進位數 [1,7]。" -#: ../../library/time.rst:489 +#: ../../library/time.rst:502 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:489 +#: ../../library/time.rst:502 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:492 +#: ../../library/time.rst:505 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:492 +#: ../../library/time.rst:505 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -885,43 +898,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:500 +#: ../../library/time.rst:513 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:500 +#: ../../library/time.rst:513 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:503 +#: ../../library/time.rst:516 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:503 +#: ../../library/time.rst:516 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:506 +#: ../../library/time.rst:519 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:506 +#: ../../library/time.rst:519 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:509 +#: ../../library/time.rst:522 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:509 +#: ../../library/time.rst:522 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:512 +#: ../../library/time.rst:525 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:512 +#: ../../library/time.rst:525 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -930,19 +943,19 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:518 +#: ../../library/time.rst:531 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:518 +#: ../../library/time.rst:531 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:521 +#: ../../library/time.rst:534 msgid "``%G``" msgstr "``%G``" -#: ../../library/time.rst:521 +#: ../../library/time.rst:534 msgid "" "ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " "calendar year). The year starts with the week that contains the first " @@ -951,11 +964,11 @@ msgstr "" "ISO 8601 年(類似於 ``%Y``,但遵循 ISO 8601 日曆年的規則)。年份從包含該日曆" "年第一個星期四的那一週開始。" -#: ../../library/time.rst:526 +#: ../../library/time.rst:539 msgid "``%V``" msgstr "``%V``" -#: ../../library/time.rst:526 +#: ../../library/time.rst:539 msgid "" "ISO 8601 week number (as a decimal number [01,53]). The first week of the " "year is the one that contains the first Thursday of the year. Weeks start on " @@ -964,19 +977,19 @@ msgstr "" "ISO 8601 週數(以十進位數表示 [01,53])。年份的第一週是包含該年第一個星期四的" "那一週。每週從星期一開始。" -#: ../../library/time.rst:531 +#: ../../library/time.rst:544 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:531 +#: ../../library/time.rst:544 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:534 +#: ../../library/time.rst:547 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:537 +#: ../../library/time.rst:550 msgid "" "The ``%f`` format directive only applies to :func:`strptime`, not to :func:" "`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" @@ -987,7 +1000,7 @@ msgstr "" "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 `。" -#: ../../library/time.rst:543 +#: ../../library/time.rst:556 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -996,7 +1009,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:549 +#: ../../library/time.rst:562 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -1005,7 +1018,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:554 +#: ../../library/time.rst:567 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -1013,7 +1026,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:557 +#: ../../library/time.rst:570 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -1021,7 +1034,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:560 +#: ../../library/time.rst:573 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -1031,7 +1044,7 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:564 +#: ../../library/time.rst:577 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " @@ -1041,7 +1054,7 @@ msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:569 +#: ../../library/time.rst:582 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -1051,7 +1064,7 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:580 +#: ../../library/time.rst:593 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." @@ -1059,7 +1072,7 @@ msgstr "" "根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" "`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:584 +#: ../../library/time.rst:597 msgid "" "The *format* parameter uses the same directives as those used by :func:" "`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " @@ -1075,11 +1088,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:592 +#: ../../library/time.rst:605 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:599 +#: ../../library/time.rst:612 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1090,7 +1103,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:604 +#: ../../library/time.rst:617 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1098,11 +1111,11 @@ msgid "" "platform and thus does not necessarily support all directives available that " "are not documented as supported." msgstr "" -"僅支援文檔中指定的指令。由於 ``strftime()`` 是根據每個平台實作的,有時它可以" +"僅支援文件中指定的指令。由於 ``strftime()`` 是根據每個平台實作的,有時它可以" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:613 +#: ../../library/time.rst:626 msgid "" "The type of the time value sequence returned by :func:`gmtime`, :func:" "`localtime`, and :func:`strptime`. It is an object with a :term:`named " @@ -1113,110 +1126,110 @@ msgstr "" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:620 +#: ../../library/time.rst:633 msgid "Index" msgstr "索引" -#: ../../library/time.rst:621 +#: ../../library/time.rst:634 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:622 +#: ../../library/time.rst:635 msgid "Values" msgstr "值" -#: ../../library/time.rst:624 +#: ../../library/time.rst:637 msgid "0" msgstr "0" -#: ../../library/time.rst:626 +#: ../../library/time.rst:639 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:628 +#: ../../library/time.rst:641 msgid "1" msgstr "1" -#: ../../library/time.rst:630 +#: ../../library/time.rst:643 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:632 +#: ../../library/time.rst:645 msgid "2" msgstr "2" -#: ../../library/time.rst:634 +#: ../../library/time.rst:647 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:636 +#: ../../library/time.rst:649 msgid "3" msgstr "3" -#: ../../library/time.rst:638 +#: ../../library/time.rst:651 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:640 +#: ../../library/time.rst:653 msgid "4" msgstr "4" -#: ../../library/time.rst:642 +#: ../../library/time.rst:655 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:644 +#: ../../library/time.rst:657 msgid "5" msgstr "5" -#: ../../library/time.rst:646 +#: ../../library/time.rst:659 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) `" -#: ../../library/time.rst:648 +#: ../../library/time.rst:661 msgid "6" msgstr "6" -#: ../../library/time.rst:650 +#: ../../library/time.rst:663 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:652 +#: ../../library/time.rst:665 msgid "7" msgstr "7" -#: ../../library/time.rst:654 +#: ../../library/time.rst:667 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:656 +#: ../../library/time.rst:669 msgid "8" msgstr "8" -#: ../../library/time.rst:658 +#: ../../library/time.rst:671 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:660 ../../library/time.rst:664 +#: ../../library/time.rst:673 ../../library/time.rst:677 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:662 +#: ../../library/time.rst:675 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:666 +#: ../../library/time.rst:679 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:668 +#: ../../library/time.rst:681 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:671 +#: ../../library/time.rst:684 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1226,7 +1239,7 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:675 +#: ../../library/time.rst:688 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" @@ -1235,7 +1248,7 @@ msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:681 +#: ../../library/time.rst:694 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " @@ -1247,7 +1260,7 @@ msgstr "" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 `_。" -#: ../../library/time.rst:687 +#: ../../library/time.rst:700 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1259,7 +1272,7 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:693 +#: ../../library/time.rst:706 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -1273,31 +1286,31 @@ msgstr "" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:702 +#: ../../library/time.rst:715 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." msgstr "在 Windows 上,呼叫 ``GetSystemTimeAsFileTime()``。" -#: ../../library/time.rst:703 +#: ../../library/time.rst:716 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_REALTIME)``。" -#: ../../library/time.rst:704 +#: ../../library/time.rst:717 msgid "Otherwise, call ``gettimeofday()``." msgstr "否則,呼叫 ``gettimeofday()``。" -#: ../../library/time.rst:706 +#: ../../library/time.rst:719 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:712 +#: ../../library/time.rst:725 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:725 +#: ../../library/time.rst:738 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1305,26 +1318,26 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls in the same thread is valid." msgstr "" -"回傳當前執行緒的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠" +"回傳目前執行緒的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠" "期間經過的時間。根據定義,這是執行緒特定 (thread-specific) 的。回傳值的參照點" "未定義,因此只有同一執行緒中兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:731 +#: ../../library/time.rst:744 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" "使用 :func:`thread_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:736 +#: ../../library/time.rst:749 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "有支援 ``CLOCK_THREAD_CPUTIME_ID`` 的 Unix 系統。" -#: ../../library/time.rst:743 +#: ../../library/time.rst:756 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "類似於 :func:`thread_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:750 +#: ../../library/time.rst:763 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1341,7 +1354,7 @@ msgstr "" "``daylight``\\ (如果該時區沒有日光節約時間規則,則設定為 0;如果在過去、現在" "或未來的某個時間有日光節約時間規則,則設置為非零的值)。" -#: ../../library/time.rst:762 +#: ../../library/time.rst:775 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" @@ -1350,30 +1363,30 @@ msgstr "" "雖然在許多情況下,更改 :envvar:`TZ` 環境變數可能會在沒有呼叫 :func:`tzset` 的" "情況下影響 :func:`localtime` 等函式的輸出,但是這種行為是不該被依賴的。" -#: ../../library/time.rst:766 +#: ../../library/time.rst:779 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr ":envvar:`TZ` 環境變數不應包含空格字元。" -#: ../../library/time.rst:768 +#: ../../library/time.rst:781 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" ":envvar:`TZ` 環境變數的標準格式為(為了清楚表達,中間增加了空格字元): ::" -#: ../../library/time.rst:771 +#: ../../library/time.rst:784 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:773 +#: ../../library/time.rst:786 msgid "Where the components are:" msgstr "其中各個組成部分為:" -#: ../../library/time.rst:775 +#: ../../library/time.rst:788 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:776 +#: ../../library/time.rst:789 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" @@ -1381,11 +1394,11 @@ msgstr "" "三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 time." "tzname 中。" -#: ../../library/time.rst:779 +#: ../../library/time.rst:792 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:780 +#: ../../library/time.rst:793 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1396,22 +1409,22 @@ msgstr "" "果以 '-' 開頭,則表示該時區位於本初子午線以東;否則,位於其西。如果 dst 之後" "沒有偏移量,則假定日光時間比標準時間快一小時。" -#: ../../library/time.rst:785 +#: ../../library/time.rst:798 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:786 +#: ../../library/time.rst:799 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" "表示何時切換至日光節約時間及何時切換回來。開始和結束日期的格式如以下其一:" -#: ../../library/time.rst:789 +#: ../../library/time.rst:802 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:790 +#: ../../library/time.rst:803 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." @@ -1419,22 +1432,22 @@ msgstr "" "儒略日 (Julian day) *n*(1 <= *n* <= 365)。閏日不計算,因此在所有年份中,2 " "月 28 日是第 59 天,3 月 1 日是第 60 天。" -#: ../../library/time.rst:793 +#: ../../library/time.rst:806 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:794 +#: ../../library/time.rst:807 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" "從 0 開始的儒略日 (0 <= *n* <= 365)。閏日會計算,因此可以適用至 2 月 29 日。" -#: ../../library/time.rst:797 +#: ../../library/time.rst:810 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:798 +#: ../../library/time.rst:811 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1445,7 +1458,7 @@ msgstr "" "*m* <= 12,其中 *n* 為 5 表示「該月的最後一個第 *d* 天」,這可能出現在第四或" "第五週)。第 1 週是 *d* 天首次出現的那一週。第零天為星期天。" -#: ../../library/time.rst:804 +#: ../../library/time.rst:817 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." @@ -1453,7 +1466,7 @@ msgstr "" "``time`` 的格式與 ``offset`` 相同,但不允許出現前導符號('-' 或 '+')。如果未" "指定時間,則預設為 02:00:00。" -#: ../../library/time.rst:809 +#: ../../library/time.rst:822 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1473,7 +1486,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:818 +#: ../../library/time.rst:831 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1490,7 +1503,7 @@ msgstr "" "Eastern'``、``'Australia/Melbourne'``、``'Egypt'`` 或 ``'Europe/" "Amsterdam'``。 ::" -#: ../../library/time.rst:826 +#: ../../library/time.rst:839 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1510,35 +1523,35 @@ msgstr "" ">>> time.tzname\n" "('EET', 'EEST')" -#: ../../library/time.rst:839 +#: ../../library/time.rst:852 msgid "Clock ID Constants" msgstr "時鐘 ID 常數" -#: ../../library/time.rst:841 +#: ../../library/time.rst:854 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "這些常數用作 :func:`clock_getres` 和 :func:`clock_gettime` 的參數。" -#: ../../library/time.rst:846 +#: ../../library/time.rst:859 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" "與 :data:`CLOCK_MONOTONIC` 基本相同,不同之處在於它還包括系統暫停的任何時間。" -#: ../../library/time.rst:849 +#: ../../library/time.rst:862 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" -"這允許應用程式獲取一個能夠感知暫停的單調時鐘,而無需處理 :data:" +"這允許應用程式取得一個能夠感知暫停的單調時鐘,而無需處理 :data:" "`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函式更改時間" "時可能會出現不連續的情況。" -#: ../../library/time.rst:861 +#: ../../library/time.rst:874 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " @@ -1547,13 +1560,13 @@ msgstr "" "Solaris 作業系統具有 ``CLOCK_HIGHRES`` 計時器,它嘗試使用最佳的硬體資源,並可" "能提供接近奈秒的解析度。``CLOCK_HIGHRES`` 是不可調整且高解析度的時鐘。" -#: ../../library/time.rst:872 +#: ../../library/time.rst:885 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "該時鐘無法被設定,其表示自某個未指定起點以來的單調時間。" -#: ../../library/time.rst:882 +#: ../../library/time.rst:895 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." @@ -1561,7 +1574,7 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC`,但提供對基於硬體的原始時間的存取,此時間不受 " "NTP 調整的影響。" -#: ../../library/time.rst:891 +#: ../../library/time.rst:904 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." @@ -1569,11 +1582,11 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC_RAW`,但讀取的是系統在情境切換時快取的值,因此" "精準度較低。" -#: ../../library/time.rst:901 ../../library/time.rst:910 +#: ../../library/time.rst:914 ../../library/time.rst:923 msgid "High-resolution per-process timer from the CPU." msgstr "來自 CPU 的高解析度每個行程的計時器。" -#: ../../library/time.rst:918 +#: ../../library/time.rst:931 msgid "" "`International Atomic Time `_" @@ -1581,18 +1594,18 @@ msgstr "" "`國際原子時間 `_" -#: ../../library/time.rst:920 +#: ../../library/time.rst:933 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" -"系統必須擁有當前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" +"系統必須擁有目前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" -#: ../../library/time.rst:929 +#: ../../library/time.rst:942 msgid "Thread-specific CPU-time clock." msgstr "執行緒相關的 CPU 時間時鐘。" -#: ../../library/time.rst:938 +#: ../../library/time.rst:951 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." @@ -1600,7 +1613,7 @@ msgstr "" "表示系統運作且無暫停的絕對時間,提供包括絕對時間 (absolute) 和時間區間 " "(interval) 的精確的正常上線時間 (uptime) 測量。" -#: ../../library/time.rst:949 +#: ../../library/time.rst:962 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " @@ -1609,7 +1622,7 @@ msgstr "" "單調增量的時鐘,從某個任意點開始計時,不受頻率或時間調整影響,並且在系統休眠" "時不增量。" -#: ../../library/time.rst:959 +#: ../../library/time.rst:972 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." @@ -1617,23 +1630,23 @@ msgstr "" "類似於 :data:`CLOCK_UPTIME_RAW`,但該值在情境切換時由系統快取,因此精準度較" "低。" -#: ../../library/time.rst:966 +#: ../../library/time.rst:979 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." msgstr "以下常數是唯一可以傳遞給 :func:`clock_settime` 的參數。" -#: ../../library/time.rst:972 +#: ../../library/time.rst:985 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "涵蓋整個系統的即時時鐘。設定此時鐘需要適當的權限。" -#: ../../library/time.rst:983 +#: ../../library/time.rst:996 msgid "Timezone Constants" msgstr "時區常數" -#: ../../library/time.rst:987 +#: ../../library/time.rst:1000 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1644,11 +1657,11 @@ msgstr "" "為單位)。若本地 DST 時區位於 UTC 以東(例如包括英國在內的西歐),則此值為負" "值。僅在 ``daylight`` 為非零時使用此值。詳情請參見下方註釋。" -#: ../../library/time.rst:993 +#: ../../library/time.rst:1006 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "如果定義了 DST 時區,則為非零值。詳情請參見下方註釋。" -#: ../../library/time.rst:997 +#: ../../library/time.rst:1010 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " @@ -1657,7 +1670,7 @@ msgstr "" "本地(非 DST)時區相對於 UTC 以西的偏移量(以秒為單位),西歐大多數地區為負," "美國為正,英國為零。詳情請參見下方註釋。" -#: ../../library/time.rst:1002 +#: ../../library/time.rst:1015 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " @@ -1666,7 +1679,7 @@ msgstr "" "一個包含兩個字串的元組:第一個是本地非 DST 時區的名稱,第二個是本地 DST 時區" "的名稱。如果沒有定義 DST 時區,則不應使用第二個字串。詳情請參見下方註釋。" -#: ../../library/time.rst:1008 +#: ../../library/time.rst:1021 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1678,21 +1691,21 @@ msgstr "" "對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` 和 :" "data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區規則" "決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳的 :attr:" -"`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來獲取時區資訊。" +"`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來取得時區資訊。" -#: ../../library/time.rst:1017 +#: ../../library/time.rst:1030 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:1018 +#: ../../library/time.rst:1031 msgid "More object-oriented interface to dates and times." msgstr "更多物件導向的日期和時間介面。" -#: ../../library/time.rst:1020 +#: ../../library/time.rst:1033 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:1021 +#: ../../library/time.rst:1034 msgid "" "Internationalization services. The locale setting affects the " "interpretation of many format specifiers in :func:`strftime` and :func:" @@ -1701,11 +1714,11 @@ msgstr "" "國際化服務。區域設定會影響 :func:`strftime` 和 :func:`strptime` 中許多格式指" "定符號 (format specifiers) 的解譯。" -#: ../../library/time.rst:1024 +#: ../../library/time.rst:1037 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:1025 +#: ../../library/time.rst:1038 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." @@ -1713,11 +1726,11 @@ msgstr "" "通用的日曆相關函式。:func:`~calendar.timegm` 是本模組中 :func:`gmtime` 的反函" "式。" -#: ../../library/time.rst:1029 +#: ../../library/time.rst:1042 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:1030 +#: ../../library/time.rst:1043 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1757,27 +1770,35 @@ msgstr "Coordinated Universal Time(世界協調時間)" msgid "Greenwich Mean Time" msgstr "Greenwich Mean Time(格林威治標準時間)" -#: ../../library/time.rst:59 +#: ../../library/time.rst:63 msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" -#: ../../library/time.rst:319 ../../library/time.rst:354 -#: ../../library/time.rst:720 +#: ../../library/time.rst:323 ../../library/time.rst:358 +#: ../../library/time.rst:733 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:354 ../../library/time.rst:720 +#: ../../library/time.rst:358 ../../library/time.rst:733 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:354 ../../library/time.rst:720 +#: ../../library/time.rst:358 ../../library/time.rst:733 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:416 ../../library/time.rst:575 +#: ../../library/time.rst:429 ../../library/time.rst:588 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:416 ../../library/time.rst:575 +#: ../../library/time.rst:429 ../../library/time.rst:588 msgid "datetime format" msgstr "datetime format(日期時間格式)" + +#~ msgid "" +#~ "UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, " +#~ "or GMT). The acronym UTC is not a mistake but a compromise between " +#~ "English and French." +#~ msgstr "" +#~ "UTC 是 Coordinated Universal Time --- 世界協調時間(原稱為格林威治標準時" +#~ "間,或 GMT)。縮寫 UTC 並不是寫錯,而是英文和法文之間折衷的結果。" diff --git a/library/timeit.po b/library/timeit.po index b7a9d153b8..a52e2b76e1 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -36,8 +36,8 @@ msgid "" "execution times. See also Tim Peters' introduction to the \"Algorithms\" " "chapter in the second edition of *Python Cookbook*, published by O'Reilly." msgstr "" -"該模組提供了一種對少量 Python 程式碼進行計時的簡單方法。它有一個\\ :ref:" -"`timeit-command-line-interface`\\ 和一個\\ :ref:`可呼叫介面 `,它避免了許多測量執行時間的常見陷阱。另請參閱由 O'Reilly 出版的 " "*Python 錦囊妙計 (Python Cookbook)* 第二版中 Tim Peters 所寫的「演算法」章節" "的介紹。" @@ -107,11 +107,11 @@ msgstr "" #: ../../library/timeit.rst:52 msgid "" "Note however that :func:`.timeit` will automatically determine the number of " -"repetitions only when the command-line interface is used. In the :ref:" -"`timeit-examples` section you can find more advanced examples." +"repetitions only when the command-line interface is used. In " +"the :ref:`timeit-examples` section you can find more advanced examples." msgstr "" -"但請注意,僅當使用命令列界面時 :func:`.timeit` 才會自動確定重複次數。在\\ :" -"ref:`timeit-examples`\\ 章節中有更進階的範例。" +"但請注意,僅當使用命令列介面時 :func:`.timeit` 才會自動確定重複次數。在" +"\\ :ref:`timeit-examples`\\ 章節中有更進階的範例。" #: ../../library/timeit.rst:60 msgid "Python Interface" @@ -157,8 +157,8 @@ msgid "" "The default timer, which is always time.perf_counter(), returns float " "seconds. An alternative, time.perf_counter_ns, returns integer nanoseconds." msgstr "" -"預設計時器始終為 time.perf_counter(),會回傳浮點秒數。另一種方法是 time." -"perf_counter_ns,會回傳整數奈秒。" +"預設計時器始終為 time.perf_counter(),會回傳浮點秒數。另一種方法是 " +"time.perf_counter_ns,會回傳整數奈秒。" #: ../../library/timeit.rst:95 msgid ":func:`time.perf_counter` is now the default timer." @@ -186,9 +186,9 @@ msgstr "" #: ../../library/timeit.rst:111 msgid "" -"To measure the execution time of the first statement, use the :meth:`." -"timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are " -"convenience methods to call :meth:`.timeit` multiple times." +"To measure the execution time of the first statement, use " +"the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` " +"methods are convenience methods to call :meth:`.timeit` multiple times." msgstr "" "要測量第一個陳述式的執行時間,請使用 :meth:`.timeit` 方法。:meth:`.repeat` " "和 :meth:`.autorange` 方法是多次呼叫 :meth:`.timeit` 的便捷方法。" @@ -313,6 +313,11 @@ msgid "" "except Exception:\n" " t.print_exc()" msgstr "" +"t = Timer(...) # 在 try/except 之外\n" +"try:\n" +" t.timeit(...) # 或 t.repeat(...)\n" +"except Exception:\n" +" t.print_exc()" #: ../../library/timeit.rst:199 msgid "" @@ -359,8 +364,8 @@ msgid "" "measure process time, not wallclock time, using :func:`time.process_time` " "instead of :func:`time.perf_counter`, which is the default" msgstr "" -"若要測量行程時間 (process time) 而非掛鐘時間 (wallclock time),請使用 :func:" -"`time.process_time` 而不是預設的 :func:`time.perf_counter`" +"若要測量行程時間 (process time) 而非掛鐘時間 (wallclock time),請使" +"用 :func:`time.process_time` 而不是預設的 :func:`time.perf_counter`" #: ../../library/timeit.rst:238 msgid "" @@ -401,15 +406,15 @@ msgstr "" msgid "" ":func:`default_timer` measurements can be affected by other programs running " "on the same machine, so the best thing to do when accurate timing is " -"necessary is to repeat the timing a few times and use the best time. The :" -"option:`-r` option is good for this; the default of 5 repetitions is " +"necessary is to repeat the timing a few times and use the best time. " +"The :option:`-r` option is good for this; the default of 5 repetitions is " "probably enough in most cases. You can use :func:`time.process_time` to " "measure CPU time." msgstr "" ":func:`default_timer` 測量可能會受到同一台機器上運行的其他程式的影響,因此," "當需要精確計時時,最好的做法是重複計時幾次並使用最佳時間。:option:`-r` 選項對" -"此很有用;在大多數情況下,預設的重複 5 次可能就足夠了。你可以使用 :func:" -"`time.process_time` 來測量 CPU 時間。" +"此很有用;在大多數情況下,預設的重複 5 次可能就足夠了。你可以使" +"用 :func:`time.process_time` 來測量 CPU 時間。" #: ../../library/timeit.rst:267 msgid "" @@ -437,15 +442,15 @@ msgid "" "$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " "text\"\n" "5000000 loops, best of 5: 0.0877 usec per loop\n" -"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." -"find(char)\"\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" " +"\"text.find(char)\"\n" "1000000 loops, best of 5: 0.342 usec per loop" msgstr "" "$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " "text\"\n" "5000000 loops, best of 5: 0.0877 usec per loop\n" -"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." -"find(char)\"\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" " +"\"text.find(char)\"\n" "1000000 loops, best of 5: 0.342 usec per loop" #: ../../library/timeit.rst:287 @@ -507,11 +512,12 @@ msgstr "" #: ../../library/timeit.rst:312 msgid "" "The following examples show how to time expressions that contain multiple " -"lines. Here we compare the cost of using :func:`hasattr` vs. :keyword:`try`/:" -"keyword:`except` to test for missing and present object attributes:" +"lines. Here we compare the cost of using :func:`hasattr` " +"vs. :keyword:`try`/:keyword:`except` to test for missing and present object " +"attributes:" msgstr "" -"以下範例展示如何對包含多行的運算式進行計時。這裡我們使用 :func:`hasattr` 與 :" -"keyword:`try`/:keyword:`except` 來測試缺失和存在之物件屬性並比較其花費 " +"以下範例展示如何對包含多行的運算式進行計時。這裡我們使用 :func:`hasattr` " +"與 :keyword:`try`/:keyword:`except` 來測試缺失和存在之物件屬性並比較其花費 " "(cost):" #: ../../library/timeit.rst:316 @@ -614,6 +620,13 @@ msgid "" " import timeit\n" " print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" msgstr "" +"def test():\n" +" \"\"\"一個笨笨的測試函式\"\"\"\n" +" L = [i for i in range(100)]\n" +"\n" +"if __name__ == '__main__':\n" +" import timeit\n" +" print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" #: ../../library/timeit.rst:369 msgid "" @@ -621,7 +634,7 @@ msgid "" "will cause the code to be executed within your current global namespace. " "This can be more convenient than individually specifying imports::" msgstr "" -"另一種選擇是將 :func:`globals` 傳遞給 *globals* 參數,這將導致程式碼在當前的" +"另一種選擇是將 :func:`globals` 傳遞給 *globals* 參數,這將導致程式碼在目前的" "全域命名空間中執行,這比單獨指定 import 更方便: ::" #: ../../library/timeit.rst:373 diff --git a/library/tk.po b/library/tk.po index 7b366eefa0..5a3fc9a8d8 100644 --- a/library/tk.po +++ b/library/tk.po @@ -25,28 +25,27 @@ msgid "Graphical User Interfaces with Tk" msgstr "以 Tk 打造圖形使用者介面 (Graphical User Interfaces)" #: ../../library/tk.rst:13 -#, fuzzy msgid "" "Tk/Tcl has long been an integral part of Python. It provides a robust and " "platform independent windowing toolkit, that is available to Python " -"programmers using the :mod:`tkinter` package, and its extension, the :mod:" -"`tkinter.ttk` module." +"programmers using the :mod:`tkinter` package, and its extension, " +"the :mod:`tkinter.ttk` module." msgstr "" "Tk/Tcl 長期以來一直是 Python 不可或缺的一部分。它提供了一個強大且獨立於平台的" -"視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.tix` 和 :" -"mod:`tkinter.ttk` 模組的 Python 開發者使用。" +"視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.ttk` 模組" +"的 Python 開發者使用。" #: ../../library/tk.rst:17 msgid "" "The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. " "To use :mod:`tkinter`, you don't need to write Tcl code, but you will need " -"to consult the Tk documentation, and occasionally the Tcl documentation. :" -"mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python " -"classes." +"to consult the Tk documentation, and occasionally the Tcl " +"documentation. :mod:`tkinter` is a set of wrappers that implement the Tk " +"widgets as Python classes." msgstr "" -":mod:`tkinter` 套件是 Tcl/Tk 之上的一個輕薄物件導向層。要使用 :mod:" -"`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文件。:mod:" -"`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" +":mod:`tkinter` 套件是 Tcl/Tk 之上的一個輕薄物件導向層。要使" +"用 :mod:`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文" +"件。:mod:`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" #: ../../library/tk.rst:23 msgid "" @@ -60,10 +59,10 @@ msgid "" "GuiProgramming>`_." msgstr "" ":mod:`tkinter` 的主要優點是速度快,而且通常與 Python 捆綁 (bundle) 在一起。儘" -"管其標準文件不是很完整,但還是有些不錯的材料,包括:參考資料、教學、書籍等。:" -"mod:`tkinter` 曾因其過時的外觀而眾所皆知,但這在 Tk 8.5 中得到了極大的改進。" -"此外,還有許多其他你可能會感興趣的 GUI 函式庫。Python wiki 列出了幾個替代的 " -"`GUI 框架和工具 `_。" +"管其標準文件不是很完整,但還是有些不錯的材料,包括:參考資料、教學、書籍" +"等。:mod:`tkinter` 曾因其過時的外觀而眾所皆知,但這在 Tk 8.5 中得到了極大的改" +"進。此外,還有許多其他你可能會感興趣的 GUI 函式庫。Python wiki 列出了幾個替代" +"的 `GUI 框架和工具 `_。" #: ../../library/tk.rst:7 msgid "GUI" diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 52ae5a7140..6dc7058647 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -77,11 +77,9 @@ msgstr "" #: ../../library/tkinter.ttk.rst:43 msgid "" -"That code causes several :mod:`tkinter.ttk` widgets (:class:`Button`, :class:" -"`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:" -"`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:" -"`Radiobutton`, :class:`Scale` and :class:`Scrollbar`) to automatically " -"replace the Tk widgets." +"That code causes several :mod:`tkinter.ttk` widgets " +"(:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale` " +"and :class:`Scrollbar`) to automatically replace the Tk widgets." msgstr "" #: ../../library/tkinter.ttk.rst:49 @@ -96,8 +94,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:59 msgid "" -"`Converting existing applications to use Tile widgets `_" +"`Converting existing applications to use Tile widgets `_" msgstr "" #: ../../library/tkinter.ttk.rst:60 @@ -112,13 +110,11 @@ msgstr "" #: ../../library/tkinter.ttk.rst:67 msgid "" -"Ttk comes with 18 widgets, twelve of which already existed in tkinter: :" -"class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:" -"`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :" -"class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, and :class:" -"`Spinbox`. The other six are new: :class:`Combobox`, :class:`Notebook`, :" -"class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` and :class:" -"`Treeview`. And all them are subclasses of :class:`Widget`." +"Ttk comes with 18 widgets, twelve of which already existed in " +"tkinter: :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, " +"and :class:`Spinbox`. The other six are " +"new: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` " +"and :class:`Treeview`. And all them are subclasses of :class:`Widget`." msgstr "" #: ../../library/tkinter.ttk.rst:75 @@ -537,11 +533,10 @@ msgstr "" #: ../../library/tkinter.ttk.rst:300 msgid "" -"Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" -"meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " -"and :meth:`Widget.state`, and the following inherited from :class:`Entry`: :" -"meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry." -"index`, :meth:`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`, " +"Besides the methods inherited " +"from :class:`Widget`: :meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " +"and :meth:`Widget.state`, and the following inherited " +"from :class:`Entry`: :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`, " "it has some other methods, described at :class:`ttk.Combobox`." msgstr "" @@ -669,12 +664,11 @@ msgstr "" #: ../../library/tkinter.ttk.rst:388 msgid "" -"Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" -"meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " -"and :meth:`Widget.state`, and the following inherited from :class:`Entry`: :" -"meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry." -"index`, :meth:`Entry.insert`, :meth:`Entry.xview`, it has some other " -"methods, described at :class:`ttk.Spinbox`." +"Besides the methods inherited " +"from :class:`Widget`: :meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " +"and :meth:`Widget.state`, and the following inherited " +"from :class:`Entry`: :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.xview`, " +"it has some other methods, described at :class:`ttk.Spinbox`." msgstr "" #: ../../library/tkinter.ttk.rst:405 @@ -842,8 +836,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:523 msgid "" -"Specifies an image to display in the tab. See the option image described in :" -"class:`Widget`." +"Specifies an image to display in the tab. See the option image described " +"in :class:`Widget`." msgstr "" #: ../../library/tkinter.ttk.rst:526 @@ -855,8 +849,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:530 msgid "" "Specifies the index (0-based) of a character to underline in the text " -"string. The underlined character is used for mnemonic activation if :meth:" -"`Notebook.enable_traversal` is called." +"string. The underlined character is used for mnemonic activation " +"if :meth:`Notebook.enable_traversal` is called." msgstr "" #: ../../library/tkinter.ttk.rst:538 @@ -1112,9 +1106,9 @@ msgstr "ttk.Progressbar" #: ../../library/tkinter.ttk.rst:705 msgid "" -"Begin autoincrement mode: schedules a recurring timer event that calls :meth:" -"`Progressbar.step` every *interval* milliseconds. If omitted, *interval* " -"defaults to 50 milliseconds." +"Begin autoincrement mode: schedules a recurring timer event that " +"calls :meth:`Progressbar.step` every *interval* milliseconds. If omitted, " +"*interval* defaults to 50 milliseconds." msgstr "" #: ../../library/tkinter.ttk.rst:712 @@ -1127,8 +1121,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:719 msgid "" -"Stop autoincrement mode: cancels any recurring timer event initiated by :" -"meth:`Progressbar.start` for this progress bar." +"Stop autoincrement mode: cancels any recurring timer event initiated " +"by :meth:`Progressbar.start` for this progress bar." msgstr "" #: ../../library/tkinter.ttk.rst:724 @@ -1235,8 +1229,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:795 msgid "" "The Treeview widget supports horizontal and vertical scrolling, according to " -"the options described in `Scrollable Widget Options`_ and the methods :meth:" -"`Treeview.xview` and :meth:`Treeview.yview`." +"the options described in `Scrollable Widget Options`_ and the " +"methods :meth:`Treeview.xview` and :meth:`Treeview.yview`." msgstr "" #: ../../library/tkinter.ttk.rst:810 @@ -1909,8 +1903,8 @@ msgid "" "elements making up the widget and how they are arranged, along with dynamic " "and default settings for element options. By default the style name is the " "same as the widget's class name, but it may be overridden by the widget's " -"style option. If you don't know the class name of a widget, use the method :" -"meth:`Misc.winfo_class` (somewidget.winfo_class())." +"style option. If you don't know the class name of a widget, use the " +"method :meth:`Misc.winfo_class` (somewidget.winfo_class())." msgstr "" #: ../../library/tkinter.ttk.rst:1275 @@ -2245,9 +2239,8 @@ msgid "" msgstr "" #: ../../library/tkinter.ttk.rst:1465 -#, fuzzy msgid "margins=padding" -msgstr "padding=padding" +msgstr "margins=padding" #: ../../library/tkinter.ttk.rst:1466 msgid "" @@ -2318,9 +2311,9 @@ msgstr "" msgid "" "Each key in *settings* is a style and each value may contain the keys " "'configure', 'map', 'layout' and 'element create' and they are expected to " -"have the same format as specified by the methods :meth:`Style.configure`, :" -"meth:`Style.map`, :meth:`Style.layout` and :meth:`Style.element_create` " -"respectively." +"have the same format as specified by the " +"methods :meth:`Style.configure`, :meth:`Style.map`, :meth:`Style.layout` " +"and :meth:`Style.element_create` respectively." msgstr "" #: ../../library/tkinter.ttk.rst:1532 diff --git a/library/token.po b/library/token.po index bd30000c13..28c57739a7 100644 --- a/library/token.po +++ b/library/token.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-25 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,267 +41,425 @@ msgid "" "functions. The functions mirror definitions in the Python C header files." msgstr "" -#: ../../library/token.rst:25 +#: ../../library/token.rst:22 +msgid "" +"Note that a token's value may depend on tokenizer options. For example, a " +"``\"+\"`` token may be reported as either :data:`PLUS` or :data:`OP`, or a " +"``\"match\"`` token may be either :data:`NAME` or :data:`SOFT_KEYWORD`." +msgstr "" + +#: ../../library/token.rst:29 msgid "" "Dictionary mapping the numeric values of the constants defined in this " "module back to name strings, allowing more human-readable representation of " "parse trees to be generated." msgstr "" -#: ../../library/token.rst:32 +#: ../../library/token.rst:36 msgid "Return ``True`` for terminal token values." msgstr "" -#: ../../library/token.rst:37 +#: ../../library/token.rst:41 msgid "Return ``True`` for non-terminal token values." msgstr "" -#: ../../library/token.rst:42 +#: ../../library/token.rst:46 msgid "Return ``True`` if *x* is the marker indicating the end of input." msgstr "" -#: ../../library/token.rst:45 +#: ../../library/token.rst:49 msgid "The token constants are:" msgstr "" -#: ../../library/token-list.inc:18 -msgid "Token value for ``\"(\"``." +#: ../../library/token.rst:53 +msgid "" +"Token value that indicates an :ref:`identifier `. Note that " +"keywords are also initially tokenized an ``NAME`` tokens." msgstr "" -#: ../../library/token-list.inc:22 -msgid "Token value for ``\")\"``." +#: ../../library/token.rst:58 +msgid "Token value that indicates a :ref:`numeric literal `" msgstr "" -#: ../../library/token-list.inc:26 -msgid "Token value for ``\"[\"``." +#: ../../library/token.rst:62 +msgid "" +"Token value that indicates a :ref:`string or byte literal `, " +"excluding :ref:`formatted string literals `. The token string is " +"not interpreted: it includes the surrounding quotation marks and the prefix " +"(if given); backslashes are included literally, without processing escape " +"sequences." msgstr "" -#: ../../library/token-list.inc:30 -msgid "Token value for ``\"]\"``." +#: ../../library/token.rst:70 +msgid "" +"A generic token value that indicates an :ref:`operator ` or :ref:" +"`delimiter `." msgstr "" -#: ../../library/token-list.inc:34 -msgid "Token value for ``\":\"``." +#: ../../library/token.rst:75 +msgid "" +"This value is only reported by the :mod:`tokenize` module. Internally, the " +"tokenizer uses :ref:`exact token types ` instead." msgstr "" -#: ../../library/token-list.inc:38 -msgid "Token value for ``\",\"``." +#: ../../library/token.rst:81 +msgid "" +"Token value used to indicate a comment. The parser ignores :data:`!COMMENT` " +"tokens." msgstr "" -#: ../../library/token-list.inc:42 -msgid "Token value for ``\";\"``." +#: ../../library/token.rst:86 +msgid "" +"Token value that indicates the end of a :ref:`logical line `." msgstr "" -#: ../../library/token-list.inc:46 -msgid "Token value for ``\"+\"``." +#: ../../library/token.rst:90 +msgid "" +"Token value used to indicate a non-terminating newline. :data:`!NL` tokens " +"are generated when a logical line of code is continued over multiple " +"physical lines. The parser ignores :data:`!NL` tokens." msgstr "" -#: ../../library/token-list.inc:50 -msgid "Token value for ``\"-\"``." +#: ../../library/token.rst:96 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the start of an :ref:`indented block `." msgstr "" -#: ../../library/token-list.inc:54 -msgid "Token value for ``\"*\"``." +#: ../../library/token.rst:101 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the end of an :ref:`indented block `." msgstr "" -#: ../../library/token-list.inc:58 -msgid "Token value for ``\"/\"``." +#: ../../library/token.rst:106 +msgid "" +"Token value used to indicate the beginning of an :ref:`f-string literal `." msgstr "" -#: ../../library/token-list.inc:62 -msgid "Token value for ``\"|\"``." +#: ../../library/token.rst:111 +msgid "" +"The token string includes the prefix and the opening quote(s), but none of " +"the contents of the literal." msgstr "" -#: ../../library/token-list.inc:66 -msgid "Token value for ``\"&\"``." +#: ../../library/token.rst:116 +msgid "" +"Token value used for literal text inside an :ref:`f-string literal `, including format specifications." msgstr "" -#: ../../library/token-list.inc:70 -msgid "Token value for ``\"<\"``." +#: ../../library/token.rst:121 +msgid "" +"Replacement fields (that is, the non-literal parts of f-strings) use the " +"same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" +"`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." msgstr "" -#: ../../library/token-list.inc:74 -msgid "Token value for ``\">\"``." +#: ../../library/token.rst:128 +msgid "Token value used to indicate the end of a :ref:`f-string `." msgstr "" -#: ../../library/token-list.inc:78 -msgid "Token value for ``\"=\"``." +#: ../../library/token.rst:132 +msgid "The token string contains the closing quote(s)." msgstr "" -#: ../../library/token-list.inc:82 -msgid "Token value for ``\".\"``." +#: ../../library/token.rst:136 +msgid "Token value that indicates the end of input." msgstr "" -#: ../../library/token-list.inc:86 -msgid "Token value for ``\"%\"``." +#: ../../library/token.rst:140 +msgid "" +"Token value that indicates the encoding used to decode the source bytes into " +"text. The first token returned by :func:`tokenize.tokenize` will always be " +"an ``ENCODING`` token." msgstr "" -#: ../../library/token-list.inc:90 -msgid "Token value for ``\"{\"``." +#: ../../library/token.rst:146 +msgid "" +"This token type isn't used by the C tokenizer but is needed for the :mod:" +"`tokenize` module." msgstr "" -#: ../../library/token-list.inc:94 -msgid "Token value for ``\"}\"``." +#: ../../library/token.rst:150 +msgid "" +"The following token types are not produced by the :mod:`tokenize` module, " +"and are defined for special uses in the tokenizer or parser:" msgstr "" -#: ../../library/token-list.inc:98 -msgid "Token value for ``\"==\"``." +#: ../../library/token.rst:155 +msgid "" +"Token value indicating that a ``type: ignore`` comment was recognized. Such " +"tokens are produced instead of regular :data:`COMMENT` tokens only with the :" +"data:`~ast.PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token-list.inc:102 -msgid "Token value for ``\"!=\"``." +#: ../../library/token.rst:161 +msgid "" +"Token value indicating that a type comment was recognized. Such tokens are " +"produced instead of regular :data:`COMMENT` tokens only with the :data:`~ast." +"PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token-list.inc:106 -msgid "Token value for ``\"<=\"``." +#: ../../library/token.rst:167 +msgid "Token value indicating a :ref:`soft keyword `." msgstr "" -#: ../../library/token-list.inc:110 -msgid "Token value for ``\">=\"``." +#: ../../library/token.rst:169 +msgid "" +"The tokenizer never produces this value. To check for a soft keyword, pass " +"a :data:`NAME` token's string to :func:`keyword.issoftkeyword`." msgstr "" -#: ../../library/token-list.inc:114 -msgid "Token value for ``\"~\"``." +#: ../../library/token.rst:175 +msgid "Token value used to indicate wrong input." msgstr "" -#: ../../library/token-list.inc:118 -msgid "Token value for ``\"^\"``." +#: ../../library/token.rst:177 +msgid "" +"The :mod:`tokenize` module generally indicates errors by raising exceptions " +"instead of emitting this token. It can also emit tokens such as :data:`OP` " +"or :data:`NAME` with strings that are later rejected by the parser." msgstr "" -#: ../../library/token-list.inc:122 -msgid "Token value for ``\"<<\"``." +#: ../../library/token.rst:185 +msgid "" +"The remaining tokens represent specific :ref:`operators ` and :" +"ref:`delimiters `. (The :mod:`tokenize` module reports these as :" +"data:`OP`; see ``exact_type`` in the :mod:`tokenize` documentation for " +"details.)" msgstr "" -#: ../../library/token-list.inc:126 -msgid "Token value for ``\">>\"``." +#: ../../library/token-list.inc:7 +msgid "Token" msgstr "" -#: ../../library/token-list.inc:130 -msgid "Token value for ``\"**\"``." +#: ../../library/token-list.inc:8 +msgid "Value" msgstr "" -#: ../../library/token-list.inc:134 -msgid "Token value for ``\"+=\"``." +#: ../../library/token-list.inc:10 +msgid "``\"(\"``" msgstr "" -#: ../../library/token-list.inc:138 -msgid "Token value for ``\"-=\"``." +#: ../../library/token-list.inc:12 +msgid "``\")\"``" msgstr "" -#: ../../library/token-list.inc:142 -msgid "Token value for ``\"*=\"``." +#: ../../library/token-list.inc:14 +msgid "``\"[\"``" msgstr "" -#: ../../library/token-list.inc:146 -msgid "Token value for ``\"/=\"``." +#: ../../library/token-list.inc:16 +msgid "``\"]\"``" msgstr "" -#: ../../library/token-list.inc:150 -msgid "Token value for ``\"%=\"``." +#: ../../library/token-list.inc:18 +msgid "``\":\"``" msgstr "" -#: ../../library/token-list.inc:154 -msgid "Token value for ``\"&=\"``." +#: ../../library/token-list.inc:20 +msgid "``\",\"``" msgstr "" -#: ../../library/token-list.inc:158 -msgid "Token value for ``\"|=\"``." +#: ../../library/token-list.inc:22 +msgid "``\";\"``" msgstr "" -#: ../../library/token-list.inc:162 -msgid "Token value for ``\"^=\"``." +#: ../../library/token-list.inc:24 +msgid "``\"+\"``" msgstr "" -#: ../../library/token-list.inc:166 -msgid "Token value for ``\"<<=\"``." +#: ../../library/token-list.inc:26 +msgid "``\"-\"``" msgstr "" -#: ../../library/token-list.inc:170 -msgid "Token value for ``\">>=\"``." +#: ../../library/token-list.inc:28 +msgid "``\"*\"``" msgstr "" -#: ../../library/token-list.inc:174 -msgid "Token value for ``\"**=\"``." +#: ../../library/token-list.inc:30 +msgid "``\"/\"``" msgstr "" -#: ../../library/token-list.inc:178 -msgid "Token value for ``\"//\"``." +#: ../../library/token-list.inc:32 +msgid "``\"|\"``" msgstr "" -#: ../../library/token-list.inc:182 -msgid "Token value for ``\"//=\"``." +#: ../../library/token-list.inc:34 +msgid "``\"&\"``" msgstr "" -#: ../../library/token-list.inc:186 -msgid "Token value for ``\"@\"``." +#: ../../library/token-list.inc:36 +msgid "``\"<\"``" msgstr "" -#: ../../library/token-list.inc:190 -msgid "Token value for ``\"@=\"``." +#: ../../library/token-list.inc:38 +msgid "``\">\"``" msgstr "" -#: ../../library/token-list.inc:194 -msgid "Token value for ``\"->\"``." +#: ../../library/token-list.inc:40 +msgid "``\"=\"``" msgstr "" -#: ../../library/token-list.inc:198 -msgid "Token value for ``\"...\"``." +#: ../../library/token-list.inc:42 +msgid "``\".\"``" msgstr "" -#: ../../library/token-list.inc:202 -msgid "Token value for ``\":=\"``." +#: ../../library/token-list.inc:44 +msgid "``\"%\"``" msgstr "" -#: ../../library/token-list.inc:206 -msgid "Token value for ``\"!\"``." +#: ../../library/token-list.inc:46 +msgid "``\"{\"``" msgstr "" -#: ../../library/token.rst:49 -msgid "" -"The following token type values aren't used by the C tokenizer but are " -"needed for the :mod:`tokenize` module." +#: ../../library/token-list.inc:48 +msgid "``\"}\"``" msgstr "" -#: ../../library/token.rst:55 -msgid "Token value used to indicate a comment." +#: ../../library/token-list.inc:50 +msgid "``\"==\"``" msgstr "" -#: ../../library/token.rst:61 -msgid "" -"Token value used to indicate a non-terminating newline. The :data:`NEWLINE` " -"token indicates the end of a logical line of Python code; ``NL`` tokens are " -"generated when a logical line of code is continued over multiple physical " -"lines." +#: ../../library/token-list.inc:52 +msgid "``\"!=\"``" msgstr "" -#: ../../library/token.rst:69 -msgid "" -"Token value that indicates the encoding used to decode the source bytes into " -"text. The first token returned by :func:`tokenize.tokenize` will always be " -"an ``ENCODING`` token." +#: ../../library/token-list.inc:54 +msgid "``\"<=\"``" msgstr "" -#: ../../library/token.rst:77 +#: ../../library/token-list.inc:56 +msgid "``\">=\"``" +msgstr "" + +#: ../../library/token-list.inc:58 +msgid "``\"~\"``" +msgstr "" + +#: ../../library/token-list.inc:60 +msgid "``\"^\"``" +msgstr "" + +#: ../../library/token-list.inc:62 +msgid "``\"<<\"``" +msgstr "" + +#: ../../library/token-list.inc:64 +msgid "``\">>\"``" +msgstr "" + +#: ../../library/token-list.inc:66 +msgid "``\"**\"``" +msgstr "" + +#: ../../library/token-list.inc:68 +msgid "``\"+=\"``" +msgstr "" + +#: ../../library/token-list.inc:70 +msgid "``\"-=\"``" +msgstr "" + +#: ../../library/token-list.inc:72 +msgid "``\"*=\"``" +msgstr "" + +#: ../../library/token-list.inc:74 +msgid "``\"/=\"``" +msgstr "" + +#: ../../library/token-list.inc:76 +msgid "``\"%=\"``" +msgstr "" + +#: ../../library/token-list.inc:78 +msgid "``\"&=\"``" +msgstr "" + +#: ../../library/token-list.inc:80 +msgid "``\"|=\"``" +msgstr "" + +#: ../../library/token-list.inc:82 +msgid "``\"^=\"``" +msgstr "" + +#: ../../library/token-list.inc:84 +msgid "``\"<<=\"``" +msgstr "" + +#: ../../library/token-list.inc:86 +msgid "``\">>=\"``" +msgstr "" + +#: ../../library/token-list.inc:88 +msgid "``\"**=\"``" +msgstr "" + +#: ../../library/token-list.inc:90 +msgid "``\"//\"``" +msgstr "" + +#: ../../library/token-list.inc:92 +msgid "``\"//=\"``" +msgstr "" + +#: ../../library/token-list.inc:94 +msgid "``\"@\"``" +msgstr "" + +#: ../../library/token-list.inc:96 +msgid "``\"@=\"``" +msgstr "" + +#: ../../library/token-list.inc:98 +msgid "``\"->\"``" +msgstr "" + +#: ../../library/token-list.inc:100 +msgid "``\"...\"``" +msgstr "" + +#: ../../library/token-list.inc:102 +msgid "``\":=\"``" +msgstr "" + +#: ../../library/token-list.inc:104 +msgid "``\"!\"``" +msgstr "" + +#: ../../library/token.rst:193 +msgid "The following non-token constants are provided:" +msgstr "" + +#: ../../library/token.rst:197 +msgid "The number of token types defined in this module." +msgstr "" + +#: ../../library/token.rst:204 msgid "" -"Token value indicating that a type comment was recognized. Such tokens are " -"only produced when :func:`ast.parse` is invoked with ``type_comments=True``." +"A dictionary mapping the string representation of a token to its numeric " +"code." msgstr "" -#: ../../library/token.rst:82 +#: ../../library/token.rst:209 msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" -#: ../../library/token.rst:85 +#: ../../library/token.rst:212 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" -#: ../../library/token.rst:88 +#: ../../library/token.rst:215 msgid "" "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " "are now tokenized as :data:`NAME` tokens." msgstr "" -#: ../../library/token.rst:92 +#: ../../library/token.rst:219 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" "data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " @@ -309,6 +467,10 @@ msgid "" "set to 6 or lower)." msgstr "" -#: ../../library/token.rst:98 +#: ../../library/token.rst:225 +msgid "Added :data:`EXCLAMATION`." +msgstr "" + +#: ../../library/token.rst:228 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." msgstr "" diff --git a/library/tokenize.po b/library/tokenize.po index 32d1dd0754..c5081d3b15 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-01-20 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,18 +35,18 @@ msgstr "" #: ../../library/tokenize.rst:19 msgid "" -"To simplify token stream handling, all :ref:`operator ` and :ref:" -"`delimiter ` tokens and :data:`Ellipsis` are returned using the " -"generic :data:`~token.OP` token type. The exact type can be determined by " -"checking the ``exact_type`` property on the :term:`named tuple` returned " -"from :func:`tokenize.tokenize`." +"To simplify token stream handling, all :ref:`operator ` " +"and :ref:`delimiter ` tokens and :data:`Ellipsis` are returned " +"using the generic :data:`~token.OP` token type. The exact type can be " +"determined by checking the ``exact_type`` property on the :term:`named " +"tuple` returned from :func:`tokenize.tokenize`." msgstr "" #: ../../library/tokenize.rst:28 msgid "" "Note that the functions in this module are only designed to parse " -"syntactically valid Python code (code that does not raise when parsed using :" -"func:`ast.parse`). The behavior of the functions in this module is " +"syntactically valid Python code (code that does not raise when parsed " +"using :func:`ast.parse`). The behavior of the functions in this module is " "**undefined** when providing invalid Python code and it can change at any " "point." msgstr "" @@ -63,9 +62,9 @@ msgstr "" #: ../../library/tokenize.rst:41 msgid "" "The :func:`.tokenize` generator requires one argument, *readline*, which " -"must be a callable object which provides the same interface as the :meth:`io." -"IOBase.readline` method of file objects. Each call to the function should " -"return one line of input as bytes." +"must be a callable object which provides the same interface as " +"the :meth:`io.IOBase.readline` method of file objects. Each call to the " +"function should return one line of input as bytes." msgstr "" #: ../../library/tokenize.rst:46 @@ -114,14 +113,14 @@ msgstr "" #: ../../library/tokenize.rst:77 msgid "" -"The result is an iterator yielding named tuples, exactly like :func:`." -"tokenize`. It does not yield an :data:`~token.ENCODING` token." +"The result is an iterator yielding named tuples, exactly " +"like :func:`.tokenize`. It does not yield an :data:`~token.ENCODING` token." msgstr "" #: ../../library/tokenize.rst:80 msgid "" -"All constants from the :mod:`token` module are also exported from :mod:" -"`tokenize`." +"All constants from the :mod:`token` module are also exported " +"from :mod:`tokenize`." msgstr "" #: ../../library/tokenize.rst:83 @@ -140,40 +139,39 @@ msgstr "" #: ../../library/tokenize.rst:94 msgid "" -"The reconstructed script is returned as a single string. The result is " -"guaranteed to tokenize back to match the input so that the conversion is " -"lossless and round-trips are assured. The guarantee applies only to the " -"token type and token string as the spacing between tokens (column positions) " -"may change." +"The result is guaranteed to tokenize back to match the input so that the " +"conversion is lossless and round-trips are assured. The guarantee applies " +"only to the token type and token string as the spacing between tokens " +"(column positions) may change." msgstr "" -#: ../../library/tokenize.rst:100 +#: ../../library/tokenize.rst:99 msgid "" "It returns bytes, encoded using the :data:`~token.ENCODING` token, which is " "the first token sequence output by :func:`.tokenize`. If there is no " "encoding token in the input, it returns a str instead." msgstr "" -#: ../../library/tokenize.rst:105 +#: ../../library/tokenize.rst:104 msgid "" ":func:`.tokenize` needs to detect the encoding of source files it tokenizes. " "The function it uses to do this is available:" msgstr "" -#: ../../library/tokenize.rst:110 +#: ../../library/tokenize.rst:109 msgid "" "The :func:`detect_encoding` function is used to detect the encoding that " "should be used to decode a Python source file. It requires one argument, " "readline, in the same way as the :func:`.tokenize` generator." msgstr "" -#: ../../library/tokenize.rst:114 +#: ../../library/tokenize.rst:113 msgid "" "It will call readline a maximum of twice, and return the encoding used (as a " "string) and a list of any lines (not decoded from bytes) it has read in." msgstr "" -#: ../../library/tokenize.rst:118 +#: ../../library/tokenize.rst:117 msgid "" "It detects the encoding from the presence of a UTF-8 BOM or an encoding " "cookie as specified in :pep:`263`. If both a BOM and a cookie are present, " @@ -181,31 +179,31 @@ msgid "" "found, ``'utf-8-sig'`` will be returned as an encoding." msgstr "" -#: ../../library/tokenize.rst:123 +#: ../../library/tokenize.rst:122 msgid "" "If no encoding is specified, then the default of ``'utf-8'`` will be " "returned." msgstr "" -#: ../../library/tokenize.rst:126 +#: ../../library/tokenize.rst:125 msgid "" -"Use :func:`.open` to open Python source files: it uses :func:" -"`detect_encoding` to detect the file encoding." +"Use :func:`.open` to open Python source files: it " +"uses :func:`detect_encoding` to detect the file encoding." msgstr "" -#: ../../library/tokenize.rst:132 +#: ../../library/tokenize.rst:131 msgid "" -"Open a file in read only mode using the encoding detected by :func:" -"`detect_encoding`." +"Open a file in read only mode using the encoding detected " +"by :func:`detect_encoding`." msgstr "" -#: ../../library/tokenize.rst:139 +#: ../../library/tokenize.rst:138 msgid "" "Raised when either a docstring or expression that may be split over several " "lines is not completed anywhere in the file, for example::" msgstr "" -#: ../../library/tokenize.rst:142 +#: ../../library/tokenize.rst:141 msgid "" "\"\"\"Beginning of\n" "docstring" @@ -213,11 +211,11 @@ msgstr "" "\"\"\"Beginning of\n" "docstring" -#: ../../library/tokenize.rst:145 +#: ../../library/tokenize.rst:144 msgid "or::" msgstr "或是: ::" -#: ../../library/tokenize.rst:147 +#: ../../library/tokenize.rst:146 msgid "" "[1,\n" " 2,\n" @@ -227,49 +225,49 @@ msgstr "" " 2,\n" " 3" -#: ../../library/tokenize.rst:154 +#: ../../library/tokenize.rst:153 msgid "Command-Line Usage" msgstr "" -#: ../../library/tokenize.rst:158 +#: ../../library/tokenize.rst:157 msgid "" "The :mod:`tokenize` module can be executed as a script from the command " "line. It is as simple as:" msgstr "" -#: ../../library/tokenize.rst:161 +#: ../../library/tokenize.rst:160 msgid "python -m tokenize [-e] [filename.py]" msgstr "python -m tokenize [-e] [filename.py]" -#: ../../library/tokenize.rst:165 +#: ../../library/tokenize.rst:164 msgid "The following options are accepted:" -msgstr "" +msgstr "可接受以下選項:" -#: ../../library/tokenize.rst:171 +#: ../../library/tokenize.rst:170 msgid "show this help message and exit" msgstr "" -#: ../../library/tokenize.rst:175 +#: ../../library/tokenize.rst:174 msgid "display token names using the exact type" msgstr "" -#: ../../library/tokenize.rst:177 +#: ../../library/tokenize.rst:176 msgid "" "If :file:`filename.py` is specified its contents are tokenized to stdout. " "Otherwise, tokenization is performed on stdin." msgstr "" -#: ../../library/tokenize.rst:181 +#: ../../library/tokenize.rst:180 msgid "Examples" msgstr "範例" -#: ../../library/tokenize.rst:183 +#: ../../library/tokenize.rst:182 msgid "" "Example of a script rewriter that transforms float literals into Decimal " "objects::" msgstr "" -#: ../../library/tokenize.rst:186 +#: ../../library/tokenize.rst:185 msgid "" "from tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP\n" "from io import BytesIO\n" @@ -312,11 +310,11 @@ msgid "" " return untokenize(result).decode('utf-8')" msgstr "" -#: ../../library/tokenize.rst:225 +#: ../../library/tokenize.rst:224 msgid "Example of tokenizing from the command line. The script::" msgstr "" -#: ../../library/tokenize.rst:227 +#: ../../library/tokenize.rst:226 msgid "" "def say_hello():\n" " print(\"Hello, World!\")\n" @@ -328,7 +326,7 @@ msgstr "" "\n" "say_hello()" -#: ../../library/tokenize.rst:232 +#: ../../library/tokenize.rst:231 msgid "" "will be tokenized to the following output where the first column is the " "range of the line/column coordinates where the token is found, the second " @@ -336,7 +334,7 @@ msgid "" "token (if any)" msgstr "" -#: ../../library/tokenize.rst:236 +#: ../../library/tokenize.rst:235 msgid "" "$ python -m tokenize hello.py\n" "0,0-0,0: ENCODING 'utf-8'\n" @@ -382,12 +380,12 @@ msgstr "" "4,11-4,12: NEWLINE '\\n'\n" "5,0-5,0: ENDMARKER ''" -#: ../../library/tokenize.rst:260 +#: ../../library/tokenize.rst:259 msgid "" "The exact token type names can be displayed using the :option:`-e` option:" msgstr "" -#: ../../library/tokenize.rst:262 +#: ../../library/tokenize.rst:261 msgid "" "$ python -m tokenize -e hello.py\n" "0,0-0,0: ENCODING 'utf-8'\n" @@ -433,13 +431,13 @@ msgstr "" "4,11-4,12: NEWLINE '\\n'\n" "5,0-5,0: ENDMARKER ''" -#: ../../library/tokenize.rst:286 +#: ../../library/tokenize.rst:285 msgid "" "Example of tokenizing a file programmatically, reading unicode strings " "instead of bytes with :func:`generate_tokens`::" msgstr "" -#: ../../library/tokenize.rst:289 +#: ../../library/tokenize.rst:288 msgid "" "import tokenize\n" "\n" @@ -455,11 +453,11 @@ msgstr "" " for token in tokens:\n" " print(token)" -#: ../../library/tokenize.rst:296 +#: ../../library/tokenize.rst:295 msgid "Or reading bytes directly with :func:`.tokenize`::" msgstr "" -#: ../../library/tokenize.rst:298 +#: ../../library/tokenize.rst:297 msgid "" "import tokenize\n" "\n" diff --git a/library/traceback.po b/library/traceback.po index b2fbc3ea87..6337736158 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -150,26 +150,26 @@ msgid "" "when printing an unhandled exception." msgstr "" -#: ../../library/traceback.rst:104 ../../library/traceback.rst:208 +#: ../../library/traceback.rst:104 ../../library/traceback.rst:215 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: ../../library/traceback.rst:107 ../../library/traceback.rst:188 +#: ../../library/traceback.rst:107 ../../library/traceback.rst:195 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" #: ../../library/traceback.rst:114 msgid "" -"This is a shorthand for ``print_exception(sys.exception(), limit, file, " -"chain)``." +"This is a shorthand for ``print_exception(sys.exception(), limit=limit, " +"file=file, chain=chain)``." msgstr "" #: ../../library/traceback.rst:120 msgid "" -"This is a shorthand for ``print_exception(sys.last_exc, limit, file, " -"chain)``. In general it will work only after an exception has reached an " -"interactive prompt (see :data:`sys.last_exc`)." +"This is a shorthand for ``print_exception(sys.last_exc, limit=limit, " +"file=file, chain=chain)``. In general it will work only after an exception " +"has reached an interactive prompt (see :data:`sys.last_exc`)." msgstr "" #: ../../library/traceback.rst:127 @@ -205,6 +205,13 @@ msgstr "" #: ../../library/traceback.rst:162 msgid "" +"Print the list of tuples as returned by :func:`extract_tb` or :func:" +"`extract_stack` as a formatted stack trace to the given file. If *file* is " +"``None``, the output is written to :data:`sys.stderr`." +msgstr "" + +#: ../../library/traceback.rst:169 +msgid "" "Given a list of tuples or :class:`FrameSummary` objects as returned by :func:" "`extract_tb` or :func:`extract_stack`, return a list of strings ready for " "printing. Each string in the resulting list corresponds to the item with " @@ -213,7 +220,7 @@ msgid "" "text line is not ``None``." msgstr "" -#: ../../library/traceback.rst:172 +#: ../../library/traceback.rst:179 msgid "" "Format the exception part of a traceback using an exception value such as " "given by :data:`sys.last_value`. The return value is a list of strings, " @@ -224,31 +231,31 @@ msgid "" "contains the exception's :attr:`notes `." msgstr "" -#: ../../library/traceback.rst:180 +#: ../../library/traceback.rst:187 msgid "" "Since Python 3.10, instead of passing *value*, an exception object can be " "passed as the first argument. If *value* is provided, the first argument is " "ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:184 ../../library/traceback.rst:415 +#: ../../library/traceback.rst:191 ../../library/traceback.rst:422 msgid "" "When *show_group* is ``True``, and the exception is an instance of :exc:" "`BaseExceptionGroup`, the nested exceptions are included as well, " "recursively, with indentation relative to their nesting depth." msgstr "" -#: ../../library/traceback.rst:192 +#: ../../library/traceback.rst:199 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" -#: ../../library/traceback.rst:196 +#: ../../library/traceback.rst:203 msgid "*show_group* parameter was added." msgstr "" -#: ../../library/traceback.rst:202 +#: ../../library/traceback.rst:209 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -257,69 +264,69 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:211 +#: ../../library/traceback.rst:218 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." msgstr "" -#: ../../library/traceback.rst:218 +#: ../../library/traceback.rst:225 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: ../../library/traceback.rst:224 +#: ../../library/traceback.rst:231 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "``format_list(extract_tb(tb, limit))`` 的簡寫。" -#: ../../library/traceback.rst:229 +#: ../../library/traceback.rst:236 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` 的簡寫。" -#: ../../library/traceback.rst:233 +#: ../../library/traceback.rst:240 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" -#: ../../library/traceback.rst:242 +#: ../../library/traceback.rst:249 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:251 +#: ../../library/traceback.rst:258 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" -#: ../../library/traceback.rst:259 +#: ../../library/traceback.rst:266 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` 物件" -#: ../../library/traceback.rst:263 +#: ../../library/traceback.rst:270 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " "capture data for later printing. They offer a more lightweight method of " "storing this information by avoiding holding references to :ref:" -"`traceback` and :ref:`frame` objects In " +"`traceback` and :ref:`frame` objects. In " "addition, they expose more options to configure the output compared to the " "module-level functions described above." msgstr "" -#: ../../library/traceback.rst:272 +#: ../../library/traceback.rst:279 msgid "" "Capture an exception for later rendering. The meaning of *limit*, " "*lookup_lines* and *capture_locals* are as for the :class:`StackSummary` " "class." msgstr "" -#: ../../library/traceback.rst:276 +#: ../../library/traceback.rst:283 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -327,12 +334,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: ../../library/traceback.rst:282 ../../library/traceback.rst:383 +#: ../../library/traceback.rst:289 ../../library/traceback.rst:390 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: ../../library/traceback.rst:284 +#: ../../library/traceback.rst:291 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -341,128 +348,128 @@ msgid "" "limit is exceeded." msgstr "" -#: ../../library/traceback.rst:290 +#: ../../library/traceback.rst:297 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:293 +#: ../../library/traceback.rst:300 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "新增 *max_group_width* 和 *max_group_depth* 參數。" -#: ../../library/traceback.rst:298 +#: ../../library/traceback.rst:305 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" -#: ../../library/traceback.rst:303 +#: ../../library/traceback.rst:310 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" -#: ../../library/traceback.rst:308 +#: ../../library/traceback.rst:315 msgid "" "If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" "class:`!TracebackException` instances representing the nested exceptions. " "Otherwise it is ``None``." msgstr "" -#: ../../library/traceback.rst:316 +#: ../../library/traceback.rst:323 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: ../../library/traceback.rst:321 +#: ../../library/traceback.rst:328 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: ../../library/traceback.rst:330 +#: ../../library/traceback.rst:337 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:334 +#: ../../library/traceback.rst:341 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:340 +#: ../../library/traceback.rst:347 msgid "String display of the class of the original exception." msgstr "" -#: ../../library/traceback.rst:346 +#: ../../library/traceback.rst:353 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:350 +#: ../../library/traceback.rst:357 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:354 +#: ../../library/traceback.rst:361 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: ../../library/traceback.rst:361 +#: ../../library/traceback.rst:368 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:365 +#: ../../library/traceback.rst:372 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:369 +#: ../../library/traceback.rst:376 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: ../../library/traceback.rst:376 +#: ../../library/traceback.rst:383 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:380 +#: ../../library/traceback.rst:387 msgid "" "Capture an exception for later rendering. *limit*, *lookup_lines* and " "*capture_locals* are as for the :class:`StackSummary` class." msgstr "" -#: ../../library/traceback.rst:387 +#: ../../library/traceback.rst:394 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: ../../library/traceback.rst:394 +#: ../../library/traceback.rst:401 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:396 +#: ../../library/traceback.rst:403 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: ../../library/traceback.rst:399 +#: ../../library/traceback.rst:406 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:405 +#: ../../library/traceback.rst:412 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:407 +#: ../../library/traceback.rst:414 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:409 +#: ../../library/traceback.rst:416 msgid "" "When *show_group* is ``False``, the generator emits the exception's message " "followed by its notes (if it has any). The exception message is normally a " @@ -471,32 +478,32 @@ msgid "" "the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:419 +#: ../../library/traceback.rst:426 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" -#: ../../library/traceback.rst:423 +#: ../../library/traceback.rst:430 msgid "Added the *show_group* parameter." msgstr "新增 *show_group* 參數。" -#: ../../library/traceback.rst:428 +#: ../../library/traceback.rst:435 msgid ":class:`!StackSummary` Objects" msgstr ":class:`!StackSummary` 物件" -#: ../../library/traceback.rst:432 +#: ../../library/traceback.rst:439 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:438 +#: ../../library/traceback.rst:445 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:442 +#: ../../library/traceback.rst:449 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -506,20 +513,20 @@ msgid "" "class:`!FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:450 +#: ../../library/traceback.rst:457 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: ../../library/traceback.rst:456 +#: ../../library/traceback.rst:463 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" -#: ../../library/traceback.rst:463 +#: ../../library/traceback.rst:470 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " @@ -527,18 +534,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: ../../library/traceback.rst:469 +#: ../../library/traceback.rst:476 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:473 +#: ../../library/traceback.rst:480 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:478 +#: ../../library/traceback.rst:485 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -546,17 +553,17 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: ../../library/traceback.rst:488 +#: ../../library/traceback.rst:495 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` 物件" -#: ../../library/traceback.rst:492 +#: ../../library/traceback.rst:499 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:497 +#: ../../library/traceback.rst:506 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -570,38 +577,60 @@ msgid "" "display." msgstr "" -#: ../../library/traceback.rst:508 +#: ../../library/traceback.rst:517 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:512 +#: ../../library/traceback.rst:521 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: ../../library/traceback.rst:518 +#: ../../library/traceback.rst:527 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:522 +#: ../../library/traceback.rst:531 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:527 +#: ../../library/traceback.rst:536 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:534 +#: ../../library/traceback.rst:542 +msgid "" +"The last line number of the source code for this frame. By default, it is " +"set to ``lineno`` and indexation starts from 1." +msgstr "" + +#: ../../library/traceback.rst:545 +msgid "The default value changed from ``None`` to ``lineno``." +msgstr "" + +#: ../../library/traceback.rst:550 +msgid "" +"The column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: ../../library/traceback.rst:555 +msgid "" +"The last column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: ../../library/traceback.rst:562 msgid "Examples of Using the Module-Level Functions" msgstr "" -#: ../../library/traceback.rst:536 +#: ../../library/traceback.rst:564 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -609,7 +638,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:541 +#: ../../library/traceback.rst:569 msgid "" "import sys, traceback\n" "\n" @@ -628,13 +657,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:558 +#: ../../library/traceback.rst:586 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:561 +#: ../../library/traceback.rst:589 msgid "" "import sys, traceback\n" "\n" @@ -666,11 +695,11 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:592 +#: ../../library/traceback.rst:620 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:594 +#: ../../library/traceback.rst:622 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" @@ -720,13 +749,13 @@ msgid "" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:639 +#: ../../library/traceback.rst:667 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:641 +#: ../../library/traceback.rst:669 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -778,11 +807,11 @@ msgstr "" " ' File \"\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:665 +#: ../../library/traceback.rst:693 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:667 +#: ../../library/traceback.rst:695 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" @@ -794,15 +823,15 @@ msgid "" "['IndexError: tuple index out of range\\n']" msgstr "" -#: ../../library/traceback.rst:681 +#: ../../library/traceback.rst:709 msgid "Examples of Using :class:`TracebackException`" msgstr ":class:`TracebackException` 的使用範例" -#: ../../library/traceback.rst:683 +#: ../../library/traceback.rst:711 msgid "With the helper class, we have more options::" msgstr "" -#: ../../library/traceback.rst:685 +#: ../../library/traceback.rst:713 msgid "" ">>> import sys\n" ">>> from traceback import TracebackException\n" diff --git a/library/tty.po b/library/tty.po index 86b6a46e29..6b2b0efbc6 100644 --- a/library/tty.po +++ b/library/tty.po @@ -81,7 +81,7 @@ msgid "" msgstr "" "將檔案描述器 *fd* 的模式更改為 raw。如果 *when* 被省略,則預設為 :const:" "`termios.TCSAFLUSH`,並傳遞給 :func:`termios.tcsetattr`。:func:`termios." -"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函數回傳這個" +"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函式回傳這個" "值。" #: ../../library/tty.rst:55 ../../library/tty.rst:69 @@ -98,7 +98,7 @@ msgid "" msgstr "" "將檔案描述器 *fd* 的模式更改為 cbreak。如果 *when* 被省略,則預設為 :const:" "`termios.TCSAFLUSH`,並傳遞給 :func:`termios.tcsetattr`。:func:`termios." -"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函數回傳這個" +"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函式回傳這個" "值。" #: ../../library/tty.rst:66 diff --git a/library/turtle.po b/library/turtle.po index 3a6d1eb7aa..ef88f69b8e 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-03 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,8 +19,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/turtle.rst:3 -msgid ":mod:`turtle` --- Turtle graphics" -msgstr ":mod:`turtle` --- 龜圖學 (Turtle graphics)" +msgid ":mod:`!turtle` --- Turtle graphics" +msgstr ":mod:`!turtle` --- 龜圖學 (Turtle graphics)" #: ../../library/turtle.rst:10 msgid "**Source code:** :source:`Lib/turtle.py`" @@ -37,8 +37,8 @@ msgid "" "developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967." msgstr "" "龜圖學是由 Wally Feurzeig,Seymour Papert 與 Cynthia Solomon 於 1967 年開發" -"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" +"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" #: ../../library/turtle.rst:29 msgid "Get started" @@ -322,8 +322,8 @@ msgstr "" #: ../../library/turtle.rst:195 msgid "" "The turtle module makes this possible by exposing all its basic " -"functionality as functions, available with ``from turtle import *``. The :" -"ref:`turtle graphics tutorial ` covers this approach." +"functionality as functions, available with ``from turtle import *``. " +"The :ref:`turtle graphics tutorial ` covers this approach." msgstr "" #: ../../library/turtle.rst:199 @@ -1059,8 +1059,8 @@ msgstr "" #: ../../library/turtle.rst:545 msgid "" -"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." -"g. as returned by :func:`pos`)." +"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` " +"(e.g. as returned by :func:`pos`)." msgstr "" #: ../../library/turtle.rst:548 @@ -1583,8 +1583,8 @@ msgstr "" #: ../../library/turtle.rst:938 msgid "" -"Return the turtle's current heading (value depends on the turtle mode, see :" -"func:`mode`)." +"Return the turtle's current heading (value depends on the turtle mode, " +"see :func:`mode`)." msgstr "" #: ../../library/turtle.rst:941 @@ -1644,8 +1644,8 @@ msgid "" ">>> turtle.heading()\n" "90.0\n" "\n" -"Change angle measurement unit to grad (also known as gon,\n" -"grade, or gradian and equals 1/100-th of the right angle.)\n" +">>> # Change angle measurement unit to grad (also known as gon,\n" +">>> # grade, or gradian and equals 1/100-th of the right angle.)\n" ">>> turtle.degrees(400.0)\n" ">>> turtle.heading()\n" "100.0\n" @@ -1656,8 +1656,8 @@ msgstr "" #: ../../library/turtle.rst:1002 msgid "" -"Set the angle measurement units to radians. Equivalent to ``degrees(2*math." -"pi)``." +"Set the angle measurement units to radians. Equivalent to " +"``degrees(2*math.pi)``." msgstr "" #: ../../library/turtle.rst:1005 @@ -2005,8 +2005,8 @@ msgstr "``color()``" #: ../../library/turtle.rst:1221 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " -"specification strings or tuples as returned by :func:`pencolor` and :func:" -"`fillcolor`." +"specification strings or tuples as returned by :func:`pencolor` " +"and :func:`fillcolor`." msgstr "" #: ../../library/turtle.rst:1225 @@ -2199,8 +2199,8 @@ msgid "" "name of current shape. Shape with *name* must exist in the TurtleScreen's " "shape dictionary. Initially there are the following polygon shapes: " "\"arrow\", \"turtle\", \"circle\", \"square\", \"triangle\", \"classic\". " -"To learn about how to deal with shapes see Screen method :func:" -"`register_shape`." +"To learn about how to deal with shapes see Screen " +"method :func:`register_shape`." msgstr "" #: ../../library/turtle.rst:1398 @@ -2645,8 +2645,8 @@ msgstr "" #: ../../library/turtle.rst:1754 msgid "" -"Add as many components to this object as desired, using the :meth:`~Shape." -"addcomponent` method." +"Add as many components to this object as desired, using " +"the :meth:`~Shape.addcomponent` method." msgstr "" #: ../../library/turtle.rst:1757 @@ -3282,16 +3282,16 @@ msgstr "" msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " -"switch (no subprocess) is used, this value should be set to ``True`` in :" -"file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the " -"client script." +"switch (no subprocess) is used, this value should be set to ``True`` " +"in :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for " +"the client script." msgstr "" #: ../../library/turtle.rst:2274 msgid "" "Set the size and position of the main window. Default values of arguments " -"are stored in the configuration dictionary and can be changed via a :file:" -"`turtle.cfg` file." +"are stored in the configuration dictionary and can be changed via " +"a :file:`turtle.cfg` file." msgstr "" #: ../../library/turtle.rst:2278 @@ -3344,8 +3344,8 @@ msgstr "" #: ../../library/turtle.rst:2318 msgid "" -"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" -"`TurtleScreen`" +"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or " +"a :class:`TurtleScreen`" msgstr "" #: ../../library/turtle.rst:2321 @@ -3356,8 +3356,9 @@ msgstr "" #: ../../library/turtle.rst:2327 msgid "" -"Subclass of RawTurtle, has the same interface but draws on a default :class:" -"`Screen` object created automatically when needed for the first time." +"Subclass of RawTurtle, has the same interface but draws on a " +"default :class:`Screen` object created automatically when needed for the " +"first time." msgstr "" #: ../../library/turtle.rst:2333 @@ -3427,8 +3428,8 @@ msgstr "\"compound\"" #: ../../library/turtle.rst:2364 msgid "" -"``None`` (a compound shape has to be constructed using the :meth:" -"`addcomponent` method)" +"``None`` (a compound shape has to be constructed using " +"the :meth:`addcomponent` method)" msgstr "" #: ../../library/turtle.rst:2370 @@ -3515,17 +3516,18 @@ msgstr "" msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " -"or created for it. The *canvas* can be a :class:`!tkinter.Canvas`, :class:" -"`ScrolledCanvas` or :class:`TurtleScreen`." +"or created for it. The *canvas* can be a :class:`!" +"tkinter.Canvas`, :class:`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" #: ../../library/turtle.rst:2421 msgid "" -":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" -"`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " -"additional methods ` for managing its appearance (including " -"size and title) and behaviour. ``TurtleScreen``'s constructor needs a :class:" -"`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." +":class:`TurtleScreen` is the basic drawing surface for a " +"turtle. :class:`Screen` is a subclass of ``TurtleScreen``, and " +"includes :ref:`some additional methods ` for managing its " +"appearance (including size and title) and behaviour. ``TurtleScreen``'s " +"constructor needs a :class:`!tkinter.Canvas` or a :class:`ScrolledCanvas` as " +"an argument." msgstr "" #: ../../library/turtle.rst:2428 @@ -3828,8 +3830,8 @@ msgstr "" #: ../../library/turtle.rst:2589 msgid "" -"Line 5 and 6 correspond to the arguments of the method :func:`Screen." -"screensize `." +"Line 5 and 6 correspond to the arguments of the " +"method :func:`Screen.screensize `." msgstr "" #: ../../library/turtle.rst:2591 @@ -3853,9 +3855,10 @@ msgstr "" #: ../../library/turtle.rst:2598 msgid "" -"If you set e.g. ``language = italian`` the docstringdict :file:" -"`turtle_docstringdict_italian.py` will be loaded at import time (if present " -"on the import path, e.g. in the same directory as :mod:`turtle`)." +"If you set e.g. ``language = italian`` the " +"docstringdict :file:`turtle_docstringdict_italian.py` will be loaded at " +"import time (if present on the import path, e.g. in the same directory " +"as :mod:`turtle`)." msgstr "" #: ../../library/turtle.rst:2601 @@ -4181,9 +4184,9 @@ msgstr "" #: ../../library/turtle.rst:2726 msgid "" -"The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" -"`begin_fill` and :func:`end_fill` have changed slightly: now every filling " -"process must be completed with an ``end_fill()`` call." +"The method :func:`!Turtle.fill` has been eliminated. The behaviour " +"of :func:`begin_fill` and :func:`end_fill` have changed slightly: now every " +"filling process must be completed with an ``end_fill()`` call." msgstr "" #: ../../library/turtle.rst:2731 @@ -4200,11 +4203,11 @@ msgstr "" #: ../../library/turtle.rst:2739 msgid "" -"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" -"func:`get_shapepoly` have been added. Thus the full range of regular linear " -"transforms is now available for transforming turtle shapes. :func:" -"`tiltangle` has been enhanced in functionality: it now can be used to get or " -"set the tilt angle." +"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` " +"and :func:`get_shapepoly` have been added. Thus the full range of regular " +"linear transforms is now available for transforming turtle " +"shapes. :func:`tiltangle` has been enhanced in functionality: it now can be " +"used to get or set the tilt angle." msgstr "" #: ../../library/turtle.rst:2745 @@ -4223,9 +4226,9 @@ msgstr "" #: ../../library/turtle.rst:2753 msgid "" -"Two input methods have been added: :func:`Screen.textinput ` and :" -"func:`Screen.numinput `. These pop up input dialogs and return " -"strings and numbers respectively." +"Two input methods have been added: :func:`Screen.textinput ` " +"and :func:`Screen.numinput `. These pop up input dialogs and " +"return strings and numbers respectively." msgstr "" #: ../../library/turtle.rst:2757 diff --git a/library/typing.po b/library/typing.po index 909335de57..2306bfda2b 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-11 06:16+0000\n" +"POT-Creation-Date: 2025-05-06 02:41+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,8 +19,8 @@ msgstr "" "X-Generator: Poedit 3.4.4\n" #: ../../library/typing.rst:3 -msgid ":mod:`typing` --- Support for type hints" -msgstr ":mod:`typing` --- 支援型別提示" +msgid ":mod:`!typing` --- Support for type hints" +msgstr ":mod:`!typing` --- 支援型別提示" #: ../../library/typing.rst:16 msgid "**Source code:** :source:`Lib/typing.py`" @@ -55,8 +55,8 @@ msgstr "" msgid "" "The function ``surface_area_of_cube`` takes an argument expected to be an " "instance of :class:`float`, as indicated by the :term:`type hint` " -"``edge_length: float``. The function is expected to return an instance of :" -"class:`str`, as indicated by the ``-> str`` hint." +"``edge_length: float``. The function is expected to return an instance " +"of :class:`str`, as indicated by the ``-> str`` hint." msgstr "" "函式 ``surface_area_of_cube`` 需要一個引數且預期是一個 :class:`float` 的實" "例,如 ``edge_length: float`` 所指出的\\ :term:`型別提示 `。這個函" @@ -73,9 +73,9 @@ msgstr "" #: ../../library/typing.rst:42 msgid "" -"New features are frequently added to the ``typing`` module. The :pypi:" -"`typing_extensions` package provides backports of these new features to " -"older versions of Python." +"New features are frequently added to the ``typing`` module. " +"The :pypi:`typing_extensions` package provides backports of these new " +"features to older versions of Python." msgstr "" "新功能會頻繁的新增至 ``typing`` 模組中。:pypi:`typing_extensions` 套件為這些" "新功能提供了 backport(向後移植的)版本,提供給舊版本的 Python 使用。" @@ -94,8 +94,8 @@ msgstr "型別提示的快速預覽(發布於 mypy 的文件中)" #: ../../library/typing.rst:51 msgid "" -"\"Type System Reference\" section of `the mypy docs `_" +"\"Type System Reference\" section of `the mypy docs `_" msgstr "" "`mypy 文件 `_\\ 的 \"型別系" "統參考資料 (Type System Reference)\" 章節" @@ -110,11 +110,10 @@ msgstr "" "多數 Python 型別檢查器中廣為使用。(某些部分依然是特定給 mypy 使用。)" #: ../../library/typing.rst:56 -msgid "" -"`\"Static Typing with Python\" `_" +msgid "`\"Static Typing with Python\" `_" msgstr "" -"`\"Python 的靜態型別 (Static Typing)\" `_" +"`\"Python 的靜態型別 (Static Typing)\" `_" #: ../../library/typing.rst:57 msgid "" @@ -131,12 +130,12 @@ msgstr "Python 型別系統的技術規範" #: ../../library/typing.rst:66 msgid "" "The canonical, up-to-date specification of the Python type system can be " -"found at `\"Specification for the Python type system\" `_." +"found at `\"Specification for the Python type system\" `_." msgstr "" "關於 Python 型別系統標準的 (canonical)、最新的技術規範可以在\\ `「Python 型別" -"系統的技術規範」 `_\\ 找到。" +"系統的技術規範」 `_\\ 找" +"到。" #: ../../library/typing.rst:72 msgid "Type aliases" @@ -148,9 +147,9 @@ msgid "" "an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " "``list[float]`` will be treated equivalently by static type checkers::" msgstr "" -"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立了 :class:" -"`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 ``list[float]`` 會被當作" -"和靜態型別檢查器一樣同等對待: ::" +"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立" +"了 :class:`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 " +"``list[float]`` 會被當作和靜態型別檢查器一樣同等對待: ::" #: ../../library/typing.rst:79 msgid "" @@ -377,18 +376,19 @@ msgstr "註釋 callable 物件" #: ../../library/typing.rst:210 msgid "" -"Functions -- or other :term:`callable` objects -- can be annotated using :" -"class:`collections.abc.Callable` or deprecated :data:`typing.Callable`. " -"``Callable[[int], str]`` signifies a function that takes a single parameter " -"of type :class:`int` and returns a :class:`str`." +"Functions -- or other :term:`callable` objects -- can be annotated " +"using :class:`collections.abc.Callable` or " +"deprecated :data:`typing.Callable`. ``Callable[[int], str]`` signifies a " +"function that takes a single parameter of type :class:`int` and returns " +"a :class:`str`." msgstr "" -"函式,或者是其他 :term:`callable` 物件,可以使用 :class:`collections.abc." -"Callable` 或以棄用的 :data:`typing.Callable` 進行註釋。 ``Callable[[int], " -"str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" -"class:`str`。" +"函式,或者是其他 :term:`callable` 物件,可以使" +"用 :class:`collections.abc.Callable` 或以棄用的 :data:`typing.Callable` 進行" +"註釋。 ``Callable[[int], str]`` 象徵為一個函式,可以接受一個型別" +"為 :class:`int` 的引數,並回傳一個 :class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3128 -#: ../../library/typing.rst:3308 +#: ../../library/typing.rst:215 ../../library/typing.rst:3161 +#: ../../library/typing.rst:3341 msgid "For example:" msgstr "舉例來說:" @@ -443,8 +443,8 @@ msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " "functions that have keyword-only parameters. However, these signatures can " -"be expressed by defining a :class:`Protocol` class with a :meth:`~object." -"__call__` method:" +"be expressed by defining a :class:`Protocol` class with " +"a :meth:`~object.__call__` method:" msgstr "" "``Callable`` 不如有可變數量引數的函式、:func:`overloaded functions " "`、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透" @@ -492,13 +492,13 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3798 +#: ../../library/typing.rst:285 ../../library/typing.rst:3831 msgid "" -"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" -"pep:`612` for more details." +"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. " +"See :pep:`612` for more details." msgstr "" -"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參閱 :" -"pep:`612` 閱讀詳細內容。" +"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參" +"閱 :pep:`612` 閱讀詳細內容。" #: ../../library/typing.rst:290 msgid "" @@ -603,9 +603,10 @@ msgstr "" #: ../../library/typing.rst:356 msgid "" ":class:`list` only accepts one type argument, so a type checker would emit " -"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." -"Mapping` only accepts two type arguments: the first indicates the type of " -"the keys, and the second indicates the type of the values." +"an error on the ``y`` assignment above. " +"Similarly, :class:`~collections.abc.Mapping` only accepts two type " +"arguments: the first indicates the type of the keys, and the second " +"indicates the type of the values." msgstr "" ":class:`list` 只接受一個型別引數,所以型別檢查器可能在上述 ``y`` 賦值 " "(assignment) 觸發錯誤。類似的範例,:class:`~collections.abc.Mapping` 只接受兩" @@ -616,8 +617,8 @@ msgstr "" msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " -"For this reason, tuples are special-cased in Python's typing system. :class:" -"`tuple` accepts *any number* of type arguments::" +"For this reason, tuples are special-cased in Python's typing " +"system. :class:`tuple` accepts *any number* of type arguments::" msgstr "" "然而,與其他多數的 Python 容器不同,在慣用的 (idiomatic) Python 程式碼中,元" "組可以擁有不完全相同型別的元素是相當常見的。為此,元組在 Python 的加註型別系" @@ -677,9 +678,10 @@ msgstr "類別物件的型別" #: ../../library/typing.rst:403 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " -"contrast, a variable annotated with ``type[C]`` (or deprecated :class:" -"`typing.Type[C] `) may accept values that are classes themselves -- " -"specifically, it will accept the *class object* of ``C``. For example::" +"contrast, a variable annotated with ``type[C]`` (or " +"deprecated :class:`typing.Type[C] `) may accept values that are " +"classes themselves -- specifically, it will accept the *class object* of " +"``C``. For example::" msgstr "" "一個變數被註釋為 ``C`` 可以接受一個型別為 ``C`` 的值。相對的,一個變數備註解" "為 ``type[C]`` \\ (或已棄用的 :class:`typing.Type[C] `)\\ 可以接受本" @@ -718,8 +720,9 @@ msgstr "" #: ../../library/typing.rst:429 msgid "" -"The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" -"`type variables `, and unions of any of these types. For example::" +"The only legal parameters for :class:`type` are " +"classes, :data:`Any`, :ref:`type variables `, and unions of any of " +"these types. For example::" msgstr "" ":class:`type` 僅有的合法參數是類別、:data:`Any`、:ref:`型別變數 " "`\\ 以及這些型別任意組合成的聯集。舉例來說: ::" @@ -737,8 +740,8 @@ msgstr "" #: ../../library/typing.rst:441 msgid "" -"``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" -"ref:`metaclass hierarchy `." +"``type[Any]`` is equivalent to :class:`type`, which is the root of " +"Python's :ref:`metaclass hierarchy `." msgstr "" "``type[Any]`` 等價於 :class:`type` ,其為 Python :ref:`metaclass 階層結構 " "(hierachy) `。" @@ -749,9 +752,9 @@ msgstr "" #: ../../library/typing.rst:450 msgid "" -"A generator can be annotated using the generic type :class:" -"`Generator[YieldType, SendType, ReturnType] `. " -"For example::" +"A generator can be annotated using the generic " +"type :class:`Generator[YieldType, SendType, ReturnType] " +"`. For example::" msgstr "" #: ../../library/typing.rst:454 @@ -798,8 +801,9 @@ msgstr "" #: ../../library/typing.rst:478 msgid "" "Simple generators that only ever yield values can also be annotated as " -"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" +"having a return type of either :class:`Iterable[YieldType] " +"` or :class:`Iterator[YieldType] " +"`::" msgstr "" #: ../../library/typing.rst:483 @@ -814,8 +818,8 @@ msgstr "" msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " -"`). The ``SendType`` argument defaults to :" -"const:`!None`, so the following definitions are equivalent::" +"`). The ``SendType`` argument defaults " +"to :const:`!None`, so the following definitions are equivalent::" msgstr "" #: ../../library/typing.rst:494 @@ -833,9 +837,9 @@ msgstr "" #: ../../library/typing.rst:504 msgid "" -"As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" +"As in the synchronous case, :class:`AsyncIterable[YieldType] " +"` and :class:`AsyncIterator[YieldType] " +"` are available as well::" msgstr "" #: ../../library/typing.rst:509 @@ -904,8 +908,8 @@ msgstr "" #: ../../library/typing.rst:557 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " -"with Python 3.11 and lower, it is also possible to inherit explicitly from :" -"class:`Generic` to indicate a generic class::" +"with Python 3.11 and lower, it is also possible to inherit explicitly " +"from :class:`Generic` to indicate a generic class::" msgstr "" "泛型類別隱性繼承了 :class:`Generic`。為了相容 Python 3.11 及更早版本,也可以" "明確的繼承 :class:`Generic` 並指出是一個泛型類別: ::" @@ -939,8 +943,8 @@ msgstr "" #: ../../library/typing.rst:577 msgid "" -"A generic type can have any number of type variables. All varieties of :" -"class:`TypeVar` are permissible as parameters for a generic type::" +"A generic type can have any number of type variables. All varieties " +"of :class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" "一個泛型型別可以有任意數量的型別變數。所有種類的 :class:`TypeVar` 都可以作為" "泛型型別的參數: ::" @@ -1080,14 +1084,14 @@ msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " "consistent with type variables' described above as parameter specification " -"variables are treated by the typing module as a specialized type variable. " -"The one exception to this is that a list of types can be used to substitute " -"a :class:`ParamSpec`::" +"variables are treated by the :mod:`!typing` module as a specialized type " +"variable. The one exception to this is that a list of types can be used to " +"substitute a :class:`ParamSpec`::" msgstr "" "使用者定義的參數運算式 (parameter expression) 泛型一樣有支援,透過 ``[**P]`` " -"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續被型" -"別模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可以替代 :" -"class:`ParamSpec`: ::" +"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續" +"被 :mod:`!typing` 模組視為一個特定的型別變數。對此,其中一個例外是一個型別列" +"表可以替代 :class:`ParamSpec`: ::" #: ../../library/typing.rst:671 msgid "" @@ -1096,6 +1100,10 @@ msgid "" ">>> Z[int, [dict, float]]\n" "__main__.Z[int, [dict, float]]" msgstr "" +">>> class Z[T, **P]: ... # T 為 TypeVar;P 為 ParamSpec\n" +"...\n" +">>> Z[int, [dict, float]]\n" +"__main__.Z[int, [dict, float]]" #: ../../library/typing.rst:676 msgid "" @@ -1114,6 +1122,12 @@ msgid "" "class Z(Generic[P]):\n" " ..." msgstr "" +"from typing import ParamSpec, Generic\n" +"\n" +"P = ParamSpec('P')\n" +"\n" +"class Z(Generic[P]):\n" +" ..." #: ../../library/typing.rst:686 msgid "" @@ -1137,6 +1151,12 @@ msgid "" ">>> X[[int, str]]\n" "__main__.X[[int, str]]" msgstr "" +">>> class X[**P]: ...\n" +"...\n" +">>> X[int, str]\n" +"__main__.X[[int, str]]\n" +">>> X[[int, str]]\n" +"__main__.X[[int, str]]" #: ../../library/typing.rst:699 msgid "" @@ -1149,22 +1169,22 @@ msgstr "" #: ../../library/typing.rst:703 msgid "" -":class:`Generic` can now be parameterized over parameter expressions. See :" -"class:`ParamSpec` and :pep:`612` for more details." +":class:`Generic` can now be parameterized over parameter expressions. " +"See :class:`ParamSpec` and :pep:`612` for more details." msgstr "" -":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:" -"`ParamSpec` 以及 :pep:`612`。" +":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請" +"見 :class:`ParamSpec` 以及 :pep:`612`。" #: ../../library/typing.rst:707 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " -"parameterizing generics is cached, and most types in the typing module are :" -"term:`hashable` and comparable for equality." +"parameterizing generics is cached, and most types in the :mod:`!typing` " +"module are :term:`hashable` and comparable for equality." msgstr "" "一個使用者定義的泛型類別可以將 ABC 作為他們的基底類別,且不會有 metaclass 衝" -"突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在型別模組中多" -"數的型別皆為 :term:`hashable` 且可以比較相等性。" +"突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在 :mod:`!" +"typing` 模組中多數的型別皆為 :term:`hashable` 且可以比較相等性。" #: ../../library/typing.rst:714 msgid "The :data:`Any` type" @@ -1176,8 +1196,8 @@ msgid "" "every type as being compatible with :data:`Any` and :data:`Any` as being " "compatible with every type." msgstr "" -":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :" -"data:`Any` 且 :data:`Any` 也可以相容於每個型別。" +":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容" +"於 :data:`Any` 且 :data:`Any` 也可以相容於每個型別。" #: ../../library/typing.rst:720 msgid "" @@ -1207,11 +1227,11 @@ msgstr "" #: ../../library/typing.rst:738 msgid "" -"Notice that no type checking is performed when assigning a value of type :" -"data:`Any` to a more precise type. For example, the static type checker did " -"not report an error when assigning ``a`` to ``s`` even though ``s`` was " -"declared to be of type :class:`str` and receives an :class:`int` value at " -"runtime!" +"Notice that no type checking is performed when assigning a value of " +"type :data:`Any` to a more precise type. For example, the static type " +"checker did not report an error when assigning ``a`` to ``s`` even though " +"``s`` was declared to be of type :class:`str` and receives an :class:`int` " +"value at runtime!" msgstr "" "請注意,當賦予型別為 :data:`Any` 的值更精確的型別時,將不會執行任何型別檢查。" "舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報" @@ -1252,8 +1272,8 @@ msgid "" "subtype of every other type." msgstr "" ":data:`Any` 的行為對比 :class:`object` 的行為。與 :data:`Any` 相似,所有的型" -"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::" -"class:`object` 並\\ *不是*\\一個其他型別的子型別。" +"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦" +"然::class:`object` 並\\ *不是*\\一個其他型別的子型別。" #: ../../library/typing.rst:765 msgid "" @@ -1310,16 +1330,16 @@ msgstr "" #: ../../library/typing.rst:798 msgid "" -"This requirement previously also applied to abstract base classes, such as :" -"class:`~collections.abc.Iterable`. The problem with this approach is that a " -"class had to be explicitly marked to support them, which is unpythonic and " -"unlike what one would normally do in idiomatic dynamically typed Python " -"code. For example, this conforms to :pep:`484`::" +"This requirement previously also applied to abstract base classes, such " +"as :class:`~collections.abc.Iterable`. The problem with this approach is " +"that a class had to be explicitly marked to support them, which is " +"unpythonic and unlike what one would normally do in idiomatic dynamically " +"typed Python code. For example, this conforms to :pep:`484`::" msgstr "" "這個需求之前也被運用在抽象基底類別,例如 :class:`~collections.abc.Iterable`。" "這種方式的問題在於,一個類別需要顯式的標記來支援他們,這並不符合 Python 風" -"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :" -"pep:`484`: ::" +"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符" +"合 :pep:`484`: ::" #: ../../library/typing.rst:804 msgid "" @@ -1330,6 +1350,12 @@ msgid "" " def __len__(self) -> int: ...\n" " def __iter__(self) -> Iterator[int]: ..." msgstr "" +"from collections.abc import Sized, Iterable, Iterator\n" +"\n" +"class Bucket(Sized, Iterable[int]):\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ..." #: ../../library/typing.rst:811 msgid "" @@ -1356,6 +1382,15 @@ msgid "" "def collect(items: Iterable[int]) -> int: ...\n" "result = collect(Bucket()) # Passes type check" msgstr "" +"from collections.abc import Iterator, Iterable\n" +"\n" +"class Bucket: # 注意:沒有基底類別\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ...\n" +"\n" +"def collect(items: Iterable[int]) -> int: ...\n" +"result = collect(Bucket()) # Passes type check" #: ../../library/typing.rst:827 msgid "" @@ -1421,7 +1456,7 @@ msgstr "定義: ::" #: ../../library/typing.rst:863 msgid "AnyStr = TypeVar('AnyStr', str, bytes)" -msgstr "" +msgstr "AnyStr = TypeVar('AnyStr', str, bytes)" #: ../../library/typing.rst:865 msgid "" @@ -1432,10 +1467,10 @@ msgstr "" "不可以將此兩種混合。" #: ../../library/typing.rst:868 ../../library/typing.rst:986 -#: ../../library/typing.rst:1043 ../../library/typing.rst:1209 -#: ../../library/typing.rst:1270 ../../library/typing.rst:1312 -#: ../../library/typing.rst:1527 ../../library/typing.rst:1588 -#: ../../library/typing.rst:3065 ../../library/typing.rst:3293 +#: ../../library/typing.rst:1043 ../../library/typing.rst:1215 +#: ../../library/typing.rst:1302 ../../library/typing.rst:1344 +#: ../../library/typing.rst:1553 ../../library/typing.rst:1614 +#: ../../library/typing.rst:3098 ../../library/typing.rst:3326 msgid "For example::" msgstr "舉例來說: ::" @@ -1451,9 +1486,10 @@ msgstr "" #: ../../library/typing.rst:877 msgid "" -"Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" -"`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " -"``str | bytes`` are different from each other and have different use cases::" +"Note that, despite its name, ``AnyStr`` has nothing to do with " +"the :class:`Any` type, nor does it mean \"any string\". In particular, " +"``AnyStr`` and ``str | bytes`` are different from each other and have " +"different use cases::" msgstr "" "請注意,儘管他的名稱相近,``AnyStr`` 與 :class:`Any` 型別無關,更不代表是「任" "何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用" @@ -1475,8 +1511,8 @@ msgstr "" #: ../../library/typing.rst:892 msgid "" "Deprecated in favor of the new :ref:`type parameter syntax `. " -"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" -"pep:`695` for more details." +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. " +"See :pep:`695` for more details." msgstr "" #: ../../library/typing.rst:897 @@ -1502,7 +1538,7 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:912 ../../library/typing.rst:2159 +#: ../../library/typing.rst:912 ../../library/typing.rst:2185 msgid "Example:" msgstr "舉例來說: ::" @@ -1538,16 +1574,16 @@ msgstr "更多細節請見 :pep:`675`。" #: ../../library/typing.rst:940 msgid "" -":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." +":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." msgstr "" ":data:`!Never` 和 :data:`!NoReturn` 表示\\ `底部型別 (bottom type) `_,為一個沒有任何成員的型別。" #: ../../library/typing.rst:944 msgid "" -"They can be used to indicate that a function never returns, such as :func:" -"`sys.exit`::" +"They can be used to indicate that a function never returns, such " +"as :func:`sys.exit`::" msgstr "它們可以被用來代表一個不會回傳的函式,像是 :func:`sys.exit`: ::" #: ../../library/typing.rst:947 @@ -1557,14 +1593,18 @@ msgid "" "def stop() -> Never:\n" " raise RuntimeError('no way')" msgstr "" +"from typing import Never # 或 NoReturn\n" +"\n" +"def stop() -> Never:\n" +" raise RuntimeError('no way')" #: ../../library/typing.rst:952 msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" msgstr "" -"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像是 :func:" -"`assert_never`: ::" +"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像" +"是 :func:`assert_never`: ::" #: ../../library/typing.rst:956 msgid "" @@ -1602,7 +1642,7 @@ msgstr "新增 :data:`Never`。" #: ../../library/typing.rst:984 msgid "Special type to represent the current enclosed class." -msgstr "特別型別,用來表示當前類別之內 (enclosed class)。" +msgstr "特別型別,用來表示目前類別之內 (enclosed class)。" #: ../../library/typing.rst:988 msgid "" @@ -1749,17 +1789,17 @@ msgstr "更多細節請見 :pep:`613`。" msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " -"supports forward references. Note that while :data:`TypeAlias` and :class:" -"`TypeAliasType` serve similar purposes and have similar names, they are " -"distinct and the latter is not the type of the former. Removal of :data:" -"`TypeAlias` is not currently planned, but users are encouraged to migrate " -"to :keyword:`type` statements." -msgstr "" -":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建立 :class:" -"`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖然 :data:" -"`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名稱,他們" -"是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓" -"勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" +"supports forward references. Note that while :data:`TypeAlias` " +"and :class:`TypeAliasType` serve similar purposes and have similar names, " +"they are distinct and the latter is not the type of the former. Removal " +"of :data:`TypeAlias` is not currently planned, but users are encouraged to " +"migrate to :keyword:`type` statements." +msgstr "" +":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建" +"立 :class:`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖" +"然 :data:`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名" +"稱,他們是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計" +"畫,但鼓勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" #: ../../library/typing.rst:1084 msgid "Special forms" @@ -1801,53 +1841,67 @@ msgid "Union[Union[int, str], float] == Union[int, str, float]" msgstr "Union[Union[int, str], float] == Union[int, str, float]" #: ../../library/typing.rst:1101 +msgid "" +"However, this does not apply to unions referenced through a type alias, to " +"avoid forcing evaluation of the underlying :class:`TypeAliasType`::" +msgstr "" + +#: ../../library/typing.rst:1104 +msgid "" +"type A = Union[int, str]\n" +"Union[A, float] != Union[int, str, float]" +msgstr "" +"type A = Union[int, str]\n" +"Union[A, float] != Union[int, str, float]" + +#: ../../library/typing.rst:1107 msgid "Unions of a single argument vanish, e.g.::" msgstr "單一引數的聯集會消失不見,舉例來說: ::" -#: ../../library/typing.rst:1103 +#: ../../library/typing.rst:1109 msgid "Union[int] == int # The constructor actually returns int" -msgstr "Union[int] == int # The constructor actually returns int" +msgstr "Union[int] == int # 實際上建構函式會回傳 int" -#: ../../library/typing.rst:1105 +#: ../../library/typing.rst:1111 ../../library/typing.rst:1245 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" -#: ../../library/typing.rst:1107 +#: ../../library/typing.rst:1113 msgid "Union[int, str, int] == Union[int, str] == int | str" -msgstr "" +msgstr "Union[int, str, int] == Union[int, str] == int | str" -#: ../../library/typing.rst:1109 +#: ../../library/typing.rst:1115 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "當比較聯集時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1111 +#: ../../library/typing.rst:1117 msgid "Union[int, str] == Union[str, int]" msgstr "Union[int, str] == Union[str, int]" -#: ../../library/typing.rst:1113 +#: ../../library/typing.rst:1119 msgid "You cannot subclass or instantiate a ``Union``." msgstr "你不能建立 ``Union`` 的子類別或是實例。" -#: ../../library/typing.rst:1115 +#: ../../library/typing.rst:1121 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:1117 +#: ../../library/typing.rst:1123 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "請勿在 runtime 中將顯性子類別從聯集中移除。" -#: ../../library/typing.rst:1120 +#: ../../library/typing.rst:1126 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" "現在可以將聯集寫成 ``X | Y``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1126 +#: ../../library/typing.rst:1132 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "``Optional[X]`` 與 ``X | None`` 是相等的(或是 ``Union[X, None]``)。" -#: ../../library/typing.rst:1128 +#: ../../library/typing.rst:1134 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 " @@ -1858,7 +1912,7 @@ msgstr "" "有預設值的選擇性引數的型別註釋中不具有 ``Optional`` 限定符 (qualifier),單純" "的因為它就是選擇性的。舉例來說: ::" -#: ../../library/typing.rst:1133 +#: ../../library/typing.rst:1139 msgid "" "def foo(arg: int = 0) -> None:\n" " ..." @@ -1866,7 +1920,7 @@ msgstr "" "def foo(arg: int = 0) -> None:\n" " ..." -#: ../../library/typing.rst:1136 +#: ../../library/typing.rst:1142 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 " @@ -1875,7 +1929,7 @@ msgstr "" "另一方面,如果一個顯性的值 ``None`` 是被允許的,不論引數是不是選擇性的," "``Optional`` 都適用。舉例來說: ::" -#: ../../library/typing.rst:1140 +#: ../../library/typing.rst:1146 msgid "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." @@ -1883,7 +1937,7 @@ msgstr "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." -#: ../../library/typing.rst:1143 +#: ../../library/typing.rst:1149 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." @@ -1891,11 +1945,11 @@ msgstr "" "現在可以將 Optional 寫成 ``X | None``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1149 +#: ../../library/typing.rst:1155 msgid "Special form for annotating higher-order functions." msgstr "用於註釋高階函式的特別型式。" -#: ../../library/typing.rst:1151 +#: ../../library/typing.rst:1157 msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " @@ -1905,23 +1959,23 @@ msgid "" "a :ref:`Callable `. The last parameter to " "``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ 與 :" -"class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以新" -"增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " +"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ " +"與 :class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以" +"新增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " "``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``。``Concatenate`` " "目前只在 :ref:`Callable 物件 `\\ 中第一個引數使用時有" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " "(``...``)。" -#: ../../library/typing.rst:1160 +#: ../../library/typing.rst:1166 msgid "" -"For example, to annotate a decorator ``with_lock`` which provides a :class:" -"`threading.Lock` to the decorated function, ``Concatenate`` can be used to " -"indicate that ``with_lock`` expects a callable which takes in a ``Lock`` as " -"the first argument, and returns a callable with a different type signature. " -"In this case, the :class:`ParamSpec` indicates that the returned callable's " -"parameter types are dependent on the parameter types of the callable being " -"passed in::" +"For example, to annotate a decorator ``with_lock`` which provides " +"a :class:`threading.Lock` to the decorated function, ``Concatenate`` can be " +"used to indicate that ``with_lock`` expects a callable which takes in a " +"``Lock`` as the first argument, and returns a callable with a different type " +"signature. In this case, the :class:`ParamSpec` indicates that the returned " +"callable's parameter types are dependent on the parameter types of the " +"callable being passed in::" msgstr "" "舉例來說,註釋一個為裝飾過後的函式提供 :class:`threading.Lock` 的裝飾器 " "``with_lock``,``Concatenate`` 可以用於指出 ``with_lock`` 預期一個 Callable " @@ -1929,7 +1983,7 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1168 +#: ../../library/typing.rst:1174 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -1957,32 +2011,32 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1196 ../../library/typing.rst:2127 +#: ../../library/typing.rst:1202 ../../library/typing.rst:2153 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1198 +#: ../../library/typing.rst:1204 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1199 ../../library/typing.rst:2130 +#: ../../library/typing.rst:1205 ../../library/typing.rst:2156 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1203 +#: ../../library/typing.rst:1209 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1205 +#: ../../library/typing.rst:1211 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。" -#: ../../library/typing.rst:1211 +#: ../../library/typing.rst:1217 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -1995,7 +2049,7 @@ msgid "" "open_helper('/other/path', 'typo') # Error in type checker" msgstr "" -#: ../../library/typing.rst:1221 +#: ../../library/typing.rst:1227 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -2005,7 +2059,57 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1227 +#: ../../library/typing.rst:1231 +msgid "Additional details:" +msgstr "其他細節:" + +#: ../../library/typing.rst:1233 +msgid "The arguments must be literal values and there must be at least one." +msgstr "引數必須為文本值且必須有至少一個。" + +#: ../../library/typing.rst:1235 +msgid "Nested ``Literal`` types are flattened, e.g.::" +msgstr "巢狀的 ``Literal`` 會是扁平化的 (flattened),舉例來說: ::" + +#: ../../library/typing.rst:1237 +msgid "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" +msgstr "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" + +#: ../../library/typing.rst:1239 +msgid "" +"However, this does not apply to ``Literal`` types referenced through a type " +"alias, to avoid forcing evaluation of the underlying :class:`TypeAliasType`::" +msgstr "" + +#: ../../library/typing.rst:1242 +msgid "" +"type A = Literal[1, 2]\n" +"assert Literal[A, 3] != Literal[1, 2, 3]" +msgstr "" +"type A = Literal[1, 2]\n" +"assert Literal[A, 3] != Literal[1, 2, 3]" + +#: ../../library/typing.rst:1247 +msgid "assert Literal[1, 2, 1] == Literal[1, 2]" +msgstr "assert Literal[1, 2, 1] == Literal[1, 2]" + +#: ../../library/typing.rst:1249 +msgid "When comparing literals, the argument order is ignored, e.g.::" +msgstr "當比較文本時,引數的順序會被忽略,舉例來說: ::" + +#: ../../library/typing.rst:1251 +msgid "assert Literal[1, 2] == Literal[2, 1]" +msgstr "assert Literal[1, 2] == Literal[2, 1]" + +#: ../../library/typing.rst:1253 +msgid "You cannot subclass or instantiate a ``Literal``." +msgstr "你不能建立 ``Literal`` 的子類別或是實例。" + +#: ../../library/typing.rst:1255 +msgid "You cannot write ``Literal[X][Y]``." +msgstr "你不能寫成 ``Literal[X][Y]``。" + +#: ../../library/typing.rst:1259 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -2016,11 +2120,11 @@ msgstr "" "比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" "的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1235 +#: ../../library/typing.rst:1267 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1237 +#: ../../library/typing.rst:1269 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 " @@ -2030,45 +2134,49 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1241 +#: ../../library/typing.rst:1273 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" " damage: int = 10 # instance variable" msgstr "" +"class Starship:\n" +" stats: ClassVar[dict[str, int]] = {} # 類別變數\n" +" damage: int = 10 # 實例變數" -#: ../../library/typing.rst:1245 +#: ../../library/typing.rst:1277 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1247 +#: ../../library/typing.rst:1279 msgid "" -":data:`ClassVar` is not a class itself, and should not be used with :func:" -"`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " -"runtime behavior, but it can be used by third-party type checkers. For " -"example, a type checker might flag the following code as an error::" +":data:`ClassVar` is not a class itself, and should not be used " +"with :func:`isinstance` or :func:`issubclass`. :data:`ClassVar` does not " +"change Python runtime behavior, but it can be used by third-party type " +"checkers. For example, a type checker might flag the following code as an " +"error::" msgstr "" -":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或是 :" -"func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行為," -"但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" -"式碼為一個錯誤: ::" +":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或" +"是 :func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行" +"為,但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方" +"的程式碼為一個錯誤: ::" -#: ../../library/typing.rst:1253 +#: ../../library/typing.rst:1285 msgid "" "enterprise_d = Starship(3000)\n" "enterprise_d.stats = {} # Error, setting class variable on instance\n" "Starship.stats = {} # This is OK" msgstr "" -#: ../../library/typing.rst:1261 +#: ../../library/typing.rst:1293 msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." msgstr "" -#: ../../library/typing.rst:1265 +#: ../../library/typing.rst:1297 msgid "Special typing construct to indicate final names to type checkers." msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" -#: ../../library/typing.rst:1267 +#: ../../library/typing.rst:1299 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -2076,7 +2184,7 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1272 +#: ../../library/typing.rst:1304 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2088,46 +2196,46 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1281 ../../library/typing.rst:3081 +#: ../../library/typing.rst:1313 ../../library/typing.rst:3114 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1288 +#: ../../library/typing.rst:1320 msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." msgstr "" -#: ../../library/typing.rst:1292 +#: ../../library/typing.rst:1324 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1294 +#: ../../library/typing.rst:1326 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." msgstr "" -"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" -"pep:`655`。" +"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` " +"與 :pep:`655`。" -#: ../../library/typing.rst:1301 +#: ../../library/typing.rst:1333 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1304 +#: ../../library/typing.rst:1336 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1310 +#: ../../library/typing.rst:1342 msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" -#: ../../library/typing.rst:1314 +#: ../../library/typing.rst:1346 msgid "" "class Movie(TypedDict):\n" " title: ReadOnly[str]\n" @@ -2137,20 +2245,27 @@ msgid "" " m[\"year\"] = 1999 # allowed\n" " m[\"title\"] = \"The Matrix\" # typechecker error" msgstr "" +"class Movie(TypedDict):\n" +" title: ReadOnly[str]\n" +" year: int\n" +"\n" +"def mutate_movie(m: Movie) -> None:\n" +" m[\"year\"] = 1999 # allowed\n" +" m[\"title\"] = \"The Matrix\" # 型別檢查器錯誤" -#: ../../library/typing.rst:1322 +#: ../../library/typing.rst:1354 msgid "There is no runtime checking for this property." msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" -#: ../../library/typing.rst:1324 +#: ../../library/typing.rst:1356 msgid "See :class:`TypedDict` and :pep:`705` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" -#: ../../library/typing.rst:1330 +#: ../../library/typing.rst:1362 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1332 +#: ../../library/typing.rst:1364 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -2158,7 +2273,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1337 +#: ../../library/typing.rst:1369 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 " @@ -2167,7 +2282,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1343 +#: ../../library/typing.rst:1375 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -2177,7 +2292,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1350 +#: ../../library/typing.rst:1382 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -2185,13 +2300,13 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1358 +#: ../../library/typing.rst:1390 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:1361 +#: ../../library/typing.rst:1393 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2209,70 +2324,47 @@ msgstr "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1371 -msgid "Details of the syntax:" -msgstr "" - -#: ../../library/typing.rst:1373 -msgid "The first argument to ``Annotated`` must be a valid type" -msgstr "" - -#: ../../library/typing.rst:1375 +#: ../../library/typing.rst:1403 msgid "" -"Multiple metadata elements can be supplied (``Annotated`` supports variadic " -"arguments)::" +"The first argument to ``Annotated`` must be a valid type. Multiple metadata " +"elements can be supplied as ``Annotated`` supports variadic arguments. The " +"order of the metadata elements is preserved and matters for equality checks::" msgstr "" -#: ../../library/typing.rst:1378 +#: ../../library/typing.rst:1407 msgid "" "@dataclass\n" "class ctype:\n" -" kind: str\n" +" kind: str\n" +"\n" +"a1 = Annotated[int, ValueRange(3, 10), ctype(\"char\")]\n" +"a2 = Annotated[int, ctype(\"char\"), ValueRange(3, 10)]\n" "\n" -"Annotated[int, ValueRange(3, 10), ctype(\"char\")]" +"assert a1 != a2 # Order matters" msgstr "" "@dataclass\n" "class ctype:\n" -" kind: str\n" +" kind: str\n" "\n" -"Annotated[int, ValueRange(3, 10), ctype(\"char\")]" +"a1 = Annotated[int, ValueRange(3, 10), ctype(\"char\")]\n" +"a2 = Annotated[int, ctype(\"char\"), ValueRange(3, 10)]\n" +"\n" +"assert a1 != a2 # 順序是有意義的" -#: ../../library/typing.rst:1384 +#: ../../library/typing.rst:1416 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:1388 -msgid "" -"``Annotated`` must be subscripted with at least two arguments " -"( ``Annotated[int]`` is not valid)" -msgstr "" - -#: ../../library/typing.rst:1391 -msgid "" -"The order of the metadata elements is preserved and matters for equality " -"checks::" -msgstr "" - -#: ../../library/typing.rst:1394 -msgid "" -"assert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\n" -" int, ctype(\"char\"), ValueRange(3, 10)\n" -"]" -msgstr "" -"assert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\n" -" int, ctype(\"char\"), ValueRange(3, 10)\n" -"]" - -#: ../../library/typing.rst:1398 +#: ../../library/typing.rst:1420 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1401 +#: ../../library/typing.rst:1423 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2284,11 +2376,30 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1405 +#: ../../library/typing.rst:1427 +msgid "" +"However, this does not apply to ``Annotated`` types referenced through a " +"type alias, to avoid forcing evaluation of the " +"underlying :class:`TypeAliasType`::" +msgstr "" + +#: ../../library/typing.rst:1430 +msgid "" +"type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" +"assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" +" int, ValueRange(3, 10), ctype(\"char\")\n" +"]" +msgstr "" +"type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" +"assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" +" int, ValueRange(3, 10), ctype(\"char\")\n" +"]" + +#: ../../library/typing.rst:1435 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1407 +#: ../../library/typing.rst:1437 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2298,11 +2409,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1411 +#: ../../library/typing.rst:1441 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1413 +#: ../../library/typing.rst:1443 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2316,35 +2427,31 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1425 +#: ../../library/typing.rst:1455 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1427 -msgid "type Variadic[*Ts] = Annotated[*Ts, Ann1] # NOT valid" +#: ../../library/typing.rst:1457 +msgid "" +"type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " +"Ann1] # NOT valid" msgstr "" +"type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " +"Ann1] # 無效" -#: ../../library/typing.rst:1429 -msgid "This would be equivalent to::" -msgstr "這會等價於: ::" - -#: ../../library/typing.rst:1431 -msgid "Annotated[T1, T2, T3, ..., Ann1]" -msgstr "Annotated[T1, T2, T3, ..., Ann1]" - -#: ../../library/typing.rst:1433 +#: ../../library/typing.rst:1459 msgid "" -"where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " -"invalid: only one type should be passed to Annotated." +"where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " +"as only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1436 +#: ../../library/typing.rst:1462 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1439 +#: ../../library/typing.rst:1465 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2362,13 +2469,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1449 +#: ../../library/typing.rst:1475 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1452 +#: ../../library/typing.rst:1478 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2384,13 +2491,13 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1461 +#: ../../library/typing.rst:1487 msgid "" -"At runtime, if you want to retrieve the original type wrapped by " -"``Annotated``, use the :attr:`!__origin__` attribute:" +"If you want to retrieve the original type wrapped by ``Annotated``, use " +"the :attr:`!__origin__` attribute:" msgstr "" -#: ../../library/typing.rst:1464 +#: ../../library/typing.rst:1490 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" @@ -2402,11 +2509,11 @@ msgstr "" ">>> Password.__origin__\n" "" -#: ../../library/typing.rst:1471 +#: ../../library/typing.rst:1497 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1499 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" @@ -2414,20 +2521,20 @@ msgstr "" ">>> get_origin(Password)\n" "typing.Annotated" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1506 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1481 +#: ../../library/typing.rst:1507 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1488 ../../library/typing.rst:1572 +#: ../../library/typing.rst:1514 ../../library/typing.rst:1598 msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1516 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2435,7 +2542,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1495 +#: ../../library/typing.rst:1521 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2445,7 +2552,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1501 +#: ../../library/typing.rst:1527 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2457,40 +2564,40 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1510 +#: ../../library/typing.rst:1536 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type predicate. Such a function should use ``TypeIs[...]`` or :data:" -"`TypeGuard` as its return type to alert static type checkers to this " -"intention. ``TypeIs`` usually has more intuitive behavior than " +"type predicate. Such a function should use ``TypeIs[...]`` " +"or :data:`TypeGuard` as its return type to alert static type checkers to " +"this intention. ``TypeIs`` usually has more intuitive behavior than " "``TypeGuard``, but it cannot be used when the input and output types are " "incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1518 +#: ../../library/typing.rst:1544 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1521 ../../library/typing.rst:1582 +#: ../../library/typing.rst:1547 ../../library/typing.rst:1608 msgid "The return value is a boolean." -msgstr "" +msgstr "回傳值是一個布林值。" -#: ../../library/typing.rst:1522 +#: ../../library/typing.rst:1548 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1524 +#: ../../library/typing.rst:1550 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1529 +#: ../../library/typing.rst:1555 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2514,7 +2621,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1550 +#: ../../library/typing.rst:1576 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2523,27 +2630,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1556 +#: ../../library/typing.rst:1582 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1560 +#: ../../library/typing.rst:1586 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1564 +#: ../../library/typing.rst:1590 msgid "" -"``TypeIs`` also works with type variables. For more information, see :pep:" -"`742` (Narrowing types with ``TypeIs``)." +"``TypeIs`` also works with type variables. For more information, " +"see :pep:`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1574 +#: ../../library/typing.rst:1600 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2551,25 +2658,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1579 +#: ../../library/typing.rst:1605 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1583 +#: ../../library/typing.rst:1609 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1586 +#: ../../library/typing.rst:1612 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1590 +#: ../../library/typing.rst:1616 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2584,11 +2691,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1602 +#: ../../library/typing.rst:1628 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" -msgstr "" +msgstr "``TypeIs`` 和 ``TypeGuard`` 在以下幾個方面有所不同:" -#: ../../library/typing.rst:1604 +#: ../../library/typing.rst:1630 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2596,7 +2703,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1608 +#: ../../library/typing.rst:1634 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2605,7 +2712,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1612 +#: ../../library/typing.rst:1638 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2613,18 +2720,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1647 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1623 +#: ../../library/typing.rst:1649 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1653 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2632,7 +2739,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1632 +#: ../../library/typing.rst:1658 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2640,7 +2747,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1638 +#: ../../library/typing.rst:1664 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2651,13 +2758,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1646 +#: ../../library/typing.rst:1672 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1675 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2670,23 +2777,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1659 +#: ../../library/typing.rst:1685 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1664 +#: ../../library/typing.rst:1690 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1666 +#: ../../library/typing.rst:1692 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1696 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2694,35 +2801,39 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1677 +#: ../../library/typing.rst:1703 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1679 +#: ../../library/typing.rst:1705 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1682 +#: ../../library/typing.rst:1708 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" " ...\n" " # Etc." msgstr "" +"class Mapping[KT, VT]:\n" +" def __getitem__(self, key: KT) -> VT:\n" +" ...\n" +" # Etc." -#: ../../library/typing.rst:1687 +#: ../../library/typing.rst:1713 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1691 +#: ../../library/typing.rst:1717 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1719 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2736,20 +2847,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1699 +#: ../../library/typing.rst:1725 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:1728 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1707 +#: ../../library/typing.rst:1733 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2767,18 +2878,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1719 +#: ../../library/typing.rst:1745 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1721 +#: ../../library/typing.rst:1747 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1726 +#: ../../library/typing.rst:1752 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2786,13 +2897,13 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1729 +#: ../../library/typing.rst:1755 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" msgstr "" -#: ../../library/typing.rst:1732 +#: ../../library/typing.rst:1758 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -2803,20 +2914,23 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1739 +#: ../../library/typing.rst:1765 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1741 +#: ../../library/typing.rst:1767 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" +"T = TypeVar('T') # 可以是任何東西\n" +"S = TypeVar('S', bound=str) # 可以是任何 str 的子型別\n" +"A = TypeVar('A', str, bytes) # 必須是 str 或 bytes" -#: ../../library/typing.rst:1745 +#: ../../library/typing.rst:1771 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -2824,7 +2938,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1751 +#: ../../library/typing.rst:1777 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2842,13 +2956,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1766 +#: ../../library/typing.rst:1792 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" -#: ../../library/typing.rst:1769 +#: ../../library/typing.rst:1795 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2858,14 +2972,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1777 +#: ../../library/typing.rst:1803 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1781 +#: ../../library/typing.rst:1807 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2879,13 +2993,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1818 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1821 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2896,13 +3010,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1804 +#: ../../library/typing.rst:1830 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1807 +#: ../../library/typing.rst:1833 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2915,88 +3029,88 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1815 +#: ../../library/typing.rst:1841 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." -msgstr "" +msgstr "在 runtime ``isinstance(x, T)`` 會引發 :exc:`TypeError`。" -#: ../../library/typing.rst:1819 +#: ../../library/typing.rst:1845 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1823 +#: ../../library/typing.rst:1849 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1827 +#: ../../library/typing.rst:1853 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1831 +#: ../../library/typing.rst:1857 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1837 +#: ../../library/typing.rst:1863 msgid "The upper bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1841 +#: ../../library/typing.rst:1867 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1847 +#: ../../library/typing.rst:1873 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1851 +#: ../../library/typing.rst:1877 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1857 +#: ../../library/typing.rst:1883 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1864 +#: ../../library/typing.rst:1890 msgid "" "Return whether or not the type variable has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1873 +#: ../../library/typing.rst:1899 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1879 ../../library/typing.rst:2018 -#: ../../library/typing.rst:2120 +#: ../../library/typing.rst:1905 ../../library/typing.rst:2044 +#: ../../library/typing.rst:2146 msgid "Support for default values was added." -msgstr "" +msgstr "新增對預設值的支援。" -#: ../../library/typing.rst:1885 +#: ../../library/typing.rst:1911 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1888 +#: ../../library/typing.rst:1914 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1891 +#: ../../library/typing.rst:1917 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -3006,11 +3120,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1894 +#: ../../library/typing.rst:1920 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1896 +#: ../../library/typing.rst:1922 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3024,7 +3138,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1902 +#: ../../library/typing.rst:1928 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3032,7 +3146,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1907 +#: ../../library/typing.rst:1933 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3052,7 +3166,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1924 +#: ../../library/typing.rst:1950 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3062,26 +3176,29 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1932 +#: ../../library/typing.rst:1958 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:1961 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" +"x: Ts # 無效\n" +"x: tuple[Ts] # 無效\n" +"x: tuple[*Ts] # 正確的做法" -#: ../../library/typing.rst:1939 +#: ../../library/typing.rst:1965 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1942 +#: ../../library/typing.rst:1968 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3093,12 +3210,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1947 +#: ../../library/typing.rst:1973 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1949 +#: ../../library/typing.rst:1975 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3113,26 +3230,29 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1963 +#: ../../library/typing.rst:1989 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1966 +#: ../../library/typing.rst:1992 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" +"x: tuple[*Ts, *Ts] # 無效\n" +"class Array[*Shape, *Shape]: # 無效\n" +" pass" -#: ../../library/typing.rst:1970 +#: ../../library/typing.rst:1996 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:1999 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3148,7 +3268,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:1980 +#: ../../library/typing.rst:2006 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3157,61 +3277,61 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:2013 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1991 +#: ../../library/typing.rst:2017 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:2021 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:2002 +#: ../../library/typing.rst:2028 msgid "" "Return whether or not the type variable tuple has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2039 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2022 +#: ../../library/typing.rst:2048 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2025 +#: ../../library/typing.rst:2051 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2028 +#: ../../library/typing.rst:2054 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2030 +#: ../../library/typing.rst:2056 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2033 +#: ../../library/typing.rst:2059 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2035 +#: ../../library/typing.rst:2061 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3221,7 +3341,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2042 +#: ../../library/typing.rst:2068 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3229,7 +3349,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2047 +#: ../../library/typing.rst:2073 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3247,97 +3367,98 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2062 +#: ../../library/typing.rst:2088 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2092 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2068 +#: ../../library/typing.rst:2094 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2075 +#: ../../library/typing.rst:2101 msgid "" -"Since ``ParamSpec`` captures both positional and keyword parameters, ``P." -"args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " +"Since ``ParamSpec`` captures both positional and keyword parameters, " +"``P.args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " "components. ``P.args`` represents the tuple of positional parameters in a " "given call and should only be used to annotate ``*args``. ``P.kwargs`` " "represents the mapping of keyword parameters to their values in a given " "call, and should be only be used to annotate ``**kwargs``. Both attributes " "require the annotated parameter to be in scope. At runtime, ``P.args`` and " -"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` and :class:" -"`ParamSpecKwargs`." +"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` " +"and :class:`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2087 +#: ../../library/typing.rst:2113 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2091 +#: ../../library/typing.rst:2117 msgid "" -"The default value of the parameter specification, or :data:`typing." -"NoDefault` if it has no default." +"The default value of the parameter specification, " +"or :data:`typing.NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2098 +#: ../../library/typing.rst:2124 msgid "" "Return whether or not the parameter specification has a default value. This " -"is equivalent to checking whether :attr:`__default__` is not the :data:" -"`typing.NoDefault` singleton, except that it does not force evaluation of " -"the :ref:`lazily evaluated ` default value." +"is equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2105 +#: ../../library/typing.rst:2131 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " -"generic types. The ``bound`` argument is also accepted, similar to :class:" -"`TypeVar`. However the actual semantics of these keywords are yet to be " -"decided." +"generic types. The ``bound`` argument is also accepted, similar " +"to :class:`TypeVar`. However the actual semantics of these keywords are yet " +"to be decided." msgstr "" -#: ../../library/typing.rst:2115 +#: ../../library/typing.rst:2141 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2123 +#: ../../library/typing.rst:2149 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2129 +#: ../../library/typing.rst:2155 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2135 +#: ../../library/typing.rst:2161 msgid "" -"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." -"args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " -"``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended for " -"runtime introspection and have no special meaning to static type checkers." +"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The " +"``P.args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, " +"and ``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended " +"for runtime introspection and have no special meaning to static type " +"checkers." msgstr "" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2166 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2143 +#: ../../library/typing.rst:2169 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3353,11 +3474,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2157 +#: ../../library/typing.rst:2183 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2161 +#: ../../library/typing.rst:2187 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3367,11 +3488,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2171 +#: ../../library/typing.rst:2197 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2173 +#: ../../library/typing.rst:2199 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3381,11 +3502,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2181 +#: ../../library/typing.rst:2207 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2183 +#: ../../library/typing.rst:2209 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3395,13 +3516,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2215 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2192 +#: ../../library/typing.rst:2218 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3417,14 +3538,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2203 +#: ../../library/typing.rst:2229 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2207 +#: ../../library/typing.rst:2233 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3448,27 +3569,27 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2221 +#: ../../library/typing.rst:2247 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2223 +#: ../../library/typing.rst:2249 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2229 +#: ../../library/typing.rst:2255 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2231 ../../library/typing.rst:2323 -#: ../../library/typing.rst:3364 +#: ../../library/typing.rst:2257 ../../library/typing.rst:2349 +#: ../../library/typing.rst:3397 msgid "Usage::" -msgstr "" +msgstr "用法: ::" -#: ../../library/typing.rst:2233 +#: ../../library/typing.rst:2259 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3478,20 +3599,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2237 +#: ../../library/typing.rst:2263 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2239 +#: ../../library/typing.rst:2265 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2241 +#: ../../library/typing.rst:2267 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2243 +#: ../../library/typing.rst:2269 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3507,12 +3628,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2250 +#: ../../library/typing.rst:2276 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2252 +#: ../../library/typing.rst:2278 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3521,11 +3642,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2258 +#: ../../library/typing.rst:2284 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2260 +#: ../../library/typing.rst:2286 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3536,11 +3657,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2268 +#: ../../library/typing.rst:2294 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2270 +#: ../../library/typing.rst:2296 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3550,11 +3671,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2274 +#: ../../library/typing.rst:2300 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2276 +#: ../../library/typing.rst:2302 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3567,38 +3688,38 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2286 +#: ../../library/typing.rst:2312 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2289 +#: ../../library/typing.rst:2315 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2292 +#: ../../library/typing.rst:2318 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2296 +#: ../../library/typing.rst:2322 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2300 +#: ../../library/typing.rst:2326 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2303 +#: ../../library/typing.rst:2329 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2308 +#: ../../library/typing.rst:2334 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3608,48 +3729,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2318 +#: ../../library/typing.rst:2344 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2320 +#: ../../library/typing.rst:2346 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2325 +#: ../../library/typing.rst:2351 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2330 +#: ../../library/typing.rst:2356 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2334 +#: ../../library/typing.rst:2360 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2338 +#: ../../library/typing.rst:2364 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2342 +#: ../../library/typing.rst:2368 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2347 +#: ../../library/typing.rst:2373 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2349 +#: ../../library/typing.rst:2375 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2351 +#: ../../library/typing.rst:2377 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3659,13 +3780,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2355 +#: ../../library/typing.rst:2381 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2358 +#: ../../library/typing.rst:2384 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3677,19 +3798,20 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2367 +#: ../../library/typing.rst:2393 msgid "" -"See :pep:`544` for more details. Protocol classes decorated with :func:" -"`runtime_checkable` (described later) act as simple-minded runtime protocols " -"that check only the presence of given attributes, ignoring their type " -"signatures." +"See :pep:`544` for more details. Protocol classes decorated " +"with :func:`runtime_checkable` (described later) act as simple-minded " +"runtime protocols that check only the presence of given attributes, ignoring " +"their type signatures. Protocol classes without this decorator cannot be " +"used as the second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: ../../library/typing.rst:2372 +#: ../../library/typing.rst:2399 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2401 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3699,13 +3821,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2378 +#: ../../library/typing.rst:2405 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2408 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3719,20 +3841,19 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2391 +#: ../../library/typing.rst:2418 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2393 +#: ../../library/typing.rst:2420 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " -"This raises :exc:`TypeError` when applied to a non-protocol class. This " -"allows a simple-minded structural check, very similar to \"one trick " -"ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." -"Iterable`. For example::" +"This allows a simple-minded structural check, very similar to \"one trick " +"ponies\" in :mod:`collections.abc` such " +"as :class:`~collections.abc.Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2398 +#: ../../library/typing.rst:2424 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3760,18 +3881,23 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2413 +#: ../../library/typing.rst:2437 +msgid "" +"This decorator raises :exc:`TypeError` when applied to a non-protocol class." +msgstr "" + +#: ../../library/typing.rst:2441 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " -"methods or attributes, not their type signatures or types. For example, :" -"class:`ssl.SSLObject` is a class, therefore it passes an :func:`issubclass` " -"check against :ref:`Callable `. However, the ``ssl." -"SSLObject.__init__`` method exists only to raise a :exc:`TypeError` with a " -"more informative message, therefore making it impossible to call " -"(instantiate) :class:`ssl.SSLObject`." +"methods or attributes, not their type signatures or types. For " +"example, :class:`ssl.SSLObject` is a class, therefore it passes " +"an :func:`issubclass` check against :ref:`Callable `. " +"However, the ``ssl.SSLObject.__init__`` method exists only to raise " +"a :exc:`TypeError` with a more informative message, therefore making it " +"impossible to call (instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2424 +#: ../../library/typing.rst:2452 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3779,7 +3905,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2432 +#: ../../library/typing.rst:2460 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3789,22 +3915,23 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2441 +#: ../../library/typing.rst:2469 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " "onto a runtime-checkable protocol will still work, but will have no impact " -"on :func:`isinstance` checks comparing objects to the protocol. See :ref:" -"`\"What's new in Python 3.12\" ` for more details." +"on :func:`isinstance` checks comparing objects to the protocol. " +"See :ref:`\"What's new in Python 3.12\" ` for more " +"details." msgstr "" -#: ../../library/typing.rst:2452 +#: ../../library/typing.rst:2480 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2455 +#: ../../library/typing.rst:2483 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -3812,7 +3939,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2461 +#: ../../library/typing.rst:2489 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3825,41 +3952,46 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2471 +#: ../../library/typing.rst:2499 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2474 +#: ../../library/typing.rst:2502 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2476 +#: ../../library/typing.rst:2504 msgid "" -"This functional syntax allows defining keys which are not valid :ref:" -"`identifiers `, for example because they are keywords or " -"contain hyphens::" +"This functional syntax allows defining keys which are not " +"valid :ref:`identifiers `, for example because they are " +"keywords or contain hyphens, or when key names must not be :ref:`mangled " +"` like regular private names::" msgstr "" -#: ../../library/typing.rst:2480 +#: ../../library/typing.rst:2509 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" " in: int # 'in' is a keyword\n" " x-y: int # name with hyphens\n" "\n" +"class Definition(TypedDict):\n" +" __schema: str # mangled to `_Definition__schema`\n" +"\n" "# OK, functional syntax\n" -"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" +"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})\n" +"Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: ../../library/typing.rst:2488 +#: ../../library/typing.rst:2521 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2491 +#: ../../library/typing.rst:2524 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3870,20 +4002,28 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" msgstr "" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: NotRequired[str]\n" +"\n" +"# 替代語法\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " +"NotRequired[str]})" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2532 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2502 +#: ../../library/typing.rst:2535 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2505 +#: ../../library/typing.rst:2538 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3892,8 +4032,14 @@ msgid "" "# Alternative syntax\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: int\n" +" y: int\n" +"\n" +"# 替代語法\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" -#: ../../library/typing.rst:2512 +#: ../../library/typing.rst:2545 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -3901,13 +4047,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2517 +#: ../../library/typing.rst:2550 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2520 +#: ../../library/typing.rst:2553 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3921,14 +4067,25 @@ msgid "" " 'label': str\n" "}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: Required[int]\n" +" y: Required[int]\n" +" label: str\n" +"\n" +"# 替代語法\n" +"Point2D = TypedDict('Point2D', {\n" +" 'x': Required[int],\n" +" 'y': Required[int],\n" +" 'label': str\n" +"}, total=False)" -#: ../../library/typing.rst:2532 +#: ../../library/typing.rst:2565 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2536 +#: ../../library/typing.rst:2569 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -3936,13 +4093,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2539 +#: ../../library/typing.rst:2572 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2542 +#: ../../library/typing.rst:2575 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -3954,13 +4111,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2547 +#: ../../library/typing.rst:2580 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2550 +#: ../../library/typing.rst:2583 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3974,12 +4131,23 @@ msgid "" "\n" "class XZ(X, Z): pass # raises TypeError" msgstr "" +"class X(TypedDict):\n" +" x: int\n" +"\n" +"class Y(TypedDict):\n" +" y: int\n" +"\n" +"class Z(object): pass # 一個非 TypedDict 的類別\n" +"\n" +"class XY(X, Y): pass # OK\n" +"\n" +"class XZ(X, Z): pass # 引發 TypeError" -#: ../../library/typing.rst:2562 +#: ../../library/typing.rst:2595 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2564 +#: ../../library/typing.rst:2597 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -3989,13 +4157,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2568 +#: ../../library/typing.rst:2601 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2571 +#: ../../library/typing.rst:2604 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4009,19 +4177,20 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2579 +#: ../../library/typing.rst:2612 msgid "" -"A ``TypedDict`` can be introspected via annotations dicts (see :ref:" -"`annotations-howto` for more information on annotations best practices), :" -"attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." +"A ``TypedDict`` can be introspected via annotations dicts " +"(see :ref:`annotations-howto` for more information on annotations best " +"practices), :attr:`__total__`, :attr:`__required_keys__`, " +"and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2585 +#: ../../library/typing.rst:2618 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2588 +#: ../../library/typing.rst:2621 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4045,7 +4214,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2601 +#: ../../library/typing.rst:2634 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4056,21 +4225,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2614 +#: ../../library/typing.rst:2647 msgid "" -"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" -"class:`frozenset` objects containing required and non-required keys, " +"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` " +"return :class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2617 +#: ../../library/typing.rst:2650 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2620 +#: ../../library/typing.rst:2653 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4079,7 +4248,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2627 +#: ../../library/typing.rst:2660 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4105,7 +4274,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2645 +#: ../../library/typing.rst:2678 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4114,48 +4283,48 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2651 +#: ../../library/typing.rst:2684 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2655 +#: ../../library/typing.rst:2688 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2662 +#: ../../library/typing.rst:2695 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2667 +#: ../../library/typing.rst:2700 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2671 +#: ../../library/typing.rst:2704 msgid "" -"Added support for marking individual keys as :data:`Required` or :data:" -"`NotRequired`. See :pep:`655`." +"Added support for marking individual keys as :data:`Required` " +"or :data:`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2675 +#: ../../library/typing.rst:2708 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2678 +#: ../../library/typing.rst:2711 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2681 +#: ../../library/typing.rst:2714 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2684 +#: ../../library/typing.rst:2717 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4165,106 +4334,106 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2693 +#: ../../library/typing.rst:2726 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2695 +#: ../../library/typing.rst:2728 msgid "" -"The following protocols are provided by the typing module. All are decorated " -"with :func:`@runtime_checkable `." +"The following protocols are provided by the :mod:`!typing` module. All are " +"decorated with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2700 +#: ../../library/typing.rst:2733 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2705 +#: ../../library/typing.rst:2738 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2709 +#: ../../library/typing.rst:2742 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2713 +#: ../../library/typing.rst:2746 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2717 +#: ../../library/typing.rst:2750 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2723 +#: ../../library/typing.rst:2756 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2727 +#: ../../library/typing.rst:2760 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2731 +#: ../../library/typing.rst:2764 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2737 +#: ../../library/typing.rst:2770 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2743 +#: ../../library/typing.rst:2776 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2747 +#: ../../library/typing.rst:2780 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2749 +#: ../../library/typing.rst:2782 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2756 +#: ../../library/typing.rst:2789 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2758 +#: ../../library/typing.rst:2791 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2761 +#: ../../library/typing.rst:2794 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2764 +#: ../../library/typing.rst:2797 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2768 +#: ../../library/typing.rst:2801 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2771 +#: ../../library/typing.rst:2804 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4274,16 +4443,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2782 +#: ../../library/typing.rst:2815 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2784 +#: ../../library/typing.rst:2817 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2786 +#: ../../library/typing.rst:2819 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4303,14 +4472,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2795 +#: ../../library/typing.rst:2828 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2800 +#: ../../library/typing.rst:2833 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4320,47 +4489,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2841 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2811 +#: ../../library/typing.rst:2844 msgid "" -"`Unreachable Code and Exhaustiveness Checking `__ has more information about " -"exhaustiveness checking with static typing." +"`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " +"checking with static typing." msgstr "" -#: ../../library/typing.rst:2819 +#: ../../library/typing.rst:2852 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2821 +#: ../../library/typing.rst:2854 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2824 +#: ../../library/typing.rst:2857 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2827 +#: ../../library/typing.rst:2860 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2830 +#: ../../library/typing.rst:2863 msgid "" -"At runtime, this function prints the runtime type of its argument to :data:" -"`sys.stderr` and returns the argument unchanged (allowing the call to be " -"used within an expression)::" +"At runtime, this function prints the runtime type of its argument " +"to :data:`sys.stderr` and returns the argument unchanged (allowing the call " +"to be used within an expression)::" msgstr "" -#: ../../library/typing.rst:2834 +#: ../../library/typing.rst:2867 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4368,13 +4537,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2837 +#: ../../library/typing.rst:2870 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2840 +#: ../../library/typing.rst:2873 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4382,13 +4551,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2851 +#: ../../library/typing.rst:2884 msgid "" -"Decorator to mark an object as providing :func:`dataclass `-like behavior." +"Decorator to mark an object as providing :func:`dataclass " +"`-like behavior." msgstr "" -#: ../../library/typing.rst:2854 +#: ../../library/typing.rst:2887 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4397,11 +4566,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2861 +#: ../../library/typing.rst:2894 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2896 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4423,11 +4592,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2875 +#: ../../library/typing.rst:2908 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2877 +#: ../../library/typing.rst:2910 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4443,11 +4612,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2884 +#: ../../library/typing.rst:2917 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2886 +#: ../../library/typing.rst:2919 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4467,15 +4636,15 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2895 +#: ../../library/typing.rst:2928 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :func:`@dataclasses.dataclass " +"`. For example, type checkers will assume these " +"classes have ``__init__`` methods that accept ``id`` and ``name``." msgstr "" -#: ../../library/typing.rst:2901 +#: ../../library/typing.rst:2934 msgid "" "The decorated class, metaclass, or function may accept the following bool " "arguments which type checkers will assume have the same effect as they would " @@ -4485,7 +4654,7 @@ msgid "" "arguments (``True`` or ``False``) to be statically evaluated." msgstr "" -#: ../../library/typing.rst:2909 +#: ../../library/typing.rst:2942 msgid "" "The arguments to the ``dataclass_transform`` decorator can be used to " "customize the default behaviors of the decorated class, metaclass, or " @@ -4496,90 +4665,90 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/typing.rst:2913 +#: ../../library/typing.rst:2946 msgid "" "Indicates whether the ``eq`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``True``." msgstr "" -#: ../../library/typing.rst:2918 +#: ../../library/typing.rst:2951 msgid "" "Indicates whether the ``order`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:2923 +#: ../../library/typing.rst:2956 msgid "" "Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:2928 +#: ../../library/typing.rst:2961 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``. .. " "versionadded:: 3.12" msgstr "" -#: ../../library/typing.rst:2929 +#: ../../library/typing.rst:2962 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:2935 +#: ../../library/typing.rst:2968 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" -#: ../../library/typing.rst:2941 +#: ../../library/typing.rst:2974 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." msgstr "" -#: ../../library/typing.rst:2945 +#: ../../library/typing.rst:2978 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" -#: ../../library/typing.rst:2948 +#: ../../library/typing.rst:2981 msgid "**Recognised parameters for field specifiers**" msgstr "" -#: ../../library/typing.rst:2952 +#: ../../library/typing.rst:2985 msgid "Parameter name" msgstr "" -#: ../../library/typing.rst:2953 +#: ../../library/typing.rst:2986 msgid "Description" msgstr "" -#: ../../library/typing.rst:2954 +#: ../../library/typing.rst:2987 msgid "``init``" msgstr "``init``" -#: ../../library/typing.rst:2955 +#: ../../library/typing.rst:2988 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" -#: ../../library/typing.rst:2958 +#: ../../library/typing.rst:2991 msgid "``default``" msgstr "``default``" -#: ../../library/typing.rst:2959 +#: ../../library/typing.rst:2992 msgid "Provides the default value for the field." msgstr "" -#: ../../library/typing.rst:2960 +#: ../../library/typing.rst:2993 msgid "``default_factory``" msgstr "``default_factory``" -#: ../../library/typing.rst:2961 +#: ../../library/typing.rst:2994 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " @@ -4587,19 +4756,19 @@ msgid "" "is instantiated." msgstr "" -#: ../../library/typing.rst:2966 +#: ../../library/typing.rst:2999 msgid "``factory``" msgstr "``factory``" -#: ../../library/typing.rst:2967 +#: ../../library/typing.rst:3000 msgid "An alias for the ``default_factory`` parameter on field specifiers." msgstr "" -#: ../../library/typing.rst:2968 +#: ../../library/typing.rst:3001 msgid "``kw_only``" msgstr "``kw_only``" -#: ../../library/typing.rst:2969 +#: ../../library/typing.rst:3002 msgid "" "Indicates whether the field should be marked as keyword-only. If ``True``, " "the field will be keyword-only. If ``False``, it will not be keyword-only. " @@ -4609,32 +4778,32 @@ msgid "" "will be used." msgstr "" -#: ../../library/typing.rst:2975 +#: ../../library/typing.rst:3008 msgid "``alias``" msgstr "``alias``" -#: ../../library/typing.rst:2976 +#: ../../library/typing.rst:3009 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" -#: ../../library/typing.rst:2979 +#: ../../library/typing.rst:3012 msgid "" "At runtime, this decorator records its arguments in the " "``__dataclass_transform__`` attribute on the decorated object. It has no " "other runtime effect." msgstr "" -#: ../../library/typing.rst:2983 +#: ../../library/typing.rst:3016 msgid "See :pep:`681` for more details." msgstr "更多細節請見 :pep:`681`。" -#: ../../library/typing.rst:2991 +#: ../../library/typing.rst:3024 msgid "Decorator for creating overloaded functions and methods." msgstr "" -#: ../../library/typing.rst:2993 +#: ../../library/typing.rst:3026 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -4642,23 +4811,23 @@ msgid "" "``@overload``-decorated definition (for the same function/method)." msgstr "" -#: ../../library/typing.rst:2998 +#: ../../library/typing.rst:3031 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " "definition. The non-``@overload``-decorated definition, meanwhile, will be " "used at runtime but should be ignored by a type checker. At runtime, " -"calling an ``@overload``-decorated function directly will raise :exc:" -"`NotImplementedError`." +"calling an ``@overload``-decorated function directly will " +"raise :exc:`NotImplementedError`." msgstr "" -#: ../../library/typing.rst:3006 +#: ../../library/typing.rst:3039 msgid "" "An example of overload that gives a more precise type than can be expressed " "using a union or a type variable:" msgstr "" -#: ../../library/typing.rst:3009 +#: ../../library/typing.rst:3042 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -4672,25 +4841,36 @@ msgid "" "def process(response):\n" " ... # actual implementation goes here" msgstr "" +"@overload\n" +"def process(response: None) -> None:\n" +" ...\n" +"@overload\n" +"def process(response: int) -> tuple[int, str]:\n" +" ...\n" +"@overload\n" +"def process(response: bytes) -> str:\n" +" ...\n" +"def process(response):\n" +" ... # 實際的實作在這邊" -#: ../../library/typing.rst:3023 +#: ../../library/typing.rst:3056 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3025 +#: ../../library/typing.rst:3058 msgid "" -"Overloaded functions can now be introspected at runtime using :func:" -"`get_overloads`." +"Overloaded functions can now be introspected at runtime " +"using :func:`get_overloads`." msgstr "" -#: ../../library/typing.rst:3032 +#: ../../library/typing.rst:3065 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:3035 +#: ../../library/typing.rst:3068 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4700,32 +4880,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3075 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3050 +#: ../../library/typing.rst:3083 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3052 +#: ../../library/typing.rst:3085 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3059 +#: ../../library/typing.rst:3092 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3061 +#: ../../library/typing.rst:3094 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3067 +#: ../../library/typing.rst:3100 msgid "" "class Base:\n" " @final\n" @@ -4741,8 +4921,21 @@ msgid "" "class Other(Leaf): # Error reported by type checker\n" " ..." msgstr "" +"class Base:\n" +" @final\n" +" def done(self) -> None:\n" +" ...\n" +"class Sub(Base):\n" +" def done(self) -> None: # 型別檢查器回報的錯誤\n" +" ...\n" +"\n" +"@final\n" +"class Leaf:\n" +" ...\n" +"class Other(Leaf): # 型別檢查器回報的錯誤\n" +" ..." -#: ../../library/typing.rst:3086 +#: ../../library/typing.rst:3119 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -4752,11 +4945,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3097 +#: ../../library/typing.rst:3130 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3099 +#: ../../library/typing.rst:3132 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -4764,40 +4957,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3105 +#: ../../library/typing.rst:3138 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3109 +#: ../../library/typing.rst:3142 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3111 +#: ../../library/typing.rst:3144 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3114 +#: ../../library/typing.rst:3147 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3120 +#: ../../library/typing.rst:3153 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3123 +#: ../../library/typing.rst:3156 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3130 +#: ../../library/typing.rst:3163 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4813,11 +5006,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3145 +#: ../../library/typing.rst:3178 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3147 +#: ../../library/typing.rst:3180 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4827,22 +5020,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3154 +#: ../../library/typing.rst:3187 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3161 +#: ../../library/typing.rst:3194 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3163 +#: ../../library/typing.rst:3196 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3167 +#: ../../library/typing.rst:3200 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4852,29 +5045,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3174 +#: ../../library/typing.rst:3207 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3211 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3182 +#: ../../library/typing.rst:3215 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:3185 +#: ../../library/typing.rst:3218 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3188 +#: ../../library/typing.rst:3221 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4883,17 +5076,17 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3193 +#: ../../library/typing.rst:3226 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3194 +#: ../../library/typing.rst:3227 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:3196 +#: ../../library/typing.rst:3229 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " @@ -4903,62 +5096,62 @@ msgid "" "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3236 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " -"with ``T``, unless *include_extras* is set to ``True`` (see :class:" -"`Annotated` for more information)." +"with ``T``, unless *include_extras* is set to ``True`` " +"(see :class:`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:3207 +#: ../../library/typing.rst:3240 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3212 +#: ../../library/typing.rst:3245 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " -"are not valid Python code, this function will raise an exception such as :" -"exc:`NameError`. For example, this can happen with imported :ref:`type " +"are not valid Python code, this function will raise an exception such " +"as :exc:`NameError`. For example, this can happen with imported :ref:`type " "aliases ` that include forward references, or with names " "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3251 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." msgstr "" -"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" -"`Annotated` 的文件。" +"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請" +"見 :data:`Annotated` 的文件。" -#: ../../library/typing.rst:3222 +#: ../../library/typing.rst:3255 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3229 +#: ../../library/typing.rst:3262 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3232 +#: ../../library/typing.rst:3265 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " -"it will be normalized to the original class. If ``X`` is an instance of :" -"class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the underlying :" -"class:`ParamSpec`. Return ``None`` for unsupported objects." +"it will be normalized to the original class. If ``X`` is an instance " +"of :class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the " +"underlying :class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3238 ../../library/typing.rst:3262 +#: ../../library/typing.rst:3271 ../../library/typing.rst:3295 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3240 +#: ../../library/typing.rst:3273 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -4976,13 +5169,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3287 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3257 +#: ../../library/typing.rst:3290 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -4990,7 +5183,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3297 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5000,11 +5193,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3307 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3276 +#: ../../library/typing.rst:3309 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5013,16 +5206,22 @@ msgid "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" msgstr "" +">>> from typing import Protocol, get_protocol_members\n" +">>> class P(Protocol):\n" +"... def a(self) -> str: ...\n" +"... b: int\n" +">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" +"True" -#: ../../library/typing.rst:3285 +#: ../../library/typing.rst:3318 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3291 +#: ../../library/typing.rst:3324 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3295 +#: ../../library/typing.rst:3328 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5031,12 +5230,18 @@ msgid "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" msgstr "" +"class P(Protocol):\n" +" def a(self) -> str: ...\n" +" b: int\n" +"\n" +"is_protocol(P) # => True\n" +"is_protocol(int) # => False" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3339 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3310 +#: ../../library/typing.rst:3343 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5050,32 +5255,32 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3327 +#: ../../library/typing.rst:3360 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3329 +#: ../../library/typing.rst:3362 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3334 +#: ../../library/typing.rst:3367 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3342 +#: ../../library/typing.rst:3375 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3345 +#: ../../library/typing.rst:3378 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5084,18 +5289,24 @@ msgid "" ">>> S.__default__ is None\n" "True" msgstr "" +">>> T = TypeVar(\"T\")\n" +">>> T.__default__ is typing.NoDefault\n" +"True\n" +">>> S = TypeVar(\"S\", default=None)\n" +">>> S.__default__ is None\n" +"True" -#: ../../library/typing.rst:3357 +#: ../../library/typing.rst:3390 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3361 +#: ../../library/typing.rst:3394 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3366 +#: ../../library/typing.rst:3399 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5109,7 +5320,7 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3372 +#: ../../library/typing.rst:3405 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -5117,7 +5328,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3379 +#: ../../library/typing.rst:3412 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -5125,20 +5336,20 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3391 +#: ../../library/typing.rst:3424 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3393 +#: ../../library/typing.rst:3426 msgid "" "This module defines several deprecated aliases to pre-existing standard " -"library classes. These were originally included in the typing module in " -"order to support parameterizing these generic classes using ``[]``. However, " -"the aliases became redundant in Python 3.9 when the corresponding pre-" -"existing classes were enhanced to support ``[]`` (see :pep:`585`)." +"library classes. These were originally included in the :mod:`!typing` module " +"in order to support parameterizing these generic classes using ``[]``. " +"However, the aliases became redundant in Python 3.9 when the corresponding " +"pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3400 +#: ../../library/typing.rst:3433 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5146,571 +5357,577 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3405 +#: ../../library/typing.rst:3438 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " -"releases prior to removal. The aliases are guaranteed to remain in the " -"typing module without deprecation warnings until at least Python 3.14." +"releases prior to removal. The aliases are guaranteed to remain in " +"the :mod:`!typing` module without deprecation warnings until at least Python " +"3.14." msgstr "" -#: ../../library/typing.rst:3410 +#: ../../library/typing.rst:3443 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3416 +#: ../../library/typing.rst:3449 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3420 +#: ../../library/typing.rst:3453 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3422 +#: ../../library/typing.rst:3455 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3459 msgid "" -":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.dict ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3432 +#: ../../library/typing.rst:3465 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3434 +#: ../../library/typing.rst:3467 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Iterable` rather than to use :class:`list` or :class:`!" -"typing.List`." +"collection type such as :class:`~collections.abc.Sequence` " +"or :class:`~collections.abc.Iterable` rather than to use :class:`list` " +"or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:3439 +#: ../../library/typing.rst:3472 msgid "" -":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.list ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3445 +#: ../../library/typing.rst:3478 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3447 +#: ../../library/typing.rst:3480 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`collections.abc.Set` rather than to use :" -"class:`set` or :class:`typing.Set`." +"collection type such as :class:`collections.abc.Set` rather than to " +"use :class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3451 +#: ../../library/typing.rst:3484 msgid "" -":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.set ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3457 +#: ../../library/typing.rst:3490 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3459 +#: ../../library/typing.rst:3492 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3466 +#: ../../library/typing.rst:3499 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3468 +#: ../../library/typing.rst:3501 msgid "" -":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" -"`annotating-tuples` for more details." +":class:`tuple` and ``Tuple`` are special-cased in the type system; " +"see :ref:`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3471 +#: ../../library/typing.rst:3504 msgid "" -":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.tuple ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3477 +#: ../../library/typing.rst:3510 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3479 +#: ../../library/typing.rst:3512 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3517 msgid "" -":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.type ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3491 +#: ../../library/typing.rst:3524 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3495 +#: ../../library/typing.rst:3528 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3532 msgid "" -":class:`collections.defaultdict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.defaultdict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3505 +#: ../../library/typing.rst:3538 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3509 +#: ../../library/typing.rst:3542 msgid "" -":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.OrderedDict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3515 +#: ../../library/typing.rst:3548 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3519 +#: ../../library/typing.rst:3552 msgid "" -":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.ChainMap` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3525 +#: ../../library/typing.rst:3558 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3529 +#: ../../library/typing.rst:3562 msgid "" -":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.Counter` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3535 +#: ../../library/typing.rst:3568 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3539 +#: ../../library/typing.rst:3572 msgid "" -":class:`collections.deque` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.deque` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3546 +#: ../../library/typing.rst:3579 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3551 +#: ../../library/typing.rst:3584 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3554 +#: ../../library/typing.rst:3587 msgid "" -"These types (and the corresponding functions) are generic over :data:" -"`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " +"These types (and the corresponding functions) are generic " +"over :data:`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " "``Pattern[bytes]``; ``Match`` can be specialised as ``Match[str]`` or " "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3559 +#: ../../library/typing.rst:3592 msgid "" -"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" -"pep:`585` and :ref:`types-genericalias`." +"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3565 +#: ../../library/typing.rst:3598 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3567 +#: ../../library/typing.rst:3600 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3571 +#: ../../library/typing.rst:3604 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3574 +#: ../../library/typing.rst:3607 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" +"def add_unicode_checkmark(text: Text) -> Text:\n" +" return text + u' \\u2713'" -#: ../../library/typing.rst:3579 +#: ../../library/typing.rst:3612 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3589 +#: ../../library/typing.rst:3622 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3593 +#: ../../library/typing.rst:3626 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3595 +#: ../../library/typing.rst:3628 msgid "" -":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.abc.Set` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3601 +#: ../../library/typing.rst:3634 msgid "" -"This type represents the types :class:`bytes`, :class:`bytearray`, and :" -"class:`memoryview` of byte sequences." +"This type represents the types :class:`bytes`, :class:`bytearray`, " +"and :class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3604 +#: ../../library/typing.rst:3637 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3609 +#: ../../library/typing.rst:3642 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3646 msgid "" -":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Collection` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3619 +#: ../../library/typing.rst:3652 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3621 +#: ../../library/typing.rst:3654 msgid "" -":class:`collections.abc.Container` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Container` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3627 +#: ../../library/typing.rst:3660 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3629 +#: ../../library/typing.rst:3662 msgid "" -":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ItemsView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3635 +#: ../../library/typing.rst:3668 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3637 +#: ../../library/typing.rst:3670 msgid "" -":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.KeysView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3643 +#: ../../library/typing.rst:3676 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3645 +#: ../../library/typing.rst:3678 msgid "" -":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Mapping` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3651 +#: ../../library/typing.rst:3684 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3653 +#: ../../library/typing.rst:3686 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3659 +#: ../../library/typing.rst:3692 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3661 +#: ../../library/typing.rst:3694 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3668 +#: ../../library/typing.rst:3701 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3670 +#: ../../library/typing.rst:3703 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3677 +#: ../../library/typing.rst:3710 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3679 +#: ../../library/typing.rst:3712 msgid "" -":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.MutableSet` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3685 +#: ../../library/typing.rst:3718 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3687 +#: ../../library/typing.rst:3720 msgid "" -":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Sequence` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3693 +#: ../../library/typing.rst:3726 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3695 +#: ../../library/typing.rst:3728 msgid "" -":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ValuesView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3702 +#: ../../library/typing.rst:3735 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" -msgstr "" +msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3706 +#: ../../library/typing.rst:3739 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3708 +#: ../../library/typing.rst:3741 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Coroutine` and ``typing.Coroutine`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3714 +#: ../../library/typing.rst:3747 msgid "" -":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Coroutine` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3720 +#: ../../library/typing.rst:3753 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3722 +#: ../../library/typing.rst:3755 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " -"annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` " +"in type annotations." msgstr "" -#: ../../library/typing.rst:3728 +#: ../../library/typing.rst:3761 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3733 +#: ../../library/typing.rst:3766 msgid "The ``SendType`` parameter now has a default." -msgstr "" +msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3738 +#: ../../library/typing.rst:3771 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3742 +#: ../../library/typing.rst:3775 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3748 +#: ../../library/typing.rst:3781 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3785 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3758 +#: ../../library/typing.rst:3791 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3762 +#: ../../library/typing.rst:3795 msgid "" -":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Awaitable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3769 +#: ../../library/typing.rst:3802 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3773 +#: ../../library/typing.rst:3806 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3775 +#: ../../library/typing.rst:3808 msgid "" -":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3781 +#: ../../library/typing.rst:3814 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3783 +#: ../../library/typing.rst:3816 msgid "" -":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3789 +#: ../../library/typing.rst:3822 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3791 +#: ../../library/typing.rst:3824 msgid "" -"See :ref:`annotating-callables` for details on how to use :class:" -"`collections.abc.Callable` and ``typing.Callable`` in type annotations." +"See :ref:`annotating-callables` for details on how to " +"use :class:`collections.abc.Callable` and ``typing.Callable`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3794 +#: ../../library/typing.rst:3827 msgid "" -":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Callable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3804 +#: ../../library/typing.rst:3837 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3806 +#: ../../library/typing.rst:3839 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Generator` and ``typing.Generator`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Generator` and ``typing.Generator`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3810 +#: ../../library/typing.rst:3843 msgid "" -":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Generator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3814 +#: ../../library/typing.rst:3847 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3819 +#: ../../library/typing.rst:3852 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3821 +#: ../../library/typing.rst:3854 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3826 +#: ../../library/typing.rst:3859 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3828 +#: ../../library/typing.rst:3861 msgid "" -":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Reversible` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3834 +#: ../../library/typing.rst:3867 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3836 +#: ../../library/typing.rst:3869 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3842 +#: ../../library/typing.rst:3875 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3879 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3848 +#: ../../library/typing.rst:3881 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__enter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__enter__` method. The optional second type parameter, " "``ExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:3855 +#: ../../library/typing.rst:3888 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3860 +#: ../../library/typing.rst:3893 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:3865 +#: ../../library/typing.rst:3898 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3867 +#: ../../library/typing.rst:3900 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__aenter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__aenter__` method. The optional second type parameter, " "``AExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:3874 +#: ../../library/typing.rst:3907 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3912 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:3883 +#: ../../library/typing.rst:3916 msgid "Deprecation Timeline of Major Features" -msgstr "" +msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:3885 +#: ../../library/typing.rst:3918 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -5718,111 +5935,130 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3892 +#: ../../library/typing.rst:3925 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3893 +#: ../../library/typing.rst:3926 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3927 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3928 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3896 +#: ../../library/typing.rst:3929 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3897 ../../library/typing.rst:3901 +#: ../../library/typing.rst:3930 ../../library/typing.rst:3934 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:3931 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3899 +#: ../../library/typing.rst:3932 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:3933 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3902 +#: ../../library/typing.rst:3935 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3903 +#: ../../library/typing.rst:3936 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3904 +#: ../../library/typing.rst:3937 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3905 +#: ../../library/typing.rst:3938 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3906 ../../library/typing.rst:3910 -#: ../../library/typing.rst:3914 +#: ../../library/typing.rst:3939 ../../library/typing.rst:3943 +#: ../../library/typing.rst:3947 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3907 +#: ../../library/typing.rst:3940 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3908 +#: ../../library/typing.rst:3941 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3909 ../../library/typing.rst:3913 +#: ../../library/typing.rst:3942 ../../library/typing.rst:3946 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:3911 +#: ../../library/typing.rst:3944 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:3945 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3915 +#: ../../library/typing.rst:3948 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:3916 +#: ../../library/typing.rst:3949 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:3917 ../../library/typing.rst:3921 +#: ../../library/typing.rst:3950 ../../library/typing.rst:3954 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3918 +#: ../../library/typing.rst:3951 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:3919 +#: ../../library/typing.rst:3952 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:3920 +#: ../../library/typing.rst:3953 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:3922 +#: ../../library/typing.rst:3955 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:3923 +#: ../../library/typing.rst:3956 msgid ":gh:`105578`" msgstr ":gh:`105578`" + +#~ msgid "" +#~ "@dataclass\n" +#~ "class ctype:\n" +#~ " kind: str\n" +#~ "\n" +#~ "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" +#~ msgstr "" +#~ "@dataclass\n" +#~ "class ctype:\n" +#~ " kind: str\n" +#~ "\n" +#~ "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" + +#~ msgid "This would be equivalent to::" +#~ msgstr "這會等價於: ::" + +#~ msgid "Annotated[T1, T2, T3, ..., Ann1]" +#~ msgstr "Annotated[T1, T2, T3, ..., Ann1]" diff --git a/library/unicodedata.po b/library/unicodedata.po index 2e2e5479be..a4a717761c 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -26,8 +26,8 @@ msgstr ":mod:`!unicodedata` --- Unicode 資料庫" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 15.1.0 `_." +"in this database is compiled from the `UCD version 15.1.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -57,22 +57,22 @@ msgstr "" #: ../../library/unicodedata.rst:47 msgid "" "Returns the decimal value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" #: ../../library/unicodedata.rst:54 msgid "" "Returns the digit value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" #: ../../library/unicodedata.rst:61 msgid "" "Returns the numeric value assigned to the character *chr* as float. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" #: ../../library/unicodedata.rst:68 @@ -188,14 +188,12 @@ msgid "Footnotes" msgstr "註解" #: ../../library/unicodedata.rst:178 -#, fuzzy msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" -msgstr "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" #: ../../library/unicodedata.rst:180 -#, fuzzy msgid "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" -msgstr "https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt" +msgstr "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" #: ../../library/unicodedata.rst:11 msgid "Unicode" diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 1b709b5160..cb271a4ff9 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -75,8 +75,9 @@ msgid "" "with the correct arguments." msgstr "" "一旦 mock 被呼叫,它的 :attr:`~Mock.called` 屬性將被設定為 ``True``。更重要的" -"是,我們可以使用 :meth:`~Mock.assert_called_with` 或 :meth:`~Mock." -"assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼叫。" +"是,我們可以使用 :meth:`~Mock.assert_called_with` " +"或 :meth:`~Mock.assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼" +"叫。" #: ../../library/unittest.mock-examples.rst:59 msgid "" @@ -121,12 +122,12 @@ msgstr "" msgid "" "We don't have to do any work to provide the 'close' method on our mock. " "Accessing close creates it. So, if 'close' hasn't already been called then " -"accessing it in the test will create it, but :meth:`~Mock." -"assert_called_with` will raise a failure exception." +"accessing it in the test will create it, " +"but :meth:`~Mock.assert_called_with` will raise a failure exception." msgstr "" "我們不必做任何額外的事情來為 mock 提供 'close' 方法,存取 close 會建立它。因" -"此,如果 'close' 並未被呼叫過,在測試中存取 'close' 就會建立它,但 :meth:" -"`~Mock.assert_called_with` 就會引發一個失敗的例外。" +"此,如果 'close' 並未被呼叫過,在測試中存取 'close' 就會建立它," +"但 :meth:`~Mock.assert_called_with` 就會引發一個失敗的例外。" #: ../../library/unittest.mock-examples.rst:106 msgid "Mocking Classes" @@ -148,8 +149,8 @@ msgid "" "In the example below we have a function ``some_function`` that instantiates " "``Foo`` and calls a method on it. The call to :func:`patch` replaces the " "class ``Foo`` with a mock. The ``Foo`` instance is the result of calling the " -"mock, so it is configured by modifying the mock :attr:`~Mock." -"return_value`. ::" +"mock, so it is configured by modifying the " +"mock :attr:`~Mock.return_value`. ::" msgstr "" "在下面的範例中,我們有一個函式 ``some_function``,它實例化 ``Foo`` 並呼叫它的" "方法。對 :func:`patch` 的呼叫將類別 ``Foo`` 替換為一個 mock。``Foo`` 實例是呼" @@ -197,9 +198,9 @@ msgstr "追蹤所有呼叫" #: ../../library/unittest.mock-examples.rst:146 msgid "" -"Often you want to track more than a single call to a method. The :attr:" -"`~Mock.mock_calls` attribute records all calls to child attributes of the " -"mock - and also to their children." +"Often you want to track more than a single call to a method. " +"The :attr:`~Mock.mock_calls` attribute records all calls to child attributes " +"of the mock - and also to their children." msgstr "" "通常你會想要追蹤對一個方法的多個呼叫。:attr:`~Mock.mock_calls` 屬性記錄對 " "mock 的子屬性以及其子屬性的所有呼叫。" @@ -256,9 +257,9 @@ msgid "" "``mock.connection.cursor().execute(\"SELECT 1\")``. If we wanted this call " "to return a list, then we have to configure the result of the nested call." msgstr "" -"有時你想要 mock 更複雜的情況,例如 ``mock.connection.cursor()." -"execute(\"SELECT 1\")``。如果我們希望此呼叫回傳一個串列,那麼我們就必須配置巢" -"狀呼叫的結果。" +"有時你想要 mock 更複雜的情況,例如 " +"``mock.connection.cursor().execute(\"SELECT 1\")``。如果我們希望此呼叫回傳一" +"個串列,那麼我們就必須配置巢狀呼叫的結果。" #: ../../library/unittest.mock-examples.rst:214 msgid "" @@ -322,10 +323,10 @@ msgstr "Mock 非同步可疊代物件" #: ../../library/unittest.mock-examples.rst:283 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-iterators` through ``__aiter__``. The :attr:`~Mock.return_value` " -"attribute of ``__aiter__`` can be used to set the return values to be used " -"for iteration." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-iterators` through ``__aiter__``. " +"The :attr:`~Mock.return_value` attribute of ``__aiter__`` can be used to set " +"the return values to be used for iteration." msgstr "" "從 Python 3.8 開始,``AsyncMock`` 和 ``MagicMock`` 支援透過 ``__aiter__`` 來 " "mock :ref:`async-iterators`。``__aiter__`` 的 :attr:`~Mock.return_value` 屬性" @@ -337,10 +338,10 @@ msgstr "Mock 非同步情境管理器" #: ../../library/unittest.mock-examples.rst:300 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-context-managers` through ``__aenter__`` and ``__aexit__``. By " -"default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances that " -"return an async function." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-context-managers` through ``__aenter__`` and ``__aexit__``. " +"By default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances " +"that return an async function." msgstr "" "從 Python 3.8 開始,``AsyncMock`` 和 ``MagicMock`` 支援透過 ``__aenter__`` " "和 ``__aexit__`` 來 mock :ref:`async-context-managers`。預設情況下," @@ -426,9 +427,10 @@ msgstr "使用 side_effect 回傳各別檔案內容" #: ../../library/unittest.mock-examples.rst:366 msgid "" -":func:`mock_open` is used to patch :func:`open` method. :attr:`~Mock." -"side_effect` can be used to return a new Mock object per call. This can be " -"used to return different contents per file stored in a dictionary::" +":func:`mock_open` is used to patch :func:`open` " +"method. :attr:`~Mock.side_effect` can be used to return a new Mock object " +"per call. This can be used to return different contents per file stored in a " +"dictionary::" msgstr "" ":func:`mock_open` 是用於 patch :func:`open` 方法。:attr:`~Mock.side_effect` " "可以用來在每次呼叫回傳一個新的 mock 物件。這可以用於回傳儲存在字典中的各別檔" @@ -499,19 +501,19 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:404 msgid "" -"mock provides three convenient decorators for this: :func:`patch`, :func:" -"`patch.object` and :func:`patch.dict`. ``patch`` takes a single string, of " -"the form ``package.module.Class.attribute`` to specify the attribute you are " -"patching. It also optionally takes a value that you want the attribute (or " -"class or whatever) to be replaced with. 'patch.object' takes an object and " -"the name of the attribute you would like patched, plus optionally the value " -"to patch it with." +"mock provides three convenient decorators for " +"this: :func:`patch`, :func:`patch.object` and :func:`patch.dict`. ``patch`` " +"takes a single string, of the form ``package.module.Class.attribute`` to " +"specify the attribute you are patching. It also optionally takes a value " +"that you want the attribute (or class or whatever) to be replaced with. " +"'patch.object' takes an object and the name of the attribute you would like " +"patched, plus optionally the value to patch it with." msgstr "" -"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` 和 :" -"func:`patch.dict`。``patch`` 接受單一字串,格式為 ``package.module.Class." -"attribute``,用來指定要 patch 的屬性。同時它也可以接受你想要替換的屬性(或類" -"別或其他)的值。``patch.object`` 接受一個物件和你想要 patch 的屬性的名稱,同" -"時也可以接受要 patch 的值。" +"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` " +"和 :func:`patch.dict`。``patch`` 接受單一字串,格式為 " +"``package.module.Class.attribute``,用來指定要 patch 的屬性。同時它也可以接受" +"你想要替換的屬性(或類別或其他)的值。``patch.object`` 接受一個物件和你想要 " +"patch 的屬性的名稱,同時也可以接受要 patch 的值。" #: ../../library/unittest.mock-examples.rst:412 msgid "``patch.object``::" @@ -551,11 +553,11 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:429 msgid "" -"If you are patching a module (including :mod:`builtins`) then use :func:" -"`patch` instead of :func:`patch.object`:" +"If you are patching a module (including :mod:`builtins`) then " +"use :func:`patch` instead of :func:`patch.object`:" msgstr "" -"如果你要 patch 一個模組(包括 :mod:`builtins`),請使用 :func:`patch` 而非 :" -"func:`patch.object`:" +"如果你要 patch 一個模組(包括 :mod:`builtins`),請使用 :func:`patch` 而" +"非 :func:`patch.object`:" #: ../../library/unittest.mock-examples.rst:439 msgid "" @@ -657,8 +659,9 @@ msgid "" "as class decorators. When used in this way it is the same as applying the " "decorator individually to every method whose name starts with \"test\"." msgstr "" -"另外,“patch”、“patch.object” 和 “patch.dict” 也可以用來作為類別裝飾器。以這" -"種方式使用時,與將裝飾器單獨應用於每個名稱以 “test” 開頭的方法相同。" +"另外,``patch``、``patch.object`` 和 ``patch.dict`` 也可以用來作為類別裝飾" +"器。以這種方式使用時,與將裝飾器單獨應用於每個名稱以 \"test\" 開頭的方法相" +"同。" #: ../../library/unittest.mock-examples.rst:523 msgid "Further Examples" @@ -741,16 +744,17 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:573 msgid "" -"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." -"return_value = mock_response" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value " +"= mock_response" msgstr "" -"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." -"return_value = mock_response" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value " +"= mock_response" #: ../../library/unittest.mock-examples.rst:575 msgid "" -"We can do that in a slightly nicer way using the :meth:`~Mock." -"configure_mock` method to directly set the return value for us::" +"We can do that in a slightly nicer way using " +"the :meth:`~Mock.configure_mock` method to directly set the return value for " +"us::" msgstr "" "我們可以使用 :meth:`~Mock.configure_mock` 方法來以稍微好一點的方式為我們直接" "設定回傳值: ::" @@ -760,15 +764,17 @@ msgid "" ">>> something = Something()\n" ">>> mock_response = Mock(spec=open)\n" ">>> mock_backend = Mock()\n" -">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." -"return_value': mock_response}\n" +">>> config = " +"{'get_endpoint.return_value.create_call.return_value.start_call.return_value': " +"mock_response}\n" ">>> mock_backend.configure_mock(**config)" msgstr "" ">>> something = Something()\n" ">>> mock_response = Mock(spec=open)\n" ">>> mock_backend = Mock()\n" -">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." -"return_value': mock_response}\n" +">>> config = " +"{'get_endpoint.return_value.create_call.return_value.start_call.return_value': " +"mock_response}\n" ">>> mock_backend.configure_mock(**config)" #: ../../library/unittest.mock-examples.rst:584 @@ -800,13 +806,13 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:595 msgid "" -">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." -"start_call()\n" +">>> chained = call.get_endpoint('foobar').create_call('spam', " +"'eggs').start_call()\n" ">>> call_list = chained.call_list()\n" ">>> assert mock_backend.mock_calls == call_list" msgstr "" -">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." -"start_call()\n" +">>> chained = call.get_endpoint('foobar').create_call('spam', " +"'eggs').start_call()\n" ">>> call_list = chained.call_list()\n" ">>> assert mock_backend.mock_calls == call_list" @@ -819,13 +825,13 @@ msgid "" "In some tests I wanted to mock out a call to :meth:`datetime.date.today` to " "return a known date, but I didn't want to prevent the code under test from " "creating new date objects. Unfortunately :class:`datetime.date` is written " -"in C, and so I couldn't just monkey-patch out the static :meth:`datetime." -"date.today` method." +"in C, and so I couldn't just monkey-patch out the " +"static :meth:`datetime.date.today` method." msgstr "" "在某些測試中,我們會想 mock 對 :meth:`datetime.date.today` 的呼叫以回傳一個已" -"知日期,但我不想阻止測試中的程式碼建立新的日期物件。不幸的是 :class:" -"`datetime.date` 是用 C 語言寫的,所以們我不能 monkey patch 靜態的 :meth:" -"`datetime.date.today` 方法。" +"知日期,但我不想阻止測試中的程式碼建立新的日期物件。不幸的" +"是 :class:`datetime.date` 是用 C 語言寫的,所以們我不能 monkey patch 靜態" +"的 :meth:`datetime.date.today` 方法。" #: ../../library/unittest.mock-examples.rst:608 msgid "" @@ -901,9 +907,9 @@ msgid "" "is discussed in `this blog entry `_." msgstr "" -"處理 mock 日期或其他內建類別的另一種方法在 `這個 blog `_ 中" -"討論。" +"處理 mock 日期或其他內建類別的另一種方法在 `這個 blog `_ 中討論。" #: ../../library/unittest.mock-examples.rst:643 msgid "Mocking a Generator Method" @@ -921,8 +927,8 @@ msgstr "" msgid "" "A generator method / function is called to return the generator object. It " "is the generator object that is then iterated over. The protocol method for " -"iteration is :meth:`~container.__iter__`, so we can mock this using a :class:" -"`MagicMock`." +"iteration is :meth:`~container.__iter__`, so we can mock this using " +"a :class:`MagicMock`." msgstr "" "產生器方法 / 函式會被呼叫以回傳產生器物件。之後此產生器會進行疊代。疊代的協定" "方法是 :meth:`~container.__iter__`,所以我們可以使用 :class:`MagicMock` 來 " @@ -948,16 +954,16 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:675 msgid "" -"There are also generator expressions and more `advanced uses `_ of generators, but we aren't concerned " -"about them here. A very good introduction to generators and how powerful " -"they are is: `Generator Tricks for Systems Programmers `_." +"There are also generator expressions and more `advanced uses `_ of generators, but we aren't " +"concerned about them here. A very good introduction to generators and how " +"powerful they are is: `Generator Tricks for Systems Programmers `_." msgstr "" "還有關於產生器運算式及產生器的更多 `進階用法 `_ ,但我們在這裡不考慮它們。一個關於產生器及其強大功能" -"的優良說明是:`Generator Tricks for Systems Programmers `_。" +"的優良說明是:`Generator Tricks for Systems Programmers `_。" #: ../../library/unittest.mock-examples.rst:683 msgid "Applying the same patch to every test method" @@ -1054,8 +1060,8 @@ msgstr "" msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the setUp then tearDown is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the setUp then tearDown is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" @@ -1147,9 +1153,9 @@ msgstr "mock 有很好的 API,用於對 mock 物件的使用方式做出斷言 #: ../../library/unittest.mock-examples.rst:792 msgid "" -"If your mock is only being called once you can use the :meth:`~Mock." -"assert_called_once_with` method that also asserts that the :attr:`~Mock." -"call_count` is one." +"If your mock is only being called once you can use " +"the :meth:`~Mock.assert_called_once_with` method that also asserts that " +"the :attr:`~Mock.call_count` is one." msgstr "" "如果你的 mock 只被呼叫一次,你可以使用 :meth:`~Mock.assert_called_once_with` " "方法,其也斷言 :attr:`~Mock.call_count` 是1。" @@ -1158,8 +1164,8 @@ msgstr "" msgid "" "Both ``assert_called_with`` and ``assert_called_once_with`` make assertions " "about the *most recent* call. If your mock is going to be called several " -"times, and you want to make assertions about *all* those calls you can use :" -"attr:`~Mock.call_args_list`:" +"times, and you want to make assertions about *all* those calls you can " +"use :attr:`~Mock.call_args_list`:" msgstr "" "``assert_called_with`` 和 ``assert_called_once_with`` 都對\\ *最近一次*\\ 的" "呼叫做出斷言。如果你的 mock 將被多次呼叫,並且你想要對\\ *所有*\\ 這些呼叫進" @@ -1332,12 +1338,12 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:912 msgid "" -"An alternative approach is to create a subclass of :class:`Mock` or :class:" -"`MagicMock` that copies (using :func:`copy.deepcopy`) the arguments. Here's " -"an example implementation:" +"An alternative approach is to create a subclass of :class:`Mock` " +"or :class:`MagicMock` that copies (using :func:`copy.deepcopy`) the " +"arguments. Here's an example implementation:" msgstr "" -"另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使用 :" -"func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" +"另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使" +"用 :func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" #: ../../library/unittest.mock-examples.rst:937 msgid "" @@ -1466,8 +1472,8 @@ msgid "" "and using :data:`~Mock.side_effect` to delegate dictionary access to a real " "underlying dictionary that is under our control." msgstr "" -"我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使用 :" -"data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" +"我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使" +"用 :data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" #: ../../library/unittest.mock-examples.rst:1000 msgid "" @@ -1476,15 +1482,16 @@ msgid "" "``side_effect`` is called with the key (and in the case of ``__setitem__`` " "the value too). We can also control what is returned." msgstr "" -"當 ``MagicMock`` 的 :meth:`~object.__getitem__` 和 :meth:`~object." -"__setitem__` 方法被呼叫時(一般的字典存取), ``side_effect`` 會被使用鍵 " -"(key) 來呼叫 (在 ``__setitem__`` 的情況也會使用值 (value))。我們也可以控制" -"回傳的內容。" +"當 ``MagicMock`` 的 :meth:`~object.__getitem__` " +"和 :meth:`~object.__setitem__` 方法被呼叫時(一般的字典存取), " +"``side_effect`` 會被使用鍵 (key) 來呼叫 (在 ``__setitem__`` 的情況也會使用" +"值 (value))。我們也可以控制回傳的內容。" #: ../../library/unittest.mock-examples.rst:1005 msgid "" -"After the ``MagicMock`` has been used we can use attributes like :data:" -"`~Mock.call_args_list` to assert about how the dictionary was used:" +"After the ``MagicMock`` has been used we can use attributes " +"like :data:`~Mock.call_args_list` to assert about how the dictionary was " +"used:" msgstr "" "使用 ``MagicMock`` 後,我們可以使用諸如 :data:`~Mock.call_args_list` 之類的屬" "性來斷言字典被使用的方式:" @@ -1549,10 +1556,11 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:1101 msgid "" -"Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created a `Twisted " -"adaptor `_. Having this applied to attributes too actually causes errors." +"Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created " +"a `Twisted adaptor `_. Having this applied to attributes too " +"actually causes errors." msgstr "" "有時候這很不方便。例如,`有一個使用者 `_\\ 正在子類別化 mock 以建立 `Twisted adaptor `_ provides similar functionality, that may be " -"useful here, in the form of its equality matcher (`hamcrest.library." -"integration.match_equality `_)." -msgstr "" -"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest `_ 以其相等匹配器的形式,提供了類似的功能,在這裡可能是有用" -"的 (\\ `hamcrest.library.integration.match_equality `_\\ )。" +"useful here, in the form of its equality matcher " +"(`hamcrest.library.integration.match_equality `_)." +msgstr "" +"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest `_ 以其相等匹配器的形式,提供了類似的功能,在這裡" +"可能是有用的 (\\ `hamcrest.library.integration.match_equality `_\\ )。" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 720ca6deba..dcdcb78d7a 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 00:13+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,15 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along with :" -"const:`sentinel` for creating unique objects. See the `quick guide`_ for " -"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" -"`patch`." +"module and class level attributes within the scope of a test, along " +"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " +"for some examples of how to use :class:`Mock`, :class:`MagicMock` " +"and :func:`patch`." msgstr "" "此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" -"`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` 和 :func:" -"`patch` 的一些範例,請參閱\\ `快速導引 `_。" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件" +"的 :const:`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` " +"和 :func:`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -109,7 +109,7 @@ msgid "" "that don't exist on the spec will fail with an :exc:`AttributeError`." msgstr "" "Mock 有許多其他方法可以讓你配置與控制它的行為。例如,*spec* 引數可以配置 " -"mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於規格中的屬性或方法將" +"mock ,讓其從另一個物件取得規格。嘗試讀取 mock 中不存在於規格中的屬性或方法將" "會失敗,並出現 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:97 @@ -222,11 +222,11 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" -"ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch 的 " -"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock 物" -"件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)" -"都具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用" +"\\ :ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch " +"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock " +"物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函" +"式)都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:177 msgid "" @@ -264,12 +264,12 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't callable: :class:" -"`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't " +"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` 是 :class:`Mock` 的子類別,其中所有魔術方法均已預先建立並" -"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" -"`NonCallableMock` 和 :class:`NonCallableMagicMock`" +"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有" +"用::class:`NonCallableMock` 和 :class:`NonCallableMagicMock`" #: ../../library/unittest.mock.rst:224 msgid "" @@ -279,8 +279,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。" -"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" -"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" +"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使" +"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" #: ../../library/unittest.mock.rst:232 msgid "" @@ -300,18 +300,18 @@ msgid "" msgstr "" "*spec*:這可以是字串的 list(串列),也可以是充當 mock 物件規格的現有物件(類" "別或實例)。如果傳入一個物件,則通過對該物件呼叫 dir 來形成字串的串列(不包括" -"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" -"`AttributeError`。" +"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~object." -"__class__` returns the class of the spec object. This allows mocks to pass :" -"func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) " +"then :attr:`~object.__class__` returns the class of the spec object. This " +"allows mocks to pass :func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." -"__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" -"試。" +"如果 *spec* 是一個物件(而不是一個字串的串列),那" +"麼 :attr:`~object.__class__` 會回傳 spec 物件的類別。這允許 mocks 通" +"過 :func:`isinstance` 測試。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -320,13 +320,13 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*:*spec* 的一個更嚴格的變體。如果使用 *spec_set*,在 mock 上嘗試 " -"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" -"`AttributeError`。" +"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See the :" -"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See " +"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." @@ -367,8 +367,8 @@ msgstr "" #: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " -"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" -"`AttributeError`. Passing ``unsafe=True`` will allow access to these " +"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise " +"an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" "*unsafe*:預設情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 " @@ -381,13 +381,13 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise an :exc:" -"`AttributeError`)." +"to access an attribute that doesn't exist will raise " +"an :exc:`AttributeError`)." msgstr "" "*wraps*:被 mock 物件包裝的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將" "通過被包裝的物件(回傳真實結果)。存取 mock 的屬性將會回傳一個 Mock 物件,該" -"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" -"`AttributeError`\\ )。" +"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引" +"發 :exc:`AttributeError`\\ )。" #: ../../library/unittest.mock.rst:281 msgid "" @@ -408,8 +408,8 @@ msgstr "" #: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See the :meth:" -"`configure_mock` method for details." +"used to set attributes on the mock after it is created. See " +"the :meth:`configure_mock` method for details." msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" @@ -440,19 +440,19 @@ msgstr "斷言 mock 已經被使用指定的引數呼叫。" #: ../../library/unittest.mock.rst:351 msgid "" -"The assert passes if the mock has *ever* been called, unlike :meth:" -"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " -"the call is the most recent one, and in the case of :meth:" -"`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, " +"unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that " +"only pass if the call is the most recent one, and in the case " +"of :meth:`assert_called_once_with` it must also be the only call." msgstr "" -"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :" -"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" -"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" +"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` " +"和 :meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對" +"於 :meth:`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" #: ../../library/unittest.mock.rst:364 msgid "" -"assert the mock has been called with the specified calls. The :attr:" -"`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. " +"The :attr:`mock_calls` list is checked for the calls." msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" @@ -481,31 +481,92 @@ msgstr "斷言 mock 從未被呼叫。" msgid "The reset_mock method resets all the call attributes on a mock object:" msgstr "reset_mock 方法重置 mock 物件上的所有呼叫屬性:" -#: ../../library/unittest.mock.rst:412 -msgid "Added two keyword-only arguments to the reset_mock function." -msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" +#: ../../library/unittest.mock.rst:404 +msgid "" +">>> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" +msgstr "" +">>> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" -#: ../../library/unittest.mock.rst:415 +#: ../../library/unittest.mock.rst:414 msgid "" "This can be useful where you want to make a series of assertions that reuse " -"the same object. Note that :meth:`reset_mock` *doesn't* clear the :attr:" -"`return_value`, :attr:`side_effect` or any child attributes you have set " -"using normal assignment by default. In case you want to reset :attr:" -"`return_value` or :attr:`side_effect`, then pass the corresponding parameter " -"as ``True``. Child mocks and the return value mock (if any) are reset as " -"well." +"the same object." msgstr "" -"這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況下,:" -"meth:`reset_mock` *不會*\\ 清除 :attr:`return_value`、:attr:`side_effect` 或" -"使用普通賦值設定的任何子屬性。如果你想要重置 :attr:`return_value` 或 :attr:" -"`side_effect`,則將相應的參數設置為 ``True``。Child mock 和回傳值 mock(如果" -"有的話)也會被重置。" -#: ../../library/unittest.mock.rst:423 -msgid "*return_value*, and *side_effect* are keyword-only arguments." -msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" +#: ../../library/unittest.mock.rst:417 +msgid "" +"*return_value* parameter when set to ``True`` resets :attr:`return_value`:" +msgstr "" + +#: ../../library/unittest.mock.rst:419 +msgid "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" +msgstr "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" -#: ../../library/unittest.mock.rst:429 +#: ../../library/unittest.mock.rst:428 +msgid "" +"*side_effect* parameter when set to ``True`` resets :attr:`side_effect`:" +msgstr "" + +#: ../../library/unittest.mock.rst:430 +msgid "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" +msgstr "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" + +#: ../../library/unittest.mock.rst:441 +msgid "" +"Note that :meth:`reset_mock` *doesn't* clear " +"the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +"have set using normal assignment by default." +msgstr "" + +#: ../../library/unittest.mock.rst:445 +msgid "Child mocks are reset as well." +msgstr "" + +#: ../../library/unittest.mock.rst:447 +msgid "Added two keyword-only arguments to the reset_mock function." +msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" + +#: ../../library/unittest.mock.rst:452 msgid "" "Add a spec to a mock. *spec* can either be an object or a list of strings. " "Only attributes on the *spec* can be fetched as attributes from the mock." @@ -513,25 +574,25 @@ msgstr "" "向 mock 增加一個規格 (spec)。*spec* 可以是一個物件或一個字串串列 (list of " "strings)。只有在 *spec* 上的屬性才能作為 mock 的屬性被取得。" -#: ../../library/unittest.mock.rst:433 +#: ../../library/unittest.mock.rst:456 msgid "If *spec_set* is true then only attributes on the spec can be set." msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" -#: ../../library/unittest.mock.rst:438 +#: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" -"attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` " +"and :attr:`mock_calls` attributes of this one." msgstr "" "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 " "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " "屬性中。" -#: ../../library/unittest.mock.rst:445 +#: ../../library/unittest.mock.rst:468 msgid "Set attributes on the mock through keyword arguments." msgstr "透過關鍵字引數在 mock 上設定屬性。" -#: ../../library/unittest.mock.rst:447 +#: ../../library/unittest.mock.rst:470 msgid "" "Attributes plus return values and side effects can be set on child mocks " "using standard dot notation and unpacking a dictionary in the method call:" @@ -539,18 +600,18 @@ msgstr "" "可以在使用 method(方法)呼叫時,使用標準點記法 (dot notation) 並將字典拆開," "為 child mock 設定屬性、回傳值和 side effects:" -#: ../../library/unittest.mock.rst:461 +#: ../../library/unittest.mock.rst:484 msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "同樣的事情可以在 mock 的建構函式呼叫中實現:" -#: ../../library/unittest.mock.rst:474 +#: ../../library/unittest.mock.rst:497 msgid "" ":meth:`configure_mock` exists to make it easier to do configuration after " "the mock has been created." msgstr "" ":meth:`configure_mock` 的存在是為了在 mock 被建立後更容易進行組態設定。" -#: ../../library/unittest.mock.rst:480 +#: ../../library/unittest.mock.rst:503 msgid "" ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " "results. For mocks with a *spec* this includes all the permitted attributes " @@ -559,13 +620,13 @@ msgstr "" ":class:`Mock` 物件限制了 ``dir(some_mock)`` 僅顯示有用的結果。對於具有 " "*spec* 的 mock,這包含所有被允許的 mock 屬性。" -#: ../../library/unittest.mock.rst:484 +#: ../../library/unittest.mock.rst:507 msgid "" "See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "off." msgstr "請參閱 :data:`FILTER_DIR` 以了解這種過濾行為的作用,以及如何關閉它。" -#: ../../library/unittest.mock.rst:490 +#: ../../library/unittest.mock.rst:513 msgid "" "Create the child mocks for attributes and return value. By default child " "mocks will be the same type as the parent. Subclasses of Mock may want to " @@ -574,35 +635,35 @@ msgstr "" "建立為了得到屬性和回傳值的 child mock。預設情況下,child mock 將與其上代是相" "同的型別。Mock 的子類別可能會想要置換此行為,以自定義 child mock 的建立方式。" -#: ../../library/unittest.mock.rst:495 +#: ../../library/unittest.mock.rst:518 msgid "" "For non-callable mocks the callable variant will be used (rather than any " "custom subclass)." msgstr "對於不可呼叫的 mock,將使用可呼叫的變體,而不是任何的自定義子類別。" -#: ../../library/unittest.mock.rst:501 +#: ../../library/unittest.mock.rst:524 msgid "A boolean representing whether or not the mock object has been called:" msgstr "一個 boolean(布林),表述 mock 物件是否已經被呼叫:" -#: ../../library/unittest.mock.rst:512 +#: ../../library/unittest.mock.rst:535 msgid "An integer telling you how many times the mock object has been called:" msgstr "一個整數,告訴你 mock 物件被呼叫的次數:" -#: ../../library/unittest.mock.rst:524 +#: ../../library/unittest.mock.rst:547 msgid "Set this to configure the value returned by calling the mock:" msgstr "設定此值以配置呼叫 mock 時回傳的值:" -#: ../../library/unittest.mock.rst:531 +#: ../../library/unittest.mock.rst:554 msgid "" "The default return value is a mock object and you can configure it in the " "normal way:" msgstr "預設的回傳值是一個 mock 物件,你也可以按照正常的方式配置它:" -#: ../../library/unittest.mock.rst:540 +#: ../../library/unittest.mock.rst:563 msgid ":attr:`return_value` can also be set in the constructor:" msgstr ":attr:`return_value` 也可以在建構函式中設定:" -#: ../../library/unittest.mock.rst:551 +#: ../../library/unittest.mock.rst:574 msgid "" "This can either be a function to be called when the mock is called, an " "iterable or an exception (class or instance) to be raised." @@ -610,7 +671,7 @@ msgstr "" "這可以是一個在呼叫 mock 時要呼叫的函式、一個可疊代物件,或者要引發的例外(類" "別或實例)。" -#: ../../library/unittest.mock.rst:554 +#: ../../library/unittest.mock.rst:577 msgid "" "If you pass in a function it will be called with same arguments as the mock " "and unless the function returns the :data:`DEFAULT` singleton the call to " @@ -618,37 +679,37 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." msgstr "" -"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回傳 :data:" -"`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何值。如果函" -"式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" -"`return_value` 得到)。" +"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回" +"傳 :data:`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何" +"值。如果函式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值" +"(從 :attr:`return_value` 得到)。" -#: ../../library/unittest.mock.rst:560 +#: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock (:data:" -"`DEFAULT` handling is identical to the function case)." +"to be raised, or a value to be returned from the call to the mock " +"(:data:`DEFAULT` handling is identical to the function case)." msgstr "" "如果你傳遞一個可疊代物件,它將被用於檢索一個疊代器,該疊代器必須在每次呼叫時" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" "的值(處理 :data:`DEFAULT` 的方式與函式的狀況相同)。" -#: ../../library/unittest.mock.rst:565 +#: ../../library/unittest.mock.rst:588 msgid "" "An example of a mock that raises an exception (to test exception handling of " "an API):" msgstr "以下是一個引發例外的 mock 的範例(用於測試 API 的例外處理):" -#: ../../library/unittest.mock.rst:575 +#: ../../library/unittest.mock.rst:598 msgid "Using :attr:`side_effect` to return a sequence of values:" msgstr "使用 :attr:`side_effect` 回傳一連串值的範例:" -#: ../../library/unittest.mock.rst:582 +#: ../../library/unittest.mock.rst:605 msgid "Using a callable:" msgstr "使用可被呼叫物件的範例:" -#: ../../library/unittest.mock.rst:592 +#: ../../library/unittest.mock.rst:615 msgid "" ":attr:`side_effect` can be set in the constructor. Here's an example that " "adds one to the value the mock is called with and returns it:" @@ -656,11 +717,11 @@ msgstr "" ":attr:`side_effect` 可以在建構函式中設定。以下是一個範例,它將 mock 被呼叫時" "給的值加一並回傳:" -#: ../../library/unittest.mock.rst:602 +#: ../../library/unittest.mock.rst:625 msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "將 :attr:`side_effect` 設定為 ``None`` 可以清除它:" -#: ../../library/unittest.mock.rst:616 +#: ../../library/unittest.mock.rst:639 msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " @@ -670,39 +731,40 @@ msgid "" "is any keyword arguments (or an empty dictionary)." msgstr "" "這會是 ``None``\\ (如果 mock 尚未被呼叫),或是 mock 上次被呼叫時使用的引" -"數。這將以元組的形式呈現:第一個成員 (member),其可以通過 ``args`` 屬性訪問," +"數。這將以元組的形式呈現:第一個成員 (member),其可以通過 ``args`` 屬性存取," "是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " -"``kwargs`` 屬性訪問,是所有關鍵字引數(或一個空字典)。" +"``kwargs`` 屬性存取,是所有關鍵字引數(或一個空字典)。" -#: ../../library/unittest.mock.rst:649 +#: ../../library/unittest.mock.rst:672 msgid "" -":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" -"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " -"are tuples, so they can be unpacked to get at the individual arguments and " -"make more complex assertions. See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the " +"lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` " +"are :data:`call` objects. These are tuples, so they can be unpacked to get " +"at the individual arguments and make more complex assertions. " +"See :ref:`calls as tuples `." msgstr "" -":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` 和 :" -"attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解包以" -"獲取各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:655 +#: ../../library/unittest.mock.rst:678 msgid "Added ``args`` and ``kwargs`` properties." msgstr "新增 ``args`` 與 ``kwargs`` 特性。" -#: ../../library/unittest.mock.rst:661 +#: ../../library/unittest.mock.rst:684 msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare with :attr:" -"`call_args_list`." +"used for conveniently constructing lists of calls to compare " +"with :attr:`call_args_list`." msgstr "" "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" "叫的串列,以便與 :attr:`call_args_list` 進行比較。" -#: ../../library/unittest.mock.rst:677 +#: ../../library/unittest.mock.rst:700 msgid "" "Members of :attr:`call_args_list` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -711,7 +773,7 @@ msgstr "" ":attr:`call_args_list` 的成員都是 :data:`call` 物件。這些物件可以被拆包為元" "組,以取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:684 +#: ../../library/unittest.mock.rst:707 msgid "" "As well as tracking calls to themselves, mocks also track calls to methods " "and attributes, and *their* methods and attributes:" @@ -719,7 +781,7 @@ msgstr "" "除了追蹤對自身的呼叫之外,mock 還會追蹤對方法和屬性的呼叫,以及\\ *它們(這些" "方法和屬性)*\\ 的方法和屬性:" -#: ../../library/unittest.mock.rst:695 +#: ../../library/unittest.mock.rst:718 msgid "" "Members of :attr:`method_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -728,7 +790,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:702 +#: ../../library/unittest.mock.rst:725 msgid "" ":attr:`mock_calls` records *all* calls to the mock object, its methods, " "magic methods *and* return value mocks." @@ -736,7 +798,7 @@ msgstr "" ":attr:`mock_calls` 記錄了 *所有* 對 mock 物件的呼叫,包含其方法、魔術方法以及" "回傳值 mock。" -#: ../../library/unittest.mock.rst:720 +#: ../../library/unittest.mock.rst:743 msgid "" "Members of :attr:`mock_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -745,7 +807,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:726 +#: ../../library/unittest.mock.rst:749 msgid "" "The way :attr:`mock_calls` are recorded means that where nested calls are " "made, the parameters of ancestor calls are not recorded and so will always " @@ -754,7 +816,7 @@ msgstr "" ":attr:`mock_calls` 記錄的方式意味著在進行巢狀呼叫時,上代 (ancestor) 呼叫的參" "數不會被記錄,因此在比較時它們將始終相等:" -#: ../../library/unittest.mock.rst:740 +#: ../../library/unittest.mock.rst:763 msgid "" "Normally the :attr:`!__class__` attribute of an object will return its type. " "For a mock object with a :attr:`!spec`, :attr:`!__class__` returns the spec " @@ -765,15 +827,15 @@ msgstr "" "的 mock 物件,:attr:`!__class__` 會回傳 spec 的類別。這允許 mock 物件通過對它" "們所替代或偽裝的物件進行的 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:749 +#: ../../library/unittest.mock.rst:772 msgid "" -":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" -"`isinstance` check without forcing you to use a spec:" +":attr:`!__class__` is assignable to, this allows a mock to pass " +"an :func:`isinstance` check without forcing you to use a spec:" msgstr "" ":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" -#: ../../library/unittest.mock.rst:759 +#: ../../library/unittest.mock.rst:782 msgid "" "A non-callable version of :class:`Mock`. The constructor parameters have the " "same meaning of :class:`Mock`, with the exception of *return_value* and " @@ -782,34 +844,34 @@ msgstr "" ":class:`Mock` 的一個不可呼叫版本。建構函式參數的意義與 :class:`Mock` 相同,其" "例外為 *return_value* 和 *side_effect* 在不可呼叫的 mock 上無意義。" -#: ../../library/unittest.mock.rst:763 +#: ../../library/unittest.mock.rst:786 msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" -"func:`isinstance` 測試:" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通" +"過 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:773 +#: ../../library/unittest.mock.rst:796 msgid "" -"The :class:`Mock` classes have support for mocking magic methods. See :ref:" -"`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. " +"See :ref:`magic methods ` for the full details." msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:776 +#: ../../library/unittest.mock.rst:799 msgid "" "The mock classes and the :func:`patch` decorators all take arbitrary keyword " "arguments for configuration. For the :func:`patch` decorators the keywords " "are passed to the constructor of the mock being created. The keyword " "arguments are for configuring attributes of the mock:" msgstr "" -"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:" -"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" -"於配置 mock 的屬性:" +"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對" +"於 :func:`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵" +"字引數用於配置 mock 的屬性:" -#: ../../library/unittest.mock.rst:787 +#: ../../library/unittest.mock.rst:810 msgid "" "The return value and side effect of child mocks can be set in the same way, " "using dotted notation. As you can't use dotted names directly in a call you " @@ -818,7 +880,7 @@ msgstr "" "Child mock 的回傳值和 side effect 可以使用使用點記法進行設置。由於你無法直接" "在呼叫中使用帶有點 (.) 的名稱,因此你必須建立一個字典並使用 ``**`` 解包:" -#: ../../library/unittest.mock.rst:802 +#: ../../library/unittest.mock.rst:825 msgid "" "A callable mock which was created with a *spec* (or a *spec_set*) will " "introspect the specification object's signature when matching calls to the " @@ -829,7 +891,7 @@ msgstr "" "將會內省 (introspect) 規格物件的簽名 (signature)。因此,它可以匹配實際呼叫的" "引數,無論它們是按位置傳遞還是按名稱傳遞: ::" -#: ../../library/unittest.mock.rst:807 +#: ../../library/unittest.mock.rst:830 msgid "" ">>> def f(a, b, c): pass\n" "...\n" @@ -847,36 +909,36 @@ msgstr "" ">>> mock.assert_called_with(1, 2, 3)\n" ">>> mock.assert_called_with(a=1, b=2, c=3)" -#: ../../library/unittest.mock.rst:815 +#: ../../library/unittest.mock.rst:838 msgid "" -"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." -"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." -"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " -"calls on the mock object." +"This applies " +"to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` " +"and :meth:`~Mock.assert_any_call`. When :ref:`auto-speccing`, it will also " +"apply to method calls on the mock object." msgstr "" -"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock." -"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock." -"assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" -"呼叫。" +"這適用" +"於 :meth:`~Mock.assert_called_with`、:meth:`~Mock.assert_called_once_with`、:meth:`~Mock.assert_has_calls` " +"和 :meth:`~Mock.assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 " +"mock 物件的方法呼叫。" -#: ../../library/unittest.mock.rst:820 +#: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." msgstr "" "對於已經設置了規格(spec)和自動規格(autospec)的 mock 物件,新增簽名內省功" "能。" -#: ../../library/unittest.mock.rst:826 +#: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or other :term:" -"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." -"__get__` and :meth:`~object.__set__` methods so you can specify a return " -"value when it is fetched." +"A mock intended to be used as a :class:`property`, or " +"other :term:`descriptor`, on a class. :class:`PropertyMock` " +"provides :meth:`~object.__get__` and :meth:`~object.__set__` methods so you " +"can specify a return value when it is fetched." msgstr "" -"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 mock。:" -"class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." -"__set__` 方法,因此你可以在它被提取時指定回傳值。" +"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 " +"mock。:class:`PropertyMock` 提供了 :meth:`~object.__get__` " +"和 :meth:`~object.__set__` 方法,因此你可以在它被提取時指定回傳值。" -#: ../../library/unittest.mock.rst:831 +#: ../../library/unittest.mock.rst:854 msgid "" "Fetching a :class:`PropertyMock` instance from an object calls the mock, " "with no args. Setting it calls the mock with the value being set. ::" @@ -884,7 +946,7 @@ msgstr "" "從物件中提取 :class:`PropertyMock` 實例會不帶任何引數呼叫 mock。設定它則會用" "設定的值來呼叫 mock: ::" -#: ../../library/unittest.mock.rst:834 +#: ../../library/unittest.mock.rst:857 msgid "" ">>> class Foo:\n" "... @property\n" @@ -922,16 +984,16 @@ msgstr "" ">>> mock_foo.mock_calls\n" "[call(), call(6)]" -#: ../../library/unittest.mock.rst:852 +#: ../../library/unittest.mock.rst:875 msgid "" -"Because of the way mock attributes are stored you can't directly attach a :" -"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " -"type object::" +"Because of the way mock attributes are stored you can't directly attach " +"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " +"mock type object::" msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" -#: ../../library/unittest.mock.rst:856 +#: ../../library/unittest.mock.rst:879 msgid "" ">>> m = MagicMock()\n" ">>> p = PropertyMock(return_value=3)\n" @@ -947,14 +1009,14 @@ msgstr "" "3\n" ">>> p.assert_called_once_with()" -#: ../../library/unittest.mock.rst:865 +#: ../../library/unittest.mock.rst:888 msgid "" "If an :exc:`AttributeError` is raised by :class:`PropertyMock`, it will be " "interpreted as a missing descriptor and :meth:`~object.__getattr__` will be " "called on the parent mock::" msgstr "" -#: ../../library/unittest.mock.rst:869 +#: ../../library/unittest.mock.rst:892 msgid "" ">>> m = MagicMock()\n" ">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" @@ -968,11 +1030,11 @@ msgstr "" ">>> m.my_property\n" "" -#: ../../library/unittest.mock.rst:875 +#: ../../library/unittest.mock.rst:898 msgid "See :meth:`~object.__getattr__` for details." msgstr "詳情請見 :meth:`~object.__getattr__`。" -#: ../../library/unittest.mock.rst:880 +#: ../../library/unittest.mock.rst:903 msgid "" "An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object " "will behave so the object is recognized as an async function, and the result " @@ -981,7 +1043,7 @@ msgstr "" ":class:`MagicMock` 的非同步版本。:class:`AsyncMock` 物件的表現將被視為非同步" "函式,並且呼叫的結果是一個可等待物件。" -#: ../../library/unittest.mock.rst:890 +#: ../../library/unittest.mock.rst:913 msgid "" "The result of ``mock()`` is an async function which will have the outcome of " "``side_effect`` or ``return_value`` after it has been awaited:" @@ -989,19 +1051,19 @@ msgstr "" "``mock()`` 的結果是一個非同步函式,在它被等待後將具有 ``side_effect`` 或 " "``return_value`` 的結果:" -#: ../../library/unittest.mock.rst:893 +#: ../../library/unittest.mock.rst:916 msgid "" "if ``side_effect`` is a function, the async function will return the result " "of that function," msgstr "如果 ``side_effect`` 是一個函式,非同步函式將回傳該函式的結果," -#: ../../library/unittest.mock.rst:895 +#: ../../library/unittest.mock.rst:918 msgid "" "if ``side_effect`` is an exception, the async function will raise the " "exception," msgstr "如果 ``side_effect`` 是一個例外,則非同步函式將引發該例外," -#: ../../library/unittest.mock.rst:897 +#: ../../library/unittest.mock.rst:920 msgid "" "if ``side_effect`` is an iterable, the async function will return the next " "value of the iterable, however, if the sequence of result is exhausted, " @@ -1010,7 +1072,7 @@ msgstr "" "如果 ``side_effect`` 是一個可疊代物件,非同步函式將回傳可疊代物件的下一個值," "但如果結果序列耗盡,將立即引發 ``StopAsyncIteration``," -#: ../../library/unittest.mock.rst:900 +#: ../../library/unittest.mock.rst:923 msgid "" "if ``side_effect`` is not defined, the async function will return the value " "defined by ``return_value``, hence, by default, the async function returns a " @@ -1019,7 +1081,7 @@ msgstr "" "如果 ``side_effect`` 沒有被定義,非同步函式將回傳由 ``return_value`` 定義的" "值,因此在預設情況下,非同步函式回傳一個新的 :class:`AsyncMock` 物件。" -#: ../../library/unittest.mock.rst:905 +#: ../../library/unittest.mock.rst:928 msgid "" "Setting the *spec* of a :class:`Mock` or :class:`MagicMock` to an async " "function will result in a coroutine object being returned after calling." @@ -1027,22 +1089,22 @@ msgstr "" "將 :class:`Mock` 或 :class:`MagicMock` 的 *spec* 設定為非同步函式將導致在呼叫" "後回傳一個協程物件。" -#: ../../library/unittest.mock.rst:917 +#: ../../library/unittest.mock.rst:940 msgid "" -"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" -"`AsyncMock` to a class with asynchronous and synchronous functions will " -"automatically detect the synchronous functions and set them as :class:" -"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " -"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " -"functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " +"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " +"will automatically detect the synchronous functions and set them " +"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " +"or :class:`MagicMock`) or :class:`Mock` (if the parent mock " +"is :class:`Mock`). All asynchronous functions will be :class:`AsyncMock`." msgstr "" "將 :class:`Mock`、:class:`MagicMock` 或 :class:`AsyncMock` 的 *spec* 設定為具" -"有同步和非同步函式的類別,會自動檢測同步函式並將其設定為 :class:" -"`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` 或 :class:" -"`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" -"有非同步函式將被設定為 :class:`AsyncMock`。" +"有同步和非同步函式的類別,會自動檢測同步函式並將其設定" +"為 :class:`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` " +"或 :class:`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock " +"為 :class:`Mock`\\ )。所有非同步函式將被設定為 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:945 +#: ../../library/unittest.mock.rst:968 msgid "" "Assert that the mock was awaited at least once. Note that this is separate " "from the object having been called, the ``await`` keyword must be used:" @@ -1050,33 +1112,33 @@ msgstr "" "斷言 mock 至少被等待過一次。請注意這與物件是否被呼叫是分開的,``await`` 關鍵" "字必須被使用:" -#: ../../library/unittest.mock.rst:964 +#: ../../library/unittest.mock.rst:987 msgid "Assert that the mock was awaited exactly once." msgstr "斷言 mock 正好被等待了一次。" -#: ../../library/unittest.mock.rst:980 +#: ../../library/unittest.mock.rst:1003 msgid "Assert that the last await was with the specified arguments." msgstr "斷言最後一次等待使用了指定的引數。" -#: ../../library/unittest.mock.rst:997 +#: ../../library/unittest.mock.rst:1020 msgid "" "Assert that the mock was awaited exactly once and with the specified " "arguments." msgstr "斷言 mock 只被等待了一次並使用了指定的引數。" -#: ../../library/unittest.mock.rst:1014 +#: ../../library/unittest.mock.rst:1037 msgid "Assert the mock has ever been awaited with the specified arguments." msgstr "斷言 mock 曾經被使用指定的引數等待過。" -#: ../../library/unittest.mock.rst:1030 +#: ../../library/unittest.mock.rst:1053 msgid "" -"Assert the mock has been awaited with the specified calls. The :attr:" -"`await_args_list` list is checked for the awaits." +"Assert the mock has been awaited with the specified calls. " +"The :attr:`await_args_list` list is checked for the awaits." msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" -#: ../../library/unittest.mock.rst:1033 +#: ../../library/unittest.mock.rst:1056 msgid "" "If *any_order* is false then the awaits must be sequential. There can be " "extra calls before or after the specified awaits." @@ -1084,41 +1146,41 @@ msgstr "" "如果 *any_order* 為 false,則等待必須按照順序。指定的等待之前或之後可以有額外" "的呼叫。" -#: ../../library/unittest.mock.rst:1037 +#: ../../library/unittest.mock.rst:1060 msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" -"attr:`await_args_list` 中。" +"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現" +"在 :attr:`await_args_list` 中。" -#: ../../library/unittest.mock.rst:1057 +#: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." msgstr "斷言 mock 從未被等待。" -#: ../../library/unittest.mock.rst:1064 +#: ../../library/unittest.mock.rst:1087 msgid "" -"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" -"`await_args` to None, and clears the :attr:`await_args_list`." +"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to " +"0, :attr:`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" -"`await_args` 設定為 None,並清除 :attr:`await_args_list`。" +"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 " +"0,:attr:`await_args` 設定為 None,並清除 :attr:`await_args_list`。" -#: ../../library/unittest.mock.rst:1069 +#: ../../library/unittest.mock.rst:1092 msgid "" "An integer keeping track of how many times the mock object has been awaited." msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" -#: ../../library/unittest.mock.rst:1084 +#: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " -"that the mock was last awaited with. Functions the same as :attr:`Mock." -"call_args`." +"that the mock was last awaited with. Functions the same " +"as :attr:`Mock.call_args`." msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" -#: ../../library/unittest.mock.rst:1102 +#: ../../library/unittest.mock.rst:1125 msgid "" "This is a list of all the awaits made to the mock object in sequence (so the " "length of the list is the number of times it has been awaited). Before any " @@ -1127,78 +1189,78 @@ msgstr "" "這是一個按照順序記錄 mock 物件所有等待的串列(因此串列的長度表示該物件已被等" "待的次數)。在進行任何等待之前,此串列為空。" -#: ../../library/unittest.mock.rst:1122 +#: ../../library/unittest.mock.rst:1145 msgid "" -"A version of :class:`MagicMock` for multithreading tests. The :class:" -"`ThreadingMock` object provides extra methods to wait for a call to be " -"invoked, rather than assert on it immediately." +"A version of :class:`MagicMock` for multithreading tests. " +"The :class:`ThreadingMock` object provides extra methods to wait for a call " +"to be invoked, rather than assert on it immediately." msgstr "" -#: ../../library/unittest.mock.rst:1126 +#: ../../library/unittest.mock.rst:1149 msgid "" "The default timeout is specified by the ``timeout`` argument, or if unset by " "the :attr:`ThreadingMock.DEFAULT_TIMEOUT` attribute, which defaults to " "blocking (``None``)." msgstr "" -#: ../../library/unittest.mock.rst:1129 +#: ../../library/unittest.mock.rst:1152 msgid "" -"You can configure the global default timeout by setting :attr:`ThreadingMock." -"DEFAULT_TIMEOUT`." +"You can configure the global default timeout by " +"setting :attr:`ThreadingMock.DEFAULT_TIMEOUT`." msgstr "" -#: ../../library/unittest.mock.rst:1133 +#: ../../library/unittest.mock.rst:1156 msgid "Waits until the mock is called." msgstr "等待直到 mock 被呼叫。" -#: ../../library/unittest.mock.rst:1135 +#: ../../library/unittest.mock.rst:1158 msgid "" "If a timeout was passed at the creation of the mock or if a timeout argument " "is passed to this function, the function raises an :exc:`AssertionError` if " "the call is not performed in time." msgstr "" -#: ../../library/unittest.mock.rst:1147 +#: ../../library/unittest.mock.rst:1170 msgid "Waits until the mock is called with the specified arguments." msgstr "等到直到 mock 被以特定引數呼叫。" -#: ../../library/unittest.mock.rst:1149 +#: ../../library/unittest.mock.rst:1172 msgid "" -"If a timeout was passed at the creation of the mock the function raises an :" -"exc:`AssertionError` if the call is not performed in time." +"If a timeout was passed at the creation of the mock the function raises " +"an :exc:`AssertionError` if the call is not performed in time." msgstr "" -#: ../../library/unittest.mock.rst:1160 +#: ../../library/unittest.mock.rst:1183 msgid "" -"Global default timeout in seconds to create instances of :class:" -"`ThreadingMock`." +"Global default timeout in seconds to create instances " +"of :class:`ThreadingMock`." msgstr "" -#: ../../library/unittest.mock.rst:1166 +#: ../../library/unittest.mock.rst:1189 msgid "Calling" msgstr "呼叫" -#: ../../library/unittest.mock.rst:1168 +#: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as the :attr:" -"`~Mock.return_value` attribute. The default return value is a new Mock " -"object; it is created the first time the return value is accessed (either " -"explicitly or by calling the Mock) - but it is stored and the same one " -"returned each time." +"Mock objects are callable. The call will return the value set as " +"the :attr:`~Mock.return_value` attribute. The default return value is a new " +"Mock object; it is created the first time the return value is accessed " +"(either explicitly or by calling the Mock) - but it is stored and the same " +"one returned each time." msgstr "" "Mock 物件可被呼叫。呼叫將回傳設定為 :attr:`~Mock.return_value` 屬性的值。預設" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" "過呼叫 Mock)被建立,但是這個回傳值會被儲存,之後每次都回傳同一個值。" -#: ../../library/unittest.mock.rst:1174 +#: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes like :attr:" -"`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes " +"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." -"call_args_list` 等屬性中。" +"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` " +"和 :attr:`~Mock.call_args_list` 等屬性中。" -#: ../../library/unittest.mock.rst:1177 +#: ../../library/unittest.mock.rst:1200 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " "has been recorded, so if :attr:`!side_effect` raises an exception the call " @@ -1207,15 +1269,15 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 被設定,那麼在呼叫被記錄後它才會被呼叫,所以如" "果 :attr:`!side_effect` 引發例外,呼叫仍然會被記錄。" -#: ../../library/unittest.mock.rst:1181 +#: ../../library/unittest.mock.rst:1204 msgid "" -"The simplest way to make a mock raise an exception when called is to make :" -"attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to " +"make :attr:`~Mock.side_effect` an exception class or instance:" msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" -#: ../../library/unittest.mock.rst:1199 +#: ../../library/unittest.mock.rst:1222 msgid "" "If :attr:`~Mock.side_effect` is a function then whatever that function " "returns is what calls to the mock return. The :attr:`!side_effect` function " @@ -1226,7 +1288,7 @@ msgstr "" "叫所回傳的值。:attr:`!side_effect` 函式會使用與 mock 相同的引數被呼叫。這讓你" "可以根據輸入動態地變更呼叫的回傳值:" -#: ../../library/unittest.mock.rst:1215 +#: ../../library/unittest.mock.rst:1238 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " @@ -1234,10 +1296,10 @@ msgid "" "return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." -"return_value`,或回傳 :data:`DEFAULT`:" +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回" +"傳 :attr:`~Mock.return_value`,或回傳 :data:`DEFAULT`:" -#: ../../library/unittest.mock.rst:1234 +#: ../../library/unittest.mock.rst:1257 msgid "" "To remove a :attr:`~Mock.side_effect`, and return to the default behaviour, " "set the :attr:`!side_effect` to ``None``:" @@ -1245,7 +1307,7 @@ msgstr "" "要刪除 :attr:`~Mock.side_effect`,並恢復預設行為,將 :attr:`!side_effect` 設" "為 ``None``:" -#: ../../library/unittest.mock.rst:1248 +#: ../../library/unittest.mock.rst:1271 msgid "" "The :attr:`~Mock.side_effect` can also be any iterable object. Repeated " "calls to the mock will return values from the iterable (until the iterable " @@ -1254,13 +1316,13 @@ msgstr "" ":attr:`~Mock.side_effect` 也可以是任何可疊代的物件。對 mock 的重複呼叫將從可" "疊代物件中回傳值(直到疊代物件耗盡並引發 :exc:`StopIteration` 為止):" -#: ../../library/unittest.mock.rst:1264 +#: ../../library/unittest.mock.rst:1287 msgid "" "If any members of the iterable are exceptions they will be raised instead of " "returned::" msgstr "如果可疊代物件中的任何成員是例外,則它們將被引發而不是被回傳: ::" -#: ../../library/unittest.mock.rst:1267 +#: ../../library/unittest.mock.rst:1290 msgid "" ">>> iterable = (33, ValueError, 66)\n" ">>> m = MagicMock(side_effect=iterable)\n" @@ -1284,17 +1346,17 @@ msgstr "" ">>> m()\n" "66" -#: ../../library/unittest.mock.rst:1282 +#: ../../library/unittest.mock.rst:1305 msgid "Deleting Attributes" msgstr "刪除屬性" -#: ../../library/unittest.mock.rst:1284 +#: ../../library/unittest.mock.rst:1307 msgid "" "Mock objects create attributes on demand. This allows them to pretend to be " "objects of any type." msgstr "Mock 物件會在需要時建立屬性。這使得它們可以假裝成任何種類的物件。" -#: ../../library/unittest.mock.rst:1287 +#: ../../library/unittest.mock.rst:1310 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " @@ -1305,30 +1367,30 @@ msgstr "" "提取時引發 :exc:`AttributeError`。你可以通過將物件提供為 mock 的 :attr:`!" "spec` 來實現這一點,但這並不總是那麼好用。" -#: ../../library/unittest.mock.rst:1291 +#: ../../library/unittest.mock.rst:1314 msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" -"`AttributeError`。" +"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引" +"發 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:1308 +#: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" msgstr "Mock 名稱與名稱屬性" -#: ../../library/unittest.mock.rst:1310 +#: ../../library/unittest.mock.rst:1333 msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to use :meth:`~Mock." -"configure_mock`::" +"creation time. There are two alternatives. One option is to " +"use :meth:`~Mock.configure_mock`::" msgstr "" "由於 \"name\" 是傳遞給 :class:`Mock` 建構函式的引數,如果你想讓你的 mock 物件" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" "使用 :meth:`~Mock.configure_mock`: ::" -#: ../../library/unittest.mock.rst:1315 +#: ../../library/unittest.mock.rst:1338 msgid "" ">>> mock = MagicMock()\n" ">>> mock.configure_mock(name='my_name')\n" @@ -1340,13 +1402,13 @@ msgstr "" ">>> mock.name\n" "'my_name'" -#: ../../library/unittest.mock.rst:1320 +#: ../../library/unittest.mock.rst:1343 msgid "" "A simpler option is to simply set the \"name\" attribute after mock " "creation::" msgstr "更簡單的方法是在 mock 建立後直接設定 \"name\" 屬性: ::" -#: ../../library/unittest.mock.rst:1322 +#: ../../library/unittest.mock.rst:1345 msgid "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" @@ -1354,11 +1416,11 @@ msgstr "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" -#: ../../library/unittest.mock.rst:1327 +#: ../../library/unittest.mock.rst:1350 msgid "Attaching Mocks as Attributes" msgstr "如同屬性一般附加 mock" -#: ../../library/unittest.mock.rst:1329 +#: ../../library/unittest.mock.rst:1352 msgid "" "When you attach a mock as an attribute of another mock (or as the return " "value) it becomes a \"child\" of that mock. Calls to the child are recorded " @@ -1374,7 +1436,7 @@ msgstr "" "mock 附加到記錄所有對子代的呼叫的上代並允許你對 mock 間的呼叫順序進行斷言非常" "有用:" -#: ../../library/unittest.mock.rst:1347 +#: ../../library/unittest.mock.rst:1370 msgid "" "The exception to this is if the mock has a name. This allows you to prevent " "the \"parenting\" if for some reason you don't want it to happen." @@ -1382,16 +1444,16 @@ msgstr "" "如果 mock 有 name 引數,則上述規則會有例外。這使你可以防止「親屬關係 " "(parenting)」的建立,假設因為某些原因你不希望這種狀況發生。" -#: ../../library/unittest.mock.rst:1358 +#: ../../library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use the :meth:`~Mock." -"attach_mock` method::" +"attach mocks that have names to a parent you use " +"the :meth:`~Mock.attach_mock` method::" msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" -#: ../../library/unittest.mock.rst:1362 +#: ../../library/unittest.mock.rst:1385 msgid "" ">>> thing1 = object()\n" ">>> thing2 = object()\n" @@ -1419,7 +1481,7 @@ msgstr "" ">>> parent.mock_calls\n" "[call.child1('one'), call.child2('two')]" -#: ../../library/unittest.mock.rst:1376 +#: ../../library/unittest.mock.rst:1399 msgid "" "The only exceptions are magic methods and attributes (those that have " "leading and trailing double underscores). Mock doesn't create these but " @@ -1428,16 +1490,16 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引發 :" -"exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到一個" -"魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" -"術方法的支援,請參閱\\ :ref:`魔術方法 `。" +"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引" +"發 :exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到" +"一個魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需" +"要魔術方法的支援,請參閱\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:1385 +#: ../../library/unittest.mock.rst:1408 msgid "The patchers" msgstr "Patchers" -#: ../../library/unittest.mock.rst:1387 +#: ../../library/unittest.mock.rst:1410 msgid "" "The patch decorators are used for patching objects only within the scope of " "the function they decorate. They automatically handle the unpatching for " @@ -1448,17 +1510,17 @@ msgstr "" "patch 的中止,即使有異常被引發也是如此。所有這些函式也可以在 with 陳述式中使" "用,或者作為類別裝飾器使用。" -#: ../../library/unittest.mock.rst:1394 +#: ../../library/unittest.mock.rst:1417 msgid "patch" msgstr "patch" -#: ../../library/unittest.mock.rst:1398 +#: ../../library/unittest.mock.rst:1421 msgid "" "The key is to do the patching in the right namespace. See the section `where " "to patch`_." msgstr "關鍵是要在正確的命名空間進行 patch。請參閱 `where to patch`_ 一節。" -#: ../../library/unittest.mock.rst:1402 +#: ../../library/unittest.mock.rst:1425 msgid "" ":func:`patch` acts as a function decorator, class decorator or a context " "manager. Inside the body of the function or with statement, the *target* is " @@ -1469,7 +1531,7 @@ msgstr "" "內部,*目標*\\ 會被 patch 成一個\\ *新的*\\ 物件。當函式或 with 陳述式結束" "時,patch 就會被解除。" -#: ../../library/unittest.mock.rst:1407 +#: ../../library/unittest.mock.rst:1430 msgid "" "If *new* is omitted, then the target is replaced with an :class:`AsyncMock` " "if the patched object is an async function or a :class:`MagicMock` " @@ -1478,12 +1540,13 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" -"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換為 :class:" -"`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做為裝飾器使" -"用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" -"func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" +"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換" +"為 :class:`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做" +"為裝飾器使用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函" +"式。如果 :func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回" +"傳。" -#: ../../library/unittest.mock.rst:1415 +#: ../../library/unittest.mock.rst:1438 msgid "" "*target* should be a string in the form ``'package.module.ClassName'``. The " "*target* is imported and the specified object replaced with the *new* " @@ -1492,19 +1555,19 @@ msgid "" "function is executed, not at decoration time." msgstr "" "*target* 應該是以 ``'package.module.ClassName'`` 形式出現的字串。*target* 會" -"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼叫 :func:" -"`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" -"時 (decoration time)。" +"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼" +"叫 :func:`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝" +"飾器作用時 (decoration time)。" -#: ../../library/unittest.mock.rst:1421 +#: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to the :class:" -"`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to " +"the :class:`MagicMock` if patch is creating one for you." msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" -#: ../../library/unittest.mock.rst:1424 +#: ../../library/unittest.mock.rst:1447 msgid "" "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " "patch to pass in the object being mocked as the spec/spec_set object." @@ -1512,17 +1575,18 @@ msgstr "" "此外,你還可以傳遞 ``spec=True`` 或 ``spec_set=True``,這將導致 patch 將被 " "mock 的物件作為 spec/spec_set 物件傳遞。" -#: ../../library/unittest.mock.rst:1427 +#: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By default :class:" -"`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." +"that will be called to create the *new* object. By " +"default :class:`AsyncMock` is used for async functions " +"and :class:`MagicMock` for the rest." msgstr "" "*new_callable* 允許你指定一個不同的類別或可呼叫的物件,用於被呼叫並建立 " "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" "則使用 :class:`MagicMock`。" -#: ../../library/unittest.mock.rst:1431 +#: ../../library/unittest.mock.rst:1454 msgid "" "A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " "then the mock will be created with a spec from the object being replaced. " @@ -1530,17 +1594,17 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See the :" -"func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See " +"the :func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "*spec* 的一種更強大的形式是 *autospec*。如果你設定 ``autospec=True``,則該 " "mock 將使用被替換物件的規格來建立。該 mock 的所有屬性也將具有被替換物件的對應" "屬性的規格。被 mock 的方法和函式將檢查其引數,如果呼叫時引數與規格不符(被使" "用錯誤的簽名 (signature) 呼叫),將引發 :exc:`TypeError`。對於替換類別的 " -"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" -"`create_autospec` 函式和 :ref:`auto-speccing`。" +"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參" +"閱 :func:`create_autospec` 函式和 :ref:`auto-speccing`。" -#: ../../library/unittest.mock.rst:1441 +#: ../../library/unittest.mock.rst:1464 msgid "" "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " "arbitrary object as the spec instead of the one being replaced." @@ -1548,7 +1612,7 @@ msgstr "" "你可以用 ``autospec=some_object`` 替代 ``autospec=True``,以使用任意物件作為" "規格,而不是被替換的物件。" -#: ../../library/unittest.mock.rst:1444 +#: ../../library/unittest.mock.rst:1467 msgid "" "By default :func:`patch` will fail to replace attributes that don't exist. " "If you pass in ``create=True``, and the attribute doesn't exist, patch will " @@ -1564,7 +1628,7 @@ msgstr "" "行環境建立的屬性的測試時非常有用。此功能預設為關閉,因為這可能會相當危險。開" "啟這個功能後,你可以對於實際上不存在的 API 撰寫會通過的測試!" -#: ../../library/unittest.mock.rst:1454 +#: ../../library/unittest.mock.rst:1477 msgid "" "If you are patching builtins in a module then you don't need to pass " "``create=True``, it will be added by default." @@ -1572,15 +1636,15 @@ msgstr "" "如果你正在 patch 模組中的內建函式,那麼你不需要傳遞 ``create=True``,它預設會" "被加入。" -#: ../../library/unittest.mock.rst:1458 +#: ../../library/unittest.mock.rst:1481 msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with ``patch." -"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" -"`unittest` finds tests. You can specify an alternative prefix by setting " -"``patch.TEST_PREFIX``." +"finds tests by looking for method names that start with " +"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " +"way :mod:`unittest` finds tests. You can specify an alternative prefix by " +"setting ``patch.TEST_PREFIX``." msgstr "" "patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" "的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" @@ -1588,7 +1652,7 @@ msgstr "" "設情況下會是 ``'test'``,這與 :mod:`unittest` 尋找測試的方式相匹配。你可以通" "過設定 ``patch.TEST_PREFIX`` 來指定別的前綴。" -#: ../../library/unittest.mock.rst:1465 +#: ../../library/unittest.mock.rst:1488 msgid "" "Patch can be used as a context manager, with the with statement. Here the " "patching applies to the indented block after the with statement. If you use " @@ -1599,17 +1663,17 @@ msgstr "" "的縮排區塊。如果你使用 \"as\",則被 patch 的物件將被綁定到 \"as\" 後面的名" "稱;如果 :func:`patch` 正在為你建立一個 mock 物件,這會非常有用。" -#: ../../library/unittest.mock.rst:1470 +#: ../../library/unittest.mock.rst:1493 msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed to :" -"class:`AsyncMock` if the patched object is asynchronous, to :class:" -"`MagicMock` otherwise or to *new_callable* if specified." +":func:`patch` takes arbitrary keyword arguments. These will be passed " +"to :class:`AsyncMock` if the patched object is asynchronous, " +"to :class:`MagicMock` otherwise or to *new_callable* if specified." msgstr "" ":func:`patch` 接受任意的關鍵字引數。如果被 patch 的物件是非同步的,這些將會被" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" "指定了 *new_callable*,則傳遞給它。" -#: ../../library/unittest.mock.rst:1474 +#: ../../library/unittest.mock.rst:1497 msgid "" "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " "available for alternate use-cases." @@ -1617,14 +1681,14 @@ msgstr "" "``patch.dict(...)``、``patch.multiple(...)`` 和 ``patch.object(...)`` 可用於" "其餘的使用情境。" -#: ../../library/unittest.mock.rst:1477 +#: ../../library/unittest.mock.rst:1500 msgid "" ":func:`patch` as function decorator, creating the mock for you and passing " "it into the decorated function::" msgstr "" ":func:`patch` 作為函式裝飾器,為你建立 mock 並將其傳遞給被裝飾的函式: ::" -#: ../../library/unittest.mock.rst:1480 +#: ../../library/unittest.mock.rst:1503 msgid "" ">>> @patch('__main__.SomeClass')\n" "... def function(normal_argument, mock_class):\n" @@ -1640,34 +1704,34 @@ msgstr "" ">>> function(None)\n" "True" -#: ../../library/unittest.mock.rst:1487 +#: ../../library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be the :attr:" -"`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be " +"the :attr:`~Mock.return_value` of the mock that will be used." msgstr "" "Patch 一個類別會以 :class:`MagicMock`\\ *實例*\\ 取代該類別。如果該類別在被" -"測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." -"return_value`。" +"測試的程式碼中實例化,那麼它將是會被使用的 mock " +"的 :attr:`~Mock.return_value`。" -#: ../../library/unittest.mock.rst:1491 +#: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could use :attr:`~Mock." -"side_effect` to return a new mock each time. Alternatively you can set the " -"*return_value* to be anything you want." +"If the class is instantiated multiple times you could " +"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " +"you can set the *return_value* to be anything you want." msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" -#: ../../library/unittest.mock.rst:1495 +#: ../../library/unittest.mock.rst:1518 msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." -"return_value` 上進行配置。例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須" +"在 :attr:`~Mock.return_value` 上進行配置。例如: ::" -#: ../../library/unittest.mock.rst:1498 +#: ../../library/unittest.mock.rst:1521 msgid "" ">>> class Class:\n" "... def method(self):\n" @@ -1691,7 +1755,7 @@ msgstr "" "... assert Class().method() == 'foo'\n" "..." -#: ../../library/unittest.mock.rst:1509 +#: ../../library/unittest.mock.rst:1532 msgid "" "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " "then the return value of the created mock will have the same spec. ::" @@ -1699,7 +1763,7 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 且 :func:`patch` 正在取代一個\\ *類別*,那麼" "被建立的 mock 的回傳值將具有相同的規格。: ::" -#: ../../library/unittest.mock.rst:1512 +#: ../../library/unittest.mock.rst:1535 msgid "" ">>> Original = Class\n" ">>> patcher = patch('__main__.Class', spec=True)\n" @@ -1715,7 +1779,7 @@ msgstr "" ">>> assert isinstance(instance, Original)\n" ">>> patcher.stop()" -#: ../../library/unittest.mock.rst:1519 +#: ../../library/unittest.mock.rst:1542 msgid "" "The *new_callable* argument is useful where you want to use an alternative " "class to the default :class:`MagicMock` for the created mock. For example, " @@ -1725,7 +1789,7 @@ msgstr "" "*new_callable* 引數非常有用。例如,如果你想要一個 :class:`NonCallableMock` 被" "使用: ::" -#: ../../library/unittest.mock.rst:1523 +#: ../../library/unittest.mock.rst:1546 msgid "" ">>> thing = object()\n" ">>> with patch('__main__.thing', new_callable=NonCallableMock) as " @@ -1747,13 +1811,13 @@ msgstr "" " ...\n" "TypeError: 'NonCallableMock' object is not callable" -#: ../../library/unittest.mock.rst:1532 +#: ../../library/unittest.mock.rst:1555 msgid "" "Another use case might be to replace an object with an :class:`io.StringIO` " "instance::" msgstr "另一個用法是用一個 :class:`io.StringIO` 實例替換一個物件: ::" -#: ../../library/unittest.mock.rst:1534 +#: ../../library/unittest.mock.rst:1557 msgid "" ">>> from io import StringIO\n" ">>> def foo():\n" @@ -1777,7 +1841,7 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1545 +#: ../../library/unittest.mock.rst:1568 msgid "" "When :func:`patch` is creating a mock for you, it is common that the first " "thing you need to do is to configure the mock. Some of that configuration " @@ -1788,7 +1852,7 @@ msgstr "" "一些配置可以在對 patch 的呼叫中完成。你傳遞到呼叫中的任何關鍵字都將用於在被建" "立的 mock 上設定屬性: ::" -#: ../../library/unittest.mock.rst:1550 +#: ../../library/unittest.mock.rst:1573 msgid "" ">>> patcher = patch('__main__.thing', first='one', second='two')\n" ">>> mock_thing = patcher.start()\n" @@ -1804,20 +1868,20 @@ msgstr "" ">>> mock_thing.second\n" "'two'" -#: ../../library/unittest.mock.rst:1557 +#: ../../library/unittest.mock.rst:1580 msgid "" -"As well as attributes on the created mock attributes, like the :attr:`~Mock." -"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " -"configured. These aren't syntactically valid to pass in directly as keyword " -"arguments, but a dictionary with these as keys can still be expanded into a :" -"func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like " +"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " +"can also be configured. These aren't syntactically valid to pass in directly " +"as keyword arguments, but a dictionary with these as keys can still be " +"expanded into a :func:`patch` call using ``**``::" msgstr "" -"除了被建立的 mock 上的屬性外,還可以配置 child mock 的 :attr:`~Mock." -"return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能直接作為關鍵字引" -"數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" -"叫: ::" +"除了被建立的 mock 上的屬性外,還可以配置 child mock " +"的 :attr:`~Mock.return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能" +"直接作為關鍵字引數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一" +"個 :func:`patch` 呼叫: ::" -#: ../../library/unittest.mock.rst:1563 +#: ../../library/unittest.mock.rst:1586 msgid "" ">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" ">>> patcher = patch('__main__.thing', **config)\n" @@ -1839,16 +1903,16 @@ msgstr "" " ...\n" "KeyError" -#: ../../library/unittest.mock.rst:1573 +#: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail with :exc:" -"`AttributeError`::" +"attribute in a class) that does not exist will fail " +"with :exc:`AttributeError`::" msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" -#: ../../library/unittest.mock.rst:1576 +#: ../../library/unittest.mock.rst:1599 msgid "" ">>> @patch('sys.non_existing_attribute', 42)\n" "... def test():\n" @@ -1870,7 +1934,7 @@ msgstr "" "AttributeError: does not have the attribute " "'non_existing_attribute'" -#: ../../library/unittest.mock.rst:1585 +#: ../../library/unittest.mock.rst:1608 msgid "" "but adding ``create=True`` in the call to :func:`patch` will make the " "previous example work as expected::" @@ -1878,7 +1942,7 @@ msgstr "" "但是在對 :func:`patch` 的呼叫中增加 ``create=True`` 將使前面的範例按照預期運" "作: ::" -#: ../../library/unittest.mock.rst:1588 +#: ../../library/unittest.mock.rst:1611 msgid "" ">>> @patch('sys.non_existing_attribute', 42, create=True)\n" "... def test(mock_stdout):\n" @@ -1892,18 +1956,18 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1596 +#: ../../library/unittest.mock.rst:1619 msgid "" ":func:`patch` now returns an :class:`AsyncMock` if the target is an async " "function." msgstr "" "如果目標是一個非同步函式,:func:`patch` 現在會回傳一個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:1600 +#: ../../library/unittest.mock.rst:1623 msgid "patch.object" msgstr "patch.object" -#: ../../library/unittest.mock.rst:1604 +#: ../../library/unittest.mock.rst:1627 msgid "" "patch the named member (*attribute*) on an object (*target*) with a mock " "object." @@ -1911,28 +1975,28 @@ msgstr "" "使用一個 mock 物件 patch 一個物件(\\ *目標*\\ )上的命名成員(\\ *屬性" "*\\ )。" -#: ../../library/unittest.mock.rst:1607 +#: ../../library/unittest.mock.rst:1630 msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" -"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " -"configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. " +"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " +"for configuring the mock object it creates." msgstr "" ":func:`patch.object` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 *new*、" -"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " -"接受任意關鍵字引數來配置它所建立的 mock 物件。" +"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。與 :func:`patch` 一" +"樣,:func:`patch.object` 接受任意關鍵字引數來配置它所建立的 mock 物件。" -#: ../../library/unittest.mock.rst:1613 +#: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1616 +#: ../../library/unittest.mock.rst:1639 msgid "" "You can either call :func:`patch.object` with three arguments or two " "arguments. The three argument form takes the object to be patched, the " @@ -1941,7 +2005,7 @@ msgstr "" "你可以使用三個引數或兩個引數來呼叫 :func:`patch.object`。三個引數的形式接受要" "被 patch 的物件、屬性名稱和要替換掉屬性的物件。" -#: ../../library/unittest.mock.rst:1620 +#: ../../library/unittest.mock.rst:1643 msgid "" "When calling with the two argument form you omit the replacement object, and " "a mock is created for you and passed in as an extra argument to the " @@ -1950,7 +2014,7 @@ msgstr "" "當使用兩個引數的形式呼叫時,你會省略要替換的物件,一個 mock 會為你建立並將其" "作為額外的引數傳遞給被裝飾的函式:" -#: ../../library/unittest.mock.rst:1631 +#: ../../library/unittest.mock.rst:1654 msgid "" "*spec*, *create* and the other arguments to :func:`patch.object` have the " "same meaning as they do for :func:`patch`." @@ -1958,32 +2022,32 @@ msgstr "" "*spec*、*create* 和 :func:`patch.object` 的其他引數與在 :func:`patch` 中的引" "數具有相同的意義。" -#: ../../library/unittest.mock.rst:1636 +#: ../../library/unittest.mock.rst:1659 msgid "patch.dict" msgstr "patch.dict" -#: ../../library/unittest.mock.rst:1640 +#: ../../library/unittest.mock.rst:1663 msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test." msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態。" -#: ../../library/unittest.mock.rst:1643 +#: ../../library/unittest.mock.rst:1666 msgid "" "*in_dict* can be a dictionary or a mapping like container. If it is a " "mapping then it must at least support getting, setting and deleting items " "plus iterating over keys." msgstr "" "*in_dict* 可以是一個字典或一個類對映的容器。如果它是一個對映,那麼它至少必須" -"支援獲取、設定、刪除項目以及對鍵的疊代。" +"支援取得、設定、刪除項目以及對鍵的疊代。" -#: ../../library/unittest.mock.rst:1647 +#: ../../library/unittest.mock.rst:1670 msgid "" "*in_dict* can also be a string specifying the name of the dictionary, which " "will then be fetched by importing it." msgstr "*in_dict* 也可以是指定字典名稱的字串,然後透過 import 來取得該字典。" -#: ../../library/unittest.mock.rst:1650 +#: ../../library/unittest.mock.rst:1673 msgid "" "*values* can be a dictionary of values to set in the dictionary. *values* " "can also be an iterable of ``(key, value)`` pairs." @@ -1991,39 +2055,40 @@ msgstr "" "*values* 可以是要設定的值的字典。*values* 也可以是 ``(key, value)`` 對 " "(pairs) 的可疊代物件。" -#: ../../library/unittest.mock.rst:1653 +#: ../../library/unittest.mock.rst:1676 msgid "" "If *clear* is true then the dictionary will be cleared before the new values " "are set." msgstr "如果 *clear* 為 true,則在設定新值之前字典將被清除。" -#: ../../library/unittest.mock.rst:1656 +#: ../../library/unittest.mock.rst:1679 msgid "" ":func:`patch.dict` can also be called with arbitrary keyword arguments to " "set values in the dictionary." msgstr "也可以使用任意關鍵字引數呼叫 :func:`patch.dict` 以在字典中設定值。" -#: ../../library/unittest.mock.rst:1661 +#: ../../library/unittest.mock.rst:1684 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr ":func:`patch.dict` 現在在做為情境管理器使用時回傳被 patch 的字典。" -#: ../../library/unittest.mock.rst:1664 +#: ../../library/unittest.mock.rst:1687 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝飾器使用:" -#: ../../library/unittest.mock.rst:1675 +#: ../../library/unittest.mock.rst:1698 msgid "" -"When used as a class decorator :func:`patch.dict` honours ``patch." -"TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" +"When used as a class decorator :func:`patch.dict` honours " +"``patch.TEST_PREFIX`` (default to ``'test'``) for choosing which methods to " +"wrap:" msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" -#: ../../library/unittest.mock.rst:1686 +#: ../../library/unittest.mock.rst:1709 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " @@ -2033,7 +2098,7 @@ msgstr "" "patcher 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內" "容。" -#: ../../library/unittest.mock.rst:1690 +#: ../../library/unittest.mock.rst:1713 msgid "" ":func:`patch.dict` can be used to add members to a dictionary, or simply let " "a test change a dictionary, and ensure the dictionary is restored when the " @@ -2042,32 +2107,31 @@ msgstr "" ":func:`patch.dict` 可用於在字典中新增成員,或單純地讓測試更改字典,並確保在測" "試結束時將字典回復原狀。" -#: ../../library/unittest.mock.rst:1711 +#: ../../library/unittest.mock.rst:1734 msgid "" "Keywords can be used in the :func:`patch.dict` call to set values in the " "dictionary:" msgstr "可以在 :func:`patch.dict` 呼叫中使用關鍵字來設定字典中的值:" -#: ../../library/unittest.mock.rst:1721 +#: ../../library/unittest.mock.rst:1744 msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." -"__iter__` or :meth:`~object.__contains__`." +"to the magic " +"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " +"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的獲取、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" -"`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." -"__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." -"__contains__`。" +"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中" +"的 :meth:`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object.__delitem__` " +"以及 :meth:`~container.__iter__` 或 :meth:`~object.__contains__`。" -#: ../../library/unittest.mock.rst:1751 +#: ../../library/unittest.mock.rst:1774 msgid "patch.multiple" msgstr "patch.multiple" -#: ../../library/unittest.mock.rst:1755 +#: ../../library/unittest.mock.rst:1778 msgid "" "Perform multiple patches in a single call. It takes the object to be patched " "(either as an object or a string to fetch the object by importing) and " @@ -2076,7 +2140,7 @@ msgstr "" "在一次呼叫中執行多個 patch。它接受被 patch 的物件(作為物件或透過 import 取得" "物件的字串)和 patch 的關鍵字引數: ::" -#: ../../library/unittest.mock.rst:1759 +#: ../../library/unittest.mock.rst:1782 msgid "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." @@ -2084,18 +2148,18 @@ msgstr "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." -#: ../../library/unittest.mock.rst:1762 +#: ../../library/unittest.mock.rst:1785 msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned when :func:" -"`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned " +"when :func:`patch.multiple` is used as a context manager." msgstr "" "如果你想要 :func:`patch.multiple` 為你建立 mock,請使用 :data:`DEFAULT` 作為" -"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" -"func:`patch.multiple` 作為情境管理器時會回傳字典。" +"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且" +"當 :func:`patch.multiple` 作為情境管理器時會回傳字典。" -#: ../../library/unittest.mock.rst:1767 +#: ../../library/unittest.mock.rst:1790 msgid "" ":func:`patch.multiple` can be used as a decorator, class decorator or a " "context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " @@ -2103,30 +2167,30 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" ":func:`patch.multiple` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 " -"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" -"成的\\ *所有* patch。" +"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。這些引數將應用於" +"由 :func:`patch.multiple` 完成的\\ *所有* patch。" -#: ../../library/unittest.mock.rst:1772 +#: ../../library/unittest.mock.rst:1795 msgid "" -"When used as a class decorator :func:`patch.multiple` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1775 +#: ../../library/unittest.mock.rst:1798 msgid "" "If you want :func:`patch.multiple` to create mocks for you, then you can " "use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使用 :data:" -"`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " -"mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" +"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使" +"用 :data:`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼" +"被建立的 mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" -#: ../../library/unittest.mock.rst:1779 +#: ../../library/unittest.mock.rst:1802 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2148,7 +2212,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1789 +#: ../../library/unittest.mock.rst:1812 msgid "" ":func:`patch.multiple` can be nested with other ``patch`` decorators, but " "put arguments passed by keyword *after* any of the standard arguments " @@ -2157,7 +2221,7 @@ msgstr "" ":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器巢狀使用,但需要將透過關鍵" "字傳遞的引數放在 :func:`patch` 建立的任何標準引數\\ *之後*: ::" -#: ../../library/unittest.mock.rst:1792 +#: ../../library/unittest.mock.rst:1815 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2177,7 +2241,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1801 +#: ../../library/unittest.mock.rst:1824 msgid "" "If :func:`patch.multiple` is used as a context manager, the value returned " "by the context manager is a dictionary where created mocks are keyed by " @@ -2186,7 +2250,7 @@ msgstr "" "如果 :func:`patch.multiple` 作為情境管理器使用,則情境管理器回傳的值是一個字" "典,其中被建立的 mock 會按名稱作為其鍵值: ::" -#: ../../library/unittest.mock.rst:1804 +#: ../../library/unittest.mock.rst:1827 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2204,11 +2268,11 @@ msgstr "" "... assert values['other'] is other\n" "..." -#: ../../library/unittest.mock.rst:1815 +#: ../../library/unittest.mock.rst:1838 msgid "patch methods: start and stop" msgstr "patch 方法:啟動與停止" -#: ../../library/unittest.mock.rst:1817 +#: ../../library/unittest.mock.rst:1840 msgid "" "All the patchers have :meth:`!start` and :meth:`!stop` methods. These make " "it simpler to do patching in ``setUp`` methods or where you want to do " @@ -2218,18 +2282,18 @@ msgstr "" "方法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多" "個 patch 時變得更簡單。" -#: ../../library/unittest.mock.rst:1821 +#: ../../library/unittest.mock.rst:1844 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" -"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" -"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" +"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` " +"或 :func:`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼" +"叫 :meth:`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" -#: ../../library/unittest.mock.rst:1825 +#: ../../library/unittest.mock.rst:1848 msgid "" "If you are using :func:`patch` to create a mock for you then it will be " "returned by the call to ``patcher.start``. ::" @@ -2237,7 +2301,7 @@ msgstr "" "如果你使用 :func:`patch` 為你建立 mock,那麼它將透過呼叫 ``patcher.start`` 回" "傳。: ::" -#: ../../library/unittest.mock.rst:1828 +#: ../../library/unittest.mock.rst:1851 msgid "" ">>> patcher = patch('package.module.ClassName')\n" ">>> from package import module\n" @@ -2259,7 +2323,7 @@ msgstr "" ">>> assert module.ClassName is original\n" ">>> assert module.ClassName is not new_mock" -#: ../../library/unittest.mock.rst:1839 +#: ../../library/unittest.mock.rst:1862 msgid "" "A typical use case for this might be for doing multiple patches in the " "``setUp`` method of a :class:`~unittest.TestCase`::" @@ -2267,7 +2331,7 @@ msgstr "" "一個典型的用法是在一個 :class:`~unittest.TestCase` 的 ``setUp`` 方法中執行多" "個 patch: ::" -#: ../../library/unittest.mock.rst:1842 +#: ../../library/unittest.mock.rst:1865 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2303,18 +2367,18 @@ msgstr "" "...\n" ">>> MyTest('test_something').run()" -#: ../../library/unittest.mock.rst:1861 +#: ../../library/unittest.mock.rst:1884 msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" "不會被呼叫。:meth:`unittest.TestCase.addCleanup` 會讓這稍微簡單一點: ::" -#: ../../library/unittest.mock.rst:1866 +#: ../../library/unittest.mock.rst:1889 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2336,34 +2400,34 @@ msgstr "" "... assert package.module.Class is self.MockClass\n" "..." -#: ../../library/unittest.mock.rst:1876 +#: ../../library/unittest.mock.rst:1899 msgid "" "As an added bonus you no longer need to keep a reference to the ``patcher`` " "object." msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的參照。" -#: ../../library/unittest.mock.rst:1879 +#: ../../library/unittest.mock.rst:1902 msgid "" -"It is also possible to stop all patches which have been started by using :" -"func:`patch.stopall`." +"It is also possible to stop all patches which have been started by " +"using :func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" -#: ../../library/unittest.mock.rst:1884 +#: ../../library/unittest.mock.rst:1907 msgid "Stop all active patches. Only stops patches started with ``start``." msgstr "停止所有運作的 patch。只停止以 ``start`` 啟動的 patch。" -#: ../../library/unittest.mock.rst:1890 +#: ../../library/unittest.mock.rst:1913 msgid "patch builtins" msgstr "patch 內建函式" -#: ../../library/unittest.mock.rst:1891 +#: ../../library/unittest.mock.rst:1914 msgid "" "You can patch any builtins within a module. The following example patches " "builtin :func:`ord`::" msgstr "" "你可以 patch 模組內的任何內建函式。以下範例 patch 內建函式 :func:`ord`: ::" -#: ../../library/unittest.mock.rst:1894 +#: ../../library/unittest.mock.rst:1917 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2381,11 +2445,11 @@ msgstr "" ">>> test()\n" "101" -#: ../../library/unittest.mock.rst:1906 +#: ../../library/unittest.mock.rst:1929 msgid "TEST_PREFIX" msgstr "TEST_PREFIX" -#: ../../library/unittest.mock.rst:1908 +#: ../../library/unittest.mock.rst:1931 msgid "" "All of the patchers can be used as class decorators. When used in this way " "they wrap every test method on the class. The patchers recognise methods " @@ -2393,19 +2457,19 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" "所有 patcher 都可以作為類別裝飾器使用。以這種方式使用時,它們包裝了類別上的每" -"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" -"`unittest.TestLoader` 預設尋找測試方法的方式相同。" +"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這" +"與 :class:`unittest.TestLoader` 預設尋找測試方法的方式相同。" -#: ../../library/unittest.mock.rst:1913 +#: ../../library/unittest.mock.rst:1936 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting ``patch." -"TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting " +"``patch.TEST_PREFIX``::" msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" -#: ../../library/unittest.mock.rst:1916 +#: ../../library/unittest.mock.rst:1939 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2443,21 +2507,21 @@ msgstr "" ">>> value\n" "3" -#: ../../library/unittest.mock.rst:1936 +#: ../../library/unittest.mock.rst:1959 msgid "Nesting Patch Decorators" msgstr "巢狀使用 Patch 裝飾器" -#: ../../library/unittest.mock.rst:1938 +#: ../../library/unittest.mock.rst:1961 msgid "" "If you want to perform multiple patches then you can simply stack up the " "decorators." msgstr "如果你想執行多個 patch,那麼你可以簡單地堆疊裝飾器。" -#: ../../library/unittest.mock.rst:1941 +#: ../../library/unittest.mock.rst:1964 msgid "You can stack up multiple patch decorators using this pattern:" msgstr "你可以使用這個模式來堆疊多個 patch 裝飾器:" -#: ../../library/unittest.mock.rst:1957 +#: ../../library/unittest.mock.rst:1980 msgid "" "Note that the decorators are applied from the bottom upwards. This is the " "standard way that Python applies decorators. The order of the created mocks " @@ -2466,11 +2530,11 @@ msgstr "" "請注意,裝飾器是從底部向上應用的。這是 Python 應用裝飾器的標準方式。被建立的 " "mock 傳遞到測試函式中的順序與此順序相同。" -#: ../../library/unittest.mock.rst:1965 +#: ../../library/unittest.mock.rst:1988 msgid "Where to patch" msgstr "該 patch 何處" -#: ../../library/unittest.mock.rst:1967 +#: ../../library/unittest.mock.rst:1990 msgid "" ":func:`patch` works by (temporarily) changing the object that a *name* " "points to with another one. There can be many names pointing to any " @@ -2481,7 +2545,7 @@ msgstr "" "有許多 name 指向任何單一物件,因此為了使 patch 起作用,你必須確保你 patch 了" "被測試系統使用的 name。" -#: ../../library/unittest.mock.rst:1972 +#: ../../library/unittest.mock.rst:1995 msgid "" "The basic principle is that you patch where an object is *looked up*, which " "is not necessarily the same place as where it is defined. A couple of " @@ -2490,12 +2554,12 @@ msgstr "" "基本原則是在物件\\ *被查找*\\ 的位置進行 patch,該位置不一定與其被定義的位置" "相同。幾個範例將有助於闡明這一點。" -#: ../../library/unittest.mock.rst:1976 +#: ../../library/unittest.mock.rst:1999 msgid "" "Imagine we have a project that we want to test with the following structure::" msgstr "想像一下,我們想要測試一個專案,其結構如下: ::" -#: ../../library/unittest.mock.rst:1978 +#: ../../library/unittest.mock.rst:2001 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2504,15 +2568,21 @@ msgid "" " -> from a import SomeClass\n" " -> some_function instantiates SomeClass" msgstr "" +"a.py\n" +" -> Defines SomeClass\n" +"\n" +"b.py\n" +" -> from a import SomeClass\n" +" -> some_function instantiates SomeClass" -#: ../../library/unittest.mock.rst:1985 +#: ../../library/unittest.mock.rst:2008 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do then it imports ``SomeClass`` from module a. If we use :func:" -"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " -"module b already has a reference to the *real* ``SomeClass`` and it looks " -"like our patching had no effect." +"will have to do when it imports ``SomeClass`` from module a. If we " +"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " +"our test; module b already has a reference to the *real* ``SomeClass`` and " +"it looks like our patching had no effect." msgstr "" "現在我們想要測試 ``some_function``,但我們想使用 :func:`patch` mock " "``SomeClass``。問題是,當我們 import 模組 b 時(我們必須這樣做),它會從模組 " @@ -2520,7 +2590,7 @@ msgstr "" "那麼它對我們的測試就不會有任何影響;模組 b 已經有了一個\\ *真實的*\\ " "``SomeClass`` 的參照 ,看起來我們的 patch 並沒有任何效果。" -#: ../../library/unittest.mock.rst:1992 +#: ../../library/unittest.mock.rst:2015 msgid "" "The key is to patch out ``SomeClass`` where it is used (or where it is " "looked up). In this case ``some_function`` will actually look up " @@ -2531,64 +2601,64 @@ msgstr "" "``some_function`` 實際上會在我們 import 它的模組 b 中查找 ``SomeClass``。這裡" "的 patch 應該長得像這樣: ::" -#: ../../library/unittest.mock.rst:1996 +#: ../../library/unittest.mock.rst:2019 msgid "@patch('b.SomeClass')" msgstr "@patch('b.SomeClass')" -#: ../../library/unittest.mock.rst:1998 +#: ../../library/unittest.mock.rst:2021 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." -"SomeClass``. Both of these import forms are common. In this case the class " -"we want to patch is being looked up in the module and so we have to patch " -"``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses " +"``a.SomeClass``. Both of these import forms are common. In this case the " +"class we want to patch is being looked up in the module and so we have to " +"patch ``a.SomeClass`` instead::" msgstr "" "然而,考慮另一種情況,其中模組 b 並不是使用 ``from a import SomeClass``,而" "是 ``import a``,然後 ``some_function`` 使用 ``a.SomeClass``。這兩種 import " "形式都很常見。在這種情況下,我們想要 patch 的類別正在其模組中被查找,因此我們" "必須 patch ``a.SomeClass``: ::" -#: ../../library/unittest.mock.rst:2003 +#: ../../library/unittest.mock.rst:2026 msgid "@patch('a.SomeClass')" msgstr "@patch('a.SomeClass')" -#: ../../library/unittest.mock.rst:2007 +#: ../../library/unittest.mock.rst:2030 msgid "Patching Descriptors and Proxy Objects" msgstr "Patch 描述器與代理物件 (Proxy Objects)" -#: ../../library/unittest.mock.rst:2009 +#: ../../library/unittest.mock.rst:2032 msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ 和 patch.object_ 都正確地 patch 和還原描述器:類別方法、靜態方法以及屬" "性。你應該在 *類別* 而不是實例上 patch 它們。它們還可以使用代理屬性存取的\\ *" -"一些*\\ 物件,例如 `django 設定物件 `_。" -#: ../../library/unittest.mock.rst:2017 +#: ../../library/unittest.mock.rst:2040 msgid "MagicMock and magic method support" msgstr "MagicMock 以及魔術方法支援" -#: ../../library/unittest.mock.rst:2022 +#: ../../library/unittest.mock.rst:2045 msgid "Mocking Magic Methods" msgstr "Mock 魔術方法" -#: ../../library/unittest.mock.rst:2024 +#: ../../library/unittest.mock.rst:2047 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known as :" -"term:`\"magic methods\" `. This allows mock objects to replace " -"containers or other objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known " +"as :term:`\"magic methods\" `. This allows mock objects to " +"replace containers or other objects that implement Python protocols." msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" -#: ../../library/unittest.mock.rst:2028 +#: ../../library/unittest.mock.rst:2051 msgid "" "Because magic methods are looked up differently from normal methods [#]_, " "this support has been specially implemented. This means that only specific " @@ -2599,7 +2669,7 @@ msgstr "" "代表著僅有特定的魔術方法被此方式支援。現在已支援清單中已經\\ *幾乎*\\ 包含了" "所有魔術方法。如果你需要 mock 任何魔術方法而其尚未被支援,請讓我們知道。" -#: ../../library/unittest.mock.rst:2033 +#: ../../library/unittest.mock.rst:2056 msgid "" "You mock magic methods by setting the method you are interested in to a " "function or a mock instance. If you are using a function then it *must* take " @@ -2608,46 +2678,46 @@ msgstr "" "你可以透過將你感興趣的方法設定為函式或 mock 實例來 mock 魔術方法。如果你使用" "函式,那麼它\\ *必須*\\ 將 ``self`` 作為第一個引數 [#]_。" -#: ../../library/unittest.mock.rst:2056 +#: ../../library/unittest.mock.rst:2079 msgid "" -"One use case for this is for mocking objects used as context managers in a :" -"keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in " +"a :keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" -#: ../../library/unittest.mock.rst:2068 +#: ../../library/unittest.mock.rst:2091 msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" -"attr:`~Mock.mock_calls` 內。" +"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄" +"在 :attr:`~Mock.mock_calls` 內。" -#: ../../library/unittest.mock.rst:2073 +#: ../../library/unittest.mock.rst:2096 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise an :exc:" -"`AttributeError`." +"set a magic method that isn't in the spec will raise " +"an :exc:`AttributeError`." msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2076 +#: ../../library/unittest.mock.rst:2099 msgid "The full list of supported magic methods is:" msgstr "已支援的魔術方法的完整列表是:" -#: ../../library/unittest.mock.rst:2078 +#: ../../library/unittest.mock.rst:2101 msgid "``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``" msgstr "``__hash__``、``__sizeof__``、 ``__repr__`` 和 ``__str__``" -#: ../../library/unittest.mock.rst:2079 +#: ../../library/unittest.mock.rst:2102 msgid "``__dir__``, ``__format__`` and ``__subclasses__``" msgstr "``__dir__``、 ``__format__`` 和 ``__subclasses__``" -#: ../../library/unittest.mock.rst:2080 +#: ../../library/unittest.mock.rst:2103 msgid "``__round__``, ``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__round__``、``__floor__``、``__trunc__`` 和 ``__ceil__``" -#: ../../library/unittest.mock.rst:2081 +#: ../../library/unittest.mock.rst:2104 msgid "" "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " "``__ne__``" @@ -2655,7 +2725,7 @@ msgstr "" "比較方法:``__lt__``、``__gt__``、``__le__``、``__ge__``、``__eq__`` 和 " "``__ne__``" -#: ../../library/unittest.mock.rst:2083 +#: ../../library/unittest.mock.rst:2106 msgid "" "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " @@ -2665,18 +2735,18 @@ msgstr "" "``__contains__``、``__len__``、``__iter__``、``__reversed__`` 和 " "``__missing__``" -#: ../../library/unittest.mock.rst:2086 +#: ../../library/unittest.mock.rst:2109 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" "情境管理器:``__enter__``、``__exit__``、``__aenter__`` 和 ``__aexit__``" -#: ../../library/unittest.mock.rst:2087 +#: ../../library/unittest.mock.rst:2110 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "一元數值方法:``__neg__``、``__pos__`` 和 ``__invert__``" -#: ../../library/unittest.mock.rst:2088 +#: ../../library/unittest.mock.rst:2111 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " @@ -2688,18 +2758,18 @@ msgstr "" "``__mod__``、``__divmod__``、``__lshift__``、``__rshift__``、``__and__``、" "``__xor__``、``__or__`` 和 ``__pow__``" -#: ../../library/unittest.mock.rst:2092 +#: ../../library/unittest.mock.rst:2115 msgid "" "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " "``__index__``" msgstr "" "數值轉換方法:``__complex__``、``__int__``、``__float__`` 和 ``__index__``" -#: ../../library/unittest.mock.rst:2094 +#: ../../library/unittest.mock.rst:2117 msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "描述器方法:``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2095 +#: ../../library/unittest.mock.rst:2118 msgid "" "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__`` and ``__setstate__``" @@ -2707,19 +2777,19 @@ msgstr "" "Pickling:``__reduce__``、``__reduce_ex__``、``__getinitargs__``、" "``__getnewargs__``、``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2097 +#: ../../library/unittest.mock.rst:2120 msgid "File system path representation: ``__fspath__``" msgstr "檔案系統路徑表示法:``__fspath__``" -#: ../../library/unittest.mock.rst:2098 +#: ../../library/unittest.mock.rst:2121 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" msgstr "非同步疊代方法:``__aiter__`` 和 ``__anext__``" -#: ../../library/unittest.mock.rst:2100 +#: ../../library/unittest.mock.rst:2123 msgid "Added support for :func:`os.PathLike.__fspath__`." msgstr "新增對於 :func:`os.PathLike.__fspath__` 的支援。" -#: ../../library/unittest.mock.rst:2103 +#: ../../library/unittest.mock.rst:2126 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." @@ -2727,7 +2797,7 @@ msgstr "" "新增對於 ``__aenter__``、``__aexit__``、``__aiter__`` 和 ``__anext__`` 的支" "援。" -#: ../../library/unittest.mock.rst:2107 +#: ../../library/unittest.mock.rst:2130 msgid "" "The following methods exist but are *not* supported as they are either in " "use by mock, can't be set dynamically, or can cause problems:" @@ -2735,29 +2805,29 @@ msgstr "" "以下方法存在,但「不」被支援,因為它們在被 mock 使用時,會無法動態設定,或可" "能導致問題:" -#: ../../library/unittest.mock.rst:2110 +#: ../../library/unittest.mock.rst:2133 msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "``__getattr__``、``__setattr__``、``__init__`` 和 ``__new__``" -#: ../../library/unittest.mock.rst:2111 +#: ../../library/unittest.mock.rst:2134 msgid "" "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" "``__prepare__``、``__instancecheck__``、``__subclasscheck__``、``__del__``" -#: ../../library/unittest.mock.rst:2116 +#: ../../library/unittest.mock.rst:2139 msgid "Magic Mock" msgstr "Magic Mock" -#: ../../library/unittest.mock.rst:2118 +#: ../../library/unittest.mock.rst:2141 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" -"`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` " +"and :class:`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" -"`NonCallableMagicMock`。" +"``MagicMock`` 有兩個變體::class:`MagicMock` " +"和 :class:`NonCallableMagicMock`。" -#: ../../library/unittest.mock.rst:2123 +#: ../../library/unittest.mock.rst:2146 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " @@ -2766,11 +2836,11 @@ msgstr "" "``MagicMock`` 是 :class:`Mock` 的子類別,其預設具有大多數\\ :term:`魔術方法 " "`\\ 的實作。你可以使用 ``MagicMock``,而無需自行配置魔術方法。" -#: ../../library/unittest.mock.rst:2127 +#: ../../library/unittest.mock.rst:2150 msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "建構函式參數的意義與 :class:`Mock` 中的參數相同。" -#: ../../library/unittest.mock.rst:2129 +#: ../../library/unittest.mock.rst:2152 msgid "" "If you use the *spec* or *spec_set* arguments then *only* magic methods that " "exist in the spec will be created." @@ -2778,11 +2848,11 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 引數,那麼\\ *只有*\\ 規格中存在的魔術方法會" "被建立。" -#: ../../library/unittest.mock.rst:2135 +#: ../../library/unittest.mock.rst:2158 msgid "A non-callable version of :class:`MagicMock`." msgstr ":class:`MagicMock` 的不可呼叫版本。" -#: ../../library/unittest.mock.rst:2137 +#: ../../library/unittest.mock.rst:2160 msgid "" "The constructor parameters have the same meaning as for :class:`MagicMock`, " "with the exception of *return_value* and *side_effect* which have no meaning " @@ -2791,7 +2861,7 @@ msgstr "" "建構函式參數的意義與 :class:`MagicMock` 中的參數相同,但 *return_value* 和 " "*side_effect* 除外,它們對不可呼叫的 mock 來說沒有任何意義。" -#: ../../library/unittest.mock.rst:2141 +#: ../../library/unittest.mock.rst:2164 msgid "" "The magic methods are setup with :class:`MagicMock` objects, so you can " "configure them and use them in the usual way:" @@ -2799,7 +2869,7 @@ msgstr "" "魔術方法是使用 :class:`MagicMock` 物件設定的,因此你可以配置它們並以一般的方" "法來使用它們:" -#: ../../library/unittest.mock.rst:2151 +#: ../../library/unittest.mock.rst:2174 msgid "" "By default many of the protocol methods are required to return objects of a " "specific type. These methods are preconfigured with a default return value, " @@ -2811,94 +2881,94 @@ msgstr "" "值,因此如果你對回傳值不感興趣,則無需執行任何操作即可使用它們。如果你想更改" "預設值,你仍然可以手動\\ *設定*\\ 回傳值。" -#: ../../library/unittest.mock.rst:2157 +#: ../../library/unittest.mock.rst:2180 msgid "Methods and their defaults:" msgstr "方法及其預設值:" -#: ../../library/unittest.mock.rst:2159 +#: ../../library/unittest.mock.rst:2182 msgid "``__lt__``: :data:`NotImplemented`" msgstr "``__lt__``::data:`NotImplemented`" -#: ../../library/unittest.mock.rst:2160 +#: ../../library/unittest.mock.rst:2183 msgid "``__gt__``: :data:`!NotImplemented`" msgstr "``__gt__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2161 +#: ../../library/unittest.mock.rst:2184 msgid "``__le__``: :data:`!NotImplemented`" msgstr "``__le__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2162 +#: ../../library/unittest.mock.rst:2185 msgid "``__ge__``: :data:`!NotImplemented`" msgstr "``__ge__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2163 +#: ../../library/unittest.mock.rst:2186 msgid "``__int__``: ``1``" msgstr "``__int__``:``1``" -#: ../../library/unittest.mock.rst:2164 +#: ../../library/unittest.mock.rst:2187 msgid "``__contains__``: ``False``" msgstr "``__contains__``:``False``" -#: ../../library/unittest.mock.rst:2165 +#: ../../library/unittest.mock.rst:2188 msgid "``__len__``: ``0``" msgstr "``__len__``:``0``" -#: ../../library/unittest.mock.rst:2166 +#: ../../library/unittest.mock.rst:2189 msgid "``__iter__``: ``iter([])``" msgstr "``__iter__``:``iter([])``" -#: ../../library/unittest.mock.rst:2167 +#: ../../library/unittest.mock.rst:2190 msgid "``__exit__``: ``False``" msgstr "``__exit__``:``False``" -#: ../../library/unittest.mock.rst:2168 +#: ../../library/unittest.mock.rst:2191 msgid "``__aexit__``: ``False``" msgstr "``__aexit__``:``False``" -#: ../../library/unittest.mock.rst:2169 +#: ../../library/unittest.mock.rst:2192 msgid "``__complex__``: ``1j``" msgstr "``__complex__``:``1j``" -#: ../../library/unittest.mock.rst:2170 +#: ../../library/unittest.mock.rst:2193 msgid "``__float__``: ``1.0``" msgstr "``__float__``:``1.0``" -#: ../../library/unittest.mock.rst:2171 +#: ../../library/unittest.mock.rst:2194 msgid "``__bool__``: ``True``" msgstr "``__bool__``:``True``" -#: ../../library/unittest.mock.rst:2172 +#: ../../library/unittest.mock.rst:2195 msgid "``__index__``: ``1``" msgstr "``__index__``:``1``" -#: ../../library/unittest.mock.rst:2173 +#: ../../library/unittest.mock.rst:2196 msgid "``__hash__``: default hash for the mock" msgstr "``__hash__``:mock 的預設雜湊" -#: ../../library/unittest.mock.rst:2174 +#: ../../library/unittest.mock.rst:2197 msgid "``__str__``: default str for the mock" msgstr "``__str__``:mock 的預設字串" -#: ../../library/unittest.mock.rst:2175 +#: ../../library/unittest.mock.rst:2198 msgid "``__sizeof__``: default sizeof for the mock" msgstr "``__sizeof__``:mock 的預設 sizeof" -#: ../../library/unittest.mock.rst:2177 +#: ../../library/unittest.mock.rst:2200 msgid "For example:" msgstr "舉例來說:" -#: ../../library/unittest.mock.rst:2189 +#: ../../library/unittest.mock.rst:2212 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " -"They do the default equality comparison on identity, using the :attr:`~Mock." -"side_effect` attribute, unless you change their return value to return " -"something else::" +"They do the default equality comparison on identity, using " +"the :attr:`~Mock.side_effect` attribute, unless you change their return " +"value to return something else::" msgstr "" -":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使用 :attr:" -"`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" -"們的回傳值以回傳其他內容: ::" +":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使" +"用 :attr:`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非" +"你變更它們的回傳值以回傳其他內容: ::" -#: ../../library/unittest.mock.rst:2194 +#: ../../library/unittest.mock.rst:2217 msgid "" ">>> MagicMock() == 3\n" "False\n" @@ -2918,14 +2988,14 @@ msgstr "" ">>> mock == 3\n" "True" -#: ../../library/unittest.mock.rst:2203 +#: ../../library/unittest.mock.rst:2226 msgid "" "The return value of :meth:`MagicMock.__iter__` can be any iterable object " "and isn't required to be an iterator:" msgstr "" ":meth:`MagicMock.__iter__` 的回傳值可以是任何可疊代物件,且不需是一個疊代器:" -#: ../../library/unittest.mock.rst:2213 +#: ../../library/unittest.mock.rst:2236 msgid "" "If the return value *is* an iterator, then iterating over it once will " "consume it and subsequent iterations will result in an empty list:" @@ -2933,7 +3003,7 @@ msgstr "" "如果回傳值\\ *是*\\ 一個疊代器,那麼對其進行一次疊代將消耗它,並且後續疊代將" "產生一個空串列:" -#: ../../library/unittest.mock.rst:2222 +#: ../../library/unittest.mock.rst:2245 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " @@ -2942,33 +3012,33 @@ msgstr "" "``MagicMock`` 配置了所有支援的魔術方法,除了一些少見和過時的方法。如果你想" "要,你仍然可以設定這些魔術方法。" -#: ../../library/unittest.mock.rst:2225 +#: ../../library/unittest.mock.rst:2248 msgid "" "Magic methods that are supported but not setup by default in ``MagicMock`` " "are:" msgstr "``MagicMock`` 中支援但預設未設置的魔術方法包含:" -#: ../../library/unittest.mock.rst:2227 +#: ../../library/unittest.mock.rst:2250 msgid "``__subclasses__``" msgstr "``__subclasses__``" -#: ../../library/unittest.mock.rst:2228 +#: ../../library/unittest.mock.rst:2251 msgid "``__dir__``" msgstr "``__dir__``" -#: ../../library/unittest.mock.rst:2229 +#: ../../library/unittest.mock.rst:2252 msgid "``__format__``" msgstr "``__format__``" -#: ../../library/unittest.mock.rst:2230 +#: ../../library/unittest.mock.rst:2253 msgid "``__get__``, ``__set__`` and ``__delete__``" msgstr "``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2231 +#: ../../library/unittest.mock.rst:2254 msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` 和 ``__missing__``" -#: ../../library/unittest.mock.rst:2232 +#: ../../library/unittest.mock.rst:2255 msgid "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__`` and ``__setstate__``" @@ -2976,11 +3046,11 @@ msgstr "" "``__reduce__``、``__reduce_ex__``、``__getinitargs__``、``__getnewargs__``、" "``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2234 +#: ../../library/unittest.mock.rst:2257 msgid "``__getformat__``" msgstr "``__getformat__``" -#: ../../library/unittest.mock.rst:2238 +#: ../../library/unittest.mock.rst:2261 msgid "" "Magic methods *should* be looked up on the class rather than the instance. " "Different versions of Python are inconsistent about applying this rule. The " @@ -2989,27 +3059,27 @@ msgstr "" "魔術方法\\ *應該*\\ 在類別而不是實例上被查找。不同版本的 Python 對於這條規則" "的適用並不一致。支援的協定方法應適用於所有支援的 Python 版本。" -#: ../../library/unittest.mock.rst:2242 +#: ../../library/unittest.mock.rst:2265 msgid "" "The function is basically hooked up to the class, but each ``Mock`` instance " "is kept isolated from the others." msgstr "該函式基本上與類別掛鉤,但每個 ``Mock`` 實例都與其他實例保持隔離。" -#: ../../library/unittest.mock.rst:2247 +#: ../../library/unittest.mock.rst:2270 msgid "Helpers" msgstr "輔助函式" -#: ../../library/unittest.mock.rst:2250 +#: ../../library/unittest.mock.rst:2273 msgid "sentinel" msgstr "sentinel(哨兵)" -#: ../../library/unittest.mock.rst:2254 +#: ../../library/unittest.mock.rst:2277 msgid "" "The ``sentinel`` object provides a convenient way of providing unique " "objects for your tests." msgstr "``哨兵``\\ 物件提供了一種為你的測試提供獨特物件的便利方式。" -#: ../../library/unittest.mock.rst:2257 +#: ../../library/unittest.mock.rst:2280 msgid "" "Attributes are created on demand when you access them by name. Accessing the " "same attribute will always return the same object. The objects returned have " @@ -3018,15 +3088,15 @@ msgstr "" "當你使用名稱存取屬性時,屬性會根據需要被建立。存取相同的屬性將始終回傳相同的" "物件。回傳的物件會具有合適的 repr,讓測試失敗的訊息是可閱讀的。" -#: ../../library/unittest.mock.rst:2261 +#: ../../library/unittest.mock.rst:2284 msgid "" -"The ``sentinel`` attributes now preserve their identity when they are :mod:" -"`copied ` or :mod:`pickled `." +"The ``sentinel`` attributes now preserve their identity when they " +"are :mod:`copied ` or :mod:`pickled `." msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" -#: ../../library/unittest.mock.rst:2265 +#: ../../library/unittest.mock.rst:2288 msgid "" "Sometimes when testing you need to test that a specific object is passed as " "an argument to another method, or returned. It can be common to create named " @@ -3037,44 +3107,43 @@ msgstr "" "名的哨兵物件來測試這一點是常見的。:data:`sentinel` 提供了一種此類建立和測試物" "件識別性的便利方式。" -#: ../../library/unittest.mock.rst:2270 +#: ../../library/unittest.mock.rst:2293 msgid "" -"In this example we monkey patch ``method`` to return ``sentinel." -"some_object``:" +"In this example we monkey patch ``method`` to return " +"``sentinel.some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" -#: ../../library/unittest.mock.rst:2282 +#: ../../library/unittest.mock.rst:2305 msgid "DEFAULT" msgstr "DEFAULT" -#: ../../library/unittest.mock.rst:2287 +#: ../../library/unittest.mock.rst:2310 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." -"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " -"indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually " +"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " +"to indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 ``sentinel." -"DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" -"應該被使用。" +":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 " +"``sentinel.DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示" +"正常的回傳值應該被使用。" -#: ../../library/unittest.mock.rst:2293 +#: ../../library/unittest.mock.rst:2316 msgid "call" msgstr "call" -#: ../../library/unittest.mock.rst:2297 +#: ../../library/unittest.mock.rst:2320 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." -"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " +"and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock." -"mock_calls` 和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更" -"簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" -"起使用。" +"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock.mock_calls` " +"和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更簡單的斷言的" +"輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一起使用。" -#: ../../library/unittest.mock.rst:2310 +#: ../../library/unittest.mock.rst:2333 msgid "" "For a call object that represents multiple calls, :meth:`call_list` returns " "a list of all the intermediate calls as well as the final call." @@ -3082,7 +3151,7 @@ msgstr "" "對於表示多個呼叫的 call 物件,:meth:`call_list` 回傳所有中間呼叫以及最終呼叫" "的串列。" -#: ../../library/unittest.mock.rst:2314 +#: ../../library/unittest.mock.rst:2337 msgid "" "``call_list`` is particularly useful for making assertions on \"chained " "calls\". A chained call is multiple calls on a single line of code. This " @@ -3093,39 +3162,41 @@ msgstr "" "在單行程式碼進行的多次呼叫。這會導致 mock 上的 :attr:`~Mock.mock_calls` 中出" "現多個項目。手動建構呼叫序列會相當單調乏味。" -#: ../../library/unittest.mock.rst:2319 +#: ../../library/unittest.mock.rst:2342 msgid "" ":meth:`~call.call_list` can construct the sequence of calls from the same " "chained call:" msgstr ":meth:`~call.call_list` 可以從同一個鍊接呼叫建構呼叫序列:" -#: ../../library/unittest.mock.rst:2336 +#: ../../library/unittest.mock.rst:2359 msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." -"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " -"to get at the individual arguments they contain." +"the ``call`` objects that are in " +"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " +"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " +"individual arguments they contain." msgstr "" "取決於它的建構方式,一個 ``call`` 物件會是(位置引數, 關鍵字引數)的元組,或" "是 (名稱, 位置引數, 關鍵字引數) 的元組。當你自己建構它們時,這並不是那麼有" -"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." -"mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" +"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` " +"和 :attr:`Mock.mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各" +"個引數。" -#: ../../library/unittest.mock.rst:2343 +#: ../../library/unittest.mock.rst:2366 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." -"call_args_list` are two-tuples of (positional args, keyword args) whereas " -"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " -"construct yourself, are three-tuples of (name, positional args, keyword " -"args)." +"The ``call`` objects in :attr:`Mock.call_args` " +"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " +"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " +"ones you construct yourself, are three-tuples of (name, positional args, " +"keyword args)." msgstr "" ":attr:`Mock.call_args` 和 :attr:`Mock.call_args_list` 中的 ``call`` 物件是" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" "件以及你自己建立的 ``call`` 物件是(名稱, 位置引數, 關鍵字引數)的三元組。" -#: ../../library/unittest.mock.rst:2348 +#: ../../library/unittest.mock.rst:2371 msgid "" "You can use their \"tupleness\" to pull out the individual arguments for " "more complex introspection and assertions. The positional arguments are a " @@ -3135,11 +3206,11 @@ msgstr "" "你可以利用它們作為元組的特性來提取單個引數,以進行更複雜的內省和斷言。位置引" "數是一個元組(如果沒有位置引數則為空元組),關鍵字引數是一個字典:" -#: ../../library/unittest.mock.rst:2381 +#: ../../library/unittest.mock.rst:2404 msgid "create_autospec" msgstr "create_autospec" -#: ../../library/unittest.mock.rst:2385 +#: ../../library/unittest.mock.rst:2408 msgid "" "Create a mock object using another object as a spec. Attributes on the mock " "will use the corresponding attribute on the *spec* object as their spec." @@ -3147,21 +3218,21 @@ msgstr "" "使用另一個物件作為規格建立一個 mock 物件。Mock 上的屬性將使用 *spec* 物件上的" "對應屬性作為其規格。" -#: ../../library/unittest.mock.rst:2389 +#: ../../library/unittest.mock.rst:2412 msgid "" "Functions or methods being mocked will have their arguments checked to " "ensure that they are called with the correct signature." msgstr "被 mock 的函式或方法將檢查其引數,以確保他們被使用正確的簽名來呼叫。" -#: ../../library/unittest.mock.rst:2392 +#: ../../library/unittest.mock.rst:2415 msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" -"`AttributeError`。" +"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引" +"發 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2395 +#: ../../library/unittest.mock.rst:2418 msgid "" "If a class is used as a spec then the return value of the mock (the instance " "of the class) will have the same spec. You can use a class as the spec for " @@ -3172,7 +3243,7 @@ msgstr "" "可以透過傳遞 ``instance=True`` 來使用一個類別作為一個實例物件的規格。只有當 " "mock 的實例是可呼叫物件時,回傳的 mock 才會是可呼叫物件。" -#: ../../library/unittest.mock.rst:2400 +#: ../../library/unittest.mock.rst:2423 msgid "" ":func:`create_autospec` also takes arbitrary keyword arguments that are " "passed to the constructor of the created mock." @@ -3180,27 +3251,27 @@ msgstr "" ":func:`create_autospec` 也接受任意的關鍵字引數,這些引數會傳遞給已建立的 " "mock 的建構函式。" -#: ../../library/unittest.mock.rst:2403 +#: ../../library/unittest.mock.rst:2426 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" -"`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing " +"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" -#: ../../library/unittest.mock.rst:2409 +#: ../../library/unittest.mock.rst:2432 msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" -"`AsyncMock`。" +"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一" +"個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:2414 +#: ../../library/unittest.mock.rst:2437 msgid "ANY" msgstr "ANY" -#: ../../library/unittest.mock.rst:2418 +#: ../../library/unittest.mock.rst:2441 msgid "" "Sometimes you may need to make assertions about *some* of the arguments in a " "call to mock, but either not care about some of the arguments or want to " @@ -3210,30 +3281,31 @@ msgstr "" "有時你可能需要對 mock 的呼叫中的\\ *某些*\\ 引數進行斷言,但你不在意其他的某" "些引數,或想將它們單獨從 :attr:`~Mock.call_args` 中取出並進行更加複雜的斷言。" -#: ../../library/unittest.mock.rst:2423 +#: ../../library/unittest.mock.rst:2446 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." -"assert_called_once_with` will then succeed no matter what was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` " +"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " +"was passed in." msgstr "" "要忽略某些引數,你可以傳入對\\ *所有物件*\\ 來說都相等的物件。那麼無論傳入什" -"麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." -"assert_used_once_with` 的呼叫都會成功。" +"麼內容,對 :meth:`~Mock.assert_used_with` " +"和 :meth:`~Mock.assert_used_once_with` 的呼叫都會成功。" -#: ../../library/unittest.mock.rst:2432 +#: ../../library/unittest.mock.rst:2455 msgid "" -":data:`ANY` can also be used in comparisons with call lists like :attr:" -"`~Mock.mock_calls`:" +":data:`ANY` can also be used in comparisons with call lists " +"like :attr:`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" -#: ../../library/unittest.mock.rst:2442 +#: ../../library/unittest.mock.rst:2465 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr ":data:`ANY` 不只能與呼叫物件比較,其也可以在測試斷言中使用: ::" -#: ../../library/unittest.mock.rst:2445 +#: ../../library/unittest.mock.rst:2468 msgid "" "class TestStringMethods(unittest.TestCase):\n" "\n" @@ -3247,24 +3319,24 @@ msgstr "" " s = 'hello world'\n" " self.assertEqual(s.split(), ['hello', ANY])" -#: ../../library/unittest.mock.rst:2453 +#: ../../library/unittest.mock.rst:2476 msgid "FILTER_DIR" msgstr "FILTER_DIR" -#: ../../library/unittest.mock.rst:2457 +#: ../../library/unittest.mock.rst:2480 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set ``mock." -"FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set " +"``mock.FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` 是一個模組級別的變數,用於控制 mock 物件回應 :func:`dir` " "的方式。其預設值為 ``True``,它使用以下描述的過濾方式來只顯示有用的成員。如果" "你不喜歡這個過濾方式,或由於診斷意圖而需要將其關閉,請設定 ``mock.FILTER_DIR " "= False``。" -#: ../../library/unittest.mock.rst:2463 +#: ../../library/unittest.mock.rst:2486 msgid "" "With filtering on, ``dir(some_mock)`` shows only useful attributes and will " "include any dynamically created attributes that wouldn't normally be shown. " @@ -3276,7 +3348,7 @@ msgstr "" "的任何動態建立的屬性。如果 mock 是使用 *spec*\\ (或 *autospec*\\ )來建立" "的,那麼源頭的所有屬性都會顯示,即使它們尚未被存取:" -#: ../../library/unittest.mock.rst:2469 +#: ../../library/unittest.mock.rst:2492 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3314,7 +3386,7 @@ msgstr "" " 'BaseHandler',\n" " ..." -#: ../../library/unittest.mock.rst:2490 +#: ../../library/unittest.mock.rst:2513 msgid "" "Many of the not-very-useful (private to :class:`Mock` rather than the thing " "being mocked) underscore and double underscore prefixed attributes have been " @@ -3326,7 +3398,7 @@ msgstr "" "雙底線前綴屬性已從在 :class:`Mock` 上呼叫 :func:`dir` 的結果中濾除。如果你不" "喜歡這種特性,可以透過設定模組級別開關 :data:`FILTER_DIR` 來將其關閉:" -#: ../../library/unittest.mock.rst:2496 +#: ../../library/unittest.mock.rst:2519 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3352,21 +3424,21 @@ msgstr "" " '__class__',\n" " ..." -#: ../../library/unittest.mock.rst:2511 +#: ../../library/unittest.mock.rst:2534 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " "of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" -"`FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考" +"慮 :const:`FILTER_DIR`。" -#: ../../library/unittest.mock.rst:2517 +#: ../../library/unittest.mock.rst:2540 msgid "mock_open" msgstr "mock_open" -#: ../../library/unittest.mock.rst:2521 +#: ../../library/unittest.mock.rst:2544 msgid "" "A helper function to create a mock to replace the use of :func:`open`. It " "works for :func:`open` called directly or used as a context manager." @@ -3374,7 +3446,7 @@ msgstr "" "用於建立取代 :func:`open` 用途的 mock 的輔助函式。它適用於直接呼叫或用作情境" "管理器的 :func:`open`。" -#: ../../library/unittest.mock.rst:2524 +#: ../../library/unittest.mock.rst:2547 msgid "" "The *mock* argument is the mock object to configure. If ``None`` (the " "default) then a :class:`MagicMock` will be created for you, with the API " @@ -3383,41 +3455,43 @@ msgstr "" "*mock* 引數是要配置的 mock 物件。如果其為 ``None``\\ (預設值),那麼就會為你" "建立一個 :class:`MagicMock`,其 API 限制在標準檔案處理上可用的方法或屬性。" -#: ../../library/unittest.mock.rst:2528 -msgid "" -"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." -"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " -"handle to return. Calls to those methods will take data from *read_data* " -"until it is depleted. The mock of these methods is pretty simplistic: every " -"time the *mock* is called, the *read_data* is rewound to the start. If you " -"need more control over the data that you are feeding to the tested code you " -"will need to customize this mock for yourself. When that is insufficient, " -"one of the in-memory filesystem packages on `PyPI `_ can " -"offer a realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." -"readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " -"*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " -"*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" -"更多控制,你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" -"試的真實檔案系統。" - -#: ../../library/unittest.mock.rst:2538 +#: ../../library/unittest.mock.rst:2551 +msgid "" +"*read_data* is a string for " +"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " +"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " +"Calls to those methods will take data from *read_data* until it is " +"depleted. The mock of these methods is pretty simplistic: every time the " +"*mock* is called, the *read_data* is rewound to the start. If you need more " +"control over the data that you are feeding to the tested code you will need " +"to customize this mock for yourself. When that is insufficient, one of the " +"in-memory filesystem packages on `PyPI `_ can offer a " +"realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方" +"法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase.readline` " +"和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 *read_data* " +"取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 *mock* 時," +"*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行更多控制," +"你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的" +"其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測試的真實檔" +"案系統。" + +#: ../../library/unittest.mock.rst:2561 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" -"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" -"傳它。" +"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支" +"援。:meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼" +"叫時回傳它。" -#: ../../library/unittest.mock.rst:2543 +#: ../../library/unittest.mock.rst:2566 msgid "*read_data* is now reset on each call to the *mock*." msgstr "現在,每次呼叫 *mock* 時都會重置 *read_data*。" -#: ../../library/unittest.mock.rst:2546 +#: ../../library/unittest.mock.rst:2569 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." @@ -3425,7 +3499,7 @@ msgstr "" "新增 :meth:`~container.__iter__` 到實作中,以便使疊代(例如在 for 迴圈中)正" "確地消耗 *read_data*。" -#: ../../library/unittest.mock.rst:2550 +#: ../../library/unittest.mock.rst:2573 msgid "" "Using :func:`open` as a context manager is a great way to ensure your file " "handles are closed properly and is becoming common::" @@ -3433,7 +3507,7 @@ msgstr "" "使用 :func:`open` 作為情境管理器是確保檔案處理正確關閉的好方式,且這種方式正" "在變得普遍: ::" -#: ../../library/unittest.mock.rst:2553 +#: ../../library/unittest.mock.rst:2576 msgid "" "with open('/some/path', 'w') as f:\n" " f.write('something')" @@ -3441,17 +3515,17 @@ msgstr "" "with open('/some/path', 'w') as f:\n" " f.write('something')" -#: ../../library/unittest.mock.rst:2556 +#: ../../library/unittest.mock.rst:2579 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and has :meth:`~object." -"__enter__` and :meth:`~object.__exit__` called)." +"*returned object* that is used as a context manager (and " +"has :meth:`~object.__enter__` and :meth:`~object.__exit__` called)." msgstr "" "問題是,即使你 mock 了對 :func:`open` 的呼叫,它也是作為情境管理器使用的\\ *" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" "被呼叫)。" -#: ../../library/unittest.mock.rst:2560 +#: ../../library/unittest.mock.rst:2583 msgid "" "Mocking context managers with a :class:`MagicMock` is common enough and " "fiddly enough that a helper function is useful. ::" @@ -3459,7 +3533,7 @@ msgstr "" "使用 :class:`MagicMock` mock 情境管理器相當常見並且精細,因此輔助函式就非常有" "用: ::" -#: ../../library/unittest.mock.rst:2563 +#: ../../library/unittest.mock.rst:2586 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3489,11 +3563,11 @@ msgstr "" ">>> handle = m()\n" ">>> handle.write.assert_called_once_with('some stuff')" -#: ../../library/unittest.mock.rst:2577 +#: ../../library/unittest.mock.rst:2600 msgid "And for reading files::" msgstr "以及讀取檔案: ::" -#: ../../library/unittest.mock.rst:2579 +#: ../../library/unittest.mock.rst:2602 msgid "" ">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" "... with open('foo') as h:\n" @@ -3509,29 +3583,29 @@ msgstr "" ">>> m.assert_called_once_with('foo')\n" ">>> assert result == 'bibble'" -#: ../../library/unittest.mock.rst:2590 +#: ../../library/unittest.mock.rst:2613 msgid "Autospeccing" msgstr "Autospeccing(自動規格)" -#: ../../library/unittest.mock.rst:2592 +#: ../../library/unittest.mock.rst:2615 msgid "" "Autospeccing is based on the existing :attr:`!spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise a :exc:" -"`TypeError` if they are called incorrectly." +"methods have the same call signature as the original so they raise " +"a :exc:`TypeError` if they are called incorrectly." msgstr "" "自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" "始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" "具有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相" "同的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" -#: ../../library/unittest.mock.rst:2599 +#: ../../library/unittest.mock.rst:2622 msgid "Before I explain how auto-speccing works, here's why it is needed." msgstr "在解釋自動規格如何運作之前,我們先解釋為什麼需要它。" -#: ../../library/unittest.mock.rst:2601 +#: ../../library/unittest.mock.rst:2624 msgid "" ":class:`Mock` is a very powerful and flexible object, but it suffers from a " "flaw which is general to mocking. If you refactor some of your code, rename " @@ -3544,7 +3618,7 @@ msgstr "" "實物件的程式碼測試仍然會通過。這意味著即使你的程式碼壞了,但測試仍可以全部通" "過。" -#: ../../library/unittest.mock.rst:2609 +#: ../../library/unittest.mock.rst:2632 msgid "" "Before 3.5, tests with a typo in the word assert would silently pass when " "they should raise an error. You can still achieve this behavior by passing " @@ -3553,7 +3627,7 @@ msgstr "" "在 3.5 之前,當測試應該引發錯誤時,斷言單字中存在拼字錯誤的測驗會默默地通過。" "你仍可以透過將 ``unsafe=True`` 傳遞給 Mock 來實作此行為。" -#: ../../library/unittest.mock.rst:2612 +#: ../../library/unittest.mock.rst:2635 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " @@ -3563,7 +3637,7 @@ msgstr "" "謹記這是你需要有整合測試和單元測試的另一個原因。單獨測試所有內容都很好,但如" "果你不測試你的單元是如何「連接在一起」的,那麼測試還是有機會發現很多錯誤。" -#: ../../library/unittest.mock.rst:2617 +#: ../../library/unittest.mock.rst:2640 msgid "" ":mod:`unittest.mock` already provides a feature to help with this, called " "speccing. If you use a class or instance as the :attr:`!spec` for a mock " @@ -3573,13 +3647,13 @@ msgstr "" "如果你使用類別或實例作為 mock 的 :attr:`!spec`,那麼你在 mock 上只能存取真實" "類別中存在的屬性:" -#: ../../library/unittest.mock.rst:2628 +#: ../../library/unittest.mock.rst:2651 msgid "" "The spec only applies to the mock itself, so we still have the same issue " "with any methods on the mock:" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" -#: ../../library/unittest.mock.rst:2631 +#: ../../library/unittest.mock.rst:2654 msgid "" ">>> mock.has_data()\n" "\n" @@ -3589,10 +3663,10 @@ msgstr "" "\n" ">>> mock.has_data.assret_called_with() # 故意的錯字!" -#: ../../library/unittest.mock.rst:2637 +#: ../../library/unittest.mock.rst:2660 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" -"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` " +"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3600,18 +3674,18 @@ msgid "" "complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" -"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞給 :func:`patch` / :" -"func:`patch.object` 或使用 :func:`create_autospec` 函式建立帶有規格的 mock。" -"如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取代的物件將作為規格" -"物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時作為屬性被建立" -"的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" -"使用,而不會過於影響性能。" +"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞" +"給 :func:`patch` / :func:`patch.object` 或使用 :func:`create_autospec` 函式建" +"立帶有規格的 mock。如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取" +"代的物件將作為規格物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時" +"作為屬性被建立的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引" +"用的模組)一起使用,而不會過於影響性能。" -#: ../../library/unittest.mock.rst:2646 +#: ../../library/unittest.mock.rst:2669 msgid "Here's an example of it in use::" msgstr "這是一個正在使用的例子: ::" -#: ../../library/unittest.mock.rst:2648 +#: ../../library/unittest.mock.rst:2671 msgid "" ">>> from urllib import request\n" ">>> patcher = patch('__main__.request', autospec=True)\n" @@ -3629,17 +3703,17 @@ msgstr "" ">>> mock_request.Request\n" "" -#: ../../library/unittest.mock.rst:2656 +#: ../../library/unittest.mock.rst:2679 msgid "" -"You can see that :class:`!request.Request` has a spec. :class:`!request." -"Request` takes two arguments in the constructor (one of which is *self*). " -"Here's what happens if we try to call it incorrectly::" +"You can see that :class:`!request.Request` has a spec. :class:`!" +"request.Request` takes two arguments in the constructor (one of which is " +"*self*). Here's what happens if we try to call it incorrectly::" msgstr "" "你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" "建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" "以下情況: ::" -#: ../../library/unittest.mock.rst:2660 +#: ../../library/unittest.mock.rst:2683 msgid "" ">>> req = request.Request()\n" "Traceback (most recent call last):\n" @@ -3651,13 +3725,13 @@ msgstr "" " ...\n" "TypeError: () takes at least 2 arguments (1 given)" -#: ../../library/unittest.mock.rst:2665 +#: ../../library/unittest.mock.rst:2688 msgid "" "The spec also applies to instantiated classes (i.e. the return value of " "specced mocks)::" msgstr "此規格也適用於實例化的類別(即有規格的 mock 的回傳值): ::" -#: ../../library/unittest.mock.rst:2668 +#: ../../library/unittest.mock.rst:2691 msgid "" ">>> req = request.Request('foo')\n" ">>> req\n" @@ -3667,7 +3741,7 @@ msgstr "" ">>> req\n" "" -#: ../../library/unittest.mock.rst:2672 +#: ../../library/unittest.mock.rst:2695 msgid "" ":class:`!Request` objects are not callable, so the return value of " "instantiating our mocked out :class:`!request.Request` is a non-callable " @@ -3678,7 +3752,7 @@ msgstr "" "request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" "都會引發正確的錯誤: ::" -#: ../../library/unittest.mock.rst:2676 +#: ../../library/unittest.mock.rst:2699 msgid "" ">>> req.add_header('spam', 'eggs')\n" "\n" @@ -3696,7 +3770,7 @@ msgstr "" "AttributeError: Mock object has no attribute 'assret_called_with'\n" ">>> req.add_header.assert_called_with('spam', 'eggs')" -#: ../../library/unittest.mock.rst:2684 +#: ../../library/unittest.mock.rst:2707 msgid "" "In many cases you will just be able to add ``autospec=True`` to your " "existing :func:`patch` calls and then be protected against bugs due to typos " @@ -3705,15 +3779,15 @@ msgstr "" "在許多情況下,你只需要將 ``autospec=True`` 新增至現有的 :func:`patch` 呼叫" "中,然後就可以防止因拼字錯誤和 api 變更而導致的錯誤。" -#: ../../library/unittest.mock.rst:2688 +#: ../../library/unittest.mock.rst:2711 msgid "" -"As well as using *autospec* through :func:`patch` there is a :func:" -"`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is " +"a :func:`create_autospec` for creating autospecced mocks directly:" msgstr "" -"除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" -"`create_autospec` 用於直接建立有自動規格的 mock:" +"除了透過 :func:`patch` 使用 *autospec* 之外,還有一" +"個 :func:`create_autospec` 用於直接建立有自動規格的 mock:" -#: ../../library/unittest.mock.rst:2696 +#: ../../library/unittest.mock.rst:2719 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -3730,7 +3804,7 @@ msgstr "" "描述器,那麼你可能無法使用 autospec。換句話說,設計你的物件讓內省是安全的 " "[#]_ 會比較好。" -#: ../../library/unittest.mock.rst:2705 +#: ../../library/unittest.mock.rst:2728 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " @@ -3741,7 +3815,7 @@ msgstr "" "而其根本不存在於類別中。*autospec* 無法知道任何動態建立的屬性,並將 api 限制" "為可見的屬性。: ::" -#: ../../library/unittest.mock.rst:2710 +#: ../../library/unittest.mock.rst:2733 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3767,7 +3841,7 @@ msgstr "" " ...\n" "AttributeError: Mock object has no attribute 'a'" -#: ../../library/unittest.mock.rst:2722 +#: ../../library/unittest.mock.rst:2745 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -3779,7 +3853,7 @@ msgstr "" "在 mock 上設定所需的屬性。因為雖然 *autospec* 不允許你取得規格中不存在的屬" "性,但是它不會阻止你設定它們: ::" -#: ../../library/unittest.mock.rst:2728 +#: ../../library/unittest.mock.rst:2751 msgid "" ">>> with patch('__main__.Something', autospec=True):\n" "... thing = Something()\n" @@ -3791,7 +3865,7 @@ msgstr "" "... thing.a = 33\n" "..." -#: ../../library/unittest.mock.rst:2733 +#: ../../library/unittest.mock.rst:2756 msgid "" "There is a more aggressive version of both *spec* and *autospec* that *does* " "prevent you setting non-existent attributes. This is useful if you want to " @@ -3802,7 +3876,7 @@ msgstr "" "屬性。如果你想確保你的程式碼僅能\\ *設定*\\ 有效的屬性,那麼這會很有用,但顯" "然它也順便阻止了這個特殊情況:" -#: ../../library/unittest.mock.rst:2746 +#: ../../library/unittest.mock.rst:2769 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -3814,7 +3888,7 @@ msgstr "" "的實例成員的預設值。請注意,如果你僅在 :meth:`!__init__` 中設定預設屬性,那麼" "透過類別屬性(當然在實例之間共用)提供它們也會更快。例如:" -#: ../../library/unittest.mock.rst:2752 +#: ../../library/unittest.mock.rst:2775 msgid "" "class Something:\n" " a = 33" @@ -3822,7 +3896,7 @@ msgstr "" "class Something:\n" " a = 33" -#: ../../library/unittest.mock.rst:2757 +#: ../../library/unittest.mock.rst:2780 msgid "" "This brings up another issue. It is relatively common to provide a default " "value of ``None`` for members that will later be an object of a different " @@ -3838,7 +3912,7 @@ msgstr "" "他型別的成員,因此自動規格不會對設定為 ``None`` 的成員使用規格。這些會只是普" "通的 mock(通常是 MagicMocks):" -#: ../../library/unittest.mock.rst:2772 +#: ../../library/unittest.mock.rst:2795 msgid "" "If modifying your production classes to add defaults isn't to your liking " "then there are more options. One of these is simply to use an instance as " @@ -3854,7 +3928,7 @@ msgstr "" "你使用替代物件作為規格。值得慶幸的是 :func:`patch` 支援這一點 - 你可以簡單地" "將替代物件作為 *autospec* 引數傳遞: ::" -#: ../../library/unittest.mock.rst:2780 +#: ../../library/unittest.mock.rst:2803 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3880,7 +3954,7 @@ msgstr "" ">>> mock.a\n" "" -#: ../../library/unittest.mock.rst:2793 +#: ../../library/unittest.mock.rst:2816 msgid "" "This only applies to classes or already instantiated objects. Calling a " "mocked class to create a mock instance *does not* create a real instance. It " @@ -3889,11 +3963,11 @@ msgstr "" "這只適用於類別或已經實例化的物件。呼叫一個被 mock 的類別來建立一個 mock 實例" "\\ *不會*\\ 建立真的實例。它僅查找屬性及對 :func:`dir` 的呼叫。" -#: ../../library/unittest.mock.rst:2798 +#: ../../library/unittest.mock.rst:2821 msgid "Sealing mocks" msgstr "密封 mock" -#: ../../library/unittest.mock.rst:2807 +#: ../../library/unittest.mock.rst:2830 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " @@ -3902,7 +3976,7 @@ msgstr "" "當存取被密封的 mock 的屬性或其任何已經遞迴 mock 的屬性時,seal 將停用 mock 的" "自動建立。" -#: ../../library/unittest.mock.rst:2810 +#: ../../library/unittest.mock.rst:2833 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " @@ -3911,7 +3985,7 @@ msgstr "" "如果將具有名稱或規格的 mock 實例指派給屬性,則不會出現在密封鏈中。這表示可藉" "由固定 mock 物件的一部分來防止密封。: ::" -#: ../../library/unittest.mock.rst:2814 +#: ../../library/unittest.mock.rst:2837 msgid "" ">>> mock = Mock()\n" ">>> mock.submock.attribute1 = 2\n" @@ -3929,52 +4003,52 @@ msgstr "" ">>> mock.submock.attribute2 # This will raise AttributeError.\n" ">>> mock.not_submock.attribute2 # This won't raise." -#: ../../library/unittest.mock.rst:2826 +#: ../../library/unittest.mock.rst:2849 msgid "" "Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and " "*wraps*" msgstr ":attr:`!side_effect`、:attr:`!return_value` 和 *wraps* 的優先順序" -#: ../../library/unittest.mock.rst:2828 +#: ../../library/unittest.mock.rst:2851 msgid "The order of their precedence is:" msgstr "它們的優先順序是:" -#: ../../library/unittest.mock.rst:2830 +#: ../../library/unittest.mock.rst:2853 msgid ":attr:`~Mock.side_effect`" msgstr ":attr:`~Mock.side_effect`" -#: ../../library/unittest.mock.rst:2831 +#: ../../library/unittest.mock.rst:2854 msgid ":attr:`~Mock.return_value`" msgstr ":attr:`~Mock.return_value`" -#: ../../library/unittest.mock.rst:2832 +#: ../../library/unittest.mock.rst:2855 msgid "*wraps*" msgstr "*wraps*" -#: ../../library/unittest.mock.rst:2834 +#: ../../library/unittest.mock.rst:2857 msgid "" -"If all three are set, mock will return the value from :attr:`~Mock." -"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " -"altogether. If any two are set, the one with the higher precedence will " -"return the value. Regardless of the order of which was set first, the order " -"of precedence remains unchanged." +"If all three are set, mock will return the value " +"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " +"wrapped object altogether. If any two are set, the one with the higher " +"precedence will return the value. Regardless of the order of which was set " +"first, the order of precedence remains unchanged." msgstr "" "如果這三個都有設定,mock 將會回傳來自 :attr:`~Mock.side_effect` 的值,並忽" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" "的一項將回傳該值。無論先設定哪個順序,優先順序都保持不變。" -#: ../../library/unittest.mock.rst:2852 +#: ../../library/unittest.mock.rst:2875 msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " -"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" -"`~Mock.side_effect`." +"between :attr:`~Mock.return_value` and the wrapped object, " +"ignoring :attr:`~Mock.side_effect`." msgstr "" "由於 ``None`` 是 :attr:`~Mock.side_effect` 的預設值,如果將其值重新賦值回為 " "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" "略 :attr:`~Mock.side_effect`。" -#: ../../library/unittest.mock.rst:2861 +#: ../../library/unittest.mock.rst:2884 msgid "" "If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " "it is ignored and the order of precedence moves to the successor to obtain " @@ -3983,21 +4057,21 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 回傳的值是 :data:`DEFAULT`,它將被忽略,並且優" "先順序被移動到後面一個以獲得要回傳的值。" -#: ../../library/unittest.mock.rst:2870 +#: ../../library/unittest.mock.rst:2893 msgid "" -"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." -"return_value` will be :data:`DEFAULT`." +"When :class:`Mock` wraps an object, the default value " +"of :attr:`~Mock.return_value` will be :data:`DEFAULT`." msgstr "" -"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" -"data:`DEFAULT`。" +"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將" +"為 :data:`DEFAULT`。" -#: ../../library/unittest.mock.rst:2879 +#: ../../library/unittest.mock.rst:2902 msgid "" "The order of precedence will ignore this value and it will move to the last " "successor which is the wrapped object." msgstr "優先順序將忽略該值,並將移動到最後一個,即被包裝物件。" -#: ../../library/unittest.mock.rst:2882 +#: ../../library/unittest.mock.rst:2905 msgid "" "As the real call is being made to the wrapped object, creating an instance " "of this mock will return the real instance of the class. The positional " @@ -4006,7 +4080,7 @@ msgstr "" "當對被包裝物件進行真正的呼叫時,建立此 mock 的實例將回傳該類別的真實實例。必" "須傳遞被包裝物件所需的位置引數(如果存在)。" -#: ../../library/unittest.mock.rst:2900 +#: ../../library/unittest.mock.rst:2923 msgid "" "But if you assign ``None`` to it, this will not be ignored as it is an " "explicit assignment. So, the order of precedence will not move to the " @@ -4015,13 +4089,13 @@ msgstr "" "但如果你為其賦予 ``None`` 則不會被忽略,因為它是明確賦值。因此,優先順序不會" "移至被包裝物件。" -#: ../../library/unittest.mock.rst:2908 +#: ../../library/unittest.mock.rst:2931 msgid "" "Even if you set all three at once when initializing the mock, the order of " "precedence remains the same:" msgstr "即使你在初始化 mock 時同時設定所有三個,優先順序也保持不變:" -#: ../../library/unittest.mock.rst:2925 +#: ../../library/unittest.mock.rst:2948 msgid "" "If :attr:`~Mock.side_effect` is exhausted, the order of precedence will not " "cause a value to be obtained from the successors. Instead, ``StopIteration`` " @@ -4029,3 +4103,21 @@ msgid "" msgstr "" "如果 :attr:`~Mock.side_effect` 已耗盡,則優先順序將不會使值由後面取得。相反地" "這會引發 ``StopIteration`` 例外。" + +#~ msgid "" +#~ "This can be useful where you want to make a series of assertions that " +#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear " +#~ "the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +#~ "have set using normal assignment by default. In case you want to " +#~ "reset :attr:`return_value` or :attr:`side_effect`, then pass the " +#~ "corresponding parameter as ``True``. Child mocks and the return value " +#~ "mock (if any) are reset as well." +#~ msgstr "" +#~ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況" +#~ "下,:meth:`reset_mock` *不會*\\ 清" +#~ "除 :attr:`return_value`、:attr:`side_effect` 或使用普通賦值設定的任何子屬" +#~ "性。如果你想要重置 :attr:`return_value` 或 :attr:`side_effect`,則將相應的" +#~ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。" + +#~ msgid "*return_value*, and *side_effect* are keyword-only arguments." +#~ msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" diff --git a/library/unittest.po b/library/unittest.po index bd134aa24b..80fe6553c4 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -548,11 +548,11 @@ msgstr "" #: ../../library/unittest.rst:291 msgid "The ``discover`` sub-command has the following options:" -msgstr "``discover`` 子指令有以下幾個選項:" +msgstr "``discover`` 子命令有以下幾個選項:" #: ../../library/unittest.rst:297 msgid "Verbose output" -msgstr "詳細(verbose)輸出" +msgstr "詳細 (verbose) 輸出" #: ../../library/unittest.rst:301 msgid "Directory to start discovery (``.`` default)" @@ -564,7 +564,7 @@ msgstr "匹配測試檔案的模式(預設為 ``test*.py``\\ )" #: ../../library/unittest.rst:309 msgid "Top level directory of project (defaults to start directory)" -msgstr "專案的最高階層目錄 (defaults to start directory)" +msgstr "專案的最高階層目錄(預設為開始的資料夾)" #: ../../library/unittest.rst:311 msgid "" @@ -1186,6 +1186,35 @@ msgid "" " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" "AssertionError: 1 != 0" msgstr "" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=1)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=3)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=5)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0" #: ../../library/unittest.rst:699 msgid "" @@ -1214,7 +1243,7 @@ msgstr "" #: ../../library/unittest.rst:715 msgid "Classes and functions" -msgstr "" +msgstr "類別與函式" #: ../../library/unittest.rst:717 msgid "This section describes in depth the API of :mod:`unittest`." @@ -1378,7 +1407,7 @@ msgstr "" #: ../../library/unittest.rst:853 ../../library/unittest.rst:974 #: ../../library/unittest.rst:1188 ../../library/unittest.rst:1312 msgid "Method" -msgstr "" +msgstr "方法" #: ../../library/unittest.rst:853 ../../library/unittest.rst:974 #: ../../library/unittest.rst:1188 @@ -1589,13 +1618,15 @@ msgstr ":meth:`assertRaises(exc, fun, *args, **kwds) `" #: ../../library/unittest.rst:976 msgid "``fun(*args, **kwds)`` raises *exc*" -msgstr "" +msgstr "``fun(*args, **kwds)`` 會引發 *exc*" #: ../../library/unittest.rst:979 msgid "" ":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" msgstr "" +":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" #: ../../library/unittest.rst:979 msgid "``fun(*args, **kwds)`` raises *exc* and the message matches regex *r*" @@ -1607,7 +1638,7 @@ msgstr ":meth:`assertWarns(warn, fun, *args, **kwds) `" #: ../../library/unittest.rst:982 msgid "``fun(*args, **kwds)`` raises *warn*" -msgstr "" +msgstr "``fun(*args, **kwds)`` 會引發 *warn*" #: ../../library/unittest.rst:985 msgid "" @@ -1725,6 +1756,8 @@ msgid "" "self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" " int, 'XYZ')" msgstr "" +"self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" +" int, 'XYZ')" #: ../../library/unittest.rst:1046 ../../library/unittest.rst:1114 msgid "or::" @@ -1818,12 +1851,17 @@ msgid "" " r'legacy_function\\(\\) is deprecated',\n" " legacy_function, 'XYZ')" msgstr "" +"self.assertWarnsRegex(DeprecationWarning,\n" +" r'legacy_function\\(\\) is deprecated',\n" +" legacy_function, 'XYZ')" #: ../../library/unittest.rst:1116 msgid "" "with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" " frobnicate('/etc/passwd')" msgstr "" +"with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" +" frobnicate('/etc/passwd')" #: ../../library/unittest.rst:1126 msgid "" @@ -1881,6 +1919,11 @@ msgid "" "self.assertEqual(cm.output, ['INFO:foo:first message',\n" " 'ERROR:foo.bar:second message'])" msgstr "" +"with self.assertLogs('foo', level='INFO') as cm:\n" +" logging.getLogger('foo').info('first message')\n" +" logging.getLogger('foo.bar').error('second message')\n" +"self.assertEqual(cm.output, ['INFO:foo:first message',\n" +" 'ERROR:foo.bar:second message'])" #: ../../library/unittest.rst:1168 msgid "" @@ -2016,6 +2059,8 @@ msgid "" ">>> self.assertGreaterEqual(3, 4)\n" "AssertionError: \"3\" unexpectedly not greater than or equal to \"4\"" msgstr "" +">>> self.assertGreaterEqual(3, 4)\n" +"AssertionError: \"3\" unexpectedly not greater than or equal to \"4\"" #: ../../library/unittest.rst:1257 msgid "" @@ -2034,7 +2079,7 @@ msgstr "以 ``assertRegexpMatches`` 為名新增。" msgid "" "The method ``assertRegexpMatches()`` has been renamed to :meth:`." "assertRegex`." -msgstr "" +msgstr "``assertRegexpMatches()`` 方法已重新命名為 :meth:`.assertRegex`。" #: ../../library/unittest.rst:1268 msgid ":meth:`.assertNotRegex`." @@ -2091,7 +2136,7 @@ msgstr ":meth:`assertMultiLineEqual(a, b) `" #: ../../library/unittest.rst:1314 msgid "strings" -msgstr "" +msgstr "字串" #: ../../library/unittest.rst:1317 msgid ":meth:`assertSequenceEqual(a, b) `" @@ -2099,7 +2144,7 @@ msgstr ":meth:`assertSequenceEqual(a, b) `" #: ../../library/unittest.rst:1317 msgid "sequences" -msgstr "" +msgstr "序列" #: ../../library/unittest.rst:1320 msgid ":meth:`assertListEqual(a, b) `" @@ -2107,7 +2152,7 @@ msgstr ":meth:`assertListEqual(a, b) `" #: ../../library/unittest.rst:1320 msgid "lists" -msgstr "" +msgstr "串列" #: ../../library/unittest.rst:1323 msgid ":meth:`assertTupleEqual(a, b) `" @@ -2115,7 +2160,7 @@ msgstr ":meth:`assertTupleEqual(a, b) `" #: ../../library/unittest.rst:1323 msgid "tuples" -msgstr "" +msgstr "元組" #: ../../library/unittest.rst:1326 msgid ":meth:`assertSetEqual(a, b) `" @@ -2123,7 +2168,7 @@ msgstr ":meth:`assertSetEqual(a, b) `" #: ../../library/unittest.rst:1326 msgid "sets or frozensets" -msgstr "" +msgstr "集合或凍結集合" #: ../../library/unittest.rst:1329 msgid ":meth:`assertDictEqual(a, b) `" @@ -2131,7 +2176,7 @@ msgstr ":meth:`assertDictEqual(a, b) `" #: ../../library/unittest.rst:1329 msgid "dicts" -msgstr "" +msgstr "字典" #: ../../library/unittest.rst:1337 msgid "" @@ -2380,7 +2425,7 @@ msgid "" "with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." msgstr "" -#: ../../library/unittest.rst:1584 +#: ../../library/unittest.rst:1585 msgid "" "Method called to prepare the test fixture. This is called after :meth:" "`setUp`. This is called immediately before calling the test method; other " @@ -2389,7 +2434,7 @@ msgid "" "implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1592 +#: ../../library/unittest.rst:1594 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called before :meth:`tearDown`. This is called " @@ -2402,11 +2447,11 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1604 +#: ../../library/unittest.rst:1606 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: ../../library/unittest.rst:1608 +#: ../../library/unittest.rst:1611 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " "also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" @@ -2414,7 +2459,7 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1621 msgid "" "Sets up a new event loop to run the test, collecting the result into the :" "class:`TestResult` object passed as *result*. If *result* is omitted or " @@ -2424,11 +2469,11 @@ msgid "" "cancelled." msgstr "" -#: ../../library/unittest.rst:1626 +#: ../../library/unittest.rst:1629 msgid "An example illustrating the order::" msgstr "" -#: ../../library/unittest.rst:1628 +#: ../../library/unittest.rst:1631 msgid "" "from unittest import IsolatedAsyncioTestCase\n" "\n" @@ -2500,14 +2545,14 @@ msgstr "" "if __name__ == \"__main__\":\n" " unittest.main()" -#: ../../library/unittest.rst:1662 +#: ../../library/unittest.rst:1665 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", " "\"asyncSetUp\", \"test_response\", \"asyncTearDown\", \"tearDown\", " "\"cleanup\"]``." msgstr "" -#: ../../library/unittest.rst:1667 +#: ../../library/unittest.rst:1670 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " @@ -2516,11 +2561,11 @@ msgid "" "`unittest`-based test framework." msgstr "" -#: ../../library/unittest.rst:1677 +#: ../../library/unittest.rst:1680 msgid "Grouping tests" msgstr "" -#: ../../library/unittest.rst:1681 +#: ../../library/unittest.rst:1684 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -2528,14 +2573,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: ../../library/unittest.rst:1686 +#: ../../library/unittest.rst:1689 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: ../../library/unittest.rst:1690 +#: ../../library/unittest.rst:1693 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2544,47 +2589,47 @@ msgid "" "instances:" msgstr "" -#: ../../library/unittest.rst:1698 +#: ../../library/unittest.rst:1701 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: ../../library/unittest.rst:1703 +#: ../../library/unittest.rst:1706 msgid "" "Add all the tests from an iterable of :class:`TestCase` and :class:" "`TestSuite` instances to this test suite." msgstr "" -#: ../../library/unittest.rst:1706 +#: ../../library/unittest.rst:1709 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: ../../library/unittest.rst:1709 +#: ../../library/unittest.rst:1712 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: ../../library/unittest.rst:1714 +#: ../../library/unittest.rst:1717 msgid "" "Run the tests associated with this suite, collecting the result into the " "test result object passed as *result*. Note that unlike :meth:`TestCase." "run`, :meth:`TestSuite.run` requires the result object to be passed in." msgstr "" -#: ../../library/unittest.rst:1722 +#: ../../library/unittest.rst:1725 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:1729 +#: ../../library/unittest.rst:1732 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: ../../library/unittest.rst:1735 +#: ../../library/unittest.rst:1738 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note " @@ -2596,31 +2641,31 @@ msgid "" "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: ../../library/unittest.rst:1745 +#: ../../library/unittest.rst:1748 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" -#: ../../library/unittest.rst:1750 +#: ../../library/unittest.rst:1753 msgid "" "In earlier versions the :class:`TestSuite` held references to each :class:" "`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " "by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" -#: ../../library/unittest.rst:1755 +#: ../../library/unittest.rst:1758 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " "is invoked by a :class:`TestRunner` rather than by the end-user test harness." msgstr "" -#: ../../library/unittest.rst:1760 +#: ../../library/unittest.rst:1763 msgid "Loading and running tests" msgstr "" -#: ../../library/unittest.rst:1764 +#: ../../library/unittest.rst:1767 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " @@ -2629,11 +2674,11 @@ msgid "" "customization of some configurable properties." msgstr "" -#: ../../library/unittest.rst:1770 +#: ../../library/unittest.rst:1773 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: ../../library/unittest.rst:1775 +#: ../../library/unittest.rst:1778 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2641,17 +2686,17 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: ../../library/unittest.rst:1784 +#: ../../library/unittest.rst:1787 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: ../../library/unittest.rst:1789 +#: ../../library/unittest.rst:1792 msgid "" "Return a suite of all test cases contained in the :class:`TestCase`\\ -" "derived :class:`testCaseClass`." msgstr "" -#: ../../library/unittest.rst:1792 +#: ../../library/unittest.rst:1795 msgid "" "A test case instance is created for each method named by :meth:" "`getTestCaseNames`. By default these are the method names beginning with " @@ -2660,14 +2705,14 @@ msgid "" "method instead." msgstr "" -#: ../../library/unittest.rst:1801 +#: ../../library/unittest.rst:1804 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: ../../library/unittest.rst:1808 +#: ../../library/unittest.rst:1811 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2676,7 +2721,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: ../../library/unittest.rst:1814 +#: ../../library/unittest.rst:1817 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2684,24 +2729,24 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: ../../library/unittest.rst:1819 +#: ../../library/unittest.rst:1822 msgid "Support for ``load_tests`` added." msgstr "" -#: ../../library/unittest.rst:1822 +#: ../../library/unittest.rst:1825 msgid "Support for a keyword-only argument *pattern* has been added." msgstr "" -#: ../../library/unittest.rst:1825 +#: ../../library/unittest.rst:1828 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." msgstr "" -#: ../../library/unittest.rst:1832 +#: ../../library/unittest.rst:1835 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: ../../library/unittest.rst:1834 +#: ../../library/unittest.rst:1837 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " "module, a test case class, a test method within a test case class, a :class:" @@ -2712,7 +2757,7 @@ msgid "" "object\"." msgstr "" -#: ../../library/unittest.rst:1842 +#: ../../library/unittest.rst:1845 msgid "" "For example, if you have a module :mod:`SampleTests` containing a :class:" "`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " @@ -2725,31 +2770,31 @@ msgid "" "a side-effect." msgstr "" -#: ../../library/unittest.rst:1852 +#: ../../library/unittest.rst:1855 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: ../../library/unittest.rst:1854 +#: ../../library/unittest.rst:1857 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: ../../library/unittest.rst:1863 +#: ../../library/unittest.rst:1866 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: ../../library/unittest.rst:1870 +#: ../../library/unittest.rst:1873 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: ../../library/unittest.rst:1876 +#: ../../library/unittest.rst:1879 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2758,14 +2803,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: ../../library/unittest.rst:1882 +#: ../../library/unittest.rst:1885 msgid "" "All test modules must be importable from the top level of the project. If " "the start directory is not the top level directory then *top_level_dir* must " "be specified separately." msgstr "" -#: ../../library/unittest.rst:1886 +#: ../../library/unittest.rst:1889 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2773,7 +2818,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: ../../library/unittest.rst:1891 +#: ../../library/unittest.rst:1894 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2783,103 +2828,103 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: ../../library/unittest.rst:1899 +#: ../../library/unittest.rst:1902 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: ../../library/unittest.rst:1903 +#: ../../library/unittest.rst:1906 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves." msgstr "" -#: ../../library/unittest.rst:1906 +#: ../../library/unittest.rst:1909 msgid "" "*top_level_dir* is stored internally, and used as a default to any nested " "calls to ``discover()``. That is, if a package's ``load_tests`` calls " "``loader.discover()``, it does not need to pass this argument." msgstr "" -#: ../../library/unittest.rst:1910 +#: ../../library/unittest.rst:1913 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: ../../library/unittest.rst:1914 +#: ../../library/unittest.rst:1917 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: ../../library/unittest.rst:1918 +#: ../../library/unittest.rst:1921 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:1921 +#: ../../library/unittest.rst:1924 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: ../../library/unittest.rst:1926 +#: ../../library/unittest.rst:1929 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: ../../library/unittest.rst:1931 +#: ../../library/unittest.rst:1934 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " "has been broken since Python 3.7 and Python 3.11 officially remove it." msgstr "" -#: ../../library/unittest.rst:1935 +#: ../../library/unittest.rst:1938 msgid "*top_level_dir* is only stored for the duration of *discover* call." msgstr "" -#: ../../library/unittest.rst:1939 +#: ../../library/unittest.rst:1942 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: ../../library/unittest.rst:1945 +#: ../../library/unittest.rst:1948 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: ../../library/unittest.rst:1948 +#: ../../library/unittest.rst:1951 msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1954 +#: ../../library/unittest.rst:1957 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1960 +#: ../../library/unittest.rst:1963 msgid "" "Callable object that constructs a test suite from a list of tests. No " "methods on the resulting object are needed. The default value is the :class:" "`TestSuite` class." msgstr "" -#: ../../library/unittest.rst:1964 ../../library/unittest.rst:1977 +#: ../../library/unittest.rst:1967 ../../library/unittest.rst:1980 msgid "This affects all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1968 +#: ../../library/unittest.rst:1971 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-k`` option)." msgstr "" -#: ../../library/unittest.rst:1971 +#: ../../library/unittest.rst:1974 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2888,13 +2933,13 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: ../../library/unittest.rst:1984 +#: ../../library/unittest.rst:1987 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: ../../library/unittest.rst:1987 +#: ../../library/unittest.rst:1990 msgid "" "A :class:`TestResult` object stores the results of a set of tests. The :" "class:`TestCase` and :class:`TestSuite` classes ensure that results are " @@ -2902,7 +2947,7 @@ msgid "" "outcome of tests." msgstr "" -#: ../../library/unittest.rst:1992 +#: ../../library/unittest.rst:1995 msgid "" "Testing frameworks built on top of :mod:`unittest` may want access to the :" "class:`TestResult` object generated by running a set of tests for reporting " @@ -2910,61 +2955,61 @@ msgid "" "`TestRunner.run` method for this purpose." msgstr "" -#: ../../library/unittest.rst:1997 +#: ../../library/unittest.rst:2000 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: ../../library/unittest.rst:2003 +#: ../../library/unittest.rst:2006 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: ../../library/unittest.rst:2009 +#: ../../library/unittest.rst:2012 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" -#: ../../library/unittest.rst:2015 +#: ../../library/unittest.rst:2018 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: ../../library/unittest.rst:2022 +#: ../../library/unittest.rst:2025 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: ../../library/unittest.rst:2028 +#: ../../library/unittest.rst:2031 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: ../../library/unittest.rst:2033 +#: ../../library/unittest.rst:2036 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" -#: ../../library/unittest.rst:2040 +#: ../../library/unittest.rst:2043 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: ../../library/unittest.rst:2044 +#: ../../library/unittest.rst:2047 msgid "The total number of tests run so far." msgstr "" -#: ../../library/unittest.rst:2048 +#: ../../library/unittest.rst:2051 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -2973,29 +3018,29 @@ msgid "" "error message." msgstr "" -#: ../../library/unittest.rst:2057 +#: ../../library/unittest.rst:2060 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: ../../library/unittest.rst:2064 +#: ../../library/unittest.rst:2067 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: ../../library/unittest.rst:2070 +#: ../../library/unittest.rst:2073 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: ../../library/unittest.rst:2073 +#: ../../library/unittest.rst:2076 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2079 +#: ../../library/unittest.rst:2082 msgid "" "This method can be called to signal that the set of tests being run should " "be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" @@ -3003,7 +3048,7 @@ msgid "" "additional tests." msgstr "" -#: ../../library/unittest.rst:2084 +#: ../../library/unittest.rst:2087 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " @@ -3011,7 +3056,7 @@ msgid "" "implementations can use this in a similar manner." msgstr "" -#: ../../library/unittest.rst:2089 +#: ../../library/unittest.rst:2092 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -3019,141 +3064,141 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: ../../library/unittest.rst:2097 +#: ../../library/unittest.rst:2100 msgid "Called when the test case *test* is about to be run." msgstr "" -#: ../../library/unittest.rst:2101 +#: ../../library/unittest.rst:2104 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: ../../library/unittest.rst:2106 +#: ../../library/unittest.rst:2109 msgid "Called once before any tests are executed." msgstr "" -#: ../../library/unittest.rst:2113 +#: ../../library/unittest.rst:2116 msgid "Called once after all tests are executed." msgstr "" -#: ../../library/unittest.rst:2120 +#: ../../library/unittest.rst:2123 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: ../../library/unittest.rst:2124 +#: ../../library/unittest.rst:2127 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2131 +#: ../../library/unittest.rst:2134 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2134 +#: ../../library/unittest.rst:2137 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2141 +#: ../../library/unittest.rst:2144 msgid "Called when the test case *test* succeeds." msgstr "" -#: ../../library/unittest.rst:2143 +#: ../../library/unittest.rst:2146 msgid "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:2148 +#: ../../library/unittest.rst:2151 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: ../../library/unittest.rst:2151 +#: ../../library/unittest.rst:2154 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: ../../library/unittest.rst:2157 +#: ../../library/unittest.rst:2160 msgid "" "Called when the test case *test* fails or errors, but was marked with the :" "func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2160 +#: ../../library/unittest.rst:2163 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2167 +#: ../../library/unittest.rst:2170 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: ../../library/unittest.rst:2170 +#: ../../library/unittest.rst:2173 msgid "" "The default implementation appends the test to the instance's :attr:" "`unexpectedSuccesses` attribute." msgstr "" -#: ../../library/unittest.rst:2176 +#: ../../library/unittest.rst:2179 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: ../../library/unittest.rst:2180 +#: ../../library/unittest.rst:2183 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2184 +#: ../../library/unittest.rst:2187 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: ../../library/unittest.rst:2191 +#: ../../library/unittest.rst:2194 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" -#: ../../library/unittest.rst:2198 +#: ../../library/unittest.rst:2201 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" -#: ../../library/unittest.rst:2204 +#: ../../library/unittest.rst:2207 msgid "Added the *durations* keyword parameter." msgstr "新增 *durations* 關鍵字參數。" -#: ../../library/unittest.rst:2209 +#: ../../library/unittest.rst:2212 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: ../../library/unittest.rst:2218 +#: ../../library/unittest.rst:2221 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -3164,7 +3209,7 @@ msgid "" "unittest." msgstr "" -#: ../../library/unittest.rst:2225 +#: ../../library/unittest.rst:2228 msgid "" "By default this runner shows :exc:`DeprecationWarning`, :exc:" "`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " @@ -3174,32 +3219,32 @@ msgid "" "``None``." msgstr "" -#: ../../library/unittest.rst:2233 +#: ../../library/unittest.rst:2236 msgid "Added the *warnings* parameter." msgstr "新增 *warnings* 參數。" -#: ../../library/unittest.rst:2236 +#: ../../library/unittest.rst:2239 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: ../../library/unittest.rst:2240 +#: ../../library/unittest.rst:2243 msgid "Added the *tb_locals* parameter." msgstr "新增 *tb_locals* 參數。" -#: ../../library/unittest.rst:2243 +#: ../../library/unittest.rst:2246 msgid "Added the *durations* parameter." msgstr "新增 *durations* 參數。" -#: ../../library/unittest.rst:2248 +#: ../../library/unittest.rst:2251 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: ../../library/unittest.rst:2252 +#: ../../library/unittest.rst:2255 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -3207,11 +3252,11 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2257 +#: ../../library/unittest.rst:2260 msgid "stream, descriptions, verbosity" msgstr "" -#: ../../library/unittest.rst:2261 +#: ../../library/unittest.rst:2264 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " "method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" @@ -3219,7 +3264,7 @@ msgid "" "run and the results printed to stdout." msgstr "" -#: ../../library/unittest.rst:2272 +#: ../../library/unittest.rst:2275 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -3227,7 +3272,7 @@ msgid "" "of a test script::" msgstr "" -#: ../../library/unittest.rst:2277 +#: ../../library/unittest.rst:2280 msgid "" "if __name__ == '__main__':\n" " unittest.main()" @@ -3235,13 +3280,13 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main()" -#: ../../library/unittest.rst:2280 +#: ../../library/unittest.rst:2283 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: ../../library/unittest.rst:2283 +#: ../../library/unittest.rst:2286 msgid "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" @@ -3249,7 +3294,7 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" -#: ../../library/unittest.rst:2286 +#: ../../library/unittest.rst:2289 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -3257,14 +3302,14 @@ msgid "" "tests found in *module* are run." msgstr "" -#: ../../library/unittest.rst:2291 +#: ../../library/unittest.rst:2294 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: ../../library/unittest.rst:2295 +#: ../../library/unittest.rst:2298 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " @@ -3272,20 +3317,20 @@ msgid "" "code of 5 indicates that no tests were run or skipped." msgstr "" -#: ../../library/unittest.rst:2300 +#: ../../library/unittest.rst:2303 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: ../../library/unittest.rst:2303 +#: ../../library/unittest.rst:2306 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: ../../library/unittest.rst:2307 +#: ../../library/unittest.rst:2310 msgid "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" @@ -3293,13 +3338,13 @@ msgstr "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" -#: ../../library/unittest.rst:2310 +#: ../../library/unittest.rst:2313 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: ../../library/unittest.rst:2313 +#: ../../library/unittest.rst:2316 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -3308,60 +3353,60 @@ msgid "" "to ``'default'``." msgstr "" -#: ../../library/unittest.rst:2319 +#: ../../library/unittest.rst:2322 msgid "" "Calling ``main`` returns an object with the ``result`` attribute that " "contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" -#: ../../library/unittest.rst:2322 +#: ../../library/unittest.rst:2325 msgid "The *exit* parameter was added." msgstr "新增 *exit* 參數。" -#: ../../library/unittest.rst:2325 +#: ../../library/unittest.rst:2328 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: ../../library/unittest.rst:2329 +#: ../../library/unittest.rst:2332 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: ../../library/unittest.rst:2337 +#: ../../library/unittest.rst:2340 msgid "load_tests Protocol" -msgstr "" +msgstr "load_tests 協定" -#: ../../library/unittest.rst:2341 +#: ../../library/unittest.rst:2344 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: ../../library/unittest.rst:2344 +#: ../../library/unittest.rst:2347 msgid "" "If a test module defines ``load_tests`` it will be called by :meth:" "`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2347 ../../library/unittest.rst:2379 +#: ../../library/unittest.rst:2350 ../../library/unittest.rst:2382 msgid "load_tests(loader, standard_tests, pattern)" msgstr "load_tests(loader, standard_tests, pattern)" -#: ../../library/unittest.rst:2349 +#: ../../library/unittest.rst:2352 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: ../../library/unittest.rst:2352 +#: ../../library/unittest.rst:2355 msgid "It should return a :class:`TestSuite`." -msgstr "" +msgstr "它應該回傳一個 :class:`TestSuite`。" -#: ../../library/unittest.rst:2354 +#: ../../library/unittest.rst:2357 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -3370,13 +3415,13 @@ msgid "" "packages as part of test discovery." msgstr "" -#: ../../library/unittest.rst:2360 +#: ../../library/unittest.rst:2363 msgid "" "A typical ``load_tests`` function that loads tests from a specific set of :" "class:`TestCase` classes may look like::" msgstr "" -#: ../../library/unittest.rst:2363 +#: ../../library/unittest.rst:2366 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -3396,7 +3441,7 @@ msgstr "" " suite.addTests(tests)\n" " return suite" -#: ../../library/unittest.rst:2372 +#: ../../library/unittest.rst:2375 msgid "" "If discovery is started in a directory containing a package, either from the " "command line or by calling :meth:`TestLoader.discover`, then the package :" @@ -3406,21 +3451,21 @@ msgid "" "left up to ``load_tests`` which is called with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2381 +#: ../../library/unittest.rst:2384 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " "package. (``standard_tests`` will only contain tests collected from :file:" "`__init__.py`.)" msgstr "" -#: ../../library/unittest.rst:2385 +#: ../../library/unittest.rst:2388 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: ../../library/unittest.rst:2389 +#: ../../library/unittest.rst:2392 msgid "" "def load_tests(loader, standard_tests, pattern):\n" " # top level directory cached on loader instance\n" @@ -3430,17 +3475,17 @@ msgid "" " return standard_tests" msgstr "" -#: ../../library/unittest.rst:2396 +#: ../../library/unittest.rst:2399 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: ../../library/unittest.rst:2403 +#: ../../library/unittest.rst:2406 msgid "Class and Module Fixtures" msgstr "" -#: ../../library/unittest.rst:2405 +#: ../../library/unittest.rst:2408 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " @@ -3448,27 +3493,27 @@ msgid "" "`setUpClass` from the new class." msgstr "" -#: ../../library/unittest.rst:2410 +#: ../../library/unittest.rst:2413 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: ../../library/unittest.rst:2414 +#: ../../library/unittest.rst:2417 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: ../../library/unittest.rst:2417 +#: ../../library/unittest.rst:2420 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: ../../library/unittest.rst:2420 +#: ../../library/unittest.rst:2423 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -3478,14 +3523,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: ../../library/unittest.rst:2427 +#: ../../library/unittest.rst:2430 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: ../../library/unittest.rst:2431 +#: ../../library/unittest.rst:2434 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -3495,15 +3540,15 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: ../../library/unittest.rst:2440 +#: ../../library/unittest.rst:2443 msgid "setUpClass and tearDownClass" -msgstr "" +msgstr "setUpClass 和 tearDownClass" -#: ../../library/unittest.rst:2442 +#: ../../library/unittest.rst:2445 msgid "These must be implemented as class methods::" msgstr "" -#: ../../library/unittest.rst:2444 +#: ../../library/unittest.rst:2447 msgid "" "import unittest\n" "\n" @@ -3527,14 +3572,14 @@ msgstr "" " def tearDownClass(cls):\n" " cls._connection.destroy()" -#: ../../library/unittest.rst:2455 +#: ../../library/unittest.rst:2458 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " "then you must call up to them yourself. The implementations in :class:" "`TestCase` are empty." msgstr "" -#: ../../library/unittest.rst:2459 +#: ../../library/unittest.rst:2462 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " @@ -3543,15 +3588,15 @@ msgid "" "instead of as an error." msgstr "" -#: ../../library/unittest.rst:2467 +#: ../../library/unittest.rst:2470 msgid "setUpModule and tearDownModule" -msgstr "" +msgstr "setUpModule 和 tearDownModule" -#: ../../library/unittest.rst:2469 +#: ../../library/unittest.rst:2472 msgid "These should be implemented as functions::" msgstr "" -#: ../../library/unittest.rst:2471 +#: ../../library/unittest.rst:2474 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -3565,7 +3610,7 @@ msgstr "" "def tearDownModule():\n" " closeConnection()" -#: ../../library/unittest.rst:2477 +#: ../../library/unittest.rst:2480 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -3573,13 +3618,13 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2482 +#: ../../library/unittest.rst:2485 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: ../../library/unittest.rst:2488 +#: ../../library/unittest.rst:2491 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " @@ -3588,13 +3633,13 @@ msgid "" "`addModuleCleanup` when they are added." msgstr "" -#: ../../library/unittest.rst:2494 +#: ../../library/unittest.rst:2497 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:2502 +#: ../../library/unittest.rst:2505 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :func:" @@ -3602,30 +3647,30 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:2512 +#: ../../library/unittest.rst:2515 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: ../../library/unittest.rst:2515 +#: ../../library/unittest.rst:2518 msgid "" "It is responsible for calling all the cleanup functions added by :func:" "`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" "func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:2520 +#: ../../library/unittest.rst:2523 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:2527 +#: ../../library/unittest.rst:2530 msgid "Signal Handling" msgstr "" -#: ../../library/unittest.rst:2531 +#: ../../library/unittest.rst:2534 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " "along with the ``catchbreak`` parameter to :func:`unittest.main`, provide " @@ -3635,7 +3680,7 @@ msgid "" "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: ../../library/unittest.rst:2538 +#: ../../library/unittest.rst:2541 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -3647,48 +3692,48 @@ msgid "" "disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: ../../library/unittest.rst:2547 +#: ../../library/unittest.rst:2550 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: ../../library/unittest.rst:2552 +#: ../../library/unittest.rst:2555 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: ../../library/unittest.rst:2559 +#: ../../library/unittest.rst:2562 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: ../../library/unittest.rst:2563 +#: ../../library/unittest.rst:2566 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: ../../library/unittest.rst:2570 +#: ../../library/unittest.rst:2573 msgid "" "Remove a registered result. Once a result has been removed then :meth:" "`~TestResult.stop` will no longer be called on that result object in " "response to a control-c." msgstr "" -#: ../../library/unittest.rst:2577 +#: ../../library/unittest.rst:2580 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" -#: ../../library/unittest.rst:2581 +#: ../../library/unittest.rst:2584 msgid "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index d8aa51ce60..b5476ab963 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -80,9 +80,9 @@ msgstr "" #: ../../library/urllib.parse.rst:55 msgid "" "Parse a URL into six components, returning a 6-item :term:`named tuple`. " -"This corresponds to the general structure of a URL: ``scheme://netloc/path;" -"parameters?query#fragment``. Each tuple item is a string, possibly empty. " -"The components are not broken up into smaller parts (for example, the " +"This corresponds to the general structure of a URL: ``scheme://netloc/" +"path;parameters?query#fragment``. Each tuple item is a string, possibly " +"empty. The components are not broken up into smaller parts (for example, the " "network location is a single string), and % escapes are not expanded. The " "delimiters as shown above are not part of the result, except for a leading " "slash in the *path* component, which is retained if present. For example:" @@ -145,8 +145,8 @@ msgstr "" msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -157,8 +157,8 @@ msgid "" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -346,8 +346,8 @@ msgstr "" #: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:336 msgid "" -"Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" -"`ValueError`." +"Unmatched square brackets in the :attr:`netloc` attribute will raise " +"a :exc:`ValueError`." msgstr "" #: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:339 @@ -361,9 +361,9 @@ msgstr "" #: ../../library/urllib.parse.rst:158 msgid "" "As is the case with all named tuples, the subclass has a few additional " -"methods and attributes that are particularly useful. One such method is :" -"meth:`_replace`. The :meth:`_replace` method will return a new ParseResult " -"object replacing specified fields with new values." +"methods and attributes that are particularly useful. One such method " +"is :meth:`_replace`. The :meth:`_replace` method will return a new " +"ParseResult object replacing specified fields with new values." msgstr "" #: ../../library/urllib.parse.rst:163 @@ -371,23 +371,23 @@ msgid "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')" #: ../../library/urllib.parse.rst:177 @@ -409,8 +409,8 @@ msgstr "" #: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:353 msgid "" -"Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" -"const:`None`." +"Out-of-range port numbers now raise :exc:`ValueError`, instead of " +"returning :const:`None`." msgstr "" #: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:357 @@ -421,10 +421,10 @@ msgstr "" #: ../../library/urllib.parse.rst:199 msgid "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a dictionary. " -"The dictionary keys are the unique query variable names and the values are " -"lists of values for each name." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"dictionary. The dictionary keys are the unique query variable names and the " +"values are lists of values for each name." msgstr "" #: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:249 @@ -446,8 +446,8 @@ msgstr "" #: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " -"percent-encoded sequences into Unicode characters, as accepted by the :meth:" -"`bytes.decode` method." +"percent-encoded sequences into Unicode characters, as accepted by " +"the :meth:`bytes.decode` method." msgstr "" #: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:263 @@ -471,7 +471,7 @@ msgstr "" #: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:273 msgid "Add *encoding* and *errors* parameters." -msgstr "" +msgstr "新增 *encoding* 和 *errors* 參數。" #: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:276 msgid "Added *max_num_fields* parameter." @@ -487,9 +487,9 @@ msgstr "" #: ../../library/urllib.parse.rst:245 msgid "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a list of name, " -"value pairs." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"list of name, value pairs." msgstr "" #: ../../library/urllib.parse.rst:270 @@ -570,8 +570,8 @@ msgstr "" #: ../../library/urllib.parse.rst:389 msgid "" -"The *allow_fragments* argument has the same meaning and default as for :func:" -"`urlparse`." +"The *allow_fragments* argument has the same meaning and default as " +"for :func:`urlparse`." msgstr "" #: ../../library/urllib.parse.rst:394 @@ -638,10 +638,10 @@ msgstr "" #: ../../library/urllib.parse.rst:447 msgid "" -"Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " -"or ``scheme://host/path``). If *url* is not a wrapped URL, it is returned " -"without changes." +"Extract the url from a wrapped URL (that is, a string formatted as " +"````, ````, ``URL:scheme://host/" +"path`` or ``scheme://host/path``). If *url* is not a wrapped URL, it is " +"returned without changes." msgstr "" #: ../../library/urllib.parse.rst:455 @@ -694,36 +694,37 @@ msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " "quoted and encoded URLs as sequences of ASCII bytes. Accordingly, the URL " -"parsing functions in this module all operate on :class:`bytes` and :class:" -"`bytearray` objects in addition to :class:`str` objects." +"parsing functions in this module all operate on :class:`bytes` " +"and :class:`bytearray` objects in addition to :class:`str` objects." msgstr "" #: ../../library/urllib.parse.rst:492 msgid "" -"If :class:`str` data is passed in, the result will also contain only :class:" -"`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " -"result will contain only :class:`bytes` data." +"If :class:`str` data is passed in, the result will also contain " +"only :class:`str` data. If :class:`bytes` or :class:`bytearray` data is " +"passed in, the result will contain only :class:`bytes` data." msgstr "" #: ../../library/urllib.parse.rst:496 msgid "" -"Attempting to mix :class:`str` data with :class:`bytes` or :class:" -"`bytearray` in a single function call will result in a :exc:`TypeError` " -"being raised, while attempting to pass in non-ASCII byte values will " -"trigger :exc:`UnicodeDecodeError`." +"Attempting to mix :class:`str` data with :class:`bytes` " +"or :class:`bytearray` in a single function call will result in " +"a :exc:`TypeError` being raised, while attempting to pass in non-ASCII byte " +"values will trigger :exc:`UnicodeDecodeError`." msgstr "" #: ../../library/urllib.parse.rst:501 msgid "" -"To support easier conversion of result objects between :class:`str` and :" -"class:`bytes`, all return values from URL parsing functions provide either " -"an :meth:`encode` method (when the result contains :class:`str` data) or a :" -"meth:`decode` method (when the result contains :class:`bytes` data). The " -"signatures of these methods match those of the corresponding :class:`str` " -"and :class:`bytes` methods (except that the default encoding is ``'ascii'`` " -"rather than ``'utf-8'``). Each produces a value of a corresponding type that " -"contains either :class:`bytes` data (for :meth:`encode` methods) or :class:" -"`str` data (for :meth:`decode` methods)." +"To support easier conversion of result objects between :class:`str` " +"and :class:`bytes`, all return values from URL parsing functions provide " +"either an :meth:`encode` method (when the result contains :class:`str` data) " +"or a :meth:`decode` method (when the result contains :class:`bytes` data). " +"The signatures of these methods match those of the " +"corresponding :class:`str` and :class:`bytes` methods (except that the " +"default encoding is ``'ascii'`` rather than ``'utf-8'``). Each produces a " +"value of a corresponding type that contains either :class:`bytes` data " +"(for :meth:`encode` methods) or :class:`str` data (for :meth:`decode` " +"methods)." msgstr "" #: ../../library/urllib.parse.rst:512 @@ -751,9 +752,9 @@ msgstr "" #: ../../library/urllib.parse.rst:530 msgid "" -"The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" -"`urldefrag` functions are subclasses of the :class:`tuple` type. These " -"subclasses add the attributes listed in the documentation for those " +"The result objects from the :func:`urlparse`, :func:`urlsplit` " +"and :func:`urldefrag` functions are subclasses of the :class:`tuple` type. " +"These subclasses add the attributes listed in the documentation for those " "functions, the encoding and decoding support described in the previous " "section, as well as an additional method:" msgstr "" @@ -866,8 +867,8 @@ msgid "" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " "defaults to ``'utf-8'``. *errors* defaults to ``'strict'``, meaning " "unsupported characters raise a :class:`UnicodeEncodeError`. *encoding* and " -"*errors* must not be supplied if *string* is a :class:`bytes`, or a :class:" -"`TypeError` is raised." +"*errors* must not be supplied if *string* is a :class:`bytes`, or " +"a :class:`TypeError` is raised." msgstr "" #: ../../library/urllib.parse.rst:643 @@ -894,8 +895,8 @@ msgstr "" #: ../../library/urllib.parse.rst:661 msgid "" -"Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" -"`str`, and does not perform string-to-bytes encoding." +"Like :func:`quote`, but accepts a :class:`bytes` object rather than " +"a :class:`str`, and does not perform string-to-bytes encoding." msgstr "" #: ../../library/urllib.parse.rst:664 @@ -906,8 +907,8 @@ msgstr "" msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" -"encoded sequences into Unicode characters, as accepted by the :meth:`bytes." -"decode` method." +"encoded sequences into Unicode characters, as accepted by " +"the :meth:`bytes.decode` method." msgstr "" #: ../../library/urllib.parse.rst:677 @@ -1003,9 +1004,9 @@ msgstr "" #: ../../library/urllib.parse.rst:747 msgid "" -"Refer to :ref:`urllib examples ` to find out how the :func:" -"`urllib.parse.urlencode` method can be used for generating the query string " -"of a URL or data for a POST request." +"Refer to :ref:`urllib examples ` to find out how " +"the :func:`urllib.parse.urlencode` method can be used for generating the " +"query string of a URL or data for a POST request." msgstr "" #: ../../library/urllib.parse.rst:751 diff --git a/library/urllib.request.po b/library/urllib.request.po index e18223387e..0e3384e9e9 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2025-03-24 00:15+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "The `Requests package `_ is " "recommended for a higher-level HTTP client interface." msgstr "" -"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" +"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" #: ../../library/urllib.request.rst:26 msgid "" @@ -74,8 +74,8 @@ msgid "" "Open *url*, which can be either a string containing a valid, properly " "encoded URL, or a :class:`Request` object." msgstr "" -"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一個 :class:" -"`Request` 物件。" +"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一" +"個 :class:`Request` 物件。" #: ../../library/urllib.request.rst:42 msgid "" @@ -108,8 +108,8 @@ msgstr "" #: ../../library/urllib.request.rst:54 msgid "" "If *context* is specified, it must be a :class:`ssl.SSLContext` instance " -"describing the various SSL options. See :class:`~http.client." -"HTTPSConnection` for more details." +"describing the various SSL options. " +"See :class:`~http.client.HTTPSConnection` for more details." msgstr "" "若 *context* 有被指定時,它必須是一個 :class:`ssl.SSLContext` 的實例並描述著" "各種 SSL 選項。更多細節請見 :class:`~http.client.HTTPSConnection`。" @@ -117,37 +117,37 @@ msgstr "" #: ../../library/urllib.request.rst:58 msgid "" "This function always returns an object which can work as a :term:`context " -"manager` and has the properties *url*, *headers*, and *status*. See :class:" -"`urllib.response.addinfourl` for more detail on these properties." +"manager` and has the properties *url*, *headers*, and *status*. " +"See :class:`urllib.response.addinfourl` for more detail on these properties." msgstr "" "這個函式總是回傳一個可作為 :term:`context manager` 使用的物件,並有著特性 " -"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" -"`urllib.response.addinfourl`。" +"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參" +"見 :class:`urllib.response.addinfourl`。" #: ../../library/urllib.request.rst:62 msgid "" -"For HTTP and HTTPS URLs, this function returns a :class:`http.client." -"HTTPResponse` object slightly modified. In addition to the three new methods " -"above, the msg attribute contains the same information as the :attr:`~http." -"client.HTTPResponse.reason` attribute --- the reason phrase returned by " -"server --- instead of the response headers as it is specified in the " -"documentation for :class:`~http.client.HTTPResponse`." +"For HTTP and HTTPS URLs, this function returns " +"a :class:`http.client.HTTPResponse` object slightly modified. In addition to " +"the three new methods above, the msg attribute contains the same information " +"as the :attr:`~http.client.HTTPResponse.reason` attribute --- the reason " +"phrase returned by server --- instead of the response headers as it is " +"specified in the documentation for :class:`~http.client.HTTPResponse`." msgstr "" -"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同的 :class:`http.client." -"HTTPResponse` 物件。除了上述提到的三個方法外,另有 msg 屬性並有著與 :attr:" -"`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺服器回傳的原因敘述 " -"(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" -"應 headers。" +"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同" +"的 :class:`http.client.HTTPResponse` 物件。除了上述提到的三個方法外,另有 " +"msg 屬性並有著與 :attr:`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺" +"服器回傳的原因敘述 (reason phrase),而不是" +"在 :class:`~http.client.HTTPResponse` 文件中提到的回應 headers。" #: ../../library/urllib.request.rst:70 msgid "" -"For FTP, file, and data URLs and requests explicitly handled by legacy :" -"class:`URLopener` and :class:`FancyURLopener` classes, this function returns " -"a :class:`urllib.response.addinfourl` object." +"For FTP, file, and data URLs and requests explicitly handled by " +"legacy :class:`URLopener` and :class:`FancyURLopener` classes, this function " +"returns a :class:`urllib.response.addinfourl` object." msgstr "" -"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` 與 :" -"class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." -"response.addinfourl` 物件。" +"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` " +"與 :class:`FancyURLopener` 所處理的請求,這個函式會回傳一" +"個 :class:`urllib.response.addinfourl` 物件。" #: ../../library/urllib.request.rst:74 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." @@ -156,8 +156,8 @@ msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`。 #: ../../library/urllib.request.rst:76 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " -"the default installed global :class:`OpenerDirector` uses :class:" -"`UnknownHandler` to ensure this never happens)." +"the default installed global :class:`OpenerDirector` " +"uses :class:`UnknownHandler` to ensure this never happens)." msgstr "" "請注意若沒有 handler 處理請求時,``None`` 值將會被回傳。(即使有預設的全域類" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" @@ -166,9 +166,9 @@ msgstr "" #: ../../library/urllib.request.rst:80 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " -"environment variable like :envvar:`!http_proxy` is set), :class:" -"`ProxyHandler` is default installed and makes sure the requests are handled " -"through the proxy." +"environment variable like :envvar:`!http_proxy` is " +"set), :class:`ProxyHandler` is default installed and makes sure the requests " +"are handled through the proxy." msgstr "" "另外,若有偵測到代理服務的設定(例如當 ``*_proxy`` 環境變數像是::envvar:!" "http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" @@ -179,19 +179,19 @@ msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " "``urllib2.urlopen``. Proxy handling, which was done by passing a dictionary " -"parameter to ``urllib.urlopen``, can be obtained by using :class:" -"`ProxyHandler` objects." +"parameter to ``urllib.urlopen``, can be obtained by " +"using :class:`ProxyHandler` objects." msgstr "" -"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函式 :" -"func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理服務" -"的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," -"現在則可以透過 :class:`ProxyHandler` 物件來取得。" +"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函" +"式 :func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理" +"服務的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得" +"的,現在則可以透過 :class:`ProxyHandler` 物件來取得。" #: ../../library/urllib.request.rst:91 ../../library/urllib.request.rst:93 msgid "" -"The default opener raises an :ref:`auditing event ` ``urllib." -"Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " -"taken from the request object." +"The default opener raises an :ref:`auditing event ` " +"``urllib.Request`` with arguments ``fullurl``, ``data``, ``headers``, " +"``method`` taken from the request object." msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" @@ -202,8 +202,8 @@ msgstr "新增 *cafile* 與 *capath*。" #: ../../library/urllib.request.rst:100 msgid "" -"HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." -"HAS_SNI` is true)." +"HTTPS virtual hosts are now supported if possible (that is, " +"if :const:`ssl.HAS_SNI` is true)." msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :const:`ssl.HAS_SNI` 的值為 " "true。" @@ -222,13 +222,13 @@ msgstr "*context* 被新增。" #: ../../library/urllib.request.rst:111 msgid "" -"HTTPS connection now send an ALPN extension with protocol indicator " -"``http/1.1`` when no *context* is given. Custom *context* should set ALPN " -"protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`." +"HTTPS connection now send an ALPN extension with protocol indicator ``http/" +"1.1`` when no *context* is given. Custom *context* should set ALPN protocols " +"with :meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" -"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 " -"``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." -"SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" +"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 ``http/" +"1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利" +"用 :meth:`~ssl.SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" #: ../../library/urllib.request.rst:116 msgid "" @@ -240,15 +240,16 @@ msgstr "" msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " -"opener; otherwise, simply call :meth:`OpenerDirector.open` instead of :func:" -"`~urllib.request.urlopen`. The code does not check for a real :class:" -"`OpenerDirector`, and any class with the appropriate interface will work." +"opener; otherwise, simply call :meth:`OpenerDirector.open` instead " +"of :func:`~urllib.request.urlopen`. The code does not check for a " +"real :class:`OpenerDirector`, and any class with the appropriate interface " +"will work." msgstr "" "安裝一個 :class:`OpenerDirector` 實例作為預設的全域 opener。僅在當你想要讓 " -"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼叫 :meth:" -"`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不會檢查 " -"class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都能適" -"用。" +"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼" +"叫 :meth:`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不" +"會檢查 class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 " +"class 都能適用。" #: ../../library/urllib.request.rst:133 msgid "" @@ -258,19 +259,15 @@ msgid "" "call the constructor without any parameters). Instances of the following " "classes will be in front of the *handler*\\s, unless the *handler*\\s " "contain them, instances of them or subclasses of them: :class:`ProxyHandler` " -"(if proxy settings are detected), :class:`UnknownHandler`, :class:" -"`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:" -"`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:" -"`HTTPErrorProcessor`." +"(if proxy settings are " +"detected), :class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:`HTTPErrorProcessor`." msgstr "" "回傳一個 :class:`OpenerDirector` 實例,以給定的順序把 handlers 串接起來。" "*handler*\\s 可以是 :class:`BaseHandler` 的實例,亦或是 :class:`BaseHandler` " "的 subclasses(這個情況下必須有不帶參數的建構函式能夠被呼叫)。以下 classes " "的實例順位會在 *handler*\\s 之前,除非 *handler*\\s 已經包含它們,是它們的實" "例,或是它們的 subclasses::class:`ProxyHandler`\\ (如果代理服務設定被偵測" -"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:" -"`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:" -"`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" +"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" #: ../../library/urllib.request.rst:143 msgid "" @@ -290,10 +287,10 @@ msgstr "" #: ../../library/urllib.request.rst:152 msgid "" -"Convert the given local path to a ``file:`` URL. This function uses :func:" -"`~urllib.parse.quote` function to encode the path. For historical reasons, " -"the return value omits the ``file:`` scheme prefix. This example shows the " -"function being used on Windows::" +"Convert the given local path to a ``file:`` URL. This function " +"uses :func:`~urllib.parse.quote` function to encode the path. For historical " +"reasons, the return value omits the ``file:`` scheme prefix. This example " +"shows the function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:157 @@ -310,10 +307,10 @@ msgstr "" #: ../../library/urllib.request.rst:165 msgid "" -"Convert the given ``file:`` URL to a local path. This function uses :func:" -"`~urllib.parse.unquote` to decode the URL. For historical reasons, the given " -"value *must* omit the ``file:`` scheme prefix. This example shows the " -"function being used on Windows::" +"Convert the given ``file:`` URL to a local path. This function " +"uses :func:`~urllib.parse.unquote` to decode the URL. For historical " +"reasons, the given value *must* omit the ``file:`` scheme prefix. This " +"example shows the function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:170 @@ -395,11 +392,11 @@ msgstr "" #: ../../library/urllib.request.rst:214 msgid "" -"For an HTTP POST request method, *data* should be a buffer in the standard :" -"mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." -"parse.urlencode` function takes a mapping or sequence of 2-tuples and " -"returns an ASCII string in this format. It should be encoded to bytes before " -"being used as the *data* parameter." +"For an HTTP POST request method, *data* should be a buffer in the " +"standard :mimetype:`application/x-www-form-urlencoded` format. " +"The :func:`urllib.parse.urlencode` function takes a mapping or sequence of 2-" +"tuples and returns an ASCII string in this format. It should be encoded to " +"bytes before being used as the *data* parameter." msgstr "" "對於一個 HTTP POST 請求方法,*data* 應為一個標準 :mimetype:`application/x-" "www-form-urlencoded` 格式的 buffer。:func:`urllib.parse.urlencode` 方法接受一" @@ -408,10 +405,10 @@ msgstr "" #: ../../library/urllib.request.rst:220 msgid "" -"*headers* should be a dictionary, and will be treated as if :meth:" -"`add_header` was called with each key and value as arguments. This is often " -"used to \"spoof\" the ``User-Agent`` header value, which is used by a " -"browser to identify itself -- some HTTP servers only allow requests coming " +"*headers* should be a dictionary, and will be treated as " +"if :meth:`add_header` was called with each key and value as arguments. This " +"is often used to \"spoof\" the ``User-Agent`` header value, which is used by " +"a browser to identify itself -- some HTTP servers only allow requests coming " "from common browsers as opposed to scripts. For example, Mozilla Firefox may " "identify itself as ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " "Firefox/2.0.0.11\"``, while :mod:`urllib`'s default user agent string is " @@ -422,10 +419,9 @@ msgstr "" "叫 :meth:`add_header`。經常用於「偽裝」 ``User-Agent`` header 的值,這個 " "header 是用來讓一個瀏覽器向伺服器表明自己的身分 --- 有些 HTTP 伺服器僅允許來" "自普通瀏覽器的請求,而不接受來自程式腳本的請求。例如,Mozilla Firefox 會將 " -"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " -"Firefox/2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ " -"(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" -"送。" +"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/" +"2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ (在 " +"Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳送。" #: ../../library/urllib.request.rst:231 msgid "" @@ -448,16 +444,16 @@ msgstr "" #: ../../library/urllib.request.rst:239 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " -"defined by :rfc:`2965`. It defaults to ``http.cookiejar." -"request_host(self)``. This is the host name or IP address of the original " -"request that was initiated by the user. For example, if the request is for " -"an image in an HTML document, this should be the request-host of the request " -"for the page containing the image." +"defined by :rfc:`2965`. It defaults to " +"``http.cookiejar.request_host(self)``. This is the host name or IP address " +"of the original request that was initiated by the user. For example, if the " +"request is for an image in an HTML document, this should be the request-host " +"of the request for the page containing the image." msgstr "" -"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同在 :rfc:" -"`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是使用者發" -"起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" -"像,則這個屬性應為請求包含影像頁面的請求主機。" +"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同" +"在 :rfc:`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是" +"使用者發起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中" +"的一個影像,則這個屬性應為請求包含影像頁面的請求主機。" #: ../../library/urllib.request.rst:247 msgid "" @@ -475,11 +471,11 @@ msgstr "" #: ../../library/urllib.request.rst:254 msgid "" "*method* should be a string that indicates the HTTP request method that will " -"be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" -"`~Request.method` attribute and is used by :meth:`get_method`. The default " -"is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. Subclasses may " -"indicate a different default method by setting the :attr:`~Request.method` " -"attribute in the class itself." +"be used (e.g. ``'HEAD'``). If provided, its value is stored in " +"the :attr:`~Request.method` attribute and is used by :meth:`get_method`. The " +"default is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. " +"Subclasses may indicate a different default method by setting " +"the :attr:`~Request.method` attribute in the class itself." msgstr "" "*method* 應為一個標示 HTTP 請求方法的字串(例如:``'HEAD'``)。如果有提供值," "則會被存在 :attr:`~Request.method` 屬性中且被 :meth:`get_method` 所使用。當 " @@ -598,9 +594,9 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be " -"supported. If *passwd_mgr* also provides ``is_authenticated`` and " +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported. If *passwd_mgr* also provides ``is_authenticated`` and " "``update_authenticated`` methods (see :ref:`http-password-mgr-with-prior-" "auth`), then the handler will use the ``is_authenticated`` result for a " "given URI to determine whether or not to send authentication credentials " @@ -638,8 +634,9 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be supported." +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported." msgstr "" #: ../../library/urllib.request.rst:404 @@ -715,9 +712,9 @@ msgstr "" #: ../../library/urllib.request.rst:487 msgid "" -"Request.full_url is a property with setter, getter and a deleter. Getting :" -"attr:`~Request.full_url` returns the original request URL with the fragment, " -"if it was present." +"Request.full_url is a property with setter, getter and a deleter. " +"Getting :attr:`~Request.full_url` returns the original request URL with the " +"fragment, if it was present." msgstr "" #: ../../library/urllib.request.rst:493 @@ -752,8 +749,8 @@ msgstr "" #: ../../library/urllib.request.rst:519 msgid "" -"boolean, indicates whether the request is unverifiable as defined by :rfc:" -"`2965`." +"boolean, indicates whether the request is unverifiable as defined " +"by :rfc:`2965`." msgstr "" #: ../../library/urllib.request.rst:524 @@ -775,10 +772,10 @@ msgstr "" #: ../../library/urllib.request.rst:541 msgid "" -"Return a string indicating the HTTP request method. If :attr:`Request." -"method` is not ``None``, return its value, otherwise return ``'GET'`` if :" -"attr:`Request.data` is ``None``, or ``'POST'`` if it's not. This is only " -"meaningful for HTTP requests." +"Return a string indicating the HTTP request method. " +"If :attr:`Request.method` is not ``None``, return its value, otherwise " +"return ``'GET'`` if :attr:`Request.data` is ``None``, or ``'POST'`` if it's " +"not. This is only meaningful for HTTP requests." msgstr "" #: ../../library/urllib.request.rst:546 @@ -859,10 +856,10 @@ msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " "errors are a special case). Note that, in the following, *protocol* should " -"be replaced with the actual protocol to handle, for example :meth:" -"`http_response` would be the HTTP protocol response handler. Also *type* " -"should be replaced with the actual HTTP code, for example :meth:" -"`http_error_404` would handle HTTP 404 errors." +"be replaced with the actual protocol to handle, for " +"example :meth:`http_response` would be the HTTP protocol response handler. " +"Also *type* should be replaced with the actual HTTP code, for " +"example :meth:`http_error_404` would handle HTTP 404 errors." msgstr "" #: ../../library/urllib.request.rst:631 @@ -956,25 +953,27 @@ msgstr "" #: ../../library/urllib.request.rst:689 msgid "" "Handlers with a method named like :meth:`!_open` are called to " -"handle the request. This stage ends when a handler either returns a non-\\ :" -"const:`None` value (ie. a response), or raises an exception (usually :exc:" -"`~urllib.error.URLError`). Exceptions are allowed to propagate." +"handle the request. This stage ends when a handler either returns a non-" +"\\ :const:`None` value (ie. a response), or raises an exception " +"(usually :exc:`~urllib.error.URLError`). Exceptions are allowed to " +"propagate." msgstr "" #: ../../library/urllib.request.rst:694 msgid "" -"In fact, the above algorithm is first tried for methods named :meth:" -"`~BaseHandler.default_open`. If all such methods return :const:`None`, the " -"algorithm is repeated for methods named like :meth:`!_open`. If " -"all such methods return :const:`None`, the algorithm is repeated for methods " +"In fact, the above algorithm is first tried for methods " +"named :meth:`~BaseHandler.default_open`. If all such methods " +"return :const:`None`, the algorithm is repeated for methods named " +"like :meth:`!_open`. If all such methods return :const:`None`, " +"the algorithm is repeated for methods " "named :meth:`~BaseHandler.unknown_open`." msgstr "" #: ../../library/urllib.request.rst:700 msgid "" "Note that the implementation of these methods may involve calls of the " -"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" -"meth:`~OpenerDirector.error` methods." +"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` " +"and :meth:`~OpenerDirector.error` methods." msgstr "" #: ../../library/urllib.request.rst:704 @@ -1011,8 +1010,8 @@ msgstr "" #: ../../library/urllib.request.rst:732 msgid "" "The convention has been adopted that subclasses defining :meth:`!" -"_request` or :meth:`!_response` methods are named :class:" -"`!\\*Processor`; all others are named :class:`!\\*Handler`." +"_request` or :meth:`!_response` methods are " +"named :class:`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" #: ../../library/urllib.request.rst:739 @@ -1029,12 +1028,13 @@ msgstr "" #: ../../library/urllib.request.rst:748 msgid "" -"This method, if implemented, will be called by the parent :class:" -"`OpenerDirector`. It should return a file-like object as described in the " -"return value of the :meth:`~OpenerDirector.open` method of :class:" -"`OpenerDirector`, or ``None``. It should raise :exc:`~urllib.error." -"URLError`, unless a truly exceptional thing happens (for example, :exc:" -"`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." +"This method, if implemented, will be called by the " +"parent :class:`OpenerDirector`. It should return a file-like object as " +"described in the return value of the :meth:`~OpenerDirector.open` method " +"of :class:`OpenerDirector`, or ``None``. It should " +"raise :exc:`~urllib.error.URLError`, unless a truly exceptional thing " +"happens (for example, :exc:`MemoryError` should not be mapped " +"to :exc:`~urllib.error.URLError`)." msgstr "" #: ../../library/urllib.request.rst:755 @@ -1049,9 +1049,9 @@ msgstr "" #: ../../library/urllib.request.rst:765 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`~BaseHandler.default_open`." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. Return values should be the same as " +"for :meth:`~BaseHandler.default_open`." msgstr "" #: ../../library/urllib.request.rst:771 @@ -1063,18 +1063,18 @@ msgstr "" #: ../../library/urllib.request.rst:775 msgid "" -"This method, if implemented, will be called by the :attr:`parent` :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`default_open`." +"This method, if implemented, will be called by " +"the :attr:`parent` :class:`OpenerDirector`. Return values should be the " +"same as for :meth:`default_open`." msgstr "" #: ../../library/urllib.request.rst:782 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " -"HTTP errors. It will be called automatically by the :class:" -"`OpenerDirector` getting the error, and should not normally be called in " -"other circumstances." +"HTTP errors. It will be called automatically by " +"the :class:`OpenerDirector` getting the error, and should not normally be " +"called in other circumstances." msgstr "" #: ../../library/urllib.request.rst:787 @@ -1087,8 +1087,8 @@ msgstr "" #: ../../library/urllib.request.rst:792 msgid "" -"Return values and exceptions raised should be the same as those of :func:" -"`urlopen`." +"Return values and exceptions raised should be the same as those " +"of :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:799 @@ -1104,8 +1104,8 @@ msgstr "" #: ../../library/urllib.request.rst:805 msgid "" -"Arguments, return values and exceptions raised should be the same as for :" -"meth:`~BaseHandler.http_error_default`." +"Arguments, return values and exceptions raised should be the same as " +"for :meth:`~BaseHandler.http_error_default`." msgstr "" #: ../../library/urllib.request.rst:813 @@ -1116,9 +1116,9 @@ msgstr "" #: ../../library/urllib.request.rst:816 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. The return value " -"should be a :class:`Request` object." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. The " +"return value should be a :class:`Request` object." msgstr "" #: ../../library/urllib.request.rst:825 @@ -1129,11 +1129,11 @@ msgstr "" #: ../../library/urllib.request.rst:828 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " -"be an object implementing the same interface as the return value of :func:" -"`urlopen`. The return value should implement the same interface as the " -"return value of :func:`urlopen`." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. " +"*response* will be an object implementing the same interface as the return " +"value of :func:`urlopen`. The return value should implement the same " +"interface as the return value of :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:838 @@ -1160,18 +1160,19 @@ msgid "" "called by the default implementations of the :meth:`!http_error_30\\*` " "methods when a redirection is received from the server. If a redirection " "should take place, return a new :class:`Request` to allow :meth:`!" -"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, raise :" -"exc:`~urllib.error.HTTPError` if no other handler should try to handle this " -"URL, or return ``None`` if you can't but another handler might." +"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, " +"raise :exc:`~urllib.error.HTTPError` if no other handler should try to " +"handle this URL, or return ``None`` if you can't but another handler might." msgstr "" #: ../../library/urllib.request.rst:863 msgid "" -"The default implementation of this method does not strictly follow :rfc:" -"`2616`, which says that 301 and 302 responses to ``POST`` requests must not " -"be automatically redirected without confirmation by the user. In reality, " -"browsers do allow automatic redirection of these responses, changing the " -"POST to a ``GET``, and the default implementation reproduces this behavior." +"The default implementation of this method does not strictly " +"follow :rfc:`2616`, which says that 301 and 302 responses to ``POST`` " +"requests must not be automatically redirected without confirmation by the " +"user. In reality, browsers do allow automatic redirection of these " +"responses, changing the POST to a ``GET``, and the default implementation " +"reproduces this behavior." msgstr "" #: ../../library/urllib.request.rst:872 @@ -1236,8 +1237,8 @@ msgstr "HTTPPasswordMgr 物件" #: ../../library/urllib.request.rst:935 msgid "" -"These methods are available on :class:`HTTPPasswordMgr` and :class:" -"`HTTPPasswordMgrWithDefaultRealm` objects." +"These methods are available on :class:`HTTPPasswordMgr` " +"and :class:`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" #: ../../library/urllib.request.rst:941 @@ -1273,10 +1274,10 @@ msgstr "" #: ../../library/urllib.request.rst:968 msgid "" -"*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." -"add_password`. *is_authenticated* sets the initial value of the " -"``is_authenticated`` flag for the given URI or list of URIs. If " -"*is_authenticated* is specified as ``True``, *realm* is ignored." +"*realm*, *uri*, *user*, *passwd* are as " +"for :meth:`HTTPPasswordMgr.add_password`. *is_authenticated* sets the " +"initial value of the ``is_authenticated`` flag for the given URI or list of " +"URIs. If *is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" #: ../../library/urllib.request.rst:976 @@ -1302,8 +1303,8 @@ msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " "information about the realm is included in the request, *host* specifies the " -"URL and path to authenticate for, *req* should be the (failed) :class:" -"`Request` object, and *headers* should be the error headers." +"URL and path to authenticate for, *req* should be the " +"(failed) :class:`Request` object, and *headers* should be the error headers." msgstr "" #: ../../library/urllib.request.rst:1006 @@ -1353,8 +1354,8 @@ msgstr "HTTPHandler 物件" #: ../../library/urllib.request.rst:1078 msgid "" -"Send an HTTP request, which can be either GET or POST, depending on ``req." -"has_data()``." +"Send an HTTP request, which can be either GET or POST, depending on " +"``req.has_data()``." msgstr "" #: ../../library/urllib.request.rst:1085 @@ -1363,8 +1364,8 @@ msgstr "HTTPSHandler 物件" #: ../../library/urllib.request.rst:1090 msgid "" -"Send an HTTPS request, which can be either GET or POST, depending on ``req." -"has_data()``." +"Send an HTTPS request, which can be either GET or POST, depending on " +"``req.has_data()``." msgstr "" #: ../../library/urllib.request.rst:1097 @@ -1445,8 +1446,8 @@ msgstr "" msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " -"Eventually, :class:`HTTPDefaultErrorHandler` will raise an :exc:`~urllib." -"error.HTTPError` if no other handler handles the error." +"Eventually, :class:`HTTPDefaultErrorHandler` will raise " +"an :exc:`~urllib.error.HTTPError` if no other handler handles the error." msgstr "" #: ../../library/urllib.request.rst:1186 @@ -1470,7 +1471,7 @@ msgstr "" #: ../../library/urllib.request.rst:1199 msgid "" "This example gets the python.org main page and displays the first 300 bytes " -"of it. ::" +"of it::" msgstr "" #: ../../library/urllib.request.rst:1202 @@ -1479,27 +1480,13 @@ msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(300))\n" "...\n" -"b'\\n\\n\\n\\n\\n\\n\n" -"\\n\n" -"Python Programming '" +"b'<!doctype html>\\n<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-" +"ie8 lt-ie9\"> <![endif]-->\\n<!--[if IE 7]> <html class=\"no-js ie7 " +"lt-ie8 lt-ie9\"> <![endif]-->\\n<!--[if IE 8]> <html " +"class=\"no-js ie8 lt-ie9\">" msgstr "" -">>> import urllib.request\n" -">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" -"... print(f.read(300))\n" -"...\n" -"b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n\\n\\n<html\n" -"xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " -"lang=\"en\">\\n\\n<head>\\n\n" -"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" -">\\n\n" -"<title>Python Programming '" -#: ../../library/urllib.request.rst:1212 +#: ../../library/urllib.request.rst:1208 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1508,61 +1495,83 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1218 +#: ../../library/urllib.request.rst:1214 msgid "" -"The following W3C document, https://www.w3.org/International/O-charset\\ , " -"lists the various ways in which an (X)HTML or an XML document could have " +"The following HTML spec document, https://html.spec.whatwg.org/#charset, " +"lists the various ways in which an HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1222 +#: ../../library/urllib.request.rst:1218 +msgid "" +"For additional information, see the W3C document: https://www.w3.org/" +"International/questions/qa-html-encoding-declarations." +msgstr "" + +#: ../../library/urllib.request.rst:1220 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " -"tag, we will use the same for decoding the bytes object. ::" +"tag, we will use the same for decoding the bytes object::" msgstr "" -#: ../../library/urllib.request.rst:1225 +#: ../../library/urllib.request.rst:1223 msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" "...\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!-" msgstr "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" "...\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!-" -#: ../../library/urllib.request.rst:1231 +#: ../../library/urllib.request.rst:1230 msgid "" -"It is also possible to achieve the same result without using the :term:" -"`context manager` approach. ::" +"It is also possible to achieve the same result without using " +"the :term:`context manager` approach::" msgstr "" -#: ../../library/urllib.request.rst:1234 +#: ../../library/urllib.request.rst:1233 msgid "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" -">>> print(f.read(100).decode('utf-8'))\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +">>> try:\n" +"... print(f.read(100).decode('utf-8'))\n" +"... finally:\n" +"... f.close()\n" +"...\n" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!--" msgstr "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" -">>> print(f.read(100).decode('utf-8'))\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +">>> try:\n" +"... print(f.read(100).decode('utf-8'))\n" +"... finally:\n" +"... f.close()\n" +"...\n" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!--" -#: ../../library/urllib.request.rst:1240 +#: ../../library/urllib.request.rst:1244 msgid "" "In the following example, we are sending a data-stream to the stdin of a CGI " "and reading the data it returns to us. Note that this example will only work " "when the Python installation supports SSL. ::" msgstr "" -#: ../../library/urllib.request.rst:1244 +#: ../../library/urllib.request.rst:1248 msgid "" ">>> import urllib.request\n" ">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" @@ -1573,11 +1582,11 @@ msgid "" "Got Data: \"This data is passed to stdin of the CGI\"" msgstr "" -#: ../../library/urllib.request.rst:1252 +#: ../../library/urllib.request.rst:1256 msgid "The code for the sample CGI used in the above example is::" msgstr "" -#: ../../library/urllib.request.rst:1254 +#: ../../library/urllib.request.rst:1258 msgid "" "#!/usr/bin/env python\n" "import sys\n" @@ -1589,11 +1598,11 @@ msgstr "" "data = sys.stdin.read()\n" "print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" -#: ../../library/urllib.request.rst:1259 +#: ../../library/urllib.request.rst:1263 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "" -#: ../../library/urllib.request.rst:1261 +#: ../../library/urllib.request.rst:1265 msgid "" "import urllib.request\n" "DATA = b'some data'\n" @@ -1613,11 +1622,11 @@ msgstr "" "print(f.status)\n" "print(f.reason)" -#: ../../library/urllib.request.rst:1269 +#: ../../library/urllib.request.rst:1273 msgid "Use of Basic HTTP Authentication::" msgstr "" -#: ../../library/urllib.request.rst:1271 +#: ../../library/urllib.request.rst:1275 msgid "" "import urllib.request\n" "# Create an OpenerDirector with support for Basic HTTP Authentication...\n" @@ -1629,101 +1638,109 @@ msgid "" "opener = urllib.request.build_opener(auth_handler)\n" "# ...and install it globally so it can be used with urlopen.\n" "urllib.request.install_opener(opener)\n" -"urllib.request.urlopen('http://www.example.com/login.html')" +"with urllib.request.urlopen('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" -#: ../../library/urllib.request.rst:1283 +#: ../../library/urllib.request.rst:1288 msgid "" -":func:`build_opener` provides many handlers by default, including a :class:" -"`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " -"variables named ``<scheme>_proxy``, where ``<scheme>`` is the URL scheme " -"involved. For example, the :envvar:`!http_proxy` environment variable is " -"read to obtain the HTTP proxy's URL." +":func:`build_opener` provides many handlers by default, including " +"a :class:`ProxyHandler`. By default, :class:`ProxyHandler` uses the " +"environment variables named ``<scheme>_proxy``, where ``<scheme>`` is the " +"URL scheme involved. For example, the :envvar:`!http_proxy` environment " +"variable is read to obtain the HTTP proxy's URL." msgstr "" -#: ../../library/urllib.request.rst:1289 +#: ../../library/urllib.request.rst:1294 msgid "" "This example replaces the default :class:`ProxyHandler` with one that uses " "programmatically supplied proxy URLs, and adds proxy authorization support " "with :class:`ProxyBasicAuthHandler`. ::" msgstr "" -#: ../../library/urllib.request.rst:1293 +#: ../../library/urllib.request.rst:1298 msgid "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." -"com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" +"www.example.com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" "opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)\n" "# This time, rather than install the OpenerDirector, we use it directly:\n" -"opener.open('http://www.example.com/login.html')" +"with opener.open('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." -"com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" +"www.example.com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" "opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)\n" "# 這次我們直接使用它而不安裝 OpenerDirector:\n" -"opener.open('http://www.example.com/login.html')" +"with opener.open('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" -#: ../../library/urllib.request.rst:1301 +#: ../../library/urllib.request.rst:1307 msgid "Adding HTTP headers:" msgstr "" -#: ../../library/urllib.request.rst:1303 +#: ../../library/urllib.request.rst:1309 msgid "Use the *headers* argument to the :class:`Request` constructor, or::" msgstr "" -#: ../../library/urllib.request.rst:1305 +#: ../../library/urllib.request.rst:1311 msgid "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" "req.add_header('Referer', 'http://www.python.org/')\n" "# Customize the default User-Agent header value:\n" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" -"r = urllib.request.urlopen(req)" +"with urllib.request.urlopen(req) as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" "req.add_header('Referer', 'http://www.python.org/')\n" -"# Customize the default User-Agent header value:\n" +"# 自訂預設的使用者代理標頭值:\n" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" -"r = urllib.request.urlopen(req)" +"with urllib.request.urlopen(req) as f:\n" +" print(f.read().decode('utf-8'))" -#: ../../library/urllib.request.rst:1312 +#: ../../library/urllib.request.rst:1320 msgid "" ":class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header " "to every :class:`Request`. To change this::" msgstr "" -#: ../../library/urllib.request.rst:1315 +#: ../../library/urllib.request.rst:1323 msgid "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" -"opener.open('http://www.example.com/')" +"with opener.open('http://www.example.com/') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" -"opener.open('http://www.example.com/')" +"with opener.open('http://www.example.com/') as f:\n" +" print(f.read().decode('utf-8'))" -#: ../../library/urllib.request.rst:1320 +#: ../../library/urllib.request.rst:1329 msgid "" -"Also, remember that a few standard headers (:mailheader:`Content-Length`, :" -"mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" -"`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." +"Also, remember that a few standard headers (:mailheader:`Content-" +"Length`, :mailheader:`Content-Type` and :mailheader:`Host`) are added when " +"the :class:`Request` is passed to :func:`urlopen` " +"(or :meth:`OpenerDirector.open`)." msgstr "" -#: ../../library/urllib.request.rst:1327 +#: ../../library/urllib.request.rst:1336 msgid "" "Here is an example session that uses the ``GET`` method to retrieve a URL " "containing parameters::" msgstr "" -#: ../../library/urllib.request.rst:1330 +#: ../../library/urllib.request.rst:1339 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1741,14 +1758,14 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1338 +#: ../../library/urllib.request.rst:1347 msgid "" "The following example uses the ``POST`` method instead. Note that params " "output from urlencode is encoded to bytes before it is sent to urlopen as " "data::" msgstr "" -#: ../../library/urllib.request.rst:1341 +#: ../../library/urllib.request.rst:1350 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1768,13 +1785,13 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1349 +#: ../../library/urllib.request.rst:1358 msgid "" "The following example uses an explicitly specified HTTP proxy, overriding " "environment settings::" msgstr "" -#: ../../library/urllib.request.rst:1352 +#: ../../library/urllib.request.rst:1361 msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" @@ -1790,13 +1807,13 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1359 +#: ../../library/urllib.request.rst:1368 msgid "" "The following example uses no proxies at all, overriding environment " "settings::" msgstr "" -#: ../../library/urllib.request.rst:1361 +#: ../../library/urllib.request.rst:1370 msgid "" ">>> import urllib.request\n" ">>> opener = urllib.request.FancyURLopener({})\n" @@ -1810,28 +1827,28 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1369 +#: ../../library/urllib.request.rst:1378 msgid "Legacy interface" msgstr "" -#: ../../library/urllib.request.rst:1371 +#: ../../library/urllib.request.rst:1380 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -#: ../../library/urllib.request.rst:1377 +#: ../../library/urllib.request.rst:1386 msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " "Return a tuple ``(filename, headers)`` where *filename* is the local file " -"name under which the object can be found, and *headers* is whatever the :" -"meth:`!info` method of the object returned by :func:`urlopen` returned (for " -"a remote object). Exceptions are the same as for :func:`urlopen`." +"name under which the object can be found, and *headers* is whatever " +"the :meth:`!info` method of the object returned by :func:`urlopen` returned " +"(for a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1384 +#: ../../library/urllib.request.rst:1393 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -1843,34 +1860,34 @@ msgid "" "file size in response to a retrieval request." msgstr "" -#: ../../library/urllib.request.rst:1393 +#: ../../library/urllib.request.rst:1402 msgid "The following example illustrates the most common usage scenario::" msgstr "" -#: ../../library/urllib.request.rst:1395 +#: ../../library/urllib.request.rst:1404 msgid "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://python." -"org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://" +"python.org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" msgstr "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://python." -"org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://" +"python.org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" -#: ../../library/urllib.request.rst:1400 +#: ../../library/urllib.request.rst:1409 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must be a bytes object in standard :" -"mimetype:`application/x-www-form-urlencoded` format; see the :func:`urllib." -"parse.urlencode` function." +"type is ``GET``). The *data* argument must be a bytes object in " +"standard :mimetype:`application/x-www-form-urlencoded` format; see " +"the :func:`urllib.parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1406 +#: ../../library/urllib.request.rst:1415 msgid "" ":func:`urlretrieve` will raise :exc:`~urllib.error.ContentTooShortError` " "when it detects that the amount of data available was less than the " @@ -1878,40 +1895,40 @@ msgid "" "This can occur, for example, when the download is interrupted." msgstr "" -#: ../../library/urllib.request.rst:1411 +#: ../../library/urllib.request.rst:1420 msgid "" "The *Content-Length* is treated as a lower bound: if there's more data to " "read, urlretrieve reads more data, but if less data is available, it raises " "the exception." msgstr "" -#: ../../library/urllib.request.rst:1415 +#: ../../library/urllib.request.rst:1424 msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`!content` attribute of the exception instance." msgstr "" -#: ../../library/urllib.request.rst:1418 +#: ../../library/urllib.request.rst:1427 msgid "" "If no *Content-Length* header was supplied, urlretrieve can not check the " "size of the data it has downloaded, and just returns it. In this case you " "just have to assume that the download was successful." msgstr "" -#: ../../library/urllib.request.rst:1424 +#: ../../library/urllib.request.rst:1433 msgid "" "Cleans up temporary files that may have been left behind by previous calls " "to :func:`urlretrieve`." msgstr "" -#: ../../library/urllib.request.rst:1431 +#: ../../library/urllib.request.rst:1440 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " -"objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" -"`, you probably want to use :class:`FancyURLopener`." +"objects using schemes other than :file:`http:`, :file:`ftp:`, " +"or :file:`file:`, you probably want to use :class:`FancyURLopener`." msgstr "" -#: ../../library/urllib.request.rst:1435 +#: ../../library/urllib.request.rst:1444 msgid "" "By default, the :class:`URLopener` class sends a :mailheader:`User-Agent` " "header of ``urllib/VVV``, where *VVV* is the :mod:`urllib` version number. " @@ -1921,7 +1938,7 @@ msgid "" "subclass definition." msgstr "" -#: ../../library/urllib.request.rst:1441 +#: ../../library/urllib.request.rst:1450 msgid "" "The optional *proxies* parameter should be a dictionary mapping scheme names " "to proxy URLs, where an empty dictionary turns proxies off completely. Its " @@ -1929,7 +1946,7 @@ msgid "" "be used if present, as discussed in the definition of :func:`urlopen`, above." msgstr "" -#: ../../library/urllib.request.rst:1446 +#: ../../library/urllib.request.rst:1455 msgid "" "Additional keyword parameters, collected in *x509*, may be used for " "authentication of the client when using the :file:`https:` scheme. The " @@ -1937,64 +1954,64 @@ msgid "" "certificate; both are needed to support client authentication." msgstr "" -#: ../../library/urllib.request.rst:1451 +#: ../../library/urllib.request.rst:1460 msgid "" ":class:`URLopener` objects will raise an :exc:`OSError` exception if the " "server returns an error code." msgstr "" -#: ../../library/urllib.request.rst:1456 +#: ../../library/urllib.request.rst:1465 msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " "arguments. If the scheme is not recognized, :meth:`open_unknown` is called. " -"The *data* argument has the same meaning as the *data* argument of :func:" -"`urlopen`." +"The *data* argument has the same meaning as the *data* argument " +"of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1462 +#: ../../library/urllib.request.rst:1471 msgid "This method always quotes *fullurl* using :func:`~urllib.parse.quote`." msgstr "" -#: ../../library/urllib.request.rst:1466 +#: ../../library/urllib.request.rst:1475 msgid "Overridable interface to open unknown URL types." msgstr "" -#: ../../library/urllib.request.rst:1471 +#: ../../library/urllib.request.rst:1480 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " -"value is a tuple consisting of a local filename and either an :class:`email." -"message.Message` object containing the response headers (for remote URLs) or " -"``None`` (for local URLs). The caller must then open and read the contents " -"of *filename*. If *filename* is not given and the URL refers to a local " -"file, the input filename is returned. If the URL is non-local and " -"*filename* is not given, the filename is the output of :func:`tempfile." -"mktemp` with a suffix that matches the suffix of the last path component of " -"the input URL. If *reporthook* is given, it must be a function accepting " -"three numeric parameters: A chunk number, the maximum size chunks are read " -"in and the total size of the download (-1 if unknown). It will be called " -"once at the start and after each chunk of data is read from the network. " -"*reporthook* is ignored for local URLs." -msgstr "" - -#: ../../library/urllib.request.rst:1484 +"value is a tuple consisting of a local filename and either " +"an :class:`email.message.Message` object containing the response headers " +"(for remote URLs) or ``None`` (for local URLs). The caller must then open " +"and read the contents of *filename*. If *filename* is not given and the URL " +"refers to a local file, the input filename is returned. If the URL is non-" +"local and *filename* is not given, the filename is the output " +"of :func:`tempfile.mktemp` with a suffix that matches the suffix of the last " +"path component of the input URL. If *reporthook* is given, it must be a " +"function accepting three numeric parameters: A chunk number, the maximum " +"size chunks are read in and the total size of the download (-1 if unknown). " +"It will be called once at the start and after each chunk of data is read " +"from the network. *reporthook* is ignored for local URLs." +msgstr "" + +#: ../../library/urllib.request.rst:1493 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must in standard :mimetype:" -"`application/x-www-form-urlencoded` format; see the :func:`urllib.parse." -"urlencode` function." +"type is ``GET``). The *data* argument must in " +"standard :mimetype:`application/x-www-form-urlencoded` format; see " +"the :func:`urllib.parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1493 +#: ../../library/urllib.request.rst:1502 msgid "" -"Variable that specifies the user agent of the opener object. To get :mod:" -"`urllib` to tell servers that it is a particular user agent, set this in a " -"subclass as a class variable or in the constructor before calling the base " -"constructor." +"Variable that specifies the user agent of the opener object. To " +"get :mod:`urllib` to tell servers that it is a particular user agent, set " +"this in a subclass as a class variable or in the constructor before calling " +"the base constructor." msgstr "" -#: ../../library/urllib.request.rst:1503 +#: ../../library/urllib.request.rst:1512 msgid "" ":class:`FancyURLopener` subclasses :class:`URLopener` providing default " "handling for the following HTTP response codes: 301, 302, 303, 307 and 401. " @@ -2005,14 +2022,14 @@ msgid "" "defaults to 10." msgstr "" -#: ../../library/urllib.request.rst:1510 +#: ../../library/urllib.request.rst:1519 msgid "" -"For all other response codes, the method :meth:`~BaseHandler." -"http_error_default` is called which you can override in subclasses to handle " -"the error appropriately." +"For all other response codes, the " +"method :meth:`~BaseHandler.http_error_default` is called which you can " +"override in subclasses to handle the error appropriately." msgstr "" -#: ../../library/urllib.request.rst:1515 +#: ../../library/urllib.request.rst:1524 msgid "" "According to the letter of :rfc:`2616`, 301 and 302 responses to POST " "requests must not be automatically redirected without confirmation by the " @@ -2021,13 +2038,13 @@ msgid "" "behaviour." msgstr "" -#: ../../library/urllib.request.rst:1520 +#: ../../library/urllib.request.rst:1529 msgid "" -"The parameters to the constructor are the same as those for :class:" -"`URLopener`." +"The parameters to the constructor are the same as those " +"for :class:`URLopener`." msgstr "" -#: ../../library/urllib.request.rst:1524 +#: ../../library/urllib.request.rst:1533 msgid "" "When performing basic authentication, a :class:`FancyURLopener` instance " "calls its :meth:`prompt_user_passwd` method. The default implementation " @@ -2036,59 +2053,59 @@ msgid "" "needed." msgstr "" -#: ../../library/urllib.request.rst:1529 +#: ../../library/urllib.request.rst:1538 msgid "" "The :class:`FancyURLopener` class offers one additional method that should " "be overloaded to provide the appropriate behavior:" msgstr "" -#: ../../library/urllib.request.rst:1534 +#: ../../library/urllib.request.rst:1543 msgid "" "Return information needed to authenticate the user at the given host in the " "specified security realm. The return value should be a tuple, ``(user, " "password)``, which can be used for basic authentication." msgstr "" -#: ../../library/urllib.request.rst:1538 +#: ../../library/urllib.request.rst:1547 msgid "" "The implementation prompts for this information on the terminal; an " "application should override this method to use an appropriate interaction " "model in the local environment." msgstr "" -#: ../../library/urllib.request.rst:1544 +#: ../../library/urllib.request.rst:1553 msgid ":mod:`urllib.request` Restrictions" msgstr "" -#: ../../library/urllib.request.rst:1550 +#: ../../library/urllib.request.rst:1559 msgid "" "Currently, only the following protocols are supported: HTTP (versions 0.9 " "and 1.0), FTP, local files, and data URLs." msgstr "" -#: ../../library/urllib.request.rst:1553 +#: ../../library/urllib.request.rst:1562 msgid "Added support for data URLs." msgstr "" -#: ../../library/urllib.request.rst:1555 +#: ../../library/urllib.request.rst:1564 msgid "" "The caching feature of :func:`urlretrieve` has been disabled until someone " "finds the time to hack proper processing of Expiration time headers." msgstr "" -#: ../../library/urllib.request.rst:1558 +#: ../../library/urllib.request.rst:1567 msgid "" "There should be a function to query whether a particular URL is in the cache." msgstr "" -#: ../../library/urllib.request.rst:1560 +#: ../../library/urllib.request.rst:1569 msgid "" "For backward compatibility, if a URL appears to point to a local file but " "the file can't be opened, the URL is re-interpreted using the FTP protocol. " "This can sometimes cause confusing error messages." msgstr "" -#: ../../library/urllib.request.rst:1564 +#: ../../library/urllib.request.rst:1573 msgid "" "The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily " "long delays while waiting for a network connection to be set up. This means " @@ -2096,17 +2113,17 @@ msgid "" "functions without using threads." msgstr "" -#: ../../library/urllib.request.rst:1573 +#: ../../library/urllib.request.rst:1582 msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " "text or (for example) HTML. The HTTP protocol provides type information in " -"the reply header, which can be inspected by looking at the :mailheader:" -"`Content-Type` header. If the returned data is HTML, you can use the " -"module :mod:`html.parser` to parse it." +"the reply header, which can be inspected by looking at " +"the :mailheader:`Content-Type` header. If the returned data is HTML, you " +"can use the module :mod:`html.parser` to parse it." msgstr "" -#: ../../library/urllib.request.rst:1582 +#: ../../library/urllib.request.rst:1591 msgid "" "The code handling the FTP protocol cannot differentiate between a file and a " "directory. This can lead to unexpected behavior when attempting to read a " @@ -2124,59 +2141,86 @@ msgid "" "meet your needs." msgstr "" -#: ../../library/urllib.request.rst:1599 +#: ../../library/urllib.request.rst:1608 msgid ":mod:`urllib.response` --- Response classes used by urllib" msgstr "" -#: ../../library/urllib.request.rst:1604 +#: ../../library/urllib.request.rst:1613 msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " -"Functions defined by this module are used internally by the :mod:`urllib." -"request` module. The typical response object is a :class:`urllib.response." -"addinfourl` instance:" +"Functions defined by this module are used internally by " +"the :mod:`urllib.request` module. The typical response object is " +"a :class:`urllib.response.addinfourl` instance:" msgstr "" -#: ../../library/urllib.request.rst:1613 +#: ../../library/urllib.request.rst:1622 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/urllib.request.rst:1617 +#: ../../library/urllib.request.rst:1626 msgid "" -"Returns the headers of the response in the form of an :class:`~email.message." -"EmailMessage` instance." +"Returns the headers of the response in the form of " +"an :class:`~email.message.EmailMessage` instance." msgstr "" -#: ../../library/urllib.request.rst:1623 +#: ../../library/urllib.request.rst:1632 msgid "Status code returned by server." msgstr "" -#: ../../library/urllib.request.rst:1627 +#: ../../library/urllib.request.rst:1636 msgid "Deprecated in favor of :attr:`~addinfourl.url`." msgstr "" -#: ../../library/urllib.request.rst:1632 +#: ../../library/urllib.request.rst:1641 msgid "Deprecated in favor of :attr:`~addinfourl.headers`." msgstr "" -#: ../../library/urllib.request.rst:1637 ../../library/urllib.request.rst:1642 +#: ../../library/urllib.request.rst:1646 ../../library/urllib.request.rst:1651 msgid "Deprecated in favor of :attr:`~addinfourl.status`." msgstr "" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1578 msgid "HTTP" msgstr "HTTP" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1578 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1580 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1589 msgid "FTP" msgstr "FTP" -#: ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1578 msgid "HTML" msgstr "HTML" + +#~ msgid "" +#~ ">>> import urllib.request\n" +#~ ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" +#~ "... print(f.read(300))\n" +#~ "...\n" +#~ "b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +#~ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" +#~ "transitional.dtd\">\\n\\n\\n<html\n" +#~ "xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " +#~ "lang=\"en\">\\n\\n<head>\\n\n" +#~ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" +#~ ">\\n\n" +#~ "<title>Python Programming '" +#~ msgstr "" +#~ ">>> import urllib.request\n" +#~ ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" +#~ "... print(f.read(300))\n" +#~ "...\n" +#~ "b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +#~ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" +#~ "transitional.dtd\">\\n\\n\\n<html\n" +#~ "xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " +#~ "lang=\"en\">\\n\\n<head>\\n\n" +#~ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" +#~ ">\\n\n" +#~ "<title>Python Programming '" diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 0d17e17856..7f42925a3f 100644 --- a/library/urllib.robotparser.po +++ b/library/urllib.robotparser.po @@ -81,7 +81,7 @@ msgstr "" #: ../../library/urllib.robotparser.rst:57 msgid "" "Sets the time the ``robots.txt`` file was last fetched to the current time." -msgstr "將最近一次 fetch ``robots.txt`` 文件的時間設置為當前時間。" +msgstr "將最近一次 fetch ``robots.txt`` 文件的時間設置為目前時間。" #: ../../library/urllib.robotparser.rst:62 msgid "" diff --git a/library/uuid.po b/library/uuid.po index e3274d2fbf..6f5ae1103d 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-02-26 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,18 +29,18 @@ msgstr "**原始碼:**\\ :source:`Lib/uuid.py`" #: ../../library/uuid.rst:13 msgid "" "This module provides immutable :class:`UUID` objects (the :class:`UUID` " -"class) and the functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:" -"`uuid5` for generating version 1, 3, 4, and 5 UUIDs as specified in :rfc:" -"`4122`." +"class) and the " +"functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:`uuid5` for " +"generating version 1, 3, 4, and 5 UUIDs as specified in :rfc:`4122`." msgstr "" -"這個模組提供了不可變的 :class:`UUID` 物件(:class:`UUID` 類別)和 :func:" -"`uuid1`、:func:`uuid3`、:func:`uuid4`、:func:`uuid5` 等函式,用於生成 :rfc:" -"`4122` 定義的第 1、3、4、5 版本的 UUID。" +"這個模組提供了不可變的 :class:`UUID` 物件(:class:`UUID` 類別)" +"和 :func:`uuid1`、:func:`uuid3`、:func:`uuid4`、:func:`uuid5` 等函式,用於生" +"成 :rfc:`4122` 定義的第 1、3、4、5 版本的 UUID。" #: ../../library/uuid.rst:17 msgid "" -"If all you want is a unique ID, you should probably call :func:`uuid1` or :" -"func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " +"If all you want is a unique ID, you should probably call :func:`uuid1` " +"or :func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " "creates a UUID containing the computer's network address. :func:`uuid4` " "creates a random UUID." msgstr "" @@ -58,7 +58,7 @@ msgid "" "enumeration:" msgstr "" "根據底層平台的支援情況,:func:`uuid1` 可能會也可能不會回傳一個「安全的」" -"UUID。安全的 UUID 是使用同步方法生成的,以確保不會有兩個行程獲取到相同的 " +"UUID。安全的 UUID 是使用同步方法生成的,以確保不會有兩個行程取得到相同的 " "UUID。所有 :class:`UUID` 的實例都有一個 :attr:`~UUID.is_safe` 屬性,該屬性使" "用下面這個列舉來傳遞有關 UUID 安全性的任何資訊:" @@ -130,9 +130,9 @@ msgstr "" #: ../../library/uuid.rst:71 msgid "" -"Comparison of UUID objects are made by way of comparing their :attr:`UUID." -"int` attributes. Comparison with a non-UUID object raises a :exc:" -"`TypeError`." +"Comparison of UUID objects are made by way of comparing " +"their :attr:`UUID.int` attributes. Comparison with a non-UUID object raises " +"a :exc:`TypeError`." msgstr "" "UUID 物件之間的比較是透過比較它們的 :attr:`UUID.int` 屬性。與非 UUID 的物件進" "行比較會引發 :exc:`TypeError`。" @@ -220,17 +220,18 @@ msgstr "UUID 以 :rfc:`4122` 中指定的 URN 形式表示。" #: ../../library/uuid.rst:145 msgid "" "The UUID variant, which determines the internal layout of the UUID. This " -"will be one of the constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :" -"const:`RESERVED_MICROSOFT`, or :const:`RESERVED_FUTURE`." +"will be one of the " +"constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :const:`RESERVED_MICROSOFT`, " +"or :const:`RESERVED_FUTURE`." msgstr "" -"UUID 的變體,決定 UUID 內部的佈局 (layout),是 :const:`RESERVED_NCS`、:const:" -"`RFC_4122`、:const:`RESERVED_MICROSOFT` 或 :const:`RESERVED_FUTURE` 其中一個" -"常數。" +"UUID 的變體,決定 UUID 內部的佈局 (layout)," +"是 :const:`RESERVED_NCS`、:const:`RFC_4122`、:const:`RESERVED_MICROSOFT` " +"或 :const:`RESERVED_FUTURE` 其中一個常數。" #: ../../library/uuid.rst:152 msgid "" -"The UUID version number (1 through 5, meaningful only when the variant is :" -"const:`RFC_4122`)." +"The UUID version number (1 through 5, meaningful only when the variant " +"is :const:`RFC_4122`)." msgstr "UUID 的版本號(1 到 5,只有當變體是 :const:`RFC_4122` 時才有意義)。" #: ../../library/uuid.rst:157 @@ -256,7 +257,7 @@ msgid "" "locally administered MAC addresses, but with no other ordering guarantees." msgstr "" "取得 48 位元正整數形式的硬體位址。第一次執行時,有可能會啟動一個獨立的程式," -"這也許會相當耗時。如果所有獲取硬體位址的嘗試都失敗,我們會根據 :rfc:`4122` 中" +"這也許會相當耗時。如果所有取得硬體位址的嘗試都失敗,我們會根據 :rfc:`4122` 中" "的建議,使用一個 48 位元的隨機數,其中群播位元 (multicast bit)(第一個八位元" "組的最低有效位)設置為 1。「硬體位址」指的是網路介面 (network interface) 的 " "MAC 位址。在具有多個網路介面的機器上,將優先選擇通用管理 (universally " @@ -273,31 +274,31 @@ msgstr "" "通用管理的 MAC 位址優於本地管理的 MAC 位址,因為前者保證是全球唯一的,而後者" "不是。" -#: ../../library/uuid.rst:187 +#: ../../library/uuid.rst:185 msgid "" "Generate a UUID from a host ID, sequence number, and the current time. If " "*node* is not given, :func:`getnode` is used to obtain the hardware address. " "If *clock_seq* is given, it is used as the sequence number; otherwise a " "random 14-bit sequence number is chosen." msgstr "" -"從主機 ID、序列號和當前時間生成 UUID。如果未給定 *node*,將使用 :func:" -"`getnode` 獲取硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則將使用一" -"個隨機 14 位元的序列號。" +"從主機 ID、序列號和目前時間生成 UUID。如果未給定 *node*,將使" +"用 :func:`getnode` 取得硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則" +"將使用一個隨機 14 位元的序列號。" -#: ../../library/uuid.rst:197 +#: ../../library/uuid.rst:193 msgid "" "Generate a UUID based on the MD5 hash of a namespace identifier (which is a " "UUID) and a name (which is a :class:`bytes` object or a string that will be " "encoded using UTF-8)." msgstr "" -"基於命名空間識別碼 (namespace identifier)(一個 UUID)和名稱(一個 :class:" -"`bytes` 物件或使用 UTF-8 編碼的字串)的 MD5 hash 來生成 UUID。" +"基於命名空間識別碼 (namespace identifier)(一個 UUID)和名稱(一" +"個 :class:`bytes` 物件或使用 UTF-8 編碼的字串)的 MD5 hash 來生成 UUID。" -#: ../../library/uuid.rst:206 +#: ../../library/uuid.rst:200 msgid "Generate a random UUID." msgstr "生成一個隨機的 UUID。" -#: ../../library/uuid.rst:213 +#: ../../library/uuid.rst:205 msgid "" "Generate a UUID based on the SHA-1 hash of a namespace identifier (which is " "a UUID) and a name (which is a :class:`bytes` object or a string that will " @@ -306,7 +307,7 @@ msgstr "" "基於命名空間識別碼(一個 UUID)和名稱(一個 :class:`bytes` 物件或使用 UTF-8 " "編碼的字串)的 SHA-1 hash 來生成 UUID。" -#: ../../library/uuid.rst:219 +#: ../../library/uuid.rst:210 msgid "" "The :mod:`uuid` module defines the following namespace identifiers for use " "with :func:`uuid3` or :func:`uuid5`." @@ -314,7 +315,7 @@ msgstr "" ":mod:`uuid` 模組為 :func:`uuid3` 或 :func:`uuid5` 定義了以下的命名空間識別" "碼。" -#: ../../library/uuid.rst:225 +#: ../../library/uuid.rst:216 msgid "" "When this namespace is specified, the *name* string is a fully qualified " "domain name." @@ -322,50 +323,50 @@ msgstr "" "當指定這個命名空間時,*name* 字串是一個完整網域名稱 (fully qualified domain " "name)。" -#: ../../library/uuid.rst:231 +#: ../../library/uuid.rst:222 msgid "When this namespace is specified, the *name* string is a URL." msgstr "當指定這個命名空間時,*name* 字串是一個 URL。" -#: ../../library/uuid.rst:236 +#: ../../library/uuid.rst:227 msgid "When this namespace is specified, the *name* string is an ISO OID." msgstr "當指定這個命名空間時,*name* 字串是一個 ISO OID。" -#: ../../library/uuid.rst:241 +#: ../../library/uuid.rst:232 msgid "" "When this namespace is specified, the *name* string is an X.500 DN in DER or " "a text output format." msgstr "" "當指定這個命名空間時,*name* 字串是以 DER 或文字輸出格式表示的 X.500 DN。" -#: ../../library/uuid.rst:244 +#: ../../library/uuid.rst:235 msgid "" "The :mod:`uuid` module defines the following constants for the possible " "values of the :attr:`~UUID.variant` attribute:" msgstr ":mod:`uuid` 模組為 :attr:`~UUID.variant` 屬性的可能值定義了以下常數:" -#: ../../library/uuid.rst:250 +#: ../../library/uuid.rst:241 msgid "Reserved for NCS compatibility." msgstr "保留供 NCS 相容性使用。" -#: ../../library/uuid.rst:255 +#: ../../library/uuid.rst:246 msgid "Specifies the UUID layout given in :rfc:`4122`." msgstr "使用在 :rfc:`4122` 中給定的 UUID 佈局。" -#: ../../library/uuid.rst:260 +#: ../../library/uuid.rst:251 msgid "Reserved for Microsoft compatibility." msgstr "保留供 Microsoft 相容性使用。" -#: ../../library/uuid.rst:265 +#: ../../library/uuid.rst:256 msgid "Reserved for future definition." msgstr "保留供未來定義使用。" -#: ../../library/uuid.rst:270 +#: ../../library/uuid.rst:261 msgid ":rfc:`4122` - A Universally Unique IDentifier (UUID) URN Namespace" msgstr "" ":rfc:`4122` - 通用唯一辨識碼 (UUID, Universally Unique IDentifier) 的 URN 命" "名空間" -#: ../../library/uuid.rst:271 +#: ../../library/uuid.rst:262 msgid "" "This specification defines a Uniform Resource Name namespace for UUIDs, the " "internal format of UUIDs, and methods of generating UUIDs." @@ -373,36 +374,36 @@ msgstr "" "這個規範定義了 UUID 的統一資源名稱 (Uniform Resource Name) 命名空間、UUID 的" "內部格式和生成 UUID 的方法。" -#: ../../library/uuid.rst:278 +#: ../../library/uuid.rst:269 msgid "Command-Line Usage" msgstr "命令列的用法" -#: ../../library/uuid.rst:282 +#: ../../library/uuid.rst:273 msgid "" "The :mod:`uuid` module can be executed as a script from the command line." msgstr ":mod:`uuid` 模組可以在命令列下作為腳本來執行。" -#: ../../library/uuid.rst:284 +#: ../../library/uuid.rst:275 msgid "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]" msgstr "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]" -#: ../../library/uuid.rst:288 +#: ../../library/uuid.rst:279 msgid "The following options are accepted:" msgstr "可以接受以下選項:" -#: ../../library/uuid.rst:294 +#: ../../library/uuid.rst:285 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/uuid.rst:299 +#: ../../library/uuid.rst:290 msgid "" -"Specify the function name to use to generate the uuid. By default :func:" -"`uuid4` is used." +"Specify the function name to use to generate the uuid. By " +"default :func:`uuid4` is used." msgstr "指定要用來生成 UUID 的函式名稱。預設使用 :func:`uuid4`。" -#: ../../library/uuid.rst:305 +#: ../../library/uuid.rst:296 msgid "" "The namespace is a ``UUID``, or ``@ns`` where ``ns`` is a well-known " "predefined UUID addressed by namespace name. Such as ``@dns``, ``@url``, " @@ -410,24 +411,24 @@ msgid "" "functions." msgstr "" "該命名空間是一個 ``UUID`` 或 ``@ns``,其中 ``ns`` 是指知名預定義 UUID 的命名" -"空間名稱,例如 ``@dns``、``@url``、``@oid`` 和 ``@x500``。 只有 :func:" -"`uuid3` / :func:`uuid5` 函式會需要。" +"空間名稱,例如 ``@dns``、``@url``、``@oid`` 和 ``@x500``。 只" +"有 :func:`uuid3` / :func:`uuid5` 函式會需要。" -#: ../../library/uuid.rst:312 +#: ../../library/uuid.rst:303 msgid "" -"The name used as part of generating the uuid. Only required for :func:" -"`uuid3` / :func:`uuid5` functions." +"The name used as part of generating the uuid. Only required " +"for :func:`uuid3` / :func:`uuid5` functions." msgstr "用於生成 uuid 的名稱。只有 :func:`uuid3` / :func:`uuid5` 函式會需要。" -#: ../../library/uuid.rst:319 +#: ../../library/uuid.rst:310 msgid "Example" msgstr "範例" -#: ../../library/uuid.rst:321 +#: ../../library/uuid.rst:312 msgid "Here are some examples of typical usage of the :mod:`uuid` module::" msgstr "以下是一些 :mod:`uuid` 模組的典型使用範例: ::" -#: ../../library/uuid.rst:323 +#: ../../library/uuid.rst:314 msgid "" ">>> import uuid\n" "\n" @@ -462,18 +463,50 @@ msgid "" ">>> uuid.UUID(bytes=x.bytes)\n" "UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')" msgstr "" +">>> import uuid\n" +"\n" +">>> # 基於主機 ID 和目前時間生成 UUID\n" +">>> uuid.uuid1()\n" +"UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n" +"\n" +">>> # 使用命名空間 UUID 的 MD5 雜湊和一個名稱生成 UUID\n" +">>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n" +"\n" +">>> # 生成一個隨機的 UUID\n" +">>> uuid.uuid4()\n" +"UUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n" +"\n" +">>> # 使用命名空間 UUID 的 SHA-1 雜湊和一個名稱生成 UUID\n" +">>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n" +"\n" +">>> # 從十六進位數字組成的字串生成 UUID(大括號和連字符號會被忽略)\n" +">>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')\n" +"\n" +">>> # 將 UUID 轉換為標準形式的十六進位數字字串\n" +">>> str(x)\n" +"'00010203-0405-0607-0809-0a0b0c0d0e0f'\n" +"\n" +">>> # 取得 UUID 的原始 16 位元組\n" +">>> x.bytes\n" +"b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n" +"\n" +">>> # 從 16 位元組的字串生成 UUID\n" +">>> uuid.UUID(bytes=x.bytes)\n" +"UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')" -#: ../../library/uuid.rst:360 +#: ../../library/uuid.rst:351 msgid "Command-Line Example" msgstr "命令列的範例" -#: ../../library/uuid.rst:362 +#: ../../library/uuid.rst:353 msgid "" "Here are some examples of typical usage of the :mod:`uuid` command line " "interface:" msgstr "以下是一些 :mod:`uuid` 命令列介面的典型使用範例:" -#: ../../library/uuid.rst:364 +#: ../../library/uuid.rst:355 msgid "" "# generate a random uuid - by default uuid4() is used\n" "$ python -m uuid\n" @@ -484,23 +517,11 @@ msgid "" "# generate a uuid using uuid5\n" "$ python -m uuid -u uuid5 -n @url -N example.com" msgstr "" - -#: ../../library/uuid.rst:182 -msgid "getnode" -msgstr "getnode" - -#: ../../library/uuid.rst:192 -msgid "uuid1" -msgstr "uuid1" - -#: ../../library/uuid.rst:201 -msgid "uuid3" -msgstr "uuid3" - -#: ../../library/uuid.rst:208 -msgid "uuid4" -msgstr "uuid4" - -#: ../../library/uuid.rst:217 -msgid "uuid5" -msgstr "uuid5" +"# 生成一個隨機的 uuid - 預設使用 uuid4()\n" +"$ python -m uuid\n" +"\n" +"# 使用 uuid1() 生成一組 uuid\n" +"$ python -m uuid -u uuid1\n" +"\n" +"# 使用 uuid5 生成一組 uuid\n" +"$ python -m uuid -u uuid5 -n @url -N example.com" diff --git a/library/venv.po b/library/venv.po index 0ed5da76cd..d3bcb61ca0 100644 --- a/library/venv.po +++ b/library/venv.po @@ -316,7 +316,7 @@ msgid "" "Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be " "invoked to bootstrap ``pip`` into the virtual environment." msgstr "" -"除非 ``--without-pip`` 選項被提供,否則將調用 :mod:`ensurepip` 來啟動 " +"除非 ``--without-pip`` 選項被提供,否則將叫用 :mod:`ensurepip` 來啟動 " "``pip`` 到虛擬環境中。" #: ../../library/venv.rst:182 @@ -358,7 +358,7 @@ msgid "" msgstr "" "虛擬環境可以透過位於二進位檔案目錄中的腳本「啟用」(在 POSIX 上為 ``bin``;" "在 Windows 上為 ``Scripts``)這會將該目錄加入到你的 :envvar:`PATH`,當你運" -"行 :program:`python` 時就會調用該環境的直譯器並且執行已安裝的腳本,而不需要使" +"行 :program:`python` 時就會叫用該環境的直譯器並且執行已安裝的腳本,而不需要使" "用完整的路徑。啟動腳本的方式因平台而異(:samp:`{<venv>}` 需要替換成包含虛擬環" "境的目錄路徑)" @@ -447,7 +447,7 @@ msgid "" "invoking Python. Furthermore, all scripts installed in the environment " "should be runnable without activating it." msgstr "" -"你不用特別開啟虛擬環境,你可以在調用 Python 時指定該環境下 Python 直譯器的完" +"你不用特別開啟虛擬環境,你可以在呼叫 Python 時指定該環境下 Python 直譯器的完" "整路徑。此外,所有安裝在環境裡的腳本都應該都可以在未啟用虛擬環境的情況下運" "行。" @@ -583,7 +583,7 @@ msgid "" "current directory is used as the prompt." msgstr "" "*prompt* -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設為 " -"``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當前目" +"``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則目前目" "錄的 basename 會做為提示路徑使用。" #: ../../library/venv.rst:313 diff --git a/library/warnings.po b/library/warnings.po index 914b791ce7..35a798ed78 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -38,16 +38,16 @@ msgstr "" #: ../../library/warnings.rst:18 msgid "" "Python programmers issue warnings by calling the :func:`warn` function " -"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; see :ref:" -"`exceptionhandling` for details)." +"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; " +"see :ref:`exceptionhandling` for details)." msgstr "" #: ../../library/warnings.rst:22 msgid "" "Warning messages are normally written to :data:`sys.stderr`, but their " "disposition can be changed flexibly, from ignoring all warnings to turning " -"them into exceptions. The disposition of warnings can vary based on the :" -"ref:`warning category <warning-categories>`, the text of the warning " +"them into exceptions. The disposition of warnings can vary based on " +"the :ref:`warning category <warning-categories>`, the text of the warning " "message, and the source location where it is issued. Repetitions of a " "particular warning for the same source location are typically suppressed." msgstr "" @@ -62,11 +62,11 @@ msgstr "" #: ../../library/warnings.rst:33 msgid "" -"The determination whether to issue a warning message is controlled by the :" -"ref:`warning filter <warning-filter>`, which is a sequence of matching rules " -"and actions. Rules can be added to the filter by calling :func:" -"`filterwarnings` and reset to its default state by calling :func:" -"`resetwarnings`." +"The determination whether to issue a warning message is controlled by " +"the :ref:`warning filter <warning-filter>`, which is a sequence of matching " +"rules and actions. Rules can be added to the filter by " +"calling :func:`filterwarnings` and reset to its default state by " +"calling :func:`resetwarnings`." msgstr "" #: ../../library/warnings.rst:38 @@ -113,7 +113,7 @@ msgstr "" #: ../../library/warnings.rst:69 msgid "Class" -msgstr "" +msgstr "類別" #: ../../library/warnings.rst:69 msgid "Description" @@ -315,10 +315,10 @@ msgstr "" #: ../../library/warnings.rst:156 msgid "" "*message* is a string containing a regular expression that the start of the " -"warning message must match, case-insensitively. In :option:`-W` and :envvar:" -"`PYTHONWARNINGS`, *message* is a literal string that the start of the " -"warning message must contain (case-insensitively), ignoring any whitespace " -"at the start or end of *message*." +"warning message must match, case-insensitively. In :option:`-W` " +"and :envvar:`PYTHONWARNINGS`, *message* is a literal string that the start " +"of the warning message must contain (case-insensitively), ignoring any " +"whitespace at the start or end of *message*." msgstr "" #: ../../library/warnings.rst:162 @@ -409,11 +409,11 @@ msgstr "action:message:category:module:line" #: ../../library/warnings.rst:211 msgid "" "The meaning of each of these fields is as described in :ref:`warning-" -"filter`. When listing multiple filters on a single line (as for :envvar:" -"`PYTHONWARNINGS`), the individual filters are separated by commas and the " -"filters listed later take precedence over those listed before them (as " -"they're applied left-to-right, and the most recently applied filters take " -"precedence over earlier ones)." +"filter`. When listing multiple filters on a single line (as " +"for :envvar:`PYTHONWARNINGS`), the individual filters are separated by " +"commas and the filters listed later take precedence over those listed before " +"them (as they're applied left-to-right, and the most recently applied " +"filters take precedence over earlier ones)." msgstr "" #: ../../library/warnings.rst:218 @@ -475,8 +475,8 @@ msgstr "" #: ../../library/warnings.rst:251 msgid "" -":exc:`DeprecationWarning` is now ignored by default in addition to :exc:" -"`PendingDeprecationWarning`." +":exc:`DeprecationWarning` is now ignored by default in addition " +"to :exc:`PendingDeprecationWarning`." msgstr "" #: ../../library/warnings.rst:255 @@ -500,10 +500,10 @@ msgstr "" msgid "" "Developers of applications written in Python may wish to hide *all* Python " "level warnings from their users by default, and only display them when " -"running tests or otherwise working on the application. The :data:`sys." -"warnoptions` attribute used to pass filter configurations to the interpreter " -"can be used as a marker to indicate whether or not warnings should be " -"disabled::" +"running tests or otherwise working on the application. " +"The :data:`sys.warnoptions` attribute used to pass filter configurations to " +"the interpreter can be used as a marker to indicate whether or not warnings " +"should be disabled::" msgstr "" #: ../../library/warnings.rst:276 @@ -599,7 +599,7 @@ msgstr "" #: ../../library/warnings.rst:334 msgid "Testing Warnings" -msgstr "" +msgstr "測試警告" #: ../../library/warnings.rst:336 msgid "" @@ -766,8 +766,8 @@ msgstr "" #: ../../library/warnings.rst:457 ../../library/warnings.rst:483 msgid "" -"*source*, if supplied, is the destroyed object which emitted a :exc:" -"`ResourceWarning`." +"*source*, if supplied, is the destroyed object which emitted " +"a :exc:`ResourceWarning`." msgstr "" #: ../../library/warnings.rst:460 @@ -800,26 +800,26 @@ msgstr "" #: ../../library/warnings.rst:486 msgid "Add the *source* parameter." -msgstr "" +msgstr "新增 *source* 參數。" #: ../../library/warnings.rst:492 msgid "" "Write a warning to a file. The default implementation calls " "``formatwarning(message, category, filename, lineno, line)`` and writes the " "resulting string to *file*, which defaults to :data:`sys.stderr`. You may " -"replace this function with any callable by assigning to ``warnings." -"showwarning``. *line* is a line of source code to be included in the warning " -"message; if *line* is not supplied, :func:`showwarning` will try to read the " -"line specified by *filename* and *lineno*." +"replace this function with any callable by assigning to " +"``warnings.showwarning``. *line* is a line of source code to be included in " +"the warning message; if *line* is not supplied, :func:`showwarning` will try " +"to read the line specified by *filename* and *lineno*." msgstr "" #: ../../library/warnings.rst:503 msgid "" "Format a warning the standard way. This returns a string which may contain " "embedded newlines and ends in a newline. *line* is a line of source code to " -"be included in the warning message; if *line* is not supplied, :func:" -"`formatwarning` will try to read the line specified by *filename* and " -"*lineno*." +"be included in the warning message; if *line* is not " +"supplied, :func:`formatwarning` will try to read the line specified by " +"*filename* and *lineno*." msgstr "" #: ../../library/warnings.rst:512 @@ -837,10 +837,10 @@ msgstr "" #: ../../library/warnings.rst:524 msgid "" "Insert a simple entry into the list of :ref:`warnings filter specifications " -"<warning-filter>`. The meaning of the function parameters is as for :func:" -"`filterwarnings`, but regular expressions are not needed as the filter " -"inserted always matches any message in any module as long as the category " -"and line number match." +"<warning-filter>`. The meaning of the function parameters is as " +"for :func:`filterwarnings`, but regular expressions are not needed as the " +"filter inserted always matches any message in any module as long as the " +"category and line number match." msgstr "" #: ../../library/warnings.rst:533 @@ -902,9 +902,9 @@ msgstr "" msgid "" "The deprecation message passed to the decorator is saved in the " "``__deprecated__`` attribute on the decorated object. If applied to an " -"overload, the decorator must be after the :func:`@overload <typing." -"overload>` decorator for the attribute to exist on the overload as returned " -"by :func:`typing.get_overloads`." +"overload, the decorator must be after the :func:`@overload " +"<typing.overload>` decorator for the attribute to exist on the overload as " +"returned by :func:`typing.get_overloads`." msgstr "" #: ../../library/warnings.rst:584 @@ -918,12 +918,13 @@ msgstr "" #: ../../library/warnings.rst:593 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " -"and the :func:`showwarning` function. If the *record* argument is :const:" -"`False` (the default) the context manager returns :class:`None` on entry. If " -"*record* is :const:`True`, a list is returned that is progressively " -"populated with objects as seen by a custom :func:`showwarning` function " -"(which also suppresses output to ``sys.stdout``). Each object in the list " -"has attributes with the same names as the arguments to :func:`showwarning`." +"and the :func:`showwarning` function. If the *record* argument " +"is :const:`False` (the default) the context manager returns :class:`None` on " +"entry. If *record* is :const:`True`, a list is returned that is " +"progressively populated with objects as seen by a custom :func:`showwarning` " +"function (which also suppresses output to ``sys.stdout``). Each object in " +"the list has attributes with the same names as the arguments " +"to :func:`showwarning`." msgstr "" #: ../../library/warnings.rst:602 diff --git a/library/wave.po b/library/wave.po index d2fee008a9..f397aec31b 100644 --- a/library/wave.po +++ b/library/wave.po @@ -99,8 +99,8 @@ msgstr "" #: ../../library/wave.rst:48 msgid "" "The :func:`.open` function may be used in a :keyword:`with` statement. When " -"the :keyword:`!with` block completes, the :meth:`Wave_read.close` or :meth:" -"`Wave_write.close` method is called." +"the :keyword:`!with` block completes, the :meth:`Wave_read.close` " +"or :meth:`Wave_write.close` method is called." msgstr "" ":func:`.open` 函式可以在 :keyword:`with` 陳述式中使用。當 :keyword:`!with` 區" "塊完成時,會呼叫 :meth:`Wave_read.close` 或是 :meth:`Wave_write.close` 方法。" @@ -181,22 +181,23 @@ msgid "Rewind the file pointer to the beginning of the audio stream." msgstr "重置檔案指標至音訊流的開頭。" #: ../../library/wave.rst:126 -#, fuzzy msgid "" "The following two methods are defined for compatibility with the old :mod:`!" "aifc` module, and don't do anything interesting." -msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" +msgstr "" +"以下兩個方法是為了與舊的 :mod:`!aifc` 模組保持相容性,並不執行任何操作。" #: ../../library/wave.rst:132 msgid "Returns ``None``." msgstr "回傳 ``None``。" #: ../../library/wave.rst:134 ../../library/wave.rst:143 -#, fuzzy msgid "" "The method only existed for compatibility with the :mod:`!aifc` module which " "has been removed in Python 3.13." -msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" +msgstr "" +"該方法是為了保持與 :mod:`!aifc` 模組相容性而留存,此模組已於 Python 3.13 中刪" +"除。" #: ../../library/wave.rst:141 msgid "Raise an error." @@ -235,21 +236,22 @@ msgid "" "For seekable output streams, the ``wave`` header will automatically be " "updated to reflect the number of frames actually written. For unseekable " "streams, the *nframes* value must be accurate when the first frame data is " -"written. An accurate *nframes* value can be achieved either by calling :" -"meth:`setnframes` or :meth:`setparams` with the number of frames that will " -"be written before :meth:`close` is called and then using :meth:" -"`writeframesraw` to write the frame data, or by calling :meth:`writeframes` " -"with all of the frame data to be written. In the latter case :meth:" -"`writeframes` will calculate the number of frames in the data and set " -"*nframes* accordingly before writing the frame data." +"written. An accurate *nframes* value can be achieved either by " +"calling :meth:`setnframes` or :meth:`setparams` with the number of frames " +"that will be written before :meth:`close` is called and then " +"using :meth:`writeframesraw` to write the frame data, or by " +"calling :meth:`writeframes` with all of the frame data to be written. In " +"the latter case :meth:`writeframes` will calculate the number of frames in " +"the data and set *nframes* accordingly before writing the frame data." msgstr "" "對於可搜尋 (seekable) 的輸出串流,``wave`` 標頭將自動更新,以反映實際寫入的幀" "數。對於不可搜尋的串流,當寫入第一個幀資料時,*nframes* 的值必須是準確的。要" -"取得準確的 *nframes* 值,可以通過呼叫 :meth:`setnframes` 或 :meth:" -"`setparams` 方法,並在呼叫 :meth:`close` 之前設定將寫入的幀數量,然後使用 :" -"meth:`writeframesraw` 方法寫入幀資料;或者通過呼叫 :meth:`writeframes` 方法一" -"次性寫入所有的幀資料。在後一種情況下,:meth:`writeframes` 方法將計算資料中的" -"幀數量,並在寫入幀資料之前相應地設定 *nframes* 的值。" +"取得準確的 *nframes* 值,可以通過呼叫 :meth:`setnframes` " +"或 :meth:`setparams` 方法,並在呼叫 :meth:`close` 之前設定將寫入的幀數量,然" +"後使用 :meth:`writeframesraw` 方法寫入幀資料;或者通過呼" +"叫 :meth:`writeframes` 方法一次性寫入所有的幀資料。在後一種情況" +"下,:meth:`writeframes` 方法將計算資料中的幀數量,並在寫入幀資料之前相應地設" +"定 *nframes* 的值。" #: ../../library/wave.rst:187 msgid "Wave_write objects have the following methods:" @@ -257,10 +259,10 @@ msgstr "Wave_write 物件具有以下方法:" #: ../../library/wave.rst:191 msgid "" -"Make sure *nframes* is correct, and close the file if it was opened by :mod:" -"`wave`. This method is called upon object collection. It will raise an " -"exception if the output stream is not seekable and *nframes* does not match " -"the number of frames actually written." +"Make sure *nframes* is correct, and close the file if it was opened " +"by :mod:`wave`. This method is called upon object collection. It will " +"raise an exception if the output stream is not seekable and *nframes* does " +"not match the number of frames actually written." msgstr "" "確保 *nframes* 正確,如果該檔案是由 :mod:`wave` 開啟的,則關閉該檔案。此方法" "在物件回收時被呼叫。如果輸出串流不可搜尋且 *nframes* 不符合實際寫入的幀數,則" @@ -308,11 +310,11 @@ msgstr "" #: ../../library/wave.rst:238 msgid "" -"Return current position in the file, with the same disclaimer for the :meth:" -"`Wave_read.tell` and :meth:`Wave_read.setpos` methods." +"Return current position in the file, with the same disclaimer for " +"the :meth:`Wave_read.tell` and :meth:`Wave_read.setpos` methods." msgstr "" -"回傳檔案中的指標位置,其指標位置含意與 :meth:`Wave_read.tell` 和 :meth:" -"`Wave_read.setpos` 是一致的。" +"回傳檔案中的指標位置,其指標位置含意與 :meth:`Wave_read.tell` " +"和 :meth:`Wave_read.setpos` 是一致的。" #: ../../library/wave.rst:244 msgid "Write audio frames, without correcting *nframes*." @@ -334,9 +336,9 @@ msgstr "" #: ../../library/wave.rst:260 msgid "" -"Note that it is invalid to set any parameters after calling :meth:" -"`writeframes` or :meth:`writeframesraw`, and any attempt to do so will " -"raise :exc:`wave.Error`." +"Note that it is invalid to set any parameters after " +"calling :meth:`writeframes` or :meth:`writeframesraw`, and any attempt to do " +"so will raise :exc:`wave.Error`." msgstr "" "注意在呼叫 :meth:`writeframes` 或 :meth:`writeframesraw` 之後設置任何參數都是" "無效的,任何嘗試這樣做的操作都會引發 :exc:`wave.Error`。" diff --git a/library/weakref.po b/library/weakref.po index 3325dd9142..b1adbed3a3 100644 --- a/library/weakref.po +++ b/library/weakref.po @@ -507,7 +507,7 @@ msgid "" "replaced by :const:`None`." msgstr "" "當模組的 globals 可能被 :const:`None` 取代時,最終化器永遠不會在 :term:" -"`interpreter shutdown` 的後期調用(invoke)其回呼。" +"`interpreter shutdown` 的後期叫用(invoke)其回呼。" #: ../../library/weakref.rst:296 msgid "" @@ -598,7 +598,7 @@ msgid "" "if it still exists, by calling it:" msgstr "" "弱參照物件除了 :attr:`ref.__callback__` 之外沒有任何方法和屬性。弱參照物件允" -"許透過呼叫來獲取參照目標(如果它仍然存在):" +"許透過呼叫來取得參照目標(如果它仍然存在):" #: ../../library/weakref.rst:380 msgid "" @@ -741,7 +741,7 @@ msgstr "" msgid "" "The finalizer can be called directly as well. However the finalizer will " "invoke the callback at most once." -msgstr "最終化器也可以直接被呼叫。然而,最終化器最多會調用回呼一次。" +msgstr "最終化器也可以直接被呼叫。然而,最終化器最多會叫用回呼一次。" #: ../../library/weakref.rst:497 msgid "" diff --git a/library/webbrowser.po b/library/webbrowser.po index d65090b5fb..8e2062bdf8 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2024-09-24 18:27+0000\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,7 +88,7 @@ msgstr "" "要 :mod:`ctypes` 模組。如果 :mod:`ctypes` 不可用,則呼叫 :func:`.open` 將會失" "敗。" -#: ../../library/webbrowser.rst:43 +#: ../../library/webbrowser.rst:45 msgid "" "The script :program:`webbrowser` can be used as a command-line interface for " "the module. It accepts a URL as the argument. It accepts the following " @@ -97,40 +97,39 @@ msgstr "" "腳本 :program:`webbrowser` 可以用作模組的命令列介面。它接受 URL 作為引數。它" "接受以下可選參數:" -#: ../../library/webbrowser.rst:47 -msgid "" -"``-n``/``--new-window`` opens the URL in a new browser window, if possible." -msgstr "如果可能的話,``-n``/``--new-window`` 會在新的瀏覽器視窗中開啟 URL。" +#: ../../library/webbrowser.rst:51 +msgid "Opens the URL in a new browser window, if possible." +msgstr "如果可能的話會在新的瀏覽器視窗中開啟 URL。" -#: ../../library/webbrowser.rst:48 -msgid "``-t``/``--new-tab`` opens the URL in a new browser page (\"tab\")." -msgstr "``-t``/``--new-tab`` 會在新的瀏覽器分頁 (\"tab\") 中開啟 URL。" +#: ../../library/webbrowser.rst:55 +msgid "Opens the URL in a new browser tab." +msgstr "會在新的瀏覽器分頁 (\"tab\") 中開啟 URL。" -#: ../../library/webbrowser.rst:50 -msgid "The options are, naturally, mutually exclusive. Usage example::" -msgstr "這些選項自然是相互排斥的。用法範例: ::" +#: ../../library/webbrowser.rst:57 +msgid "The options are, naturally, mutually exclusive. Usage example:" +msgstr "這些選項自然是相互排斥的。用法範例如下:" -#: ../../library/webbrowser.rst:52 +#: ../../library/webbrowser.rst:59 msgid "python -m webbrowser -t \"https://www.python.org\"" msgstr "python -m webbrowser -t \"https://www.python.org\"" -#: ../../library/webbrowser.rst:54 +#: ../../library/webbrowser.rst:63 msgid "Availability" msgstr "" -#: ../../library/webbrowser.rst:56 +#: ../../library/webbrowser.rst:65 msgid "The following exception is defined:" msgstr "以下例外有被定義於該模組:" -#: ../../library/webbrowser.rst:61 +#: ../../library/webbrowser.rst:70 msgid "Exception raised when a browser control error occurs." msgstr "當瀏覽器控制項發生錯誤時引發例外。" -#: ../../library/webbrowser.rst:63 +#: ../../library/webbrowser.rst:72 msgid "The following functions are defined:" msgstr "以下函式有被定義於該模組:" -#: ../../library/webbrowser.rst:68 +#: ../../library/webbrowser.rst:77 msgid "" "Display *url* using the default browser. If *new* is 0, the *url* is opened " "in the same browser window if possible. If *new* is 1, a new browser window " @@ -144,13 +143,13 @@ msgstr "" "可能開啟一個新的瀏覽器分頁 (\"tab\")。如果 *autoraise* 為 ``True``,則盡可能" "提升視窗(請注意,無論此變數的設定如何,許多視窗管理器下都會發生這種情況)。" -#: ../../library/webbrowser.rst:75 ../../library/webbrowser.rst:89 -#: ../../library/webbrowser.rst:97 +#: ../../library/webbrowser.rst:84 ../../library/webbrowser.rst:98 +#: ../../library/webbrowser.rst:106 msgid "" "Returns ``True`` if a browser was successfully launched, ``False`` otherwise." msgstr "如果瀏覽器成功啟動則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/webbrowser.rst:77 +#: ../../library/webbrowser.rst:86 msgid "" "Note that on some platforms, trying to open a filename using this function, " "may work and start the operating system's associated program. However, this " @@ -159,30 +158,30 @@ msgstr "" "請注意,在某些平台上,嘗試使用此函式開啟檔案名稱可能能夠運作並啟動作業系統的" "關聯程式。然而這既不支援也不可移植。" -#: ../../library/webbrowser.rst:81 +#: ../../library/webbrowser.rst:90 msgid "" "Raises an :ref:`auditing event <auditing>` ``webbrowser.open`` with argument " "``url``." msgstr "" -"引發一個附帶引數 ``url`` 的\\ :ref:`稽核事件 <auditing>` ``webbrowser." -"open``。" +"引發一個附帶引數 ``url`` 的\\ :ref:`稽核事件 <auditing>` " +"``webbrowser.open``。" -#: ../../library/webbrowser.rst:86 +#: ../../library/webbrowser.rst:95 msgid "" "Open *url* in a new window of the default browser, if possible, otherwise, " "open *url* in the only browser window." msgstr "" "盡可能在預設瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開啟 *url*。" -#: ../../library/webbrowser.rst:94 +#: ../../library/webbrowser.rst:103 msgid "" "Open *url* in a new page (\"tab\") of the default browser, if possible, " "otherwise equivalent to :func:`open_new`." msgstr "" -"盡可能在預設瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :func:" -"`open_new`。" +"盡可能在預設瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當" +"於 :func:`open_new`。" -#: ../../library/webbrowser.rst:102 +#: ../../library/webbrowser.rst:111 msgid "" "Return a controller object for the browser type *using*. If *using* is " "``None``, return a controller for a default browser appropriate to the " @@ -191,36 +190,36 @@ msgstr "" "回傳瀏覽器類型\\ *使用*(以引數 *using* 給定)的控制器物件。如果 *using* 為 " "``None``,則回傳適合呼叫者環境的預設瀏覽器控制器。" -#: ../../library/webbrowser.rst:109 +#: ../../library/webbrowser.rst:118 msgid "" -"Register the browser type *name*. Once a browser type is registered, the :" -"func:`get` function can return a controller for that browser type. If " +"Register the browser type *name*. Once a browser type is registered, " +"the :func:`get` function can return a controller for that browser type. If " "*instance* is not provided, or is ``None``, *constructor* will be called " "without parameters to create an instance when needed. If *instance* is " "provided, *constructor* will never be called, and may be ``None``." msgstr "" -"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類型,:func:" -"`get` 函式就可以回傳該瀏覽器類型的控制器。如果沒有提供 *instance* 或為 " -"``None``,則會在需要時不帶參數地呼叫 *constructor* 來建立實例。如果提供了 " -"*instance*,*constructor* 將永遠不會被呼叫,並且可能為 ``None``。" +"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類" +"型,:func:`get` 函式就可以回傳該瀏覽器類型的控制器。如果沒有提供 *instance* " +"或為 ``None``,則會在需要時不帶參數地呼叫 *constructor* 來建立實例。如果提供" +"了 *instance*,*constructor* 將永遠不會被呼叫,並且可能為 ``None``。" -#: ../../library/webbrowser.rst:115 +#: ../../library/webbrowser.rst:124 msgid "" -"Setting *preferred* to ``True`` makes this browser a preferred result for a :" -"func:`get` call with no argument. Otherwise, this entry point is only " -"useful if you plan to either set the :envvar:`BROWSER` variable or call :" -"func:`get` with a nonempty argument matching the name of a handler you " +"Setting *preferred* to ``True`` makes this browser a preferred result for " +"a :func:`get` call with no argument. Otherwise, this entry point is only " +"useful if you plan to either set the :envvar:`BROWSER` variable or " +"call :func:`get` with a nonempty argument matching the name of a handler you " "declare." msgstr "" "將 *preferred* 設為 ``True`` 會使該瀏覽器成為不帶引數的 :func:`get` 呼叫的偏" "好結果。否則只有當你計劃設定 :envvar:`BROWSER` 變數或使用與你宣告的處理程序名" "稱相符的非空引數呼叫 :func:`get` 時,此入口點才會有用。" -#: ../../library/webbrowser.rst:121 +#: ../../library/webbrowser.rst:130 msgid "*preferred* keyword-only parameter was added." msgstr "新增了 *preferred* 僅限關鍵字參數。" -#: ../../library/webbrowser.rst:124 +#: ../../library/webbrowser.rst:133 msgid "" "A number of browser types are predefined. This table gives the type names " "that may be passed to the :func:`get` function and the corresponding " @@ -229,220 +228,221 @@ msgstr "" "預先定義了多種瀏覽器類型。此表給出了可以傳遞給 :func:`get` 函式的類型名稱以及" "控制器類別的相應實例化方式,這些都定義於此模組中。" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Type Name" msgstr "類型名稱" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Class Name" msgstr "類別名稱" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Notes" msgstr "註解" -#: ../../library/webbrowser.rst:131 +#: ../../library/webbrowser.rst:140 msgid "``'mozilla'``" msgstr "``'mozilla'``" -#: ../../library/webbrowser.rst:131 ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:140 ../../library/webbrowser.rst:142 msgid "``Mozilla('mozilla')``" msgstr "``Mozilla('mozilla')``" -#: ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:142 msgid "``'firefox'``" msgstr "``'firefox'``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:144 msgid "``'epiphany'``" msgstr "``'epiphany'``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:144 msgid "``Epiphany('epiphany')``" msgstr "``Epiphany('epiphany')``" -#: ../../library/webbrowser.rst:137 +#: ../../library/webbrowser.rst:146 msgid "``'kfmclient'``" msgstr "``'kfmclient'``" -#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:146 ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid "``Konqueror()``" msgstr "``Konqueror()``" -#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:146 ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:148 msgid "``'konqueror'``" msgstr "``'konqueror'``" -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:150 msgid "``'kfm'``" msgstr "``'kfm'``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:152 msgid "``'opera'``" msgstr "``'opera'``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:152 msgid "``Opera()``" msgstr "``Opera()``" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:154 msgid "``'links'``" msgstr "``'links'``" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:154 msgid "``GenericBrowser('links')``" msgstr "``GenericBrowser('links')``" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:156 msgid "``'elinks'``" msgstr "``'elinks'``" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:156 msgid "``Elinks('elinks')``" msgstr "``Elinks('elinks')``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:158 msgid "``'lynx'``" msgstr "``'lynx'``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:158 msgid "``GenericBrowser('lynx')``" msgstr "``GenericBrowser('lynx')``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:160 msgid "``'w3m'``" msgstr "``'w3m'``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:160 msgid "``GenericBrowser('w3m')``" msgstr "``GenericBrowser('w3m')``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "``'windows-default'``" msgstr "``'windows-default'``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "``WindowsDefault``" msgstr "``WindowsDefault``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:164 msgid "``'macosx'``" msgstr "``'macosx'``" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:164 msgid "``MacOSXOSAScript('default')``" msgstr "``MacOSXOSAScript('default')``" -#: ../../library/webbrowser.rst:155 ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:164 ../../library/webbrowser.rst:166 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:166 msgid "``'safari'``" msgstr "``'safari'``" -#: ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:166 msgid "``MacOSXOSAScript('safari')``" msgstr "``MacOSXOSAScript('safari')``" -#: ../../library/webbrowser.rst:159 +#: ../../library/webbrowser.rst:168 msgid "``'google-chrome'``" msgstr "``'google-chrome'``" -#: ../../library/webbrowser.rst:159 +#: ../../library/webbrowser.rst:168 msgid "``Chrome('google-chrome')``" msgstr "``Chrome('google-chrome')``" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:170 msgid "``'chrome'``" msgstr "``'chrome'``" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:170 msgid "``Chrome('chrome')``" msgstr "``Chrome('chrome')``" -#: ../../library/webbrowser.rst:163 +#: ../../library/webbrowser.rst:172 msgid "``'chromium'``" msgstr "``'chromium'``" -#: ../../library/webbrowser.rst:163 +#: ../../library/webbrowser.rst:172 msgid "``Chromium('chromium')``" msgstr "``Chromium('chromium')``" -#: ../../library/webbrowser.rst:165 +#: ../../library/webbrowser.rst:174 msgid "``'chromium-browser'``" msgstr "``'chromium-browser'``" -#: ../../library/webbrowser.rst:165 +#: ../../library/webbrowser.rst:174 msgid "``Chromium('chromium-browser')``" msgstr "``Chromium('chromium-browser')``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "``'iosbrowser'``" msgstr "``'iosbrowser'``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "``IOSBrowser``" msgstr "``IOSBrowser``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/webbrowser.rst:170 +#: ../../library/webbrowser.rst:179 msgid "Notes:" msgstr "註解:" -#: ../../library/webbrowser.rst:173 +#: ../../library/webbrowser.rst:182 msgid "" "\"Konqueror\" is the file manager for the KDE desktop environment for Unix, " "and only makes sense to use if KDE is running. Some way of reliably " "detecting KDE would be nice; the :envvar:`!KDEDIR` variable is not " -"sufficient. Note also that the name \"kfm\" is used even when using the :" -"program:`konqueror` command with KDE 2 --- the implementation selects the " -"best strategy for running Konqueror." +"sufficient. Note also that the name \"kfm\" is used even when using " +"the :program:`konqueror` command with KDE 2 --- the implementation selects " +"the best strategy for running Konqueror." msgstr "" "\"Konqueror\" 是 Unix 的 KDE 桌面環境的檔案管理器,只有在 KDE 運作時才有意" "義。最好能有某種可靠的 KDE 檢測方法;僅有 :envvar:`!KDEDIR` 變數是不夠的。另" "請注意,即使在 KDE 2 中使用 :program:`konqueror` 命令時,也會使用 \"kfm\" 名" "稱 --- 該實作會選擇執行 Konqueror 的最佳策略。" -#: ../../library/webbrowser.rst:180 +#: ../../library/webbrowser.rst:189 msgid "Only on Windows platforms." msgstr "僅在 Windows 平台上。" -#: ../../library/webbrowser.rst:183 +#: ../../library/webbrowser.rst:192 msgid "Only on macOS." msgstr "僅在 macOS 上。" -#: ../../library/webbrowser.rst:186 +#: ../../library/webbrowser.rst:195 msgid "Only on iOS." msgstr "僅在 iOS 上。" -#: ../../library/webbrowser.rst:188 +#: ../../library/webbrowser.rst:197 msgid "" "A new :class:`!MacOSXOSAScript` class has been added and is used on Mac " "instead of the previous :class:`!MacOSX` class. This adds support for " "opening browsers not currently set as the OS default." msgstr "" -"新增了 :class:`!MacOSXOSAScript` 類別並於 Mac 上使用,而非使用先前的 :class:" -"`!MacOSX` 類別。這增加了對開啟目前未設定為作業系統預設之瀏覽器的支援。" +"新增了 :class:`!MacOSXOSAScript` 類別並於 Mac 上使用,而非使用先前" +"的 :class:`!MacOSX` 類別。這增加了對開啟目前未設定為作業系統預設之瀏覽器的支" +"援。" -#: ../../library/webbrowser.rst:193 +#: ../../library/webbrowser.rst:202 msgid "Support for Chrome/Chromium has been added." msgstr "新增了對 Chrome/Chromium 的支援。" -#: ../../library/webbrowser.rst:196 +#: ../../library/webbrowser.rst:205 msgid "" "Support for several obsolete browsers has been removed. Removed browsers " "include Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, and Firefox " @@ -451,15 +451,15 @@ msgstr "" "對多個過時瀏覽器的支援已被刪除。已刪除的瀏覽器包括 Grail、Mosaic、Netscape、" "Galeon、Skipstone、Iceape 和 Firefox 35 及以下版本。" -#: ../../library/webbrowser.rst:201 +#: ../../library/webbrowser.rst:210 msgid "Support for iOS has been added." msgstr "新增了對 iOS 的支援。" -#: ../../library/webbrowser.rst:204 +#: ../../library/webbrowser.rst:213 msgid "Here are some simple examples::" msgstr "以下是一些簡單範例: ::" -#: ../../library/webbrowser.rst:206 +#: ../../library/webbrowser.rst:215 msgid "" "url = 'https://docs.python.org/'\n" "\n" @@ -477,21 +477,23 @@ msgstr "" "# 在新視窗中開啟 URL,如果可能的話提升視窗。\n" "webbrowser.open_new(url)" -#: ../../library/webbrowser.rst:218 +#: ../../library/webbrowser.rst:227 msgid "Browser Controller Objects" msgstr "瀏覽器控制器物件" -#: ../../library/webbrowser.rst:220 +#: ../../library/webbrowser.rst:229 msgid "" -"Browser controllers provide these methods which parallel three of the module-" -"level convenience functions:" -msgstr "瀏覽器控制器提供了這些與三個模組層級便利函式相同的方法:" +"Browser controllers provide the :attr:`~controller.name` attribute, and the " +"following three methods which parallel module-level convenience functions:" +msgstr "" +"瀏覽器控制器提供了 :attr:`~controller.name` 屬性和以下三個與模組層級便利函式" +"相同的方法:" -#: ../../library/webbrowser.rst:226 +#: ../../library/webbrowser.rst:235 msgid "System-dependent name for the browser." msgstr "瀏覽器的系統相依名稱 (system-dependent name)。" -#: ../../library/webbrowser.rst:231 +#: ../../library/webbrowser.rst:240 msgid "" "Display *url* using the browser handled by this controller. If *new* is 1, a " "new browser window is opened if possible. If *new* is 2, a new browser page " @@ -500,28 +502,28 @@ msgstr "" "使用此控制器處理的瀏覽器顯示 *url*。如果 *new* 為 1,則盡可能開啟一個新的瀏覽" "器視窗。如果 *new* 為 2,則盡可能開啟一個新的瀏覽器分頁 (\"tab\")。" -#: ../../library/webbrowser.rst:238 +#: ../../library/webbrowser.rst:247 msgid "" "Open *url* in a new window of the browser handled by this controller, if " -"possible, otherwise, open *url* in the only browser window. Alias :func:" -"`open_new`." +"possible, otherwise, open *url* in the only browser window. " +"Alias :func:`open_new`." msgstr "" "盡可能在此控制器處理的瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開" "啟 *url*。別名為 :func:`open_new`。" -#: ../../library/webbrowser.rst:245 +#: ../../library/webbrowser.rst:254 msgid "" "Open *url* in a new page (\"tab\") of the browser handled by this " "controller, if possible, otherwise equivalent to :func:`open_new`." msgstr "" -"盡可能在此控制器處理的瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :" -"func:`open_new`。" +"盡可能在此控制器處理的瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當" +"於 :func:`open_new`。" -#: ../../library/webbrowser.rst:250 +#: ../../library/webbrowser.rst:259 msgid "Footnotes" msgstr "註腳" -#: ../../library/webbrowser.rst:251 +#: ../../library/webbrowser.rst:260 msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." diff --git a/library/winsound.po b/library/winsound.po index f51aa90496..0113d36816 100644 --- a/library/winsound.po +++ b/library/winsound.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-03-17 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -188,18 +188,25 @@ msgstr "" msgid "Return immediately if the sound driver is busy." msgstr "" -#: ../../library/winsound.rst:140 ../../library/winsound.rst:160 +#: ../../library/winsound.rst:140 +msgid "" +"The *sound* parameter is an application-specific alias in the registry. This " +"flag can be combined with the :const:`SND_ALIAS` flag to specify an " +"application-defined sound alias." +msgstr "" + +#: ../../library/winsound.rst:147 ../../library/winsound.rst:167 msgid "Play the ``SystemDefault`` sound." msgstr "播放 ``SystemDefault`` 聲音。" -#: ../../library/winsound.rst:145 +#: ../../library/winsound.rst:152 msgid "Play the ``SystemExclamation`` sound." msgstr "播放 ``SystemExclamation`` 聲音。" -#: ../../library/winsound.rst:150 +#: ../../library/winsound.rst:157 msgid "Play the ``SystemHand`` sound." msgstr "播放 ``SystemHand`` 聲音。" -#: ../../library/winsound.rst:155 +#: ../../library/winsound.rst:162 msgid "Play the ``SystemQuestion`` sound." msgstr "播放 ``SystemQuestion`` 聲音。" diff --git a/library/wsgiref.po b/library/wsgiref.po index 240292a6a8..02456816c1 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -81,13 +81,14 @@ msgid "" "environments. A WSGI environment is a dictionary containing HTTP request " "variables as described in :pep:`3333`. All of the functions taking an " "*environ* parameter expect a WSGI-compliant dictionary to be supplied; " -"please see :pep:`3333` for a detailed specification and :data:`~wsgiref." -"types.WSGIEnvironment` for a type alias that can be used in type annotations." +"please see :pep:`3333` for a detailed specification " +"and :data:`~wsgiref.types.WSGIEnvironment` for a type alias that can be used " +"in type annotations." msgstr "" "這個模組提供許多用於處理 WSGI 環境運作的功能。WSGI 環境是一個包含 HTTP 請求變" "數的字典,如 :pep:`3333` 所述。所有接受 *environ* 的參數的函式都需要提供符合 " -"WSGI 標準的字典;請參閱 :pep:`3333` 獲取詳細規格,以及 :data:`~wsgiref.types." -"WSGIEnvironment` 獲取可用於使用型別註釋的型別別名。" +"WSGI 標準的字典;請參閱 :pep:`3333` 取得詳細規格,以" +"及 :data:`~wsgiref.types.WSGIEnvironment` 取得可用於使用型別註釋的型別別名。" #: ../../library/wsgiref.rst:56 msgid "" @@ -107,9 +108,9 @@ msgid "" "a value is found, and \"http\" otherwise." msgstr "" "當建立一個包裝 CGI 或類似 FastCGI 的 CGI-like 協議閘道時,此函式非常有用。例" -"如 FastCGI,通常提供這類協議的伺服器在通過 SSL 接收到請求時會包含 " -"\"1\",\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回" -"傳 \"https\",否則回傳 \"http\"。" +"如 FastCGI,通常提供這類協議的伺服器在通過 SSL 接收到請求時會包含 \"1\"," +"\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回傳 " +"\"https\",否則回傳 \"http\"。" #: ../../library/wsgiref.rst:69 msgid "" @@ -154,11 +155,11 @@ msgid "" "routine modifies the passed-in environment to make it suitable for invoking " "another WSGI application that is located at the target URI. For example, if " "there is a WSGI application at ``/foo``, and the request URI path is ``/foo/" -"bar/baz``, and the WSGI application at ``/foo`` calls :func:" -"`shift_path_info`, it will receive the string \"bar\", and the environment " -"will be updated to be suitable for passing to a WSGI application at ``/foo/" -"bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/foo/bar``, " -"and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." +"bar/baz``, and the WSGI application at ``/foo`` " +"calls :func:`shift_path_info`, it will receive the string \"bar\", and the " +"environment will be updated to be suitable for passing to a WSGI application " +"at ``/foo/bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/" +"foo/bar``, and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." msgstr "" "通常,此程式用於處理請求 URI 的每一部分路徑,例如將路徑視為一系列的字典鍵此程" "式會修改傳入的環境,使其適用於呼叫位於目標 URI 的 WSGI 應用程式。例如,如果" @@ -190,9 +191,9 @@ msgstr "為測試目的,以簡單的預設值更新 *environ* 。" msgid "" "This routine adds various parameters required for WSGI, including " "``HTTP_HOST``, ``SERVER_NAME``, ``SERVER_PORT``, ``REQUEST_METHOD``, " -"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined ``wsgi." -"*`` variables. It only supplies default values, and does not replace any " -"existing settings for these variables." +"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined " +"``wsgi.*`` variables. It only supplies default values, and does not replace " +"any existing settings for these variables." msgstr "" "這個程式新增 WSGI 所需的各種參數,包括 ``HTTP_HOST``、``SERVER_NAME``、" "``SERVER_PORT``、``REQUEST_METHOD``、``SCRIPT_NAME``、``PATH_INFO``,以及所" @@ -208,12 +209,13 @@ msgstr "" "這個程式目的為了讓 WSGI 伺服器和應用程式的單元測試更容易建置虛擬環境。實際的 " "WSGI 伺服器或應用程式不應該使用它,因為所產生的數據是假的!" -#: ../../library/wsgiref.rst:122 ../../library/wsgiref.rst:170 -#: ../../library/wsgiref.rst:293 ../../library/wsgiref.rst:426 -msgid "Example usage::" -msgstr "用法範例: ::" +#: ../../library/wsgiref.rst:122 +msgid "" +"Example usage (see also :func:`~wsgiref.simple_server.demo_app` for another " +"example)::" +msgstr "" -#: ../../library/wsgiref.rst:124 +#: ../../library/wsgiref.rst:125 msgid "" "from wsgiref.util import setup_testing_defaults\n" "from wsgiref.simple_server import make_server\n" @@ -237,13 +239,13 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:146 +#: ../../library/wsgiref.rst:147 msgid "" "In addition to the environment functions above, the :mod:`wsgiref.util` " "module also provides these miscellaneous utilities:" msgstr "除了上述的環境功能外,:mod:`wsgiref.util` 模組還提供以下各類工具:" -#: ../../library/wsgiref.rst:152 +#: ../../library/wsgiref.rst:153 msgid "" "Return ``True`` if 'header_name' is an HTTP/1.1 \"Hop-by-Hop\" header, as " "defined by :rfc:`2616`." @@ -251,31 +253,37 @@ msgstr "" "如果 'header_name' 是根據 :rfc:`2616` 所定義的 HTTP/1.1 \"Hop-by-Hop\" 標頭," "則回傳 ``True``。" -#: ../../library/wsgiref.rst:158 +#: ../../library/wsgiref.rst:159 msgid "" "A concrete implementation of the :class:`wsgiref.types.FileWrapper` protocol " "used to convert a file-like object to an :term:`iterator`. The resulting " "objects are :term:`iterable`\\ s. As the object is iterated over, the " "optional *blksize* parameter will be repeatedly passed to the *filelike* " -"object's :meth:`read` method to obtain bytestrings to yield. When :meth:" -"`read` returns an empty bytestring, iteration is ended and is not resumable." +"object's :meth:`read` method to obtain bytestrings to yield. " +"When :meth:`read` returns an empty bytestring, iteration is ended and is not " +"resumable." msgstr "" -":class:`wsgiref.types.FileWrapper` 協議的具體實作,用於將類檔案物件轉換為 :" -"term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選的 " -"*blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" +":class:`wsgiref.types.FileWrapper` 協議的具體實作,用於將類檔案物件轉換" +"為 :term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選" +"的 *blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" "(yield)的位元組字串。當 :meth:`read` 回傳一個空位元組字串,代表疊代已結束且" "無法回復。" -#: ../../library/wsgiref.rst:166 +#: ../../library/wsgiref.rst:167 msgid "" "If *filelike* has a :meth:`close` method, the returned object will also have " -"a :meth:`close` method, and it will invoke the *filelike* object's :meth:" -"`close` method when called." +"a :meth:`close` method, and it will invoke the *filelike* " +"object's :meth:`close` method when called." msgstr "" "如果 *filelike* 有 :meth:`close` 方法,則回傳的物件也會具有 :meth:`close` 方" -"法,並在呼叫時呼叫 *filelike* 物件的 :meth:`close` 方法。" +"法,並在呼叫時叫用 *filelike* 物件的 :meth:`close` 方法。" -#: ../../library/wsgiref.rst:172 +#: ../../library/wsgiref.rst:171 ../../library/wsgiref.rst:294 +#: ../../library/wsgiref.rst:429 +msgid "Example usage::" +msgstr "用法範例: ::" + +#: ../../library/wsgiref.rst:173 msgid "" "from io import StringIO\n" "from wsgiref.util import FileWrapper\n" @@ -288,15 +296,15 @@ msgid "" " print(chunk)" msgstr "" -#: ../../library/wsgiref.rst:182 +#: ../../library/wsgiref.rst:183 msgid "Support for :meth:`~object.__getitem__` method has been removed." msgstr "已移除對 :meth:`~object.__getitem__` 方法的支援。" -#: ../../library/wsgiref.rst:187 +#: ../../library/wsgiref.rst:188 msgid ":mod:`wsgiref.headers` -- WSGI response header tools" msgstr ":mod:`wsgiref.headers` -- WSGI 回應標頭工具" -#: ../../library/wsgiref.rst:193 +#: ../../library/wsgiref.rst:194 msgid "" "This module provides a single class, :class:`Headers`, for convenient " "manipulation of WSGI response headers using a mapping-like interface." @@ -304,7 +312,7 @@ msgstr "" "這個模組提供單一類別 :class:`Headers`,用於使用類似對映的介面方便地操作 WSGI " "回應標頭。" -#: ../../library/wsgiref.rst:199 +#: ../../library/wsgiref.rst:200 msgid "" "Create a mapping-like object wrapping *headers*, which must be a list of " "header name/value tuples as described in :pep:`3333`. The default value of " @@ -313,26 +321,25 @@ msgstr "" "建立一個類似對映物件並包裝 *headers*,並且必須是符合 :pep:`3333` 描述的 name/" "value 元組的標頭串列。*headers* 的預設值是一個空串列。" -#: ../../library/wsgiref.rst:203 +#: ../../library/wsgiref.rst:204 msgid "" -":class:`Headers` objects support typical mapping operations including :meth:" -"`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:" -"`~dict.setdefault`, :meth:`~object.__delitem__` and :meth:`~object." -"__contains__`. For each of these methods, the key is the header name " -"(treated case-insensitively), and the value is the first value associated " -"with that header name. Setting a header deletes any existing values for " -"that header, then adds a new value at the end of the wrapped header list. " -"Headers' existing order is generally maintained, with new headers added to " -"the end of the wrapped list." +":class:`Headers` objects support typical mapping operations " +"including :meth:`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:`~dict.setdefault`, :meth:`~object.__delitem__` " +"and :meth:`~object.__contains__`. For each of these methods, the key is the " +"header name (treated case-insensitively), and the value is the first value " +"associated with that header name. Setting a header deletes any existing " +"values for that header, then adds a new value at the end of the wrapped " +"header list. Headers' existing order is generally maintained, with new " +"headers added to the end of the wrapped list." msgstr "" -":class:`Headers` 物件支援典型對映操作包括 :meth:`__getitem__`、:meth:`~dict." -"get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object." -"__delitem__` 以及 :meth:`~object.__contains__`。對於這些方法中的每一個,鍵是" -"標頭名稱(以不區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個值。設定" -"標頭會刪除該標頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標頭的現有" -"順序通常保持不變,新標頭會添加到包裝串列的末尾。" +":class:`Headers` 物件支援典型對映操作包" +"括 :meth:`__getitem__`、:meth:`~dict.get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object.__delitem__` " +"以及 :meth:`~object.__contains__`。對於這些方法中的每一個,鍵是標頭名稱(以不" +"區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個值。設定標頭會刪除該標" +"頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標頭的現有順序通常保持不" +"變,新標頭會添加到包裝串列的末尾。" -#: ../../library/wsgiref.rst:213 +#: ../../library/wsgiref.rst:214 msgid "" "Unlike a dictionary, :class:`Headers` objects do not raise an error when you " "try to get or delete a key that isn't in the wrapped header list. Getting a " @@ -343,22 +350,22 @@ msgstr "" "不會引發例外錯誤。取得不存在的標頭只會回傳 ``None``,而刪除不存在的標頭則不會" "有任何效果。" -#: ../../library/wsgiref.rst:218 +#: ../../library/wsgiref.rst:219 msgid "" -":class:`Headers` objects also support :meth:`keys`, :meth:`values`, and :" -"meth:`items` methods. The lists returned by :meth:`keys` and :meth:`items` " -"can include the same key more than once if there is a multi-valued header. " -"The ``len()`` of a :class:`Headers` object is the same as the length of its :" -"meth:`items`, which is the same as the length of the wrapped header list. " -"In fact, the :meth:`items` method just returns a copy of the wrapped header " -"list." +":class:`Headers` objects also support :meth:`keys`, :meth:`values`, " +"and :meth:`items` methods. The lists returned by :meth:`keys` " +"and :meth:`items` can include the same key more than once if there is a " +"multi-valued header. The ``len()`` of a :class:`Headers` object is the same " +"as the length of its :meth:`items`, which is the same as the length of the " +"wrapped header list. In fact, the :meth:`items` method just returns a copy " +"of the wrapped header list." msgstr "" ":class:`Headers` 物件還支援 :meth:`keys`、:meth:`value`、和 :meth:`items` 方" "法。由 :meth:`keys` 和 :meth:`items` 回傳的串列在存在多值標頭時可能會包含相同" "的鍵。:class:`Headers` 物件的 ``len()`` 與 :meth:`items` 的長度相同,也與包裝" "標頭串列的長度相同。實際上,:meth:`items` 方法只是回傳包裝的標頭串列的副本。" -#: ../../library/wsgiref.rst:225 +#: ../../library/wsgiref.rst:226 msgid "" "Calling ``bytes()`` on a :class:`Headers` object returns a formatted " "bytestring suitable for transmission as HTTP response headers. Each header " @@ -370,20 +377,21 @@ msgstr "" "式化的位元組字串。每個標頭都與其值一起置於一行上,由冒號與空格分隔。每行以回" "車(carriage return)和換行(line feed)結束,而該位元組字串則以空行結束。" -#: ../../library/wsgiref.rst:231 +#: ../../library/wsgiref.rst:232 msgid "" -"In addition to their mapping interface and formatting features, :class:" -"`Headers` objects also have the following methods for querying and adding " -"multi-valued headers, and for adding headers with MIME parameters:" +"In addition to their mapping interface and formatting " +"features, :class:`Headers` objects also have the following methods for " +"querying and adding multi-valued headers, and for adding headers with MIME " +"parameters:" msgstr "" "除了對映介面和格式化功能外,:class:`Headers` 物件還具有以下查詢及附加多值標頭" "的以及附加 MIME 參數標頭的方法:" -#: ../../library/wsgiref.rst:238 +#: ../../library/wsgiref.rst:239 msgid "Return a list of all the values for the named header." msgstr "回傳指定標頭的所有值的串列。" -#: ../../library/wsgiref.rst:240 +#: ../../library/wsgiref.rst:241 msgid "" "The returned list will be sorted in the order they appeared in the original " "header list or were added to this instance, and may contain duplicates. Any " @@ -394,14 +402,14 @@ msgstr "" "序,並且可能包含重複的內容。任何被刪除並重新插入的欄位都會被添加到標頭串列的" "末尾。如果不存在指定名稱的欄位,則回傳空串列。" -#: ../../library/wsgiref.rst:248 +#: ../../library/wsgiref.rst:249 msgid "" "Add a (possibly multi-valued) header, with optional MIME parameters " "specified via keyword arguments." msgstr "" "添加一個(可能是多值的)標頭,可通過關鍵字引數來指定選擇性的 MIME 參數。" -#: ../../library/wsgiref.rst:251 +#: ../../library/wsgiref.rst:252 msgid "" "*name* is the header field to add. Keyword arguments can be used to set " "MIME parameters for the header field. Each parameter must be a string or " @@ -418,55 +426,55 @@ msgstr "" "則以 ``name=\"value\"`` 的形式添加到標頭值參數中。如果它是 ``None``,則僅添加" "參數名稱。(這使用於沒有值的 MIME 參數)使用範例: ::" -#: ../../library/wsgiref.rst:259 +#: ../../library/wsgiref.rst:260 msgid "h.add_header('content-disposition', 'attachment', filename='bud.gif')" msgstr "h.add_header('content-disposition', 'attachment', filename='bud.gif')" -#: ../../library/wsgiref.rst:261 +#: ../../library/wsgiref.rst:262 msgid "The above will add a header that looks like this::" msgstr "上述操作將添加看起來像這樣的標頭: ::" -#: ../../library/wsgiref.rst:263 +#: ../../library/wsgiref.rst:264 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" msgstr "Content-Disposition: attachment; filename=\"bud.gif\"" -#: ../../library/wsgiref.rst:266 +#: ../../library/wsgiref.rst:267 msgid "*headers* parameter is optional." msgstr "*headers* 參數是可選的。" -#: ../../library/wsgiref.rst:271 +#: ../../library/wsgiref.rst:272 msgid ":mod:`wsgiref.simple_server` -- a simple WSGI HTTP server" msgstr ":mod:`wsgiref.simple_server` -- 一個簡單的 WSGI HTTP 伺服器" -#: ../../library/wsgiref.rst:277 +#: ../../library/wsgiref.rst:278 msgid "" "This module implements a simple HTTP server (based on :mod:`http.server`) " "that serves WSGI applications. Each server instance serves a single WSGI " "application on a given host and port. If you want to serve multiple " "applications on a single host and port, you should create a WSGI application " "that parses ``PATH_INFO`` to select which application to invoke for each " -"request. (E.g., using the :func:`shift_path_info` function from :mod:" -"`wsgiref.util`.)" +"request. (E.g., using the :func:`shift_path_info` function " +"from :mod:`wsgiref.util`.)" msgstr "" "這個模組實作一個簡單的的 HTTP 伺服器(基於 :mod:`http.server`)用於提供 WSGI " "應用程式。每個伺服器執行個體在特定的主機與埠提供單一的 WSGI 應用程式。如果你" "想要在單一主機與埠上提供多個應用程式,你應該建立一個 WSGI 應用程式以剖析 " -"``PATH_INFO`` 去選擇為每個請求呼叫哪個應用程式。(例如,使用來自 :mod:" -"`wsgiref.util` 的 :func:`shift_path_info` 函式。)" +"``PATH_INFO`` 去選擇為每個請求叫用哪個應用程式。(例如,使用來" +"自 :mod:`wsgiref.util` 的 :func:`shift_path_info` 函式。)" -#: ../../library/wsgiref.rst:288 +#: ../../library/wsgiref.rst:289 msgid "" "Create a new WSGI server listening on *host* and *port*, accepting " "connections for *app*. The return value is an instance of the supplied " "*server_class*, and will process requests using the specified " -"*handler_class*. *app* must be a WSGI application object, as defined by :" -"pep:`3333`." +"*handler_class*. *app* must be a WSGI application object, as defined " +"by :pep:`3333`." msgstr "" "建立一個新的 WSGI 伺服器監聽 *host* 和 *port*,接受 *app* 的連線。回傳值是提" "供 *server_class* 的實例,並將使用指定的 *handler_class* 處理請求。*app* 必須" "是一個 WSGI 應用程式物件,如 :pep:`3333` 所定義。" -#: ../../library/wsgiref.rst:295 +#: ../../library/wsgiref.rst:296 msgid "" "from wsgiref.simple_server import make_server, demo_app\n" "\n" @@ -480,7 +488,7 @@ msgid "" " httpd.handle_request()" msgstr "" -#: ../../library/wsgiref.rst:309 +#: ../../library/wsgiref.rst:310 msgid "" "This function is a small but complete WSGI application that returns a text " "page containing the message \"Hello world!\" and a list of the key/value " @@ -493,77 +501,85 @@ msgstr "" "(例如 :mod:`wsgiref.simple_server`)是否能正確執行簡單的 WSGI 應用程式非常有" "用。" -#: ../../library/wsgiref.rst:318 +#: ../../library/wsgiref.rst:316 msgid "" -"Create a :class:`WSGIServer` instance. *server_address* should be a ``(host," -"port)`` tuple, and *RequestHandlerClass* should be the subclass of :class:" -"`http.server.BaseHTTPRequestHandler` that will be used to process requests." +"The *start_response* callable should follow the :class:`.StartResponse` " +"protocol." +msgstr "" + +#: ../../library/wsgiref.rst:321 +msgid "" +"Create a :class:`WSGIServer` instance. *server_address* should be a " +"``(host,port)`` tuple, and *RequestHandlerClass* should be the subclass " +"of :class:`http.server.BaseHTTPRequestHandler` that will be used to process " +"requests." msgstr "" "建立一個 :class:`WSGIServer` 實例。*server_address* 應該是一個 ``(host, " -"port)`` 元組,而 *RequestHandlerClass* 應該是 :class:`http.server." -"BaseHTTPRequestHandler` 的子類別,將用於處理請求。" +"port)`` 元組,而 *RequestHandlerClass* 應該" +"是 :class:`http.server.BaseHTTPRequestHandler` 的子類別,將用於處理請求。" -#: ../../library/wsgiref.rst:323 +#: ../../library/wsgiref.rst:326 msgid "" -"You do not normally need to call this constructor, as the :func:" -"`make_server` function can handle all the details for you." +"You do not normally need to call this constructor, as " +"the :func:`make_server` function can handle all the details for you." msgstr "" "通常你不需要呼叫這個建構函式(constructor),因為 :func:`make_server` 函式可" "以為你處理所有細節。" -#: ../../library/wsgiref.rst:326 +#: ../../library/wsgiref.rst:329 msgid "" ":class:`WSGIServer` is a subclass of :class:`http.server.HTTPServer`, so all " "of its methods (such as :meth:`serve_forever` and :meth:`handle_request`) " "are available. :class:`WSGIServer` also provides these WSGI-specific methods:" msgstr "" ":class:`WSGIServer` 是 :class:`http.server.HTTPServer` 的子類別,因此它的所有" -"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可用。:class:" -"`WSGIServer` 也提供這些特定於 WSGI 的方法:" +"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可" +"用。:class:`WSGIServer` 也提供這些特定於 WSGI 的方法:" -#: ../../library/wsgiref.rst:333 +#: ../../library/wsgiref.rst:336 msgid "" "Sets the callable *application* as the WSGI application that will receive " "requests." msgstr "將可呼叫的 *application* 設定為接收請求的 WSGI 應用程式。" -#: ../../library/wsgiref.rst:339 +#: ../../library/wsgiref.rst:342 msgid "Returns the currently set application callable." msgstr "回傳目前設定應用程式的可呼叫物件。" -#: ../../library/wsgiref.rst:341 +#: ../../library/wsgiref.rst:344 msgid "" -"Normally, however, you do not need to use these additional methods, as :meth:" -"`set_app` is normally called by :func:`make_server`, and the :meth:`get_app` " -"exists mainly for the benefit of request handler instances." +"Normally, however, you do not need to use these additional methods, " +"as :meth:`set_app` is normally called by :func:`make_server`, and " +"the :meth:`get_app` exists mainly for the benefit of request handler " +"instances." msgstr "" -"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會被 :" -"func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式(handler)實" -"例的好處上。" +"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會" +"被 :func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式" +"(handler)實例的好處上。" -#: ../../library/wsgiref.rst:348 +#: ../../library/wsgiref.rst:351 msgid "" "Create an HTTP handler for the given *request* (i.e. a socket), " -"*client_address* (a ``(host,port)`` tuple), and *server* (:class:" -"`WSGIServer` instance)." +"*client_address* (a ``(host,port)`` tuple), and *server* " +"(:class:`WSGIServer` instance)." msgstr "" "為給定的 *request*(即一個 socket)、*client_address*(一個 ``(host,port)`` " "位元組)、*server* (:class:`WSGIServer` 實例) 建立一個 HTTP 處理程式" "(handler)。" -#: ../../library/wsgiref.rst:351 +#: ../../library/wsgiref.rst:354 msgid "" "You do not need to create instances of this class directly; they are " "automatically created as needed by :class:`WSGIServer` objects. You can, " -"however, subclass this class and supply it as a *handler_class* to the :func:" -"`make_server` function. Some possibly relevant methods for overriding in " -"subclasses:" +"however, subclass this class and supply it as a *handler_class* to " +"the :func:`make_server` function. Some possibly relevant methods for " +"overriding in subclasses:" msgstr "" "你不需要直接建立這個類別的實例;它們會在需要時由 :class:`WSGIServer` 物件自動" -"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供給 :" -"func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" +"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供" +"給 :func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" -#: ../../library/wsgiref.rst:360 +#: ../../library/wsgiref.rst:363 msgid "" "Return a :data:`~wsgiref.types.WSGIEnvironment` dictionary for a request. " "The default implementation copies the contents of the :class:`WSGIServer` " @@ -574,17 +590,17 @@ msgid "" msgstr "" "唯一個請求回傳一個 :data:`~wsgiref.types.WSGIEnvironment` 字典。預設的實作會" "複製 :class:`WSGIServer` 物件的 :attr:`base_environ` 字典屬性的內容以及添加" -"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有如 :pep:" -"`3333` 所指定的相關 CGI 環境變數的新字典。" +"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有" +"如 :pep:`3333` 所指定的相關 CGI 環境變數的新字典。" -#: ../../library/wsgiref.rst:371 +#: ../../library/wsgiref.rst:374 msgid "" "Return the object that should be used as the ``wsgi.errors`` stream. The " "default implementation just returns ``sys.stderr``." msgstr "" "回傳的物件應該被用作 ``wsgi.errors`` 串流。預設實作只會回傳 ``sys.stderr``。" -#: ../../library/wsgiref.rst:377 +#: ../../library/wsgiref.rst:380 msgid "" "Process the HTTP request. The default implementation creates a handler " "instance using a :mod:`wsgiref.handlers` class to implement the actual WSGI " @@ -593,17 +609,17 @@ msgstr "" "處理 HTTP 請求。預設實作會使用 :mod:`wsgiref.handler` 類別來建立處置程式" "(handler)實例來實作實際 WSGI 應用程式介面。" -#: ../../library/wsgiref.rst:383 +#: ../../library/wsgiref.rst:386 msgid ":mod:`wsgiref.validate` --- WSGI conformance checker" msgstr ":mod:`wsgiref.validate` --- WSGI 符合性檢查" -#: ../../library/wsgiref.rst:389 +#: ../../library/wsgiref.rst:392 msgid "" "When creating new WSGI application objects, frameworks, servers, or " -"middleware, it can be useful to validate the new code's conformance using :" -"mod:`wsgiref.validate`. This module provides a function that creates WSGI " -"application objects that validate communications between a WSGI server or " -"gateway and a WSGI application object, to check both sides for protocol " +"middleware, it can be useful to validate the new code's conformance " +"using :mod:`wsgiref.validate`. This module provides a function that creates " +"WSGI application objects that validate communications between a WSGI server " +"or gateway and a WSGI application object, to check both sides for protocol " "conformance." msgstr "" "當建立新的 WSGI 應用程式物件、框架、伺服器、或是中介軟體(middleware)時,使" @@ -611,7 +627,7 @@ msgstr "" "個函式用於建立 WSGI 應用程式物件,並用於驗證 WSGI 伺服器或是閘道與 WSGI 應用" "程式物件之間的通訊,以檢查雙方協議的符合性。" -#: ../../library/wsgiref.rst:396 +#: ../../library/wsgiref.rst:399 msgid "" "Note that this utility does not guarantee complete :pep:`3333` compliance; " "an absence of errors from this module does not necessarily mean that errors " @@ -623,7 +639,7 @@ msgstr "" "錯誤。但是,如果如果這個模組產生錯誤,那麼幾乎可以確定伺服器或應用程式不是 " "100% 符合標準。" -#: ../../library/wsgiref.rst:401 +#: ../../library/wsgiref.rst:404 msgid "" "This module is based on the :mod:`paste.lint` module from Ian Bicking's " "\"Python Paste\" library." @@ -631,7 +647,7 @@ msgstr "" "這個模組基於 Ian Bicking 的 \"Python Paste\" 函式庫的 :mod:`paste.lint` 模" "組。" -#: ../../library/wsgiref.rst:407 +#: ../../library/wsgiref.rst:410 msgid "" "Wrap *application* and return a new WSGI application object. The returned " "application will forward all requests to the original *application*, and " @@ -642,7 +658,7 @@ msgstr "" "請求給原始的 *application*,並檢查 *application* 和呼叫它的伺服器是否符合 " "WSGI 規範和 :rfc:`2616`。" -#: ../../library/wsgiref.rst:412 +#: ../../library/wsgiref.rst:415 msgid "" "Any detected nonconformance results in an :exc:`AssertionError` being " "raised; note, however, that how these errors are handled is server-" @@ -653,12 +669,12 @@ msgid "" "stream." msgstr "" "任何在 :exc:`AssertionError` 中偵測不符合結果都會發起例外;但請注意,如何處理" -"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` 的 :mod:`wsgiref." -"simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他操作的伺服器)將僅" -"輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 ``sys.stderr`` 或是其他錯" -"誤串流。" +"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` " +"的 :mod:`wsgiref.simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他" +"操作的伺服器)將僅輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 " +"``sys.stderr`` 或是其他錯誤串流。" -#: ../../library/wsgiref.rst:419 +#: ../../library/wsgiref.rst:422 msgid "" "This wrapper may also generate output using the :mod:`warnings` module to " "indicate behaviors that are questionable but which may not actually be " @@ -668,11 +684,11 @@ msgid "" "object)." msgstr "" "這個包裝器也可以使用 :mod:`warnings` 模組生成輸出去指示一些可能有疑慮但實際上" -"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項或 :mod:" -"`warnings` API,抑制了這些警告,否則這類警告將被寫入到 ``sys.stderr``\\ " -"(*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" +"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項" +"或 :mod:`warnings` API,抑制了這些警告,否則這類警告將被寫入到 " +"``sys.stderr``\\ (*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" -#: ../../library/wsgiref.rst:428 +#: ../../library/wsgiref.rst:431 msgid "" "from wsgiref.validate import validator\n" "from wsgiref.simple_server import make_server\n" @@ -696,11 +712,11 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:451 +#: ../../library/wsgiref.rst:454 msgid ":mod:`wsgiref.handlers` -- server/gateway base classes" msgstr ":mod:`wsgiref.handlers` -- 伺服器 / 閘道基本類別" -#: ../../library/wsgiref.rst:457 +#: ../../library/wsgiref.rst:460 msgid "" "This module provides base handler classes for implementing WSGI servers and " "gateways. These base classes handle most of the work of communicating with " @@ -711,7 +727,7 @@ msgstr "" "處理程式大部分與 WSGI 應用程式通訊的工作,只要它們被提供 CGI-like 環境,以及" "輸入、輸出和錯誤串流。" -#: ../../library/wsgiref.rst:465 +#: ../../library/wsgiref.rst:468 msgid "" "CGI-based invocation via ``sys.stdin``, ``sys.stdout``, ``sys.stderr`` and " "``os.environ``. This is useful when you have a WSGI application and want to " @@ -720,21 +736,21 @@ msgid "" msgstr "" "這是基於 CGI 的呼叫方式並透過 ``sys.stdin``、``sys.stdout``、``sys.stderr`` " "和 ``os.environ``。當你擁有一個 WSGI 應用程式並希望將其作為 CGI 腳本運行時是" -"很有用的。只需呼叫 ``CGIHandler().run(app)``,其中 ``app`` 是你希望呼叫的 " +"很有用的。只需叫用 ``CGIHandler().run(app)``,其中 ``app`` 是你希望叫用的 " "WSGI 應用程式物件。" -#: ../../library/wsgiref.rst:470 +#: ../../library/wsgiref.rst:473 msgid "" -"This class is a subclass of :class:`BaseCGIHandler` that sets ``wsgi." -"run_once`` to true, ``wsgi.multithread`` to false, and ``wsgi.multiprocess`` " -"to true, and always uses :mod:`sys` and :mod:`os` to obtain the necessary " -"CGI streams and environment." +"This class is a subclass of :class:`BaseCGIHandler` that sets " +"``wsgi.run_once`` to true, ``wsgi.multithread`` to false, and " +"``wsgi.multiprocess`` to true, and always uses :mod:`sys` and :mod:`os` to " +"obtain the necessary CGI streams and environment." msgstr "" "這個類別是 :class:`BaseCGIHandler` 的子類別將 ``wsgi.run_once`` 設置為 true," "``wsgi.multithread`` 設置為 false,並將 ``wsgi.multiprocess`` 設置為 true,並" -"且始終使用 :mod:`sys` 和 :mod:`os` 來獲取所需的 CGI 串流以及環境。" +"且始終使用 :mod:`sys` 和 :mod:`os` 來取得所需的 CGI 串流以及環境。" -#: ../../library/wsgiref.rst:478 +#: ../../library/wsgiref.rst:481 msgid "" "A specialized alternative to :class:`CGIHandler`, for use when deploying on " "Microsoft's IIS web server, without having set the config allowPathInfo " @@ -744,7 +760,7 @@ msgstr "" "個專門替代選擇,無需設置 config 的 allowPathInfo 選項(IIS>=7),或 metabase " "的 allowPathInfoForScriptMappings 選項(IIS<7)。" -#: ../../library/wsgiref.rst:482 +#: ../../library/wsgiref.rst:485 msgid "" "By default, IIS gives a ``PATH_INFO`` that duplicates the ``SCRIPT_NAME`` at " "the front, causing problems for WSGI applications that wish to implement " @@ -754,7 +770,7 @@ msgstr "" "作路由的 WSGI 應用程式造成問題。這個處理程式(handler)會移除任何這樣的重複路" "徑。" -#: ../../library/wsgiref.rst:486 +#: ../../library/wsgiref.rst:489 msgid "" "IIS can be configured to pass the correct ``PATH_INFO``, but this causes " "another bug where ``PATH_TRANSLATED`` is wrong. Luckily this variable is " @@ -770,30 +786,31 @@ msgstr "" "``PATH_TRANSLATED`` 問題時會中斷。由於這個原因幾乎從不會使用修復的 IIS<7(即" "使是 IIS7 也很少使用它,因為它仍然沒有相應的 UI)。" -#: ../../library/wsgiref.rst:494 +#: ../../library/wsgiref.rst:497 msgid "" "There is no way for CGI code to tell whether the option was set, so a " -"separate handler class is provided. It is used in the same way as :class:" -"`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where ``app`` " -"is the WSGI application object you wish to invoke." +"separate handler class is provided. It is used in the same way " +"as :class:`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where " +"``app`` is the WSGI application object you wish to invoke." msgstr "" "CGI 程式碼無法知道是否已設置該選項,因此提供了一個獨立的處理程式(handler)類" -"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 ``IISCGIHandler()." -"run(app)`` 來使用,其中 ``app`` 是你希望呼叫的 WSGI 應用程式物件。" +"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 " +"``IISCGIHandler().run(app)`` 來使用,其中 ``app`` 是你希望叫用的 WSGI 應用程" +"式物件。" -#: ../../library/wsgiref.rst:504 +#: ../../library/wsgiref.rst:507 msgid "" -"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and :mod:" -"`os` modules, the CGI environment and I/O streams are specified explicitly. " -"The *multithread* and *multiprocess* values are used to set the ``wsgi." -"multithread`` and ``wsgi.multiprocess`` flags for any applications run by " -"the handler instance." +"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` " +"and :mod:`os` modules, the CGI environment and I/O streams are specified " +"explicitly. The *multithread* and *multiprocess* values are used to set the " +"``wsgi.multithread`` and ``wsgi.multiprocess`` flags for any applications " +"run by the handler instance." msgstr "" "類似於 :class:`CGIHandler`,但不是使用 :mod:`sys` 和 :mod:`os` 模組,而是明確" "指定 CGI 環境與 I/O 串流。*multithread* 和 *multiprocess* 值用於設置由處理程" "式(handler)實例運行的任何應用程式的旗標。" -#: ../../library/wsgiref.rst:510 +#: ../../library/wsgiref.rst:513 msgid "" "This class is a subclass of :class:`SimpleHandler` intended for use with " "software other than HTTP \"origin servers\". If you are writing a gateway " @@ -801,38 +818,37 @@ msgid "" "``Status:`` header to send an HTTP status, you probably want to subclass " "this instead of :class:`SimpleHandler`." msgstr "" -"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用的 :class:" -"`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來發送 HTTP " -"狀態的閘道協議實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類化這個類別" -"來替代 :class:`SimpleHandler`。" +"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用" +"的 :class:`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來" +"發送 HTTP 狀態的閘道協議實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類" +"化這個類別來替代 :class:`SimpleHandler`。" -#: ../../library/wsgiref.rst:519 +#: ../../library/wsgiref.rst:522 msgid "" "Similar to :class:`BaseCGIHandler`, but designed for use with HTTP origin " "servers. If you are writing an HTTP server implementation, you will " "probably want to subclass this instead of :class:`BaseCGIHandler`." msgstr "" "類似於 :class:`BaseCGIHandler`,但是被設計使用在 HTTP origin 伺服器。如果你正" -"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替代 :class:" -"`BaseCGIHandler`。" +"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替" +"代 :class:`BaseCGIHandler`。" -#: ../../library/wsgiref.rst:523 +#: ../../library/wsgiref.rst:526 msgid "" "This class is a subclass of :class:`BaseHandler`. It overrides the :meth:`!" -"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :" -"meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, and :meth:" -"`~BaseHandler._flush` methods to support explicitly setting the environment " -"and streams via the constructor. The supplied environment and streams are " -"stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:" -"`environ` attributes." +"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, " +"and :meth:`~BaseHandler._flush` methods to support explicitly setting the " +"environment and streams via the constructor. The supplied environment and " +"streams are stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, " +"and :attr:`environ` attributes." msgstr "" -"這個類別是 :class:`BaseHandler` 的子類別。它透過建構器去覆寫 :meth:`!" -"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:" -"meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、和 :meth:" -"`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流被儲存" -"在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環境中。" +"這個類別是 :class:`BaseHandler` 的子類別。它透過建構函式去覆寫 :meth:`!" +"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、" +"和 :meth:`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流" +"被儲存在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環" +"境中。" -#: ../../library/wsgiref.rst:532 +#: ../../library/wsgiref.rst:535 msgid "" "The :meth:`~io.BufferedIOBase.write` method of *stdout* should write each " "chunk in full, like :class:`io.BufferedIOBase`." @@ -840,7 +856,7 @@ msgstr "" "*stdout* 的 :meth:`~io.BufferedIOBase.write` 方法應該完整地寫入每個塊" "(chunk),像是 :class:`io.BufferedIOBase`。" -#: ../../library/wsgiref.rst:538 +#: ../../library/wsgiref.rst:541 msgid "" "This is an abstract base class for running WSGI applications. Each instance " "will handle a single HTTP request, although in principle you could create a " @@ -849,30 +865,30 @@ msgstr "" "這是一個運行 WSGI 應用程式的抽象基底類別。每個實例將處理單個 HTTP 請求,儘管" "原則上你可以建立一個可重用於多個請求的子類別。" -#: ../../library/wsgiref.rst:542 +#: ../../library/wsgiref.rst:545 msgid "" ":class:`BaseHandler` instances have only one method intended for external " "use:" msgstr ":class:`BaseHandler` 實例只有一個供外部使用的方法:" -#: ../../library/wsgiref.rst:547 +#: ../../library/wsgiref.rst:550 msgid "Run the specified WSGI application, *app*." msgstr "運行指定 WSGI 應用程式,*app*。" -#: ../../library/wsgiref.rst:549 +#: ../../library/wsgiref.rst:552 msgid "" "All of the other :class:`BaseHandler` methods are invoked by this method in " "the process of running the application, and thus exist primarily to allow " "customizing the process." msgstr "" -"此方法在運行應用程式的過程中呼叫了所有其他 :class:`BaseHandler` 的方法,因此" +"此方法在運行應用程式的過程中叫用了所有其他 :class:`BaseHandler` 的方法,因此" "這些方法主要存在是為了允許自定義整個過程。" -#: ../../library/wsgiref.rst:553 +#: ../../library/wsgiref.rst:556 msgid "The following methods MUST be overridden in a subclass:" msgstr "以下方法必須在子類別中覆寫:" -#: ../../library/wsgiref.rst:558 +#: ../../library/wsgiref.rst:561 msgid "" "Buffer the bytes *data* for transmission to the client. It's okay if this " "method actually transmits the data; :class:`BaseHandler` just separates " @@ -883,55 +899,55 @@ msgstr "" "底層系統實際具有這種區分時,:class:`BaseHandler` 為了更好的效能進而分離寫入和" "刷新操作。" -#: ../../library/wsgiref.rst:566 +#: ../../library/wsgiref.rst:569 msgid "" "Force buffered data to be transmitted to the client. It's okay if this " "method is a no-op (i.e., if :meth:`_write` actually sends the data)." msgstr "" -"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如果 :" -"meth:`_write` 實際上發送了數據),那麼是可以的。" +"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如" +"果 :meth:`_write` 實際上發送了數據),那麼是可以的。" -#: ../../library/wsgiref.rst:572 +#: ../../library/wsgiref.rst:575 msgid "" "Return an object compatible with :class:`~wsgiref.types.InputStream` " "suitable for use as the ``wsgi.input`` of the request currently being " "processed." msgstr "" -"回傳一個與 :class:`~wsgiref.types.InputStream` 相容的物件並適用於用作當前正在" +"回傳一個與 :class:`~wsgiref.types.InputStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.input``。" -#: ../../library/wsgiref.rst:579 +#: ../../library/wsgiref.rst:582 msgid "" "Return an object compatible with :class:`~wsgiref.types.ErrorStream` " "suitable for use as the ``wsgi.errors`` of the request currently being " "processed." msgstr "" -"回傳一個與 :class:`~wsgiref.types.ErrorStream` 相容的物件並適用於用作當前正在" +"回傳一個與 :class:`~wsgiref.types.ErrorStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.errors``。" -#: ../../library/wsgiref.rst:586 +#: ../../library/wsgiref.rst:589 msgid "" "Insert CGI variables for the current request into the :attr:`environ` " "attribute." -msgstr "將當前請求的 CGI 變數插入到 :attr:`environ` 屬性中。" +msgstr "將目前請求的 CGI 變數插入到 :attr:`environ` 屬性中。" -#: ../../library/wsgiref.rst:588 +#: ../../library/wsgiref.rst:591 msgid "" "Here are some other methods and attributes you may wish to override. This " "list is only a summary, however, and does not include every method that can " "be overridden. You should consult the docstrings and source code for " -"additional information before attempting to create a customized :class:" -"`BaseHandler` subclass." +"additional information before attempting to create a " +"customized :class:`BaseHandler` subclass." msgstr "" "以下是你可能希望覆寫的其他方法和屬性。這個列表只是一個摘要,然而,不包括可以" "被覆寫的每個方法。在嘗試建立自定義的 :class:`BaseHandler` 子類別之前,你應該" "參考文件說明和原始碼以獲得更多資訊。" -#: ../../library/wsgiref.rst:594 +#: ../../library/wsgiref.rst:597 msgid "Attributes and methods for customizing the WSGI environment:" msgstr "用於自定義 WSGI 環境的屬性和方法:" -#: ../../library/wsgiref.rst:599 +#: ../../library/wsgiref.rst:602 msgid "" "The value to be used for the ``wsgi.multithread`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -940,7 +956,7 @@ msgstr "" "用於 ``wsgi.multithread`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:606 +#: ../../library/wsgiref.rst:609 msgid "" "The value to be used for the ``wsgi.multiprocess`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -949,7 +965,7 @@ msgstr "" "用於 ``wsgi.multiprocess`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:613 +#: ../../library/wsgiref.rst:616 msgid "" "The value to be used for the ``wsgi.run_once`` environment variable. It " "defaults to false in :class:`BaseHandler`, but :class:`CGIHandler` sets it " @@ -958,20 +974,21 @@ msgstr "" "用於 ``wsgi.run_once`` 環境變數的值。在 :class:`BaseHandler` 中預設為 false," "但 :class:`CGIHandler` 預設將其設置為 true。" -#: ../../library/wsgiref.rst:620 +#: ../../library/wsgiref.rst:623 msgid "" "The default environment variables to be included in every request's WSGI " -"environment. By default, this is a copy of ``os.environ`` at the time that :" -"mod:`wsgiref.handlers` was imported, but subclasses can either create their " -"own at the class or instance level. Note that the dictionary should be " -"considered read-only, since the default value is shared between multiple " +"environment. By default, this is a copy of ``os.environ`` at the time " +"that :mod:`wsgiref.handlers` was imported, but subclasses can either create " +"their own at the class or instance level. Note that the dictionary should " +"be considered read-only, since the default value is shared between multiple " "classes and instances." msgstr "" -"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載入 :mod:" -"`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例層級建立" -"自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共享。" +"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載" +"入 :mod:`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例" +"層級建立自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共" +"享。" -#: ../../library/wsgiref.rst:630 +#: ../../library/wsgiref.rst:633 msgid "" "If the :attr:`origin_server` attribute is set, this attribute's value is " "used to set the default ``SERVER_SOFTWARE`` WSGI environment variable, and " @@ -981,28 +998,28 @@ msgid "" msgstr "" "如果設置 :attr:`origin_server` 屬性,則此屬性的值將用於設置預設的 " "``SERVER_SOFTWARE`` WSGI 環境變數,並且還將用於設置 HTTP 回應中的預設 " -"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例如 :class:" -"`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" +"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例" +"如 :class:`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" -#: ../../library/wsgiref.rst:636 +#: ../../library/wsgiref.rst:639 msgid "" "The term \"Python\" is replaced with implementation specific term like " "\"CPython\", \"Jython\" etc." msgstr "" "將術語 \"Python\" 替換為特定實作的術語,如 \"CPython\"、\"Jython\" 等。" -#: ../../library/wsgiref.rst:642 +#: ../../library/wsgiref.rst:645 msgid "" "Return the URL scheme being used for the current request. The default " -"implementation uses the :func:`guess_scheme` function from :mod:`wsgiref." -"util` to guess whether the scheme should be \"http\" or \"https\", based on " -"the current request's :attr:`environ` variables." +"implementation uses the :func:`guess_scheme` function " +"from :mod:`wsgiref.util` to guess whether the scheme should be \"http\" or " +"\"https\", based on the current request's :attr:`environ` variables." msgstr "" -"回傳用於當前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中的 :func:" -"`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目前請求的 :" -"attr:`environ` 變數。" +"回傳用於目前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中" +"的 :func:`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目" +"前請求的 :attr:`environ` 變數。" -#: ../../library/wsgiref.rst:650 +#: ../../library/wsgiref.rst:653 msgid "" "Set the :attr:`environ` attribute to a fully populated WSGI environment. " "The default implementation uses all of the above methods and attributes, " @@ -1017,11 +1034,11 @@ msgstr "" "``SERVER_SOFTWARE`` 關鍵字,只要 :attr:`origin_server` 屬性是一個 true 值並" "且 :attr:`server_software` 屬性被設置。" -#: ../../library/wsgiref.rst:657 +#: ../../library/wsgiref.rst:660 msgid "Methods and attributes for customizing exception handling:" msgstr "用於自定義例外處理的屬性和方法:" -#: ../../library/wsgiref.rst:662 +#: ../../library/wsgiref.rst:665 msgid "" "Log the *exc_info* tuple in the server log. *exc_info* is a ``(type, value, " "traceback)`` tuple. The default implementation simply writes the traceback " @@ -1035,41 +1052,46 @@ msgstr "" "並刷新它。子類別可以覆蓋此方法以更改格式或重新定向輸出,將追蹤資訊發送給管理" "員,或執行其他被認為合適的操作。" -#: ../../library/wsgiref.rst:671 +#: ../../library/wsgiref.rst:674 msgid "" -"The maximum number of frames to include in tracebacks output by the default :" -"meth:`log_exception` method. If ``None``, all frames are included." +"The maximum number of frames to include in tracebacks output by the " +"default :meth:`log_exception` method. If ``None``, all frames are included." msgstr "" "預設的 :meth:`log_exception` 方法追蹤輸出中包含的最大幀數 。如果為 ``None``," "則包含所有幀。" -#: ../../library/wsgiref.rst:677 +#: ../../library/wsgiref.rst:680 msgid "" "This method is a WSGI application to generate an error page for the user. " "It is only invoked if an error occurs before headers are sent to the client." msgstr "" "這個方法是一個為使用者去產生錯誤頁面的 WSGI 應用程式。只有在標頭傳送給用戶端" -"前如果發生錯誤才會被呼叫。" +"前如果發生錯誤才會被叫用。" -#: ../../library/wsgiref.rst:680 +#: ../../library/wsgiref.rst:683 msgid "" "This method can access the current error using ``sys.exception()``, and " "should pass that information to *start_response* when calling it (as " -"described in the \"Error Handling\" section of :pep:`3333`)." +"described in the \"Error Handling\" section of :pep:`3333`). In particular, " +"the *start_response* callable should follow the :class:`.StartResponse` " +"protocol." msgstr "" -"此方法使用 ``sys.exception()`` 存取當前的錯誤,當呼叫它(如 :pep:`3333` 的 " -"\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。" +"此方法使用 ``sys.exception()`` 存取目前的錯誤,當呼叫它(如 :pep:`3333` 的 " +"\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。特別是 " +"*start_response* 可呼叫物件應該遵循 :class:`.StartResponse` 協定。" -#: ../../library/wsgiref.rst:684 +#: ../../library/wsgiref.rst:689 msgid "" -"The default implementation just uses the :attr:`error_status`, :attr:" -"`error_headers`, and :attr:`error_body` attributes to generate an output " -"page. Subclasses can override this to produce more dynamic error output." +"The default implementation just uses " +"the :attr:`error_status`, :attr:`error_headers`, and :attr:`error_body` " +"attributes to generate an output page. Subclasses can override this to " +"produce more dynamic error output." msgstr "" -"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` 和 :attr:" -"`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯誤輸出。" +"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` " +"和 :attr:`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯" +"誤輸出。" -#: ../../library/wsgiref.rst:688 +#: ../../library/wsgiref.rst:693 msgid "" "Note, however, that it's not recommended from a security perspective to spit " "out diagnostics to any old user; ideally, you should have to do something " @@ -1079,7 +1101,7 @@ msgstr "" "然而,從安全的角度並不建議向任何普通使用者顯示診斷資訊;理想情況下,你應該需" "要採取特殊措施才能啟用診斷輸出,這就是預設實作不包括任何診斷資訊的原因。" -#: ../../library/wsgiref.rst:696 +#: ../../library/wsgiref.rst:701 msgid "" "The HTTP status used for error responses. This should be a status string as " "defined in :pep:`3333`; it defaults to a 500 code and message." @@ -1087,7 +1109,7 @@ msgstr "" "用於錯誤回應的 HTTP 狀態。這應該是一個按照 :pep:`3333` 定義的狀態字串;預設" "為 500 狀態碼和訊息。" -#: ../../library/wsgiref.rst:702 +#: ../../library/wsgiref.rst:707 msgid "" "The HTTP headers used for error responses. This should be a list of WSGI " "response headers (``(name, value)`` tuples), as described in :pep:`3333`. " @@ -1097,7 +1119,7 @@ msgstr "" "value)`` 元組),如 :pep:`3333` 中所描述。預設串列只設置內容種類為 ``text/" "plain``。" -#: ../../library/wsgiref.rst:709 +#: ../../library/wsgiref.rst:714 msgid "" "The error response body. This should be an HTTP response body bytestring. " "It defaults to the plain text, \"A server error occurred. Please contact " @@ -1106,7 +1128,7 @@ msgstr "" "錯誤回應的主體。這應該是一個 HTTP 回應內容的位元組字串。預設為純文字 \"A " "server error occurred. Please contact the administrator.\"" -#: ../../library/wsgiref.rst:713 +#: ../../library/wsgiref.rst:718 msgid "" "Methods and attributes for :pep:`3333`'s \"Optional Platform-Specific File " "Handling\" feature:" @@ -1114,17 +1136,17 @@ msgstr "" "用於 :pep:`3333` 中的 \"Optional Platform-Specific File Handling\" 功能的方法" "和屬性:" -#: ../../library/wsgiref.rst:719 +#: ../../library/wsgiref.rst:724 msgid "" -"A ``wsgi.file_wrapper`` factory, compatible with :class:`wsgiref.types." -"FileWrapper`, or ``None``. The default value of this attribute is the :" -"class:`wsgiref.util.FileWrapper` class." +"A ``wsgi.file_wrapper`` factory, compatible " +"with :class:`wsgiref.types.FileWrapper`, or ``None``. The default value of " +"this attribute is the :class:`wsgiref.util.FileWrapper` class." msgstr "" -"一個 ``wsgi.file_wrapper`` 工廠函式(factory),與 :class:`wsgiref.types." -"FileWrapper` 相容,或者為 ``None``。這個屬性的預設值是 :class:`wsgiref.util." -"FileWrapper` 類別。" +"一個 ``wsgi.file_wrapper`` 工廠函式(factory)," +"與 :class:`wsgiref.types.FileWrapper` 相容,或者為 ``None``。這個屬性的預設值" +"是 :class:`wsgiref.util.FileWrapper` 類別。" -#: ../../library/wsgiref.rst:726 +#: ../../library/wsgiref.rst:731 msgid "" "Override to implement platform-specific file transmission. This method is " "called only if the application's return value is an instance of the class " @@ -1133,35 +1155,35 @@ msgid "" "default transmission code will not be executed. The default implementation " "of this method just returns a false value." msgstr "" -"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是由 :attr:" -"`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成功傳輸檔" -"案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作只回傳一" -"個 false 值。" +"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是" +"由 :attr:`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成" +"功傳輸檔案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作" +"只回傳一個 false 值。" -#: ../../library/wsgiref.rst:733 +#: ../../library/wsgiref.rst:738 msgid "Miscellaneous methods and attributes:" msgstr "其他方法和屬性:" -#: ../../library/wsgiref.rst:738 +#: ../../library/wsgiref.rst:743 msgid "" "This attribute should be set to a true value if the handler's :meth:`_write` " "and :meth:`_flush` are being used to communicate directly to the client, " "rather than via a CGI-like gateway protocol that wants the HTTP status in a " "special ``Status:`` header." msgstr "" -"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` 和 :" -"meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協議希望 " +"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` " +"和 :meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協議希望 " "HTTP 狀態在特殊的 ``Status:`` 標頭中。" -#: ../../library/wsgiref.rst:743 +#: ../../library/wsgiref.rst:748 msgid "" "This attribute's default value is true in :class:`BaseHandler`, but false " "in :class:`BaseCGIHandler` and :class:`CGIHandler`." msgstr "" -"這個屬性在 :class:`BaseCGIHandler` 預設值為 true,但是在 :class:" -"`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" +"這個屬性在 :class:`BaseCGIHandler` 預設值為 true,但是" +"在 :class:`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" -#: ../../library/wsgiref.rst:749 +#: ../../library/wsgiref.rst:754 msgid "" "If :attr:`origin_server` is true, this string attribute is used to set the " "HTTP version of the response set to the client. It defaults to ``\"1.0\"``." @@ -1169,11 +1191,11 @@ msgstr "" "如果 :attr:`origin_server` 為 true,則此字串屬性用於設定傳送給用戶端的回應的 " "HTTP 版本。預設為 ``\"1.0\"``。" -#: ../../library/wsgiref.rst:755 +#: ../../library/wsgiref.rst:760 msgid "" "Transcode CGI variables from ``os.environ`` to :pep:`3333` \"bytes in " -"unicode\" strings, returning a new dictionary. This function is used by :" -"class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " +"unicode\" strings, returning a new dictionary. This function is used " +"by :class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " "``os.environ``, which is not necessarily WSGI-compliant on all platforms and " "web servers using Python 3 -- specifically, ones where the OS's actual " "environment is Unicode (i.e. Windows), or ones where the environment is " @@ -1181,13 +1203,13 @@ msgid "" "than ISO-8859-1 (e.g. Unix systems using UTF-8)." msgstr "" "從 ``os.environ`` 轉碼 CGI 變數到 :pep:`3333` 中的 \"bytes in unicode\" 字" -"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` 和 :class:" -"`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 Python 3 的網" -"頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 Unicode(例如 " -"Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解碼它的系統編碼" -"不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" +"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` " +"和 :class:`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 " +"Python 3 的網頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 " +"Unicode(例如 Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解" +"碼它的系統編碼不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" -#: ../../library/wsgiref.rst:764 +#: ../../library/wsgiref.rst:769 msgid "" "If you are implementing a CGI-based handler of your own, you probably want " "to use this routine instead of just copying values out of ``os.environ`` " @@ -1196,17 +1218,17 @@ msgstr "" "如果你自己正在實作 CGI-based 處理程式(handler),你可能想要使用這個函式來替" "換單純直接從 ``os.environ`` 中複製值。" -#: ../../library/wsgiref.rst:772 +#: ../../library/wsgiref.rst:777 msgid ":mod:`wsgiref.types` -- WSGI types for static type checking" msgstr ":mod:`wsgiref.types` -- 用於靜態型別檢查的 WSGI 型別" -#: ../../library/wsgiref.rst:778 +#: ../../library/wsgiref.rst:783 msgid "" -"This module provides various types for static type checking as described in :" -"pep:`3333`." +"This module provides various types for static type checking as described " +"in :pep:`3333`." msgstr "這個模組提供在 :pep:`3333` 中所描述的各種用於靜態型別檢查的型別。" -#: ../../library/wsgiref.rst:786 +#: ../../library/wsgiref.rst:791 msgid "" "A :class:`typing.Protocol` describing :pep:`start_response() <3333#the-start-" "response-callable>` callables (:pep:`3333`)." @@ -1214,49 +1236,52 @@ msgstr "" "一個描述 :pep:`start_response() <3333#the-start-response-callable>` 可呼叫物" "件的 :class:`typing.Protocol` (:pep:`3333`)。" -#: ../../library/wsgiref.rst:792 +#: ../../library/wsgiref.rst:797 msgid "A type alias describing a WSGI environment dictionary." msgstr "一個描述 WSGI 環境字典的型別別名。" -#: ../../library/wsgiref.rst:796 +#: ../../library/wsgiref.rst:801 msgid "A type alias describing a WSGI application callable." msgstr "一個描述 WSGI 應用程式可呼叫物件的型別別名。" -#: ../../library/wsgiref.rst:800 +#: ../../library/wsgiref.rst:805 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Input Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ 的 :class:" -"`typing.Protocol`。" +"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ " +"的 :class:`typing.Protocol`。" -#: ../../library/wsgiref.rst:805 +#: ../../library/wsgiref.rst:810 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Error Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ 的 :class:" -"`typing.Protocol`。" +"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ " +"的 :class:`typing.Protocol`。" -#: ../../library/wsgiref.rst:810 +#: ../../library/wsgiref.rst:815 msgid "" "A :class:`typing.Protocol` describing a :pep:`file wrapper <3333#optional-" "platform-specific-file-handling>`. See :class:`wsgiref.util.FileWrapper` for " "a concrete implementation of this protocol." msgstr "" "一個描述\\ :pep:`檔案包裝器 <3333#optional-platform-specific-file-" -"handling>`\\ 的 :class:`typing.Protocol`。請參閱 :class:`wsgiref.util." -"FileWrapper` 來瞭解此協議的具體實作。" +"handling>`\\ 的 :class:`typing.Protocol`。請參" +"閱 :class:`wsgiref.util.FileWrapper` 來瞭解此協議的具體實作。" -#: ../../library/wsgiref.rst:817 +#: ../../library/wsgiref.rst:822 msgid "Examples" msgstr "範例" -#: ../../library/wsgiref.rst:819 -msgid "This is a working \"Hello World\" WSGI application::" -msgstr "這個一個運作中的 \"Hello World\" WSGI 應用程式: ::" +#: ../../library/wsgiref.rst:824 +msgid "" +"This is a working \"Hello World\" WSGI application, where the " +"*start_response* callable should follow the :class:`.StartResponse` " +"protocol::" +msgstr "" -#: ../../library/wsgiref.rst:821 +#: ../../library/wsgiref.rst:827 msgid "" "\"\"\"\n" "Every WSGI application must have an application object - a callable\n" @@ -1285,15 +1310,15 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:848 +#: ../../library/wsgiref.rst:854 msgid "" "Example of a WSGI application serving the current directory, accept optional " "directory and port number (default: 8000) on the command line::" msgstr "" -"提供當前目錄的 WSGI 應用程式範例,並接受命令列上的可選目錄和埠號(預設:" +"提供目前目錄的 WSGI 應用程式範例,並接受命令列上的可選目錄和埠號(預設:" "8000): ::" -#: ../../library/wsgiref.rst:851 +#: ../../library/wsgiref.rst:857 msgid "" "\"\"\"\n" "Small wsgiref based web server. Takes a path to serve from and an\n" @@ -1337,3 +1362,6 @@ msgid "" " print(\"Shutting down.\")\n" " httpd.server_close()" msgstr "" + +#~ msgid "This is a working \"Hello World\" WSGI application::" +#~ msgstr "這個一個運作中的 \"Hello World\" WSGI 應用程式: ::" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 4ea29b3a93..9835d74f1c 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -86,29 +86,29 @@ msgid "" "class:`bytes` and :class:`bytearray` objects may be passed to calls. The " "*headers* parameter is an optional sequence of HTTP headers to send with " "each request, expressed as a sequence of 2-tuples representing the header " -"name and value. (e.g. ``[('Header-Name', 'value')]``). The obsolete " -"*use_datetime* flag is similar to *use_builtin_types* but it applies only to " -"date/time values." +"name and value. (e.g. ``[('Header-Name', 'value')]``). If an HTTPS URL is " +"provided, *context* may be :class:`ssl.SSLContext` and configures the SSL " +"settings of the underlying HTTPS connection. The obsolete *use_datetime* " +"flag is similar to *use_builtin_types* but it applies only to date/time " +"values." msgstr "" -#: ../../library/xmlrpc.client.rst:67 ../../library/xmlrpc.client.rst:549 +#: ../../library/xmlrpc.client.rst:69 ../../library/xmlrpc.client.rst:549 msgid "The *use_builtin_types* flag was added." msgstr "新增 *use_builtin_types* 旗標。" -#: ../../library/xmlrpc.client.rst:70 +#: ../../library/xmlrpc.client.rst:72 msgid "The *headers* parameter was added." msgstr "新增 *headers* 參數。" -#: ../../library/xmlrpc.client.rst:73 +#: ../../library/xmlrpc.client.rst:75 msgid "" "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP " "Basic Authentication: ``http://user:pass@host:port/path``. The ``user:" "pass`` portion will be base64-encoded as an HTTP 'Authorization' header, and " "sent to the remote server as part of the connection process when invoking an " "XML-RPC method. You only need to use this if the remote server requires a " -"Basic Authentication user and password. If an HTTPS URL is provided, " -"*context* may be :class:`ssl.SSLContext` and configures the SSL settings of " -"the underlying HTTPS connection." +"Basic Authentication user and password." msgstr "" #: ../../library/xmlrpc.client.rst:82 diff --git a/library/xmlrpc.po b/library/xmlrpc.po index 15a6dc34eb..67ae4e4fe6 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2024-12-11 00:14+0000\n" "PO-Revision-Date: 2022-02-16 01:58+0800\n" "Last-Translator: Matt Wang <mattwang44@gamil.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,7 @@ msgstr "" msgid ":mod:`!xmlrpc` --- XMLRPC server and client modules" msgstr ":mod:`!xmlrpc` --- XMLRPC 伺服器與用戶模組" -#: ../../library/xmlrpc.rst:4 +#: ../../library/xmlrpc.rst:7 msgid "" "XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a " "transport. With it, a client can call methods with parameters on a remote " @@ -31,19 +31,19 @@ msgid "" msgstr "" "XML-RPC 是一種遠端程序呼叫 (Remote Procedure Call) 方法,它使用通過 HTTP 傳輸" "(transport)的 XML 來做傳遞。有了它,用戶端可以在遠端伺服器上呼叫帶有參數的" -"方法(伺服器以 URI 命名)並獲取結構化的資料。" +"方法(伺服器以 URI 命名)並取得結構化的資料。" -#: ../../library/xmlrpc.rst:8 +#: ../../library/xmlrpc.rst:11 msgid "" "``xmlrpc`` is a package that collects server and client modules implementing " "XML-RPC. The modules are:" msgstr "" "``xmlrpc`` 是一個集合了 XML-RPC 伺服器與用戶端模組實作的套件。這些模組是:" -#: ../../library/xmlrpc.rst:11 +#: ../../library/xmlrpc.rst:14 msgid ":mod:`xmlrpc.client`" msgstr ":mod:`xmlrpc.client`" -#: ../../library/xmlrpc.rst:12 +#: ../../library/xmlrpc.rst:15 msgid ":mod:`xmlrpc.server`" msgstr ":mod:`xmlrpc.server`" diff --git a/library/zipfile.po b/library/zipfile.po index acfa9acf15..1d66416bb3 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-09 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -213,7 +213,7 @@ msgid "" "accepted (see :class:`bz2 <bz2.BZ2File>` for more information)." msgstr "" -#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:760 +#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:768 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " @@ -274,7 +274,7 @@ msgstr "新增 :class:`ZipFile` 作為情境管理器使用的能力。" msgid "Added support for :mod:`bzip2 <bz2>` and :mod:`lzma` compression." msgstr "新增對於 :mod:`bzip2 <bz2>` 和 :mod:`lzma` 壓縮的支援。" -#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:673 +#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:681 msgid "ZIP64 extensions are enabled by default." msgstr "" @@ -292,15 +292,15 @@ msgstr "" #: ../../library/zipfile.rst:238 msgid "The *file* parameter accepts a :term:`path-like object`." -msgstr "" +msgstr "*file* 參數接受一個 :term:`path-like object`。" #: ../../library/zipfile.rst:241 msgid "Add the *compresslevel* parameter." -msgstr "" +msgstr "新增 *compresslevel* 參數。" #: ../../library/zipfile.rst:244 msgid "The *strict_timestamps* keyword-only parameter." -msgstr "" +msgstr "*strict_timestamps* 僅限關鍵字參數。" #: ../../library/zipfile.rst:247 msgid "" @@ -656,20 +656,31 @@ msgid "" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" -#: ../../library/zipfile.rst:546 +#: ../../library/zipfile.rst:547 +msgid "" +"The :class:`Path` class does not sanitize filenames within the ZIP archive. " +"Unlike the :meth:`ZipFile.extract` and :meth:`ZipFile.extractall` methods, " +"it is the caller's responsibility to validate or sanitize filenames to " +"prevent path traversal vulnerabilities (e.g., filenames containing \"..\" or " +"absolute paths). When handling untrusted archives, consider resolving " +"filenames using :func:`os.path.abspath` and checking against the target " +"directory with :func:`os.path.commonpath`." +msgstr "" + +#: ../../library/zipfile.rst:554 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" -#: ../../library/zipfile.rst:549 +#: ../../library/zipfile.rst:557 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." msgstr "" -#: ../../library/zipfile.rst:553 +#: ../../library/zipfile.rst:561 msgid "The final path component." msgstr "" -#: ../../library/zipfile.rst:557 +#: ../../library/zipfile.rst:565 msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " @@ -678,12 +689,12 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: ../../library/zipfile.rst:566 +#: ../../library/zipfile.rst:574 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" -#: ../../library/zipfile.rst:570 ../../library/zipfile.rst:631 +#: ../../library/zipfile.rst:578 ../../library/zipfile.rst:639 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " @@ -691,134 +702,134 @@ msgid "" "TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" -#: ../../library/zipfile.rst:578 +#: ../../library/zipfile.rst:586 msgid "Enumerate the children of the current directory." msgstr "" -#: ../../library/zipfile.rst:582 +#: ../../library/zipfile.rst:590 msgid "Return ``True`` if the current context references a directory." msgstr "" -#: ../../library/zipfile.rst:586 +#: ../../library/zipfile.rst:594 msgid "Return ``True`` if the current context references a file." msgstr "" -#: ../../library/zipfile.rst:590 +#: ../../library/zipfile.rst:598 msgid "Return ``True`` if the current context references a symbolic link." msgstr "" -#: ../../library/zipfile.rst:594 +#: ../../library/zipfile.rst:602 msgid "Previously, ``is_symlink`` would unconditionally return ``False``." msgstr "" -#: ../../library/zipfile.rst:599 +#: ../../library/zipfile.rst:607 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" -#: ../../library/zipfile.rst:604 +#: ../../library/zipfile.rst:612 msgid "" "The last dot-separated portion of the final component, if any. This is " "commonly called the file extension." msgstr "" -#: ../../library/zipfile.rst:607 +#: ../../library/zipfile.rst:615 msgid "Added :data:`Path.suffix` property." msgstr "新增 :data:`Path.suffix` 特性。" -#: ../../library/zipfile.rst:612 +#: ../../library/zipfile.rst:620 msgid "The final path component, without its suffix." msgstr "" -#: ../../library/zipfile.rst:614 +#: ../../library/zipfile.rst:622 msgid "Added :data:`Path.stem` property." msgstr "新增 :data:`Path.stem` 特性。" -#: ../../library/zipfile.rst:619 +#: ../../library/zipfile.rst:627 msgid "A list of the path’s suffixes, commonly called file extensions." msgstr "" -#: ../../library/zipfile.rst:621 +#: ../../library/zipfile.rst:629 msgid "Added :data:`Path.suffixes` property." msgstr "新增 :data:`Path.suffixes` 特性。" -#: ../../library/zipfile.rst:626 +#: ../../library/zipfile.rst:634 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -#: ../../library/zipfile.rst:639 +#: ../../library/zipfile.rst:647 msgid "Read the current file as bytes." msgstr "" -#: ../../library/zipfile.rst:643 +#: ../../library/zipfile.rst:651 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" -#: ../../library/zipfile.rst:646 +#: ../../library/zipfile.rst:654 msgid "" ">>> Path(...).joinpath('child').joinpath('grandchild')\n" ">>> Path(...).joinpath('child', 'grandchild')\n" ">>> Path(...) / 'child' / 'grandchild'" msgstr "" -#: ../../library/zipfile.rst:650 +#: ../../library/zipfile.rst:658 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" -#: ../../library/zipfile.rst:654 +#: ../../library/zipfile.rst:662 msgid "" "The :pypi:`zipp` project provides backports of the latest path object " "functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." "Path`` for early access to changes." msgstr "" -#: ../../library/zipfile.rst:662 +#: ../../library/zipfile.rst:670 msgid "PyZipFile Objects" msgstr "PyZipFile 物件" -#: ../../library/zipfile.rst:664 +#: ../../library/zipfile.rst:672 msgid "" "The :class:`PyZipFile` constructor takes the same parameters as the :class:" "`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" -#: ../../library/zipfile.rst:670 +#: ../../library/zipfile.rst:678 msgid "Added the *optimize* parameter." msgstr "新增 *optimize* 參數。" -#: ../../library/zipfile.rst:676 +#: ../../library/zipfile.rst:684 msgid "" "Instances have one method in addition to those of :class:`ZipFile` objects:" msgstr "" -#: ../../library/zipfile.rst:680 +#: ../../library/zipfile.rst:688 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -#: ../../library/zipfile.rst:683 +#: ../../library/zipfile.rst:691 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was not given or ``-1``, " "the corresponding file is a :file:`\\*.pyc` file, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:686 +#: ../../library/zipfile.rst:694 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was ``0``, ``1`` or ``2``, " "only files with that optimization level (see :func:`compile`) are added to " "the archive, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:690 +#: ../../library/zipfile.rst:698 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -831,11 +842,11 @@ msgid "" "in sorted order." msgstr "" -#: ../../library/zipfile.rst:700 +#: ../../library/zipfile.rst:708 msgid "*basename* is intended for internal use only." msgstr "" -#: ../../library/zipfile.rst:702 +#: ../../library/zipfile.rst:710 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -846,7 +857,7 @@ msgid "" "exclude them::" msgstr "" -#: ../../library/zipfile.rst:710 +#: ../../library/zipfile.rst:718 msgid "" ">>> zf = PyZipFile('myprog.zip')\n" ">>> def notests(s):\n" @@ -862,11 +873,11 @@ msgstr "" "...\n" ">>> zf.writepy('myprog', filterfunc=notests)" -#: ../../library/zipfile.rst:717 +#: ../../library/zipfile.rst:725 msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" -#: ../../library/zipfile.rst:720 +#: ../../library/zipfile.rst:728 msgid "" "string.pyc # Top level name\n" "test/__init__.pyc # Package directory\n" @@ -875,302 +886,302 @@ msgid "" "test/bogus/myfile.pyc # Submodule test.bogus.myfile" msgstr "" -#: ../../library/zipfile.rst:726 +#: ../../library/zipfile.rst:734 msgid "Added the *filterfunc* parameter." msgstr "新增 *filterfunc* 參數。" -#: ../../library/zipfile.rst:729 +#: ../../library/zipfile.rst:737 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:732 +#: ../../library/zipfile.rst:740 msgid "Recursion sorts directory entries." msgstr "" -#: ../../library/zipfile.rst:739 +#: ../../library/zipfile.rst:747 msgid "ZipInfo Objects" msgstr "ZipInfo 物件" -#: ../../library/zipfile.rst:741 +#: ../../library/zipfile.rst:749 msgid "" "Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` " "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -#: ../../library/zipfile.rst:745 +#: ../../library/zipfile.rst:753 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" -#: ../../library/zipfile.rst:751 +#: ../../library/zipfile.rst:759 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" -#: ../../library/zipfile.rst:754 +#: ../../library/zipfile.rst:762 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" -#: ../../library/zipfile.rst:756 +#: ../../library/zipfile.rst:764 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" -#: ../../library/zipfile.rst:768 +#: ../../library/zipfile.rst:776 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:771 +#: ../../library/zipfile.rst:779 msgid "Added the *strict_timestamps* keyword-only parameter." msgstr "新增 *strict_timestamps* 僅限關鍵字參數。" -#: ../../library/zipfile.rst:775 +#: ../../library/zipfile.rst:783 msgid "Instances have the following methods and attributes:" msgstr "" -#: ../../library/zipfile.rst:779 +#: ../../library/zipfile.rst:787 msgid "Return ``True`` if this archive member is a directory." msgstr "" -#: ../../library/zipfile.rst:781 +#: ../../library/zipfile.rst:789 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" -#: ../../library/zipfile.rst:788 +#: ../../library/zipfile.rst:796 msgid "Name of the file in the archive." msgstr "" -#: ../../library/zipfile.rst:793 +#: ../../library/zipfile.rst:801 msgid "" "The time and date of the last modification to the archive member. This is a " "tuple of six values:" msgstr "" -#: ../../library/zipfile.rst:797 +#: ../../library/zipfile.rst:805 msgid "Index" msgstr "" -#: ../../library/zipfile.rst:797 +#: ../../library/zipfile.rst:805 msgid "Value" msgstr "" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:807 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:807 msgid "Year (>= 1980)" msgstr "" -#: ../../library/zipfile.rst:801 +#: ../../library/zipfile.rst:809 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:801 +#: ../../library/zipfile.rst:809 msgid "Month (one-based)" msgstr "" -#: ../../library/zipfile.rst:803 +#: ../../library/zipfile.rst:811 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:803 +#: ../../library/zipfile.rst:811 msgid "Day of month (one-based)" msgstr "" -#: ../../library/zipfile.rst:805 +#: ../../library/zipfile.rst:813 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:805 +#: ../../library/zipfile.rst:813 msgid "Hours (zero-based)" msgstr "" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:815 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:815 msgid "Minutes (zero-based)" msgstr "" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:817 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:817 msgid "Seconds (zero-based)" msgstr "" -#: ../../library/zipfile.rst:814 +#: ../../library/zipfile.rst:822 msgid "The ZIP file format does not support timestamps before 1980." msgstr "" -#: ../../library/zipfile.rst:819 +#: ../../library/zipfile.rst:827 msgid "Type of compression for the archive member." msgstr "" -#: ../../library/zipfile.rst:824 +#: ../../library/zipfile.rst:832 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:829 +#: ../../library/zipfile.rst:837 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " "object." msgstr "" -#: ../../library/zipfile.rst:836 +#: ../../library/zipfile.rst:844 msgid "System which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:841 +#: ../../library/zipfile.rst:849 msgid "PKZIP version which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:846 +#: ../../library/zipfile.rst:854 msgid "PKZIP version needed to extract archive." msgstr "" -#: ../../library/zipfile.rst:851 +#: ../../library/zipfile.rst:859 msgid "Must be zero." msgstr "" -#: ../../library/zipfile.rst:856 +#: ../../library/zipfile.rst:864 msgid "ZIP flag bits." msgstr "" -#: ../../library/zipfile.rst:861 +#: ../../library/zipfile.rst:869 msgid "Volume number of file header." msgstr "" -#: ../../library/zipfile.rst:866 +#: ../../library/zipfile.rst:874 msgid "Internal attributes." msgstr "" -#: ../../library/zipfile.rst:871 +#: ../../library/zipfile.rst:879 msgid "External file attributes." msgstr "" -#: ../../library/zipfile.rst:876 +#: ../../library/zipfile.rst:884 msgid "Byte offset to the file header." msgstr "" -#: ../../library/zipfile.rst:881 +#: ../../library/zipfile.rst:889 msgid "CRC-32 of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:886 +#: ../../library/zipfile.rst:894 msgid "Size of the compressed data." msgstr "" -#: ../../library/zipfile.rst:891 +#: ../../library/zipfile.rst:899 msgid "Size of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:898 +#: ../../library/zipfile.rst:906 msgid "Command-Line Interface" msgstr "" -#: ../../library/zipfile.rst:900 +#: ../../library/zipfile.rst:908 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" -#: ../../library/zipfile.rst:903 +#: ../../library/zipfile.rst:911 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/zipfile.rst:906 +#: ../../library/zipfile.rst:914 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -#: ../../library/zipfile.rst:910 +#: ../../library/zipfile.rst:918 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/zipfile.rst:912 +#: ../../library/zipfile.rst:920 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" -#: ../../library/zipfile.rst:916 +#: ../../library/zipfile.rst:924 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/zipfile.rst:919 +#: ../../library/zipfile.rst:927 msgid "$ python -m zipfile -e monty.zip target-dir/" msgstr "$ python -m zipfile -e monty.zip target-dir/" -#: ../../library/zipfile.rst:923 +#: ../../library/zipfile.rst:931 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" -#: ../../library/zipfile.rst:925 +#: ../../library/zipfile.rst:933 msgid "$ python -m zipfile -l monty.zip" msgstr "$ python -m zipfile -l monty.zip" -#: ../../library/zipfile.rst:931 +#: ../../library/zipfile.rst:939 msgid "Command-line options" msgstr "" -#: ../../library/zipfile.rst:936 +#: ../../library/zipfile.rst:944 msgid "List files in a zipfile." msgstr "" -#: ../../library/zipfile.rst:941 +#: ../../library/zipfile.rst:949 msgid "Create zipfile from source files." msgstr "" -#: ../../library/zipfile.rst:946 +#: ../../library/zipfile.rst:954 msgid "Extract zipfile into target directory." msgstr "" -#: ../../library/zipfile.rst:951 +#: ../../library/zipfile.rst:959 msgid "Test whether the zipfile is valid or not." msgstr "" -#: ../../library/zipfile.rst:955 +#: ../../library/zipfile.rst:963 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "" -#: ../../library/zipfile.rst:962 +#: ../../library/zipfile.rst:970 msgid "Decompression pitfalls" msgstr "" -#: ../../library/zipfile.rst:964 +#: ../../library/zipfile.rst:972 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" -#: ../../library/zipfile.rst:967 +#: ../../library/zipfile.rst:975 msgid "From file itself" msgstr "" -#: ../../library/zipfile.rst:969 +#: ../../library/zipfile.rst:977 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" -#: ../../library/zipfile.rst:973 +#: ../../library/zipfile.rst:981 msgid "File System limitations" msgstr "" -#: ../../library/zipfile.rst:975 +#: ../../library/zipfile.rst:983 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1178,33 +1189,33 @@ msgid "" "files, etc." msgstr "" -#: ../../library/zipfile.rst:982 +#: ../../library/zipfile.rst:990 msgid "Resources limitations" msgstr "" -#: ../../library/zipfile.rst:984 +#: ../../library/zipfile.rst:992 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" -#: ../../library/zipfile.rst:989 +#: ../../library/zipfile.rst:997 msgid "Interruption" msgstr "" -#: ../../library/zipfile.rst:991 +#: ../../library/zipfile.rst:999 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" -#: ../../library/zipfile.rst:995 +#: ../../library/zipfile.rst:1003 msgid "Default behaviors of extraction" msgstr "" -#: ../../library/zipfile.rst:997 +#: ../../library/zipfile.rst:1005 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " diff --git a/library/zlib.po b/library/zlib.po index d2c292664d..ab476e6640 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2025-04-26 00:14+0000\n" "PO-Revision-Date: 2022-12-28 20:58+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -508,7 +508,7 @@ msgid "" "up random seeks into the stream at a future point." msgstr "" "回傳解壓物件的副本,這可用於在資料串流中途保存解壓縮器的狀態,以便在未來某個" -"時間點加速對串流的隨機搜索 (random seek)。" +"時間點加速對串流的隨機搜尋 (random seek)。" #: ../../library/zlib.rst:310 msgid "" @@ -562,6 +562,12 @@ msgid "" "functions." msgstr "zlib 手冊解釋了函式庫中許多函式的語義和用法。" +#: ../../library/zlib.rst:345 +msgid "" +"In case gzip (de)compression is a bottleneck, the `python-isal`_ package " +"speeds up (de)compression with a mostly compatible API." +msgstr "" + #: ../../library/zlib.rst:123 msgid "Cyclic Redundancy Check" msgstr "Cyclic Redundancy Check(循環冗餘核對)" diff --git a/license.po b/license.po index f56bcc5556..f233a27c8c 100644 --- a/license.po +++ b/license.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-02 00:14+0000\n" "PO-Revision-Date: 2022-06-27 09:40+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,49 +31,49 @@ msgstr "軟體沿革" #: ../../license.rst:13 msgid "" "Python was created in the early 1990s by Guido van Rossum at Stichting " -"Mathematisch Centrum (CWI, see https://www.cwi.nl/) in the Netherlands as a " +"Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands as a " "successor of a language called ABC. Guido remains Python's principal " "author, although it includes many contributions from others." msgstr "" -"Python 是由荷蘭數學和計算機科學研究學會(CWI,見 https://www.cwi.nl/)的 " +"Python 是由荷蘭數學和計算機科學研究學會(CWI,見 https://www.cwi.nl)的 " "Guido van Rossum 於 1990 年代早期所創造,目的是作為一種稱為 ABC 語言的後繼" "者。儘管 Python 包含了許多來自其他人的貢獻,Guido 仍是其主要作者。" #: ../../license.rst:18 msgid "" "In 1995, Guido continued his work on Python at the Corporation for National " -"Research Initiatives (CNRI, see https://www.cnri.reston.va.us/) in Reston, " +"Research Initiatives (CNRI, see https://www.cnri.reston.va.us) in Reston, " "Virginia where he released several versions of the software." msgstr "" -"1995 年,Guido 在維吉尼亞州雷斯頓的國家創新研究公司(CNRI,見 https://www." -"cnri.reston.va.us/)繼續他在 Python 的工作,並在那裡發佈了該軟體的多個版本。" +"1995 年,Guido 在維吉尼亞州雷斯頓的國家創新研究公司(CNRI,見 https://" +"www.cnri.reston.va.us)繼續他在 Python 的工作,並在那裡發佈了該軟體的多個版" +"本。" #: ../../license.rst:22 msgid "" "In May 2000, Guido and the Python core development team moved to BeOpen.com " "to form the BeOpen PythonLabs team. In October of the same year, the " -"PythonLabs team moved to Digital Creations (now Zope Corporation; see " -"https://www.zope.org/). In 2001, the Python Software Foundation (PSF, see " -"https://www.python.org/psf/) was formed, a non-profit organization created " -"specifically to own Python-related Intellectual Property. Zope Corporation " -"is a sponsoring member of the PSF." +"PythonLabs team moved to Digital Creations, which became Zope Corporation. " +"In 2001, the Python Software Foundation (PSF, see https://www.python.org/" +"psf/) was formed, a non-profit organization created specifically to own " +"Python-related Intellectual Property. Zope Corporation was a sponsoring " +"member of the PSF." msgstr "" "2000 年五月,Guido 和 Python 核心開發團隊轉移到 BeOpen.com 並成立了 BeOpen " -"PythonLabs 團隊。同年十月,PythonLabs 團隊轉移到 Digital Creations(現為 " -"Zope Corporation;見 https://www.zope.org/)。2001 年,Python 軟體基金會" -"(PSF,見 https://www.python.org/psf/)成立,這是一個專為擁有 Python 相關的智" -"慧財產權而創立的非營利組織。Zope Corporation 是 PSF 的一個贊助會員。" +"PythonLabs 團隊。同年十月,PythonLabs 團隊轉移到 Digital Creations,後來成為 " +"Zope Corporation。2001 年,Python 軟體基金會(PSF,見 https://www.python.org/" +"psf/)成立,這是一個專為擁有 Python 相關的智慧財產權而創立的非營利組織。Zope " +"Corporation 過去是 PSF 的一個贊助會員。" #: ../../license.rst:30 msgid "" -"All Python releases are Open Source (see https://opensource.org/ for the " -"Open Source Definition). Historically, most, but not all, Python releases " -"have also been GPL-compatible; the table below summarizes the various " -"releases." +"All Python releases are Open Source (see https://opensource.org for the Open " +"Source Definition). Historically, most, but not all, Python releases have " +"also been GPL-compatible; the table below summarizes the various releases." msgstr "" -"所有的 Python 版本都是開源的(有關開源的定義,參閱 https://opensource." -"org/)。歷史上,大多數但非全部的 Python 版本,也是 GPL 相容的;以下表格總結各" -"個版本的差異。" +"所有的 Python 版本都是開源的(有關開源的定義,參閱 https://opensource.org)。" +"歷史上,大多數但非全部的 Python 版本,也是 GPL 相容的;以下表格總結各個版本的" +"差異。" #: ../../license.rst:35 msgid "Release" @@ -92,8 +92,8 @@ msgid "Owner" msgstr "擁有者" #: ../../license.rst:35 -msgid "GPL compatible?" -msgstr "GPL 相容性?" +msgid "GPL-compatible? (1)" +msgstr "GPL 相容性? (1)" #: ../../license.rst:37 msgid "0.9.0 thru 1.2" @@ -145,8 +145,7 @@ msgstr "1.5.2" msgid "2000" msgstr "2000" -#: ../../license.rst:41 ../../license.rst:43 ../../license.rst:45 -#: ../../license.rst:47 +#: ../../license.rst:41 ../../license.rst:43 ../../license.rst:47 msgid "no" msgstr "否" @@ -167,6 +166,10 @@ msgstr "1.6.1" msgid "2001" msgstr "2001" +#: ../../license.rst:45 +msgid "yes (2)" +msgstr "是 (2)" + #: ../../license.rst:47 msgid "2.1" msgstr "2.1" @@ -214,7 +217,7 @@ msgstr "2001 至今" #: ../../license.rst:62 msgid "" -"GPL-compatible doesn't mean that we're distributing Python under the GPL. " +"GPL-compatible doesn't mean that we're distributing Python under the GPL. " "All Python licenses, unlike the GPL, let you distribute a modified version " "without making your changes open source. The GPL-compatible licenses make it " "possible to combine Python with other software that is released under the " @@ -226,50 +229,63 @@ msgstr "" #: ../../license.rst:68 msgid "" +"According to Richard Stallman, 1.6.1 is not GPL-compatible, because its " +"license has a choice of law clause. According to CNRI, however, Stallman's " +"lawyer has told CNRI's lawyer that 1.6.1 is \"not incompatible\" with the " +"GPL." +msgstr "" +"根據 Richard Stallman 的說法,1.6.1 不是 GPL 相容的,因為其授權有一個法律選擇" +"條款。然而根據 CNRI 的說法,Stallman 的律師告訴 CNRI 的律師,1.6.1 與 GPL「不" +"相容」。" + +#: ../../license.rst:72 +msgid "" "Thanks to the many outside volunteers who have worked under Guido's " "direction to make these releases possible." msgstr "" "感謝許多的外部志工,在 Guido 指導下的付出,使得這些版本的發佈成為可能。" -#: ../../license.rst:73 +#: ../../license.rst:77 msgid "Terms and conditions for accessing or otherwise using Python" msgstr "關於存取或以其他方式使用 Python 的合約條款" -#: ../../license.rst:75 +#: ../../license.rst:79 msgid "" -"Python software and documentation are licensed under the :ref:`PSF License " -"Agreement <PSF-license>`." -msgstr "Python 軟體和說明文件的授權是基於 :ref:`PSF 授權合約 <PSF-license>`。" +"Python software and documentation are licensed under the Python Software " +"Foundation License Version 2." +msgstr "" +"Python 軟體和說明文件的授權是基於 Python 軟體基金會授權第二版 (Python " +"Software Foundation License Version 2)。" -#: ../../license.rst:78 +#: ../../license.rst:82 msgid "" "Starting with Python 3.8.6, examples, recipes, and other code in the " -"documentation are dual licensed under the PSF License Agreement and the :ref:" -"`Zero-Clause BSD license <BSD0>`." +"documentation are dual licensed under the PSF License Version 2 and " +"the :ref:`Zero-Clause BSD license <BSD0>`." msgstr "" "從 Python 3.8.6 開始,說明文件中的範例、程式庫和其他程式碼,是被雙重授權 " -"(dual licensed) 於 PSF 授權合約以及 :ref:`Zero-Clause BSD 授權 <BSD0>`。" +"(dual licensed) 於 PSF 授權第二版以及 :ref:`Zero-Clause BSD 授權 <BSD0>`。" -#: ../../license.rst:82 +#: ../../license.rst:86 msgid "" "Some software incorporated into Python is under different licenses. The " -"licenses are listed with code falling under that license. See :ref:" -"`OtherLicenses` for an incomplete list of these licenses." +"licenses are listed with code falling under that license. " +"See :ref:`OtherLicenses` for an incomplete list of these licenses." msgstr "" "有些被納入 Python 中的軟體是基於不同的授權。這些授權將會與其授權之程式碼一起" "被列出。關於這些授權的不完整清單,請參閱\\ :ref:`OtherLicenses`。" -#: ../../license.rst:90 -msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" -msgstr "用於 PYTHON |release| 的 PSF 授權合約" - #: ../../license.rst:94 +msgid "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" +msgstr "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" + +#: ../../license.rst:98 msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" " the Individual or Organization (\"Licensee\") accessing and otherwise " -"using Python\n" -" |release| software in source or binary form and its associated " +"using this\n" +" software (\"Python\") in source or binary form and its associated " "documentation.\n" "\n" "2. Subject to the terms and conditions of this License Agreement, PSF " @@ -278,40 +294,34 @@ msgid "" "reproduce,\n" " analyze, test, perform and/or display publicly, prepare derivative " "works,\n" -" distribute, and otherwise use Python |release| alone or in any " -"derivative\n" +" distribute, and otherwise use Python alone or in any derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" " copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" -" Reserved\" are retained in Python |release| alone or in any derivative " -"version\n" +" Reserved\" are retained in Python alone or in any derivative version\n" " prepared by Licensee.\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" -" incorporates Python |release| or any part thereof, and wants to make the\n" +" incorporates Python or any part thereof, and wants to make the\n" " derivative work available to others as provided herein, then Licensee " "hereby\n" " agrees to include in any such work a brief summary of the changes made to " -"Python\n" -" |release|.\n" +"Python.\n" "\n" -"4. PSF is making Python |release| available to Licensee on an \"AS IS\" " -"basis.\n" +"4. PSF is making Python available to Licensee on an \"AS IS\" basis.\n" " PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY " "OF\n" " EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY " "REPRESENTATION OR\n" " WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " "THE\n" -" USE OF PYTHON |release| WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +" USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" "\n" -"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON |" -"release|\n" +"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n" " FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT " "OF\n" -" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON |release|, OR ANY " -"DERIVATIVE\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE\n" " THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" "\n" "6. This License Agreement will automatically terminate upon a material " @@ -328,15 +338,14 @@ msgid "" "or any\n" " third party.\n" "\n" -"8. By copying, installing or otherwise using Python |release|, Licensee " -"agrees\n" +"8. By copying, installing or otherwise using Python, Licensee agrees\n" " to be bound by the terms and conditions of this License Agreement." msgstr "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" " the Individual or Organization (\"Licensee\") accessing and otherwise " -"using Python\n" -" |release| software in source or binary form and its associated " +"using this\n" +" software (\"Python\") in source or binary form and its associated " "documentation.\n" "\n" "2. Subject to the terms and conditions of this License Agreement, PSF " @@ -345,40 +354,34 @@ msgstr "" "reproduce,\n" " analyze, test, perform and/or display publicly, prepare derivative " "works,\n" -" distribute, and otherwise use Python |release| alone or in any " -"derivative\n" +" distribute, and otherwise use Python alone or in any derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" " copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" -" Reserved\" are retained in Python |release| alone or in any derivative " -"version\n" +" Reserved\" are retained in Python alone or in any derivative version\n" " prepared by Licensee.\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" -" incorporates Python |release| or any part thereof, and wants to make the\n" +" incorporates Python or any part thereof, and wants to make the\n" " derivative work available to others as provided herein, then Licensee " "hereby\n" " agrees to include in any such work a brief summary of the changes made to " -"Python\n" -" |release|.\n" +"Python.\n" "\n" -"4. PSF is making Python |release| available to Licensee on an \"AS IS\" " -"basis.\n" +"4. PSF is making Python available to Licensee on an \"AS IS\" basis.\n" " PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY " "OF\n" " EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY " "REPRESENTATION OR\n" " WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " "THE\n" -" USE OF PYTHON |release| WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +" USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" "\n" -"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON |" -"release|\n" +"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n" " FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT " "OF\n" -" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON |release|, OR ANY " -"DERIVATIVE\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE\n" " THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" "\n" "6. This License Agreement will automatically terminate upon a material " @@ -395,19 +398,18 @@ msgstr "" "or any\n" " third party.\n" "\n" -"8. By copying, installing or otherwise using Python |release|, Licensee " -"agrees\n" +"8. By copying, installing or otherwise using Python, Licensee agrees\n" " to be bound by the terms and conditions of this License Agreement." -#: ../../license.rst:138 +#: ../../license.rst:141 msgid "BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0" -msgstr "用於 PYTHON 2.0 的 BEOPEN.COM 授權合約" +msgstr "BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0" -#: ../../license.rst:140 +#: ../../license.rst:143 msgid "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1" -msgstr "BEOPEN PYTHON 開源授權合約第 1 版" +msgstr "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1" -#: ../../license.rst:144 +#: ../../license.rst:147 msgid "" "1. This LICENSE AGREEMENT is between BeOpen.com (\"BeOpen\"), having an " "office at\n" @@ -535,11 +537,11 @@ msgstr "" "to be\n" " bound by the terms and conditions of this License Agreement." -#: ../../license.rst:185 +#: ../../license.rst:188 msgid "CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1" -msgstr "用於 PYTHON 1.6.1 的 CNRI 授權合約" +msgstr "CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1" -#: ../../license.rst:189 +#: ../../license.rst:192 msgid "" "1. This LICENSE AGREEMENT is between the Corporation for National Research\n" " Initiatives, having an office at 1895 Preston White Drive, Reston, VA " @@ -573,7 +575,7 @@ msgid "" "handle):\n" " 1895.22/1013. This Agreement may also be obtained from a proxy server on " "the\n" -" internet using the following URL: http://hdl.handle.net/1895.22/1013.\"\n" +" internet using the following URL: http://hdl.handle.net/1895.22/1013\".\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" " incorporates Python 1.6.1 or any part thereof, and wants to make the " @@ -670,7 +672,7 @@ msgstr "" "handle):\n" " 1895.22/1013. This Agreement may also be obtained from a proxy server on " "the\n" -" internet using the following URL: http://hdl.handle.net/1895.22/1013.\"\n" +" internet using the following URL: http://hdl.handle.net/1895.22/1013\".\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" " incorporates Python 1.6.1 or any part thereof, and wants to make the " @@ -735,11 +737,11 @@ msgstr "" "and\n" " conditions of this License Agreement." -#: ../../license.rst:250 +#: ../../license.rst:253 msgid "CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2" -msgstr "用於 PYTHON 0.9.0 至 1.2 的 CWI 授權合約" +msgstr "CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2" -#: ../../license.rst:254 +#: ../../license.rst:257 msgid "" "Copyright © 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The\n" "Netherlands. All rights reserved.\n" @@ -797,11 +799,11 @@ msgstr "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n" "SOFTWARE." -#: ../../license.rst:277 -msgid "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON |release| DOCUMENTATION" -msgstr "用於 PYTHON |release| 說明文件內程式碼的 ZERO-CLAUSE BSD 授權" +#: ../../license.rst:280 +msgid "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION" +msgstr "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION" -#: ../../license.rst:281 +#: ../../license.rst:284 msgid "" "Permission to use, copy, modify, and/or distribute this software for any\n" "purpose with or without fee is hereby granted.\n" @@ -831,11 +833,11 @@ msgstr "" "OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" "PERFORMANCE OF THIS SOFTWARE." -#: ../../license.rst:296 +#: ../../license.rst:299 msgid "Licenses and Acknowledgements for Incorporated Software" msgstr "被收錄軟體的授權與致謝" -#: ../../license.rst:298 +#: ../../license.rst:301 msgid "" "This section is an incomplete, but growing list of licenses and " "acknowledgements for third-party software incorporated in the Python " @@ -844,22 +846,22 @@ msgstr "" "本節是一個不完整但持續增加的授權與致謝清單,對象是在 Python 發佈版本中所收錄" "的第三方軟體。" -#: ../../license.rst:303 +#: ../../license.rst:306 msgid "Mersenne Twister" msgstr "Mersenne Twister" -#: ../../license.rst:305 +#: ../../license.rst:308 msgid "" "The :mod:`!_random` C extension underlying the :mod:`random` module includes " "code based on a download from http://www.math.sci.hiroshima-u.ac.jp/~m-mat/" "MT/MT2002/emt19937ar.html. The following are the verbatim comments from the " "original code::" msgstr "" -":mod:`random` 模組底下的 :mod:`!_random` C 擴充程式包含了以 http://www.math." -"sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html 的下載內容為基礎的程式" -"碼。以下是原始程式碼的完整聲明: ::" +":mod:`random` 模組底下的 :mod:`!_random` C 擴充程式包含了以 http://" +"www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html 的下載內容為" +"基礎的程式碼。以下是原始程式碼的完整聲明: ::" -#: ../../license.rst:310 +#: ../../license.rst:313 msgid "" "A C-program for MT19937, with initialization improved 2002/1/26.\n" "Coded by Takuji Nishimura and Makoto Matsumoto.\n" @@ -945,21 +947,21 @@ msgstr "" "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n" "email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)" -#: ../../license.rst:353 +#: ../../license.rst:356 msgid "Sockets" msgstr "Sockets" -#: ../../license.rst:355 +#: ../../license.rst:358 msgid "" -"The :mod:`socket` module uses the functions, :c:func:`!getaddrinfo`, and :c:" -"func:`!getnameinfo`, which are coded in separate source files from the WIDE " -"Project, https://www.wide.ad.jp/. ::" +"The :mod:`socket` module uses the functions, :c:func:`!getaddrinfo`, " +"and :c:func:`!getnameinfo`, which are coded in separate source files from " +"the WIDE Project, https://www.wide.ad.jp/. ::" msgstr "" ":mod:`socket` 模組使用 :c:func:`!getaddrinfo` 和 :c:func:`!getnameinfo` 函" "式,它們在 WIDE 專案(https://www.wide.ad.jp/)內,於不同的原始檔案中被編" "碼: ::" -#: ../../license.rst:359 +#: ../../license.rst:362 msgid "" "Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n" "All rights reserved.\n" @@ -976,7 +978,7 @@ msgid "" " may be used to endorse or promote products derived from this software\n" " without specific prior written permission.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n" @@ -1003,7 +1005,7 @@ msgstr "" " may be used to endorse or promote products derived from this software\n" " without specific prior written permission.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n" @@ -1015,11 +1017,11 @@ msgstr "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." -#: ../../license.rst:388 +#: ../../license.rst:391 msgid "Asynchronous socket services" msgstr "非同步 socket 服務" -#: ../../license.rst:390 +#: ../../license.rst:393 msgid "" "The :mod:`!test.support.asynchat` and :mod:`!test.support.asyncore` modules " "contain the following notice::" @@ -1027,7 +1029,7 @@ msgstr "" ":mod:`!test.support.asynchat` 和 :mod:`!test.support.asyncore` 模組包含以下聲" "明: ::" -#: ../../license.rst:393 +#: ../../license.rst:396 msgid "" "Copyright 1996 by Sam Rushing\n" "\n" @@ -1071,15 +1073,15 @@ msgstr "" "NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n" "CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE." -#: ../../license.rst:416 +#: ../../license.rst:419 msgid "Cookie management" msgstr "Cookie 管理" -#: ../../license.rst:418 +#: ../../license.rst:421 msgid "The :mod:`http.cookies` module contains the following notice::" msgstr ":mod:`http.cookies` 模組包含以下聲明: ::" -#: ../../license.rst:420 +#: ../../license.rst:423 msgid "" "Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>\n" "\n" @@ -1125,15 +1127,15 @@ msgstr "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" "PERFORMANCE OF THIS SOFTWARE." -#: ../../license.rst:444 +#: ../../license.rst:447 msgid "Execution tracing" msgstr "執行追蹤" -#: ../../license.rst:446 +#: ../../license.rst:449 msgid "The :mod:`trace` module contains the following notice::" msgstr ":mod:`trace` 模組包含以下聲明: ::" -#: ../../license.rst:448 +#: ../../license.rst:451 msgid "" "portions copyright 2001, Autonomous Zones Industries, Inc., all rights...\n" "err... reserved and offered to the public under the terms of the\n" @@ -1189,15 +1191,15 @@ msgstr "" "Bioreason or Mojam Media be used in advertising or publicity pertaining to\n" "distribution of the software without specific, written prior permission." -#: ../../license.rst:477 +#: ../../license.rst:480 msgid "UUencode and UUdecode functions" msgstr "UUencode 與 UUdecode 函式" -#: ../../license.rst:479 +#: ../../license.rst:482 msgid "The ``uu`` codec contains the following notice::" msgstr "``uu`` 編解碼器包含以下聲明: ::" -#: ../../license.rst:481 +#: ../../license.rst:484 msgid "" "Copyright 1994 by Lance Ellinghouse\n" "Cathedral City, California Republic, United States of America.\n" @@ -1247,15 +1249,15 @@ msgstr "" " version is still 5 times faster, though.\n" "- Arguments more compliant with Python standard" -#: ../../license.rst:507 +#: ../../license.rst:510 msgid "XML Remote Procedure Calls" msgstr "XML 遠端程序呼叫" -#: ../../license.rst:509 +#: ../../license.rst:512 msgid "The :mod:`xmlrpc.client` module contains the following notice::" msgstr ":mod:`xmlrpc.client` 模組包含以下聲明: ::" -#: ../../license.rst:511 +#: ../../license.rst:514 msgid "" " The XML-RPC client interface is\n" "\n" @@ -1311,15 +1313,15 @@ msgstr "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" "OF THIS SOFTWARE." -#: ../../license.rst:540 +#: ../../license.rst:543 msgid "test_epoll" msgstr "test_epoll" -#: ../../license.rst:542 +#: ../../license.rst:545 msgid "The :mod:`!test.test_epoll` module contains the following notice::" msgstr ":mod:`!test.test_epoll` 模組包含以下聲明: ::" -#: ../../license.rst:544 +#: ../../license.rst:547 msgid "" "Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" "\n" @@ -1363,17 +1365,17 @@ msgstr "" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:566 +#: ../../license.rst:569 msgid "Select kqueue" msgstr "Select kqueue" -#: ../../license.rst:568 +#: ../../license.rst:571 msgid "" "The :mod:`select` module contains the following notice for the kqueue " "interface::" msgstr ":mod:`select` 模組對於 kqueue 介面包含以下聲明: ::" -#: ../../license.rst:571 +#: ../../license.rst:574 msgid "" "Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes\n" "All rights reserved.\n" @@ -1387,7 +1389,7 @@ msgid "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" @@ -1411,7 +1413,7 @@ msgstr "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" @@ -1423,11 +1425,11 @@ msgstr "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." -#: ../../license.rst:597 +#: ../../license.rst:600 msgid "SipHash24" msgstr "SipHash24" -#: ../../license.rst:599 +#: ../../license.rst:602 msgid "" "The file :file:`Python/pyhash.c` contains Marek Majkowski' implementation of " "Dan Bernstein's SipHash24 algorithm. It contains the following note::" @@ -1435,7 +1437,7 @@ msgstr "" ":file:`Python/pyhash.c` 檔案包含 Marek Majkowski' 基於 Dan Bernstein 的 " "SipHash24 演算法的實作。它包含以下聲明: ::" -#: ../../license.rst:602 +#: ../../license.rst:605 msgid "" "<MIT License>\n" "Copyright (c) 2013 Marek Majkowski <marek@popcount.org>\n" @@ -1487,25 +1489,25 @@ msgstr "" " djb (supercop/crypto_auth/siphash24/little2)\n" " Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)" -#: ../../license.rst:626 +#: ../../license.rst:629 msgid "strtod and dtoa" msgstr "strtod 與 dtoa" -#: ../../license.rst:628 +#: ../../license.rst:631 msgid "" "The file :file:`Python/dtoa.c`, which supplies C functions dtoa and strtod " "for conversion of C doubles to and from strings, is derived from the file of " -"the same name by David M. Gay, currently available from https://web.archive." -"org/web/20220517033456/http://www.netlib.org/fp/dtoa.c. The original file, " -"as retrieved on March 16, 2009, contains the following copyright and " -"licensing notice::" +"the same name by David M. Gay, currently available from https://" +"web.archive.org/web/20220517033456/http://www.netlib.org/fp/dtoa.c. The " +"original file, as retrieved on March 16, 2009, contains the following " +"copyright and licensing notice::" msgstr "" ":file:`Python/dtoa.c` 檔案提供了 C 的 dtoa 和 strtod 函式,用於將 C 的雙精度" "浮點數和字串互相轉換。該檔案是衍生自 David M. Gay 建立的同名檔案,後者現在可" "以從 https://web.archive.org/web/20220517033456/http://www.netlib.org/fp/" "dtoa.c 下載。於 2009 年 3 月 16 日所檢索的原始檔案包含以下版權與授權聲明: ::" -#: ../../license.rst:635 +#: ../../license.rst:638 msgid "" "/****************************************************************\n" " *\n" @@ -1547,12 +1549,11 @@ msgstr "" " *\n" " ***************************************************************/" -#: ../../license.rst:656 +#: ../../license.rst:659 msgid "OpenSSL" msgstr "OpenSSL" -#: ../../license.rst:658 -#, fuzzy +#: ../../license.rst:661 msgid "" "The modules :mod:`hashlib`, :mod:`posix` and :mod:`ssl` use the OpenSSL " "library for added performance if made available by the operating system. " @@ -1561,13 +1562,13 @@ msgid "" "For the OpenSSL 3.0 release, and later releases derived from that, the " "Apache License v2 applies::" msgstr "" -"如果 OpenSSL 函式庫可被作業系統使用,則 :mod:`hashlib`、:mod:`posix`、:mod:" -"`ssl`、:mod:`crypt` 模組會使用它來提升效能。此外,因為 Windows 和 macOS 的 " -"Python 安裝程式可能包含 OpenSSL 函式庫的副本,所以我們也在此收錄 OpenSSL 授權" -"的副本。對於 OpenSSL 3.0 版本以及由此衍生的更新版本則適用 Apache 許可證 " -"v2: ::" +"如果 OpenSSL 函式庫可被作業系統使用," +"則 :mod:`hashlib`、:mod:`posix`、:mod:`ssl` 模組會使用它來提升效能。此外,因" +"為 Windows 和 macOS 的 Python 安裝程式可能包含 OpenSSL 函式庫的副本,所以我們" +"也在此收錄 OpenSSL 授權的副本。對於 OpenSSL 3.0 版本以及由此衍生的更新版本則" +"適用 Apache 許可證 v2: ::" -#: ../../license.rst:666 +#: ../../license.rst:669 msgid "" " Apache License\n" " Version 2.0, January 2004\n" @@ -1923,11 +1924,11 @@ msgstr "" "\n" "END OF TERMS AND CONDITIONS" -#: ../../license.rst:845 +#: ../../license.rst:848 msgid "expat" msgstr "expat" -#: ../../license.rst:847 +#: ../../license.rst:850 msgid "" "The :mod:`pyexpat <xml.parsers.expat>` extension is built using an included " "copy of the expat sources unless the build is configured ``--with-system-" @@ -1936,7 +1937,7 @@ msgstr "" "除非在建置 :mod:`pyexpat <xml.parsers.expat>` 擴充時設定為 ``--with-system-" "expat``,否則該擴充會用一個內含 expat 原始碼的副本來建置: ::" -#: ../../license.rst:850 +#: ../../license.rst:853 msgid "" "Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n" " and Clark Cooper\n" @@ -1982,11 +1983,11 @@ msgstr "" "TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n" "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:874 +#: ../../license.rst:877 msgid "libffi" msgstr "libffi" -#: ../../license.rst:876 +#: ../../license.rst:879 msgid "" "The :mod:`!_ctypes` C extension underlying the :mod:`ctypes` module is built " "using an included copy of the libffi sources unless the build is configured " @@ -1995,13 +1996,13 @@ msgstr "" "除非在建置 :mod:`_ctypes` 模組底下 :mod:`!_ctypes` 擴充程式時設定為 ``--with-" "system-libffi``,否則該擴充會用一個內含 libffi 原始碼的副本來建置: ::" -#: ../../license.rst:880 +#: ../../license.rst:883 msgid "" "Copyright (c) 1996-2008 Red Hat, Inc and others.\n" "\n" "Permission is hereby granted, free of charge, to any person obtaining\n" "a copy of this software and associated documentation files (the\n" -"``Software''), to deal in the Software without restriction, including\n" +"\"Software\"), to deal in the Software without restriction, including\n" "without limitation the rights to use, copy, modify, merge, publish,\n" "distribute, sublicense, and/or sell copies of the Software, and to\n" "permit persons to whom the Software is furnished to do so, subject to\n" @@ -2010,7 +2011,7 @@ msgid "" "The above copyright notice and this permission notice shall be included\n" "in all copies or substantial portions of the Software.\n" "\n" -"THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n" @@ -2023,7 +2024,7 @@ msgstr "" "\n" "Permission is hereby granted, free of charge, to any person obtaining\n" "a copy of this software and associated documentation files (the\n" -"``Software''), to deal in the Software without restriction, including\n" +"\"Software\"), to deal in the Software without restriction, including\n" "without limitation the rights to use, copy, modify, merge, publish,\n" "distribute, sublicense, and/or sell copies of the Software, and to\n" "permit persons to whom the Software is furnished to do so, subject to\n" @@ -2032,7 +2033,7 @@ msgstr "" "The above copyright notice and this permission notice shall be included\n" "in all copies or substantial portions of the Software.\n" "\n" -"THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n" @@ -2041,11 +2042,11 @@ msgstr "" "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n" "DEALINGS IN THE SOFTWARE." -#: ../../license.rst:904 +#: ../../license.rst:907 msgid "zlib" msgstr "zlib" -#: ../../license.rst:906 +#: ../../license.rst:909 msgid "" "The :mod:`zlib` extension is built using an included copy of the zlib " "sources if the zlib version found on the system is too old to be used for " @@ -2054,7 +2055,7 @@ msgstr "" "如果在系統上找到的 zlib 版本太舊以致於無法用於建置 :mod:`zlib` 擴充,則該擴充" "會用一個內含 zlib 原始碼的副本來建置: ::" -#: ../../license.rst:910 +#: ../../license.rst:913 msgid "" "Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler\n" "\n" @@ -2102,11 +2103,11 @@ msgstr "" "Jean-loup Gailly Mark Adler\n" "jloup@gzip.org madler@alumni.caltech.edu" -#: ../../license.rst:935 +#: ../../license.rst:938 msgid "cfuhash" msgstr "cfuhash" -#: ../../license.rst:937 +#: ../../license.rst:940 msgid "" "The implementation of the hash table used by the :mod:`tracemalloc` is based " "on the cfuhash project::" @@ -2114,7 +2115,7 @@ msgstr "" ":mod:`tracemalloc` 使用的雜湊表 (hash table) 實作,是以 cfuhash 專案為基" "礎: ::" -#: ../../license.rst:940 +#: ../../license.rst:943 msgid "" "Copyright (c) 2005 Don Owens\n" "All rights reserved.\n" @@ -2184,11 +2185,11 @@ msgstr "" "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n" "OF THE POSSIBILITY OF SUCH DAMAGE." -#: ../../license.rst:976 +#: ../../license.rst:979 msgid "libmpdec" msgstr "libmpdec" -#: ../../license.rst:978 +#: ../../license.rst:981 msgid "" "The :mod:`!_decimal` C extension underlying the :mod:`decimal` module is " "built using an included copy of the libmpdec library unless the build is " @@ -2198,7 +2199,7 @@ msgstr "" "with-system-libmpdec``,否則該模組會用一個內含 libmpdec 函式庫的副本來建" "置: ::" -#: ../../license.rst:982 +#: ../../license.rst:985 msgid "" "Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" "\n" @@ -2250,11 +2251,11 @@ msgstr "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." -#: ../../license.rst:1009 +#: ../../license.rst:1012 msgid "W3C C14N test suite" msgstr "W3C C14N 測試套件" -#: ../../license.rst:1011 +#: ../../license.rst:1014 msgid "" "The C14N 2.0 test suite in the :mod:`test` package (``Lib/test/xmltestdata/" "c14n-20/``) was retrieved from the W3C website at https://www.w3.org/TR/xml-" @@ -2264,7 +2265,7 @@ msgstr "" "是從 W3C 網站 https://www.w3.org/TR/xml-c14n2-testcases/ 被檢索,且是基於 3-" "clause BSD 授權被發佈: ::" -#: ../../license.rst:1016 +#: ../../license.rst:1019 msgid "" "Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),\n" "All Rights Reserved.\n" @@ -2322,15 +2323,15 @@ msgstr "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -#: ../../license.rst:1048 +#: ../../license.rst:1051 msgid "mimalloc" msgstr "mimalloc" -#: ../../license.rst:1050 +#: ../../license.rst:1053 msgid "MIT License::" -msgstr "" +msgstr "MIT 授權: ::" -#: ../../license.rst:1052 +#: ../../license.rst:1055 msgid "" "Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" "\n" @@ -2386,11 +2387,11 @@ msgstr "" "THE\n" "SOFTWARE." -#: ../../license.rst:1074 +#: ../../license.rst:1077 msgid "asyncio" msgstr "asyncio" -#: ../../license.rst:1076 +#: ../../license.rst:1079 msgid "" "Parts of the :mod:`asyncio` module are incorporated from `uvloop 0.16 " "<https://github.com/MagicStack/uvloop/tree/v0.16.0>`_, which is distributed " @@ -2399,7 +2400,7 @@ msgstr "" ":mod:`asyncio` 模組的部分內容是從 `uvloop 0.16 <https://github.com/" "MagicStack/uvloop/tree/v0.16.0>`_ 中收錄過來,其基於 MIT 授權來發佈: ::" -#: ../../license.rst:1080 +#: ../../license.rst:1083 msgid "" "Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" "\n" @@ -2443,19 +2444,19 @@ msgstr "" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:1103 +#: ../../license.rst:1106 msgid "Global Unbounded Sequences (GUS)" msgstr "" -#: ../../license.rst:1105 +#: ../../license.rst:1108 msgid "" "The file :file:`Python/qsbr.c` is adapted from FreeBSD's \"Global Unbounded " -"Sequences\" safe memory reclamation scheme in `subr_smr.c <https://github." -"com/freebsd/freebsd-src/blob/main/sys/kern/subr_smr.c>`_. The file is " +"Sequences\" safe memory reclamation scheme in `subr_smr.c <https://" +"github.com/freebsd/freebsd-src/blob/main/sys/kern/subr_smr.c>`_. The file is " "distributed under the 2-Clause BSD License::" msgstr "" -#: ../../license.rst:1110 +#: ../../license.rst:1113 msgid "" "Copyright (c) 2019,2020 Jeffrey Roberson <jeff@FreeBSD.org>\n" "\n" @@ -2469,7 +2470,7 @@ msgid "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\n" "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" "IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" @@ -2492,7 +2493,7 @@ msgstr "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\n" "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" "IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 6c12ef1f85..9930b44306 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-12 00:13+0000\n" +"POT-Creation-Date: 2025-01-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,10 +33,10 @@ msgstr "" msgid "" "The :keyword:`if`, :keyword:`while` and :keyword:`for` statements implement " "traditional control flow constructs. :keyword:`try` specifies exception " -"handlers and/or cleanup code for a group of statements, while the :keyword:" -"`with` statement allows the execution of initialization and finalization " -"code around a block of code. Function and class definitions are also " -"syntactically compound statements." +"handlers and/or cleanup code for a group of statements, while " +"the :keyword:`with` statement allows the execution of initialization and " +"finalization code around a block of code. Function and class definitions " +"are also syntactically compound statements." msgstr "" #: ../../reference/compound_stmts.rst:26 @@ -78,8 +78,8 @@ msgid "" "Note that statements always end in a ``NEWLINE`` possibly followed by a " "``DEDENT``. Also note that optional continuation clauses always begin with " "a keyword that cannot start a statement, thus there are no ambiguities (the " -"'dangling :keyword:`else`' problem is solved in Python by requiring nested :" -"keyword:`if` statements to be indented)." +"'dangling :keyword:`else`' problem is solved in Python by requiring " +"nested :keyword:`if` statements to be indented)." msgstr "" #: ../../reference/compound_stmts.rst:75 @@ -127,9 +127,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:133 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and goes back to testing the expression." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and goes back to testing the expression." msgstr "" #: ../../reference/compound_stmts.rst:142 @@ -144,22 +144,23 @@ msgstr "" #: ../../reference/compound_stmts.rst:160 msgid "" -"The ``starred_list`` expression is evaluated once; it should yield an :term:" -"`iterable` object. An :term:`iterator` is created for that iterable. The " -"first item provided by the iterator is then assigned to the target list " -"using the standard rules for assignments (see :ref:`assignment`), and the " -"suite is executed. This repeats for each item provided by the iterator. " -"When the iterator is exhausted, the suite in the :keyword:`!else` clause, if " -"present, is executed, and the loop terminates." +"The ``starred_list`` expression is evaluated once; it should yield " +"an :term:`iterable` object. An :term:`iterator` is created for that " +"iterable. The first item provided by the iterator is then assigned to the " +"target list using the standard rules for assignments " +"(see :ref:`assignment`), and the suite is executed. This repeats for each " +"item provided by the iterator. When the iterator is exhausted, the suite in " +"the :keyword:`!else` clause, if present, is executed, and the loop " +"terminates." msgstr "" #: ../../reference/compound_stmts.rst:173 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and continues with the next item, or with the :keyword:`!else` clause if " -"there is no next item." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and continues with the next item, or with the :keyword:`!else` " +"clause if there is no next item." msgstr "" #: ../../reference/compound_stmts.rst:179 @@ -203,9 +204,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:231 msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information on using the :keyword:`raise` statement to " -"generate exceptions may be found in section :ref:`raise`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information on using the :keyword:`raise` " +"statement to generate exceptions may be found in section :ref:`raise`." msgstr "" #: ../../reference/compound_stmts.rst:239 @@ -251,13 +252,13 @@ msgstr "" #: ../../reference/compound_stmts.rst:267 msgid "" "When a matching :keyword:`!except` clause is found, the exception is " -"assigned to the target specified after the :keyword:`!as` keyword in that :" -"keyword:`!except` clause, if present, and the :keyword:`!except` clause's " -"suite is executed. All :keyword:`!except` clauses must have an executable " -"block. When the end of this block is reached, execution continues normally " -"after the entire :keyword:`try` statement. (This means that if two nested " -"handlers exist for the same exception, and the exception occurs in the :" -"keyword:`!try` clause of the inner handler, the outer handler will not " +"assigned to the target specified after the :keyword:`!as` keyword in " +"that :keyword:`!except` clause, if present, and the :keyword:`!except` " +"clause's suite is executed. All :keyword:`!except` clauses must have an " +"executable block. When the end of this block is reached, execution continues " +"normally after the entire :keyword:`try` statement. (This means that if two " +"nested handlers exist for the same exception, and the exception occurs in " +"the :keyword:`!try` clause of the inner handler, the outer handler will not " "handle the exception.)" msgstr "" @@ -355,15 +356,15 @@ msgstr ":keyword:`!except*` 子句" #: ../../reference/compound_stmts.rst:335 msgid "" -"The :keyword:`!except*` clause(s) are used for handling :exc:" -"`ExceptionGroup`\\s. The exception type for matching is interpreted as in " -"the case of :keyword:`except`, but in the case of exception groups we can " -"have partial matches when the type matches some of the exceptions in the " -"group. This means that multiple :keyword:`!except*` clauses can execute, " -"each handling part of the exception group. Each clause executes at most once " -"and handles an exception group of all matching exceptions. Each exception " -"in the group is handled by at most one :keyword:`!except*` clause, the first " -"that matches it. ::" +"The :keyword:`!except*` clause(s) are used for " +"handling :exc:`ExceptionGroup`\\s. The exception type for matching is " +"interpreted as in the case of :keyword:`except`, but in the case of " +"exception groups we can have partial matches when the type matches some of " +"the exceptions in the group. This means that multiple :keyword:`!except*` " +"clauses can execute, each handling part of the exception group. Each clause " +"executes at most once and handles an exception group of all matching " +"exceptions. Each exception in the group is handled by at most " +"one :keyword:`!except*` clause, the first that matches it. ::" msgstr "" #: ../../reference/compound_stmts.rst:345 @@ -427,8 +428,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:384 msgid "" "It is not possible to mix :keyword:`except` and :keyword:`!except*` in the " -"same :keyword:`try`. :keyword:`break`, :keyword:`continue` and :keyword:" -"`return` cannot appear in an :keyword:`!except*` clause." +"same :keyword:`try`. :keyword:`break`, :keyword:`continue` " +"and :keyword:`return` cannot appear in an :keyword:`!except*` clause." msgstr "" #: ../../reference/compound_stmts.rst:399 @@ -438,10 +439,10 @@ msgstr ":keyword:`!else` 子句" #: ../../reference/compound_stmts.rst:401 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " -"the :keyword:`try` suite, no exception was raised, and no :keyword:" -"`return`, :keyword:`continue`, or :keyword:`break` statement was executed. " -"Exceptions in the :keyword:`!else` clause are not handled by the preceding :" -"keyword:`except` clauses." +"the :keyword:`try` suite, no exception was raised, and " +"no :keyword:`return`, :keyword:`continue`, or :keyword:`break` statement was " +"executed. Exceptions in the :keyword:`!else` clause are not handled by the " +"preceding :keyword:`except` clauses." msgstr "" #: ../../reference/compound_stmts.rst:413 @@ -450,16 +451,16 @@ msgstr ":keyword:`!finally` 子句" #: ../../reference/compound_stmts.rst:415 msgid "" -"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" -"keyword:`try` clause is executed, including any :keyword:`except` and :" -"keyword:`else` clauses. If an exception occurs in any of the clauses and is " -"not handled, the exception is temporarily saved. The :keyword:`!finally` " -"clause is executed. If there is a saved exception it is re-raised at the " -"end of the :keyword:`!finally` clause. If the :keyword:`!finally` clause " -"raises another exception, the saved exception is set as the context of the " -"new exception. If the :keyword:`!finally` clause executes a :keyword:" -"`return`, :keyword:`break` or :keyword:`continue` statement, the saved " -"exception is discarded::" +"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. " +"The :keyword:`try` clause is executed, including any :keyword:`except` " +"and :keyword:`else` clauses. If an exception occurs in any of the clauses " +"and is not handled, the exception is temporarily saved. The :keyword:`!" +"finally` clause is executed. If there is a saved exception it is re-raised " +"at the end of the :keyword:`!finally` clause. If the :keyword:`!finally` " +"clause raises another exception, the saved exception is set as the context " +"of the new exception. If the :keyword:`!finally` clause executes " +"a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement, the " +"saved exception is discarded::" msgstr "" #: ../../reference/compound_stmts.rst:425 @@ -526,8 +527,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:460 msgid "" -"Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" -"keyword:`!finally` clause due to a problem with the implementation." +"Prior to Python 3.8, a :keyword:`continue` statement was illegal in " +"the :keyword:`!finally` clause due to a problem with the implementation." msgstr "" #: ../../reference/compound_stmts.rst:469 @@ -538,8 +539,8 @@ msgstr ":keyword:`!with` 陳述式" msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " -"This allows common :keyword:`try`...\\ :keyword:`except`...\\ :keyword:" -"`finally` usage patterns to be encapsulated for convenient reuse." +"This allows common :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" #: ../../reference/compound_stmts.rst:488 @@ -550,8 +551,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:490 msgid "" -"The context expression (the expression given in the :token:`~python-grammar:" -"with_item`) is evaluated to obtain a context manager." +"The context expression (the expression given in the :token:`~python-" +"grammar:with_item`) is evaluated to obtain a context manager." msgstr "" #: ../../reference/compound_stmts.rst:493 @@ -575,11 +576,11 @@ msgstr "" #: ../../reference/compound_stmts.rst:504 msgid "" -"The :keyword:`with` statement guarantees that if the :meth:`~object." -"__enter__` method returns without an error, then :meth:`~object.__exit__` " -"will always be called. Thus, if an error occurs during the assignment to the " -"target list, it will be treated the same as an error occurring within the " -"suite would be. See step 7 below." +"The :keyword:`with` statement guarantees that if " +"the :meth:`~object.__enter__` method returns without an error, " +"then :meth:`~object.__exit__` will always be called. Thus, if an error " +"occurs during the assignment to the target list, it will be treated the same " +"as an error occurring within the suite would be. See step 7 below." msgstr "" #: ../../reference/compound_stmts.rst:510 @@ -590,16 +591,16 @@ msgstr "" msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " -"passed as arguments to :meth:`~object.__exit__`. Otherwise, three :const:" -"`None` arguments are supplied." +"passed as arguments to :meth:`~object.__exit__`. Otherwise, " +"three :const:`None` arguments are supplied." msgstr "" #: ../../reference/compound_stmts.rst:517 msgid "" -"If the suite was exited due to an exception, and the return value from the :" -"meth:`~object.__exit__` method was false, the exception is reraised. If the " -"return value was true, the exception is suppressed, and execution continues " -"with the statement following the :keyword:`with` statement." +"If the suite was exited due to an exception, and the return value from " +"the :meth:`~object.__exit__` method was false, the exception is reraised. " +"If the return value was true, the exception is suppressed, and execution " +"continues with the statement following the :keyword:`with` statement." msgstr "" #: ../../reference/compound_stmts.rst:522 @@ -610,8 +611,8 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:526 -#: ../../reference/compound_stmts.rst:1544 -#: ../../reference/compound_stmts.rst:1585 +#: ../../reference/compound_stmts.rst:1549 +#: ../../reference/compound_stmts.rst:1590 msgid "The following code::" msgstr "以下程式碼: ::" @@ -624,8 +625,8 @@ msgstr "" " SUITE" #: ../../reference/compound_stmts.rst:531 -#: ../../reference/compound_stmts.rst:553 -#: ../../reference/compound_stmts.rst:1590 +#: ../../reference/compound_stmts.rst:556 +#: ../../reference/compound_stmts.rst:1595 msgid "is semantically equivalent to::" msgstr "在語義上等同於: ::" @@ -635,37 +636,43 @@ msgid "" "enter = type(manager).__enter__\n" "exit = type(manager).__exit__\n" "value = enter(manager)\n" +"hit_except = False\n" "\n" "try:\n" " TARGET = value\n" " SUITE\n" "except:\n" +" hit_except = True\n" " if not exit(manager, *sys.exc_info()):\n" " raise\n" -"else:\n" -" exit(manager, None, None, None)" +"finally:\n" +" if not hit_except:\n" +" exit(manager, None, None, None)" msgstr "" "manager = (EXPRESSION)\n" "enter = type(manager).__enter__\n" "exit = type(manager).__exit__\n" "value = enter(manager)\n" +"hit_except = False\n" "\n" "try:\n" " TARGET = value\n" " SUITE\n" "except:\n" +" hit_except = True\n" " if not exit(manager, *sys.exc_info()):\n" " raise\n" -"else:\n" -" exit(manager, None, None, None)" +"finally:\n" +" if not hit_except:\n" +" exit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:547 +#: ../../reference/compound_stmts.rst:550 msgid "" -"With more than one item, the context managers are processed as if multiple :" -"keyword:`with` statements were nested::" +"With more than one item, the context managers are processed as if " +"multiple :keyword:`with` statements were nested::" msgstr "" -#: ../../reference/compound_stmts.rst:550 +#: ../../reference/compound_stmts.rst:553 msgid "" "with A() as a, B() as b:\n" " SUITE" @@ -673,7 +680,7 @@ msgstr "" "with A() as a, B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:555 +#: ../../reference/compound_stmts.rst:558 msgid "" "with A() as a:\n" " with B() as b:\n" @@ -683,13 +690,13 @@ msgstr "" " with B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:559 +#: ../../reference/compound_stmts.rst:562 msgid "" "You can also write multi-item context managers in multiple lines if the " "items are surrounded by parentheses. For example::" msgstr "" -#: ../../reference/compound_stmts.rst:562 +#: ../../reference/compound_stmts.rst:565 msgid "" "with (\n" " A() as a,\n" @@ -703,88 +710,88 @@ msgstr "" "):\n" " SUITE" -#: ../../reference/compound_stmts.rst:568 +#: ../../reference/compound_stmts.rst:571 msgid "Support for multiple context expressions." msgstr "" -#: ../../reference/compound_stmts.rst:571 +#: ../../reference/compound_stmts.rst:574 msgid "" "Support for using grouping parentheses to break the statement in multiple " "lines." msgstr "" -#: ../../reference/compound_stmts.rst:576 +#: ../../reference/compound_stmts.rst:579 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/compound_stmts.rst:577 +#: ../../reference/compound_stmts.rst:580 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/compound_stmts.rst:583 +#: ../../reference/compound_stmts.rst:586 msgid "The :keyword:`!match` statement" msgstr ":keyword:`!match` 陳述式" -#: ../../reference/compound_stmts.rst:597 +#: ../../reference/compound_stmts.rst:600 msgid "The match statement is used for pattern matching. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:606 +#: ../../reference/compound_stmts.rst:609 msgid "" "This section uses single quotes to denote :ref:`soft keywords <soft-" "keywords>`." msgstr "" -#: ../../reference/compound_stmts.rst:609 +#: ../../reference/compound_stmts.rst:612 msgid "" "Pattern matching takes a pattern as input (following ``case``) and a subject " "value (following ``match``). The pattern (which may contain subpatterns) is " "matched against the subject value. The outcomes are:" msgstr "" -#: ../../reference/compound_stmts.rst:613 +#: ../../reference/compound_stmts.rst:616 msgid "A match success or failure (also termed a pattern success or failure)." msgstr "" -#: ../../reference/compound_stmts.rst:615 +#: ../../reference/compound_stmts.rst:618 msgid "" "Possible binding of matched values to a name. The prerequisites for this " "are further discussed below." msgstr "" -#: ../../reference/compound_stmts.rst:618 +#: ../../reference/compound_stmts.rst:621 msgid "" "The ``match`` and ``case`` keywords are :ref:`soft keywords <soft-keywords>`." msgstr "" -#: ../../reference/compound_stmts.rst:622 -#: ../../reference/compound_stmts.rst:1179 +#: ../../reference/compound_stmts.rst:625 +#: ../../reference/compound_stmts.rst:1182 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../reference/compound_stmts.rst:623 -#: ../../reference/compound_stmts.rst:1180 +#: ../../reference/compound_stmts.rst:626 +#: ../../reference/compound_stmts.rst:1183 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" -#: ../../reference/compound_stmts.rst:627 +#: ../../reference/compound_stmts.rst:630 msgid "Overview" msgstr "" -#: ../../reference/compound_stmts.rst:629 +#: ../../reference/compound_stmts.rst:632 msgid "Here's an overview of the logical flow of a match statement:" msgstr "" -#: ../../reference/compound_stmts.rst:632 +#: ../../reference/compound_stmts.rst:635 msgid "" "The subject expression ``subject_expr`` is evaluated and a resulting subject " "value obtained. If the subject expression contains a comma, a tuple is " "constructed using :ref:`the standard rules <typesseq-tuple>`." msgstr "" -#: ../../reference/compound_stmts.rst:636 +#: ../../reference/compound_stmts.rst:639 msgid "" "Each pattern in a ``case_block`` is attempted to match with the subject " "value. The specific rules for success or failure are described below. The " @@ -794,7 +801,7 @@ msgid "" "outlive the executed block and can be used after the match statement**." msgstr "" -#: ../../reference/compound_stmts.rst:645 +#: ../../reference/compound_stmts.rst:648 msgid "" "During failed pattern matches, some subpatterns may succeed. Do not rely on " "bindings being made for a failed match. Conversely, do not rely on " @@ -803,38 +810,38 @@ msgid "" "made to allow different implementations to add optimizations." msgstr "" -#: ../../reference/compound_stmts.rst:652 +#: ../../reference/compound_stmts.rst:655 msgid "" "If the pattern succeeds, the corresponding guard (if present) is evaluated. " "In this case all name bindings are guaranteed to have happened." msgstr "" -#: ../../reference/compound_stmts.rst:655 +#: ../../reference/compound_stmts.rst:658 msgid "" "If the guard evaluates as true or is missing, the ``block`` inside " "``case_block`` is executed." msgstr "" -#: ../../reference/compound_stmts.rst:658 +#: ../../reference/compound_stmts.rst:661 msgid "Otherwise, the next ``case_block`` is attempted as described above." msgstr "" -#: ../../reference/compound_stmts.rst:660 +#: ../../reference/compound_stmts.rst:663 msgid "If there are no further case blocks, the match statement is completed." msgstr "" -#: ../../reference/compound_stmts.rst:664 +#: ../../reference/compound_stmts.rst:667 msgid "" "Users should generally never rely on a pattern being evaluated. Depending " "on implementation, the interpreter may cache values or use other " "optimizations which skip repeated evaluations." msgstr "" -#: ../../reference/compound_stmts.rst:668 +#: ../../reference/compound_stmts.rst:671 msgid "A sample match statement::" msgstr "" -#: ../../reference/compound_stmts.rst:670 +#: ../../reference/compound_stmts.rst:673 msgid "" ">>> flag = False\n" ">>> match (100, 200):\n" @@ -850,56 +857,56 @@ msgid "" "Case 3, y: 200" msgstr "" -#: ../../reference/compound_stmts.rst:684 +#: ../../reference/compound_stmts.rst:687 msgid "" "In this case, ``if flag`` is a guard. Read more about that in the next " "section." msgstr "" -#: ../../reference/compound_stmts.rst:687 +#: ../../reference/compound_stmts.rst:690 msgid "Guards" msgstr "" -#: ../../reference/compound_stmts.rst:694 +#: ../../reference/compound_stmts.rst:697 msgid "" "A ``guard`` (which is part of the ``case``) must succeed for code inside the " "``case`` block to execute. It takes the form: :keyword:`if` followed by an " "expression." msgstr "" -#: ../../reference/compound_stmts.rst:699 +#: ../../reference/compound_stmts.rst:702 msgid "The logical flow of a ``case`` block with a ``guard`` follows:" msgstr "" -#: ../../reference/compound_stmts.rst:701 +#: ../../reference/compound_stmts.rst:704 msgid "" "Check that the pattern in the ``case`` block succeeded. If the pattern " "failed, the ``guard`` is not evaluated and the next ``case`` block is " "checked." msgstr "" -#: ../../reference/compound_stmts.rst:705 +#: ../../reference/compound_stmts.rst:708 msgid "If the pattern succeeded, evaluate the ``guard``." msgstr "" -#: ../../reference/compound_stmts.rst:707 +#: ../../reference/compound_stmts.rst:710 msgid "" "If the ``guard`` condition evaluates as true, the case block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:710 +#: ../../reference/compound_stmts.rst:713 msgid "" "If the ``guard`` condition evaluates as false, the case block is not " "selected." msgstr "" -#: ../../reference/compound_stmts.rst:713 +#: ../../reference/compound_stmts.rst:716 msgid "" "If the ``guard`` raises an exception during evaluation, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:716 +#: ../../reference/compound_stmts.rst:719 msgid "" "Guards are allowed to have side effects as they are expressions. Guard " "evaluation must proceed from the first to the last case block, one at a " @@ -908,17 +915,17 @@ msgid "" "block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:726 +#: ../../reference/compound_stmts.rst:729 msgid "Irrefutable Case Blocks" msgstr "" -#: ../../reference/compound_stmts.rst:730 +#: ../../reference/compound_stmts.rst:733 msgid "" "An irrefutable case block is a match-all case block. A match statement may " "have at most one irrefutable case block, and it must be last." msgstr "" -#: ../../reference/compound_stmts.rst:733 +#: ../../reference/compound_stmts.rst:736 msgid "" "A case block is considered irrefutable if it has no guard and its pattern is " "irrefutable. A pattern is considered irrefutable if we can prove from its " @@ -926,47 +933,47 @@ msgid "" "irrefutable:" msgstr "" -#: ../../reference/compound_stmts.rst:738 +#: ../../reference/compound_stmts.rst:741 msgid ":ref:`as-patterns` whose left-hand side is irrefutable" msgstr "" -#: ../../reference/compound_stmts.rst:740 +#: ../../reference/compound_stmts.rst:743 msgid ":ref:`or-patterns` containing at least one irrefutable pattern" msgstr "" -#: ../../reference/compound_stmts.rst:742 +#: ../../reference/compound_stmts.rst:745 msgid ":ref:`capture-patterns`" msgstr ":ref:`capture-patterns`" -#: ../../reference/compound_stmts.rst:744 +#: ../../reference/compound_stmts.rst:747 msgid ":ref:`wildcard-patterns`" msgstr ":ref:`wildcard-patterns`" -#: ../../reference/compound_stmts.rst:746 +#: ../../reference/compound_stmts.rst:749 msgid "parenthesized irrefutable patterns" msgstr "" -#: ../../reference/compound_stmts.rst:750 +#: ../../reference/compound_stmts.rst:753 msgid "Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:757 +#: ../../reference/compound_stmts.rst:760 msgid "This section uses grammar notations beyond standard EBNF:" msgstr "" -#: ../../reference/compound_stmts.rst:759 +#: ../../reference/compound_stmts.rst:762 msgid "the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``" msgstr "" -#: ../../reference/compound_stmts.rst:761 +#: ../../reference/compound_stmts.rst:764 msgid "the notation ``!RULE`` is shorthand for a negative lookahead assertion" msgstr "" -#: ../../reference/compound_stmts.rst:764 +#: ../../reference/compound_stmts.rst:767 msgid "The top-level syntax for ``patterns`` is:" msgstr "" -#: ../../reference/compound_stmts.rst:778 +#: ../../reference/compound_stmts.rst:781 msgid "" "The descriptions below will include a description \"in simple terms\" of " "what a pattern does for illustration purposes (credits to Raymond Hettinger " @@ -976,113 +983,113 @@ msgid "" "forms." msgstr "" -#: ../../reference/compound_stmts.rst:788 +#: ../../reference/compound_stmts.rst:791 msgid "OR Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:790 +#: ../../reference/compound_stmts.rst:793 msgid "" "An OR pattern is two or more patterns separated by vertical bars ``|``. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:796 +#: ../../reference/compound_stmts.rst:799 msgid "" "Only the final subpattern may be :ref:`irrefutable <irrefutable_case>`, and " "each subpattern must bind the same set of names to avoid ambiguity." msgstr "" -#: ../../reference/compound_stmts.rst:799 +#: ../../reference/compound_stmts.rst:802 msgid "" "An OR pattern matches each of its subpatterns in turn to the subject value, " "until one succeeds. The OR pattern is then considered successful. " "Otherwise, if none of the subpatterns succeed, the OR pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:803 +#: ../../reference/compound_stmts.rst:806 msgid "" "In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it " "will try to match ``P2``, succeeding immediately if any succeeds, failing " "otherwise." msgstr "" -#: ../../reference/compound_stmts.rst:809 +#: ../../reference/compound_stmts.rst:812 msgid "AS Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:811 +#: ../../reference/compound_stmts.rst:814 msgid "" "An AS pattern matches an OR pattern on the left of the :keyword:`as` keyword " "against a subject. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:817 +#: ../../reference/compound_stmts.rst:820 msgid "" "If the OR pattern fails, the AS pattern fails. Otherwise, the AS pattern " "binds the subject to the name on the right of the as keyword and succeeds. " "``capture_pattern`` cannot be a ``_``." msgstr "" -#: ../../reference/compound_stmts.rst:821 +#: ../../reference/compound_stmts.rst:824 msgid "" "In simple terms ``P as NAME`` will match with ``P``, and on success it will " "set ``NAME = <subject>``." msgstr "" -#: ../../reference/compound_stmts.rst:828 +#: ../../reference/compound_stmts.rst:831 msgid "Literal Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:830 +#: ../../reference/compound_stmts.rst:833 msgid "" "A literal pattern corresponds to most :ref:`literals <literals>` in Python. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:843 +#: ../../reference/compound_stmts.rst:846 msgid "" -"The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" -"`standard Python grammar <./grammar>`. Triple-quoted strings are " +"The rule ``strings`` and the token ``NUMBER`` are defined in " +"the :doc:`standard Python grammar <./grammar>`. Triple-quoted strings are " "supported. Raw strings and byte strings are supported. :ref:`f-strings` " "are not supported." msgstr "" -#: ../../reference/compound_stmts.rst:848 +#: ../../reference/compound_stmts.rst:851 msgid "" "The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are " "for expressing :ref:`complex numbers <imaginary>`; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -#: ../../reference/compound_stmts.rst:852 +#: ../../reference/compound_stmts.rst:855 msgid "" "In simple terms, ``LITERAL`` will succeed only if ``<subject> == LITERAL``. " "For the singletons ``None``, ``True`` and ``False``, the :keyword:`is` " "operator is used." msgstr "" -#: ../../reference/compound_stmts.rst:858 +#: ../../reference/compound_stmts.rst:861 msgid "Capture Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:860 +#: ../../reference/compound_stmts.rst:863 msgid "A capture pattern binds the subject value to a name. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:866 +#: ../../reference/compound_stmts.rst:869 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " -"expresses). It is instead treated as a :token:`~python-grammar:" -"wildcard_pattern`." +"expresses). It is instead treated as a :token:`~python-" +"grammar:wildcard_pattern`." msgstr "" -#: ../../reference/compound_stmts.rst:870 +#: ../../reference/compound_stmts.rst:873 msgid "" "In a given pattern, a given name can only be bound once. E.g. ``case x, " "x: ...`` is invalid while ``case [x] | x: ...`` is allowed." msgstr "" -#: ../../reference/compound_stmts.rst:873 +#: ../../reference/compound_stmts.rst:876 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -1090,55 +1097,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/compound_stmts.rst:878 +#: ../../reference/compound_stmts.rst:881 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "<subject>``." msgstr "" -#: ../../reference/compound_stmts.rst:883 +#: ../../reference/compound_stmts.rst:886 msgid "Wildcard Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:885 +#: ../../reference/compound_stmts.rst:888 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:891 +#: ../../reference/compound_stmts.rst:894 msgid "" "``_`` is a :ref:`soft keyword <soft-keywords>` within any pattern, but only " "within patterns. It is an identifier, as usual, even within ``match`` " "subject expressions, ``guard``\\ s, and ``case`` blocks." msgstr "" -#: ../../reference/compound_stmts.rst:895 +#: ../../reference/compound_stmts.rst:898 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: ../../reference/compound_stmts.rst:900 +#: ../../reference/compound_stmts.rst:903 msgid "Value Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:902 +#: ../../reference/compound_stmts.rst:905 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:910 +#: ../../reference/compound_stmts.rst:913 msgid "" "The dotted name in the pattern is looked up using standard Python :ref:`name " "resolution rules <resolve_names>`. The pattern succeeds if the value found " "compares equal to the subject value (using the ``==`` equality operator)." msgstr "" -#: ../../reference/compound_stmts.rst:915 +#: ../../reference/compound_stmts.rst:918 msgid "" -"In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == NAME1." -"NAME2``" +"In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == " +"NAME1.NAME2``" msgstr "" -#: ../../reference/compound_stmts.rst:919 +#: ../../reference/compound_stmts.rst:922 msgid "" "If the same value occurs multiple times in the same match statement, the " "interpreter may cache the first value found and reuse it rather than repeat " @@ -1146,44 +1153,44 @@ msgid "" "given match statement." msgstr "" -#: ../../reference/compound_stmts.rst:927 +#: ../../reference/compound_stmts.rst:930 msgid "Group Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:929 +#: ../../reference/compound_stmts.rst:932 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:936 +#: ../../reference/compound_stmts.rst:939 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: ../../reference/compound_stmts.rst:941 +#: ../../reference/compound_stmts.rst:944 msgid "Sequence Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:943 +#: ../../reference/compound_stmts.rst:946 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" -#: ../../reference/compound_stmts.rst:954 +#: ../../reference/compound_stmts.rst:957 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: ../../reference/compound_stmts.rst:958 +#: ../../reference/compound_stmts.rst:961 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern <group-patterns>`. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:963 +#: ../../reference/compound_stmts.rst:966 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " @@ -1191,40 +1198,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:968 +#: ../../reference/compound_stmts.rst:971 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:971 +#: ../../reference/compound_stmts.rst:974 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:974 +#: ../../reference/compound_stmts.rst:977 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:977 +#: ../../reference/compound_stmts.rst:980 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: ../../reference/compound_stmts.rst:980 +#: ../../reference/compound_stmts.rst:983 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: ../../reference/compound_stmts.rst:982 +#: ../../reference/compound_stmts.rst:985 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" -#: ../../reference/compound_stmts.rst:985 +#: ../../reference/compound_stmts.rst:988 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " @@ -1232,375 +1239,375 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:990 +#: ../../reference/compound_stmts.rst:993 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: ../../reference/compound_stmts.rst:992 +#: ../../reference/compound_stmts.rst:995 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:995 +#: ../../reference/compound_stmts.rst:998 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: ../../reference/compound_stmts.rst:998 +#: ../../reference/compound_stmts.rst:1001 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" -#: ../../reference/compound_stmts.rst:1002 +#: ../../reference/compound_stmts.rst:1005 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: ../../reference/compound_stmts.rst:1005 +#: ../../reference/compound_stmts.rst:1008 msgid "" "The length of the subject sequence is obtained via :func:`len` (i.e. via " "the :meth:`__len__` protocol). This length may be cached by the interpreter " "in a similar manner as :ref:`value patterns <value-patterns>`." msgstr "" -#: ../../reference/compound_stmts.rst:1011 +#: ../../reference/compound_stmts.rst:1014 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P<N>]`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1014 +#: ../../reference/compound_stmts.rst:1017 msgid "check ``<subject>`` is a sequence" msgstr "" -#: ../../reference/compound_stmts.rst:1015 +#: ../../reference/compound_stmts.rst:1018 msgid "``len(subject) == <N>``" msgstr "``len(subject) == <N>``" -#: ../../reference/compound_stmts.rst:1016 +#: ../../reference/compound_stmts.rst:1019 msgid "" "``P1`` matches ``<subject>[0]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1017 +#: ../../reference/compound_stmts.rst:1020 msgid "" "``P2`` matches ``<subject>[1]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1018 +#: ../../reference/compound_stmts.rst:1021 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: ../../reference/compound_stmts.rst:1023 +#: ../../reference/compound_stmts.rst:1026 msgid "Mapping Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1025 +#: ../../reference/compound_stmts.rst:1028 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1036 +#: ../../reference/compound_stmts.rst:1039 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" -#: ../../reference/compound_stmts.rst:1039 +#: ../../reference/compound_stmts.rst:1042 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1043 +#: ../../reference/compound_stmts.rst:1046 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1046 +#: ../../reference/compound_stmts.rst:1049 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1048 +#: ../../reference/compound_stmts.rst:1051 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1052 +#: ../../reference/compound_stmts.rst:1055 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" -#: ../../reference/compound_stmts.rst:1056 +#: ../../reference/compound_stmts.rst:1059 msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " -"in the mapping, and not created on-the-fly via :meth:`__missing__` or :meth:" -"`~object.__getitem__`." +"in the mapping, and not created on-the-fly via :meth:`__missing__` " +"or :meth:`~object.__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:1061 +#: ../../reference/compound_stmts.rst:1064 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1064 +#: ../../reference/compound_stmts.rst:1067 msgid "check ``<subject>`` is a mapping" msgstr "" -#: ../../reference/compound_stmts.rst:1065 +#: ../../reference/compound_stmts.rst:1068 msgid "``KEY1 in <subject>``" msgstr "``KEY1 in <subject>``" -#: ../../reference/compound_stmts.rst:1066 +#: ../../reference/compound_stmts.rst:1069 msgid "``P1`` matches ``<subject>[KEY1]``" msgstr "" -#: ../../reference/compound_stmts.rst:1067 +#: ../../reference/compound_stmts.rst:1070 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1073 +#: ../../reference/compound_stmts.rst:1076 msgid "Class Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1075 +#: ../../reference/compound_stmts.rst:1078 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1086 +#: ../../reference/compound_stmts.rst:1089 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1088 +#: ../../reference/compound_stmts.rst:1091 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1091 +#: ../../reference/compound_stmts.rst:1094 msgid "" -"If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" -"exc:`TypeError`." +"If ``name_or_attr`` is not an instance of the builtin :class:`type` , " +"raise :exc:`TypeError`." msgstr "" -#: ../../reference/compound_stmts.rst:1094 +#: ../../reference/compound_stmts.rst:1097 msgid "" -"If the subject value is not an instance of ``name_or_attr`` (tested via :" -"func:`isinstance`), the class pattern fails." +"If the subject value is not an instance of ``name_or_attr`` (tested " +"via :func:`isinstance`), the class pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1097 +#: ../../reference/compound_stmts.rst:1100 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" -#: ../../reference/compound_stmts.rst:1101 +#: ../../reference/compound_stmts.rst:1104 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" -#: ../../reference/compound_stmts.rst:1105 +#: ../../reference/compound_stmts.rst:1108 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: ../../reference/compound_stmts.rst:1108 +#: ../../reference/compound_stmts.rst:1111 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1110 +#: ../../reference/compound_stmts.rst:1113 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1113 +#: ../../reference/compound_stmts.rst:1116 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: ../../reference/compound_stmts.rst:1115 +#: ../../reference/compound_stmts.rst:1118 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" -#: ../../reference/compound_stmts.rst:1120 +#: ../../reference/compound_stmts.rst:1123 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1122 +#: ../../reference/compound_stmts.rst:1125 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" -#: ../../reference/compound_stmts.rst:1126 +#: ../../reference/compound_stmts.rst:1129 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1128 +#: ../../reference/compound_stmts.rst:1131 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1130 +#: ../../reference/compound_stmts.rst:1133 msgid "" -"If the returned value is not a tuple, the conversion fails and :exc:" -"`TypeError` is raised." +"If the returned value is not a tuple, the conversion fails " +"and :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1133 +#: ../../reference/compound_stmts.rst:1136 msgid "" -"If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" -"`TypeError` is raised." +"If there are more positional patterns than " +"``len(cls.__match_args__)``, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1136 +#: ../../reference/compound_stmts.rst:1139 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1140 +#: ../../reference/compound_stmts.rst:1143 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1142 +#: ../../reference/compound_stmts.rst:1145 msgid ":ref:`class-pattern-matching`" msgstr ":ref:`class-pattern-matching`" -#: ../../reference/compound_stmts.rst:1144 +#: ../../reference/compound_stmts.rst:1147 msgid "" "II. Once all positional patterns have been converted to keyword patterns," msgstr "" -#: ../../reference/compound_stmts.rst:1145 +#: ../../reference/compound_stmts.rst:1148 msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1147 +#: ../../reference/compound_stmts.rst:1150 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: ../../reference/compound_stmts.rst:1150 +#: ../../reference/compound_stmts.rst:1153 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../reference/compound_stmts.rst:1151 +#: ../../reference/compound_stmts.rst:1154 msgid ":class:`bytearray`" msgstr ":class:`bytearray`" -#: ../../reference/compound_stmts.rst:1152 +#: ../../reference/compound_stmts.rst:1155 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../reference/compound_stmts.rst:1153 +#: ../../reference/compound_stmts.rst:1156 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../reference/compound_stmts.rst:1154 +#: ../../reference/compound_stmts.rst:1157 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../reference/compound_stmts.rst:1155 +#: ../../reference/compound_stmts.rst:1158 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../reference/compound_stmts.rst:1156 +#: ../../reference/compound_stmts.rst:1159 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../reference/compound_stmts.rst:1157 -#: ../../reference/compound_stmts.rst:1875 +#: ../../reference/compound_stmts.rst:1160 +#: ../../reference/compound_stmts.rst:1880 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../reference/compound_stmts.rst:1158 +#: ../../reference/compound_stmts.rst:1161 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../reference/compound_stmts.rst:1159 +#: ../../reference/compound_stmts.rst:1162 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1878 +#: ../../reference/compound_stmts.rst:1163 +#: ../../reference/compound_stmts.rst:1883 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1162 +#: ../../reference/compound_stmts.rst:1165 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" -#: ../../reference/compound_stmts.rst:1166 +#: ../../reference/compound_stmts.rst:1169 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1168 +#: ../../reference/compound_stmts.rst:1171 msgid "``isinstance(<subject>, CLS)``" msgstr "``isinstance(<subject>, CLS)``" -#: ../../reference/compound_stmts.rst:1169 +#: ../../reference/compound_stmts.rst:1172 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: ../../reference/compound_stmts.rst:1170 +#: ../../reference/compound_stmts.rst:1173 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: ../../reference/compound_stmts.rst:1172 +#: ../../reference/compound_stmts.rst:1175 msgid "``hasattr(<subject>, \"attr\")``" msgstr "``hasattr(<subject>, \"attr\")``" -#: ../../reference/compound_stmts.rst:1173 +#: ../../reference/compound_stmts.rst:1176 msgid "``P2`` matches ``<subject>.attr``" msgstr "" -#: ../../reference/compound_stmts.rst:1175 +#: ../../reference/compound_stmts.rst:1178 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1190 +#: ../../reference/compound_stmts.rst:1193 msgid "Function definitions" msgstr "函式定義" -#: ../../reference/compound_stmts.rst:1205 +#: ../../reference/compound_stmts.rst:1208 msgid "" -"A function definition defines a user-defined function object (see section :" -"ref:`types`):" +"A function definition defines a user-defined function object (see " +"section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1225 +#: ../../reference/compound_stmts.rst:1230 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1609,13 +1616,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1231 +#: ../../reference/compound_stmts.rst:1236 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1242 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1626,7 +1633,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1244 +#: ../../reference/compound_stmts.rst:1249 msgid "" "@f1(arg)\n" "@f2\n" @@ -1636,12 +1643,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1248 -#: ../../reference/compound_stmts.rst:1443 +#: ../../reference/compound_stmts.rst:1253 +#: ../../reference/compound_stmts.rst:1448 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1250 +#: ../../reference/compound_stmts.rst:1255 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1649,20 +1656,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1253 +#: ../../reference/compound_stmts.rst:1258 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1255 +#: ../../reference/compound_stmts.rst:1260 msgid "" -"Functions may be decorated with any valid :token:`~python-grammar:" -"assignment_expression`. Previously, the grammar was much more restrictive; " -"see :pep:`614` for details." +"Functions may be decorated with any valid :token:`~python-" +"grammar:assignment_expression`. Previously, the grammar was much more " +"restrictive; see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1260 +#: ../../reference/compound_stmts.rst:1265 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1672,12 +1679,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1267 -#: ../../reference/compound_stmts.rst:1462 +#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1467 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1275 +#: ../../reference/compound_stmts.rst:1280 msgid "" "When one or more :term:`parameters <parameter>` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1688,7 +1695,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1283 +#: ../../reference/compound_stmts.rst:1288 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1701,7 +1708,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1293 +#: ../../reference/compound_stmts.rst:1298 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1710,29 +1717,29 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1304 +#: ../../reference/compound_stmts.rst:1309 msgid "" -"Function call semantics are described in more detail in section :ref:" -"`calls`. A function call always assigns values to all parameters mentioned " -"in the parameter list, either from positional arguments, from keyword " -"arguments, or from default values. If the form \"``*identifier``\" is " -"present, it is initialized to a tuple receiving any excess positional " -"parameters, defaulting to the empty tuple. If the form \"``**identifier``\" " -"is present, it is initialized to a new ordered mapping receiving any excess " -"keyword arguments, defaulting to a new empty mapping of the same type. " -"Parameters after \"``*``\" or \"``*identifier``\" are keyword-only " -"parameters and may only be passed by keyword arguments. Parameters before " -"\"``/``\" are positional-only parameters and may only be passed by " -"positional arguments." +"Function call semantics are described in more detail in " +"section :ref:`calls`. A function call always assigns values to all " +"parameters mentioned in the parameter list, either from positional " +"arguments, from keyword arguments, or from default values. If the form " +"\"``*identifier``\" is present, it is initialized to a tuple receiving any " +"excess positional parameters, defaulting to the empty tuple. If the form " +"\"``**identifier``\" is present, it is initialized to a new ordered mapping " +"receiving any excess keyword arguments, defaulting to a new empty mapping of " +"the same type. Parameters after \"``*``\" or \"``*identifier``\" are " +"keyword-only parameters and may only be passed by keyword arguments. " +"Parameters before \"``/``\" are positional-only parameters and may only be " +"passed by positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1316 +#: ../../reference/compound_stmts.rst:1321 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1325 +#: ../../reference/compound_stmts.rst:1330 msgid "" "Parameters may have an :term:`annotation <function annotation>` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1742,8 +1749,8 @@ msgid "" "of the form \"``-> expression``\" after the parameter list. These " "annotations can be any valid Python expression. The presence of annotations " "does not change the semantics of a function. The annotation values are " -"available as values of a dictionary keyed by the parameters' names in the :" -"attr:`__annotations__` attribute of the function object. If the " +"available as values of a dictionary keyed by the parameters' names in " +"the :attr:`__annotations__` attribute of the function object. If the " "``annotations`` import from :mod:`__future__` is used, annotations are " "preserved as strings at runtime which enables postponed evaluation. " "Otherwise, they are evaluated when the function definition is executed. In " @@ -1751,25 +1758,25 @@ msgid "" "in the source code." msgstr "" -#: ../../reference/compound_stmts.rst:1339 +#: ../../reference/compound_stmts.rst:1344 msgid "" "Parameters of the form \"``*identifier``\" may have an annotation \"``: " "*expression``\". See :pep:`646`." msgstr "" -#: ../../reference/compound_stmts.rst:1345 +#: ../../reference/compound_stmts.rst:1350 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " "described in section :ref:`lambda`. Note that the lambda expression is " "merely a shorthand for a simplified function definition; a function defined " "in a \":keyword:`def`\" statement can be passed around or assigned to " -"another name just like a function defined by a lambda expression. The \":" -"keyword:`!def`\" form is actually more powerful since it allows the " +"another name just like a function defined by a lambda expression. The " +"\":keyword:`!def`\" form is actually more powerful since it allows the " "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1353 +#: ../../reference/compound_stmts.rst:1358 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1778,61 +1785,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1361 +#: ../../reference/compound_stmts.rst:1366 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1362 +#: ../../reference/compound_stmts.rst:1367 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1369 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" -#: ../../reference/compound_stmts.rst:1365 +#: ../../reference/compound_stmts.rst:1370 msgid "Definition of a standard meaning for annotations: type hints." -msgstr "" +msgstr "定義註釋的標準意義:型別提示。" -#: ../../reference/compound_stmts.rst:1367 +#: ../../reference/compound_stmts.rst:1372 msgid ":pep:`526` - Syntax for Variable Annotations" -msgstr "" +msgstr ":pep:`526` - 變數註釋的語法" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1373 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1371 +#: ../../reference/compound_stmts.rst:1376 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1372 +#: ../../reference/compound_stmts.rst:1377 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1375 +#: ../../reference/compound_stmts.rst:1380 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1376 +#: ../../reference/compound_stmts.rst:1381 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1382 +#: ../../reference/compound_stmts.rst:1387 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1397 +#: ../../reference/compound_stmts.rst:1402 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1404 +#: ../../reference/compound_stmts.rst:1409 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1841,7 +1848,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1410 +#: ../../reference/compound_stmts.rst:1415 msgid "" "class Foo:\n" " pass" @@ -1849,11 +1856,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1413 +#: ../../reference/compound_stmts.rst:1418 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1415 +#: ../../reference/compound_stmts.rst:1420 msgid "" "class Foo(object):\n" " pass" @@ -1861,19 +1868,19 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1418 +#: ../../reference/compound_stmts.rst:1423 msgid "" -"The class's suite is then executed in a new execution frame (see :ref:" -"`naming`), using a newly created local namespace and the original global " -"namespace. (Usually, the suite contains mostly function definitions.) When " -"the class's suite finishes execution, its execution frame is discarded but " -"its local namespace is saved. [#]_ A class object is then created using the " -"inheritance list for the base classes and the saved local namespace for the " -"attribute dictionary. The class name is bound to this class object in the " -"original local namespace." +"The class's suite is then executed in a new execution frame " +"(see :ref:`naming`), using a newly created local namespace and the original " +"global namespace. (Usually, the suite contains mostly function " +"definitions.) When the class's suite finishes execution, its execution " +"frame is discarded but its local namespace is saved. [#]_ A class object is " +"then created using the inheritance list for the base classes and the saved " +"local namespace for the attribute dictionary. The class name is bound to " +"this class object in the original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1427 +#: ../../reference/compound_stmts.rst:1432 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's :attr:`~type.__dict__`. Note that this is reliable only " @@ -1881,17 +1888,17 @@ msgid "" "using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1432 +#: ../../reference/compound_stmts.rst:1437 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "<metaclasses>`." msgstr "" -#: ../../reference/compound_stmts.rst:1437 +#: ../../reference/compound_stmts.rst:1442 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1439 +#: ../../reference/compound_stmts.rst:1444 msgid "" "@f1(arg)\n" "@f2\n" @@ -1901,7 +1908,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1445 +#: ../../reference/compound_stmts.rst:1450 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1909,29 +1916,29 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1448 +#: ../../reference/compound_stmts.rst:1453 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1451 +#: ../../reference/compound_stmts.rst:1456 msgid "" -"Classes may be decorated with any valid :token:`~python-grammar:" -"assignment_expression`. Previously, the grammar was much more restrictive; " -"see :pep:`614` for details." +"Classes may be decorated with any valid :token:`~python-" +"grammar:assignment_expression`. Previously, the grammar was much more " +"restrictive; see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1456 +#: ../../reference/compound_stmts.rst:1461 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets immediately after the class's name. This indicates to static type " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" -"`generic-classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. " +"See :ref:`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1465 +#: ../../reference/compound_stmts.rst:1470 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1944,35 +1951,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1477 +#: ../../reference/compound_stmts.rst:1482 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1478 +#: ../../reference/compound_stmts.rst:1483 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1482 +#: ../../reference/compound_stmts.rst:1487 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1483 +#: ../../reference/compound_stmts.rst:1488 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1490 +#: ../../reference/compound_stmts.rst:1495 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1498 +#: ../../reference/compound_stmts.rst:1503 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1508 +#: ../../reference/compound_stmts.rst:1513 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1980,23 +1987,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1512 +#: ../../reference/compound_stmts.rst:1517 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1515 +#: ../../reference/compound_stmts.rst:1520 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1518 +#: ../../reference/compound_stmts.rst:1523 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1520 +#: ../../reference/compound_stmts.rst:1525 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2006,30 +2013,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1524 +#: ../../reference/compound_stmts.rst:1529 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1532 +#: ../../reference/compound_stmts.rst:1537 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1537 +#: ../../reference/compound_stmts.rst:1542 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1541 +#: ../../reference/compound_stmts.rst:1546 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1546 +#: ../../reference/compound_stmts.rst:1551 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2041,11 +2048,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1551 +#: ../../reference/compound_stmts.rst:1556 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1553 +#: ../../reference/compound_stmts.rst:1558 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2075,28 +2082,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1567 +#: ../../reference/compound_stmts.rst:1572 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1569 +#: ../../reference/compound_stmts.rst:1574 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1577 +#: ../../reference/compound_stmts.rst:1582 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1582 +#: ../../reference/compound_stmts.rst:1587 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1587 +#: ../../reference/compound_stmts.rst:1592 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2104,7 +2111,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1592 +#: ../../reference/compound_stmts.rst:1597 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2140,44 +2147,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1609 +#: ../../reference/compound_stmts.rst:1614 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1611 +#: ../../reference/compound_stmts.rst:1616 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1616 +#: ../../reference/compound_stmts.rst:1621 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1617 +#: ../../reference/compound_stmts.rst:1622 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1623 +#: ../../reference/compound_stmts.rst:1628 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1627 +#: ../../reference/compound_stmts.rst:1632 msgid "Support for default values was added (see :pep:`696`)." msgstr "" -#: ../../reference/compound_stmts.rst:1640 +#: ../../reference/compound_stmts.rst:1645 msgid "" -":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" -"`classes <class>` and :ref:`type aliases <type>` may contain a type " -"parameter list::" +":ref:`Functions <def>` (including :ref:`coroutines <async " +"def>`), :ref:`classes <class>` and :ref:`type aliases <type>` may contain a " +"type parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1644 +#: ../../reference/compound_stmts.rst:1649 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2209,7 +2216,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1659 +#: ../../reference/compound_stmts.rst:1664 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2217,7 +2224,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1664 +#: ../../reference/compound_stmts.rst:1669 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2229,36 +2236,37 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1673 +#: ../../reference/compound_stmts.rst:1678 msgid "" -"Generic functions, classes, and type aliases have a :attr:`~definition." -"__type_params__` attribute listing their type parameters." +"Generic functions, classes, and type aliases have " +"a :attr:`~definition.__type_params__` attribute listing their type " +"parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1676 +#: ../../reference/compound_stmts.rst:1681 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1678 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1680 +#: ../../reference/compound_stmts.rst:1685 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1683 +#: ../../reference/compound_stmts.rst:1688 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1686 +#: ../../reference/compound_stmts.rst:1691 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2270,7 +2278,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1695 +#: ../../reference/compound_stmts.rst:1700 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2280,13 +2288,13 @@ msgid "" "<annotation-scopes>`." msgstr "" -#: ../../reference/compound_stmts.rst:1701 +#: ../../reference/compound_stmts.rst:1706 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1704 +#: ../../reference/compound_stmts.rst:1709 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2299,13 +2307,13 @@ msgid "" "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" -#: ../../reference/compound_stmts.rst:1714 +#: ../../reference/compound_stmts.rst:1719 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1716 +#: ../../reference/compound_stmts.rst:1721 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" @@ -2337,24 +2345,24 @@ msgstr "" " *e: SimpleTypeVarTuple,\n" "): ..." -#: ../../reference/compound_stmts.rst:1734 +#: ../../reference/compound_stmts.rst:1739 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1736 +#: ../../reference/compound_stmts.rst:1741 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1738 +#: ../../reference/compound_stmts.rst:1743 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1740 -#: ../../reference/compound_stmts.rst:1800 +#: ../../reference/compound_stmts.rst:1745 +#: ../../reference/compound_stmts.rst:1805 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1742 +#: ../../reference/compound_stmts.rst:1747 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2370,29 +2378,29 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1749 +#: ../../reference/compound_stmts.rst:1754 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " "liberty is taken in the translation: the syntax does not go through " -"attribute access on the :mod:`typing` module, but creates an instance of :" -"data:`typing.TypeVar` directly.)" +"attribute access on the :mod:`typing` module, but creates an instance " +"of :data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1755 +#: ../../reference/compound_stmts.rst:1760 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1759 +#: ../../reference/compound_stmts.rst:1764 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1762 +#: ../../reference/compound_stmts.rst:1767 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2402,13 +2410,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1766 +#: ../../reference/compound_stmts.rst:1771 msgid "" -"Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" -"`~typing.TypeVar` bound, this is equivalent to::" +"Except for the :ref:`lazy evaluation <lazy-evaluation>` of " +"the :class:`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1769 +#: ../../reference/compound_stmts.rst:1774 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2430,25 +2438,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1788 +#: ../../reference/compound_stmts.rst:1793 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1794 +#: ../../reference/compound_stmts.rst:1799 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1796 +#: ../../reference/compound_stmts.rst:1801 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1798 +#: ../../reference/compound_stmts.rst:1803 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1802 +#: ../../reference/compound_stmts.rst:1807 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2466,14 +2474,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1810 +#: ../../reference/compound_stmts.rst:1815 msgid "" -"Here again ``annotation-def`` (not a real keyword) indicates an :ref:" -"`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " -"is not actually bound at runtime." +"Here again ``annotation-def`` (not a real keyword) indicates " +"an :ref:`annotation scope <annotation-scopes>`, and the name " +"``TYPE_PARAMS_OF_Bag`` is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1814 +#: ../../reference/compound_stmts.rst:1819 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2481,7 +2489,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1820 +#: ../../reference/compound_stmts.rst:1825 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2489,11 +2497,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1823 +#: ../../reference/compound_stmts.rst:1828 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1825 +#: ../../reference/compound_stmts.rst:1830 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2511,27 +2519,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1836 +#: ../../reference/compound_stmts.rst:1841 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1838 +#: ../../reference/compound_stmts.rst:1843 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1840 +#: ../../reference/compound_stmts.rst:1845 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1842 +#: ../../reference/compound_stmts.rst:1847 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1845 +#: ../../reference/compound_stmts.rst:1850 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2544,105 +2552,105 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1854 +#: ../../reference/compound_stmts.rst:1859 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope <annotation-scopes>`. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1859 +#: ../../reference/compound_stmts.rst:1864 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1860 +#: ../../reference/compound_stmts.rst:1865 msgid "" -"The exception is propagated to the invocation stack unless there is a :" -"keyword:`finally` clause which happens to raise another exception. That new " -"exception causes the old one to be lost." +"The exception is propagated to the invocation stack unless there is " +"a :keyword:`finally` clause which happens to raise another exception. That " +"new exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1864 +#: ../../reference/compound_stmts.rst:1869 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1866 +#: ../../reference/compound_stmts.rst:1871 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1867 +#: ../../reference/compound_stmts.rst:1872 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1868 +#: ../../reference/compound_stmts.rst:1873 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1869 -#: ../../reference/compound_stmts.rst:1888 +#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1893 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1871 +#: ../../reference/compound_stmts.rst:1876 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1873 +#: ../../reference/compound_stmts.rst:1878 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1879 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1876 +#: ../../reference/compound_stmts.rst:1881 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1877 +#: ../../reference/compound_stmts.rst:1882 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1880 +#: ../../reference/compound_stmts.rst:1885 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1883 +#: ../../reference/compound_stmts.rst:1888 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1885 +#: ../../reference/compound_stmts.rst:1890 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1886 +#: ../../reference/compound_stmts.rst:1891 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1887 +#: ../../reference/compound_stmts.rst:1892 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1890 +#: ../../reference/compound_stmts.rst:1895 msgid "" -"The standard library classes :class:`dict` and :class:`types." -"MappingProxyType` are mappings." +"The standard library classes :class:`dict` " +"and :class:`types.MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1893 +#: ../../reference/compound_stmts.rst:1898 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1897 +#: ../../reference/compound_stmts.rst:1902 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's :attr:`~type.__doc__` item and therefore " @@ -2662,12 +2670,12 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:390 #: ../../reference/compound_stmts.rst:437 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 -#: ../../reference/compound_stmts.rst:1494 -#: ../../reference/compound_stmts.rst:1528 -#: ../../reference/compound_stmts.rst:1573 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 +#: ../../reference/compound_stmts.rst:1499 +#: ../../reference/compound_stmts.rst:1533 +#: ../../reference/compound_stmts.rst:1578 msgid "statement" msgstr "statement(陳述式)" @@ -2703,7 +2711,7 @@ msgstr "" msgid "else" msgstr "else" -#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:588 msgid "if" msgstr "if" @@ -2714,8 +2722,8 @@ msgstr "if" #: ../../reference/compound_stmts.rst:390 #: ../../reference/compound_stmts.rst:408 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1509 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2727,10 +2735,10 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1320 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1325 +#: ../../reference/compound_stmts.rst:1389 msgid ": (colon)" msgstr ": (冒號)" @@ -2738,9 +2746,9 @@ msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2785,8 +2793,8 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:298 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 msgid "object" msgstr "object(物件)" @@ -2818,7 +2826,7 @@ msgstr "finally" #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:265 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "as" msgstr "as" @@ -2856,199 +2864,199 @@ msgid "with statement" msgstr "with statement(with 陳述式)" #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 msgid ", (comma)" msgstr ", (逗號)" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "match" msgstr "match" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "case" msgstr "case" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "pattern matching" msgstr "pattern matching(模式匹配)" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "match statement" msgstr "match statement(匹配陳述式)" -#: ../../reference/compound_stmts.rst:689 +#: ../../reference/compound_stmts.rst:692 msgid "guard" msgstr "guard" -#: ../../reference/compound_stmts.rst:728 +#: ../../reference/compound_stmts.rst:731 msgid "irrefutable case block" msgstr "" -#: ../../reference/compound_stmts.rst:728 +#: ../../reference/compound_stmts.rst:731 msgid "case block" msgstr "" -#: ../../reference/compound_stmts.rst:752 +#: ../../reference/compound_stmts.rst:755 msgid "! patterns" msgstr "" -#: ../../reference/compound_stmts.rst:752 +#: ../../reference/compound_stmts.rst:755 msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" -#: ../../reference/compound_stmts.rst:1183 -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1186 +#: ../../reference/compound_stmts.rst:1275 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/compound_stmts.rst:1183 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1234 -#: ../../reference/compound_stmts.rst:1270 -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1186 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1239 +#: ../../reference/compound_stmts.rst:1275 +#: ../../reference/compound_stmts.rst:1304 msgid "function definition" msgstr "function definition(函式定義)" -#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1195 msgid "def" msgstr "def" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1325 msgid "function" msgstr "function (函式)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 msgid "definition" msgstr "definition(定義)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 msgid "name" msgstr "name(名稱)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 msgid "binding" msgstr "binding(綁定)" -#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1195 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1389 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1195 msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1234 -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1239 +#: ../../reference/compound_stmts.rst:1439 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1275 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1275 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1275 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1275 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1304 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1304 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1304 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1325 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1325 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1325 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1343 +#: ../../reference/compound_stmts.rst:1348 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1343 +#: ../../reference/compound_stmts.rst:1348 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1389 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1389 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1389 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1389 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1389 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1384 -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1389 +#: ../../reference/compound_stmts.rst:1439 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1389 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1494 +#: ../../reference/compound_stmts.rst:1499 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:1509 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:1509 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1528 +#: ../../reference/compound_stmts.rst:1533 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1573 +#: ../../reference/compound_stmts.rst:1578 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1630 +#: ../../reference/compound_stmts.rst:1635 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/datamodel.po b/reference/datamodel.po index ab96edc064..116f7e7b84 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2025-04-27 00:16+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu <mail@kisaragi-hiu.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,8 +66,8 @@ msgid "" msgstr "" "一個物件的型別決定了該物件所支援的操作(例如「它有長度嗎?」),也同時定義該" "型別的物件能夠擁有的數值。:func:`type` 函式會回傳一個物件的型別(而該型別本身" -"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變" -"的。\\ [#]_" +"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變的。" +"\\ [#]_" #: ../../reference/datamodel.rst:50 msgid "" @@ -137,9 +137,9 @@ msgid "" "is garbage-collected, but since garbage collection is not guaranteed to " "happen, such objects also provide an explicit way to release the external " "resource, usually a :meth:`!close` method. Programs are strongly recommended " -"to explicitly close such objects. The :keyword:`try`...\\ :keyword:" -"`finally` statement and the :keyword:`with` statement provide convenient " -"ways to do this." +"to explicitly close such objects. The :keyword:`try`..." +"\\ :keyword:`finally` statement and the :keyword:`with` statement provide " +"convenient ways to do this." msgstr "" "某些物件包含對於「外部」資源的參照,像是開啟的檔案或是視窗。基本上這些資源會" "在物件被回收時釋放,但因為垃圾回收不保證會發生,這種物件也會提供明確釋放外部" @@ -241,10 +241,10 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" -"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 :data:" -"`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所提供的運" -"算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉的操作或" -"是其他的後備方案。)它不應該在預期布林值的情境中被計算。" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名" +"稱 :data:`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所" +"提供的運算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉" +"的操作或是其他的後備方案。)它不應該在預期布林值的情境中被計算。" #: ../../reference/datamodel.rst:172 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." @@ -288,8 +288,8 @@ msgstr "" #: ../../reference/datamodel.rst:204 msgid "" -"The string representations of the numeric classes, computed by :meth:" -"`~object.__repr__` and :meth:`~object.__str__`, have the following " +"The string representations of the numeric classes, computed " +"by :meth:`~object.__repr__` and :meth:`~object.__str__`, have the following " "properties:" msgstr "" @@ -463,9 +463,9 @@ msgid "" "The built-in function :func:`ord` converts a code point from its string form " "to an integer in the range ``0 - 10FFFF``; :func:`chr` converts an integer " "in the range ``0 - 10FFFF`` to the corresponding length ``1`` string " -"object. :meth:`str.encode` can be used to convert a :class:`str` to :class:" -"`bytes` using the given text encoding, and :meth:`bytes.decode` can be used " -"to achieve the opposite." +"object. :meth:`str.encode` can be used to convert a :class:`str` " +"to :class:`bytes` using the given text encoding, and :meth:`bytes.decode` " +"can be used to achieve the opposite." msgstr "" #: ../../reference/datamodel.rst:362 @@ -491,8 +491,8 @@ msgid "" "A bytes object is an immutable array. The items are 8-bit bytes, " "represented by integers in the range 0 <= x < 256. Bytes literals (like " "``b'abc'``) and the built-in :func:`bytes` constructor can be used to create " -"bytes objects. Also, bytes objects can be decoded to strings via the :meth:" -"`~bytes.decode` method." +"bytes objects. Also, bytes objects can be decoded to strings via " +"the :meth:`~bytes.decode` method." msgstr "" #: ../../reference/datamodel.rst:386 @@ -502,8 +502,8 @@ msgstr "可變序列" #: ../../reference/datamodel.rst:395 msgid "" "Mutable sequences can be changed after they are created. The subscription " -"and slicing notations can be used as the target of assignment and :keyword:" -"`del` (delete) statements." +"and slicing notations can be used as the target of assignment " +"and :keyword:`del` (delete) statements." msgstr "" #: ../../reference/datamodel.rst:403 @@ -533,8 +533,8 @@ msgstr "位元組陣列" #: ../../reference/datamodel.rst:418 msgid "" -"A bytearray object is a mutable array. They are created by the built-in :" -"func:`bytearray` constructor. Aside from being mutable (and hence " +"A bytearray object is a mutable array. They are created by the built-" +"in :func:`bytearray` constructor. Aside from being mutable (and hence " "unhashable), byte arrays otherwise provide the same interface and " "functionality as immutable :class:`bytes` objects." msgstr "" @@ -572,8 +572,8 @@ msgstr "Set(集合)" #: ../../reference/datamodel.rst:449 msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " -"constructor and can be modified afterwards by several methods, such as :meth:" -"`~set.add`." +"constructor and can be modified afterwards by several methods, such " +"as :meth:`~set.add`." msgstr "" #: ../../reference/datamodel.rst:454 @@ -582,9 +582,10 @@ msgstr "Frozen set(凍結集合)" #: ../../reference/datamodel.rst:457 msgid "" -"These represent an immutable set. They are created by the built-in :func:" -"`frozenset` constructor. As a frozenset is immutable and :term:`hashable`, " -"it can be used again as an element of another set, or as a dictionary key." +"These represent an immutable set. They are created by the built-" +"in :func:`frozenset` constructor. As a frozenset is immutable " +"and :term:`hashable`, it can be used again as an element of another set, or " +"as a dictionary key." msgstr "" #: ../../reference/datamodel.rst:464 @@ -653,8 +654,8 @@ msgstr "可呼叫型別" #: ../../reference/datamodel.rst:525 msgid "" -"These are the types to which the function call operation (see section :ref:" -"`calls`) can be applied:" +"These are the types to which the function call operation (see " +"section :ref:`calls`) can be applied:" msgstr "" #: ../../reference/datamodel.rst:532 @@ -669,7 +670,7 @@ msgid "" msgstr "" #: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1395 -#: ../../reference/datamodel.rst:1596 +#: ../../reference/datamodel.rst:1594 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" @@ -685,9 +686,9 @@ msgstr "含義" #: ../../reference/datamodel.rst:559 msgid "" -"A reference to the :class:`dictionary <dict>` that holds the function's :ref:" -"`global variables <naming>` -- the global namespace of the module in which " -"the function was defined." +"A reference to the :class:`dictionary <dict>` that holds the " +"function's :ref:`global variables <naming>` -- the global namespace of the " +"module in which the function was defined." msgstr "" #: ../../reference/datamodel.rst:564 @@ -703,7 +704,7 @@ msgid "" "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:572 ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:572 ../../reference/datamodel.rst:1636 msgid "Special writable attributes" msgstr "特殊可寫屬性" @@ -717,8 +718,8 @@ msgstr "函式的文件字串,若不可用則為 ``None``。" #: ../../reference/datamodel.rst:597 msgid "" -"The function's name. See also: :attr:`__name__ attributes <definition." -"__name__>`." +"The function's name. See also: :attr:`__name__ attributes " +"<definition.__name__>`." msgstr "" #: ../../reference/datamodel.rst:601 @@ -748,28 +749,28 @@ msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 <code-objects>`。" #: ../../reference/datamodel.rst:620 msgid "" -"The namespace supporting arbitrary function attributes. See also: :attr:" -"`__dict__ attributes <object.__dict__>`." +"The namespace supporting arbitrary function attributes. See " +"also: :attr:`__dict__ attributes <object.__dict__>`." msgstr "" #: ../../reference/datamodel.rst:624 msgid "" "A :class:`dictionary <dict>` containing annotations of :term:`parameters " "<parameter>`. The keys of the dictionary are the parameter names, and " -"``'return'`` for the return annotation, if provided. See also: :ref:" -"`annotations-howto`." +"``'return'`` for the return annotation, if provided. See " +"also: :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:631 msgid "" -"A :class:`dictionary <dict>` containing defaults for keyword-only :term:" -"`parameters <parameter>`." +"A :class:`dictionary <dict>` containing defaults for keyword-" +"only :term:`parameters <parameter>`." msgstr "" #: ../../reference/datamodel.rst:635 msgid "" -"A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" -"ref:`generic function <generic-functions>`." +"A :class:`tuple` containing the :ref:`type parameters <type-params>` of " +"a :ref:`generic function <generic-functions>`." msgstr "" #: ../../reference/datamodel.rst:640 @@ -789,8 +790,8 @@ msgstr "" #: ../../reference/datamodel.rst:651 msgid "" "Additional information about a function's definition can be retrieved from " -"its :ref:`code object <code-objects>` (accessible via the :attr:`~function." -"__code__` attribute)." +"its :ref:`code object <code-objects>` (accessible via " +"the :attr:`~function.__code__` attribute)." msgstr "" #: ../../reference/datamodel.rst:659 @@ -803,7 +804,7 @@ msgid "" "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1732 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" @@ -819,15 +820,15 @@ msgstr "" #: ../../reference/datamodel.rst:688 msgid "" -"The method's documentation (same as :attr:`method.__func__.__doc__ <function." -"__doc__>`). A :class:`string <str>` if the original function had a " +"The method's documentation (same as :attr:`method.__func__.__doc__ " +"<function.__doc__>`). A :class:`string <str>` if the original function had a " "docstring, else ``None``." msgstr "" #: ../../reference/datamodel.rst:694 msgid "" -"The name of the method (same as :attr:`method.__func__.__name__ <function." -"__name__>`)" +"The name of the method (same as :attr:`method.__func__.__name__ " +"<function.__name__>`)" msgstr "" #: ../../reference/datamodel.rst:698 @@ -845,43 +846,44 @@ msgstr "" msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" -"defined :ref:`function object <user-defined-funcs>` or a :class:" -"`classmethod` object." +"defined :ref:`function object <user-defined-funcs>` or " +"a :class:`classmethod` object." msgstr "" #: ../../reference/datamodel.rst:711 msgid "" -"When an instance method object is created by retrieving a user-defined :ref:" -"`function object <user-defined-funcs>` from a class via one of its " -"instances, its :attr:`~method.__self__` attribute is the instance, and the " -"method object is said to be *bound*. The new method's :attr:`~method." -"__func__` attribute is the original function object." +"When an instance method object is created by retrieving a user-" +"defined :ref:`function object <user-defined-funcs>` from a class via one of " +"its instances, its :attr:`~method.__self__` attribute is the instance, and " +"the method object is said to be *bound*. The new " +"method's :attr:`~method.__func__` attribute is the original function object." msgstr "" #: ../../reference/datamodel.rst:717 msgid "" -"When an instance method object is created by retrieving a :class:" -"`classmethod` object from a class or instance, its :attr:`~method.__self__` " -"attribute is the class itself, and its :attr:`~method.__func__` attribute is " -"the function object underlying the class method." +"When an instance method object is created by retrieving " +"a :class:`classmethod` object from a class or instance, " +"its :attr:`~method.__self__` attribute is the class itself, and " +"its :attr:`~method.__func__` attribute is the function object underlying the " +"class method." msgstr "" #: ../../reference/datamodel.rst:722 msgid "" -"When an instance method object is called, the underlying function (:attr:" -"`~method.__func__`) is called, inserting the class instance (:attr:`~method." -"__self__`) in front of the argument list. For instance, when :class:`!C` is " -"a class which contains a definition for a function :meth:`!f`, and ``x`` is " -"an instance of :class:`!C`, calling ``x.f(1)`` is equivalent to calling ``C." -"f(x, 1)``." +"When an instance method object is called, the underlying function " +"(:attr:`~method.__func__`) is called, inserting the class instance " +"(:attr:`~method.__self__`) in front of the argument list. For instance, " +"when :class:`!C` is a class which contains a definition for a " +"function :meth:`!f`, and ``x`` is an instance of :class:`!C`, calling " +"``x.f(1)`` is equivalent to calling ``C.f(x, 1)``." msgstr "" #: ../../reference/datamodel.rst:729 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " -"actually be the class itself, so that calling either ``x.f(1)`` or ``C." -"f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " +"actually be the class itself, so that calling either ``x.f(1)`` or " +"``C.f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " "function." msgstr "" @@ -898,15 +900,15 @@ msgstr "產生器函式" #: ../../reference/datamodel.rst:747 msgid "" -"A function or method which uses the :keyword:`yield` statement (see section :" -"ref:`yield`) is called a :dfn:`generator function`. Such a function, when " -"called, always returns an :term:`iterator` object which can be used to " -"execute the body of the function: calling the iterator's :meth:`iterator." -"__next__` method will cause the function to execute until it provides a " -"value using the :keyword:`!yield` statement. When the function executes a :" -"keyword:`return` statement or falls off the end, a :exc:`StopIteration` " -"exception is raised and the iterator will have reached the end of the set of " -"values to be returned." +"A function or method which uses the :keyword:`yield` statement (see " +"section :ref:`yield`) is called a :dfn:`generator function`. Such a " +"function, when called, always returns an :term:`iterator` object which can " +"be used to execute the body of the function: calling the " +"iterator's :meth:`iterator.__next__` method will cause the function to " +"execute until it provides a value using the :keyword:`!yield` statement. " +"When the function executes a :keyword:`return` statement or falls off the " +"end, a :exc:`StopIteration` exception is raised and the iterator will have " +"reached the end of the set of values to be returned." msgstr "" #: ../../reference/datamodel.rst:759 @@ -916,10 +918,10 @@ msgstr "Coroutine(協程)函式" #: ../../reference/datamodel.rst:764 msgid "" "A function or method which is defined using :keyword:`async def` is called " -"a :dfn:`coroutine function`. Such a function, when called, returns a :term:" -"`coroutine` object. It may contain :keyword:`await` expressions, as well " -"as :keyword:`async with` and :keyword:`async for` statements. See also the :" -"ref:`coroutine-objects` section." +"a :dfn:`coroutine function`. Such a function, when called, returns " +"a :term:`coroutine` object. It may contain :keyword:`await` expressions, as " +"well as :keyword:`async with` and :keyword:`async for` statements. See also " +"the :ref:`coroutine-objects` section." msgstr "" #: ../../reference/datamodel.rst:772 @@ -937,13 +939,13 @@ msgstr "" #: ../../reference/datamodel.rst:784 msgid "" -"Calling the asynchronous iterator's :meth:`aiterator.__anext__ <object." -"__anext__>` method will return an :term:`awaitable` which when awaited will " -"execute until it provides a value using the :keyword:`yield` expression. " -"When the function executes an empty :keyword:`return` statement or falls off " -"the end, a :exc:`StopAsyncIteration` exception is raised and the " -"asynchronous iterator will have reached the end of the set of values to be " -"yielded." +"Calling the asynchronous iterator's :meth:`aiterator.__anext__ " +"<object.__anext__>` method will return an :term:`awaitable` which when " +"awaited will execute until it provides a value using the :keyword:`yield` " +"expression. When the function executes an empty :keyword:`return` statement " +"or falls off the end, a :exc:`StopAsyncIteration` exception is raised and " +"the asynchronous iterator will have reached the end of the set of values to " +"be yielded." msgstr "" #: ../../reference/datamodel.rst:797 @@ -957,17 +959,17 @@ msgid "" "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" -"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` 和 :" -"func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" -"與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" +"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` " +"和 :func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數" +"數量與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" #: ../../reference/datamodel.rst:809 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." msgstr "" -":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" -"`function.__doc__`。" +":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請" +"見 :attr:`function.__doc__`。" #: ../../reference/datamodel.rst:811 msgid "" @@ -993,10 +995,10 @@ msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " "argument. An example of a built-in method is ``alist.append()``, assuming " -"*alist* is a list object. In this case, the special read-only attribute :" -"attr:`!__self__` is set to the object denoted by *alist*. (The attribute has " -"the same semantics as it does with :attr:`other instance methods <method." -"__self__>`.)" +"*alist* is a list object. In this case, the special read-only " +"attribute :attr:`!__self__` is set to the object denoted by *alist*. (The " +"attribute has the same semantics as it does with :attr:`other instance " +"methods <method.__self__>`.)" msgstr "" #: ../../reference/datamodel.rst:838 @@ -1007,8 +1009,8 @@ msgstr "" msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " -"override :meth:`~object.__new__`. The arguments of the call are passed to :" -"meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " +"override :meth:`~object.__new__`. The arguments of the call are passed " +"to :meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " "initialize the new instance." msgstr "" @@ -1018,8 +1020,8 @@ msgstr "類別實例" #: ../../reference/datamodel.rst:850 msgid "" -"Instances of arbitrary classes can be made callable by defining a :meth:" -"`~object.__call__` method in their class." +"Instances of arbitrary classes can be made callable by defining " +"a :meth:`~object.__call__` method in their class." msgstr "" #: ../../reference/datamodel.rst:857 @@ -1029,16 +1031,16 @@ msgstr "模組" #: ../../reference/datamodel.rst:863 msgid "" "Modules are a basic organizational unit of Python code, and are created by " -"the :ref:`import system <importsystem>` as invoked either by the :keyword:" -"`import` statement, or by calling functions such as :func:`importlib." -"import_module` and built-in :func:`__import__`. A module object has a " -"namespace implemented by a :class:`dictionary <dict>` object (this is the " -"dictionary referenced by the :attr:`~function.__globals__` attribute of " -"functions defined in the module). Attribute references are translated to " -"lookups in this dictionary, e.g., ``m.x`` is equivalent to ``m." -"__dict__[\"x\"]``. A module object does not contain the code object used to " -"initialize the module (since it isn't needed once the initialization is " -"done)." +"the :ref:`import system <importsystem>` as invoked either by " +"the :keyword:`import` statement, or by calling functions such " +"as :func:`importlib.import_module` and built-in :func:`__import__`. A " +"module object has a namespace implemented by a :class:`dictionary <dict>` " +"object (this is the dictionary referenced by " +"the :attr:`~function.__globals__` attribute of functions defined in the " +"module). Attribute references are translated to lookups in this dictionary, " +"e.g., ``m.x`` is equivalent to ``m.__dict__[\"x\"]``. A module object does " +"not contain the code object used to initialize the module (since it isn't " +"needed once the initialization is done)." msgstr "" #: ../../reference/datamodel.rst:876 @@ -1102,8 +1104,8 @@ msgstr "" #: ../../reference/datamodel.rst:935 msgid "" "This attribute must be set to the fully qualified name of the module. It is " -"expected to match the value of :attr:`module.__spec__.name <importlib." -"machinery.ModuleSpec.name>`." +"expected to match the value of :attr:`module.__spec__.name " +"<importlib.machinery.ModuleSpec.name>`." msgstr "" #: ../../reference/datamodel.rst:941 @@ -1124,9 +1126,9 @@ msgstr "" msgid "" "If the module is top-level (that is, not a part of any specific package) " "then the attribute should be set to ``''`` (the empty string). Otherwise, it " -"should be set to the name of the module's package (which can be equal to :" -"attr:`module.__name__` if the module itself is a package). See :pep:`366` " -"for further details." +"should be set to the name of the module's package (which can be equal " +"to :attr:`module.__name__` if the module itself is a package). " +"See :pep:`366` for further details." msgstr "" #: ../../reference/datamodel.rst:958 @@ -1141,9 +1143,9 @@ msgstr "" #: ../../reference/datamodel.rst:964 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.parent " -"<importlib.machinery.ModuleSpec.parent>` instead of :attr:`!module." -"__package__`. :attr:`__package__` is now only used as a fallback if :attr:`!" -"__spec__.parent` is not set, and this fallback path is deprecated." +"<importlib.machinery.ModuleSpec.parent>` instead of :attr:`!" +"module.__package__`. :attr:`__package__` is now only used as a fallback " +"if :attr:`!__spec__.parent` is not set, and this fallback path is deprecated." msgstr "" #: ../../reference/datamodel.rst:970 ../../reference/datamodel.rst:1011 @@ -1155,17 +1157,18 @@ msgstr "" #: ../../reference/datamodel.rst:975 msgid "" -"The value of :attr:`!__package__` is expected to be the same as :attr:" -"`__spec__.parent <importlib.machinery.ModuleSpec.parent>`. :attr:" -"`__package__` is now only used as a fallback during import resolution if :" -"attr:`!__spec__.parent` is not defined." +"The value of :attr:`!__package__` is expected to be the same " +"as :attr:`__spec__.parent " +"<importlib.machinery.ModuleSpec.parent>`. :attr:`__package__` is now only " +"used as a fallback during import resolution if :attr:`!__spec__.parent` is " +"not defined." msgstr "" #: ../../reference/datamodel.rst:981 msgid "" ":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" -"__package__` instead of :attr:`__spec__.parent <importlib.machinery." -"ModuleSpec.parent>`." +"__package__` instead of :attr:`__spec__.parent " +"<importlib.machinery.ModuleSpec.parent>`." msgstr "" #: ../../reference/datamodel.rst:986 @@ -1195,16 +1198,16 @@ msgstr "" #: ../../reference/datamodel.rst:1002 msgid "" ":attr:`!__loader__` defaults to ``None`` for modules created dynamically " -"using the :class:`types.ModuleType` constructor; use :func:`importlib.util." -"module_from_spec` instead to ensure the attribute is set to a :term:`loader` " -"object." +"using the :class:`types.ModuleType` constructor; " +"use :func:`importlib.util.module_from_spec` instead to ensure the attribute " +"is set to a :term:`loader` object." msgstr "" #: ../../reference/datamodel.rst:1007 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.loader " -"<importlib.machinery.ModuleSpec.loader>` instead of :attr:`!module." -"__loader__`." +"<importlib.machinery.ModuleSpec.loader>` instead of :attr:`!" +"module.__loader__`." msgstr "" #: ../../reference/datamodel.rst:1016 @@ -1228,9 +1231,10 @@ msgstr "" #: ../../reference/datamodel.rst:1029 msgid "" -"It is **strongly** recommended that you use :attr:`module.__spec__." -"submodule_search_locations <importlib.machinery.ModuleSpec." -"submodule_search_locations>` instead of :attr:`!module.__path__`." +"It is **strongly** recommended that you " +"use :attr:`module.__spec__.submodule_search_locations " +"<importlib.machinery.ModuleSpec.submodule_search_locations>` instead " +"of :attr:`!module.__path__`." msgstr "" #: ../../reference/datamodel.rst:1036 @@ -1263,18 +1267,18 @@ msgstr "" #: ../../reference/datamodel.rst:1054 msgid "" "Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " -"set. However, that scenario is quite atypical. Ultimately, the :term:" -"`loader` is what makes use of the module spec provided by the :term:`finder` " -"(from which :attr:`!__file__` and :attr:`!__cached__` are derived). So if a " -"loader can load from a cached module but otherwise does not load from a " -"file, that atypical scenario may be appropriate." +"set. However, that scenario is quite atypical. Ultimately, " +"the :term:`loader` is what makes use of the module spec provided by " +"the :term:`finder` (from which :attr:`!__file__` and :attr:`!__cached__` are " +"derived). So if a loader can load from a cached module but otherwise does " +"not load from a file, that atypical scenario may be appropriate." msgstr "" #: ../../reference/datamodel.rst:1061 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.cached " -"<importlib.machinery.ModuleSpec.cached>` instead of :attr:`!module." -"__cached__`." +"<importlib.machinery.ModuleSpec.cached>` instead of :attr:`!" +"module.__cached__`." msgstr "" #: ../../reference/datamodel.rst:1065 @@ -1297,8 +1301,8 @@ msgstr "" #: ../../reference/datamodel.rst:1079 msgid "" -"The module's documentation string, or ``None`` if unavailable. See also: :" -"attr:`__doc__ attributes <definition.__doc__>`." +"The module's documentation string, or ``None`` if unavailable. See " +"also: :attr:`__doc__ attributes <definition.__doc__>`." msgstr "" "模組的文件字串,若不可用則為 ``None``。請見 :attr:`__doc__ attributes " "<definition.__doc__>`。" @@ -1306,8 +1310,8 @@ msgstr "" #: ../../reference/datamodel.rst:1084 msgid "" "A dictionary containing :term:`variable annotations <variable annotation>` " -"collected during module body execution. For best practices on working with :" -"attr:`__annotations__`, please see :ref:`annotations-howto`." +"collected during module body execution. For best practices on working " +"with :attr:`__annotations__`, please see :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:1090 @@ -1339,25 +1343,25 @@ msgstr "" #: ../../reference/datamodel.rst:1114 msgid "" -"Custom class types are typically created by class definitions (see section :" -"ref:`class`). A class has a namespace implemented by a dictionary object. " -"Class attribute references are translated to lookups in this dictionary, e." -"g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although there are a " -"number of hooks which allow for other means of locating attributes). When " -"the attribute name is not found there, the attribute search continues in the " -"base classes. This search of the base classes uses the C3 method resolution " -"order which behaves correctly even in the presence of 'diamond' inheritance " -"structures where there are multiple inheritance paths leading back to a " -"common ancestor. Additional details on the C3 MRO used by Python can be " -"found at :ref:`python_2.3_mro`." +"Custom class types are typically created by class definitions (see " +"section :ref:`class`). A class has a namespace implemented by a dictionary " +"object. Class attribute references are translated to lookups in this " +"dictionary, e.g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although " +"there are a number of hooks which allow for other means of locating " +"attributes). When the attribute name is not found there, the attribute " +"search continues in the base classes. This search of the base classes uses " +"the C3 method resolution order which behaves correctly even in the presence " +"of 'diamond' inheritance structures where there are multiple inheritance " +"paths leading back to a common ancestor. Additional details on the C3 MRO " +"used by Python can be found at :ref:`python_2.3_mro`." msgstr "" #: ../../reference/datamodel.rst:1135 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " -"class method object, it is transformed into an instance method object whose :" -"attr:`~method.__self__` attribute is :class:`!C`. When it would yield a :" -"class:`staticmethod` object, it is transformed into the object wrapped by " +"class method object, it is transformed into an instance method object " +"whose :attr:`~method.__self__` attribute is :class:`!C`. When it would yield " +"a :class:`staticmethod` object, it is transformed into the object wrapped by " "the static method object. See section :ref:`descriptors` for another way in " "which attributes retrieved from a class may differ from those actually " "contained in its :attr:`~object.__dict__`." @@ -1381,8 +1385,8 @@ msgstr "特殊屬性" #: ../../reference/datamodel.rst:1174 msgid "" -"The class's name. See also: :attr:`__name__ attributes <definition." -"__name__>`." +"The class's name. See also: :attr:`__name__ attributes " +"<definition.__name__>`." msgstr "" #: ../../reference/datamodel.rst:1178 @@ -1398,8 +1402,8 @@ msgstr "" #: ../../reference/datamodel.rst:1185 msgid "" "A :class:`mapping proxy <types.MappingProxyType>` providing a read-only view " -"of the class's namespace. See also: :attr:`__dict__ attributes <object." -"__dict__>`." +"of the class's namespace. See also: :attr:`__dict__ attributes " +"<object.__dict__>`." msgstr "" #: ../../reference/datamodel.rst:1190 @@ -1418,22 +1422,22 @@ msgstr "" #: ../../reference/datamodel.rst:1199 msgid "" "A dictionary containing :term:`variable annotations <variable annotation>` " -"collected during class body execution. For best practices on working with :" -"attr:`!__annotations__`, please see :ref:`annotations-howto`." +"collected during class body execution. For best practices on working " +"with :attr:`!__annotations__`, please see :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:1206 msgid "" "Accessing the :attr:`!__annotations__` attribute of a class object directly " "may yield incorrect results in the presence of metaclasses. In addition, the " -"attribute may not exist for some classes. Use :func:`inspect." -"get_annotations` to retrieve class annotations safely." +"attribute may not exist for some classes. " +"Use :func:`inspect.get_annotations` to retrieve class annotations safely." msgstr "" #: ../../reference/datamodel.rst:1213 msgid "" -"A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" -"ref:`generic class <generic-classes>`." +"A :class:`tuple` containing the :ref:`type parameters <type-params>` of " +"a :ref:`generic class <generic-classes>`." msgstr "" #: ../../reference/datamodel.rst:1219 @@ -1508,16 +1512,16 @@ msgid "" "\"Classes\". See section :ref:`descriptors` for another way in which " "attributes of a class retrieved via its instances may differ from the " "objects actually stored in the class's :attr:`~object.__dict__`. If no " -"class attribute is found, and the object's class has a :meth:`~object." -"__getattr__` method, that is called to satisfy the lookup." +"class attribute is found, and the object's class has " +"a :meth:`~object.__getattr__` method, that is called to satisfy the lookup." msgstr "" #: ../../reference/datamodel.rst:1287 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " -"a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" -"meth:`~object.__delattr__` method, this is called instead of updating the " -"instance dictionary directly." +"a class's dictionary. If the class has a :meth:`~object.__setattr__` " +"or :meth:`~object.__delattr__` method, this is called instead of updating " +"the instance dictionary directly." msgstr "" #: ../../reference/datamodel.rst:1297 @@ -1545,9 +1549,9 @@ msgstr "" msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " -"also :func:`os.popen`, :func:`os.fdopen`, and the :meth:`~socket.socket." -"makefile` method of socket objects (and perhaps by other functions or " -"methods provided by extension modules)." +"also :func:`os.popen`, :func:`os.fdopen`, and " +"the :meth:`~socket.socket.makefile` method of socket objects (and perhaps by " +"other functions or methods provided by extension modules)." msgstr "" #: ../../reference/datamodel.rst:1340 @@ -1575,14 +1579,15 @@ msgstr "程式碼物件" #: ../../reference/datamodel.rst:1366 msgid "" -"Code objects represent *byte-compiled* executable Python code, or :term:" -"`bytecode`. The difference between a code object and a function object is " -"that the function object contains an explicit reference to the function's " -"globals (the module in which it was defined), while a code object contains " -"no context; also the default argument values are stored in the function " -"object, not in the code object (because they represent values calculated at " -"run-time). Unlike function objects, code objects are immutable and contain " -"no references (directly or indirectly) to mutable objects." +"Code objects represent *byte-compiled* executable Python code, " +"or :term:`bytecode`. The difference between a code object and a function " +"object is that the function object contains an explicit reference to the " +"function's globals (the module in which it was defined), while a code object " +"contains no context; also the default argument values are stored in the " +"function object, not in the code object (because they represent values " +"calculated at run-time). Unlike function objects, code objects are " +"immutable and contain no references (directly or indirectly) to mutable " +"objects." msgstr "" #: ../../reference/datamodel.rst:1400 @@ -1695,43 +1700,42 @@ msgid "" "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " "arbitrary number of positional arguments; bit ``0x08`` is set if the " "function uses the ``**keywords`` syntax to accept arbitrary keyword " -"arguments; bit ``0x20`` is set if the function is a generator. See :ref:" -"`inspect-module-co-flags` for details on the semantics of each flags that " -"might be present." +"arguments; bit ``0x20`` is set if the function is a generator. " +"See :ref:`inspect-module-co-flags` for details on the semantics of each " +"flags that might be present." msgstr "" #: ../../reference/datamodel.rst:1482 msgid "" -"Future feature declarations (``from __future__ import division``) also use " -"bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " -"compiled with a particular feature enabled: bit ``0x2000`` is set if the " -"function was compiled with future division enabled; bits ``0x10`` and " -"``0x1000`` were used in earlier versions of Python." +"Future feature declarations (for example, ``from __future__ import " +"division``) also use bits in :attr:`~codeobject.co_flags` to indicate " +"whether a code object was compiled with a particular feature enabled. " +"See :attr:`~__future__._Feature.compiler_flag`." msgstr "" -#: ../../reference/datamodel.rst:1488 +#: ../../reference/datamodel.rst:1486 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1492 +#: ../../reference/datamodel.rst:1490 msgid "" -"If a code object represents a function, the first item in :attr:`~codeobject." -"co_consts` is the documentation string of the function, or ``None`` if " -"undefined." +"If a code object represents a function, the first item " +"in :attr:`~codeobject.co_consts` is the documentation string of the " +"function, or ``None`` if undefined." msgstr "" -#: ../../reference/datamodel.rst:1497 +#: ../../reference/datamodel.rst:1495 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1501 +#: ../../reference/datamodel.rst:1499 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1504 +#: ../../reference/datamodel.rst:1502 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1739,37 +1743,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1510 +#: ../../reference/datamodel.rst:1508 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1513 +#: ../../reference/datamodel.rst:1511 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1512 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1515 +#: ../../reference/datamodel.rst:1513 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1516 +#: ../../reference/datamodel.rst:1514 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1519 +#: ../../reference/datamodel.rst:1517 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1525 +#: ../../reference/datamodel.rst:1523 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1779,158 +1783,158 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1534 +#: ../../reference/datamodel.rst:1532 msgid "" -"Returns an iterator that yields information about successive ranges of :term:" -"`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" -"`tuple`:" +"Returns an iterator that yields information about successive ranges " +"of :term:`bytecode`\\s. Each item yielded is a ``(start, end, " +"lineno)`` :class:`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1538 +#: ../../reference/datamodel.rst:1536 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1540 +#: ../../reference/datamodel.rst:1538 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1542 +#: ../../reference/datamodel.rst:1540 msgid "" -"``lineno`` is an :class:`int` representing the line number of the :term:" -"`bytecode` range, or ``None`` if the bytecodes in the given range have no " -"line number" +"``lineno`` is an :class:`int` representing the line number of " +"the :term:`bytecode` range, or ``None`` if the bytecodes in the given range " +"have no line number" msgstr "" -#: ../../reference/datamodel.rst:1546 +#: ../../reference/datamodel.rst:1544 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1548 +#: ../../reference/datamodel.rst:1546 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1549 +#: ../../reference/datamodel.rst:1547 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1552 +#: ../../reference/datamodel.rst:1550 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1553 +#: ../../reference/datamodel.rst:1551 msgid "" -"The last :class:`tuple` yielded will have ``end`` equal to the size of the :" -"term:`bytecode`." +"The last :class:`tuple` yielded will have ``end`` equal to the size of " +"the :term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1556 +#: ../../reference/datamodel.rst:1554 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1564 +#: ../../reference/datamodel.rst:1562 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1565 +#: ../../reference/datamodel.rst:1563 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1569 +#: ../../reference/datamodel.rst:1567 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1571 +#: ../../reference/datamodel.rst:1569 msgid "" "Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" -#: ../../reference/datamodel.rst:1579 +#: ../../reference/datamodel.rst:1577 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1583 +#: ../../reference/datamodel.rst:1581 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects <traceback-objects>`, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1601 +#: ../../reference/datamodel.rst:1599 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1605 +#: ../../reference/datamodel.rst:1603 msgid "" "The :ref:`code object <code-objects>` being executed in this frame. " -"Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." -"__getattr__`` with arguments ``obj`` and ``\"f_code\"``." +"Accessing this attribute raises an :ref:`auditing event <auditing>` " +"``object.__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" "在這個 frame 中執行的\\ :ref:`程式碼物件 (code object) <code-objects>`。存取" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1610 +#: ../../reference/datamodel.rst:1608 msgid "" "The mapping used by the frame to look up :ref:`local variables <naming>`. If " "the frame refers to an :term:`optimized scope`, this may return a write-" "through proxy object." msgstr "" -#: ../../reference/datamodel.rst:1615 +#: ../../reference/datamodel.rst:1613 msgid "Return a proxy for optimized scopes." msgstr "" -#: ../../reference/datamodel.rst:1619 +#: ../../reference/datamodel.rst:1617 msgid "" "The dictionary used by the frame to look up :ref:`global variables <naming>`" msgstr "" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1621 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "<naming>`" msgstr "" -#: ../../reference/datamodel.rst:1627 +#: ../../reference/datamodel.rst:1625 msgid "" -"The \"precise instruction\" of the frame object (this is an index into the :" -"term:`bytecode` string of the :ref:`code object <code-objects>`)" +"The \"precise instruction\" of the frame object (this is an index into " +"the :term:`bytecode` string of the :ref:`code object <code-objects>`)" msgstr "" -#: ../../reference/datamodel.rst:1643 +#: ../../reference/datamodel.rst:1641 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1648 +#: ../../reference/datamodel.rst:1646 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1652 +#: ../../reference/datamodel.rst:1650 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1658 +#: ../../reference/datamodel.rst:1656 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -1938,15 +1942,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1664 +#: ../../reference/datamodel.rst:1662 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1666 +#: ../../reference/datamodel.rst:1664 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1670 +#: ../../reference/datamodel.rst:1668 msgid "" "This method clears all references to :ref:`local variables <naming>` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1955,81 +1959,81 @@ msgid "" "and storing its :ref:`traceback <traceback-objects>` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1676 +#: ../../reference/datamodel.rst:1674 msgid "" ":exc:`RuntimeError` is raised if the frame is currently executing or " "suspended." msgstr "" -#: ../../reference/datamodel.rst:1681 +#: ../../reference/datamodel.rst:1679 msgid "" "Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " "always been the case for executing frames)." msgstr "" -#: ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:1687 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1702 +#: ../../reference/datamodel.rst:1700 msgid "" "Traceback objects represent the stack trace of an :ref:`exception <tut-" "errors>`. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1707 +#: ../../reference/datamodel.rst:1705 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1710 +#: ../../reference/datamodel.rst:1708 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " "inserted in front of the current traceback. When an exception handler is " -"entered, the stack trace is made available to the program. (See section :ref:" -"`try`.) It is accessible as the third item of the tuple returned by :func:" -"`sys.exc_info`, and as the :attr:`~BaseException.__traceback__` attribute of " -"the caught exception." +"entered, the stack trace is made available to the program. (See " +"section :ref:`try`.) It is accessible as the third item of the tuple " +"returned by :func:`sys.exc_info`, and as " +"the :attr:`~BaseException.__traceback__` attribute of the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1719 +#: ../../reference/datamodel.rst:1717 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " -"interactive, it is also made available to the user as :data:`sys." -"last_traceback`." +"interactive, it is also made available to the user " +"as :data:`sys.last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1724 +#: ../../reference/datamodel.rst:1722 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1739 +#: ../../reference/datamodel.rst:1737 msgid "" "Points to the execution :ref:`frame <frame-objects>` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1740 msgid "" -"Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." -"__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." +"Accessing this attribute raises an :ref:`auditing event <auditing>` " +"``object.__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1747 +#: ../../reference/datamodel.rst:1745 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1750 +#: ../../reference/datamodel.rst:1748 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1752 +#: ../../reference/datamodel.rst:1750 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object <frame-objects>` if the exception " @@ -2037,39 +2041,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1763 +#: ../../reference/datamodel.rst:1761 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1767 +#: ../../reference/datamodel.rst:1765 msgid "This attribute is now writable" msgstr "" -#: ../../reference/datamodel.rst:1772 +#: ../../reference/datamodel.rst:1770 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1776 +#: ../../reference/datamodel.rst:1774 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1785 +#: ../../reference/datamodel.rst:1783 msgid "" -"Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" -"`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " -"each is ``None`` if omitted. These attributes can have any type." +"Special read-only attributes: :attr:`~slice.start` is the lower " +"bound; :attr:`~slice.stop` is the upper bound; :attr:`~slice.step` is the " +"step value; each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1789 +#: ../../reference/datamodel.rst:1787 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1793 +#: ../../reference/datamodel.rst:1791 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -2079,11 +2083,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1802 +#: ../../reference/datamodel.rst:1800 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1804 +#: ../../reference/datamodel.rst:1802 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -2094,48 +2098,48 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1814 +#: ../../reference/datamodel.rst:1812 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1816 +#: ../../reference/datamodel.rst:1814 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " "classes and class instances. The behaviour of class method objects upon such " "retrieval is described above, under :ref:`\"instance methods\" <instance-" -"methods>`. Class method objects are created by the built-in :func:" -"`classmethod` constructor." +"methods>`. Class method objects are created by the built-" +"in :func:`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1826 +#: ../../reference/datamodel.rst:1824 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1832 +#: ../../reference/datamodel.rst:1830 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " "methods with special names. This is Python's approach to :dfn:`operator " "overloading`, allowing classes to define their own behavior with respect to " -"language operators. For instance, if a class defines a method named :meth:" -"`~object.__getitem__`, and ``x`` is an instance of this class, then ``x[i]`` " -"is roughly equivalent to ``type(x).__getitem__(x, i)``. Except where " -"mentioned, attempts to execute an operation raise an exception when no " -"appropriate method is defined (typically :exc:`AttributeError` or :exc:" -"`TypeError`)." +"language operators. For instance, if a class defines a method " +"named :meth:`~object.__getitem__`, and ``x`` is an instance of this class, " +"then ``x[i]`` is roughly equivalent to ``type(x).__getitem__(x, i)``. " +"Except where mentioned, attempts to execute an operation raise an exception " +"when no appropriate method is defined (typically :exc:`AttributeError` " +"or :exc:`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1843 +#: ../../reference/datamodel.rst:1841 msgid "" "Setting a special method to ``None`` indicates that the corresponding " -"operation is not available. For example, if a class sets :meth:`~object." -"__iter__` to ``None``, the class is not iterable, so calling :func:`iter` on " -"its instances will raise a :exc:`TypeError` (without falling back to :meth:" -"`~object.__getitem__`). [#]_" +"operation is not available. For example, if a class " +"sets :meth:`~object.__iter__` to ``None``, the class is not iterable, so " +"calling :func:`iter` on its instances will raise a :exc:`TypeError` (without " +"falling back to :meth:`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1849 +#: ../../reference/datamodel.rst:1847 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -2145,11 +2149,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1860 +#: ../../reference/datamodel.rst:1858 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1866 +#: ../../reference/datamodel.rst:1864 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -2159,7 +2163,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1873 +#: ../../reference/datamodel.rst:1871 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -2167,7 +2171,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1878 +#: ../../reference/datamodel.rst:1876 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -2176,13 +2180,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1883 +#: ../../reference/datamodel.rst:1881 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1886 +#: ../../reference/datamodel.rst:1884 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -2190,7 +2194,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1895 +#: ../../reference/datamodel.rst:1893 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -2200,7 +2204,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1902 +#: ../../reference/datamodel.rst:1900 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -2208,16 +2212,16 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1915 +#: ../../reference/datamodel.rst:1913 msgid "" "Called when the instance is about to be destroyed. This is also called a " -"finalizer or (improperly) a destructor. If a base class has a :meth:" -"`__del__` method, the derived class's :meth:`__del__` method, if any, must " -"explicitly call it to ensure proper deletion of the base class part of the " -"instance." +"finalizer or (improperly) a destructor. If a base class has " +"a :meth:`__del__` method, the derived class's :meth:`__del__` method, if " +"any, must explicitly call it to ensure proper deletion of the base class " +"part of the instance." msgstr "" -#: ../../reference/datamodel.rst:1921 +#: ../../reference/datamodel.rst:1919 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -2227,7 +2231,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1928 +#: ../../reference/datamodel.rst:1926 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -2235,14 +2239,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1935 +#: ../../reference/datamodel.rst:1933 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1940 +#: ../../reference/datamodel.rst:1938 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -2253,27 +2257,27 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1950 +#: ../../reference/datamodel.rst:1948 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1954 +#: ../../reference/datamodel.rst:1952 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1958 +#: ../../reference/datamodel.rst:1956 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " "lock or invoke any other blocking resource, it may deadlock as the resource " -"may already be taken by the code that gets interrupted to execute :meth:" -"`__del__`." +"may already be taken by the code that gets interrupted to " +"execute :meth:`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1964 +#: ../../reference/datamodel.rst:1962 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -2284,26 +2288,27 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1979 +#: ../../reference/datamodel.rst:1977 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " "like a valid Python expression that could be used to recreate an object with " "the same value (given an appropriate environment). If this is not possible, " "a string of the form ``<...some useful description...>`` should be returned. " -"The return value must be a string object. If a class defines :meth:" -"`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is also used when " -"an \"informal\" string representation of instances of that class is required." +"The return value must be a string object. If a class " +"defines :meth:`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is " +"also used when an \"informal\" string representation of instances of that " +"class is required." msgstr "" -#: ../../reference/datamodel.rst:1988 +#: ../../reference/datamodel.rst:1986 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous. A default implementation " "is provided by the :class:`object` class itself." msgstr "" -#: ../../reference/datamodel.rst:2000 +#: ../../reference/datamodel.rst:1998 msgid "" "Called by :func:`str(object) <str>`, the default :meth:`__format__` " "implementation, and the built-in function :func:`print`, to compute the " @@ -2311,27 +2316,27 @@ msgid "" "return value must be a :ref:`str <textseq>` object." msgstr "" -#: ../../reference/datamodel.rst:2005 +#: ../../reference/datamodel.rst:2003 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:2009 +#: ../../reference/datamodel.rst:2007 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:2019 +#: ../../reference/datamodel.rst:2017 msgid "" "Called by :ref:`bytes <func-bytes>` to compute a byte-string representation " -"of an object. This should return a :class:`bytes` object. The :class:" -"`object` class itself does not provide this method." +"of an object. This should return a :class:`bytes` object. " +"The :class:`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2031 +#: ../../reference/datamodel.rst:2029 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals <f-strings>` and the :meth:`str.format` " @@ -2343,43 +2348,43 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:2041 +#: ../../reference/datamodel.rst:2039 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:2043 +#: ../../reference/datamodel.rst:2041 msgid "The return value must be a string object." msgstr "回傳值必須是個字串物件。" -#: ../../reference/datamodel.rst:2045 +#: ../../reference/datamodel.rst:2043 msgid "" "The default implementation by the :class:`object` class should be given an " "empty *format_spec* string. It delegates to :meth:`__str__`." msgstr "" -#: ../../reference/datamodel.rst:2048 +#: ../../reference/datamodel.rst:2046 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:2052 +#: ../../reference/datamodel.rst:2050 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:2068 +#: ../../reference/datamodel.rst:2066 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " -"between operator symbols and method names is as follows: ``x<y`` calls ``x." -"__lt__(y)``, ``x<=y`` calls ``x.__le__(y)``, ``x==y`` calls ``x.__eq__(y)``, " -"``x!=y`` calls ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and ``x>=y`` " -"calls ``x.__ge__(y)``." +"between operator symbols and method names is as follows: ``x<y`` calls " +"``x.__lt__(y)``, ``x<=y`` calls ``x.__le__(y)``, ``x==y`` calls " +"``x.__eq__(y)``, ``x!=y`` calls ``x.__ne__(y)``, ``x>y`` calls " +"``x.__gt__(y)``, and ``x>=y`` calls ``x.__ge__(y)``." msgstr "" -#: ../../reference/datamodel.rst:2074 +#: ../../reference/datamodel.rst:2072 msgid "" "A rich comparison method may return the singleton :data:`NotImplemented` if " "it does not implement the operation for a given pair of arguments. By " @@ -2390,66 +2395,67 @@ msgid "" "result is true or false." msgstr "" -#: ../../reference/datamodel.rst:2081 +#: ../../reference/datamodel.rst:2079 msgid "" -"By default, ``object`` implements :meth:`__eq__` by using ``is``, returning :" -"data:`NotImplemented` in the case of a false comparison: ``True if x is y " -"else NotImplemented``. For :meth:`__ne__`, by default it delegates to :meth:" -"`__eq__` and inverts the result unless it is :data:`!NotImplemented`. There " -"are no other implied relationships among the comparison operators or default " -"implementations; for example, the truth of ``(x<y or x==y)`` does not imply " -"``x<=y``. To automatically generate ordering operations from a single root " -"operation, see :func:`functools.total_ordering`." +"By default, ``object`` implements :meth:`__eq__` by using ``is``, " +"returning :data:`NotImplemented` in the case of a false comparison: ``True " +"if x is y else NotImplemented``. For :meth:`__ne__`, by default it delegates " +"to :meth:`__eq__` and inverts the result unless it is :data:`!" +"NotImplemented`. There are no other implied relationships among the " +"comparison operators or default implementations; for example, the truth of " +"``(x<y or x==y)`` does not imply ``x<=y``. To automatically generate " +"ordering operations from a single root operation, " +"see :func:`functools.total_ordering`." msgstr "" -#: ../../reference/datamodel.rst:2090 +#: ../../reference/datamodel.rst:2088 msgid "" "By default, the :class:`object` class provides implementations consistent " "with :ref:`expressions-value-comparisons`: equality compares according to " "object identity, and order comparisons raise :exc:`TypeError`. Each default " -"method may generate these results directly, but may also return :data:" -"`NotImplemented`." +"method may generate these results directly, but may also " +"return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:2096 +#: ../../reference/datamodel.rst:2094 msgid "" -"See the paragraph on :meth:`__hash__` for some important notes on creating :" -"term:`hashable` objects which support custom comparison operations and are " -"usable as dictionary keys." +"See the paragraph on :meth:`__hash__` for some important notes on " +"creating :term:`hashable` objects which support custom comparison operations " +"and are usable as dictionary keys." msgstr "" -#: ../../reference/datamodel.rst:2100 +#: ../../reference/datamodel.rst:2098 msgid "" "There are no swapped-argument versions of these methods (to be used when the " "left argument does not support the operation but the right argument does); " -"rather, :meth:`__lt__` and :meth:`__gt__` are each other's reflection, :meth:" -"`__le__` and :meth:`__ge__` are each other's reflection, and :meth:`__eq__` " -"and :meth:`__ne__` are their own reflection. If the operands are of " -"different types, and the right operand's type is a direct or indirect " -"subclass of the left operand's type, the reflected method of the right " -"operand has priority, otherwise the left operand's method has priority. " -"Virtual subclassing is not considered." +"rather, :meth:`__lt__` and :meth:`__gt__` are each other's " +"reflection, :meth:`__le__` and :meth:`__ge__` are each other's reflection, " +"and :meth:`__eq__` and :meth:`__ne__` are their own reflection. If the " +"operands are of different types, and the right operand's type is a direct or " +"indirect subclass of the left operand's type, the reflected method of the " +"right operand has priority, otherwise the left operand's method has " +"priority. Virtual subclassing is not considered." msgstr "" -#: ../../reference/datamodel.rst:2111 +#: ../../reference/datamodel.rst:2109 msgid "" -"When no appropriate method returns any value other than :data:" -"`NotImplemented`, the ``==`` and ``!=`` operators will fall back to ``is`` " -"and ``is not``, respectively." +"When no appropriate method returns any value other " +"than :data:`NotImplemented`, the ``==`` and ``!=`` operators will fall back " +"to ``is`` and ``is not``, respectively." msgstr "" -#: ../../reference/datamodel.rst:2120 +#: ../../reference/datamodel.rst:2118 msgid "" "Called by built-in function :func:`hash` and for operations on members of " -"hashed collections including :class:`set`, :class:`frozenset`, and :class:" -"`dict`. The ``__hash__()`` method should return an integer. The only " -"required property is that objects which compare equal have the same hash " -"value; it is advised to mix together the hash values of the components of " -"the object that also play a part in comparison of objects by packing them " +"hashed collections including :class:`set`, :class:`frozenset`, " +"and :class:`dict`. The ``__hash__()`` method should return an integer. The " +"only required property is that objects which compare equal have the same " +"hash value; it is advised to mix together the hash values of the components " +"of the object that also play a part in comparison of objects by packing them " "into a tuple and hashing the tuple. Example::" msgstr "" -#: ../../reference/datamodel.rst:2128 +#: ../../reference/datamodel.rst:2126 msgid "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" @@ -2457,29 +2463,29 @@ msgstr "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" -#: ../../reference/datamodel.rst:2133 +#: ../../reference/datamodel.rst:2131 msgid "" -":func:`hash` truncates the value returned from an object's custom :meth:" -"`__hash__` method to the size of a :c:type:`Py_ssize_t`. This is typically " -"8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an object's :" -"meth:`__hash__` must interoperate on builds of different bit sizes, be sure " -"to check the width on all supported builds. An easy way to do this is with " -"``python -c \"import sys; print(sys.hash_info.width)\"``." +":func:`hash` truncates the value returned from an object's " +"custom :meth:`__hash__` method to the size of a :c:type:`Py_ssize_t`. This " +"is typically 8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an " +"object's :meth:`__hash__` must interoperate on builds of different bit " +"sizes, be sure to check the width on all supported builds. An easy way to " +"do this is with ``python -c \"import sys; print(sys.hash_info.width)\"``." msgstr "" -#: ../../reference/datamodel.rst:2141 +#: ../../reference/datamodel.rst:2139 msgid "" -"If a class does not define an :meth:`__eq__` method it should not define a :" -"meth:`__hash__` operation either; if it defines :meth:`__eq__` but not :meth:" -"`__hash__`, its instances will not be usable as items in hashable " -"collections. If a class defines mutable objects and implements an :meth:" -"`__eq__` method, it should not implement :meth:`__hash__`, since the " -"implementation of :term:`hashable` collections requires that a key's hash " -"value is immutable (if the object's hash value changes, it will be in the " -"wrong hash bucket)." +"If a class does not define an :meth:`__eq__` method it should not define " +"a :meth:`__hash__` operation either; if it defines :meth:`__eq__` but " +"not :meth:`__hash__`, its instances will not be usable as items in hashable " +"collections. If a class defines mutable objects and implements " +"an :meth:`__eq__` method, it should not implement :meth:`__hash__`, since " +"the implementation of :term:`hashable` collections requires that a key's " +"hash value is immutable (if the object's hash value changes, it will be in " +"the wrong hash bucket)." msgstr "" -#: ../../reference/datamodel.rst:2150 +#: ../../reference/datamodel.rst:2148 msgid "" "User-defined classes have :meth:`__eq__` and :meth:`__hash__` methods by " "default (inherited from the :class:`object` class); with them, all objects " @@ -2488,33 +2494,33 @@ msgid "" "``hash(x) == hash(y)``." msgstr "" -#: ../../reference/datamodel.rst:2155 +#: ../../reference/datamodel.rst:2153 msgid "" "A class that overrides :meth:`__eq__` and does not define :meth:`__hash__` " -"will have its :meth:`__hash__` implicitly set to ``None``. When the :meth:" -"`__hash__` method of a class is ``None``, instances of the class will raise " -"an appropriate :exc:`TypeError` when a program attempts to retrieve their " -"hash value, and will also be correctly identified as unhashable when " -"checking ``isinstance(obj, collections.abc.Hashable)``." +"will have its :meth:`__hash__` implicitly set to ``None``. When " +"the :meth:`__hash__` method of a class is ``None``, instances of the class " +"will raise an appropriate :exc:`TypeError` when a program attempts to " +"retrieve their hash value, and will also be correctly identified as " +"unhashable when checking ``isinstance(obj, collections.abc.Hashable)``." msgstr "" -#: ../../reference/datamodel.rst:2162 +#: ../../reference/datamodel.rst:2160 msgid "" "If a class that overrides :meth:`__eq__` needs to retain the implementation " "of :meth:`__hash__` from a parent class, the interpreter must be told this " "explicitly by setting ``__hash__ = <ParentClass>.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:2166 +#: ../../reference/datamodel.rst:2164 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " -"class which defines its own :meth:`__hash__` that explicitly raises a :exc:" -"`TypeError` would be incorrectly identified as hashable by an " +"class which defines its own :meth:`__hash__` that explicitly raises " +"a :exc:`TypeError` would be incorrectly identified as hashable by an " "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:2175 +#: ../../reference/datamodel.rst:2173 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2522,7 +2528,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:2180 +#: ../../reference/datamodel.rst:2178 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2530,67 +2536,67 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:2185 +#: ../../reference/datamodel.rst:2183 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:2189 +#: ../../reference/datamodel.rst:2187 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:2191 +#: ../../reference/datamodel.rst:2189 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:2199 +#: ../../reference/datamodel.rst:2197 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " "defined, :meth:`~object.__len__` is called, if it is defined, and the object " -"is considered true if its result is nonzero. If a class defines neither :" -"meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " -"class itself), all its instances are considered true." +"is considered true if its result is nonzero. If a class defines " +"neither :meth:`!__len__` nor :meth:`!__bool__` (which is true of " +"the :class:`object` class itself), all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:2210 +#: ../../reference/datamodel.rst:2208 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:2212 +#: ../../reference/datamodel.rst:2210 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:2220 +#: ../../reference/datamodel.rst:2218 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " "*name* is not an instance attribute or an attribute in the class tree for " -"``self``; or :meth:`__get__` of a *name* property raises :exc:" -"`AttributeError`). This method should either return the (computed) " -"attribute value or raise an :exc:`AttributeError` exception. The :class:" -"`object` class itself does not provide this method." -msgstr "" - -#: ../../reference/datamodel.rst:2228 -msgid "" -"Note that if the attribute is found through the normal mechanism, :meth:" -"`__getattr__` is not called. (This is an intentional asymmetry between :" -"meth:`__getattr__` and :meth:`__setattr__`.) This is done both for " -"efficiency reasons and because otherwise :meth:`__getattr__` would have no " -"way to access other attributes of the instance. Note that at least for " -"instance variables, you can take total control by not inserting any values " -"in the instance attribute dictionary (but instead inserting them in another " -"object). See the :meth:`__getattribute__` method below for a way to " +"``self``; or :meth:`__get__` of a *name* property " +"raises :exc:`AttributeError`). This method should either return the " +"(computed) attribute value or raise an :exc:`AttributeError` exception. " +"The :class:`object` class itself does not provide this method." +msgstr "" + +#: ../../reference/datamodel.rst:2226 +msgid "" +"Note that if the attribute is found through the normal " +"mechanism, :meth:`__getattr__` is not called. (This is an intentional " +"asymmetry between :meth:`__getattr__` and :meth:`__setattr__`.) This is done " +"both for efficiency reasons and because otherwise :meth:`__getattr__` would " +"have no way to access other attributes of the instance. Note that at least " +"for instance variables, you can take total control by not inserting any " +"values in the instance attribute dictionary (but instead inserting them in " +"another object). See the :meth:`__getattribute__` method below for a way to " "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:2241 +#: ../../reference/datamodel.rst:2239 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2602,90 +2608,90 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:2252 +#: ../../reference/datamodel.rst:2250 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions <builtin-functions>`. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:2257 ../../reference/datamodel.rst:2259 +#: ../../reference/datamodel.rst:2255 ../../reference/datamodel.rst:2257 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "<auditing>` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2266 +#: ../../reference/datamodel.rst:2264 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:2270 +#: ../../reference/datamodel.rst:2268 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " -"call the base class method with the same name, for example, ``object." -"__setattr__(self, name, value)``." +"call the base class method with the same name, for example, " +"``object.__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 +#: ../../reference/datamodel.rst:2272 ../../reference/datamodel.rst:2274 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "<auditing>` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2283 +#: ../../reference/datamodel.rst:2281 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2286 ../../reference/datamodel.rst:2288 +#: ../../reference/datamodel.rst:2284 ../../reference/datamodel.rst:2286 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "<auditing>` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2295 +#: ../../reference/datamodel.rst:2293 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2300 +#: ../../reference/datamodel.rst:2298 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2307 +#: ../../reference/datamodel.rst:2305 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " "level should accept one argument which is the name of an attribute and " "return the computed value or raise an :exc:`AttributeError`. If an attribute " -"is not found on a module object through the normal lookup, i.e. :meth:" -"`object.__getattribute__`, then ``__getattr__`` is searched in the module " -"``__dict__`` before raising an :exc:`AttributeError`. If found, it is called " -"with the attribute name and the result is returned." +"is not found on a module object through the normal lookup, " +"i.e. :meth:`object.__getattribute__`, then ``__getattr__`` is searched in " +"the module ``__dict__`` before raising an :exc:`AttributeError`. If found, " +"it is called with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2316 +#: ../../reference/datamodel.rst:2314 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2320 +#: ../../reference/datamodel.rst:2318 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2324 +#: ../../reference/datamodel.rst:2322 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2713,7 +2719,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2338 +#: ../../reference/datamodel.rst:2336 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2721,27 +2727,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2343 +#: ../../reference/datamodel.rst:2341 msgid "``__class__`` module attribute is now writable." msgstr "``__class__`` 模組屬性現在是可寫入的。" -#: ../../reference/datamodel.rst:2346 +#: ../../reference/datamodel.rst:2344 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "``__getattr__`` 和 ``__dir__`` 模組屬性。" -#: ../../reference/datamodel.rst:2351 +#: ../../reference/datamodel.rst:2349 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2352 +#: ../../reference/datamodel.rst:2350 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2358 +#: ../../reference/datamodel.rst:2356 msgid "Implementing Descriptors" msgstr "實作描述器" -#: ../../reference/datamodel.rst:2360 +#: ../../reference/datamodel.rst:2358 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2752,7 +2758,7 @@ msgid "" "does not implement any of these protocols." msgstr "" -#: ../../reference/datamodel.rst:2370 +#: ../../reference/datamodel.rst:2368 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2761,13 +2767,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2376 +#: ../../reference/datamodel.rst:2374 msgid "" -"This method should return the computed attribute value or raise an :exc:" -"`AttributeError` exception." +"This method should return the computed attribute value or raise " +"an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2379 +#: ../../reference/datamodel.rst:2377 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2777,31 +2783,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2388 +#: ../../reference/datamodel.rst:2386 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2391 +#: ../../reference/datamodel.rst:2389 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2397 +#: ../../reference/datamodel.rst:2395 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2399 +#: ../../reference/datamodel.rst:2397 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2402 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2812,20 +2818,20 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2415 +#: ../../reference/datamodel.rst:2413 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2417 +#: ../../reference/datamodel.rst:2415 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " -"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, and :meth:" -"`~object.__delete__`. If any of those methods are defined for an object, it " -"is said to be a descriptor." +"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"object, it is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2423 +#: ../../reference/datamodel.rst:2421 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2833,7 +2839,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2428 +#: ../../reference/datamodel.rst:2426 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2841,60 +2847,61 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2431 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2436 +#: ../../reference/datamodel.rst:2434 msgid "Direct Call" msgstr "直接呼叫" -#: ../../reference/datamodel.rst:2437 +#: ../../reference/datamodel.rst:2435 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2440 +#: ../../reference/datamodel.rst:2438 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2441 +#: ../../reference/datamodel.rst:2439 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2444 +#: ../../reference/datamodel.rst:2442 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2445 +#: ../../reference/datamodel.rst:2443 msgid "" -"If binding to a class, ``A.x`` is transformed into the call: ``A." -"__dict__['x'].__get__(None, A)``." +"If binding to a class, ``A.x`` is transformed into the call: " +"``A.__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2448 +#: ../../reference/datamodel.rst:2446 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2449 +#: ../../reference/datamodel.rst:2447 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " -"for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." -"__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." +"for a base class ``B`` following ``A`` and then returns " +"``B.__dict__['x'].__get__(a, A)``. If not a descriptor, ``x`` is returned " +"unchanged." msgstr "" -#: ../../reference/datamodel.rst:2486 +#: ../../reference/datamodel.rst:2484 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " -"combination of :meth:`~object.__get__`, :meth:`~object.__set__` and :meth:" -"`~object.__delete__`. If it does not define :meth:`!__get__`, then " -"accessing the attribute will return the descriptor object itself unless " +"combination of :meth:`~object.__get__`, :meth:`~object.__set__` " +"and :meth:`~object.__delete__`. If it does not define :meth:`!__get__`, " +"then accessing the attribute will return the descriptor object itself unless " "there is a value in the object's instance dictionary. If the descriptor " "defines :meth:`!__set__` and/or :meth:`!__delete__`, it is a data " "descriptor; if it defines neither, it is a non-data descriptor. Normally, " @@ -2906,7 +2913,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2501 +#: ../../reference/datamodel.rst:2499 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "<staticmethod>` and :func:`@classmethod <classmethod>`) are implemented as " @@ -2915,49 +2922,49 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2507 +#: ../../reference/datamodel.rst:2505 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2514 +#: ../../reference/datamodel.rst:2512 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2516 +#: ../../reference/datamodel.rst:2514 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2520 +#: ../../reference/datamodel.rst:2518 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2525 +#: ../../reference/datamodel.rst:2523 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " -"for the declared variables and prevents the automatic creation of :attr:" -"`~object.__dict__` and *__weakref__* for each instance." +"for the declared variables and prevents the automatic creation " +"of :attr:`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2534 +#: ../../reference/datamodel.rst:2532 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2536 +#: ../../reference/datamodel.rst:2534 msgid "" -"When inheriting from a class without *__slots__*, the :attr:`~object." -"__dict__` and *__weakref__* attribute of the instances will always be " -"accessible." +"When inheriting from a class without *__slots__*, " +"the :attr:`~object.__dict__` and *__weakref__* attribute of the instances " +"will always be accessible." msgstr "" -#: ../../reference/datamodel.rst:2540 +#: ../../reference/datamodel.rst:2538 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2966,7 +2973,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2547 +#: ../../reference/datamodel.rst:2545 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references <weakref>` to its " @@ -2974,7 +2981,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2551 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "<descriptors>` for each variable name. As a result, class attributes cannot " @@ -2982,7 +2989,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2559 +#: ../../reference/datamodel.rst:2557 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2991,7 +2998,7 @@ msgid "" "only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2565 +#: ../../reference/datamodel.rst:2563 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -3000,33 +3007,33 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2570 +#: ../../reference/datamodel.rst:2568 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " -"<PyTypeObject.tp_itemsize>` such as :class:`int`, :class:`bytes`, and :class:" -"`tuple`." +"<PyTypeObject.tp_itemsize>` such as :class:`int`, :class:`bytes`, " +"and :class:`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2575 +#: ../../reference/datamodel.rst:2573 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2577 +#: ../../reference/datamodel.rst:2575 msgid "" "If a :class:`dictionary <dict>` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " -"can be used to provide per-attribute docstrings that will be recognised by :" -"func:`inspect.getdoc` and displayed in the output of :func:`help`." +"can be used to provide per-attribute docstrings that will be recognised " +"by :func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2582 +#: ../../reference/datamodel.rst:2580 msgid "" ":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2585 +#: ../../reference/datamodel.rst:2583 msgid "" ":ref:`Multiple inheritance <tut-multiple>` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -3034,35 +3041,36 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2591 +#: ../../reference/datamodel.rst:2589 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2597 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2601 +#: ../../reference/datamodel.rst:2599 msgid "" -"Whenever a class inherits from another class, :meth:`~object." -"__init_subclass__` is called on the parent class. This way, it is possible " -"to write classes which change the behavior of subclasses. This is closely " -"related to class decorators, but where class decorators only affect the " -"specific class they're applied to, ``__init_subclass__`` solely applies to " -"future subclasses of the class defining the method." +"Whenever a class inherits from another " +"class, :meth:`~object.__init_subclass__` is called on the parent class. This " +"way, it is possible to write classes which change the behavior of " +"subclasses. This is closely related to class decorators, but where class " +"decorators only affect the specific class they're applied to, " +"``__init_subclass__`` solely applies to future subclasses of the class " +"defining the method." msgstr "" -#: ../../reference/datamodel.rst:2610 +#: ../../reference/datamodel.rst:2608 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2614 +#: ../../reference/datamodel.rst:2612 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -3070,7 +3078,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2620 +#: ../../reference/datamodel.rst:2618 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -3088,13 +3096,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2628 +#: ../../reference/datamodel.rst:2626 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2633 +#: ../../reference/datamodel.rst:2631 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -3102,19 +3110,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2641 +#: ../../reference/datamodel.rst:2639 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2646 +#: ../../reference/datamodel.rst:2644 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2649 +#: ../../reference/datamodel.rst:2647 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -3122,14 +3130,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2650 msgid "" -"If the class variable is assigned after the class is created, :meth:" -"`__set_name__` will not be called automatically. If needed, :meth:" -"`__set_name__` can be called directly::" +"If the class variable is assigned after the class is " +"created, :meth:`__set_name__` will not be called automatically. If " +"needed, :meth:`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2656 +#: ../../reference/datamodel.rst:2654 msgid "" "class A:\n" " pass\n" @@ -3139,22 +3147,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2663 +#: ../../reference/datamodel.rst:2661 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2671 +#: ../../reference/datamodel.rst:2669 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2678 +#: ../../reference/datamodel.rst:2676 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2682 +#: ../../reference/datamodel.rst:2680 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -3162,7 +3170,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2687 +#: ../../reference/datamodel.rst:2685 msgid "" "class Meta(type):\n" " pass\n" @@ -3182,105 +3190,105 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2696 +#: ../../reference/datamodel.rst:2694 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2699 +#: ../../reference/datamodel.rst:2697 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2701 +#: ../../reference/datamodel.rst:2699 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2702 +#: ../../reference/datamodel.rst:2700 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2703 +#: ../../reference/datamodel.rst:2701 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2704 +#: ../../reference/datamodel.rst:2702 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2705 +#: ../../reference/datamodel.rst:2703 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2709 +#: ../../reference/datamodel.rst:2707 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2713 +#: ../../reference/datamodel.rst:2711 msgid "" -"If a base that appears in a class definition is not an instance of :class:" -"`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " -"an :meth:`!__mro_entries__` method is found, the base is substituted with " -"the result of a call to :meth:`!__mro_entries__` when creating the class. " -"The method is called with the original bases tuple passed to the *bases* " -"parameter, and must return a tuple of classes that will be used instead of " -"the base. The returned tuple may be empty: in these cases, the original base " -"is ignored." +"If a base that appears in a class definition is not an instance " +"of :class:`type`, then an :meth:`!__mro_entries__` method is searched on the " +"base. If an :meth:`!__mro_entries__` method is found, the base is " +"substituted with the result of a call to :meth:`!__mro_entries__` when " +"creating the class. The method is called with the original bases tuple " +"passed to the *bases* parameter, and must return a tuple of classes that " +"will be used instead of the base. The returned tuple may be empty: in these " +"cases, the original base is ignored." msgstr "" -#: ../../reference/datamodel.rst:2724 +#: ../../reference/datamodel.rst:2722 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2725 +#: ../../reference/datamodel.rst:2723 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2727 +#: ../../reference/datamodel.rst:2725 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2728 +#: ../../reference/datamodel.rst:2726 msgid "" -"Retrieve a class's \"original bases\" prior to modifications by :meth:" -"`~object.__mro_entries__`." +"Retrieve a class's \"original bases\" prior to modifications " +"by :meth:`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2731 +#: ../../reference/datamodel.rst:2729 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2732 +#: ../../reference/datamodel.rst:2730 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2734 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2740 +#: ../../reference/datamodel.rst:2738 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2740 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2743 +#: ../../reference/datamodel.rst:2741 msgid "" -"if an explicit metaclass is given and it is *not* an instance of :func:" -"`type`, then it is used directly as the metaclass;" +"if an explicit metaclass is given and it is *not* an instance " +"of :func:`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2745 +#: ../../reference/datamodel.rst:2743 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2748 +#: ../../reference/datamodel.rst:2746 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -3289,11 +3297,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2758 +#: ../../reference/datamodel.rst:2756 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2763 +#: ../../reference/datamodel.rst:2761 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3305,25 +3313,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2772 +#: ../../reference/datamodel.rst:2770 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2777 +#: ../../reference/datamodel.rst:2775 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2778 +#: ../../reference/datamodel.rst:2776 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2782 +#: ../../reference/datamodel.rst:2780 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2787 +#: ../../reference/datamodel.rst:2785 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3332,7 +3340,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2793 +#: ../../reference/datamodel.rst:2791 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3341,11 +3349,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2802 +#: ../../reference/datamodel.rst:2800 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2809 +#: ../../reference/datamodel.rst:2807 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3353,18 +3361,18 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2814 +#: ../../reference/datamodel.rst:2812 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " "created by the compiler if any methods in a class body refer to either " -"``__class__`` or ``super``. This allows the zero argument form of :func:" -"`super` to correctly identify the class being defined based on lexical " -"scoping, while the class or instance that was used to make the current call " -"is identified based on the first argument passed to the method." +"``__class__`` or ``super``. This allows the zero argument form " +"of :func:`super` to correctly identify the class being defined based on " +"lexical scoping, while the class or instance that was used to make the " +"current call is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2822 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3373,39 +3381,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2830 +#: ../../reference/datamodel.rst:2828 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2834 +#: ../../reference/datamodel.rst:2832 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2836 +#: ../../reference/datamodel.rst:2834 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2838 +#: ../../reference/datamodel.rst:2836 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2839 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2843 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -3413,19 +3421,19 @@ msgid "" "becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2852 +#: ../../reference/datamodel.rst:2850 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2853 +#: ../../reference/datamodel.rst:2851 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2857 +#: ../../reference/datamodel.rst:2855 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2859 +#: ../../reference/datamodel.rst:2857 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3433,17 +3441,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2866 +#: ../../reference/datamodel.rst:2864 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2868 +#: ../../reference/datamodel.rst:2866 msgid "" -"The following methods are used to override the default behavior of the :func:" -"`isinstance` and :func:`issubclass` built-in functions." +"The following methods are used to override the default behavior of " +"the :func:`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2871 +#: ../../reference/datamodel.rst:2869 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3451,21 +3459,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2878 +#: ../../reference/datamodel.rst:2876 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2885 +#: ../../reference/datamodel.rst:2883 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2890 +#: ../../reference/datamodel.rst:2888 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3473,24 +3481,24 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2897 +#: ../../reference/datamodel.rst:2895 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2898 +#: ../../reference/datamodel.rst:2896 msgid "" -"Includes the specification for customizing :func:`isinstance` and :func:" -"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" -"`~type.__subclasscheck__`, with motivation for this functionality in the " -"context of adding Abstract Base Classes (see the :mod:`abc` module) to the " -"language." +"Includes the specification for customizing :func:`isinstance` " +"and :func:`issubclass` behavior through :meth:`~type.__instancecheck__` " +"and :meth:`~type.__subclasscheck__`, with motivation for this functionality " +"in the context of adding Abstract Base Classes (see the :mod:`abc` module) " +"to the language." msgstr "" -#: ../../reference/datamodel.rst:2906 +#: ../../reference/datamodel.rst:2904 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2908 +#: ../../reference/datamodel.rst:2906 msgid "" "When using :term:`type annotations<annotation>`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3498,74 +3506,75 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2915 +#: ../../reference/datamodel.rst:2913 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" -#: ../../reference/datamodel.rst:2916 +#: ../../reference/datamodel.rst:2914 msgid "Introducing Python's framework for type annotations" -msgstr "" +msgstr "引入 Python 的型別註釋框架" -#: ../../reference/datamodel.rst:2918 +#: ../../reference/datamodel.rst:2916 msgid ":ref:`Generic Alias Types<types-genericalias>`" msgstr ":ref:`泛型別名型別 <types-genericalias>`" -#: ../../reference/datamodel.rst:2919 +#: ../../reference/datamodel.rst:2917 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2921 +#: ../../reference/datamodel.rst:2919 msgid "" -":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` and :" -"class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` " +"and :class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2922 +#: ../../reference/datamodel.rst:2920 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2925 +#: ../../reference/datamodel.rst:2923 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2930 +#: ../../reference/datamodel.rst:2928 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2933 +#: ../../reference/datamodel.rst:2931 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " -"method. As such, there is no need for it to be decorated with :func:" -"`@classmethod<classmethod>` when it is defined." +"method. As such, there is no need for it to be decorated " +"with :func:`@classmethod<classmethod>` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:2937 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2941 +#: ../../reference/datamodel.rst:2939 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints<type hint>` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2945 +#: ../../reference/datamodel.rst:2943 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " -"standard library class that already implements :meth:`~object." -"__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " -"own implementation of ``__class_getitem__()``." +"standard library class that already " +"implements :meth:`~object.__class_getitem__`, or inherit " +"from :class:`typing.Generic`, which has its own implementation of " +"``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2951 +#: ../../reference/datamodel.rst:2949 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3573,11 +3582,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2961 +#: ../../reference/datamodel.rst:2959 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2963 +#: ../../reference/datamodel.rst:2961 msgid "" "Usually, the :ref:`subscription<subscriptions>` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3587,14 +3596,15 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2970 +#: ../../reference/datamodel.rst:2968 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " -"follows something like the following process to decide whether :meth:" -"`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" +"follows something like the following process to decide " +"whether :meth:`~object.__getitem__` or :meth:`~object.__class_getitem__` " +"should be called::" msgstr "" -#: ../../reference/datamodel.rst:2975 +#: ../../reference/datamodel.rst:2973 msgid "" "from inspect import isclass\n" "\n" @@ -3620,17 +3630,17 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2998 +#: ../../reference/datamodel.rst:2996 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " -"the :class:`type` class as their metaclass. :class:`type` does not define :" -"meth:`~object.__getitem__`, meaning that expressions such as ``list[int]``, " -"``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." -"__class_getitem__` being called::" +"the :class:`type` class as their metaclass. :class:`type` does not " +"define :meth:`~object.__getitem__`, meaning that expressions such as " +"``list[int]``, ``dict[str, float]`` and ``tuple[str, bytes]`` all result " +"in :meth:`~object.__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:3005 +#: ../../reference/datamodel.rst:3003 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3645,14 +3655,15 @@ msgid "" "<class 'types.GenericAlias'>" msgstr "" -#: ../../reference/datamodel.rst:3017 +#: ../../reference/datamodel.rst:3015 msgid "" -"However, if a class has a custom metaclass that defines :meth:`~object." -"__getitem__`, subscribing the class may result in different behaviour. An " -"example of this can be found in the :mod:`enum` module::" +"However, if a class has a custom metaclass that " +"defines :meth:`~object.__getitem__`, subscribing the class may result in " +"different behaviour. An example of this can be found in the :mod:`enum` " +"module::" msgstr "" -#: ../../reference/datamodel.rst:3021 +#: ../../reference/datamodel.rst:3019 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3672,70 +3683,70 @@ msgid "" "<enum 'Menu'>" msgstr "" -#: ../../reference/datamodel.rst:3040 +#: ../../reference/datamodel.rst:3038 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:3041 +#: ../../reference/datamodel.rst:3039 msgid "" -"Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" -"`subscription<subscriptions>` results in ``__class_getitem__()`` being " -"called instead of :meth:`~object.__getitem__`" +"Introducing :meth:`~object.__class_getitem__`, and outlining when " +"a :ref:`subscription<subscriptions>` results in ``__class_getitem__()`` " +"being called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:3049 +#: ../../reference/datamodel.rst:3047 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:3056 +#: ../../reference/datamodel.rst:3054 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``. The :class:`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3064 +#: ../../reference/datamodel.rst:3062 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:3066 +#: ../../reference/datamodel.rst:3064 msgid "" "The following methods can be defined to implement container objects. None of " "them are provided by the :class:`object` class itself. Containers usually " -"are :term:`sequences <sequence>` (such as :class:`lists <list>` or :class:" -"`tuples <tuple>`) or :term:`mappings <mapping>` (like :term:`dictionaries " -"<dictionary>`), but can represent other containers as well. The first set " -"of methods is used either to emulate a sequence or to emulate a mapping; the " -"difference is that for a sequence, the allowable keys should be the integers " -"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" -"class:`slice` objects, which define a range of items. It is also " -"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" -"values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" -"meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " -"similar to those for Python's standard :class:`dictionary <dict>` objects. " -"The :mod:`collections.abc` module provides a :class:`~collections.abc." -"MutableMapping` :term:`abstract base class` to help create those methods " -"from a base set of :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. Mutable " -"sequences should provide methods :meth:`!append`, :meth:`!count`, :meth:`!" -"index`, :meth:`!extend`, :meth:`!insert`, :meth:`!pop`, :meth:`!remove`, :" -"meth:`!reverse` and :meth:`!sort`, like Python standard :class:`list` " -"objects. Finally, sequence types should implement addition (meaning " -"concatenation) and multiplication (meaning repetition) by defining the " -"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object." -"__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:" -"`~object.__imul__` described below; they should not define other numerical " -"operators. It is recommended that both mappings and sequences implement " -"the :meth:`~object.__contains__` method to allow efficient use of the ``in`` " -"operator; for mappings, ``in`` should search the mapping's keys; for " -"sequences, it should search through the values. It is further recommended " -"that both mappings and sequences implement the :meth:`~object.__iter__` " -"method to allow efficient iteration through the container; for mappings, :" -"meth:`!__iter__` should iterate through the object's keys; for sequences, it " -"should iterate through the values." -msgstr "" - -#: ../../reference/datamodel.rst:3108 +"are :term:`sequences <sequence>` (such as :class:`lists <list>` " +"or :class:`tuples <tuple>`) or :term:`mappings <mapping>` " +"(like :term:`dictionaries <dictionary>`), but can represent other containers " +"as well. The first set of methods is used either to emulate a sequence or " +"to emulate a mapping; the difference is that for a sequence, the allowable " +"keys should be the integers *k* for which ``0 <= k < N`` where *N* is the " +"length of the sequence, or :class:`slice` objects, which define a range of " +"items. It is also recommended that mappings provide the methods :meth:`!" +"keys`, :meth:`!values`, :meth:`!items`, :meth:`!get`, :meth:`!" +"clear`, :meth:`!setdefault`, :meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, " +"and :meth:`!update` behaving similar to those for Python's " +"standard :class:`dictionary <dict>` objects. The :mod:`collections.abc` " +"module provides a :class:`~collections.abc.MutableMapping` :term:`abstract " +"base class` to help create those methods from a base set " +"of :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. Mutable sequences should provide methods :meth:`!" +"append`, :meth:`!count`, :meth:`!index`, :meth:`!extend`, :meth:`!" +"insert`, :meth:`!pop`, :meth:`!remove`, :meth:`!reverse` and :meth:`!sort`, " +"like Python standard :class:`list` objects. Finally, sequence types should " +"implement addition (meaning concatenation) and multiplication (meaning " +"repetition) by defining the " +"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` " +"and :meth:`~object.__imul__` described below; they should not define other " +"numerical operators. It is recommended that both mappings and sequences " +"implement the :meth:`~object.__contains__` method to allow efficient use of " +"the ``in`` operator; for mappings, ``in`` should search the mapping's keys; " +"for sequences, it should search through the values. It is further " +"recommended that both mappings and sequences implement " +"the :meth:`~object.__iter__` method to allow efficient iteration through the " +"container; for mappings, :meth:`!__iter__` should iterate through the " +"object's keys; for sequences, it should iterate through the values." +msgstr "" + +#: ../../reference/datamodel.rst:3106 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3743,96 +3754,97 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:3115 +#: ../../reference/datamodel.rst:3113 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " -"length is larger than :data:`!sys.maxsize` some features (such as :func:" -"`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" -"OverflowError` by truth value testing, an object must define a :meth:" -"`~object.__bool__` method." +"length is larger than :data:`!sys.maxsize` some features (such " +"as :func:`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" +"OverflowError` by truth value testing, an object must define " +"a :meth:`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3122 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " -"The length must be an integer ``>=`` 0. The return value may also be :data:" -"`NotImplemented`, which is treated the same as if the ``__length_hint__`` " -"method didn't exist at all. This method is purely an optimization and is " -"never required for correctness." +"The length must be an integer ``>=`` 0. The return value may also " +"be :data:`NotImplemented`, which is treated the same as if the " +"``__length_hint__`` method didn't exist at all. This method is purely an " +"optimization and is never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:3138 +#: ../../reference/datamodel.rst:3136 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:3140 +#: ../../reference/datamodel.rst:3138 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:3142 +#: ../../reference/datamodel.rst:3140 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:3144 +#: ../../reference/datamodel.rst:3142 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:3146 +#: ../../reference/datamodel.rst:3144 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:3151 +#: ../../reference/datamodel.rst:3149 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " -"the accepted keys should be integers. Optionally, they may support :class:" -"`slice` objects as well. Negative index support is also optional. If *key* " -"is of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a " -"value outside the set of indexes for the sequence (after any special " -"interpretation of negative values), :exc:`IndexError` should be raised. For :" -"term:`mapping` types, if *key* is missing (not in the container), :exc:" -"`KeyError` should be raised." +"the accepted keys should be integers. Optionally, they may " +"support :class:`slice` objects as well. Negative index support is also " +"optional. If *key* is of an inappropriate type, :exc:`TypeError` may be " +"raised; if *key* is a value outside the set of indexes for the sequence " +"(after any special interpretation of negative values), :exc:`IndexError` " +"should be raised. For :term:`mapping` types, if *key* is missing (not in the " +"container), :exc:`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:3161 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:3168 +#: ../../reference/datamodel.rst:3166 msgid "" -"When :ref:`subscripting<subscriptions>` a *class*, the special class method :" -"meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " -"See :ref:`classgetitem-versus-getitem` for more details." +"When :ref:`subscripting<subscriptions>` a *class*, the special class " +"method :meth:`~object.__class_getitem__` may be called instead of " +"``__getitem__()``. See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:3176 +#: ../../reference/datamodel.rst:3174 msgid "" -"Called to implement assignment to ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support changes to the values for keys, or if new keys can be added, or for " -"sequences if elements can be replaced. The same exceptions should be raised " -"for improper *key* values as for the :meth:`__getitem__` method." +"Called to implement assignment to ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support changes to the values for keys, or if new keys can be " +"added, or for sequences if elements can be replaced. The same exceptions " +"should be raised for improper *key* values as for the :meth:`__getitem__` " +"method." msgstr "" -#: ../../reference/datamodel.rst:3185 +#: ../../reference/datamodel.rst:3183 msgid "" -"Called to implement deletion of ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support removal of keys, or for sequences if elements can be removed from " -"the sequence. The same exceptions should be raised for improper *key* " -"values as for the :meth:`__getitem__` method." +"Called to implement deletion of ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support removal of keys, or for sequences if elements can be " +"removed from the sequence. The same exceptions should be raised for " +"improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3194 +#: ../../reference/datamodel.rst:3192 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:3200 +#: ../../reference/datamodel.rst:3198 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3840,23 +3852,23 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:3208 +#: ../../reference/datamodel.rst:3206 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:3212 +#: ../../reference/datamodel.rst:3210 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " -"built-in will fall back to using the sequence protocol (:meth:`__len__` and :" -"meth:`__getitem__`). Objects that support the sequence protocol should only " -"provide :meth:`__reversed__` if they can provide an implementation that is " -"more efficient than the one provided by :func:`reversed`." +"built-in will fall back to using the sequence protocol (:meth:`__len__` " +"and :meth:`__getitem__`). Objects that support the sequence protocol should " +"only provide :meth:`__reversed__` if they can provide an implementation that " +"is more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:3219 +#: ../../reference/datamodel.rst:3217 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3864,14 +3876,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:3226 +#: ../../reference/datamodel.rst:3224 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3228 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3879,11 +3891,11 @@ msgid "" "reference <membership-test-details>`." msgstr "" -#: ../../reference/datamodel.rst:3239 +#: ../../reference/datamodel.rst:3237 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:3241 +#: ../../reference/datamodel.rst:3239 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3891,46 +3903,46 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:3267 +#: ../../reference/datamodel.rst:3265 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For instance, to " -"evaluate the expression ``x + y``, where *x* is an instance of a class that " -"has an :meth:`__add__` method, ``type(x).__add__(x, y)`` is called. The :" -"meth:`__divmod__` method should be the equivalent to using :meth:" -"`__floordiv__` and :meth:`__mod__`; it should not be related to :meth:" -"`__truediv__`. Note that :meth:`__pow__` should be defined to accept an " -"optional third argument if the ternary version of the built-in :func:`pow` " -"function is to be supported." +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " +"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``). For instance, to evaluate the expression ``x + y``, where *x* is an " +"instance of a class that has an :meth:`__add__` method, ``type(x).__add__(x, " +"y)`` is called. The :meth:`__divmod__` method should be the equivalent to " +"using :meth:`__floordiv__` and :meth:`__mod__`; it should not be related " +"to :meth:`__truediv__`. Note that :meth:`__pow__` should be defined to " +"accept an optional third argument if the ternary version of the built-" +"in :func:`pow` function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3278 +#: ../../reference/datamodel.rst:3276 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3301 +#: ../../reference/datamodel.rst:3299 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with reflected (swapped) " -"operands. These functions are only called if the left operand does not " -"support the corresponding operation [#]_ and the operands are of different " -"types. [#]_ For instance, to evaluate the expression ``x - y``, where *y* is " -"an instance of a class that has an :meth:`__rsub__` method, ``type(y)." -"__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` returns :data:" -"`NotImplemented`." +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " +"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``) with reflected (swapped) operands. These functions are only called if " +"the left operand does not support the corresponding operation [#]_ and the " +"operands are of different types. [#]_ For instance, to evaluate the " +"expression ``x - y``, where *y* is an instance of a class that has " +"an :meth:`__rsub__` method, ``type(y).__rsub__(y, x)`` is called if " +"``type(x).__sub__(x, y)`` returns :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3313 +#: ../../reference/datamodel.rst:3311 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3318 +#: ../../reference/datamodel.rst:3316 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3939,7 +3951,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3339 +#: ../../reference/datamodel.rst:3337 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3948,28 +3960,28 @@ msgid "" "but does not have to be, *self*). If a specific method is not defined, or " "if that method returns :data:`NotImplemented`, the augmented assignment " "falls back to the normal methods. For instance, if *x* is an instance of a " -"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = x." -"__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if ``x.__iadd__(y)`` " -"returns :data:`!NotImplemented`, ``x.__add__(y)`` and ``y.__radd__(x)`` are " -"considered, as with the evaluation of ``x + y``. In certain situations, " -"augmented assignment can result in unexpected errors (see :ref:`faq-" -"augmented-assignment-tuple-error`), but this behavior is in fact part of the " -"data model." +"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = " +"x.__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if " +"``x.__iadd__(y)`` returns :data:`!NotImplemented`, ``x.__add__(y)`` and " +"``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. In " +"certain situations, augmented assignment can result in unexpected errors " +"(see :ref:`faq-augmented-assignment-tuple-error`), but this behavior is in " +"fact part of the data model." msgstr "" -#: ../../reference/datamodel.rst:3362 +#: ../../reference/datamodel.rst:3360 msgid "" -"Called to implement the unary arithmetic operations (``-``, ``+``, :func:" -"`abs` and ``~``)." +"Called to implement the unary arithmetic operations (``-``, " +"``+``, :func:`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3375 +#: ../../reference/datamodel.rst:3373 msgid "" -"Called to implement the built-in functions :func:`complex`, :func:`int` and :" -"func:`float`. Should return a value of the appropriate type." +"Called to implement the built-in functions :func:`complex`, :func:`int` " +"and :func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3382 +#: ../../reference/datamodel.rst:3380 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3978,14 +3990,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3388 +#: ../../reference/datamodel.rst:3386 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3400 +#: ../../reference/datamodel.rst:3398 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3994,21 +4006,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3406 +#: ../../reference/datamodel.rst:3404 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3409 +#: ../../reference/datamodel.rst:3407 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3416 +#: ../../reference/datamodel.rst:3414 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3418 +#: ../../reference/datamodel.rst:3416 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -4018,34 +4030,34 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3429 +#: ../../reference/datamodel.rst:3427 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3432 +#: ../../reference/datamodel.rst:3430 msgid "" "For more information on context managers, see :ref:`typecontextmanager`. " "The :class:`object` class itself does not provide the context manager " "methods." msgstr "" -#: ../../reference/datamodel.rst:3438 +#: ../../reference/datamodel.rst:3436 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3445 +#: ../../reference/datamodel.rst:3443 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3449 +#: ../../reference/datamodel.rst:3447 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -4053,27 +4065,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3453 +#: ../../reference/datamodel.rst:3451 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3459 +#: ../../reference/datamodel.rst:3457 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3460 +#: ../../reference/datamodel.rst:3458 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3467 +#: ../../reference/datamodel.rst:3465 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3469 +#: ../../reference/datamodel.rst:3467 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -4081,7 +4093,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3476 +#: ../../reference/datamodel.rst:3474 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -4090,29 +4102,29 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3482 +#: ../../reference/datamodel.rst:3480 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " "MyClass(left=x, center=y)``. Note that the number of arguments in the " "pattern must be smaller than or equal to the number of elements in " -"*__match_args__*; if it is larger, the pattern match attempt will raise a :" -"exc:`TypeError`." +"*__match_args__*; if it is larger, the pattern match attempt will raise " +"a :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3492 +#: ../../reference/datamodel.rst:3490 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3493 +#: ../../reference/datamodel.rst:3491 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3499 +#: ../../reference/datamodel.rst:3497 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3501 +#: ../../reference/datamodel.rst:3499 msgid "" "The :ref:`buffer protocol <bufferobjects>` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -4120,53 +4132,54 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3506 +#: ../../reference/datamodel.rst:3504 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3511 +#: ../../reference/datamodel.rst:3509 msgid "" -"Called when a buffer is requested from *self* (for example, by the :class:" -"`memoryview` constructor). The *flags* argument is an integer representing " -"the kind of buffer requested, affecting for example whether the returned " -"buffer is read-only or writable. :class:`inspect.BufferFlags` provides a " -"convenient way to interpret the flags. The method must return a :class:" -"`memoryview` object." +"Called when a buffer is requested from *self* (for example, by " +"the :class:`memoryview` constructor). The *flags* argument is an integer " +"representing the kind of buffer requested, affecting for example whether the " +"returned buffer is read-only or writable. :class:`inspect.BufferFlags` " +"provides a convenient way to interpret the flags. The method must return " +"a :class:`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3520 +#: ../../reference/datamodel.rst:3518 msgid "" -"Called when a buffer is no longer needed. The *buffer* argument is a :class:" -"`memoryview` object that was previously returned by :meth:`~object." -"__buffer__`. The method must release any resources associated with the " -"buffer. This method should return ``None``. Buffer objects that do not need " -"to perform any cleanup are not required to implement this method." +"Called when a buffer is no longer needed. The *buffer* argument is " +"a :class:`memoryview` object that was previously returned " +"by :meth:`~object.__buffer__`. The method must release any resources " +"associated with the buffer. This method should return ``None``. Buffer " +"objects that do not need to perform any cleanup are not required to " +"implement this method." msgstr "" -#: ../../reference/datamodel.rst:3531 +#: ../../reference/datamodel.rst:3529 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3532 +#: ../../reference/datamodel.rst:3530 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3534 +#: ../../reference/datamodel.rst:3532 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3535 +#: ../../reference/datamodel.rst:3533 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3540 +#: ../../reference/datamodel.rst:3538 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3542 +#: ../../reference/datamodel.rst:3540 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -4174,7 +4187,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3547 +#: ../../reference/datamodel.rst:3545 msgid "" ">>> class C:\n" "... pass\n" @@ -4196,7 +4209,7 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3557 +#: ../../reference/datamodel.rst:3555 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -4205,7 +4218,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3564 +#: ../../reference/datamodel.rst:3562 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4221,14 +4234,14 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3571 +#: ../../reference/datamodel.rst:3569 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3575 +#: ../../reference/datamodel.rst:3573 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -4240,14 +4253,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3580 +#: ../../reference/datamodel.rst:3578 msgid "" "In addition to bypassing any instance attributes in the interest of " -"correctness, implicit special method lookup generally also bypasses the :" -"meth:`~object.__getattribute__` method even of the object's metaclass::" +"correctness, implicit special method lookup generally also bypasses " +"the :meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3584 +#: ../../reference/datamodel.rst:3582 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -4272,7 +4285,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3606 +#: ../../reference/datamodel.rst:3604 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -4281,103 +4294,106 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3617 +#: ../../reference/datamodel.rst:3615 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3621 +#: ../../reference/datamodel.rst:3619 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3623 +#: ../../reference/datamodel.rst:3621 msgid "" -"An :term:`awaitable` object generally implements an :meth:`~object." -"__await__` method. :term:`Coroutine objects <coroutine>` returned from :" -"keyword:`async def` functions are awaitable." +"An :term:`awaitable` object generally implements " +"an :meth:`~object.__await__` method. :term:`Coroutine objects <coroutine>` " +"returned from :keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3629 +#: ../../reference/datamodel.rst:3627 msgid "" "The :term:`generator iterator` objects returned from generators decorated " -"with :func:`types.coroutine` are also awaitable, but they do not implement :" -"meth:`~object.__await__`." +"with :func:`types.coroutine` are also awaitable, but they do not " +"implement :meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3635 +#: ../../reference/datamodel.rst:3633 msgid "" -"Must return an :term:`iterator`. Should be used to implement :term:" -"`awaitable` objects. For instance, :class:`asyncio.Future` implements this " -"method to be compatible with the :keyword:`await` expression. The :class:" -"`object` class itself is not awaitable and does not provide this method." +"Must return an :term:`iterator`. Should be used to " +"implement :term:`awaitable` objects. For instance, :class:`asyncio.Future` " +"implements this method to be compatible with the :keyword:`await` " +"expression. The :class:`object` class itself is not awaitable and does not " +"provide this method." msgstr "" -#: ../../reference/datamodel.rst:3643 +#: ../../reference/datamodel.rst:3641 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " -"specific to the implementation of the asynchronous execution framework (e." -"g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." +"specific to the implementation of the asynchronous execution framework " +"(e.g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3651 +#: ../../reference/datamodel.rst:3649 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3657 +#: ../../reference/datamodel.rst:3655 msgid "Coroutine Objects" msgstr "協程物件" -#: ../../reference/datamodel.rst:3659 +#: ../../reference/datamodel.rst:3657 msgid "" ":term:`Coroutine objects <coroutine>` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " "and iterating over the result. When the coroutine has finished executing " -"and returns, the iterator raises :exc:`StopIteration`, and the exception's :" -"attr:`~StopIteration.value` attribute holds the return value. If the " -"coroutine raises an exception, it is propagated by the iterator. Coroutines " -"should not directly raise unhandled :exc:`StopIteration` exceptions." +"and returns, the iterator raises :exc:`StopIteration`, and the " +"exception's :attr:`~StopIteration.value` attribute holds the return value. " +"If the coroutine raises an exception, it is propagated by the iterator. " +"Coroutines should not directly raise unhandled :exc:`StopIteration` " +"exceptions." msgstr "" -#: ../../reference/datamodel.rst:3667 +#: ../../reference/datamodel.rst:3665 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3671 +#: ../../reference/datamodel.rst:3669 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3677 +#: ../../reference/datamodel.rst:3675 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " -"is equivalent to advancing the iterator returned by :meth:`~object." -"__await__`. If *value* is not ``None``, this method delegates to the :meth:" -"`~generator.send` method of the iterator that caused the coroutine to " -"suspend. The result (return value, :exc:`StopIteration`, or other " -"exception) is the same as when iterating over the :meth:`!__await__` return " -"value, described above." +"is equivalent to advancing the iterator returned " +"by :meth:`~object.__await__`. If *value* is not ``None``, this method " +"delegates to the :meth:`~generator.send` method of the iterator that caused " +"the coroutine to suspend. The result (return value, :exc:`StopIteration`, " +"or other exception) is the same as when iterating over the :meth:`!" +"__await__` return value, described above." msgstr "" -#: ../../reference/datamodel.rst:3688 +#: ../../reference/datamodel.rst:3686 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " "coroutine to suspend, if it has such a method. Otherwise, the exception is " -"raised at the suspension point. The result (return value, :exc:" -"`StopIteration`, or other exception) is the same as when iterating over the :" -"meth:`~object.__await__` return value, described above. If the exception is " -"not caught in the coroutine, it propagates back to the caller." +"raised at the suspension point. The result (return " +"value, :exc:`StopIteration`, or other exception) is the same as when " +"iterating over the :meth:`~object.__await__` return value, described above. " +"If the exception is not caught in the coroutine, it propagates back to the " +"caller." msgstr "" -#: ../../reference/datamodel.rst:3699 +#: ../../reference/datamodel.rst:3697 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3704 +#: ../../reference/datamodel.rst:3702 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4387,46 +4403,46 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3712 +#: ../../reference/datamodel.rst:3710 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3718 +#: ../../reference/datamodel.rst:3716 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3720 +#: ../../reference/datamodel.rst:3718 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3723 +#: ../../reference/datamodel.rst:3721 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3725 ../../reference/datamodel.rst:3774 +#: ../../reference/datamodel.rst:3723 ../../reference/datamodel.rst:3772 msgid "The :class:`object` class itself does not provide these methods." msgstr "" -#: ../../reference/datamodel.rst:3730 +#: ../../reference/datamodel.rst:3728 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3734 +#: ../../reference/datamodel.rst:3732 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3737 +#: ../../reference/datamodel.rst:3735 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3739 +#: ../../reference/datamodel.rst:3737 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4454,53 +4470,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3754 +#: ../../reference/datamodel.rst:3752 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator <asynchronous " "iterator>`." msgstr "" -#: ../../reference/datamodel.rst:3759 +#: ../../reference/datamodel.rst:3757 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " -"asynchronous iterator object. Returning anything else will result in a :exc:" -"`TypeError` error." +"asynchronous iterator object. Returning anything else will result in " +"a :exc:`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3767 +#: ../../reference/datamodel.rst:3765 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3769 +#: ../../reference/datamodel.rst:3767 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3772 +#: ../../reference/datamodel.rst:3770 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3778 +#: ../../reference/datamodel.rst:3776 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3783 +#: ../../reference/datamodel.rst:3781 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3786 +#: ../../reference/datamodel.rst:3784 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3788 +#: ../../reference/datamodel.rst:3786 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4516,27 +4532,26 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3799 +#: ../../reference/datamodel.rst:3797 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3800 +#: ../../reference/datamodel.rst:3798 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3804 +#: ../../reference/datamodel.rst:3802 msgid "" -"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." -"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." -"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " -"handling for this. Others will still raise a :exc:`TypeError`, but may do so " -"by relying on the behavior that ``None`` is not callable." +"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object.__reversed__`, :meth:`~object.__contains__`, :meth:`~object.__class_getitem__` " +"and :meth:`~os.PathLike.__fspath__` methods have special handling for this. " +"Others will still raise a :exc:`TypeError`, but may do so by relying on the " +"behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3811 +#: ../../reference/datamodel.rst:3809 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4544,7 +4559,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3817 +#: ../../reference/datamodel.rst:3815 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4566,8 +4581,8 @@ msgstr "" #: ../../reference/datamodel.rst:859 ../../reference/datamodel.rst:1126 #: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1292 #: ../../reference/datamodel.rst:1364 ../../reference/datamodel.rst:1472 -#: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:1691 -#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:3134 +#: ../../reference/datamodel.rst:1579 ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:2114 ../../reference/datamodel.rst:3132 msgid "object" msgstr "object(物件)" @@ -4578,13 +4593,13 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:296 #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 #: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 -#: ../../reference/datamodel.rst:1321 ../../reference/datamodel.rst:1774 -#: ../../reference/datamodel.rst:2017 ../../reference/datamodel.rst:2023 -#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:2673 -#: ../../reference/datamodel.rst:3104 ../../reference/datamodel.rst:3262 -#: ../../reference/datamodel.rst:3297 ../../reference/datamodel.rst:3311 -#: ../../reference/datamodel.rst:3360 ../../reference/datamodel.rst:3370 -#: ../../reference/datamodel.rst:3398 +#: ../../reference/datamodel.rst:1321 ../../reference/datamodel.rst:1772 +#: ../../reference/datamodel.rst:2015 ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2114 ../../reference/datamodel.rst:2671 +#: ../../reference/datamodel.rst:3102 ../../reference/datamodel.rst:3260 +#: ../../reference/datamodel.rst:3295 ../../reference/datamodel.rst:3309 +#: ../../reference/datamodel.rst:3358 ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3396 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4593,7 +4608,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "type" msgstr "type(型別)" @@ -4717,12 +4732,12 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3368 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3102 msgid "len" msgstr "len" @@ -4755,8 +4770,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1992 -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1990 +#: ../../reference/datamodel.rst:2021 msgid "string" msgstr "string(字串)" @@ -4792,7 +4807,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2017 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2015 msgid "bytes" msgstr "bytes(位元組)" @@ -4814,8 +4829,8 @@ msgid "assignment" msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:859 -#: ../../reference/datamodel.rst:1728 ../../reference/datamodel.rst:1910 -#: ../../reference/datamodel.rst:3425 +#: ../../reference/datamodel.rst:1726 ../../reference/datamodel.rst:1908 +#: ../../reference/datamodel.rst:3423 msgid "statement" msgstr "statement(陳述式)" @@ -4852,7 +4867,7 @@ msgid "mapping" msgstr "mapping(對映)" #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2114 msgid "dictionary" msgstr "dictionary(字典)" @@ -4875,13 +4890,13 @@ msgid "function" msgstr "function (函式)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3054 +#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3052 msgid "call" msgstr "call(呼叫)" #: ../../reference/datamodel.rst:519 msgid "invocation" -msgstr "invocation(調用)" +msgstr "invocation(呼叫)" #: ../../reference/datamodel.rst:519 msgid "argument" @@ -4983,7 +4998,7 @@ msgstr "generator(產生器)" msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3613 +#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3611 msgid "coroutine" msgstr "coroutine(協程)" @@ -5048,8 +5063,8 @@ msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1144 -#: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1893 -#: ../../reference/datamodel.rst:2784 +#: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1891 +#: ../../reference/datamodel.rst:2782 msgid "class" msgstr "class(類別)" @@ -5059,7 +5074,7 @@ msgid "class instance" msgstr "class instance(類別實例)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1265 -#: ../../reference/datamodel.rst:3054 +#: ../../reference/datamodel.rst:3052 msgid "instance" msgstr "instance(實例)" @@ -5243,291 +5258,291 @@ msgstr "co_freevars (程式碼物件屬性)" msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1490 +#: ../../reference/datamodel.rst:1488 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1581 +#: ../../reference/datamodel.rst:1579 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1758 +#: ../../reference/datamodel.rst:1756 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1774 ../../reference/datamodel.rst:3134 +#: ../../reference/datamodel.rst:1772 ../../reference/datamodel.rst:3132 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1780 +#: ../../reference/datamodel.rst:1778 msgid "start (slice object attribute)" msgstr "start (slice 物件屬性)" -#: ../../reference/datamodel.rst:1780 +#: ../../reference/datamodel.rst:1778 msgid "stop (slice object attribute)" msgstr "stop (slice 物件屬性)" -#: ../../reference/datamodel.rst:1780 +#: ../../reference/datamodel.rst:1778 msgid "step (slice object attribute)" msgstr "step (slice 物件屬性)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1826 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1826 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1826 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1864 +#: ../../reference/datamodel.rst:1862 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1864 +#: ../../reference/datamodel.rst:1862 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1893 +#: ../../reference/datamodel.rst:1891 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1910 +#: ../../reference/datamodel.rst:1908 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1910 +#: ../../reference/datamodel.rst:1908 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1910 +#: ../../reference/datamodel.rst:1908 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1974 +#: ../../reference/datamodel.rst:1972 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1974 +#: ../../reference/datamodel.rst:1972 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:1990 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:1990 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:1990 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2021 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2021 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2021 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:2065 +#: ../../reference/datamodel.rst:2063 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2114 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:2197 +#: ../../reference/datamodel.rst:2195 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2300 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2300 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2300 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2737 +#: ../../reference/datamodel.rst:2735 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2760 +#: ../../reference/datamodel.rst:2758 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2784 +#: ../../reference/datamodel.rst:2782 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2804 +#: ../../reference/datamodel.rst:2802 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2804 +#: ../../reference/datamodel.rst:2802 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:3102 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3260 ../../reference/datamodel.rst:3295 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 -#: ../../reference/datamodel.rst:3311 +#: ../../reference/datamodel.rst:3260 ../../reference/datamodel.rst:3295 +#: ../../reference/datamodel.rst:3309 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3360 +#: ../../reference/datamodel.rst:3358 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:3368 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:3368 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3398 +#: ../../reference/datamodel.rst:3396 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3425 +#: ../../reference/datamodel.rst:3423 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3425 +#: ../../reference/datamodel.rst:3423 msgid "context manager" msgstr "context manager(情境管理器)" diff --git a/reference/expressions.po b/reference/expressions.po index 32ca7edb29..5a0217870b 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,16 +90,16 @@ msgstr "" #: ../../reference/expressions.rst:70 msgid "" -"An identifier occurring as an atom is a name. See section :ref:" -"`identifiers` for lexical definition and section :ref:`naming` for " -"documentation of naming and binding." +"An identifier occurring as an atom is a name. See " +"section :ref:`identifiers` for lexical definition and section :ref:`naming` " +"for documentation of naming and binding." msgstr "" #: ../../reference/expressions.rst:76 msgid "" "When the name is bound to an object, evaluation of the atom yields that " -"object. When a name is not bound, an attempt to evaluate it raises a :exc:" -"`NameError` exception." +"object. When a name is not bound, an attempt to evaluate it raises " +"a :exc:`NameError` exception." msgstr "" #: ../../reference/expressions.rst:87 @@ -245,8 +245,8 @@ msgstr "" #: ../../reference/expressions.rst:203 msgid "" -"they are computed via a set of looping and filtering instructions, called a :" -"dfn:`comprehension`." +"they are computed via a set of looping and filtering instructions, called " +"a :dfn:`comprehension`." msgstr "" #: ../../reference/expressions.rst:211 @@ -255,9 +255,9 @@ msgstr "" #: ../../reference/expressions.rst:219 msgid "" -"The comprehension consists of a single expression followed by at least one :" -"keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!if` " -"clauses. In this case, the elements of the new container are those that " +"The comprehension consists of a single expression followed by at least " +"one :keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!" +"if` clauses. In this case, the elements of the new container are those that " "would be produced by considering each of the :keyword:`!for` or :keyword:`!" "if` clauses a block, nesting from left to right, and evaluating the " "expression to produce an element each time the innermost block is reached." @@ -292,8 +292,8 @@ msgstr "" msgid "" "Since Python 3.6, in an :keyword:`async def` function, an :keyword:`!async " "for` clause may be used to iterate over a :term:`asynchronous iterator`. A " -"comprehension in an :keyword:`!async def` function may consist of either a :" -"keyword:`!for` or :keyword:`!async for` clause following the leading " +"comprehension in an :keyword:`!async def` function may consist of either " +"a :keyword:`!for` or :keyword:`!async for` clause following the leading " "expression, may contain additional :keyword:`!for` or :keyword:`!async for` " "clauses, and may also use :keyword:`await` expressions." msgstr "" @@ -414,11 +414,11 @@ msgstr "" #: ../../reference/expressions.rst:375 msgid "" -"Restrictions on the types of the key values are listed earlier in section :" -"ref:`types`. (To summarize, the key type should be :term:`hashable`, which " -"excludes all mutable objects.) Clashes between duplicate keys are not " -"detected; the last value (textually rightmost in the display) stored for a " -"given key value prevails." +"Restrictions on the types of the key values are listed earlier in " +"section :ref:`types`. (To summarize, the key type should " +"be :term:`hashable`, which excludes all mutable objects.) Clashes between " +"duplicate keys are not detected; the last value (textually rightmost in the " +"display) stored for a given key value prevails." msgstr "" #: ../../reference/expressions.rst:381 @@ -446,16 +446,16 @@ msgstr "" #: ../../reference/expressions.rst:407 msgid "" -"Variables used in the generator expression are evaluated lazily when the :" -"meth:`~generator.__next__` method is called for the generator object (in the " -"same fashion as normal generators). However, the iterable expression in the " -"leftmost :keyword:`!for` clause is immediately evaluated, so that an error " -"produced by it will be emitted at the point where the generator expression " -"is defined, rather than at the point where the first value is retrieved. " -"Subsequent :keyword:`!for` clauses and any filter condition in the leftmost :" -"keyword:`!for` clause cannot be evaluated in the enclosing scope as they may " -"depend on the values obtained from the leftmost iterable. For example: " -"``(x*y for x in range(10) for y in range(x, x+10))``." +"Variables used in the generator expression are evaluated lazily when " +"the :meth:`~generator.__next__` method is called for the generator object " +"(in the same fashion as normal generators). However, the iterable " +"expression in the leftmost :keyword:`!for` clause is immediately evaluated, " +"so that an error produced by it will be emitted at the point where the " +"generator expression is defined, rather than at the point where the first " +"value is retrieved. Subsequent :keyword:`!for` clauses and any filter " +"condition in the leftmost :keyword:`!for` clause cannot be evaluated in the " +"enclosing scope as they may depend on the values obtained from the leftmost " +"iterable. For example: ``(x*y for x in range(10) for y in range(x, x+10))``." msgstr "" #: ../../reference/expressions.rst:418 @@ -473,11 +473,11 @@ msgstr "" #: ../../reference/expressions.rst:425 msgid "" -"If a generator expression contains either :keyword:`!async for` clauses or :" -"keyword:`await` expressions it is called an :dfn:`asynchronous generator " +"If a generator expression contains either :keyword:`!async for` clauses " +"or :keyword:`await` expressions it is called an :dfn:`asynchronous generator " "expression`. An asynchronous generator expression returns a new " -"asynchronous generator object, which is an asynchronous iterator (see :ref:" -"`async-iterators`)." +"asynchronous generator object, which is an asynchronous iterator " +"(see :ref:`async-iterators`)." msgstr "" #: ../../reference/expressions.rst:431 @@ -500,9 +500,9 @@ msgid "" "The yield expression is used when defining a :term:`generator` function or " "an :term:`asynchronous generator` function and thus can only be used in the " "body of a function definition. Using a yield expression in a function's " -"body causes that function to be a generator function, and using it in an :" -"keyword:`async def` function's body causes that coroutine function to be an " -"asynchronous generator function. For example::" +"body causes that function to be a generator function, and using it in " +"an :keyword:`async def` function's body causes that coroutine function to be " +"an asynchronous generator function. For example::" msgstr "" #: ../../reference/expressions.rst:466 @@ -540,19 +540,19 @@ msgid "" "generator. That generator then controls the execution of the generator " "function. The execution starts when one of the generator's methods is " "called. At that time, the execution proceeds to the first yield expression, " -"where it is suspended again, returning the value of :token:`~python-grammar:" -"yield_list` to the generator's caller, or ``None`` if :token:`~python-" -"grammar:yield_list` is omitted. By suspended, we mean that all local state " -"is retained, including the current bindings of local variables, the " -"instruction pointer, the internal evaluation stack, and the state of any " -"exception handling. When the execution is resumed by calling one of the " -"generator's methods, the function can proceed exactly as if the yield " -"expression were just another external call. The value of the yield " +"where it is suspended again, returning the value of :token:`~python-" +"grammar:yield_list` to the generator's caller, or ``None`` " +"if :token:`~python-grammar:yield_list` is omitted. By suspended, we mean " +"that all local state is retained, including the current bindings of local " +"variables, the instruction pointer, the internal evaluation stack, and the " +"state of any exception handling. When the execution is resumed by calling " +"one of the generator's methods, the function can proceed exactly as if the " +"yield expression were just another external call. The value of the yield " "expression after resuming depends on the method which resumed the " -"execution. If :meth:`~generator.__next__` is used (typically via either a :" -"keyword:`for` or the :func:`next` builtin) then the result is :const:" -"`None`. Otherwise, if :meth:`~generator.send` is used, then the result will " -"be the value passed in to that method." +"execution. If :meth:`~generator.__next__` is used (typically via either " +"a :keyword:`for` or the :func:`next` builtin) then the result " +"is :const:`None`. Otherwise, if :meth:`~generator.send` is used, then the " +"result will be the value passed in to that method." msgstr "" #: ../../reference/expressions.rst:504 @@ -568,30 +568,31 @@ msgstr "" msgid "" "Yield expressions are allowed anywhere in a :keyword:`try` construct. If " "the generator is not resumed before it is finalized (by reaching a zero " -"reference count or by being garbage collected), the generator-iterator's :" -"meth:`~generator.close` method will be called, allowing any pending :keyword:" -"`finally` clauses to execute." +"reference count or by being garbage collected), the generator-" +"iterator's :meth:`~generator.close` method will be called, allowing any " +"pending :keyword:`finally` clauses to execute." msgstr "" #: ../../reference/expressions.rst:519 msgid "" "When ``yield from <expr>`` is used, the supplied expression must be an " "iterable. The values produced by iterating that iterable are passed directly " -"to the caller of the current generator's methods. Any values passed in with :" -"meth:`~generator.send` and any exceptions passed in with :meth:`~generator." -"throw` are passed to the underlying iterator if it has the appropriate " -"methods. If this is not the case, then :meth:`~generator.send` will raise :" -"exc:`AttributeError` or :exc:`TypeError`, while :meth:`~generator.throw` " -"will just raise the passed in exception immediately." +"to the caller of the current generator's methods. Any values passed in " +"with :meth:`~generator.send` and any exceptions passed in " +"with :meth:`~generator.throw` are passed to the underlying iterator if it " +"has the appropriate methods. If this is not the case, " +"then :meth:`~generator.send` will raise :exc:`AttributeError` " +"or :exc:`TypeError`, while :meth:`~generator.throw` will just raise the " +"passed in exception immediately." msgstr "" #: ../../reference/expressions.rst:528 msgid "" "When the underlying iterator is complete, the :attr:`~StopIteration.value` " "attribute of the raised :exc:`StopIteration` instance becomes the value of " -"the yield expression. It can be either set explicitly when raising :exc:" -"`StopIteration`, or automatically when the subiterator is a generator (by " -"returning a value from the subgenerator)." +"the yield expression. It can be either set explicitly when " +"raising :exc:`StopIteration`, or automatically when the subiterator is a " +"generator (by returning a value from the subgenerator)." msgstr "" #: ../../reference/expressions.rst:534 @@ -663,13 +664,13 @@ msgstr "" #: ../../reference/expressions.rst:574 msgid "" "Starts the execution of a generator function or resumes it at the last " -"executed yield expression. When a generator function is resumed with a :" -"meth:`~generator.__next__` method, the current yield expression always " +"executed yield expression. When a generator function is resumed with " +"a :meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " -"expression, where the generator is suspended again, and the value of the :" -"token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " -"caller. If the generator exits without yielding another value, a :exc:" -"`StopIteration` exception is raised." +"expression, where the generator is suspended again, and the value of " +"the :token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " +"caller. If the generator exits without yielding another value, " +"a :exc:`StopIteration` exception is raised." msgstr "" #: ../../reference/expressions.rst:583 @@ -715,7 +716,7 @@ msgid "" "*value* may be cleared." msgstr "" -#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:802 +#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:805 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." @@ -730,14 +731,14 @@ msgid "" "exception), :meth:`close` returns :const:`None`. If the generator yields a " "value, a :exc:`RuntimeError` is raised. If the generator raises any other " "exception, it is propagated to the caller. If the generator has already " -"exited due to an exception or normal exit, :meth:`close` returns :const:" -"`None` and has no other effect." +"exited due to an exception or normal exit, :meth:`close` " +"returns :const:`None` and has no other effect." msgstr "" #: ../../reference/expressions.rst:641 msgid "" -"If a generator returns a value upon being closed, the value is returned by :" -"meth:`close`." +"If a generator returns a value upon being closed, the value is returned " +"by :meth:`close`." msgstr "" #: ../../reference/expressions.rst:647 @@ -790,9 +791,9 @@ msgstr "非同步產生器函式" #: ../../reference/expressions.rst:684 msgid "" -"The presence of a yield expression in a function or method defined using :" -"keyword:`async def` further defines the function as an :term:`asynchronous " -"generator` function." +"The presence of a yield expression in a function or method defined " +"using :keyword:`async def` further defines the function as " +"an :term:`asynchronous generator` function." msgstr "" #: ../../reference/expressions.rst:688 @@ -801,26 +802,27 @@ msgid "" "asynchronous iterator known as an asynchronous generator object. That object " "then controls the execution of the generator function. An asynchronous " "generator object is typically used in an :keyword:`async for` statement in a " -"coroutine function analogously to how a generator object would be used in a :" -"keyword:`for` statement." +"coroutine function analogously to how a generator object would be used in " +"a :keyword:`for` statement." msgstr "" #: ../../reference/expressions.rst:695 msgid "" -"Calling one of the asynchronous generator's methods returns an :term:" -"`awaitable` object, and the execution starts when this object is awaited on. " -"At that time, the execution proceeds to the first yield expression, where it " -"is suspended again, returning the value of :token:`~python-grammar:" -"yield_list` to the awaiting coroutine. As with a generator, suspension means " -"that all local state is retained, including the current bindings of local " -"variables, the instruction pointer, the internal evaluation stack, and the " -"state of any exception handling. When the execution is resumed by awaiting " -"on the next object returned by the asynchronous generator's methods, the " -"function can proceed exactly as if the yield expression were just another " -"external call. The value of the yield expression after resuming depends on " -"the method which resumed the execution. If :meth:`~agen.__anext__` is used " -"then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " -"then the result will be the value passed in to that method." +"Calling one of the asynchronous generator's methods returns " +"an :term:`awaitable` object, and the execution starts when this object is " +"awaited on. At that time, the execution proceeds to the first yield " +"expression, where it is suspended again, returning the value " +"of :token:`~python-grammar:yield_list` to the awaiting coroutine. As with a " +"generator, suspension means that all local state is retained, including the " +"current bindings of local variables, the instruction pointer, the internal " +"evaluation stack, and the state of any exception handling. When the " +"execution is resumed by awaiting on the next object returned by the " +"asynchronous generator's methods, the function can proceed exactly as if the " +"yield expression were just another external call. The value of the yield " +"expression after resuming depends on the method which resumed the " +"execution. If :meth:`~agen.__anext__` is used then the result " +"is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, then the result " +"will be the value passed in to that method." msgstr "" #: ../../reference/expressions.rst:710 @@ -854,12 +856,12 @@ msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" "iterator and presumably calls :meth:`~agen.aclose` and executes the " -"coroutine. This *finalizer* may be registered by calling :func:`sys." -"set_asyncgen_hooks`. When first iterated over, an asynchronous generator-" -"iterator will store the registered *finalizer* to be called upon " -"finalization. For a reference example of a *finalizer* method see the " -"implementation of ``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/" -"asyncio/base_events.py`." +"coroutine. This *finalizer* may be registered by " +"calling :func:`sys.set_asyncgen_hooks`. When first iterated over, an " +"asynchronous generator-iterator will store the registered *finalizer* to be " +"called upon finalization. For a reference example of a *finalizer* method " +"see the implementation of ``asyncio.Loop.shutdown_asyncgens`` " +"in :source:`Lib/asyncio/base_events.py`." msgstr "" #: ../../reference/expressions.rst:740 @@ -878,7 +880,7 @@ msgid "" "which are used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:757 +#: ../../reference/expressions.rst:758 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " @@ -888,44 +890,44 @@ msgid "" "expression. The value of the :token:`~python-grammar:yield_list` of the " "yield expression is the value of the :exc:`StopIteration` exception raised " "by the completing coroutine. If the asynchronous generator exits without " -"yielding another value, the awaitable instead raises a :exc:" -"`StopAsyncIteration` exception, signalling that the asynchronous iteration " -"has completed." +"yielding another value, the awaitable instead raises " +"a :exc:`StopAsyncIteration` exception, signalling that the asynchronous " +"iteration has completed." msgstr "" -#: ../../reference/expressions.rst:769 +#: ../../reference/expressions.rst:770 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:774 +#: ../../reference/expressions.rst:776 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send` method for a " "generator, this \"sends\" a value into the asynchronous generator function, " "and the *value* argument becomes the result of the current yield expression. " "The awaitable returned by the :meth:`asend` method will return the next " -"value yielded by the generator as the value of the raised :exc:" -"`StopIteration`, or raises :exc:`StopAsyncIteration` if the asynchronous " -"generator exits without yielding another value. When :meth:`asend` is " -"called to start the asynchronous generator, it must be called with :const:" -"`None` as the argument, because there is no yield expression that could " -"receive the value." +"value yielded by the generator as the value of the " +"raised :exc:`StopIteration`, or raises :exc:`StopAsyncIteration` if the " +"asynchronous generator exits without yielding another value. " +"When :meth:`asend` is called to start the asynchronous generator, it must be " +"called with :const:`None` as the argument, because there is no yield " +"expression that could receive the value." msgstr "" -#: ../../reference/expressions.rst:790 +#: ../../reference/expressions.rst:793 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " -"yielded by the generator function as the value of the raised :exc:" -"`StopIteration` exception. If the asynchronous generator exits without " -"yielding another value, a :exc:`StopAsyncIteration` exception is raised by " -"the awaitable. If the generator function does not catch the passed-in " -"exception, or raises a different exception, then when the awaitable is run " -"that exception propagates to the caller of the awaitable." +"yielded by the generator function as the value of the " +"raised :exc:`StopIteration` exception. If the asynchronous generator exits " +"without yielding another value, a :exc:`StopAsyncIteration` exception is " +"raised by the awaitable. If the generator function does not catch the passed-" +"in exception, or raises a different exception, then when the awaitable is " +"run that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:810 +#: ../../reference/expressions.rst:814 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -941,25 +943,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:826 +#: ../../reference/expressions.rst:830 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:830 +#: ../../reference/expressions.rst:834 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:840 +#: ../../reference/expressions.rst:844 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:846 +#: ../../reference/expressions.rst:850 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:856 +#: ../../reference/expressions.rst:860 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -968,67 +970,69 @@ msgid "" "reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:862 +#: ../../reference/expressions.rst:866 msgid "" -"This production can be customized by overriding the :meth:`~object." -"__getattribute__` method or the :meth:`~object.__getattr__` method. The :" -"meth:`!__getattribute__` method is called first and either returns a value " -"or raises :exc:`AttributeError` if the attribute is not available." +"This production can be customized by overriding " +"the :meth:`~object.__getattribute__` method or " +"the :meth:`~object.__getattr__` method. The :meth:`!__getattribute__` " +"method is called first and either returns a value or " +"raises :exc:`AttributeError` if the attribute is not available." msgstr "" -#: ../../reference/expressions.rst:868 +#: ../../reference/expressions.rst:872 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" -#: ../../reference/expressions.rst:874 +#: ../../reference/expressions.rst:878 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:889 +#: ../../reference/expressions.rst:893 msgid "" "The subscription of an instance of a :ref:`container class <sequence-types>` " -"will generally select an element from the container. The subscription of a :" -"term:`generic class <generic type>` will generally return a :ref:" -"`GenericAlias <types-genericalias>` object." +"will generally select an element from the container. The subscription of " +"a :term:`generic class <generic type>` will generally return " +"a :ref:`GenericAlias <types-genericalias>` object." msgstr "" -#: ../../reference/expressions.rst:897 +#: ../../reference/expressions.rst:901 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: ../../reference/expressions.rst:900 +#: ../../reference/expressions.rst:904 msgid "" "The primary must evaluate to an object that supports subscription. An object " -"may support subscription through defining one or both of :meth:`~object." -"__getitem__` and :meth:`~object.__class_getitem__`. When the primary is " -"subscripted, the evaluated result of the expression list will be passed to " -"one of these methods. For more details on when ``__class_getitem__`` is " -"called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." +"may support subscription through defining one or both " +"of :meth:`~object.__getitem__` and :meth:`~object.__class_getitem__`. When " +"the primary is subscripted, the evaluated result of the expression list will " +"be passed to one of these methods. For more details on when " +"``__class_getitem__`` is called instead of ``__getitem__``, " +"see :ref:`classgetitem-versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:907 +#: ../../reference/expressions.rst:911 msgid "" "If the expression list contains at least one comma, or if any of the " -"expressions are starred, the expression list will evaluate to a :class:" -"`tuple` containing the items of the expression list. Otherwise, the " +"expressions are starred, the expression list will evaluate to " +"a :class:`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:912 +#: ../../reference/expressions.rst:916 msgid "Expressions in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:915 +#: ../../reference/expressions.rst:919 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:918 +#: ../../reference/expressions.rst:922 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -1036,47 +1040,47 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:922 +#: ../../reference/expressions.rst:926 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " -"following section). Examples of builtin sequence classes include the :class:" -"`str`, :class:`list` and :class:`tuple` classes." +"following section). Examples of builtin sequence classes include " +"the :class:`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:927 +#: ../../reference/expressions.rst:931 msgid "" -"The formal syntax makes no special provision for negative indices in :term:" -"`sequences <sequence>`. However, built-in sequences all provide a :meth:" -"`~object.__getitem__` method that interprets negative indices by adding the " -"length of the sequence to the index so that, for example, ``x[-1]`` selects " -"the last item of ``x``. The resulting value must be a nonnegative integer " -"less than the number of items in the sequence, and the subscription selects " -"the item whose index is that value (counting from zero). Since the support " -"for negative indices and slicing occurs in the object's :meth:`~object." -"__getitem__` method, subclasses overriding this method will need to " -"explicitly add that support." +"The formal syntax makes no special provision for negative indices " +"in :term:`sequences <sequence>`. However, built-in sequences all provide " +"a :meth:`~object.__getitem__` method that interprets negative indices by " +"adding the length of the sequence to the index so that, for example, " +"``x[-1]`` selects the last item of ``x``. The resulting value must be a " +"nonnegative integer less than the number of items in the sequence, and the " +"subscription selects the item whose index is that value (counting from " +"zero). Since the support for negative indices and slicing occurs in the " +"object's :meth:`~object.__getitem__` method, subclasses overriding this " +"method will need to explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:945 msgid "" "A :class:`string <str>` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:949 +#: ../../reference/expressions.rst:953 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:963 +#: ../../reference/expressions.rst:967 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:976 +#: ../../reference/expressions.rst:980 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -1086,7 +1090,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:988 +#: ../../reference/expressions.rst:992 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1095,29 +1099,29 @@ msgid "" "the slice items; otherwise, the conversion of the lone slice item is the " "key. The conversion of a slice item that is an expression is that " "expression. The conversion of a proper slice is a slice object (see " -"section :ref:`types`) whose :attr:`~slice.start`, :attr:`~slice.stop` and :" -"attr:`~slice.step` attributes are the values of the expressions given as " -"lower bound, upper bound and stride, respectively, substituting ``None`` for " -"missing expressions." +"section :ref:`types`) whose :attr:`~slice.start`, :attr:`~slice.stop` " +"and :attr:`~slice.step` attributes are the values of the expressions given " +"as lower bound, upper bound and stride, respectively, substituting ``None`` " +"for missing expressions." msgstr "" -#: ../../reference/expressions.rst:1012 +#: ../../reference/expressions.rst:1016 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1014 +#: ../../reference/expressions.rst:1018 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments <argument>`:" msgstr "" -#: ../../reference/expressions.rst:1031 +#: ../../reference/expressions.rst:1035 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1037 +#: ../../reference/expressions.rst:1041 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1127,7 +1131,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1045 +#: ../../reference/expressions.rst:1049 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1148,16 +1152,16 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1065 +#: ../../reference/expressions.rst:1069 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " "documentation, and which therefore cannot be supplied by keyword. In " -"CPython, this is the case for functions implemented in C that use :c:func:" -"`PyArg_ParseTuple` to parse their arguments." +"CPython, this is the case for functions implemented in C that " +"use :c:func:`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1071 +#: ../../reference/expressions.rst:1075 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1166,17 +1170,17 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1077 +#: ../../reference/expressions.rst:1081 msgid "" -"If any keyword argument does not correspond to a formal parameter name, a :" -"exc:`TypeError` exception is raised, unless a formal parameter using the " +"If any keyword argument does not correspond to a formal parameter name, " +"a :exc:`TypeError` exception is raised, unless a formal parameter using the " "syntax ``**identifier`` is present; in this case, that formal parameter " "receives a dictionary containing the excess keyword arguments (using the " "keywords as keys and the argument values as corresponding values), or a " "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1092 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1186,14 +1190,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1095 +#: ../../reference/expressions.rst:1099 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1099 +#: ../../reference/expressions.rst:1103 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1219,13 +1223,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1111 +#: ../../reference/expressions.rst:1115 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1117 +#: ../../reference/expressions.rst:1121 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1234,7 +1238,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1123 +#: ../../reference/expressions.rst:1127 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1246,35 +1250,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1133 +#: ../../reference/expressions.rst:1137 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1136 +#: ../../reference/expressions.rst:1140 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1142 +#: ../../reference/expressions.rst:1146 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1146 +#: ../../reference/expressions.rst:1150 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1148 +#: ../../reference/expressions.rst:1152 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1155 +#: ../../reference/expressions.rst:1159 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1285,73 +1289,73 @@ msgid "" "``None``." msgstr "" -#: ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1166 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1173 +#: ../../reference/expressions.rst:1177 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1180 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1185 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1187 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1193 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1197 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1198 +#: ../../reference/expressions.rst:1202 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1206 ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:2011 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1208 +#: ../../reference/expressions.rst:1212 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1220 +#: ../../reference/expressions.rst:1224 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1226 +#: ../../reference/expressions.rst:1230 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1232 +#: ../../reference/expressions.rst:1236 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1236 +#: ../../reference/expressions.rst:1240 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1359,7 +1363,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1241 +#: ../../reference/expressions.rst:1245 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1367,59 +1371,60 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1250 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " -"Raising a negative number to a fractional power results in a :class:" -"`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" +"Raising a negative number to a fractional power results in " +"a :class:`complex` number. (In earlier versions it raised " +"a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1250 +#: ../../reference/expressions.rst:1254 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1256 +#: ../../reference/expressions.rst:1260 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1266 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1273 +#: ../../reference/expressions.rst:1277 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1281 +#: ../../reference/expressions.rst:1285 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1292 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " -"It only applies to integral numbers or to custom objects that override the :" -"meth:`~object.__invert__` special method." +"It only applies to integral numbers or to custom objects that override " +"the :meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1297 +#: ../../reference/expressions.rst:1301 msgid "" -"In all three cases, if the argument does not have the proper type, a :exc:" -"`TypeError` exception is raised." +"In all three cases, if the argument does not have the proper type, " +"a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1304 +#: ../../reference/expressions.rst:1308 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1308 +#: ../../reference/expressions.rst:1312 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1427,7 +1432,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1323 +#: ../../reference/expressions.rst:1327 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1437,25 +1442,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1329 +#: ../../reference/expressions.rst:1333 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1336 +#: ../../reference/expressions.rst:1340 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "" -"This operation can be customized using the special :meth:`~object." -"__matmul__` and :meth:`~object.__rmatmul__` methods." +"This operation can be customized using the " +"special :meth:`~object.__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1354 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1465,15 +1470,16 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1361 msgid "" -"The division operation can be customized using the special :meth:`~object." -"__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " -"operation can be customized using the special :meth:`~object.__floordiv__` " -"and :meth:`~object.__rfloordiv__` methods." +"The division operation can be customized using the " +"special :meth:`~object.__truediv__` and :meth:`~object.__rtruediv__` " +"methods. The floor division operation can be customized using the " +"special :meth:`~object.__floordiv__` and :meth:`~object.__rfloordiv__` " +"methods." msgstr "" -#: ../../reference/expressions.rst:1366 +#: ../../reference/expressions.rst:1370 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1485,7 +1491,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1375 +#: ../../reference/expressions.rst:1379 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1493,7 +1499,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1384 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1502,20 +1508,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1385 +#: ../../reference/expressions.rst:1389 msgid "" -"The *modulo* operation can be customized using the special :meth:`~object." -"__mod__` and :meth:`~object.__rmod__` methods." +"The *modulo* operation can be customized using the " +"special :meth:`~object.__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1388 +#: ../../reference/expressions.rst:1392 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1397 +#: ../../reference/expressions.rst:1401 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1523,87 +1529,89 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1402 +#: ../../reference/expressions.rst:1406 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1414 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1413 +#: ../../reference/expressions.rst:1417 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1420 +#: ../../reference/expressions.rst:1424 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1427 +#: ../../reference/expressions.rst:1431 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1432 +#: ../../reference/expressions.rst:1436 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1435 +#: ../../reference/expressions.rst:1439 msgid "" -"The left shift operation can be customized using the special :meth:`~object." -"__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " -"operation can be customized using the special :meth:`~object.__rshift__` " -"and :meth:`~object.__rrshift__` methods." +"The left shift operation can be customized using the " +"special :meth:`~object.__lshift__` and :meth:`~object.__rlshift__` methods. " +"The right shift operation can be customized using the " +"special :meth:`~object.__rshift__` and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1442 +#: ../../reference/expressions.rst:1446 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1449 +#: ../../reference/expressions.rst:1453 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1453 +#: ../../reference/expressions.rst:1457 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1464 +#: ../../reference/expressions.rst:1468 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " -"integers or one of them must be a custom object overriding :meth:`~object." -"__and__` or :meth:`~object.__rand__` special methods." +"integers or one of them must be a custom object " +"overriding :meth:`~object.__and__` or :meth:`~object.__rand__` special " +"methods." msgstr "" -#: ../../reference/expressions.rst:1473 +#: ../../reference/expressions.rst:1477 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " -"which must be integers or one of them must be a custom object overriding :" -"meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." +"which must be integers or one of them must be a custom object " +"overriding :meth:`~object.__xor__` or :meth:`~object.__rxor__` special " +"methods." msgstr "" -#: ../../reference/expressions.rst:1482 +#: ../../reference/expressions.rst:1486 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " -"must be integers or one of them must be a custom object overriding :meth:" -"`~object.__or__` or :meth:`~object.__ror__` special methods." +"must be integers or one of them must be a custom object " +"overriding :meth:`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1490 +#: ../../reference/expressions.rst:1494 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1502 +#: ../../reference/expressions.rst:1506 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1611,14 +1619,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1512 +#: ../../reference/expressions.rst:1516 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1518 +#: ../../reference/expressions.rst:1522 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1626,7 +1634,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1526 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1634,24 +1642,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1527 +#: ../../reference/expressions.rst:1531 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1534 +#: ../../reference/expressions.rst:1538 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1536 +#: ../../reference/expressions.rst:1540 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1539 +#: ../../reference/expressions.rst:1543 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1663,7 +1671,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1548 +#: ../../reference/expressions.rst:1552 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1671,7 +1679,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1554 +#: ../../reference/expressions.rst:1558 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1681,14 +1689,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1561 +#: ../../reference/expressions.rst:1565 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1565 +#: ../../reference/expressions.rst:1569 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1697,13 +1705,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1571 +#: ../../reference/expressions.rst:1575 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1574 +#: ../../reference/expressions.rst:1578 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1713,7 +1721,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1581 +#: ../../reference/expressions.rst:1585 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1723,32 +1731,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1588 +#: ../../reference/expressions.rst:1592 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1592 +#: ../../reference/expressions.rst:1596 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1596 +#: ../../reference/expressions.rst:1600 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " -"numerical Unicode code points (the result of the built-in function :func:" -"`ord`) of their characters. [#]_" +"numerical Unicode code points (the result of the built-in " +"function :func:`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1600 +#: ../../reference/expressions.rst:1604 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1602 +#: ../../reference/expressions.rst:1606 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1757,7 +1765,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1612 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1765,19 +1773,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1613 +#: ../../reference/expressions.rst:1617 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1615 +#: ../../reference/expressions.rst:1619 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1620 +#: ../../reference/expressions.rst:1624 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1786,150 +1794,151 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1626 +#: ../../reference/expressions.rst:1630 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1630 +#: ../../reference/expressions.rst:1634 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1632 +#: ../../reference/expressions.rst:1636 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1635 +#: ../../reference/expressions.rst:1639 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " "``{1,2}`` and ``{2,3}`` are not equal, nor subsets of one another, nor " "supersets of one another). Accordingly, sets are not appropriate arguments " -"for functions which depend on total ordering (for example, :func:`min`, :" -"func:`max`, and :func:`sorted` produce undefined results given a list of " -"sets as inputs)." +"for functions which depend on total ordering (for " +"example, :func:`min`, :func:`max`, and :func:`sorted` produce undefined " +"results given a list of sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1643 +#: ../../reference/expressions.rst:1647 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1645 +#: ../../reference/expressions.rst:1649 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1648 +#: ../../reference/expressions.rst:1652 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1651 +#: ../../reference/expressions.rst:1655 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1654 +#: ../../reference/expressions.rst:1658 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1656 +#: ../../reference/expressions.rst:1660 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1659 +#: ../../reference/expressions.rst:1663 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1661 +#: ../../reference/expressions.rst:1665 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1663 +#: ../../reference/expressions.rst:1667 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1665 +#: ../../reference/expressions.rst:1669 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1667 +#: ../../reference/expressions.rst:1671 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1670 +#: ../../reference/expressions.rst:1674 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1672 +#: ../../reference/expressions.rst:1676 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1674 +#: ../../reference/expressions.rst:1678 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1677 +#: ../../reference/expressions.rst:1681 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1679 +#: ../../reference/expressions.rst:1683 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1681 +#: ../../reference/expressions.rst:1685 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1683 +#: ../../reference/expressions.rst:1687 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " -"sequences, but not to sets or mappings). See also the :func:`~functools." -"total_ordering` decorator." +"sequences, but not to sets or mappings). See also " +"the :func:`~functools.total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1691 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1691 +#: ../../reference/expressions.rst:1695 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1700 +#: ../../reference/expressions.rst:1704 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1702 +#: ../../reference/expressions.rst:1706 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " "otherwise. ``x not in s`` returns the negation of ``x in s``. All built-in " -"sequences and set types support this as well as dictionary, for which :" -"keyword:`!in` tests whether the dictionary has a given key. For container " -"types such as list, tuple, set, frozenset, dict, or collections.deque, the " -"expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." +"sequences and set types support this as well as dictionary, for " +"which :keyword:`!in` tests whether the dictionary has a given key. For " +"container types such as list, tuple, set, frozenset, dict, or " +"collections.deque, the expression ``x in y`` is equivalent to ``any(x is e " +"or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1710 +#: ../../reference/expressions.rst:1714 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1937,14 +1946,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1715 +#: ../../reference/expressions.rst:1719 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1723 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1953,26 +1962,27 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1725 +#: ../../reference/expressions.rst:1729 msgid "" -"Lastly, the old-style iteration protocol is tried: if a class defines :meth:" -"`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" -"negative integer index *i* such that ``x is y[i] or x == y[i]``, and no " -"lower integer index raises the :exc:`IndexError` exception. (If any other " -"exception is raised, it is as if :keyword:`in` raised that exception)." +"Lastly, the old-style iteration protocol is tried: if a class " +"defines :meth:`~object.__getitem__`, ``x in y`` is ``True`` if and only if " +"there is a non-negative integer index *i* such that ``x is y[i] or x == " +"y[i]``, and no lower integer index raises the :exc:`IndexError` exception. " +"(If any other exception is raised, it is as if :keyword:`in` raised that " +"exception)." msgstr "" -#: ../../reference/expressions.rst:1737 +#: ../../reference/expressions.rst:1741 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1750 +#: ../../reference/expressions.rst:1754 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1752 +#: ../../reference/expressions.rst:1756 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1980,40 +1990,40 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1764 +#: ../../reference/expressions.rst:1768 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1775 +#: ../../reference/expressions.rst:1779 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " "``False``, ``None``, numeric zero of all types, and empty strings and " "containers (including strings, tuples, lists, dictionaries, sets and " "frozensets). All other values are interpreted as true. User-defined " -"objects can customize their truth value by providing a :meth:`~object." -"__bool__` method." +"objects can customize their truth value by providing " +"a :meth:`~object.__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1784 +#: ../../reference/expressions.rst:1788 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1789 +#: ../../reference/expressions.rst:1793 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1798 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1797 +#: ../../reference/expressions.rst:1801 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2024,23 +2034,23 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1816 +#: ../../reference/expressions.rst:1820 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1821 +#: ../../reference/expressions.rst:1825 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " -"\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" -"`~python-grammar:identifier`, while also returning the value of the :token:" -"`~python-grammar:expression`." +"\"walrus\") assigns an :token:`~python-grammar:expression` to " +"an :token:`~python-grammar:identifier`, while also returning the value of " +"the :token:`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1826 +#: ../../reference/expressions.rst:1830 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1828 +#: ../../reference/expressions.rst:1832 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2048,11 +2058,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1833 +#: ../../reference/expressions.rst:1837 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1835 +#: ../../reference/expressions.rst:1839 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2060,7 +2070,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1844 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2070,36 +2080,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1848 +#: ../../reference/expressions.rst:1852 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:1859 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1867 +#: ../../reference/expressions.rst:1871 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1870 +#: ../../reference/expressions.rst:1874 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1874 +#: ../../reference/expressions.rst:1878 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1881 +#: ../../reference/expressions.rst:1885 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1892 +#: ../../reference/expressions.rst:1896 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2107,7 +2117,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:1900 msgid "" "def <lambda>(parameters):\n" " return expression" @@ -2115,25 +2125,25 @@ msgstr "" "def <lambda>(parameters):\n" " return expression" -#: ../../reference/expressions.rst:1901 +#: ../../reference/expressions.rst:1905 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1909 +#: ../../reference/expressions.rst:1913 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1925 +#: ../../reference/expressions.rst:1929 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1934 +#: ../../reference/expressions.rst:1938 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2141,42 +2151,42 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1939 +#: ../../reference/expressions.rst:1943 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:1946 msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1951 msgid "" -"A trailing comma is required only to create a one-item tuple, such as ``1," -"``; it is optional in all other cases. A single expression without a " +"A trailing comma is required only to create a one-item tuple, such as " +"``1,``; it is optional in all other cases. A single expression without a " "trailing comma doesn't create a tuple, but rather yields the value of that " "expression. (To create an empty tuple, use an empty pair of parentheses: " "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:1962 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1962 +#: ../../reference/expressions.rst:1966 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1965 +#: ../../reference/expressions.rst:1969 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1968 +#: ../../reference/expressions.rst:1972 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2192,11 +2202,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1979 +#: ../../reference/expressions.rst:1983 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:1988 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2206,176 +2216,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1990 +#: ../../reference/expressions.rst:1994 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2000 msgid "Operator" msgstr "運算子" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2000 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2002 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2004 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2002 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2008 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2008 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:2011 msgid ":keyword:`await x <await>`" msgstr ":keyword:`await x <await>`" -#: ../../reference/expressions.rst:2009 +#: ../../reference/expressions.rst:2013 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:2009 +#: ../../reference/expressions.rst:2013 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2015 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2015 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2017 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2017 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2021 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2021 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2023 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2023 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2025 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2025 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2023 +#: ../../reference/expressions.rst:2027 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2023 +#: ../../reference/expressions.rst:2027 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2025 +#: ../../reference/expressions.rst:2029 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2025 +#: ../../reference/expressions.rst:2029 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2031 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2031 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2031 +#: ../../reference/expressions.rst:2035 msgid ":keyword:`not x <not>`" msgstr ":keyword:`not x <not>`" -#: ../../reference/expressions.rst:2031 +#: ../../reference/expressions.rst:2035 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2037 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2037 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2039 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2039 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2037 +#: ../../reference/expressions.rst:2041 msgid ":keyword:`if <if_expr>` -- :keyword:`!else`" msgstr ":keyword:`if <if_expr>` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2037 +#: ../../reference/expressions.rst:2041 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2039 +#: ../../reference/expressions.rst:2043 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2039 +#: ../../reference/expressions.rst:2043 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2045 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2045 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2046 +#: ../../reference/expressions.rst:2050 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2047 +#: ../../reference/expressions.rst:2051 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2387,7 +2397,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2056 +#: ../../reference/expressions.rst:2060 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2395,7 +2405,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2061 +#: ../../reference/expressions.rst:2065 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2409,7 +2419,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2072 +#: ../../reference/expressions.rst:2076 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2417,13 +2427,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2077 +#: ../../reference/expressions.rst:2081 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2080 +#: ../../reference/expressions.rst:2084 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2431,22 +2441,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2085 +#: ../../reference/expressions.rst:2089 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2088 +#: ../../reference/expressions.rst:2092 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1766 -#: ../../reference/expressions.rst:1806 ../../reference/expressions.rst:1857 -#: ../../reference/expressions.rst:1883 ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1810 ../../reference/expressions.rst:1861 +#: ../../reference/expressions.rst:1887 ../../reference/expressions.rst:1915 msgid "expression" msgstr "" @@ -2454,8 +2464,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1258 -#: ../../reference/expressions.rst:1306 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1310 msgid "arithmetic" msgstr "" @@ -2477,9 +2487,9 @@ msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 #: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 -#: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:1295 ../../reference/expressions.rst:1344 -#: ../../reference/expressions.rst:1440 +#: ../../reference/expressions.rst:808 ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:1299 ../../reference/expressions.rst:1348 +#: ../../reference/expressions.rst:1444 msgid "exception" msgstr "" @@ -2519,11 +2529,11 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 #: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 #: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 -#: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1163 -#: ../../reference/expressions.rst:1177 ../../reference/expressions.rst:1184 -#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:855 ../../reference/expressions.rst:884 +#: ../../reference/expressions.rst:961 ../../reference/expressions.rst:1005 +#: ../../reference/expressions.rst:1153 ../../reference/expressions.rst:1167 +#: ../../reference/expressions.rst:1181 ../../reference/expressions.rst:1188 +#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1927 msgid "object" msgstr "object(物件)" @@ -2532,7 +2542,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2544,19 +2554,19 @@ msgstr "" msgid "empty" msgstr "" -#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:884 +#: ../../reference/expressions.rst:961 ../../reference/expressions.rst:1927 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1949 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 -#: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:955 ../../reference/expressions.rst:1005 +#: ../../reference/expressions.rst:1915 msgid ", (comma)" msgstr ", (逗號)" @@ -2573,7 +2583,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1861 msgid "if" msgstr "if" @@ -2581,13 +2591,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1202 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1206 msgid "await" msgstr "await" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:961 +#: ../../reference/expressions.rst:1915 msgid "list" msgstr "list(串列)" @@ -2596,7 +2606,7 @@ msgstr "list(串列)" msgid "display" msgstr "" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:876 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:880 msgid "[] (square brackets)" msgstr "[] (方括號)" @@ -2605,7 +2615,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:1915 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2622,7 +2632,7 @@ msgid "set expression" msgstr "set expression(集合運算式)" #: ../../reference/expressions.rst:329 ../../reference/expressions.rst:355 -#: ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:884 msgid "dictionary" msgstr "dictionary(字典)" @@ -2642,8 +2652,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:955 +#: ../../reference/expressions.rst:1887 msgid ": (colon)" msgstr ": (冒號)" @@ -2655,13 +2665,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1934 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1114 -#: ../../reference/expressions.rst:1222 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1118 +#: ../../reference/expressions.rst:1226 msgid "**" msgstr "**" @@ -2678,7 +2688,7 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1202 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1206 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2690,8 +2700,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1153 +#: ../../reference/expressions.rst:1167 ../../reference/expressions.rst:1887 msgid "function" msgstr "function (函式)" @@ -2707,7 +2717,7 @@ msgstr "yield from expression(yield from 運算式)" msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:805 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:808 msgid "GeneratorExit" msgstr "GeneratorExit" @@ -2723,488 +2733,488 @@ msgstr "asynchronous-generator(非同步產生器)" msgid "StopAsyncIteration" msgstr "StopAsyncIteration" -#: ../../reference/expressions.rst:828 +#: ../../reference/expressions.rst:832 msgid "primary" msgstr "primary(主要)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "attribute" msgstr "attribute(屬性)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "reference" msgstr "reference(參照)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "attribute reference" msgstr "attribute reference(屬性參照)" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:855 msgid "AttributeError" msgstr "AttributeError" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:855 msgid "module" msgstr "module(模組)" -#: ../../reference/expressions.rst:876 +#: ../../reference/expressions.rst:880 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:961 +#: ../../reference/expressions.rst:1735 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:884 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 -#: ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:961 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:941 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:941 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:955 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:955 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1177 -#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1153 +#: ../../reference/expressions.rst:1167 ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1188 ../../reference/expressions.rst:1198 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1038 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1114 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1118 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1038 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1319 -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1088 ../../reference/expressions.rst:1323 +#: ../../reference/expressions.rst:1934 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1153 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1153 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1181 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1181 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1184 +#: ../../reference/expressions.rst:1188 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1188 ../../reference/expressions.rst:1198 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1198 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1222 +#: ../../reference/expressions.rst:1226 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1258 -#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1422 -#: ../../reference/expressions.rst:1451 ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1226 ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1310 ../../reference/expressions.rst:1426 +#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1770 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1267 -#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1284 -#: ../../reference/expressions.rst:1319 ../../reference/expressions.rst:1332 -#: ../../reference/expressions.rst:1344 ../../reference/expressions.rst:1362 -#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 -#: ../../reference/expressions.rst:1422 ../../reference/expressions.rst:1460 -#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 -#: ../../reference/expressions.rst:1492 ../../reference/expressions.rst:1731 -#: ../../reference/expressions.rst:1740 ../../reference/expressions.rst:1782 -#: ../../reference/expressions.rst:1787 ../../reference/expressions.rst:1792 -#: ../../reference/expressions.rst:1857 ../../reference/expressions.rst:1981 +#: ../../reference/expressions.rst:1226 ../../reference/expressions.rst:1271 +#: ../../reference/expressions.rst:1280 ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1323 ../../reference/expressions.rst:1336 +#: ../../reference/expressions.rst:1348 ../../reference/expressions.rst:1366 +#: ../../reference/expressions.rst:1396 ../../reference/expressions.rst:1409 +#: ../../reference/expressions.rst:1426 ../../reference/expressions.rst:1464 +#: ../../reference/expressions.rst:1472 ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1496 ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1744 ../../reference/expressions.rst:1786 +#: ../../reference/expressions.rst:1791 ../../reference/expressions.rst:1796 +#: ../../reference/expressions.rst:1861 ../../reference/expressions.rst:1985 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1258 +#: ../../reference/expressions.rst:1262 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1258 ../../reference/expressions.rst:1451 -#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1468 -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1455 +#: ../../reference/expressions.rst:1464 ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1481 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1271 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1271 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1409 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1280 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1280 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1280 ../../reference/expressions.rst:1396 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1288 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1288 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1295 +#: ../../reference/expressions.rst:1299 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1451 +#: ../../reference/expressions.rst:1310 ../../reference/expressions.rst:1455 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1319 +#: ../../reference/expressions.rst:1323 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1336 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1336 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1362 +#: ../../reference/expressions.rst:1366 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1362 +#: ../../reference/expressions.rst:1366 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1396 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1396 ../../reference/expressions.rst:1409 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1409 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1440 +#: ../../reference/expressions.rst:1444 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1787 +#: ../../reference/expressions.rst:1464 ../../reference/expressions.rst:1791 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1460 +#: ../../reference/expressions.rst:1464 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 -#: ../../reference/expressions.rst:1792 +#: ../../reference/expressions.rst:1472 ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1796 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1516 +#: ../../reference/expressions.rst:1520 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1516 +#: ../../reference/expressions.rst:1520 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1744 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1770 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1770 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1786 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1934 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1934 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1949 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:1964 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:1964 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1981 +#: ../../reference/expressions.rst:1985 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/grammar.po b/reference/grammar.po index 14222d9038..24d3eb9b2c 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-11 00:14+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -285,8 +285,8 @@ msgid "" "import_from[stmt_ty]:\n" " | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets " "{\n" -" _PyAST_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), " -"EXTRA) }\n" +" _PyPegen_checked_future_import(p, b->v.Name.id, c, " +"_PyPegen_seq_count_dots(a), EXTRA) }\n" " | 'from' a=('.' | '...')+ 'import' b=import_from_targets {\n" " _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }\n" "import_from_targets[asdl_alias_seq*]:\n" @@ -401,10 +401,10 @@ msgid "" " | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }\n" " | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }\n" "slash_with_default[SlashWithDefault*]:\n" -" | a=param_no_default* b=param_with_default+ '/' ',' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=param_no_default* b=param_with_default+ '/' &')' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"&')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "star_etc[StarEtc*]:\n" " | invalid_star_etc\n" @@ -442,18 +442,18 @@ msgid "" "param_no_default_star_annotation[arg_ty]:\n" " | a=param_star_annotation ',' tc=TYPE_COMMENT? " "{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" -" | a=param_star_annotation tc=TYPE_COMMENT? &')' " -"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +" | a=param_star_annotation tc=TYPE_COMMENT? " +"&')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" "param_with_default[NameDefaultPair*]:\n" " | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " "a, c, tc) }\n" -" | a=param c=default tc=TYPE_COMMENT? &')' " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" "param_maybe_default[NameDefaultPair*]:\n" " | a=param c=default? ',' tc=TYPE_COMMENT? " "{ _PyPegen_name_default_pair(p, a, c, tc) }\n" -" | a=param c=default? tc=TYPE_COMMENT? &')' " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default? tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" "param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " "EXTRA) }\n" "param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v." @@ -683,10 +683,10 @@ msgid "" " | '(' pattern=pattern ')' { pattern }\n" "\n" "sequence_pattern[pattern_ty]:\n" -" | '[' patterns=maybe_sequence_pattern? ']' " -"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" -" | '(' patterns=open_sequence_pattern? ')' " -"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '[' patterns=maybe_sequence_pattern? " +"']' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '(' patterns=open_sequence_pattern? " +"')' { _PyAST_MatchSequence(patterns, EXTRA) }\n" "\n" "open_sequence_pattern[asdl_seq*]:\n" " | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {\n" @@ -1067,10 +1067,10 @@ msgid "" " | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }\n" "\n" "lambda_slash_with_default[SlashWithDefault*]:\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"&':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "lambda_star_etc[StarEtc*]:\n" " | invalid_lambda_star_etc\n" @@ -1190,8 +1190,8 @@ msgid "" " | invalid_comprehension\n" "\n" "genexp[expr_ty]:\n" -" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses ')' " -"{ _PyAST_GeneratorExp(a, b, EXTRA) }\n" +" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses " +"')' { _PyAST_GeneratorExp(a, b, EXTRA) }\n" " | invalid_comprehension\n" "\n" "dictcomp[expr_ty]:\n" @@ -1465,9 +1465,9 @@ msgid "" "annotation\") }\n" " | (star_targets '=')* a=star_expressions '=' {\n" " RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" -" | (star_targets '=')* a=yield_expr '=' " -"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression not " -"possible\") }\n" +" | (star_targets '=')* a=yield_expr " +"'=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression " +"not possible\") }\n" " | a=star_expressions augassign annotated_rhs {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" " a,\n" @@ -1528,8 +1528,8 @@ msgid "" "comment\") }\n" " | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (param_no_default | ',') param_maybe_default* a='*' " -"(param_no_default | ',') {\n" +" | '*' (param_no_default | ',') param_maybe_default* " +"a='*' (param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_kwds:\n" @@ -1572,8 +1572,8 @@ msgid "" "must follow bare *\") }\n" " | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' " -"(lambda_param_no_default | ',') {\n" +" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* " +"a='*' (lambda_param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_lambda_kwds:\n" diff --git a/reference/import.po b/reference/import.po index 54ab4c6fff..eeb49abbab 100644 --- a/reference/import.po +++ b/reference/import.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-15 16:37+0000\n" "PO-Revision-Date: 2024-11-06 14:55+0800\n" "Last-Translator: Ken Cheng <ken71301@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,9 +31,9 @@ msgid "" "`__import__` can also be used to invoke the import machinery." msgstr "" "一個 :term:`module` 中的 Python 程式碼透過 :term:`importing` 的過程來存取另一" -"個模組中的程式碼。:keyword:`import` 陳述式是調用 (invoke) 引入機制最常見的方" +"個模組中的程式碼。:keyword:`import` 陳述式是叫用 (invoke) 引入機制最常見的方" "法,但這不是唯一的方法。函式如 :func:`importlib.import_module` 以及內建函式 :" -"func:`__import__` 也可以用來調用引入機制。" +"func:`__import__` 也可以用來叫用引入機制。" #: ../../reference/import.rst:16 msgid "" @@ -73,7 +73,7 @@ msgid "" "`__import__` and use their own solutions to implement import semantics." msgstr "" "當執行 :keyword:`import` 陳述式時,會呼叫內建的 :func:`__import__` 函式。其他" -"調用引入系統的機制(如 :func:`importlib.import_module`)可以選擇略過 :func:" +"叫用引入系統的機制(如 :func:`importlib.import_module`)可以選擇略過 :func:" "`__import__`,並使用它們自己的解決方案來實作引入語意。" #: ../../reference/import.rst:36 @@ -87,7 +87,7 @@ msgid "" msgstr "" "當模組首次被引入時,Python 會搜尋該模組,若找到則會建立一個模組物件 " "[#fnmo]_,並對其進行初始化。如果找不到指定的模組,則會引發 :exc:" -"`ModuleNotFoundError`。當引入機制被調用時,Python 會實作各種策略來搜尋指定的" +"`ModuleNotFoundError`。當引入機制被叫用時,Python 會實作各種策略來搜尋指定的" "模組。這些策略可以透過使用以下章節描述的各種 hook(掛鉤)來修改和擴展。" #: ../../reference/import.rst:43 @@ -115,7 +115,7 @@ msgid "" msgstr "" ":mod:`importlib` 模組提供了豐富的 API 來與引入系統互動。例如,:func:" "`importlib.import_module` 提供了一個比內建的 :func:`__import__` 更推薦且更簡" -"單的 API 來調用引入機制。更多詳細資訊請參閱 :mod:`importlib` 函式庫文件。" +"單的 API 來叫用引入機制。更多詳細資訊請參閱 :mod:`importlib` 函式庫文件。" #: ../../reference/import.rst:62 msgid "Packages" @@ -232,11 +232,11 @@ msgstr "" "__init__.py``。隨後引入 ``parent.two`` 或 ``parent.three`` 將分別執行 " "``parent/two/__init__.py`` 和 ``parent/three/__init__.py``。" -#: ../../reference/import.rst:127 +#: ../../reference/import.rst:129 msgid "Namespace packages" msgstr "命名空間套件" -#: ../../reference/import.rst:133 +#: ../../reference/import.rst:135 msgid "" "A namespace package is a composite of various :term:`portions <portion>`, " "where each portion contributes a subpackage to the parent package. Portions " @@ -251,7 +251,7 @@ msgstr "" "中、網路上,或 Python 在引入時搜尋的任何其他地方。命名空間套件不一定直接對應" "於檔案系統中的對象;它們可能是沒有具體表示的虛擬模組。" -#: ../../reference/import.rst:141 +#: ../../reference/import.rst:143 msgid "" "Namespace packages do not use an ordinary list for their ``__path__`` " "attribute. They instead use a custom iterable type which will automatically " @@ -263,7 +263,7 @@ msgstr "" "別,當父套件的路徑(或頂層套件的 :data:`sys.path`)發生變化時,會在下一次引入" "嘗試時自動執行新一輪的套件部分搜尋。" -#: ../../reference/import.rst:147 +#: ../../reference/import.rst:149 msgid "" "With namespace packages, there is no ``parent/__init__.py`` file. In fact, " "there may be multiple ``parent`` directories found during import search, " @@ -278,15 +278,15 @@ msgstr "" "``parent`` 套件或其子套件之一時,Python 會為頂層 ``parent`` 套件建立一個命名" "空間套件。" -#: ../../reference/import.rst:154 +#: ../../reference/import.rst:156 msgid "See also :pep:`420` for the namespace package specification." msgstr "有關命名空間套件的規範,請參見 :pep:`420`。" -#: ../../reference/import.rst:158 +#: ../../reference/import.rst:160 msgid "Searching" msgstr "搜尋" -#: ../../reference/import.rst:160 +#: ../../reference/import.rst:162 msgid "" "To begin the search, Python needs the :term:`fully qualified <qualified " "name>` name of the module (or package, but for the purposes of this " @@ -300,7 +300,7 @@ msgstr "" "自 :keyword:`import` 陳述式的各種引數,或來自 :func:`importlib." "import_module` 或 :func:`__import__` 函式的參數。" -#: ../../reference/import.rst:166 +#: ../../reference/import.rst:168 msgid "" "This name will be used in various phases of the import search, and it may be " "the dotted path to a submodule, e.g. ``foo.bar.baz``. In this case, Python " @@ -313,11 +313,11 @@ msgstr "" "bar``,最後是 ``foo.bar.baz``。如果任何中間引入失敗,則會引發 :exc:" "`ModuleNotFoundError`。" -#: ../../reference/import.rst:173 +#: ../../reference/import.rst:175 msgid "The module cache" msgstr "模組快取" -#: ../../reference/import.rst:178 +#: ../../reference/import.rst:180 msgid "" "The first place checked during import search is :data:`sys.modules`. This " "mapping serves as a cache of all modules that have been previously imported, " @@ -331,7 +331,7 @@ msgstr "" "`sys.modules` 將包含 ``foo``、``foo.bar`` 和 ``foo.bar.baz`` 的條目。每個鍵的" "值都是相應的模組物件。" -#: ../../reference/import.rst:185 +#: ../../reference/import.rst:187 msgid "" "During import, the module name is looked up in :data:`sys.modules` and if " "present, the associated value is the module satisfying the import, and the " @@ -343,7 +343,7 @@ msgstr "" "滿足此引入的模組,此引入過程即完成。然而,如果值是 ``None``,則會引發 :exc:" "`ModuleNotFoundError`。如果模組名稱不存在,Python 會繼續搜尋該模組。" -#: ../../reference/import.rst:191 +#: ../../reference/import.rst:193 msgid "" ":data:`sys.modules` is writable. Deleting a key may not destroy the " "associated module (as other modules may hold references to it), but it will " @@ -357,7 +357,7 @@ msgstr "" "次引入該模組時重新搜尋。也可以將鍵賦值為 ``None``,這會強制下一次引入該模組時" "引發 :exc:`ModuleNotFoundError`。" -#: ../../reference/import.rst:198 +#: ../../reference/import.rst:200 msgid "" "Beware though, as if you keep a reference to the module object, invalidate " "its cache entry in :data:`sys.modules`, and then re-import the named module, " @@ -370,11 +370,11 @@ msgstr "" "func:`importlib.reload` 會重用\\ *相同的*\\ 模組物件,並透過重新執行模組的程" "式碼來簡單地重新初始化模組內容。" -#: ../../reference/import.rst:208 +#: ../../reference/import.rst:210 msgid "Finders and loaders" msgstr "尋檢器 (Finder) 與載入器 (Loader)" -#: ../../reference/import.rst:215 +#: ../../reference/import.rst:217 msgid "" "If the named module is not found in :data:`sys.modules`, then Python's " "import protocol is invoked to find and load the module. This protocol " @@ -385,13 +385,13 @@ msgid "" "they return themselves when they find that they can load the requested " "module." msgstr "" -"如果在 :data:`sys.modules` 中找不到指定的模組,則會調用 Python 的引入協定來尋" +"如果在 :data:`sys.modules` 中找不到指定的模組,則會叫用 Python 的引入協定來尋" "找並載入該模組。這個協定由兩個概念性物件組成,:term:`尋檢器 <finder>` 和\\ :" "term:`載入器 <loader>`。尋檢器的任務是使用其已知的策略來確定是否能找到命名模" "組。實作這兩個介面的物件稱為\\ :term:`引入器 (importer) <importer>` ——當它們" "發現可以載入所請求的模組時,會回傳它們自己。" -#: ../../reference/import.rst:223 +#: ../../reference/import.rst:225 msgid "" "Python includes a number of default finders and importers. The first one " "knows how to locate built-in modules, and the second knows how to locate " @@ -405,14 +405,14 @@ msgstr "" "組。:term:`import path` 是一個位置的列表,這些位置可能是檔案系統路徑或壓縮檔" "案,也可以擴展以搜尋任何可定位的資源,例如由 URL 識別的資源。" -#: ../../reference/import.rst:230 +#: ../../reference/import.rst:232 msgid "" "The import machinery is extensible, so new finders can be added to extend " "the range and scope of module searching." msgstr "" "引入機制是可擴展的,因此可以增加新的尋檢器來擴展模組搜尋的範圍和作用域。" -#: ../../reference/import.rst:233 +#: ../../reference/import.rst:235 msgid "" "Finders do not actually load modules. If they can find the named module, " "they return a :dfn:`module spec`, an encapsulation of the module's import-" @@ -423,7 +423,7 @@ msgstr "" "組規格`,這是一個模組的引入相關資訊的封裝,引入機制會在載入模組時使用這些資" "訊。" -#: ../../reference/import.rst:237 +#: ../../reference/import.rst:239 msgid "" "The following sections describe the protocol for finders and loaders in more " "detail, including how you can create and register new ones to extend the " @@ -432,7 +432,7 @@ msgstr "" "以下各節將更詳細地描述尋檢器和載入器的協定,包括如何建立和註冊新的尋檢器和載" "入器來擴展引入機制。" -#: ../../reference/import.rst:241 +#: ../../reference/import.rst:243 msgid "" "In previous versions of Python, finders returned :term:`loaders <loader>` " "directly, whereas now they return module specs which *contain* loaders. " @@ -442,11 +442,11 @@ msgstr "" "回傳的是\\ *包含*\\ 載入器的模組規格。載入器仍在引入過程中使用,但其責任減少" "了。" -#: ../../reference/import.rst:247 +#: ../../reference/import.rst:249 msgid "Import hooks" msgstr "引入掛鉤 (Import hooks)" -#: ../../reference/import.rst:257 +#: ../../reference/import.rst:259 msgid "" "The import machinery is designed to be extensible; the primary mechanism for " "this are the *import hooks*. There are two types of import hooks: *meta " @@ -455,7 +455,7 @@ msgstr "" "引入機制的設計是可擴展的;其主要機制是\\ *引入掛鉤*。引入掛鉤有兩種類型:*元" "掛鉤 (meta hooks)* 和\\ *引入路徑掛鉤*。" -#: ../../reference/import.rst:261 +#: ../../reference/import.rst:263 msgid "" "Meta hooks are called at the start of import processing, before any other " "import processing has occurred, other than :data:`sys.modules` cache look " @@ -468,7 +468,7 @@ msgstr "" "組,甚至是內建模組。元掛鉤透過將新的尋檢器物件添加到 :data:`sys.meta_path` 中" "來註冊,具體描述請參閱以下段落。" -#: ../../reference/import.rst:267 +#: ../../reference/import.rst:269 msgid "" "Import path hooks are called as part of :data:`sys.path` (or ``package." "__path__``) processing, at the point where their associated path item is " @@ -479,11 +479,11 @@ msgstr "" "部分來呼叫,當遇到與其相關聯的路徑項目時就會被觸發。引入路徑掛鉤透過將新的可" "呼叫對象增加到 :data:`sys.path_hooks` 中來註冊,具體描述請參閱以下段落。" -#: ../../reference/import.rst:274 +#: ../../reference/import.rst:276 msgid "The meta path" msgstr "元路徑" -#: ../../reference/import.rst:280 +#: ../../reference/import.rst:282 msgid "" "When the named module is not found in :data:`sys.modules`, Python next " "searches :data:`sys.meta_path`, which contains a list of meta path finder " @@ -500,7 +500,7 @@ msgstr "" "MetaPathFinder.find_spec` 的方法,該方法接收三個引數:名稱、引入路徑和(可選" "的)目標模組。元路徑尋檢器可以使用任何策略來確定它是否能處理命名模組。" -#: ../../reference/import.rst:289 +#: ../../reference/import.rst:291 msgid "" "If the meta path finder knows how to handle the named module, it returns a " "spec object. If it cannot handle the named module, it returns ``None``. " @@ -513,7 +513,7 @@ msgstr "" "回傳規格,則會引發 :exc:`ModuleNotFoundError`。任何其他引發的例外將直接向上傳" "播,並中止引入過程。" -#: ../../reference/import.rst:295 +#: ../../reference/import.rst:297 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders is called with two or three arguments. The first is the fully " @@ -533,7 +533,7 @@ msgstr "" "``__path__`` 屬性,將引發 :exc:`ModuleNotFoundError`。第三個引數是一個現有的" "模組物件,該物件將成為後續載入的目標。引入系統只會在重新載入時傳入目標模組。" -#: ../../reference/import.rst:306 +#: ../../reference/import.rst:308 msgid "" "The meta path may be traversed multiple times for a single import request. " "For example, assuming none of the modules involved has already been cached, " @@ -551,7 +551,7 @@ msgstr "" "None)``。當 ``foo.bar`` 被引入後,最後一次遍歷會呼叫 ``mpf.find_spec(\"foo." "bar.baz\", foo.bar.__path__, None)``。" -#: ../../reference/import.rst:316 +#: ../../reference/import.rst:318 msgid "" "Some meta path finders only support top level imports. These importers will " "always return ``None`` when anything other than ``None`` is passed as the " @@ -560,7 +560,7 @@ msgstr "" "一些元路徑尋檢器僅支援頂層引入。當第二個引數傳入 ``None`` 以外的值時,這些引" "入器將始終回傳 ``None``。" -#: ../../reference/import.rst:320 +#: ../../reference/import.rst:322 msgid "" "Python's default :data:`sys.meta_path` has three meta path finders, one that " "knows how to import built-in modules, one that knows how to import frozen " @@ -571,7 +571,7 @@ msgstr "" "模組,一個知道如何引入凍結模組,還有一個知道如何從 :term:`import path` 引入模" "組(即 :term:`path based finder`)。" -#: ../../reference/import.rst:325 +#: ../../reference/import.rst:327 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders replaced :meth:`!find_module`, which is now deprecated. While it " @@ -583,13 +583,13 @@ msgstr "" "meth:`!find_module`,後者現在已被棄用。雖然它將繼續正常工作,但引入機制僅在尋" "檢器未實作 :meth:`~importlib.abc.MetaPathFinder.find_spec` 時才會嘗試使用它。" -#: ../../reference/import.rst:332 +#: ../../reference/import.rst:334 msgid "" "Use of :meth:`!find_module` by the import system now raises :exc:" "`ImportWarning`." msgstr "引入系統現在使用 :meth:`!find_module` 時將引發 :exc:`ImportWarning`。" -#: ../../reference/import.rst:336 +#: ../../reference/import.rst:338 msgid "" ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc." "MetaPathFinder.find_spec` instead." @@ -597,11 +597,11 @@ msgstr "" ":meth:`!find_module` 已被移除。請改用 :meth:`~importlib.abc.MetaPathFinder." "find_spec`。" -#: ../../reference/import.rst:342 +#: ../../reference/import.rst:344 msgid "Loading" msgstr "載入" -#: ../../reference/import.rst:344 +#: ../../reference/import.rst:346 msgid "" "If and when a module spec is found, the import machinery will use it (and " "the loader it contains) when loading the module. Here is an approximation " @@ -610,7 +610,7 @@ msgstr "" "如果找到模組規格,引入機制會在載入模組時使用該規格(以及它包含的載入器)。以" "下是引入過程中載入部分的大致情況: ::" -#: ../../reference/import.rst:348 +#: ../../reference/import.rst:350 msgid "" "module = None\n" "if spec.loader is not None and hasattr(spec.loader, 'create_module'):\n" @@ -670,18 +670,18 @@ msgstr "" " raise\n" "return sys.modules[spec.name]" -#: ../../reference/import.rst:377 +#: ../../reference/import.rst:379 msgid "Note the following details:" msgstr "請注意下列細節:" -#: ../../reference/import.rst:379 +#: ../../reference/import.rst:381 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, import will have already returned it." msgstr "" "如果 :data:`sys.modules` 中已存在具有給定名稱的模組物件,引入會已回傳該物件。" -#: ../../reference/import.rst:382 +#: ../../reference/import.rst:384 msgid "" "The module will exist in :data:`sys.modules` before the loader executes the " "module code. This is crucial because the module code may (directly or " @@ -693,7 +693,7 @@ msgstr "" "重要,因為模組程式碼可能會(直接或間接)引入自己;事先將其增加到 :data:`sys." "modules` 可以預防類似無限遞迴以及多次重覆載入等情形。" -#: ../../reference/import.rst:388 +#: ../../reference/import.rst:390 msgid "" "If loading fails, the failing module -- and only the failing module -- gets " "removed from :data:`sys.modules`. Any module already in the :data:`sys." @@ -706,7 +706,7 @@ msgstr "" "須保留在快取中。此情形與重新載入不同,在重新載入時,即使載入失敗的模組也會保" "留在 :data:`sys.modules` 中。" -#: ../../reference/import.rst:394 +#: ../../reference/import.rst:396 msgid "" "After the module is created but before execution, the import machinery sets " "the import-related module attributes (\"_init_module_attrs\" in the pseudo-" @@ -717,7 +717,7 @@ msgstr "" "範例中為 \"_init_module_attrs\"),具體內容在\\ :ref:`之後的段落<import-mod-" "attrs>`\\ 會總結。" -#: ../../reference/import.rst:399 +#: ../../reference/import.rst:401 msgid "" "Module execution is the key moment of loading in which the module's " "namespace gets populated. Execution is entirely delegated to the loader, " @@ -726,7 +726,7 @@ msgstr "" "模組執行是載入過程中的關鍵時刻,此時模組的命名空間會被新增名稱。執行過程完全" "交由載入器處理,由其決定如何新增以及新增什麼。" -#: ../../reference/import.rst:403 +#: ../../reference/import.rst:405 msgid "" "The module created during loading and passed to exec_module() may not be the " "one returned at the end of import [#fnlo]_." @@ -734,7 +734,7 @@ msgstr "" "在載入過程中建立並傳遞給 exec_module() 的模組,可能不會是引入結束時回傳的模" "組 [#fnlo]_。" -#: ../../reference/import.rst:406 +#: ../../reference/import.rst:408 msgid "" "The import system has taken over the boilerplate responsibilities of " "loaders. These were previously performed by the :meth:`importlib.abc.Loader." @@ -743,11 +743,11 @@ msgstr "" "引入系統已接管載入器的模板 (boilerplate) 責任。之前是由 :meth:`importlib.abc." "Loader.load_module` 方法執行的。" -#: ../../reference/import.rst:412 +#: ../../reference/import.rst:414 msgid "Loaders" msgstr "載入器" -#: ../../reference/import.rst:414 +#: ../../reference/import.rst:416 msgid "" "Module loaders provide the critical function of loading: module execution. " "The import machinery calls the :meth:`importlib.abc.Loader.exec_module` " @@ -758,11 +758,11 @@ msgstr "" "組物件)呼叫 :meth:`importlib.abc.Loader.exec_module` 方法。任何從 :meth:" "`~importlib.abc.Loader.exec_module` 回傳的值都會被忽略。" -#: ../../reference/import.rst:419 +#: ../../reference/import.rst:421 msgid "Loaders must satisfy the following requirements:" msgstr "載入器必須滿足以下要求:" -#: ../../reference/import.rst:421 +#: ../../reference/import.rst:423 msgid "" "If the module is a Python module (as opposed to a built-in module or a " "dynamically loaded extension), the loader should execute the module's code " @@ -771,7 +771,7 @@ msgstr "" "如果模組是 Python 模組(而非內建模組或動態載入的擴充),載入器應在模組的全域" "命名空間 (``module.__dict__``\\ ) 中執行該模組的程式碼。" -#: ../../reference/import.rst:425 +#: ../../reference/import.rst:427 msgid "" "If the loader cannot execute the module, it should raise an :exc:" "`ImportError`, although any other exception raised during :meth:`~importlib." @@ -780,7 +780,7 @@ msgstr "" "如果載入器無法執行該模組,應引發 :exc:`ImportError`。不過,在 :meth:" "`~importlib.abc.Loader.exec_module` 中引發的任何其他例外也會被傳播。" -#: ../../reference/import.rst:429 +#: ../../reference/import.rst:431 msgid "" "In many cases, the finder and loader can be the same object; in such cases " "the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return " @@ -790,7 +790,7 @@ msgstr "" "`~importlib.abc.MetaPathFinder.find_spec` 方法只需回傳一個載入器設為 " "``self`` 的規格即可。" -#: ../../reference/import.rst:433 +#: ../../reference/import.rst:435 msgid "" "Module loaders may opt in to creating the module object during loading by " "implementing a :meth:`~importlib.abc.Loader.create_module` method. It takes " @@ -804,11 +804,11 @@ msgstr "" "要使用的新的模組物件。``create_module()`` 不需要在模組物件上設定任何屬性。如" "果該方法回傳 ``None``,引入機制將自行建立新的模組。" -#: ../../reference/import.rst:440 +#: ../../reference/import.rst:442 msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders." msgstr "載入器的 :meth:`~importlib.abc.Loader.create_module` 方法。" -#: ../../reference/import.rst:443 +#: ../../reference/import.rst:445 msgid "" "The :meth:`~importlib.abc.Loader.load_module` method was replaced by :meth:" "`~importlib.abc.Loader.exec_module` and the import machinery assumed all the " @@ -817,7 +817,7 @@ msgstr "" ":meth:`~importlib.abc.Loader.load_module` 方法已被 :meth:`~importlib.abc." "Loader.exec_module` 取代,引入機制已承擔所有載入的模板責任。" -#: ../../reference/import.rst:448 +#: ../../reference/import.rst:450 msgid "" "For compatibility with existing loaders, the import machinery will use the " "``load_module()`` method of loaders if it exists and the loader does not " @@ -828,7 +828,7 @@ msgstr "" "``load_module()`` 方法時使用該方法。然而,``load_module()`` 已被棄用,載入器" "應改為實作 ``exec_module()``。" -#: ../../reference/import.rst:453 +#: ../../reference/import.rst:455 msgid "" "The ``load_module()`` method must implement all the boilerplate loading " "functionality described above in addition to executing the module. All the " @@ -837,7 +837,7 @@ msgstr "" "``load_module()`` 方法除了執行模組外,還必須實作上述全部的模板載入功能。所有" "相同的限制依然適用,並且還有一些額外的說明:" -#: ../../reference/import.rst:457 +#: ../../reference/import.rst:459 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, the loader must use that existing module. (Otherwise, :func:" @@ -850,7 +850,7 @@ msgstr "" "`sys.modules` 中,載入器必須建立一個新的模組物件並將其新增至 :data:`sys." "modules`。" -#: ../../reference/import.rst:463 +#: ../../reference/import.rst:465 msgid "" "The module *must* exist in :data:`sys.modules` before the loader executes " "the module code, to prevent unbounded recursion or multiple loading." @@ -858,7 +858,7 @@ msgstr "" "在載入器執行模組程式碼之前,該模組\\ *必須*\\ 已存在於 :data:`sys.modules` " "中,以防止無限遞迴或多次載入。" -#: ../../reference/import.rst:467 +#: ../../reference/import.rst:469 msgid "" "If loading fails, the loader must remove any modules it has inserted into :" "data:`sys.modules`, but it must remove **only** the failing module(s), and " @@ -868,7 +868,7 @@ msgstr "" "\\ **只能**\\ 移除失敗的模組(們),且僅在載入器本身明確載入這些模組時才需移" "除。" -#: ../../reference/import.rst:472 +#: ../../reference/import.rst:474 msgid "" "A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." @@ -876,7 +876,7 @@ msgstr "" "當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" "`DeprecationWarning`。" -#: ../../reference/import.rst:476 +#: ../../reference/import.rst:478 msgid "" "An :exc:`ImportError` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." @@ -884,15 +884,15 @@ msgstr "" "當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" "`ImportError`。" -#: ../../reference/import.rst:480 +#: ../../reference/import.rst:482 msgid "Use of ``load_module()`` will raise :exc:`ImportWarning`." msgstr "使用 ``load_module()`` 將引發 :exc:`ImportWarning`。" -#: ../../reference/import.rst:484 +#: ../../reference/import.rst:486 msgid "Submodules" msgstr "子模組" -#: ../../reference/import.rst:486 +#: ../../reference/import.rst:488 msgid "" "When a submodule is loaded using any mechanism (e.g. ``importlib`` APIs, the " "``import`` or ``import-from`` statements, or built-in ``__import__()``) a " @@ -907,7 +907,7 @@ msgstr "" "foo`` 之後,``spam`` 將擁有一個名為 ``foo`` 的屬性,該屬性繫結到子模組。我們" "假設你有以下的目錄結構: ::" -#: ../../reference/import.rst:493 +#: ../../reference/import.rst:495 msgid "" "spam/\n" " __init__.py\n" @@ -917,22 +917,22 @@ msgstr "" " __init__.py\n" " foo.py" -#: ../../reference/import.rst:497 +#: ../../reference/import.rst:499 msgid "and ``spam/__init__.py`` has the following line in it::" msgstr "並且 ``spam/__init__.py`` 中包含以下程式碼: ::" -#: ../../reference/import.rst:499 +#: ../../reference/import.rst:501 msgid "from .foo import Foo" msgstr "from .foo import Foo" -#: ../../reference/import.rst:501 +#: ../../reference/import.rst:503 msgid "" "then executing the following puts name bindings for ``foo`` and ``Foo`` in " "the ``spam`` module::" msgstr "" "那麼執行以下程式碼會將 ``foo`` 和 ``Foo`` 的名稱繫結到 ``spam`` 模組中: ::" -#: ../../reference/import.rst:504 +#: ../../reference/import.rst:506 msgid "" ">>> import spam\n" ">>> spam.foo\n" @@ -946,7 +946,7 @@ msgstr "" ">>> spam.Foo\n" "<class 'spam.foo.Foo'>" -#: ../../reference/import.rst:510 +#: ../../reference/import.rst:512 msgid "" "Given Python's familiar name binding rules this might seem surprising, but " "it's actually a fundamental feature of the import system. The invariant " @@ -959,11 +959,11 @@ msgstr "" "modules['spam.foo']``\\ (就像上述引入後那樣),那麼後者必須作為前者的 " "``foo`` 屬性出現。" -#: ../../reference/import.rst:519 +#: ../../reference/import.rst:521 msgid "Module specs" msgstr "模組規格" -#: ../../reference/import.rst:521 +#: ../../reference/import.rst:523 msgid "" "The import machinery uses a variety of information about each module during " "import, especially before loading. Most of the information is common to all " @@ -974,7 +974,7 @@ msgstr "" "對所有模組來說都是通用的。模組規格的目的是以每個模組為基礎封裝這些與引入相關" "的資訊。" -#: ../../reference/import.rst:526 +#: ../../reference/import.rst:528 msgid "" "Using a spec during import allows state to be transferred between import " "system components, e.g. between the finder that creates the module spec and " @@ -986,7 +986,7 @@ msgstr "" "的尋檢器和執行該規格的載入器之間傳遞。最重要的是,這允許引入機制執行載入的模" "板操作,而在沒有模組規格的情況下,這些操作則是載入器的責任。" -#: ../../reference/import.rst:532 +#: ../../reference/import.rst:534 msgid "" "The module's spec is exposed as :attr:`module.__spec__`. Setting :attr:`!" "__spec__` appropriately applies equally to :ref:`modules initialized during " @@ -998,18 +998,18 @@ msgstr "" "例外是 ``__main__``,其中 :attr:`!__spec__` 會\\ :ref:`在某些情況下被設定成 " "None <main_spec>`。" -#: ../../reference/import.rst:538 +#: ../../reference/import.rst:540 msgid "" "See :class:`~importlib.machinery.ModuleSpec` for details on the contents of " "the module spec." msgstr "" "有關模組規格內容的詳細資訊,請參閱 :class:`~importlib.machinery.ModuleSpec`。" -#: ../../reference/import.rst:546 +#: ../../reference/import.rst:548 msgid "__path__ attributes on modules" msgstr "" -#: ../../reference/import.rst:548 +#: ../../reference/import.rst:550 msgid "" "The :attr:`~module.__path__` attribute should be a (possibly empty) :term:" "`sequence` of strings enumerating the locations where the package's " @@ -1017,7 +1017,7 @@ msgid "" "attribute, it is a :term:`package`." msgstr "" -#: ../../reference/import.rst:553 +#: ../../reference/import.rst:555 msgid "" "A package's :attr:`~module.__path__` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -1026,14 +1026,14 @@ msgid "" "than :data:`!sys.path`." msgstr "" -#: ../../reference/import.rst:560 +#: ../../reference/import.rst:562 msgid "" "The same rules used for :data:`sys.path` also apply to a package's :attr:`!" "__path__`. :data:`sys.path_hooks` (described below) are consulted when " "traversing a package's :attr:`!__path__`." msgstr "" -#: ../../reference/import.rst:564 +#: ../../reference/import.rst:566 msgid "" "A package's ``__init__.py`` file may set or alter the package's :attr:" "`~module.__path__` attribute, and this was typically the way namespace " @@ -1043,18 +1043,18 @@ msgid "" "automatically sets :attr:`!__path__` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:573 +#: ../../reference/import.rst:575 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:575 +#: ../../reference/import.rst:577 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:579 +#: ../../reference/import.rst:581 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -1064,45 +1064,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:586 +#: ../../reference/import.rst:588 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:588 +#: ../../reference/import.rst:590 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:592 +#: ../../reference/import.rst:594 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:595 +#: ../../reference/import.rst:597 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:598 +#: ../../reference/import.rst:600 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:600 +#: ../../reference/import.rst:602 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: ../../reference/import.rst:608 +#: ../../reference/import.rst:610 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:610 +#: ../../reference/import.rst:612 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1112,7 +1112,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:617 +#: ../../reference/import.rst:619 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1126,17 +1126,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:628 +#: ../../reference/import.rst:630 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:634 +#: ../../reference/import.rst:636 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:639 +#: ../../reference/import.rst:641 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -1145,14 +1145,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:645 +#: ../../reference/import.rst:647 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:649 +#: ../../reference/import.rst:651 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -1163,14 +1163,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:656 +#: ../../reference/import.rst:658 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:660 +#: ../../reference/import.rst:662 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1181,7 +1181,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:668 +#: ../../reference/import.rst:670 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1192,7 +1192,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:676 +#: ../../reference/import.rst:678 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1200,11 +1200,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:683 +#: ../../reference/import.rst:685 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:691 +#: ../../reference/import.rst:693 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1212,7 +1212,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:696 +#: ../../reference/import.rst:698 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1220,7 +1220,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:701 +#: ../../reference/import.rst:703 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1228,7 +1228,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:706 +#: ../../reference/import.rst:708 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1240,7 +1240,7 @@ msgid "" "other data types are ignored." msgstr "" -#: ../../reference/import.rst:715 +#: ../../reference/import.rst:717 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1252,7 +1252,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:724 +#: ../../reference/import.rst:726 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1268,7 +1268,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: ../../reference/import.rst:737 +#: ../../reference/import.rst:739 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1284,7 +1284,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:751 +#: ../../reference/import.rst:753 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1294,7 +1294,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:758 +#: ../../reference/import.rst:760 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1302,7 +1302,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:763 +#: ../../reference/import.rst:765 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1314,18 +1314,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:773 +#: ../../reference/import.rst:775 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:775 +#: ../../reference/import.rst:777 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:779 +#: ../../reference/import.rst:781 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1333,21 +1333,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:784 +#: ../../reference/import.rst:786 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:788 +#: ../../reference/import.rst:790 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:796 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1355,14 +1355,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:799 +#: ../../reference/import.rst:801 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:804 +#: ../../reference/import.rst:806 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1372,7 +1372,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:811 +#: ../../reference/import.rst:813 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1381,28 +1381,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:817 +#: ../../reference/import.rst:819 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:822 +#: ../../reference/import.rst:824 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: ../../reference/import.rst:827 +#: ../../reference/import.rst:829 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:829 +#: ../../reference/import.rst:831 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:833 +#: ../../reference/import.rst:835 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1411,7 +1411,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:839 +#: ../../reference/import.rst:841 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1421,11 +1421,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:849 +#: ../../reference/import.rst:851 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:851 +#: ../../reference/import.rst:853 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1433,7 +1433,7 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:856 +#: ../../reference/import.rst:858 msgid "" "package/\n" " __init__.py\n" @@ -1457,13 +1457,13 @@ msgstr "" " moduleZ.py\n" " moduleA.py" -#: ../../reference/import.rst:867 +#: ../../reference/import.rst:869 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:870 +#: ../../reference/import.rst:872 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1479,28 +1479,28 @@ msgstr "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" -#: ../../reference/import.rst:877 +#: ../../reference/import.rst:879 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:881 +#: ../../reference/import.rst:883 msgid "import XXX.YYY.ZZZ" msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:883 +#: ../../reference/import.rst:885 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:890 +#: ../../reference/import.rst:892 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:892 +#: ../../reference/import.rst:894 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere <programs>`, the ``__main__`` module is " @@ -1511,17 +1511,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:903 +#: ../../reference/import.rst:905 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:905 +#: ../../reference/import.rst:907 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:908 +#: ../../reference/import.rst:910 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1529,30 +1529,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:913 +#: ../../reference/import.rst:915 msgid "" "In :ref:`the remaining cases <using-on-interface-options>` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: ../../reference/import.rst:917 +#: ../../reference/import.rst:919 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:918 +#: ../../reference/import.rst:920 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:919 +#: ../../reference/import.rst:921 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:920 +#: ../../reference/import.rst:922 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:922 +#: ../../reference/import.rst:924 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1560,7 +1560,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:927 +#: ../../reference/import.rst:929 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1569,11 +1569,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:935 +#: ../../reference/import.rst:937 msgid "References" msgstr "" -#: ../../reference/import.rst:937 +#: ../../reference/import.rst:939 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages <https://www.python.org/doc/essays/" @@ -1581,37 +1581,37 @@ msgid "" "since the writing of that document." msgstr "" -#: ../../reference/import.rst:942 +#: ../../reference/import.rst:944 msgid "" "The original specification for :data:`sys.meta_path` was :pep:`302`, with " "subsequent extension in :pep:`420`." msgstr "" -#: ../../reference/import.rst:945 +#: ../../reference/import.rst:947 msgid "" ":pep:`420` introduced :term:`namespace packages <namespace package>` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" -#: ../../reference/import.rst:949 +#: ../../reference/import.rst:951 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:952 +#: ../../reference/import.rst:954 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:956 +#: ../../reference/import.rst:958 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:958 +#: ../../reference/import.rst:960 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1620,15 +1620,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:965 +#: ../../reference/import.rst:967 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:966 +#: ../../reference/import.rst:968 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`。" -#: ../../reference/import.rst:968 +#: ../../reference/import.rst:970 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1642,7 +1642,7 @@ msgid "import machinery" msgstr "import machinery(引入機制)" #: ../../reference/import.rst:64 ../../reference/import.rst:95 -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "package" msgstr "package(套件)" @@ -1650,83 +1650,83 @@ msgstr "package(套件)" msgid "regular" msgstr "regular(一般)" -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "portion" msgstr "portion(部分)" -#: ../../reference/import.rst:175 +#: ../../reference/import.rst:177 msgid "sys.modules" msgstr "sys.modules" -#: ../../reference/import.rst:210 ../../reference/import.rst:276 +#: ../../reference/import.rst:212 ../../reference/import.rst:278 msgid "finder" msgstr "finder(搜尋器)" -#: ../../reference/import.rst:210 +#: ../../reference/import.rst:212 msgid "loader" msgstr "loader(載入器)" -#: ../../reference/import.rst:210 +#: ../../reference/import.rst:212 msgid "module spec" msgstr "module spec" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "import hooks" msgstr "import hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "meta hooks" msgstr "meta hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "path hooks" msgstr "path hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "hooks" msgstr "hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "import" msgstr "import(引入)" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "meta" msgstr "meta" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "path" msgstr "path(路徑)" -#: ../../reference/import.rst:276 +#: ../../reference/import.rst:278 msgid "sys.meta_path" msgstr "sys.meta_path" -#: ../../reference/import.rst:276 +#: ../../reference/import.rst:278 msgid "find_spec" msgstr "find_spec" -#: ../../reference/import.rst:636 +#: ../../reference/import.rst:638 msgid "path based finder" msgstr "path based finder(基於路徑的搜尋器)" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path" msgstr "sys.path" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path_hooks" msgstr "sys.path_hooks" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path_importer_cache" msgstr "sys.path_importer_cache" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "PYTHONPATH" msgstr "PYTHONPATH" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index fd5a4fbd89..e7bd8b4e04 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,32 +23,33 @@ msgstr "詞法分析" #: ../../reference/lexical_analysis.rst:10 msgid "" -"A Python program is read by a *parser*. Input to the parser is a stream of " -"*tokens*, generated by the *lexical analyzer*. This chapter describes how " -"the lexical analyzer breaks a file into tokens." +"A Python program is read by a *parser*. Input to the parser is a stream " +"of :term:`tokens <token>`, generated by the *lexical analyzer* (also known " +"as the *tokenizer*). This chapter describes how the lexical analyzer breaks " +"a file into tokens." msgstr "" -#: ../../reference/lexical_analysis.rst:14 +#: ../../reference/lexical_analysis.rst:15 msgid "" "Python reads program text as Unicode code points; the encoding of a source " -"file can be given by an encoding declaration and defaults to UTF-8, see :pep:" -"`3120` for details. If the source file cannot be decoded, a :exc:" -"`SyntaxError` is raised." +"file can be given by an encoding declaration and defaults to UTF-8, " +"see :pep:`3120` for details. If the source file cannot be decoded, " +"a :exc:`SyntaxError` is raised." msgstr "" -#: ../../reference/lexical_analysis.rst:23 +#: ../../reference/lexical_analysis.rst:24 msgid "Line structure" msgstr "" -#: ../../reference/lexical_analysis.rst:27 +#: ../../reference/lexical_analysis.rst:28 msgid "A Python program is divided into a number of *logical lines*." msgstr "" -#: ../../reference/lexical_analysis.rst:33 +#: ../../reference/lexical_analysis.rst:34 msgid "Logical lines" msgstr "" -#: ../../reference/lexical_analysis.rst:37 +#: ../../reference/lexical_analysis.rst:38 msgid "" "The end of a logical line is represented by the token NEWLINE. Statements " "cannot cross logical line boundaries except where NEWLINE is allowed by the " @@ -57,11 +58,11 @@ msgid "" "implicit *line joining* rules." msgstr "" -#: ../../reference/lexical_analysis.rst:47 +#: ../../reference/lexical_analysis.rst:48 msgid "Physical lines" msgstr "" -#: ../../reference/lexical_analysis.rst:49 +#: ../../reference/lexical_analysis.rst:50 msgid "" "A physical line is a sequence of characters terminated by an end-of-line " "sequence. In source files and strings, any of the standard platform line " @@ -72,18 +73,18 @@ msgid "" "input also serves as an implicit terminator for the final physical line." msgstr "" -#: ../../reference/lexical_analysis.rst:57 +#: ../../reference/lexical_analysis.rst:58 msgid "" "When embedding Python, source code strings should be passed to Python APIs " "using the standard C conventions for newline characters (the ``\\n`` " "character, representing ASCII LF, is the line terminator)." msgstr "" -#: ../../reference/lexical_analysis.rst:65 +#: ../../reference/lexical_analysis.rst:66 msgid "Comments" msgstr "" -#: ../../reference/lexical_analysis.rst:70 +#: ../../reference/lexical_analysis.rst:71 msgid "" "A comment starts with a hash character (``#``) that is not part of a string " "literal, and ends at the end of the physical line. A comment signifies the " @@ -91,11 +92,11 @@ msgid "" "Comments are ignored by the syntax." msgstr "" -#: ../../reference/lexical_analysis.rst:79 +#: ../../reference/lexical_analysis.rst:80 msgid "Encoding declarations" msgstr "" -#: ../../reference/lexical_analysis.rst:84 +#: ../../reference/lexical_analysis.rst:85 msgid "" "If a comment in the first or second line of the Python script matches the " "regular expression ``coding[=:]\\s*([-\\w.]+)``, this comment is processed " @@ -105,41 +106,41 @@ msgid "" "comment-only line. The recommended forms of an encoding expression are ::" msgstr "" -#: ../../reference/lexical_analysis.rst:91 +#: ../../reference/lexical_analysis.rst:92 msgid "# -*- coding: <encoding-name> -*-" msgstr "# -*- coding: <encoding-name> -*-" -#: ../../reference/lexical_analysis.rst:93 +#: ../../reference/lexical_analysis.rst:94 msgid "which is recognized also by GNU Emacs, and ::" msgstr "" -#: ../../reference/lexical_analysis.rst:95 +#: ../../reference/lexical_analysis.rst:96 msgid "# vim:fileencoding=<encoding-name>" msgstr "# vim:fileencoding=<encoding-name>" -#: ../../reference/lexical_analysis.rst:97 +#: ../../reference/lexical_analysis.rst:98 msgid "which is recognized by Bram Moolenaar's VIM." msgstr "" -#: ../../reference/lexical_analysis.rst:99 +#: ../../reference/lexical_analysis.rst:100 msgid "" "If no encoding declaration is found, the default encoding is UTF-8. If the " "implicit or explicit encoding of a file is UTF-8, an initial UTF-8 byte-" "order mark (b'\\xef\\xbb\\xbf') is ignored rather than being a syntax error." msgstr "" -#: ../../reference/lexical_analysis.rst:103 +#: ../../reference/lexical_analysis.rst:104 msgid "" "If an encoding is declared, the encoding name must be recognized by Python " "(see :ref:`standard-encodings`). The encoding is used for all lexical " "analysis, including string literals, comments and identifiers." msgstr "" -#: ../../reference/lexical_analysis.rst:112 +#: ../../reference/lexical_analysis.rst:113 msgid "Explicit line joining" msgstr "" -#: ../../reference/lexical_analysis.rst:116 +#: ../../reference/lexical_analysis.rst:117 msgid "" "Two or more physical lines may be joined into logical lines using backslash " "characters (``\\``), as follows: when a physical line ends in a backslash " @@ -148,7 +149,7 @@ msgid "" "following end-of-line character. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:122 +#: ../../reference/lexical_analysis.rst:123 msgid "" "if 1900 < year < 2100 and 1 <= month <= 12 \\\n" " and 1 <= day <= 31 and 0 <= hour < 24 \\\n" @@ -160,7 +161,7 @@ msgstr "" " and 0 <= minute < 60 and 0 <= second < 60: # 看起來像個有效日期\n" " return 1" -#: ../../reference/lexical_analysis.rst:127 +#: ../../reference/lexical_analysis.rst:128 msgid "" "A line ending in a backslash cannot carry a comment. A backslash does not " "continue a comment. A backslash does not continue a token except for string " @@ -169,17 +170,17 @@ msgid "" "line outside a string literal." msgstr "" -#: ../../reference/lexical_analysis.rst:137 +#: ../../reference/lexical_analysis.rst:138 msgid "Implicit line joining" msgstr "" -#: ../../reference/lexical_analysis.rst:139 +#: ../../reference/lexical_analysis.rst:140 msgid "" "Expressions in parentheses, square brackets or curly braces can be split " "over more than one physical line without using backslashes. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:142 +#: ../../reference/lexical_analysis.rst:143 msgid "" "month_names = ['Januari', 'Februari', 'Maart', # These are the\n" " 'April', 'Mei', 'Juni', # Dutch names\n" @@ -187,7 +188,7 @@ msgid "" " 'Oktober', 'November', 'December'] # of the year" msgstr "" -#: ../../reference/lexical_analysis.rst:147 +#: ../../reference/lexical_analysis.rst:148 msgid "" "Implicitly continued lines can carry comments. The indentation of the " "continuation lines is not important. Blank continuation lines are allowed. " @@ -196,11 +197,11 @@ msgid "" "that case they cannot carry comments." msgstr "" -#: ../../reference/lexical_analysis.rst:157 +#: ../../reference/lexical_analysis.rst:158 msgid "Blank lines" msgstr "" -#: ../../reference/lexical_analysis.rst:161 +#: ../../reference/lexical_analysis.rst:162 msgid "" "A logical line that contains only spaces, tabs, formfeeds and possibly a " "comment, is ignored (i.e., no NEWLINE token is generated). During " @@ -211,18 +212,18 @@ msgid "" "statement." msgstr "" -#: ../../reference/lexical_analysis.rst:172 +#: ../../reference/lexical_analysis.rst:173 msgid "Indentation" msgstr "" -#: ../../reference/lexical_analysis.rst:176 +#: ../../reference/lexical_analysis.rst:177 msgid "" "Leading whitespace (spaces and tabs) at the beginning of a logical line is " "used to compute the indentation level of the line, which in turn is used to " "determine the grouping of statements." msgstr "" -#: ../../reference/lexical_analysis.rst:180 +#: ../../reference/lexical_analysis.rst:181 msgid "" "Tabs are replaced (from left to right) by one to eight spaces such that the " "total number of characters up to and including the replacement is a multiple " @@ -233,14 +234,14 @@ msgid "" "the indentation." msgstr "" -#: ../../reference/lexical_analysis.rst:188 +#: ../../reference/lexical_analysis.rst:189 msgid "" "Indentation is rejected as inconsistent if a source file mixes tabs and " "spaces in a way that makes the meaning dependent on the worth of a tab in " "spaces; a :exc:`TabError` is raised in that case." msgstr "" -#: ../../reference/lexical_analysis.rst:192 +#: ../../reference/lexical_analysis.rst:193 msgid "" "**Cross-platform compatibility note:** because of the nature of text editors " "on non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for " @@ -248,7 +249,7 @@ msgid "" "different platforms may explicitly limit the maximum indentation level." msgstr "" -#: ../../reference/lexical_analysis.rst:197 +#: ../../reference/lexical_analysis.rst:198 msgid "" "A formfeed character may be present at the start of the line; it will be " "ignored for the indentation calculations above. Formfeed characters " @@ -256,13 +257,13 @@ msgid "" "instance, they may reset the space count to zero)." msgstr "" -#: ../../reference/lexical_analysis.rst:204 +#: ../../reference/lexical_analysis.rst:205 msgid "" "The indentation levels of consecutive lines are used to generate INDENT and " "DEDENT tokens, using a stack, as follows." msgstr "" -#: ../../reference/lexical_analysis.rst:207 +#: ../../reference/lexical_analysis.rst:208 msgid "" "Before the first line of the file is read, a single zero is pushed on the " "stack; this will never be popped off again. The numbers pushed on the stack " @@ -276,13 +277,13 @@ msgid "" "number remaining on the stack that is larger than zero." msgstr "" -#: ../../reference/lexical_analysis.rst:218 +#: ../../reference/lexical_analysis.rst:219 msgid "" "Here is an example of a correctly (though confusingly) indented piece of " "Python code::" msgstr "" -#: ../../reference/lexical_analysis.rst:221 +#: ../../reference/lexical_analysis.rst:222 msgid "" "def perm(l):\n" " # Compute the list of all permutations of l\n" @@ -297,11 +298,11 @@ msgid "" " return r" msgstr "" -#: ../../reference/lexical_analysis.rst:233 +#: ../../reference/lexical_analysis.rst:234 msgid "The following example shows various indentation errors::" msgstr "" -#: ../../reference/lexical_analysis.rst:235 +#: ../../reference/lexical_analysis.rst:236 msgid "" " def perm(l): # error: first line indented\n" "for i in range(len(l)): # error: not indented\n" @@ -312,18 +313,18 @@ msgid "" " return r # error: inconsistent dedent" msgstr "" -#: ../../reference/lexical_analysis.rst:243 +#: ../../reference/lexical_analysis.rst:244 msgid "" "(Actually, the first three errors are detected by the parser; only the last " "error is found by the lexical analyzer --- the indentation of ``return r`` " "does not match a level popped off the stack.)" msgstr "" -#: ../../reference/lexical_analysis.rst:251 +#: ../../reference/lexical_analysis.rst:252 msgid "Whitespace between tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:253 +#: ../../reference/lexical_analysis.rst:254 msgid "" "Except at the beginning of a logical line or in string literals, the " "whitespace characters space, tab and formfeed can be used interchangeably to " @@ -332,11 +333,11 @@ msgid "" "is one token, but a b is two tokens)." msgstr "" -#: ../../reference/lexical_analysis.rst:263 +#: ../../reference/lexical_analysis.rst:264 msgid "Other tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:265 +#: ../../reference/lexical_analysis.rst:266 msgid "" "Besides NEWLINE, INDENT and DEDENT, the following categories of tokens " "exist: *identifiers*, *keywords*, *literals*, *operators*, and *delimiters*. " @@ -346,118 +347,118 @@ msgid "" "from left to right." msgstr "" -#: ../../reference/lexical_analysis.rst:275 +#: ../../reference/lexical_analysis.rst:276 msgid "Identifiers and keywords" msgstr "" -#: ../../reference/lexical_analysis.rst:279 +#: ../../reference/lexical_analysis.rst:280 msgid "" "Identifiers (also referred to as *names*) are described by the following " "lexical definitions." msgstr "" -#: ../../reference/lexical_analysis.rst:282 +#: ../../reference/lexical_analysis.rst:283 msgid "" "The syntax of identifiers in Python is based on the Unicode standard annex " "UAX-31, with elaboration and changes as defined below; see also :pep:`3131` " "for further details." msgstr "" -#: ../../reference/lexical_analysis.rst:286 +#: ../../reference/lexical_analysis.rst:287 msgid "" "Within the ASCII range (U+0001..U+007F), the valid characters for " "identifiers include the uppercase and lowercase letters ``A`` through ``Z``, " "the underscore ``_`` and, except for the first character, the digits ``0`` " "through ``9``. Python 3.0 introduced additional characters from outside the " "ASCII range (see :pep:`3131`). For these characters, the classification " -"uses the version of the Unicode Character Database as included in the :mod:" -"`unicodedata` module." +"uses the version of the Unicode Character Database as included in " +"the :mod:`unicodedata` module." msgstr "" -#: ../../reference/lexical_analysis.rst:294 +#: ../../reference/lexical_analysis.rst:295 msgid "Identifiers are unlimited in length. Case is significant." msgstr "" -#: ../../reference/lexical_analysis.rst:303 +#: ../../reference/lexical_analysis.rst:304 msgid "The Unicode category codes mentioned above stand for:" msgstr "" -#: ../../reference/lexical_analysis.rst:305 +#: ../../reference/lexical_analysis.rst:306 msgid "*Lu* - uppercase letters" msgstr "*Lu* - 大寫字母" -#: ../../reference/lexical_analysis.rst:306 +#: ../../reference/lexical_analysis.rst:307 msgid "*Ll* - lowercase letters" msgstr "*Ll* - 小寫字母" -#: ../../reference/lexical_analysis.rst:307 +#: ../../reference/lexical_analysis.rst:308 msgid "*Lt* - titlecase letters" msgstr "" -#: ../../reference/lexical_analysis.rst:308 +#: ../../reference/lexical_analysis.rst:309 msgid "*Lm* - modifier letters" msgstr "" -#: ../../reference/lexical_analysis.rst:309 +#: ../../reference/lexical_analysis.rst:310 msgid "*Lo* - other letters" msgstr "*Lo* - 其他字母" -#: ../../reference/lexical_analysis.rst:310 +#: ../../reference/lexical_analysis.rst:311 msgid "*Nl* - letter numbers" msgstr "" -#: ../../reference/lexical_analysis.rst:311 +#: ../../reference/lexical_analysis.rst:312 msgid "*Mn* - nonspacing marks" msgstr "" -#: ../../reference/lexical_analysis.rst:312 +#: ../../reference/lexical_analysis.rst:313 msgid "*Mc* - spacing combining marks" msgstr "" -#: ../../reference/lexical_analysis.rst:313 +#: ../../reference/lexical_analysis.rst:314 msgid "*Nd* - decimal numbers" msgstr "*Nd* - 十進位數字" -#: ../../reference/lexical_analysis.rst:314 +#: ../../reference/lexical_analysis.rst:315 msgid "*Pc* - connector punctuations" msgstr "" -#: ../../reference/lexical_analysis.rst:315 +#: ../../reference/lexical_analysis.rst:316 msgid "" -"*Other_ID_Start* - explicit list of characters in `PropList.txt <https://www." -"unicode.org/Public/15.1.0/ucd/PropList.txt>`_ to support backwards " +"*Other_ID_Start* - explicit list of characters in `PropList.txt <https://" +"www.unicode.org/Public/15.1.0/ucd/PropList.txt>`_ to support backwards " "compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:318 +#: ../../reference/lexical_analysis.rst:319 msgid "*Other_ID_Continue* - likewise" msgstr "" -#: ../../reference/lexical_analysis.rst:320 +#: ../../reference/lexical_analysis.rst:321 msgid "" "All identifiers are converted into the normal form NFKC while parsing; " "comparison of identifiers is based on NFKC." msgstr "" -#: ../../reference/lexical_analysis.rst:323 +#: ../../reference/lexical_analysis.rst:324 msgid "" "A non-normative HTML file listing all valid identifier characters for " "Unicode 15.1.0 can be found at https://www.unicode.org/Public/15.1.0/ucd/" "DerivedCoreProperties.txt" msgstr "" -#: ../../reference/lexical_analysis.rst:331 +#: ../../reference/lexical_analysis.rst:332 msgid "Keywords" msgstr "關鍵字" -#: ../../reference/lexical_analysis.rst:337 +#: ../../reference/lexical_analysis.rst:338 msgid "" "The following identifiers are used as reserved words, or *keywords* of the " "language, and cannot be used as ordinary identifiers. They must be spelled " "exactly as written here:" msgstr "" -#: ../../reference/lexical_analysis.rst:341 +#: ../../reference/lexical_analysis.rst:342 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -475,11 +476,11 @@ msgstr "" "assert del global not with\n" "async elif if or yield" -#: ../../reference/lexical_analysis.rst:355 +#: ../../reference/lexical_analysis.rst:356 msgid "Soft Keywords" msgstr "軟關鍵字" -#: ../../reference/lexical_analysis.rst:361 +#: ../../reference/lexical_analysis.rst:362 msgid "" "Some identifiers are only reserved under specific contexts. These are known " "as *soft keywords*. The identifiers ``match``, ``case``, ``type`` and ``_`` " @@ -487,82 +488,82 @@ msgid "" "is done at the parser level, not when tokenizing." msgstr "" -#: ../../reference/lexical_analysis.rst:366 +#: ../../reference/lexical_analysis.rst:367 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" -#: ../../reference/lexical_analysis.rst:370 +#: ../../reference/lexical_analysis.rst:371 msgid "" "``match``, ``case``, and ``_`` are used in the :keyword:`match` statement. " "``type`` is used in the :keyword:`type` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:373 +#: ../../reference/lexical_analysis.rst:374 msgid "``type`` is now a soft keyword." msgstr "``type`` 現在是軟關鍵字。" -#: ../../reference/lexical_analysis.rst:382 +#: ../../reference/lexical_analysis.rst:383 msgid "Reserved classes of identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:384 +#: ../../reference/lexical_analysis.rst:385 msgid "" "Certain classes of identifiers (besides keywords) have special meanings. " "These classes are identified by the patterns of leading and trailing " "underscore characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:388 +#: ../../reference/lexical_analysis.rst:389 msgid "``_*``" msgstr "``_*``" -#: ../../reference/lexical_analysis.rst:389 +#: ../../reference/lexical_analysis.rst:390 msgid "Not imported by ``from module import *``." msgstr "" -#: ../../reference/lexical_analysis.rst:391 +#: ../../reference/lexical_analysis.rst:392 msgid "``_``" msgstr "``_``" -#: ../../reference/lexical_analysis.rst:392 +#: ../../reference/lexical_analysis.rst:393 msgid "" -"In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" -"`soft keyword <soft-keywords>` that denotes a :ref:`wildcard <wildcard-" -"patterns>`." +"In a ``case`` pattern within a :keyword:`match` statement, ``_`` is " +"a :ref:`soft keyword <soft-keywords>` that denotes a :ref:`wildcard " +"<wildcard-patterns>`." msgstr "" -#: ../../reference/lexical_analysis.rst:396 +#: ../../reference/lexical_analysis.rst:397 msgid "" "Separately, the interactive interpreter makes the result of the last " -"evaluation available in the variable ``_``. (It is stored in the :mod:" -"`builtins` module, alongside built-in functions like ``print``.)" +"evaluation available in the variable ``_``. (It is stored in " +"the :mod:`builtins` module, alongside built-in functions like ``print``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:401 +#: ../../reference/lexical_analysis.rst:402 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" -#: ../../reference/lexical_analysis.rst:406 +#: ../../reference/lexical_analysis.rst:407 msgid "" "The name ``_`` is often used in conjunction with internationalization; refer " "to the documentation for the :mod:`gettext` module for more information on " "this convention." msgstr "" -#: ../../reference/lexical_analysis.rst:410 +#: ../../reference/lexical_analysis.rst:411 msgid "It is also commonly used for unused variables." msgstr "" -#: ../../reference/lexical_analysis.rst:412 +#: ../../reference/lexical_analysis.rst:413 msgid "``__*__``" msgstr "``__*__``" -#: ../../reference/lexical_analysis.rst:413 +#: ../../reference/lexical_analysis.rst:414 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -572,11 +573,11 @@ msgid "" "explicitly documented use, is subject to breakage without warning." msgstr "" -#: ../../reference/lexical_analysis.rst:420 +#: ../../reference/lexical_analysis.rst:421 msgid "``__*``" msgstr "``__*``" -#: ../../reference/lexical_analysis.rst:421 +#: ../../reference/lexical_analysis.rst:422 msgid "" "Class-private names. Names in this category, when used within the context " "of a class definition, are re-written to use a mangled form to help avoid " @@ -584,33 +585,33 @@ msgid "" "section :ref:`atom-identifiers`." msgstr "" -#: ../../reference/lexical_analysis.rst:430 +#: ../../reference/lexical_analysis.rst:431 msgid "Literals" msgstr "" -#: ../../reference/lexical_analysis.rst:434 +#: ../../reference/lexical_analysis.rst:435 msgid "Literals are notations for constant values of some built-in types." msgstr "" -#: ../../reference/lexical_analysis.rst:445 +#: ../../reference/lexical_analysis.rst:446 msgid "String and Bytes literals" msgstr "" -#: ../../reference/lexical_analysis.rst:447 +#: ../../reference/lexical_analysis.rst:448 msgid "String literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:472 +#: ../../reference/lexical_analysis.rst:473 msgid "" "One syntactic restriction not indicated by these productions is that " "whitespace is not allowed between the :token:`~python-grammar:stringprefix` " "or :token:`~python-grammar:bytesprefix` and the rest of the literal. The " "source character set is defined by the encoding declaration; it is UTF-8 if " -"no encoding declaration is given in the source file; see section :ref:" -"`encodings`." +"no encoding declaration is given in the source file; see " +"section :ref:`encodings`." msgstr "" -#: ../../reference/lexical_analysis.rst:482 +#: ../../reference/lexical_analysis.rst:483 msgid "" "In plain English: Both types of literals can be enclosed in matching single " "quotes (``'``) or double quotes (``\"``). They can also be enclosed in " @@ -623,7 +624,7 @@ msgid "" "sequences>` below for examples." msgstr "" -#: ../../reference/lexical_analysis.rst:495 +#: ../../reference/lexical_analysis.rst:496 msgid "" "Bytes literals are always prefixed with ``'b'`` or ``'B'``; they produce an " "instance of the :class:`bytes` type instead of the :class:`str` type. They " @@ -631,7 +632,7 @@ msgid "" "greater must be expressed with escapes." msgstr "" -#: ../../reference/lexical_analysis.rst:504 +#: ../../reference/lexical_analysis.rst:505 msgid "" "Both string and bytes literals may optionally be prefixed with a letter " "``'r'`` or ``'R'``; such constructs are called :dfn:`raw string literals` " @@ -640,20 +641,20 @@ msgid "" "escapes are not treated specially." msgstr "" -#: ../../reference/lexical_analysis.rst:510 +#: ../../reference/lexical_analysis.rst:511 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: ../../reference/lexical_analysis.rst:514 +#: ../../reference/lexical_analysis.rst:515 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " -"simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" -"`414` for more information." +"simplify the maintenance of dual Python 2.x and 3.x codebases. " +"See :pep:`414` for more information." msgstr "" -#: ../../reference/lexical_analysis.rst:522 +#: ../../reference/lexical_analysis.rst:523 msgid "" "A string literal with ``'f'`` or ``'F'`` in its prefix is a :dfn:`formatted " "string literal`; see :ref:`f-strings`. The ``'f'`` may be combined with " @@ -661,7 +662,7 @@ msgid "" "are possible, but formatted bytes literals are not." msgstr "" -#: ../../reference/lexical_analysis.rst:527 +#: ../../reference/lexical_analysis.rst:528 msgid "" "In triple-quoted literals, unescaped newlines and quotes are allowed (and " "are retained), except that three unescaped quotes in a row terminate the " @@ -669,253 +670,253 @@ msgid "" "either ``'`` or ``\"``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:550 +#: ../../reference/lexical_analysis.rst:551 msgid "Escape sequences" msgstr "跳脫序列" -#: ../../reference/lexical_analysis.rst:552 +#: ../../reference/lexical_analysis.rst:553 msgid "" "Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Escape Sequence" msgstr "" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Meaning" msgstr "含義" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Notes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "``\\``\\ <newline>" msgstr "``\\``\\ <newline>" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "Backslash and newline ignored" msgstr "" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "\\(1)" msgstr "\\(1)" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:562 msgid "``\\\\``" msgstr "``\\\\``" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:562 msgid "Backslash (``\\``)" msgstr "" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:564 msgid "``\\'``" msgstr "``\\'``" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:564 msgid "Single quote (``'``)" msgstr "單引號 (``'``)" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:566 msgid "``\\\"``" msgstr "``\\\"``" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:566 msgid "Double quote (``\"``)" msgstr "雙引號 (``\"``)" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:568 msgid "``\\a``" msgstr "``\\a``" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:568 msgid "ASCII Bell (BEL)" msgstr "" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:570 msgid "``\\b``" msgstr "``\\b``" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:570 msgid "ASCII Backspace (BS)" msgstr "" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:572 msgid "``\\f``" msgstr "``\\f``" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:572 msgid "ASCII Formfeed (FF)" msgstr "" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:574 msgid "``\\n``" msgstr "``\\n``" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:574 msgid "ASCII Linefeed (LF)" msgstr "" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:576 msgid "``\\r``" msgstr "``\\r``" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:576 msgid "ASCII Carriage Return (CR)" msgstr "" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:578 msgid "``\\t``" msgstr "``\\t``" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:578 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:580 msgid "``\\v``" msgstr "``\\v``" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:580 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid ":samp:`\\\\\\\\{ooo}`" msgstr ":samp:`\\\\\\\\{ooo}`" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid "Character with octal value *ooo*" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid "(2,4)" msgstr "(2,4)" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid ":samp:`\\\\x{hh}`" msgstr ":samp:`\\\\x{hh}`" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid "Character with hex value *hh*" msgstr "" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid "(3,4)" msgstr "(3,4)" -#: ../../reference/lexical_analysis.rst:587 +#: ../../reference/lexical_analysis.rst:588 msgid "Escape sequences only recognized in string literals are:" msgstr "" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid "Character named *name* in the Unicode database" msgstr "" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid "\\(5)" msgstr "\\(5)" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid ":samp:`\\\\u{xxxx}`" msgstr ":samp:`\\\\u{xxxx}`" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid "Character with 16-bit hex value *xxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid "\\(6)" msgstr "\\(6)" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid ":samp:`\\\\U{xxxxxxxx}`" msgstr ":samp:`\\\\U{xxxxxxxx}`" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid "Character with 32-bit hex value *xxxxxxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid "\\(7)" msgstr "\\(7)" -#: ../../reference/lexical_analysis.rst:602 +#: ../../reference/lexical_analysis.rst:603 msgid "Notes:" msgstr "註解:" -#: ../../reference/lexical_analysis.rst:605 +#: ../../reference/lexical_analysis.rst:606 msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: ../../reference/lexical_analysis.rst:607 +#: ../../reference/lexical_analysis.rst:608 msgid "" ">>> 'This string will not include \\\n" "... backslashes or newline characters.'\n" "'This string will not include backslashes or newline characters.'" msgstr "" -#: ../../reference/lexical_analysis.rst:611 +#: ../../reference/lexical_analysis.rst:612 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "<strings>`, or parentheses and :ref:`string literal concatenation <string-" "concatenation>`." msgstr "" -#: ../../reference/lexical_analysis.rst:616 +#: ../../reference/lexical_analysis.rst:617 msgid "As in Standard C, up to three octal digits are accepted." msgstr "" -#: ../../reference/lexical_analysis.rst:618 +#: ../../reference/lexical_analysis.rst:619 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" -"`DeprecationWarning`." +"Octal escapes with value larger than ``0o377`` produce " +"a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:622 +#: ../../reference/lexical_analysis.rst:623 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" -"`SyntaxWarning`. In a future Python version they will be eventually a :exc:" -"`SyntaxError`." +"Octal escapes with value larger than ``0o377`` produce " +"a :exc:`SyntaxWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:629 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:631 +#: ../../reference/lexical_analysis.rst:632 msgid "" "In a bytes literal, hexadecimal and octal escapes denote the byte with the " "given value. In a string literal, these escapes denote a Unicode character " "with the given value." msgstr "" -#: ../../reference/lexical_analysis.rst:636 +#: ../../reference/lexical_analysis.rst:637 msgid "Support for name aliases [#]_ has been added." msgstr "" -#: ../../reference/lexical_analysis.rst:640 +#: ../../reference/lexical_analysis.rst:641 msgid "Exactly four hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:643 +#: ../../reference/lexical_analysis.rst:644 msgid "" "Any Unicode character can be encoded this way. Exactly eight hex digits are " "required." msgstr "" -#: ../../reference/lexical_analysis.rst:649 +#: ../../reference/lexical_analysis.rst:650 msgid "" "Unlike Standard C, all unrecognized escape sequences are left in the string " "unchanged, i.e., *the backslash is left in the result*. (This behavior is " @@ -925,17 +926,17 @@ msgid "" "category of unrecognized escapes for bytes literals." msgstr "" -#: ../../reference/lexical_analysis.rst:656 +#: ../../reference/lexical_analysis.rst:657 msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:659 +#: ../../reference/lexical_analysis.rst:660 msgid "" "Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " "Python version they will be eventually a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:664 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -948,11 +949,11 @@ msgid "" "continuation." msgstr "" -#: ../../reference/lexical_analysis.rst:676 +#: ../../reference/lexical_analysis.rst:677 msgid "String literal concatenation" msgstr "" -#: ../../reference/lexical_analysis.rst:678 +#: ../../reference/lexical_analysis.rst:679 msgid "" "Multiple adjacent string or bytes literals (delimited by whitespace), " "possibly using different quoting conventions, are allowed, and their meaning " @@ -962,14 +963,14 @@ msgid "" "lines, or even to add comments to parts of strings, for example::" msgstr "" -#: ../../reference/lexical_analysis.rst:685 +#: ../../reference/lexical_analysis.rst:686 msgid "" "re.compile(\"[A-Za-z_]\" # letter or underscore\n" " \"[A-Za-z0-9_]*\" # letter, digit or underscore\n" " )" msgstr "" -#: ../../reference/lexical_analysis.rst:689 +#: ../../reference/lexical_analysis.rst:690 msgid "" "Note that this feature is defined at the syntactical level, but implemented " "at compile time. The '+' operator must be used to concatenate string " @@ -979,11 +980,11 @@ msgid "" "with plain string literals." msgstr "" -#: ../../reference/lexical_analysis.rst:712 +#: ../../reference/lexical_analysis.rst:713 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:716 +#: ../../reference/lexical_analysis.rst:717 msgid "" "A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " "that is prefixed with ``'f'`` or ``'F'``. These strings may contain " @@ -992,14 +993,14 @@ msgid "" "are really expressions evaluated at run time." msgstr "" -#: ../../reference/lexical_analysis.rst:722 +#: ../../reference/lexical_analysis.rst:723 msgid "" "Escape sequences are decoded like in ordinary string literals (except when a " "literal is also marked as a raw string). After decoding, the grammar for " "the contents of the string is:" msgstr "" -#: ../../reference/lexical_analysis.rst:736 +#: ../../reference/lexical_analysis.rst:737 msgid "" "The parts of the string outside curly braces are treated literally, except " "that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " @@ -1012,7 +1013,7 @@ msgid "" "replacement field ends with a closing curly bracket ``'}'``." msgstr "" -#: ../../reference/lexical_analysis.rst:746 +#: ../../reference/lexical_analysis.rst:747 msgid "" "Expressions in formatted string literals are treated like regular Python " "expressions surrounded by parentheses, with a few exceptions. An empty " @@ -1026,27 +1027,27 @@ msgid "" "replacement fields must be closed in a different line." msgstr "" -#: ../../reference/lexical_analysis.rst:757 +#: ../../reference/lexical_analysis.rst:758 msgid "" ">>> f\"abc{a # This is a comment }\"\n" "... + 3}\"\n" "'abc5'" msgstr "" -#: ../../reference/lexical_analysis.rst:763 +#: ../../reference/lexical_analysis.rst:764 msgid "" "Prior to Python 3.7, an :keyword:`await` expression and comprehensions " "containing an :keyword:`async for` clause were illegal in the expressions in " "formatted string literals due to a problem with the implementation." msgstr "" -#: ../../reference/lexical_analysis.rst:768 +#: ../../reference/lexical_analysis.rst:769 msgid "" "Prior to Python 3.12, comments were not allowed inside f-string replacement " "fields." msgstr "" -#: ../../reference/lexical_analysis.rst:772 +#: ../../reference/lexical_analysis.rst:773 msgid "" "When the equal sign ``'='`` is provided, the output will have the expression " "text, the ``'='`` and the evaluated value. Spaces after the opening brace " @@ -1057,18 +1058,18 @@ msgid "" "r'`` is declared." msgstr "" -#: ../../reference/lexical_analysis.rst:780 +#: ../../reference/lexical_analysis.rst:781 msgid "The equal sign ``'='``." msgstr "等號 ``'='``。" -#: ../../reference/lexical_analysis.rst:783 +#: ../../reference/lexical_analysis.rst:784 msgid "" "If a conversion is specified, the result of evaluating the expression is " "converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " "result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." msgstr "" -#: ../../reference/lexical_analysis.rst:787 +#: ../../reference/lexical_analysis.rst:788 msgid "" "The result is then formatted using the :func:`format` protocol. The format " "specifier is passed to the :meth:`~object.__format__` method of the " @@ -1077,7 +1078,7 @@ msgid "" "value of the whole string." msgstr "" -#: ../../reference/lexical_analysis.rst:793 +#: ../../reference/lexical_analysis.rst:794 msgid "" "Top-level format specifiers may include nested replacement fields. These " "nested fields may include their own conversion fields and :ref:`format " @@ -1086,17 +1087,17 @@ msgid "" "as that used by the :meth:`str.format` method." msgstr "" -#: ../../reference/lexical_analysis.rst:799 +#: ../../reference/lexical_analysis.rst:800 msgid "" "Formatted string literals may be concatenated, but replacement fields cannot " "be split across literals." msgstr "" -#: ../../reference/lexical_analysis.rst:802 +#: ../../reference/lexical_analysis.rst:803 msgid "Some examples of formatted string literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:804 +#: ../../reference/lexical_analysis.rst:805 msgid "" ">>> name = \"Fred\"\n" ">>> f\"He said his name is {name!r}.\"\n" @@ -1128,13 +1129,13 @@ msgid "" "'line = \"The mill\\'s closed\" '" msgstr "" -#: ../../reference/lexical_analysis.rst:834 +#: ../../reference/lexical_analysis.rst:835 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:837 +#: ../../reference/lexical_analysis.rst:838 msgid "" ">>> a = dict(x=2)\n" ">>> f\"abc {a[\"x\"]} def\"\n" @@ -1144,19 +1145,19 @@ msgstr "" ">>> f\"abc {a[\"x\"]} def\"\n" "'abc 2 def'" -#: ../../reference/lexical_analysis.rst:841 +#: ../../reference/lexical_analysis.rst:842 msgid "" "Prior to Python 3.12, reuse of the same quoting type of the outer f-string " "inside a replacement field was not possible." msgstr "" -#: ../../reference/lexical_analysis.rst:845 +#: ../../reference/lexical_analysis.rst:846 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" -#: ../../reference/lexical_analysis.rst:848 +#: ../../reference/lexical_analysis.rst:849 msgid "" ">>> a = [\"a\", \"b\", \"c\"]\n" ">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" @@ -1172,19 +1173,19 @@ msgstr "" "b\n" "c" -#: ../../reference/lexical_analysis.rst:855 +#: ../../reference/lexical_analysis.rst:856 msgid "" "Prior to Python 3.12, backslashes were not permitted inside an f-string " "replacement field." msgstr "" -#: ../../reference/lexical_analysis.rst:859 +#: ../../reference/lexical_analysis.rst:860 msgid "" "Formatted string literals cannot be used as docstrings, even if they do not " "include expressions." msgstr "" -#: ../../reference/lexical_analysis.rst:864 +#: ../../reference/lexical_analysis.rst:865 msgid "" ">>> def foo():\n" "... f\"Not a docstring\"\n" @@ -1193,63 +1194,63 @@ msgid "" "True" msgstr "" -#: ../../reference/lexical_analysis.rst:870 +#: ../../reference/lexical_analysis.rst:871 msgid "" "See also :pep:`498` for the proposal that added formatted string literals, " "and :meth:`str.format`, which uses a related format string mechanism." msgstr "" -#: ../../reference/lexical_analysis.rst:877 +#: ../../reference/lexical_analysis.rst:878 msgid "Numeric literals" msgstr "" -#: ../../reference/lexical_analysis.rst:883 +#: ../../reference/lexical_analysis.rst:884 msgid "" "There are three types of numeric literals: integers, floating-point numbers, " "and imaginary numbers. There are no complex literals (complex numbers can " "be formed by adding a real number and an imaginary number)." msgstr "" -#: ../../reference/lexical_analysis.rst:887 +#: ../../reference/lexical_analysis.rst:888 msgid "" "Note that numeric literals do not include a sign; a phrase like ``-1`` is " "actually an expression composed of the unary operator '``-``' and the " "literal ``1``." msgstr "" -#: ../../reference/lexical_analysis.rst:901 +#: ../../reference/lexical_analysis.rst:902 msgid "Integer literals" msgstr "" -#: ../../reference/lexical_analysis.rst:903 +#: ../../reference/lexical_analysis.rst:904 msgid "Integer literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:917 +#: ../../reference/lexical_analysis.rst:918 msgid "" "There is no limit for the length of integer literals apart from what can be " "stored in available memory." msgstr "" -#: ../../reference/lexical_analysis.rst:920 +#: ../../reference/lexical_analysis.rst:921 msgid "" "Underscores are ignored for determining the numeric value of the literal. " "They can be used to group digits for enhanced readability. One underscore " "can occur between digits, and after base specifiers like ``0x``." msgstr "" -#: ../../reference/lexical_analysis.rst:924 +#: ../../reference/lexical_analysis.rst:925 msgid "" "Note that leading zeros in a non-zero decimal number are not allowed. This " "is for disambiguation with C-style octal literals, which Python used before " "version 3.0." msgstr "" -#: ../../reference/lexical_analysis.rst:928 +#: ../../reference/lexical_analysis.rst:929 msgid "Some examples of integer literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:930 +#: ../../reference/lexical_analysis.rst:931 msgid "" "7 2147483647 0o177 0b100110111\n" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" @@ -1259,21 +1260,21 @@ msgstr "" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" " 100_000_000_000 0b_1110_0101" -#: ../../reference/lexical_analysis.rst:934 -#: ../../reference/lexical_analysis.rst:966 +#: ../../reference/lexical_analysis.rst:935 +#: ../../reference/lexical_analysis.rst:967 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: ../../reference/lexical_analysis.rst:945 +#: ../../reference/lexical_analysis.rst:946 msgid "Floating-point literals" msgstr "浮點數常數 (Floating-point literals)" -#: ../../reference/lexical_analysis.rst:947 +#: ../../reference/lexical_analysis.rst:948 msgid "" "Floating-point literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:957 +#: ../../reference/lexical_analysis.rst:958 msgid "" "Note that the integer and exponent parts are always interpreted using radix " "10. For example, ``077e010`` is legal, and denotes the same number as " @@ -1282,23 +1283,23 @@ msgid "" "grouping." msgstr "" -#: ../../reference/lexical_analysis.rst:962 +#: ../../reference/lexical_analysis.rst:963 msgid "Some examples of floating-point literals::" msgstr "一些浮點數常數的範例: ::" -#: ../../reference/lexical_analysis.rst:964 +#: ../../reference/lexical_analysis.rst:965 msgid "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" msgstr "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" -#: ../../reference/lexical_analysis.rst:975 +#: ../../reference/lexical_analysis.rst:976 msgid "Imaginary literals" msgstr "" -#: ../../reference/lexical_analysis.rst:977 +#: ../../reference/lexical_analysis.rst:978 msgid "Imaginary literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:982 +#: ../../reference/lexical_analysis.rst:983 msgid "" "An imaginary literal yields a complex number with a real part of 0.0. " "Complex numbers are represented as a pair of floating-point numbers and have " @@ -1307,19 +1308,19 @@ msgid "" "Some examples of imaginary literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:988 +#: ../../reference/lexical_analysis.rst:989 msgid "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" msgstr "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" -#: ../../reference/lexical_analysis.rst:994 +#: ../../reference/lexical_analysis.rst:995 msgid "Operators" msgstr "" -#: ../../reference/lexical_analysis.rst:998 +#: ../../reference/lexical_analysis.rst:999 msgid "The following tokens are operators:" msgstr "" -#: ../../reference/lexical_analysis.rst:1000 +#: ../../reference/lexical_analysis.rst:1001 msgid "" "+ - * ** / // % @\n" "<< >> & | ^ ~ :=\n" @@ -1329,15 +1330,15 @@ msgstr "" "<< >> & | ^ ~ :=\n" "< > <= >= == !=" -#: ../../reference/lexical_analysis.rst:1011 +#: ../../reference/lexical_analysis.rst:1012 msgid "Delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:1015 +#: ../../reference/lexical_analysis.rst:1016 msgid "The following tokens serve as delimiters in the grammar:" msgstr "" -#: ../../reference/lexical_analysis.rst:1017 +#: ../../reference/lexical_analysis.rst:1018 msgid "" "( ) [ ] { }\n" ", : ! . ; @ =\n" @@ -1349,7 +1350,7 @@ msgstr "" "-> += -= *= /= //= %=\n" "@= &= |= ^= >>= <<= **=" -#: ../../reference/lexical_analysis.rst:1024 +#: ../../reference/lexical_analysis.rst:1025 msgid "" "The period can also occur in floating-point and imaginary literals. A " "sequence of three periods has a special meaning as an ellipsis literal. The " @@ -1357,31 +1358,31 @@ msgid "" "as delimiters, but also perform an operation." msgstr "" -#: ../../reference/lexical_analysis.rst:1029 +#: ../../reference/lexical_analysis.rst:1030 msgid "" "The following printing ASCII characters have special meaning as part of " "other tokens or are otherwise significant to the lexical analyzer:" msgstr "" -#: ../../reference/lexical_analysis.rst:1032 +#: ../../reference/lexical_analysis.rst:1033 msgid "' \" # \\" msgstr "' \" # \\" -#: ../../reference/lexical_analysis.rst:1036 +#: ../../reference/lexical_analysis.rst:1037 msgid "" "The following printing ASCII characters are not used in Python. Their " "occurrence outside string literals and comments is an unconditional error:" msgstr "" -#: ../../reference/lexical_analysis.rst:1039 +#: ../../reference/lexical_analysis.rst:1040 msgid "$ ? `" msgstr "$ ? `" -#: ../../reference/lexical_analysis.rst:1045 +#: ../../reference/lexical_analysis.rst:1046 msgid "Footnotes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:1046 +#: ../../reference/lexical_analysis.rst:1047 msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" @@ -1397,415 +1398,415 @@ msgstr "parser(剖析器)" msgid "token" msgstr "token" -#: ../../reference/lexical_analysis.rst:25 +#: ../../reference/lexical_analysis.rst:26 msgid "line structure" msgstr "line structure(列結構)" -#: ../../reference/lexical_analysis.rst:35 +#: ../../reference/lexical_analysis.rst:36 msgid "logical line" msgstr "logical line(邏輯列)" -#: ../../reference/lexical_analysis.rst:35 -#: ../../reference/lexical_analysis.rst:114 -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:36 +#: ../../reference/lexical_analysis.rst:115 +#: ../../reference/lexical_analysis.rst:532 msgid "physical line" msgstr "physical line(物理列)" -#: ../../reference/lexical_analysis.rst:35 -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:36 +#: ../../reference/lexical_analysis.rst:115 msgid "line joining" msgstr "line joining(列連接)" -#: ../../reference/lexical_analysis.rst:35 +#: ../../reference/lexical_analysis.rst:36 msgid "NEWLINE token" msgstr "NEWLINE token(換行標誌)" -#: ../../reference/lexical_analysis.rst:67 +#: ../../reference/lexical_analysis.rst:68 msgid "comment" msgstr "comment(註解)" -#: ../../reference/lexical_analysis.rst:67 +#: ../../reference/lexical_analysis.rst:68 msgid "hash character" msgstr "hash character(井字號)" -#: ../../reference/lexical_analysis.rst:67 -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:68 +#: ../../reference/lexical_analysis.rst:82 msgid "# (hash)" msgstr "# (井字號)" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "source character set" msgstr "source character set(原始字元集合)" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "encoding declarations (source file)" msgstr "encoding declarations (source file)(編碼宣告(原始檔案))" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "source encoding declaration" msgstr "source encoding declaration(原始編碼宣告)" -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:115 msgid "line continuation" msgstr "line continuation(列延續)" -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:115 msgid "backslash character" msgstr "backslash character(反斜線字元)" -#: ../../reference/lexical_analysis.rst:159 +#: ../../reference/lexical_analysis.rst:160 msgid "blank line" msgstr "blank line(空白列)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "indentation" msgstr "indentation(縮排)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "leading whitespace" msgstr "leading whitespace(前置空白)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "space" msgstr "space(空白)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "tab" msgstr "tab(定位字元)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "grouping" msgstr "grouping(群組)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "statement grouping" msgstr "statement grouping(陳述式群組)" -#: ../../reference/lexical_analysis.rst:202 +#: ../../reference/lexical_analysis.rst:203 msgid "INDENT token" msgstr "INDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:202 +#: ../../reference/lexical_analysis.rst:203 msgid "DEDENT token" msgstr "DEDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:277 +#: ../../reference/lexical_analysis.rst:278 msgid "identifier" msgstr "identifier(識別器)" -#: ../../reference/lexical_analysis.rst:277 +#: ../../reference/lexical_analysis.rst:278 msgid "name" msgstr "name(名稱)" -#: ../../reference/lexical_analysis.rst:333 -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:334 +#: ../../reference/lexical_analysis.rst:358 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/lexical_analysis.rst:333 +#: ../../reference/lexical_analysis.rst:334 msgid "reserved word" msgstr "reserved word(保留字)" -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:358 msgid "soft keyword" msgstr "soft keyword(軟關鍵字)" -#: ../../reference/lexical_analysis.rst:376 +#: ../../reference/lexical_analysis.rst:377 msgid "_, identifiers" msgstr "_, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:376 +#: ../../reference/lexical_analysis.rst:377 msgid "__, identifiers" msgstr "__, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:432 +#: ../../reference/lexical_analysis.rst:433 msgid "literal" msgstr "literal(常數)" -#: ../../reference/lexical_analysis.rst:432 +#: ../../reference/lexical_analysis.rst:433 msgid "constant" msgstr "constant(常數)" -#: ../../reference/lexical_analysis.rst:437 -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:479 msgid "string literal" msgstr "string literal(字串常數)" -#: ../../reference/lexical_analysis.rst:437 -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:492 msgid "bytes literal" msgstr "bytes literal(位元組常數)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "ASCII" msgstr "ASCII" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "' (single quote)" msgstr "' (單引號)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "\" (double quote)" msgstr "\" (雙引號)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "u'" msgstr "u'" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "u\"" msgstr "u\"" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "triple-quoted string" msgstr "triple-quoted string(三引號字串)" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "Unicode Consortium" msgstr "Unicode Consortium" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "raw string" msgstr "raw string(原始字串)" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "\"\"\"" msgstr "\"\"\"" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "'''" msgstr "'''" -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:492 msgid "b'" msgstr "b'" -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:492 msgid "b\"" msgstr "b\"" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "r'" msgstr "r'" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "raw string literal" msgstr "raw string literal(原始字串常數)" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "r\"" msgstr "r\"" -#: ../../reference/lexical_analysis.rst:518 +#: ../../reference/lexical_analysis.rst:519 msgid "f'" msgstr "f'" -#: ../../reference/lexical_analysis.rst:518 -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:519 +#: ../../reference/lexical_analysis.rst:697 msgid "formatted string literal" msgstr "formatted string literal(格式化字串常數)" -#: ../../reference/lexical_analysis.rst:518 +#: ../../reference/lexical_analysis.rst:519 msgid "f\"" msgstr "f\"" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "escape sequence" msgstr "escape sequence(跳脫序列)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "Standard C" msgstr "Standard C(標準 C)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\\\" msgstr "\\\\" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\a" msgstr "\\a" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\b" msgstr "\\b" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\f" msgstr "\\f" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\n" msgstr "\\n" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\r" msgstr "\\r" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\t" msgstr "\\t" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\v" msgstr "\\v" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\x" msgstr "\\x" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\N" msgstr "\\N" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\u" msgstr "\\u" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\U" msgstr "\\U" -#: ../../reference/lexical_analysis.rst:647 +#: ../../reference/lexical_analysis.rst:648 msgid "unrecognized escape sequence" msgstr "unrecognized escape sequence(無法辨識的跳脫序列)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "string" msgstr "string(字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "for help in debugging using string literals" msgstr "for help in debugging using string literals(使用字串常數進行除錯)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "number" msgstr "number(數字)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "numeric literal" msgstr "numeric literal(數值常數)" -#: ../../reference/lexical_analysis.rst:879 -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:893 msgid "integer literal" msgstr "integer literal(整數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "floating-point literal" msgstr "floating-point literal(浮點數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "hexadecimal literal" msgstr "hexadecimal literal(十六進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "octal literal" msgstr "octal literal(八進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "binary literal" msgstr "binary literal(二進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "decimal literal" msgstr "decimal literal(十進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "imaginary literal" msgstr "imaginary literal(虛數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "complex literal" msgstr "complex literal(複數常數)" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0b" msgstr "0b" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0o" msgstr "0o" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0x" msgstr "0x" -#: ../../reference/lexical_analysis.rst:892 -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:939 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../reference/lexical_analysis.rst:892 -#: ../../reference/lexical_analysis.rst:938 -#: ../../reference/lexical_analysis.rst:970 +#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:971 msgid "in numeric literal" msgstr "於數值常數中" -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:939 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:939 msgid "e" msgstr "e" -#: ../../reference/lexical_analysis.rst:970 +#: ../../reference/lexical_analysis.rst:971 msgid "j" msgstr "j" -#: ../../reference/lexical_analysis.rst:996 +#: ../../reference/lexical_analysis.rst:997 msgid "operators" msgstr "operators(運算子)" -#: ../../reference/lexical_analysis.rst:1013 +#: ../../reference/lexical_analysis.rst:1014 msgid "delimiters" msgstr "delimiters(分隔符號)" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index b29815534b..d54049a3af 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-12-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -203,9 +203,9 @@ msgid "" "must yield an integer. If it is negative, the sequence's length is added to " "it. The resulting value must be a nonnegative integer less than the " "sequence's length, and the sequence is asked to assign the assigned object " -"to its item with that index. If the index is out of range, :exc:" -"`IndexError` is raised (assignment to a subscripted sequence cannot add new " -"items to a list)." +"to its item with that index. If the index is out of " +"range, :exc:`IndexError` is raised (assignment to a subscripted sequence " +"cannot add new items to a list)." msgstr "" #: ../../reference/simple_stmts.rst:211 @@ -262,6 +262,10 @@ msgid "" "i, x[i] = 1, 2 # i is updated, then x[i] is updated\n" "print(x)" msgstr "" +"x = [0, 1]\n" +"i = 0\n" +"i, x[i] = 1, 2 # i 先被更新,然後 x[i] 再被更新\n" +"print(x)" #: ../../reference/simple_stmts.rst:254 msgid ":pep:`3132` - Extended Iterable Unpacking" @@ -273,7 +277,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:261 msgid "Augmented assignment statements" -msgstr "" +msgstr "擴增賦值陳述式" #: ../../reference/simple_stmts.rst:279 msgid "" @@ -331,7 +335,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:320 msgid "Annotated assignment statements" -msgstr "" +msgstr "註釋賦值陳述式" #: ../../reference/simple_stmts.rst:327 msgid "" @@ -339,6 +343,8 @@ msgid "" "single statement, of a variable or attribute annotation and an optional " "assignment statement:" msgstr "" +":term:`註釋 <variable annotation>` 賦值是將變數或屬性註釋與可選的賦值陳述式結" +"合在一個陳述式中:" #: ../../reference/simple_stmts.rst:334 msgid "" @@ -375,8 +381,8 @@ msgid "" "If the right hand side is present, an annotated assignment performs the " "actual assignment before evaluating annotations (where applicable). If the " "right hand side is not present for an expression target, then the " -"interpreter evaluates the target except for the last :meth:`~object." -"__setitem__` or :meth:`~object.__setattr__` call." +"interpreter evaluates the target except for the " +"last :meth:`~object.__setitem__` or :meth:`~object.__setattr__` call." msgstr "" #: ../../reference/simple_stmts.rst:361 @@ -392,7 +398,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:366 msgid ":pep:`484` - Type hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" #: ../../reference/simple_stmts.rst:367 msgid "" @@ -447,12 +453,13 @@ msgstr "" msgid "" "These equivalences assume that :const:`__debug__` and :exc:`AssertionError` " "refer to the built-in variables with those names. In the current " -"implementation, the built-in variable :const:`__debug__` is ``True`` under " -"normal circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for an " -"assert statement when optimization is requested at compile time. Note that " -"it is unnecessary to include the source code for the expression that failed " -"in the error message; it will be displayed as part of the stack trace." +"implementation, the built-in variable ``__debug__`` is ``True`` under normal " +"circumstances, ``False`` when optimization is requested (command line " +"option :option:`-O`). The current code generator emits no code for " +"an :keyword:`assert` statement when optimization is requested at compile " +"time. Note that it is unnecessary to include the source code for the " +"expression that failed in the error message; it will be displayed as part of " +"the stack trace." msgstr "" #: ../../reference/simple_stmts.rst:416 @@ -499,8 +506,8 @@ msgstr "" msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " -"statement in the same code block. If the name is unbound, a :exc:" -"`NameError` exception will be raised." +"statement in the same code block. If the name is unbound, " +"a :exc:`NameError` exception will be raised." msgstr "" #: ../../reference/simple_stmts.rst:471 @@ -550,16 +557,17 @@ msgstr "" msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " -"returned value (if any) is used as an argument to construct :exc:" -"`StopIteration` and becomes the :attr:`StopIteration.value` attribute." +"returned value (if any) is used as an argument to " +"construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` " +"attribute." msgstr "" #: ../../reference/simple_stmts.rst:513 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " -"indicates that the asynchronous generator is done and will cause :exc:" -"`StopAsyncIteration` to be raised. A non-empty :keyword:`!return` statement " -"is a syntax error in an asynchronous generator function." +"indicates that the asynchronous generator is done and will " +"cause :exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`!" +"return` statement is a syntax error in an asynchronous generator function." msgstr "" #: ../../reference/simple_stmts.rst:521 @@ -569,7 +577,7 @@ msgstr ":keyword:`!yield` 陳述式" #: ../../reference/simple_stmts.rst:533 msgid "" "A :keyword:`yield` statement is semantically equivalent to a :ref:`yield " -"expression <yieldexpr>`. The yield statement can be used to omit the " +"expression <yieldexpr>`. The ``yield`` statement can be used to omit the " "parentheses that would otherwise be required in the equivalent yield " "expression statement. For example, the yield statements ::" msgstr "" @@ -596,16 +604,17 @@ msgstr "" #: ../../reference/simple_stmts.rst:546 msgid "" -"Yield expressions and statements are only used when defining a :term:" -"`generator` function, and are only used in the body of the generator " -"function. Using yield in a function definition is sufficient to cause that " -"definition to create a generator function instead of a normal function." +"Yield expressions and statements are only used when defining " +"a :term:`generator` function, and are only used in the body of the generator " +"function. Using :keyword:`yield` in a function definition is sufficient to " +"cause that definition to create a generator function instead of a normal " +"function." msgstr "" #: ../../reference/simple_stmts.rst:551 msgid "" -"For full details of :keyword:`yield` semantics, refer to the :ref:" -"`yieldexpr` section." +"For full details of :keyword:`yield` semantics, refer to " +"the :ref:`yieldexpr` section." msgstr "" #: ../../reference/simple_stmts.rst:557 @@ -623,15 +632,15 @@ msgstr "" #: ../../reference/simple_stmts.rst:573 msgid "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " -"object. It must be either a subclass or an instance of :class:" -"`BaseException`. If it is a class, the exception instance will be obtained " -"when needed by instantiating the class with no arguments." +"object. It must be either a subclass or an instance " +"of :class:`BaseException`. If it is a class, the exception instance will be " +"obtained when needed by instantiating the class with no arguments." msgstr "" #: ../../reference/simple_stmts.rst:578 msgid "" -"The :dfn:`type` of the exception is the exception instance's class, the :dfn:" -"`value` is the instance itself." +"The :dfn:`type` of the exception is the exception instance's class, " +"the :dfn:`value` is the instance itself." msgstr "" #: ../../reference/simple_stmts.rst:583 @@ -701,8 +710,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:624 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " -"exception is already being handled. An exception may be handled when an :" -"keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"exception is already being handled. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " "statement, is used. The previous exception is then attached as the new " "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" @@ -773,9 +782,9 @@ msgstr "" #: ../../reference/simple_stmts.rst:664 msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information about handling exceptions is in section :ref:" -"`try`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information about handling exceptions is in " +"section :ref:`try`." msgstr "" #: ../../reference/simple_stmts.rst:667 @@ -802,8 +811,8 @@ msgstr ":keyword:`!break` 陳述式" #: ../../reference/simple_stmts.rst:693 msgid "" -":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" -"keyword:`while` loop, but not nested in a function or class definition " +":keyword:`break` may only occur syntactically nested in a :keyword:`for` " +"or :keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" @@ -861,8 +870,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:766 msgid "" -"define a name or names in the local namespace for the scope where the :" -"keyword:`import` statement occurs." +"define a name or names in the local namespace for the scope where " +"the :keyword:`import` statement occurs." msgstr "" #: ../../reference/simple_stmts.rst:769 @@ -891,8 +900,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:787 msgid "" -"If the module name is followed by :keyword:`!as`, then the name following :" -"keyword:`!as` is bound directly to the imported module." +"If the module name is followed by :keyword:`!as`, then the name " +"following :keyword:`!as` is bound directly to the imported module." msgstr "" #: ../../reference/simple_stmts.rst:789 @@ -954,10 +963,10 @@ msgid "" "import foo # foo imported and bound locally\n" "import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo " "bound locally\n" -"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as fbb\n" -"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as baz\n" +"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.baz bound as fbb\n" +"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.baz bound as baz\n" "from foo import attr # foo imported and foo.attr bound as attr" msgstr "" @@ -1014,8 +1023,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:866 msgid "" "Raises an :ref:`auditing event <auditing>` ``import`` with arguments " -"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." -"path_hooks``." +"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, " +"``sys.path_hooks``." msgstr "" "引發一個附帶引數 ``module``、``filename``、``sys.path``、``sys.meta_path``、" "``sys.path_hooks`` 的\\ :ref:`稽核事件 <auditing>` ``import``。" @@ -1123,11 +1132,11 @@ msgstr "" #: ../../reference/simple_stmts.rst:936 msgid "" -"Code compiled by calls to the built-in functions :func:`exec` and :func:" -"`compile` that occur in a module :mod:`!M` containing a future statement " -"will, by default, use the new syntax or semantics associated with the future " -"statement. This can be controlled by optional arguments to :func:`compile` " -"--- see the documentation of that function for details." +"Code compiled by calls to the built-in functions :func:`exec` " +"and :func:`compile` that occur in a module :mod:`!M` containing a future " +"statement will, by default, use the new syntax or semantics associated with " +"the future statement. This can be controlled by optional arguments " +"to :func:`compile` --- see the documentation of that function for details." msgstr "" #: ../../reference/simple_stmts.rst:942 @@ -1153,35 +1162,20 @@ msgstr ":keyword:`!global` 陳述式" #: ../../reference/simple_stmts.rst:967 msgid "" -"The :keyword:`global` statement is a declaration which holds for the entire " -"current code block. It means that the listed identifiers are to be " -"interpreted as globals. It would be impossible to assign to a global " +"The :keyword:`global` statement causes the listed identifiers to be " +"interpreted as globals. It would be impossible to assign to a global " "variable without :keyword:`!global`, although free variables may refer to " "globals without being declared global." msgstr "" -#: ../../reference/simple_stmts.rst:973 -msgid "" -"Names listed in a :keyword:`global` statement must not be used in the same " -"code block textually preceding that :keyword:`!global` statement." -msgstr "" - -#: ../../reference/simple_stmts.rst:976 -msgid "" -"Names listed in a :keyword:`global` statement must not be defined as formal " -"parameters, or as targets in :keyword:`with` statements or :keyword:`except` " -"clauses, or in a :keyword:`for` target list, :keyword:`class` definition, " -"function definition, :keyword:`import` statement, or variable annotation." -msgstr "" - -#: ../../reference/simple_stmts.rst:983 +#: ../../reference/simple_stmts.rst:972 msgid "" -"The current implementation does not enforce some of these restrictions, but " -"programs should not abuse this freedom, as future implementations may " -"enforce them or silently change the meaning of the program." +"The :keyword:`global` statement applies to the entire scope of a function or " +"class body. A :exc:`SyntaxError` is raised if a variable is used or assigned " +"to prior to its global declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:992 +#: ../../reference/simple_stmts.rst:981 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1189,15 +1183,15 @@ msgid "" "string or code object supplied to the built-in :func:`exec` function does " "not affect the code block *containing* the function call, and code contained " "in such a string is unaffected by :keyword:`!global` statements in the code " -"containing the function call. The same applies to the :func:`eval` and :" -"func:`compile` functions." +"containing the function call. The same applies to the :func:`eval` " +"and :func:`compile` functions." msgstr "" -#: ../../reference/simple_stmts.rst:1004 +#: ../../reference/simple_stmts.rst:993 msgid "The :keyword:`!nonlocal` statement" msgstr ":keyword:`!nonlocal` 陳述式" -#: ../../reference/simple_stmts.rst:1012 +#: ../../reference/simple_stmts.rst:1001 msgid "" "When the definition of a function or class is nested (enclosed) within the " "definitions of other functions, its nonlocal scopes are the local scopes of " @@ -1205,91 +1199,91 @@ msgid "" "identifiers to refer to names previously bound in nonlocal scopes. It allows " "encapsulated code to rebind such nonlocal identifiers. If a name is bound " "in more than one nonlocal scope, the nearest binding is used. If a name is " -"not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:" -"`SyntaxError` is raised." +"not bound in any nonlocal scope, or if there is no nonlocal scope, " +"a :exc:`SyntaxError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:1021 +#: ../../reference/simple_stmts.rst:1010 msgid "" -"The nonlocal statement applies to the entire scope of a function or class " -"body. A :exc:`SyntaxError` is raised if a variable is used or assigned to " -"prior to its nonlocal declaration in the scope." +"The :keyword:`nonlocal` statement applies to the entire scope of a function " +"or class body. A :exc:`SyntaxError` is raised if a variable is used or " +"assigned to prior to its nonlocal declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:1027 +#: ../../reference/simple_stmts.rst:1016 msgid ":pep:`3104` - Access to Names in Outer Scopes" msgstr "" -#: ../../reference/simple_stmts.rst:1028 +#: ../../reference/simple_stmts.rst:1017 msgid "The specification for the :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1030 +#: ../../reference/simple_stmts.rst:1019 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " -"applies only to code parsed along with it. See the note for the :keyword:" -"`global` statement." +"applies only to code parsed along with it. See the note for " +"the :keyword:`global` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1038 +#: ../../reference/simple_stmts.rst:1027 msgid "The :keyword:`!type` statement" msgstr ":keyword:`!type` 陳述式" -#: ../../reference/simple_stmts.rst:1045 +#: ../../reference/simple_stmts.rst:1034 msgid "" "The :keyword:`!type` statement declares a type alias, which is an instance " "of :class:`typing.TypeAliasType`." msgstr "" -#: ../../reference/simple_stmts.rst:1048 +#: ../../reference/simple_stmts.rst:1037 msgid "For example, the following statement creates a type alias::" msgstr "" -#: ../../reference/simple_stmts.rst:1050 +#: ../../reference/simple_stmts.rst:1039 msgid "type Point = tuple[float, float]" msgstr "" -#: ../../reference/simple_stmts.rst:1052 +#: ../../reference/simple_stmts.rst:1041 msgid "This code is roughly equivalent to::" msgstr "" -#: ../../reference/simple_stmts.rst:1054 +#: ../../reference/simple_stmts.rst:1043 msgid "" "annotation-def VALUE_OF_Point():\n" " return tuple[float, float]\n" "Point = typing.TypeAliasType(\"Point\", VALUE_OF_Point())" msgstr "" -#: ../../reference/simple_stmts.rst:1058 +#: ../../reference/simple_stmts.rst:1047 msgid "" "``annotation-def`` indicates an :ref:`annotation scope <annotation-scopes>`, " "which behaves mostly like a function, but with several small differences." msgstr "" -#: ../../reference/simple_stmts.rst:1061 +#: ../../reference/simple_stmts.rst:1050 msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " -"accessed through the type alias's :attr:`!__value__` attribute (see :ref:" -"`lazy-evaluation`). This allows the type alias to refer to names that are " -"not yet defined." +"accessed through the type alias's :attr:`!__value__` attribute " +"(see :ref:`lazy-evaluation`). This allows the type alias to refer to names " +"that are not yet defined." msgstr "" -#: ../../reference/simple_stmts.rst:1067 +#: ../../reference/simple_stmts.rst:1056 msgid "" "Type aliases may be made generic by adding a :ref:`type parameter list <type-" "params>` after the name. See :ref:`generic-type-aliases` for more." msgstr "" -#: ../../reference/simple_stmts.rst:1070 +#: ../../reference/simple_stmts.rst:1059 msgid ":keyword:`!type` is a :ref:`soft keyword <soft-keywords>`." msgstr "" -#: ../../reference/simple_stmts.rst:1076 +#: ../../reference/simple_stmts.rst:1065 msgid ":pep:`695` - Type Parameter Syntax" msgstr "" -#: ../../reference/simple_stmts.rst:1077 +#: ../../reference/simple_stmts.rst:1066 msgid "" "Introduced the :keyword:`!type` statement and syntax for generic classes and " "functions." @@ -1307,8 +1301,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:523 ../../reference/simple_stmts.rst:559 #: ../../reference/simple_stmts.rst:684 ../../reference/simple_stmts.rst:718 #: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:873 -#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 -#: ../../reference/simple_stmts.rst:1040 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:995 +#: ../../reference/simple_stmts.rst:1029 msgid "statement" msgstr "statement(陳述式)" @@ -1322,7 +1316,7 @@ msgstr "" msgid "list" msgstr "list(串列)" -#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:976 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -1374,7 +1368,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:75 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" #: ../../reference/simple_stmts.rst:75 msgid "assignment statement" @@ -1418,7 +1412,7 @@ msgstr "target" #: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:382 #: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:959 -#: ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:995 msgid ", (comma)" msgstr ", (逗號)" @@ -1748,26 +1742,26 @@ msgstr "__future__" msgid "future statement" msgstr "future statement(future 陳述式)" -#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:995 msgid "identifier list" msgstr "identifier list(識別符號清單)" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "exec" msgstr "exec" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "eval" msgstr "eval" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "compile" msgstr "compile(編譯)" -#: ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:995 msgid "nonlocal" msgstr "nonlocal" -#: ../../reference/simple_stmts.rst:1040 +#: ../../reference/simple_stmts.rst:1029 msgid "type" msgstr "" diff --git a/reference/toplevel_components.po b/reference/toplevel_components.po index 11726a155b..6e725c7a03 100644 --- a/reference/toplevel_components.po +++ b/reference/toplevel_components.po @@ -50,7 +50,7 @@ msgid "" "`__main__`. The latter is used to provide the local and global namespace " "for execution of the complete program." msgstr "" -"雖然語言規範描述不必規定語言直譯器是如何被調用(invoke)的,但對完整的 " +"雖然語言規範描述不必規定語言直譯器是如何被叫用(invoke)的,但對完整的 " "Python 程式加以說明還是很有用的。一個完整的 Python 程式會在最小初始化環境中被" "執行:所有內建和標準模組均為可用,但均處於未初始化狀態,只有 :mod:`sys`\\ " "(各種系統服務)、:mod:`builtins`\\ (內建函式、例外和 ``None``)和 :mod:" @@ -71,7 +71,7 @@ msgid "" "identical to that of a complete program; each statement is executed in the " "namespace of :mod:`__main__`." msgstr "" -"直譯器也可以透過互動模式被調用;在此情況下,它並不讀取和執行一個完整程式,而" +"直譯器也可以透過互動模式被叫用;在此情況下,它並不讀取和執行一個完整程式,而" "是每讀取一條陳述式就執行一次(可能為複合陳述式)。此時的初始環境與一個完整程" "式的相同;每條陳述式會在 :mod:`__main__` 的命名空間中被執行。" @@ -109,7 +109,7 @@ msgstr "剖析一個模組時;" #: ../../reference/toplevel_components.rst:78 msgid "when parsing a string passed to the :func:`exec` function;" -msgstr "剖析一個傳遞给 :func:`exec` 函数的字串時;" +msgstr "剖析一個傳遞给 :func:`exec` 函數的字串時;" #: ../../reference/toplevel_components.rst:84 msgid "Interactive input" diff --git a/sphinx.po b/sphinx.po index f044d5a9c6..5303cc5cfd 100644 --- a/sphinx.po +++ b/sphinx.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-04-16 00:15+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,6 +20,14 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.2.2\n" +#: ../../tools/templates/_docs_by_version.html:10 +msgid "Stable" +msgstr "穩定版本" + +#: ../../tools/templates/_docs_by_version.html:11 +msgid "In development" +msgstr "開發中" + #: ../../tools/templates/customsourcelink.html:3 msgid "This Page" msgstr "此頁面" @@ -37,15 +45,15 @@ msgstr "顯示原始碼" msgid "Download" msgstr "下載" -#: ../../tools/templates/download.html:16 +#: ../../tools/templates/download.html:30 msgid "Download Python %(dl_version)s Documentation" msgstr "下載 Python %(dl_version)s 說明文件" -#: ../../tools/templates/download.html:18 +#: ../../tools/templates/download.html:32 msgid "Last updated on: %(last_updated)s." msgstr "最後更新時間:%(last_updated)s。" -#: ../../tools/templates/download.html:20 +#: ../../tools/templates/download.html:34 msgid "" "To download an archive containing all the documents for this version of\n" "Python in one of various formats, follow one of links in this table." @@ -53,23 +61,23 @@ msgstr "" "要下載包含這個 Python 版本所有文件的歸檔,可以遵循這個表格中的其中一個連結," "以取得各種格式的文件。" -#: ../../tools/templates/download.html:25 +#: ../../tools/templates/download.html:39 msgid "Format" msgstr "格式" -#: ../../tools/templates/download.html:26 +#: ../../tools/templates/download.html:40 msgid "Packed as .zip" msgstr "打包成 .zip" -#: ../../tools/templates/download.html:27 +#: ../../tools/templates/download.html:41 msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" -#: ../../tools/templates/download.html:30 +#: ../../tools/templates/download.html:44 msgid "PDF" msgstr "PDF" -#: ../../tools/templates/download.html:31 +#: ../../tools/templates/download.html:45 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">Download</a> " "(ca. %(download_size)s MiB)" @@ -77,7 +85,7 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:32 +#: ../../tools/templates/download.html:46 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">Download</" "a> (ca. %(download_size)s MiB)" @@ -85,11 +93,11 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:49 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:36 +#: ../../tools/templates/download.html:50 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">Download</a> " "(ca. %(download_size)s MiB)" @@ -97,7 +105,7 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:37 +#: ../../tools/templates/download.html:51 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -105,11 +113,11 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:54 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:41 +#: ../../tools/templates/download.html:55 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">Download</a> " "(ca. %(download_size)s MiB)" @@ -117,7 +125,7 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:42 +#: ../../tools/templates/download.html:56 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -125,11 +133,11 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:59 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:46 +#: ../../tools/templates/download.html:60 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">Download</a> " "(ca. %(download_size)s MiB)" @@ -137,7 +145,7 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:47 +#: ../../tools/templates/download.html:61 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">Download</" "a> (ca. %(download_size)s MiB)" @@ -145,11 +153,11 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:50 +#: ../../tools/templates/download.html:64 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:51 +#: ../../tools/templates/download.html:65 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. " "%(download_size)s MiB)" @@ -157,15 +165,15 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:56 +#: ../../tools/templates/download.html:70 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:73 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:61 +#: ../../tools/templates/download.html:75 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -180,7 +188,7 @@ msgstr "" "net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" "快的下載時間。" -#: ../../tools/templates/download.html:67 +#: ../../tools/templates/download.html:81 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -188,11 +196,11 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:71 +#: ../../tools/templates/download.html:85 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:73 +#: ../../tools/templates/download.html:87 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" @@ -202,266 +210,270 @@ msgstr "" "docs@python.org\">docs@python.org</a>。" #: ../../tools/templates/dummy.html:6 -msgid "CPython implementation detail:" -msgstr "CPython 實作細節:" +msgid "Availability" +msgstr "適用" -#: ../../tools/templates/dummy.html:7 -msgid "" -"Deprecated since version {deprecated}, will be removed in version {removed}" -msgstr "自從版本 {deprecated} 後不推薦使用,將會自版本 {removed} 中移除。" - -#: ../../tools/templates/dummy.html:8 -msgid "Deprecated since version {deprecated}, removed in version {removed}" -msgstr "自從版本 {deprecated} 後不推薦使用,已從版本 {removed} 中移除。" - -#: ../../tools/templates/dummy.html:12 +#: ../../tools/templates/dummy.html:10 msgid "Part of the" msgstr "為" -#: ../../tools/templates/dummy.html:13 +#: ../../tools/templates/dummy.html:11 msgid "Limited API" msgstr "受限 API 的一部分" -#: ../../tools/templates/dummy.html:14 +#: ../../tools/templates/dummy.html:12 msgid "Stable ABI" msgstr "穩定 ABI 的一部分" -#: ../../tools/templates/dummy.html:15 +#: ../../tools/templates/dummy.html:13 msgid "(as an opaque struct)" msgstr "(做為一個不透明結構 (opaque struct))" -#: ../../tools/templates/dummy.html:16 +#: ../../tools/templates/dummy.html:14 msgid "(including all members)" msgstr "(包含所有成員)" -#: ../../tools/templates/dummy.html:17 +#: ../../tools/templates/dummy.html:15 msgid "since version %s" msgstr "自 %s 版本開始" -#: ../../tools/templates/dummy.html:18 +#: ../../tools/templates/dummy.html:16 msgid "(Only some members are part of the stable ABI.)" msgstr "(只有部分成員是穩定 ABI 的一部分。)" -#: ../../tools/templates/dummy.html:19 +#: ../../tools/templates/dummy.html:17 msgid "This is" msgstr "這是" -#: ../../tools/templates/dummy.html:20 +#: ../../tools/templates/dummy.html:18 msgid "Unstable API" msgstr "不穩定 API" -#: ../../tools/templates/dummy.html:21 +#: ../../tools/templates/dummy.html:19 msgid ". It may change without warning in minor releases." msgstr ",它可能在小版本發布中沒有任何警告地被變更。" -#: ../../tools/templates/dummy.html:22 +#: ../../tools/templates/dummy.html:20 msgid "Return value: Always NULL." msgstr "回傳值:總是為 NULL。" -#: ../../tools/templates/dummy.html:23 +#: ../../tools/templates/dummy.html:21 msgid "Return value: New reference." msgstr "回傳值:新的參照。" -#: ../../tools/templates/dummy.html:24 +#: ../../tools/templates/dummy.html:22 msgid "Return value: Borrowed reference." msgstr "回傳值:借用參照。" -#: ../../tools/templates/dummy.html:28 +#: ../../tools/templates/dummy.html:26 +msgid "CPython implementation detail:" +msgstr "CPython 實作細節:" + +#: ../../tools/templates/dummy.html:30 +msgid "" +"Deprecated since version {deprecated}, will be removed in version {removed}" +msgstr "自從版本 {deprecated} 後不推薦使用,將會自版本 {removed} 中移除。" + +#: ../../tools/templates/dummy.html:31 +msgid "Deprecated since version {deprecated}, removed in version {removed}" +msgstr "自從版本 {deprecated} 後不推薦使用,已從版本 {removed} 中移除。" + +#: ../../tools/templates/dummy.html:35 msgid "in development" msgstr "開發中" -#: ../../tools/templates/dummy.html:29 +#: ../../tools/templates/dummy.html:36 msgid "pre-release" msgstr "預發行" -#: ../../tools/templates/dummy.html:30 +#: ../../tools/templates/dummy.html:37 msgid "stable" msgstr "穩定版本" -#: ../../tools/templates/dummy.html:31 +#: ../../tools/templates/dummy.html:38 msgid "security-fixes" msgstr "安全性修護" -#: ../../tools/templates/dummy.html:32 +#: ../../tools/templates/dummy.html:39 msgid "EOL" msgstr "停止維護" -#: ../../tools/templates/indexcontent.html:8 +#: ../../tools/templates/indexcontent.html:21 msgid "Welcome! This is the official documentation for Python %(release)s." msgstr "歡迎!這是 Python %(release)s 的官方說明文件。" -#: ../../tools/templates/indexcontent.html:10 +#: ../../tools/templates/indexcontent.html:23 msgid "Documentation sections:" msgstr "文件章節:" -#: ../../tools/templates/indexcontent.html:13 +#: ../../tools/templates/indexcontent.html:26 msgid "What's new in Python %(version)s?" msgstr "Python %(version)s 有什麼新功能?" -#: ../../tools/templates/indexcontent.html:14 +#: ../../tools/templates/indexcontent.html:27 msgid "" "Or <a href=\"%(whatsnew_index)s\">all \"What's new\" documents since Python " "2.0</a>" msgstr "" "或<a href=\"%(whatsnew_index)s\">自 2.0 起的所有「有什麼新功能?」文件</a>" -#: ../../tools/templates/indexcontent.html:15 +#: ../../tools/templates/indexcontent.html:28 msgid "Tutorial" msgstr "Python 教學" -#: ../../tools/templates/indexcontent.html:16 +#: ../../tools/templates/indexcontent.html:29 msgid "Start here: a tour of Python's syntax and features" msgstr "從這裡開始:Python 的語法與特性導覽" -#: ../../tools/templates/indexcontent.html:17 +#: ../../tools/templates/indexcontent.html:30 msgid "Library reference" msgstr "函式庫參考手冊" -#: ../../tools/templates/indexcontent.html:18 +#: ../../tools/templates/indexcontent.html:31 msgid "Standard library and builtins" msgstr "標準函式庫與內建函式" -#: ../../tools/templates/indexcontent.html:19 +#: ../../tools/templates/indexcontent.html:32 msgid "Language reference" msgstr "語言參考手冊" -#: ../../tools/templates/indexcontent.html:20 +#: ../../tools/templates/indexcontent.html:33 msgid "Syntax and language elements" msgstr "語法及語言要素" -#: ../../tools/templates/indexcontent.html:21 +#: ../../tools/templates/indexcontent.html:34 msgid "Python setup and usage" msgstr "Python 的設置與使用" -#: ../../tools/templates/indexcontent.html:22 +#: ../../tools/templates/indexcontent.html:35 msgid "How to install, configure, and use Python" msgstr "如何安裝、設定與使用 Python" -#: ../../tools/templates/indexcontent.html:23 +#: ../../tools/templates/indexcontent.html:36 msgid "Python HOWTOs" msgstr "Python 如何達成任務" -#: ../../tools/templates/indexcontent.html:24 +#: ../../tools/templates/indexcontent.html:37 msgid "In-depth topic manuals" msgstr "深度主題說明手冊" -#: ../../tools/templates/indexcontent.html:26 +#: ../../tools/templates/indexcontent.html:39 msgid "Installing Python modules" msgstr "安裝 Python 模組" -#: ../../tools/templates/indexcontent.html:27 +#: ../../tools/templates/indexcontent.html:40 msgid "Third-party modules and PyPI.org" msgstr "第三方模組與 PyPI.org" -#: ../../tools/templates/indexcontent.html:28 +#: ../../tools/templates/indexcontent.html:41 msgid "Distributing Python modules" msgstr "發布 Python 模組" -#: ../../tools/templates/indexcontent.html:29 +#: ../../tools/templates/indexcontent.html:42 msgid "Publishing modules for use by other people" msgstr "發佈模組讓其他人可以使用" -#: ../../tools/templates/indexcontent.html:30 +#: ../../tools/templates/indexcontent.html:43 msgid "Extending and embedding" msgstr "擴充和嵌入" -#: ../../tools/templates/indexcontent.html:31 +#: ../../tools/templates/indexcontent.html:44 msgid "For C/C++ programmers" msgstr "給 C/C++ 程式設計師" -#: ../../tools/templates/indexcontent.html:32 +#: ../../tools/templates/indexcontent.html:45 msgid "Python's C API" msgstr "Python 的 C 應用程式介面 (API)" -#: ../../tools/templates/indexcontent.html:33 +#: ../../tools/templates/indexcontent.html:46 msgid "C API reference" msgstr "C API 參考手冊" -#: ../../tools/templates/indexcontent.html:34 +#: ../../tools/templates/indexcontent.html:47 msgid "FAQs" msgstr "常見問答集" -#: ../../tools/templates/indexcontent.html:35 +#: ../../tools/templates/indexcontent.html:48 msgid "Frequently asked questions (with answers!)" msgstr "常被提出的問題(還有答案!)" -#: ../../tools/templates/indexcontent.html:36 +#: ../../tools/templates/indexcontent.html:49 msgid "Deprecations" msgstr "棄用功能" -#: ../../tools/templates/indexcontent.html:37 +#: ../../tools/templates/indexcontent.html:50 msgid "Deprecated functionality" msgstr "已棄用的功能" -#: ../../tools/templates/indexcontent.html:41 +#: ../../tools/templates/indexcontent.html:54 msgid "Indices, glossary, and search:" msgstr "索引、術語表與搜尋:" -#: ../../tools/templates/indexcontent.html:44 +#: ../../tools/templates/indexcontent.html:57 msgid "Global module index" msgstr "全域模組索引" -#: ../../tools/templates/indexcontent.html:45 +#: ../../tools/templates/indexcontent.html:58 msgid "All modules and libraries" msgstr "所有模組與函式庫" -#: ../../tools/templates/indexcontent.html:46 +#: ../../tools/templates/indexcontent.html:59 msgid "General index" msgstr "總索引" -#: ../../tools/templates/indexcontent.html:47 +#: ../../tools/templates/indexcontent.html:60 msgid "All functions, classes, and terms" msgstr "全部函式、類別和術語" -#: ../../tools/templates/indexcontent.html:48 +#: ../../tools/templates/indexcontent.html:61 msgid "Glossary" msgstr "術語表" -#: ../../tools/templates/indexcontent.html:49 +#: ../../tools/templates/indexcontent.html:62 msgid "Terms explained" msgstr "術語解釋" -#: ../../tools/templates/indexcontent.html:51 +#: ../../tools/templates/indexcontent.html:64 msgid "Search page" msgstr "搜尋頁" -#: ../../tools/templates/indexcontent.html:52 +#: ../../tools/templates/indexcontent.html:65 msgid "Search this documentation" msgstr "搜尋這份說明文件" -#: ../../tools/templates/indexcontent.html:53 +#: ../../tools/templates/indexcontent.html:66 msgid "Complete table of contents" msgstr "完整內容列表" -#: ../../tools/templates/indexcontent.html:54 +#: ../../tools/templates/indexcontent.html:67 msgid "Lists all sections and subsections" msgstr "列出所有章節與小節" -#: ../../tools/templates/indexcontent.html:58 +#: ../../tools/templates/indexcontent.html:71 msgid "Project information:" msgstr "專案資訊:" -#: ../../tools/templates/indexcontent.html:61 +#: ../../tools/templates/indexcontent.html:74 msgid "Reporting issues" msgstr "回報問題" -#: ../../tools/templates/indexcontent.html:62 +#: ../../tools/templates/indexcontent.html:75 msgid "Contributing to Docs" msgstr "貢獻說明文件" -#: ../../tools/templates/indexcontent.html:63 +#: ../../tools/templates/indexcontent.html:76 msgid "Download the documentation" msgstr "下載說明文件" -#: ../../tools/templates/indexcontent.html:65 +#: ../../tools/templates/indexcontent.html:78 msgid "History and license of Python" msgstr "Python 的沿革與授權" -#: ../../tools/templates/indexcontent.html:66 +#: ../../tools/templates/indexcontent.html:79 msgid "Copyright" msgstr "版權" -#: ../../tools/templates/indexcontent.html:67 +#: ../../tools/templates/indexcontent.html:80 msgid "About the documentation" msgstr "關於說明文件" @@ -473,39 +485,31 @@ msgstr "下載這些說明文件" msgid "Docs by version" msgstr "各版本說明文件" -#: ../../tools/templates/indexsidebar.html:5 -msgid "Stable" -msgstr "穩定版本" - -#: ../../tools/templates/indexsidebar.html:6 -msgid "In development" -msgstr "開發中" - #: ../../tools/templates/indexsidebar.html:7 msgid "All versions" msgstr "所有版本" -#: ../../tools/templates/indexsidebar.html:10 +#: ../../tools/templates/indexsidebar.html:9 msgid "Other resources" msgstr "其他資源" -#: ../../tools/templates/indexsidebar.html:13 +#: ../../tools/templates/indexsidebar.html:12 msgid "PEP Index" msgstr "PEP 索引" -#: ../../tools/templates/indexsidebar.html:14 +#: ../../tools/templates/indexsidebar.html:13 msgid "Beginner's Guide" msgstr "初學者指南" -#: ../../tools/templates/indexsidebar.html:15 +#: ../../tools/templates/indexsidebar.html:14 msgid "Book List" msgstr "推薦書單" -#: ../../tools/templates/indexsidebar.html:16 +#: ../../tools/templates/indexsidebar.html:15 msgid "Audio/Visual Talks" msgstr "音訊/視訊演講" -#: ../../tools/templates/indexsidebar.html:17 +#: ../../tools/templates/indexsidebar.html:16 msgid "Python Developer’s Guide" msgstr "Python 開發者指南" @@ -517,7 +521,7 @@ msgstr "這份說明文件是寫給一個不再被支援的舊版 Python。你 #: ../../tools/templates/layout.html:8 msgid "Python documentation for the current stable release" -msgstr "當前穩定發行的 Python 版本說明文件" +msgstr "目前穩定發行的 Python 版本說明文件" #: ../../tools/templates/layout.html:14 msgid "" @@ -531,4 +535,4 @@ msgstr "" #: ../../tools/templates/layout.html:16 msgid "the current stable release" -msgstr "當前的穩定發行版" +msgstr "目前的穩定發行版" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index e96743c902..d2261fcbfd 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -188,7 +188,7 @@ msgid "" "want to use the startup file in a script, you must do this explicitly in the " "script::" msgstr "" -"如果你想從當前目錄中讀取一個額外的啟動檔案,你可以在全域啟動檔案中使用類似 " +"如果你想從目前目錄中讀取一個額外的啟動檔案,你可以在全域啟動檔案中使用類似 " "``if os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read()`` 的程" "式碼設定這個行為。如果你想在一個腳本中使用啟動檔案,你必須在腳本中明確地這樣" "做: ::" diff --git a/tutorial/classes.po b/tutorial/classes.po index 491479937b..388fa0b934 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -159,7 +159,7 @@ msgstr "" "*命名空間*\\ 是從名稱到物件的對映。大部分的命名空間現在都是以 Python 的 " "dictionary 被實作,但通常不會以任何方式被察覺(除了性能),且它可能會在未來改" "變。命名空間的例子有:內建名稱的集合(包含如 :func:`abs` 的函式,和內建的例外" -"名稱);模組中的全域 (global) 名稱;和在函式調用中的區域 (local) 名稱。某種意" +"名稱);模組中的全域 (global) 名稱;和在函式呼叫中的區域 (local) 名稱。某種意" "義上,物件中的屬性集合也會形成一個命名空間。關於命名空間的重要一點是,不同命" "名空間中的名稱之間絕對沒有關係;舉例來說,兩個不一樣的模組都可以定義一個 " "``maximize`` 函式而不會混淆——模組的使用者必須為它加上前綴 (prefix) 模組名稱。" @@ -209,7 +209,7 @@ msgstr "" "命名空間在不同的時刻被建立,並且有不同的壽命。當 Python 直譯器啟動時,含有內" "建名稱的命名空間會被建立,並且永遠不會被刪除。當模組定義被讀入時,模組的全域" "命名空間會被建立;一般情況下,模組的命名空間也會持續到直譯器結束。被直譯器的" -"頂層調用 (top-level invocation) 執行的陳述式,不論是從腳本檔案讀取的或是互動" +"頂層呼叫 (top-level invocation) 執行的陳述式,不論是從腳本檔案讀取的或是互動" "模式中的,會被視為一個稱為 :mod:`__main__` 的模組的一部分,因此它們具有自己的" "全域命名空間。(內建名稱實際上也存在一個模組中,它被稱為 :mod:`builtins`。)" @@ -223,7 +223,7 @@ msgid "" msgstr "" "函式的區域命名空間是在呼叫函式時建立的,而當函式返回,或引發了未在函式中處理" "的例外時,此命名空間將會被刪除。(實際上,忘記是描述實際發生的事情的更好方" -"法。) 當然,每個遞迴調用 (recursive invocation) 都有自己的區域命名空間。" +"法。) 當然,每個遞迴呼叫 (recursive invocation) 都有自己的區域命名空間。" #: ../../tutorial/classes.rst:112 msgid "" @@ -258,7 +258,7 @@ msgstr "" #: ../../tutorial/classes.rst:123 msgid "the next-to-last scope contains the current module's global names" -msgstr "倒數第二個作用域,包含當前模組的全域名稱" +msgstr "倒數第二個作用域,包含目前模組的全域名稱" #: ../../tutorial/classes.rst:124 msgid "" @@ -289,7 +289,7 @@ msgid "" "namespace as the global scope: the module's namespace. Class definitions " "place yet another namespace in the local scope." msgstr "" -"通常,區域作用域會參照(文本的)當前函式的區域名稱。在函式外部,區域作用域與" +"通常,區域作用域會參照(文本的)目前函式的區域名稱。在函式外部,區域作用域與" "全域作用域參照相同的命名空間:模組的命名空間。然而,Class definition 會在區域" "作用域中放置另一個命名空間。" @@ -587,7 +587,7 @@ msgid "" "by::" msgstr "" "當 class 定義了 :meth:`~object.__init__` method,class 實例化會為新建的 " -"class 實例自動調用 :meth:`!__init__`。所以在這個範例中,一個新的、初始化的實" +"class 實例自動叫用 :meth:`!__init__`。所以在這個範例中,一個新的、初始化的實" "例可以如此獲得: ::" #: ../../tutorial/classes.rst:305 @@ -1324,7 +1324,7 @@ msgstr "" "突),這種機制也存在另一個有限的支援,稱為 :dfn:`name mangling`\\ (名稱修" "飾)。任何格式為 ``__spam``\\ (至少兩個前導下底線,最多一個尾隨下底線)的物" "件名稱 (identifier) 會被文本地被替換為 ``_classname__spam``,在此 " -"``classname`` 就是去掉前導下底線的當前 class 名稱。只要這個修飾是在 class 的" +"``classname`` 就是去掉前導下底線的目前 class 名稱。只要這個修飾是在 class 的" "定義之中發生,它就會在不考慮該物件名稱的語法位置的情況下完成。" #: ../../tutorial/classes.rst:693 @@ -1394,8 +1394,8 @@ msgid "" "applies to ``getattr()``, ``setattr()`` and ``delattr()``, as well as when " "referencing ``__dict__`` directly." msgstr "" -"另外也注意,傳遞給 ``exec()`` 或 ``eval()`` 的程式碼不會把調用 class 的名稱視" -"為當前的 class;這和 ``global`` 陳述式的效果類似,該效果同樣僅限於整體被位元" +"另外也注意,傳遞給 ``exec()`` 或 ``eval()`` 的程式碼不會把叫用 class 的名稱視" +"為目前的 class;這和 ``global`` 陳述式的效果類似,該效果同樣僅限於整體被位元" "組編譯後 (byte-compiled) 的程式碼。同樣的限制適用於 ``getattr()``," "``setattr()`` 和 ``delattr()``,以及直接參照 ``__dict__`` 時。" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index b4bf143460..a33b54fa3a 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -64,9 +64,9 @@ msgstr "" msgid "" "There can be zero or more :keyword:`elif` parts, and the :keyword:`else` " "part is optional. The keyword ':keyword:`!elif`' is short for 'else if', " -"and is useful to avoid excessive indentation. An :keyword:`!if` ... :" -"keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the " -"``switch`` or ``case`` statements found in other languages." +"and is useful to avoid excessive indentation. An :keyword:`!" +"if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute " +"for the ``switch`` or ``case`` statements found in other languages." msgstr "" "在陳述式中,可以沒有或有許多個 :keyword:`elif` 敘述,且 :keyword:`else` 敘述" "並不是必要的。關鍵字 :keyword:`!elif` 是「else if」的縮寫,用來避免過多的縮" @@ -91,10 +91,10 @@ msgid "" "The :keyword:`for` statement in Python differs a bit from what you may be " "used to in C or Pascal. Rather than always iterating over an arithmetic " "progression of numbers (like in Pascal), or giving the user the ability to " -"define both the iteration step and halting condition (as C), Python's :" -"keyword:`!for` statement iterates over the items of any sequence (a list or " -"a string), in the order that they appear in the sequence. For example (no " -"pun intended):" +"define both the iteration step and halting condition (as C), " +"Python's :keyword:`!for` statement iterates over the items of any sequence " +"(a list or a string), in the order that they appear in the sequence. For " +"example (no pun intended):" msgstr "" "在 Python 中的 :keyword:`for` 陳述式有點不同於在 C 或 Pascal 中的慣用方式。相" "較於只能疊代 (iterate) 一個等差數列(如 Pascal),或給予使用者定義疊代步驟與" @@ -119,7 +119,7 @@ msgid "" "can be tricky to get right. Instead, it is usually more straight-forward to " "loop over a copy of the collection or to create a new collection::" msgstr "" -"在疊代一個集合的同時修改該集合的內容,很難獲取想要的結果。比較直觀的替代方" +"在疊代一個集合的同時修改該集合的內容,很難取得想要的結果。比較直觀的替代方" "式,是疊代該集合的副本,或建立一個新的集合: ::" #: ../../tutorial/controlflow.rst:76 @@ -145,8 +145,9 @@ msgstr ":func:`range` 函式" #: ../../tutorial/controlflow.rst:96 msgid "" -"If you do need to iterate over a sequence of numbers, the built-in function :" -"func:`range` comes in handy. It generates arithmetic progressions::" +"If you do need to iterate over a sequence of numbers, the built-in " +"function :func:`range` comes in handy. It generates arithmetic " +"progressions::" msgstr "" "如果你需要疊代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一" "等差數列: ::" @@ -266,12 +267,12 @@ msgstr "" msgid "" "We say such an object is :term:`iterable`, that is, suitable as a target for " "functions and constructs that expect something from which they can obtain " -"successive items until the supply is exhausted. We have seen that the :" -"keyword:`for` statement is such a construct, while an example of a function " -"that takes an iterable is :func:`sum`::" +"successive items until the supply is exhausted. We have seen that " +"the :keyword:`for` statement is such a construct, while an example of a " +"function that takes an iterable is :func:`sum`::" msgstr "" "我們稱這樣的物件為 :term:`iterable`\\ (可疊代物件),意即能作為函式及架構中" -"可以一直獲取項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" +"可以一直取得項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" "架構,另一個使用 iterable 的函式範例是 :func:`sum`: ::" #: ../../tutorial/controlflow.rst:154 @@ -288,8 +289,8 @@ msgid "" "arguments. In chapter :ref:`tut-structures`, we will discuss in more detail " "about :func:`list`." msgstr "" -"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在\\ :ref:" -"`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" +"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在" +"\\ :ref:`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 msgid ":keyword:`!break` and :keyword:`!continue` Statements" @@ -297,11 +298,11 @@ msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" -"The :keyword:`break` statement breaks out of the innermost enclosing :" -"keyword:`for` or :keyword:`while` loop::" +"The :keyword:`break` statement breaks out of the innermost " +"enclosing :keyword:`for` or :keyword:`while` loop::" msgstr "" -":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" -"`while` 迴圈: ::" +":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` " +"或 :keyword:`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" @@ -405,7 +406,7 @@ msgstr "" msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" -msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::" +msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜尋質數: ::" #: ../../tutorial/controlflow.rst:221 msgid "" @@ -454,11 +455,11 @@ msgid "" "occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" "handling`." msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" -"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" -"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " -"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" -"handling`。" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為" +"與 :keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 " +"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" +"任何 ``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見" +"\\ :ref:`tut-handling`。" #: ../../tutorial/controlflow.rst:257 msgid ":keyword:`!pass` Statements" @@ -697,8 +698,8 @@ msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " "variables would be set to what. Only the standalone names (like ``var`` " -"above) are assigned to by a match statement. Dotted names (like ``foo." -"bar``), attribute names (the ``x=`` and ``y=`` above) or class names " +"above) are assigned to by a match statement. Dotted names (like " +"``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names " "(recognized by the \"(...)\" next to them like ``Point`` above) are never " "assigned to." msgstr "" @@ -883,8 +884,8 @@ msgstr "" #: ../../tutorial/controlflow.rst:454 msgid "" -"For a more detailed explanation and additional examples, you can look into :" -"pep:`636` which is written in a tutorial format." +"For a more detailed explanation and additional examples, you can look " +"into :pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" @@ -926,12 +927,12 @@ msgstr "" #: ../../tutorial/controlflow.rst:487 msgid "" "The first statement of the function body can optionally be a string literal; " -"this string literal is the function's documentation string, or :dfn:" -"`docstring`. (More about docstrings can be found in the section :ref:`tut-" -"docstrings`.) There are tools which use docstrings to automatically produce " -"online or printed documentation, or to let the user interactively browse " -"through code; it's good practice to include docstrings in code that you " -"write, so make a habit of it." +"this string literal is the function's documentation string, " +"or :dfn:`docstring`. (More about docstrings can be found in the " +"section :ref:`tut-docstrings`.) There are tools which use docstrings to " +"automatically produce online or printed documentation, or to let the user " +"interactively browse through code; it's good practice to include docstrings " +"in code that you write, so make a habit of it." msgstr "" "一個函式的第一個陳述式可以是一個字串文本;該字串文本被視為該函式的說明文件字" "串,即 :dfn:`docstring`。(關於 docstring 的細節請參見\\ :ref:`tut-" @@ -957,8 +958,8 @@ msgstr "" "域符號表。然而,在引用一個變數時,會先從區域符號表開始搜尋,其次為外層函式的" "區域符號表,其次為全域符號表 (global symbol table),最後為所有內建的名稱。因" "此,在函式中,全域變數及外層函式變數雖然可以被引用,但無法被直接賦值(除非全" -"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" -"`nonlocal` 陳述式中被定義)。" +"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數" +"在 :keyword:`nonlocal` 陳述式中被定義)。" #: ../../tutorial/controlflow.rst:505 msgid "" @@ -981,7 +982,7 @@ msgid "" "to by that name as a user-defined function. Other names can also point to " "that same function object and can also be used to access the function::" msgstr "" -"函式定義時,會把該函式名稱加入至當前的符號表。函式名稱的值帶有一個型別,並被" +"函式定義時,會把該函式名稱加入至目前的符號表。函式名稱的值帶有一個型別,並被" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" @@ -1006,8 +1007,8 @@ msgid "" "without a :keyword:`return` statement do return a value, albeit a rather " "boring one. This value is called ``None`` (it's a built-in name). Writing " "the value ``None`` is normally suppressed by the interpreter if it would be " -"the only value written. You can see it if you really want to using :func:" -"`print`::" +"the only value written. You can see it if you really want to " +"using :func:`print`::" msgstr "" "如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure)," "因為它並沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述式,它" @@ -1052,9 +1053,9 @@ msgstr "這個例子一樣示範了一些新的 Python 特性:" #: ../../tutorial/controlflow.rst:552 msgid "" -"The :keyword:`return` statement returns with a value from a function. :" -"keyword:`!return` without an expression argument returns ``None``. Falling " -"off the end of a function also returns ``None``." +"The :keyword:`return` statement returns with a value from a " +"function. :keyword:`!return` without an expression argument returns " +"``None``. Falling off the end of a function also returns ``None``." msgstr "" ":keyword:`return` 陳述式會讓一個函式回傳一個值。單獨使用 :keyword:`!return` " "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " @@ -1068,8 +1069,8 @@ msgid "" "expression), and ``methodname`` is the name of a method that is defined by " "the object's type. Different types define different methods. Methods of " "different types may have the same name without causing ambiguity. (It is " -"possible to define your own object types and methods, using *classes*, see :" -"ref:`tut-classes`) The method :meth:`!append` shown in the example is " +"possible to define your own object types and methods, using *classes*, " +"see :ref:`tut-classes`) The method :meth:`!append` shown in the example is " "defined for list objects; it adds a new element at the end of the list. In " "this example it is equivalent to ``result = result + [a]``, but more " "efficient." @@ -1359,8 +1360,8 @@ msgid "" "positional arguments beyond the formal parameter list. (``*name`` must " "occur before ``**name``.) For example, if we define a function like this::" msgstr "" -"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳見 :ref:" -"`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" +"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳" +"見 :ref:`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" "``**name`` 可以與 ``*name`` 參數(下一小節介紹)組合使用,``*name`` 接收一" "個 :ref:`tuple <tut-tuples>`,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" @@ -1830,9 +1831,7 @@ msgid "" msgstr "" "通常,這些 *variadic*\\ (可變的)引數會出現在參數列表的最末端,這樣它們就可" "以把所有傳遞給函式的剩餘輸入引數都撈起來。出現在 ``*args`` 參數後面的任何參數" -"必須是「僅限關鍵字」引數,意即它們只能作為關鍵字引數,而不能用作位置引數。\n" -"\n" -"::" +"必須是「僅限關鍵字」引數,意即它們只能作為關鍵字引數,而不能用作位置引數。 ::" #: ../../tutorial/controlflow.rst:936 msgid "" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 2974c0a980..d466df73d1 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2024-12-07 00:14+0000\n" "PO-Revision-Date: 2024-01-22 21:43+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -160,6 +160,27 @@ msgid "" ">>> fruits.pop()\n" "'pear'" msgstr "" +">>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', " +"'banana']\n" +">>> fruits.count('apple')\n" +"2\n" +">>> fruits.count('tangerine')\n" +"0\n" +">>> fruits.index('banana')\n" +"3\n" +">>> fruits.index('banana', 4) # 從位置 4 開始找到下一個 banana\n" +"6\n" +">>> fruits.reverse()\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n" +">>> fruits.append('grape')\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n" +">>> fruits.sort()\n" +">>> fruits\n" +"['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n" +">>> fruits.pop()\n" +"'pear'" #: ../../tutorial/datastructures.rst:122 msgid "" @@ -193,14 +214,14 @@ msgstr "將 List 作為 Stack(堆疊)使用" msgid "" "The list methods make it very easy to use a list as a stack, where the last " "element added is the first element retrieved (\"last-in, first-out\"). To " -"add an item to the top of the stack, use :meth:`~list.append`. To retrieve " -"an item from the top of the stack, use :meth:`~list.pop` without an explicit " -"index. For example::" +"add an item to the top of the stack, use :meth:`!append`. To retrieve an " +"item from the top of the stack, use :meth:`!pop` without an explicit index. " +"For example::" msgstr "" "List 的操作方法使得它非常簡單可以用來實作 stack(堆疊)。Stack 為一個遵守最後" "加入元素最先被取回(後進先出,\"last-in, first-out\")規則的資料結構。你可以" -"使用方法 :meth:`~list.append` 將一個項目放到堆疊的頂層。而使用方法 :meth:" -"`~list.pop` 且不給定索引值去取得堆疊最上面的項目。舉例而言: ::" +"使用方法 :meth:`!append` 將一個項目放到堆疊的頂層。而使用方法 :meth:`!pop` 且" +"不給定索引值去取得堆疊最上面的項目。舉例而言: ::" #: ../../tutorial/datastructures.rst:148 msgid "" @@ -274,6 +295,16 @@ msgid "" ">>> queue # Remaining queue in order of arrival\n" "deque(['Michael', 'Terry', 'Graham'])" msgstr "" +">>> from collections import deque\n" +">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n" +">>> queue.append(\"Terry\") # Terry 加進來\n" +">>> queue.append(\"Graham\") # Graham 加進來\n" +">>> queue.popleft() # 第一個加進來的現在離開\n" +"'Eric'\n" +">>> queue.popleft() # 第二個加進來的現在離開\n" +"'John'\n" +">>> queue # queue 裡剩下的會按照加進來的順序排列\n" +"deque(['Michael', 'Terry', 'Graham'])" #: ../../tutorial/datastructures.rst:196 msgid "List Comprehensions" @@ -528,6 +559,16 @@ msgid "" ">>> transposed\n" "[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" msgstr "" +">>> transposed = []\n" +">>> for i in range(4):\n" +"... # 下面這三行實作了巢狀的 listcomp\n" +"... transposed_row = []\n" +"... for row in matrix:\n" +"... transposed_row.append(row[i])\n" +"... transposed.append(transposed_row)\n" +"...\n" +">>> transposed\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" #: ../../tutorial/datastructures.rst:329 msgid "" @@ -557,15 +598,15 @@ msgstr ":keyword:`!del` 陳述式" #: ../../tutorial/datastructures.rst:342 msgid "" "There is a way to remove an item from a list given its index instead of its " -"value: the :keyword:`del` statement. This differs from the :meth:`~list." -"pop` method which returns a value. The :keyword:`!del` statement can also " -"be used to remove slices from a list or clear the entire list (which we did " +"value: the :keyword:`del` statement. This differs from the :meth:`!pop` " +"method which returns a value. The :keyword:`!del` statement can also be " +"used to remove slices from a list or clear the entire list (which we did " "earlier by assignment of an empty list to the slice). For example::" msgstr "" "有一個方法可以藉由索引而不是值來刪除 list 中的項目::keyword:`del` 陳述式。這" -"和 :meth:`~list.pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪" -"除 list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片" -"段來完成這件事)。例如: ::" +"和 :meth:`!pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪除 " +"list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片段" +"來完成這件事)。例如: ::" #: ../../tutorial/datastructures.rst:348 msgid "" @@ -650,6 +691,24 @@ msgid "" ">>> v\n" "([1, 2, 3], [3, 2, 1])" msgstr "" +">>> t = 12345, 54321, 'hello!'\n" +">>> t[0]\n" +"12345\n" +">>> t\n" +"(12345, 54321, 'hello!')\n" +">>> # Tuple 可以為巢狀的:\n" +">>> u = t, (1, 2, 3, 4, 5)\n" +">>> u\n" +"((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n" +">>> # Tuple 為不可變的:\n" +">>> t[0] = 88888\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"TypeError: 'tuple' object does not support item assignment\n" +">>> # but they can contain mutable objects:\n" +">>> v = ([1, 2, 3], [3, 2, 1])\n" +">>> v\n" +"([1, 2, 3], [3, 2, 1])" #: ../../tutorial/datastructures.rst:400 msgid "" @@ -706,6 +765,14 @@ msgid "" ">>> singleton\n" "('hello',)" msgstr "" +">>> empty = ()\n" +">>> singleton = 'hello', # <-- 注意後面有個逗號\n" +">>> len(empty)\n" +"0\n" +">>> len(singleton)\n" +"1\n" +">>> singleton\n" +"('hello',)" #: ../../tutorial/datastructures.rst:430 msgid "" @@ -822,8 +889,8 @@ msgid "" "can be used as keys if they contain only strings, numbers, or tuples; if a " "tuple contains any mutable object either directly or indirectly, it cannot " "be used as a key. You can't use lists as keys, since lists can be modified " -"in place using index assignments, slice assignments, or methods like :meth:" -"`~list.append` and :meth:`~list.extend`." +"in place using index assignments, slice assignments, or methods like :meth:`!" +"append` and :meth:`!extend`." msgstr "" "下一個常用的 Python 內建資料類型為 *dictionary*\\ (請參考\\ :ref:" "`typesmapping`\\ )。 Dictionary 有時被稱為「關聯記憶體」(associative " @@ -832,8 +899,7 @@ msgstr "" "和數字都可以當作鍵。Tuple 也可以當作鍵,如果他們只含有字串、數字或 tuple;若" "一個 tuple 直接或間接地含有任何可變的物件,它就不能當作鍵。你無法使用 list 當" "作鍵,因為 list 可以經由索引指派 (index assignment)、切片指派 (slice " -"assignment) 或是像 :meth:`~list.append` 和 :meth:`~list.extend` 等 method 被" -"修改。" +"assignment) 或是像 :meth:`!append` 和 :meth:`!extend` 等 method 被修改。" #: ../../tutorial/datastructures.rst:506 msgid "" diff --git a/tutorial/errors.po b/tutorial/errors.po index bd14d08027..73c5b19dc8 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-26 00:14+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,22 +64,27 @@ msgstr "" #: ../../tutorial/errors.rst:26 msgid "" "The parser repeats the offending line and displays little arrows pointing at " -"the token in the line where the error was detected. The error may be caused " -"by the absence of a token *before* the indicated token. In the example, the " -"error is detected at the function :func:`print`, since a colon (``':'``) is " -"missing before it. File name and line number are printed so you know where " -"to look in case the input came from a script." -msgstr "" -"剖析器 (parser) 會重複犯錯的那一行,並用一個小箭頭指向該行檢測到的第一個錯誤" -"點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的。此例中,錯誤是在 :func:" -"`print` 函式中被檢測到,因為在它前面少了一個冒號 (``':'``)。檔案名稱和列號會" -"被印出來,所以如果訊息是來自腳本時,就可以知道去哪裡找問題。" - -#: ../../tutorial/errors.rst:37 +"the place where the error was detected. Note that this is not always the " +"place that needs to be fixed. In the example, the error is detected at the " +"function :func:`print`, since a colon (``':'``) is missing just before it." +msgstr "" +"剖析器 (parser) 會重複犯錯的那一行,並用一個小箭頭指向該行檢測到錯誤的地方," +"但請注意這並非都會是應該去修改的地方。此例中,錯誤是在 :func:`print` 函式中被" +"檢測到,因為在它前面少了一個冒號 (``':'``)。" + +#: ../../tutorial/errors.rst:31 +msgid "" +"The file name (``<stdin>`` in our example) and line number are printed so " +"you know where to look in case the input came from a file." +msgstr "" +"檔案名稱(此例中為 ``<stdin>``)和列號會被印出來,所以如果訊息是來自一個檔案" +"時,就可以知道去哪裡找問題。" + +#: ../../tutorial/errors.rst:38 msgid "Exceptions" msgstr "例外 (Exception)" -#: ../../tutorial/errors.rst:39 +#: ../../tutorial/errors.rst:40 msgid "" "Even if a statement or expression is syntactically correct, it may cause an " "error when an attempt is made to execute it. Errors detected during " @@ -92,7 +97,7 @@ msgstr "" "到的錯誤稱為\\ *例外*,例外不一定都很嚴重:你很快就能學會在 Python 程式中如何" "處理它們。不過大多數的例外不會被程式處理,並且會顯示如下的錯誤訊息: ::" -#: ../../tutorial/errors.rst:45 +#: ../../tutorial/errors.rst:46 msgid "" ">>> 10 * (1/0)\n" "Traceback (most recent call last):\n" @@ -132,16 +137,16 @@ msgstr "" " ~~~~^~~\n" "TypeError: can only concatenate str (not \"int\") to str" -#: ../../tutorial/errors.rst:64 +#: ../../tutorial/errors.rst:65 msgid "" "The last line of the error message indicates what happened. Exceptions come " "in different types, and the type is printed as part of the message: the " -"types in the example are :exc:`ZeroDivisionError`, :exc:`NameError` and :exc:" -"`TypeError`. The string printed as the exception type is the name of the " -"built-in exception that occurred. This is true for all built-in exceptions, " -"but need not be true for user-defined exceptions (although it is a useful " -"convention). Standard exception names are built-in identifiers (not reserved " -"keywords)." +"types in the example are :exc:`ZeroDivisionError`, :exc:`NameError` " +"and :exc:`TypeError`. The string printed as the exception type is the name " +"of the built-in exception that occurred. This is true for all built-in " +"exceptions, but need not be true for user-defined exceptions (although it is " +"a useful convention). Standard exception names are built-in identifiers (not " +"reserved keywords)." msgstr "" "錯誤訊息的最後一行指示發生了什麼事。例外有不同的類型,而類型名稱會作為訊息的" "一部份被印出。範例中的例外類型為::exc:`ZeroDivisionError`、:exc:`NameError` " @@ -150,13 +155,13 @@ msgstr "" "需要遵守(雖然這是一個有用的慣例)。標準例外名稱是內建的識別字 (identifier)," "不是保留關鍵字 (reserved keyword)。" -#: ../../tutorial/errors.rst:72 +#: ../../tutorial/errors.rst:73 msgid "" "The rest of the line provides detail based on the type of exception and what " "caused it." msgstr "此行其餘部分,根據例外的類型及導致例外的原因,說明例外的細節。" -#: ../../tutorial/errors.rst:75 +#: ../../tutorial/errors.rst:76 msgid "" "The preceding part of the error message shows the context where the " "exception occurred, in the form of a stack traceback. In general it contains " @@ -167,30 +172,30 @@ msgstr "" "說,它含有一個列出源程式碼行 (source line) 的堆疊回溯;但它不會顯示從標準輸入" "中讀取的程式碼。" -#: ../../tutorial/errors.rst:80 +#: ../../tutorial/errors.rst:81 msgid "" ":ref:`bltin-exceptions` lists the built-in exceptions and their meanings." msgstr ":ref:`bltin-exceptions`\\ 章節列出內建的例外及它們的意義。" -#: ../../tutorial/errors.rst:86 +#: ../../tutorial/errors.rst:87 msgid "Handling Exceptions" msgstr "處理例外" -#: ../../tutorial/errors.rst:88 +#: ../../tutorial/errors.rst:89 msgid "" "It is possible to write programs that handle selected exceptions. Look at " "the following example, which asks the user for input until a valid integer " -"has been entered, but allows the user to interrupt the program (using :kbd:" -"`Control-C` or whatever the operating system supports); note that a user-" -"generated interruption is signalled by raising the :exc:`KeyboardInterrupt` " -"exception. ::" +"has been entered, but allows the user to interrupt the program " +"(using :kbd:`Control-C` or whatever the operating system supports); note " +"that a user-generated interruption is signalled by raising " +"the :exc:`KeyboardInterrupt` exception. ::" msgstr "" "編寫程式處理選定的例外是可行的。以下範例會要求使用者輸入內容,直到有效的整數" "被輸入為止,但它允許使用者中斷程式(使用 :kbd:`Control-C` 或作業系統支援的指" "令);請注意,由使用者產生的程式中斷會引發 :exc:`KeyboardInterrupt` 例外信" "號。 ::" -#: ../../tutorial/errors.rst:94 +#: ../../tutorial/errors.rst:95 msgid "" ">>> while True:\n" "... try:\n" @@ -208,27 +213,27 @@ msgstr "" "... print(\"Oops! That was no valid number. Try again...\")\n" "..." -#: ../../tutorial/errors.rst:102 +#: ../../tutorial/errors.rst:103 msgid "The :keyword:`try` statement works as follows." msgstr ":keyword:`try` 陳述式運作方式如下。" -#: ../../tutorial/errors.rst:104 +#: ../../tutorial/errors.rst:105 msgid "" -"First, the *try clause* (the statement(s) between the :keyword:`try` and :" -"keyword:`except` keywords) is executed." +"First, the *try clause* (the statement(s) between the :keyword:`try` " +"and :keyword:`except` keywords) is executed." msgstr "" "首先,執行 *try 子句*\\ (:keyword:`try` 和 :keyword:`except` 關鍵字之間的陳" "述式)。" -#: ../../tutorial/errors.rst:107 +#: ../../tutorial/errors.rst:108 msgid "" -"If no exception occurs, the *except clause* is skipped and execution of the :" -"keyword:`try` statement is finished." +"If no exception occurs, the *except clause* is skipped and execution of " +"the :keyword:`try` statement is finished." msgstr "" "如果沒有發生例外,則 *except 子句*\\ 會被跳過,:keyword:`try` 陳述式執行完" "畢。" -#: ../../tutorial/errors.rst:110 +#: ../../tutorial/errors.rst:111 msgid "" "If an exception occurs during execution of the :keyword:`try` clause, the " "rest of the clause is skipped. Then, if its type matches the exception " @@ -239,18 +244,18 @@ msgstr "" "例外的類型與 :keyword:`except` 關鍵字後面的例外名稱相符,則 *except 子句*\\ " "被執行,然後,繼續執行 try/except 區塊之後的程式碼。" -#: ../../tutorial/errors.rst:115 +#: ../../tutorial/errors.rst:116 msgid "" "If an exception occurs which does not match the exception named in the " "*except clause*, it is passed on to outer :keyword:`try` statements; if no " "handler is found, it is an *unhandled exception* and execution stops with an " "error message." msgstr "" -"如果發生的例外未符合 *except 子句* 中的例外名稱,則將其傳遞到外層的 :keyword:" -"`try` 陳述式;如果仍無法找到處理者,則它是一個\\ *未處理例外 (unhandled " -"exception)*,執行將停止,並顯示錯誤訊息。" +"如果發生的例外未符合 *except 子句* 中的例外名稱,則將其傳遞到外層" +"的 :keyword:`try` 陳述式;如果仍無法找到處理者,則它是一個\\ *未處理例外 " +"(unhandled exception)*,執行將停止,並顯示錯誤訊息。" -#: ../../tutorial/errors.rst:119 +#: ../../tutorial/errors.rst:120 msgid "" "A :keyword:`try` statement may have more than one *except clause*, to " "specify handlers for different exceptions. At most one handler will be " @@ -264,7 +269,7 @@ msgstr "" "理同一 :keyword:`!try` 陳述式裡其他處理者內的例外。一個 *except 子句*\\ 可以" "用一組括號內的 tuple 列舉多個例外,例如: ::" -#: ../../tutorial/errors.rst:125 +#: ../../tutorial/errors.rst:126 msgid "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" @@ -272,7 +277,7 @@ msgstr "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" -#: ../../tutorial/errors.rst:128 +#: ../../tutorial/errors.rst:129 msgid "" "A class in an :keyword:`except` clause matches exceptions which are " "instances of the class itself or one of its derived classes (but not the " @@ -284,7 +289,7 @@ msgstr "" "反過來 -- 列出一個衍生類別的 *except 子句*\\ 不會符合它的基底類別的例外)。例" "如,以下程式碼會按照 B、C、D 的順序印出: ::" -#: ../../tutorial/errors.rst:133 +#: ../../tutorial/errors.rst:134 msgid "" "class B(Exception):\n" " pass\n" @@ -324,7 +329,7 @@ msgstr "" " except B:\n" " print(\"B\")" -#: ../../tutorial/errors.rst:152 +#: ../../tutorial/errors.rst:153 msgid "" "Note that if the *except clauses* were reversed (with ``except B`` first), " "it would have printed B, B, B --- the first matching *except clause* is " @@ -333,7 +338,7 @@ msgstr "" "請注意,如果 *except 子句*\\ 的順序被反轉(把 ``except B`` 放到第一個),則會" "印出 B、B、B ­­——第一個符合的 *except 子句*\\ 會被觸發。" -#: ../../tutorial/errors.rst:155 +#: ../../tutorial/errors.rst:156 msgid "" "When an exception occurs, it may have associated values, also known as the " "exception's *arguments*. The presence and types of the arguments depend on " @@ -342,7 +347,7 @@ msgstr "" "當例外發生時,它可能有相關聯的值,也就是例外的\\ *引數*。引數的存在與否及它的" "類型,是取決於例外的類型。" -#: ../../tutorial/errors.rst:159 +#: ../../tutorial/errors.rst:160 msgid "" "The *except clause* may specify a variable after the exception name. The " "variable is bound to the exception instance which typically has an ``args`` " @@ -351,10 +356,10 @@ msgid "" "explicitly accessing ``.args``. ::" msgstr "" "*except 子句*\\ 可以在例外名稱後面指定一個變數。這個變數被綁定到一個例外實例 " -"(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義了 :" -"meth:`~object.__str__` 以印出所有引數而不需顯式地取用 ``.args``: ::" +"(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義" +"了 :meth:`~object.__str__` 以印出所有引數而不需顯式地取用 ``.args``: ::" -#: ../../tutorial/errors.rst:165 +#: ../../tutorial/errors.rst:166 msgid "" ">>> try:\n" "... raise Exception('spam', 'eggs')\n" @@ -374,8 +379,24 @@ msgid "" "x = spam\n" "y = eggs" msgstr "" +">>> try:\n" +"... raise Exception('spam', 'eggs')\n" +"... except Exception as inst:\n" +"... print(type(inst)) # 例外的型別\n" +"... print(inst.args) # 儲存在 .args 中的引數\n" +"... print(inst) # __str__ 使得引數可以直接被印出,\n" +"... # 但可能在例外的子類別中被覆蓋\n" +"... x, y = inst.args # 解包引數\n" +"... print('x =', x)\n" +"... print('y =', y)\n" +"...\n" +"<class 'Exception'>\n" +"('spam', 'eggs')\n" +"('spam', 'eggs')\n" +"x = spam\n" +"y = eggs" -#: ../../tutorial/errors.rst:182 +#: ../../tutorial/errors.rst:183 msgid "" "The exception's :meth:`~object.__str__` output is printed as the last part " "('detail') of the message for unhandled exceptions." @@ -383,23 +404,24 @@ msgstr "" "例外的 :meth:`~object.__str__` 輸出會被印在未處理例外訊息的最後一部分(「細" "節」)。" -#: ../../tutorial/errors.rst:185 +#: ../../tutorial/errors.rst:186 msgid "" ":exc:`BaseException` is the common base class of all exceptions. One of its " "subclasses, :exc:`Exception`, is the base class of all the non-fatal " "exceptions. Exceptions which are not subclasses of :exc:`Exception` are not " "typically handled, because they are used to indicate that the program should " -"terminate. They include :exc:`SystemExit` which is raised by :meth:`sys." -"exit` and :exc:`KeyboardInterrupt` which is raised when a user wishes to " -"interrupt the program." +"terminate. They include :exc:`SystemExit` which is raised " +"by :meth:`sys.exit` and :exc:`KeyboardInterrupt` which is raised when a user " +"wishes to interrupt the program." msgstr "" ":exc:`BaseException` 是由全部的例外所共用的 base class。它的 subclass(子類" "別)之一,:exc:`Exception`,則是所有非嚴重例外 (non-fatal exception) 的 base " "class。有些例外不是 :exc:`Exception` 的 subclass,而它們通常不會被處理,因為" -"它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發的 :exc:" -"`SystemExit`,以及當使用者想要中斷程式時所引發的 :exc:`KeyboardInterrupt`。" +"它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發" +"的 :exc:`SystemExit`,以及當使用者想要中斷程式時所引發" +"的 :exc:`KeyboardInterrupt`。" -#: ../../tutorial/errors.rst:193 +#: ../../tutorial/errors.rst:194 msgid "" ":exc:`Exception` can be used as a wildcard that catches (almost) everything. " "However, it is good practice to be as specific as possible with the types of " @@ -410,7 +432,7 @@ msgstr "" "較好的做法是盡可能具體地說明我們打算處理的例外類型,並容許任何非預期例外的傳" "遞 (propagate)。" -#: ../../tutorial/errors.rst:198 +#: ../../tutorial/errors.rst:199 msgid "" "The most common pattern for handling :exc:`Exception` is to print or log the " "exception and then re-raise it (allowing a caller to handle the exception as " @@ -419,7 +441,7 @@ msgstr "" "處理 :exc:`Exception` 的最常見模式,是先將該例外印出或記錄,然後再重新引發它" "(也允許一個呼叫函式 (caller) 來處理該例外): ::" -#: ../../tutorial/errors.rst:202 +#: ../../tutorial/errors.rst:203 msgid "" "import sys\n" "\n" @@ -449,7 +471,7 @@ msgstr "" " print(f\"Unexpected {err=}, {type(err)=}\")\n" " raise" -#: ../../tutorial/errors.rst:216 +#: ../../tutorial/errors.rst:217 msgid "" "The :keyword:`try` ... :keyword:`except` statement has an optional *else " "clause*, which, when present, must follow all *except clauses*. It is " @@ -460,7 +482,7 @@ msgstr "" "時,該子句必須放在所有 *except 子句*\\ 之後。如果一段程式碼必須被執行,但 " "*try 子句*\\ 又沒有引發例外時,這個子句很有用。例如: ::" -#: ../../tutorial/errors.rst:221 +#: ../../tutorial/errors.rst:222 msgid "" "for arg in sys.argv[1:]:\n" " try:\n" @@ -480,7 +502,7 @@ msgstr "" " print(arg, 'has', len(f.readlines()), 'lines')\n" " f.close()" -#: ../../tutorial/errors.rst:230 +#: ../../tutorial/errors.rst:231 msgid "" "The use of the :keyword:`!else` clause is better than adding additional code " "to the :keyword:`try` clause because it avoids accidentally catching an " @@ -491,7 +513,7 @@ msgstr "" "這可以避免意外地捕獲不是由 :keyword:`!try` ... :keyword:`!except` 陳述式保護" "的程式碼所引發的例外。" -#: ../../tutorial/errors.rst:235 +#: ../../tutorial/errors.rst:236 msgid "" "Exception handlers do not handle only exceptions that occur immediately in " "the *try clause*, but also those that occur inside functions that are called " @@ -500,7 +522,7 @@ msgstr "" "例外的處理者不僅處理 *try 子句*\\ 內立即發生的例外,還處理 *try 子句*\\ 內" "(即使是間接地)呼叫的函式內部發生的例外。例如: ::" -#: ../../tutorial/errors.rst:239 +#: ../../tutorial/errors.rst:240 msgid "" ">>> def this_fails():\n" "... x = 1/0\n" @@ -522,17 +544,17 @@ msgstr "" "...\n" "Handling run-time error: division by zero" -#: ../../tutorial/errors.rst:253 +#: ../../tutorial/errors.rst:254 msgid "Raising Exceptions" msgstr "引發例外" -#: ../../tutorial/errors.rst:255 +#: ../../tutorial/errors.rst:256 msgid "" "The :keyword:`raise` statement allows the programmer to force a specified " "exception to occur. For example::" msgstr ":keyword:`raise` 陳述式可讓程式設計師強制引發指定的例外。例如: ::" -#: ../../tutorial/errors.rst:258 +#: ../../tutorial/errors.rst:259 msgid "" ">>> raise NameError('HiThere')\n" "Traceback (most recent call last):\n" @@ -546,7 +568,7 @@ msgstr "" " raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:264 +#: ../../tutorial/errors.rst:265 msgid "" "The sole argument to :keyword:`raise` indicates the exception to be raised. " "This must be either an exception instance or an exception class (a class " @@ -559,20 +581,20 @@ msgstr "" "的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " "(constructor) ,使它被自動建立實例 (implicitly instantiated): ::" -#: ../../tutorial/errors.rst:270 +#: ../../tutorial/errors.rst:271 msgid "raise ValueError # shorthand for 'raise ValueError()'" msgstr "raise ValueError # 'raise ValueError()' 的簡寫" -#: ../../tutorial/errors.rst:272 +#: ../../tutorial/errors.rst:273 msgid "" "If you need to determine whether an exception was raised but don't intend to " "handle it, a simpler form of the :keyword:`raise` statement allows you to re-" "raise the exception::" msgstr "" -"如果你只想判斷是否引發了例外,但並不打算處理它,則可以使用簡單的 :keyword:" -"`raise` 陳述式來重新引發該例外: ::" +"如果你只想判斷是否引發了例外,但並不打算處理它,則可以使用簡單" +"的 :keyword:`raise` 陳述式來重新引發該例外: ::" -#: ../../tutorial/errors.rst:276 +#: ../../tutorial/errors.rst:277 msgid "" ">>> try:\n" "... raise NameError('HiThere')\n" @@ -598,11 +620,11 @@ msgstr "" " raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:292 +#: ../../tutorial/errors.rst:293 msgid "Exception Chaining" msgstr "例外鏈接 (Exception Chaining)" -#: ../../tutorial/errors.rst:294 +#: ../../tutorial/errors.rst:295 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " @@ -611,7 +633,7 @@ msgstr "" "如果在 :keyword:`except` 段落內部發生了一個未處理的例外,則它會讓這個將要被處" "理的例外附加在後,並將其包含在錯誤訊息中: ::" -#: ../../tutorial/errors.rst:298 +#: ../../tutorial/errors.rst:299 msgid "" ">>> try:\n" "... open(\"database.sqlite\")\n" @@ -649,15 +671,16 @@ msgstr "" " raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" -#: ../../tutorial/errors.rst:316 +#: ../../tutorial/errors.rst:317 msgid "" -"To indicate that an exception is a direct consequence of another, the :" -"keyword:`raise` statement allows an optional :keyword:`from<raise>` clause::" +"To indicate that an exception is a direct consequence of another, " +"the :keyword:`raise` statement allows an optional :keyword:`from<raise>` " +"clause::" msgstr "" "為了表明一個例外是另一個例外直接造成的結果,:keyword:`raise` 陳述式容許一個選" "擇性的 :keyword:`from<raise>` 子句: ::" -#: ../../tutorial/errors.rst:319 +#: ../../tutorial/errors.rst:320 msgid "" "# exc must be exception instance or None.\n" "raise RuntimeError from exc" @@ -665,11 +688,11 @@ msgstr "" "# exc 必須是例外實例或 None。\n" "raise RuntimeError from exc" -#: ../../tutorial/errors.rst:322 +#: ../../tutorial/errors.rst:323 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "要變換例外時,這種方式很有用。例如: ::" -#: ../../tutorial/errors.rst:324 +#: ../../tutorial/errors.rst:325 msgid "" ">>> def func():\n" "... raise ConnectionError\n" @@ -715,13 +738,13 @@ msgstr "" " raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" -#: ../../tutorial/errors.rst:346 +#: ../../tutorial/errors.rst:347 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" msgstr "它也容許使用慣用語 ``from None`` 來停用自動例外鏈接: ::" -#: ../../tutorial/errors.rst:349 +#: ../../tutorial/errors.rst:350 msgid "" ">>> try:\n" "... open('database.sqlite')\n" @@ -743,16 +766,16 @@ msgstr "" " raise RuntimeError from None\n" "RuntimeError" -#: ../../tutorial/errors.rst:359 +#: ../../tutorial/errors.rst:360 msgid "" "For more information about chaining mechanics, see :ref:`bltin-exceptions`." msgstr "更多關於鏈接機制的資訊,詳見\\ :ref:`bltin-exceptions`。" -#: ../../tutorial/errors.rst:365 +#: ../../tutorial/errors.rst:366 msgid "User-defined Exceptions" msgstr "使用者自定的例外" -#: ../../tutorial/errors.rst:367 +#: ../../tutorial/errors.rst:368 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " @@ -760,10 +783,10 @@ msgid "" "indirectly." msgstr "" "程式可以通過建立新的例外 class 來命名自己的例外(深入了解 Python class,詳見" -"\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該從 :exc:" -"`Exception` class 衍生出來。" +"\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該" +"從 :exc:`Exception` class 衍生出來。" -#: ../../tutorial/errors.rst:371 +#: ../../tutorial/errors.rst:372 msgid "" "Exception classes can be defined which do anything any other class can do, " "but are usually kept simple, often only offering a number of attributes that " @@ -773,23 +796,23 @@ msgstr "" "例外 class 可被定義來做任何其他 class 能夠做的事,但通常會讓它維持簡單,只提" "供一些屬性,讓關於錯誤的資訊可被例外的處理者抽取出來。" -#: ../../tutorial/errors.rst:375 +#: ../../tutorial/errors.rst:376 msgid "" "Most exceptions are defined with names that end in \"Error\", similar to the " "naming of the standard exceptions." msgstr "大多數的例外定義,都會以「Error」作為名稱結尾,類似於標準例外的命名。" -#: ../../tutorial/errors.rst:378 +#: ../../tutorial/errors.rst:379 msgid "" "Many standard modules define their own exceptions to report errors that may " "occur in functions they define." msgstr "許多標準模組會定義它們自己的例外,以報告在其定義的函式中發生的錯誤。" -#: ../../tutorial/errors.rst:385 +#: ../../tutorial/errors.rst:386 msgid "Defining Clean-up Actions" msgstr "定義清理動作" -#: ../../tutorial/errors.rst:387 +#: ../../tutorial/errors.rst:388 msgid "" "The :keyword:`try` statement has another optional clause which is intended " "to define clean-up actions that must be executed under all circumstances. " @@ -798,7 +821,7 @@ msgstr "" ":keyword:`try` 陳述式有另一個選擇性子句,用於定義在所有情況下都必須被執行的清" "理動作。例如: ::" -#: ../../tutorial/errors.rst:391 +#: ../../tutorial/errors.rst:392 msgid "" ">>> try:\n" "... raise KeyboardInterrupt\n" @@ -822,7 +845,7 @@ msgstr "" " raise KeyboardInterrupt\n" "KeyboardInterrupt" -#: ../../tutorial/errors.rst:402 +#: ../../tutorial/errors.rst:403 msgid "" "If a :keyword:`finally` clause is present, the :keyword:`!finally` clause " "will execute as the last task before the :keyword:`try` statement completes. " @@ -830,66 +853,67 @@ msgid "" "statement produces an exception. The following points discuss more complex " "cases when an exception occurs:" msgstr "" -"如果 :keyword:`finally` 子句存在,則 :keyword:`!finally` 子句會是 :keyword:" -"`try` 陳述式結束前執行的最後一項任務。不論 :keyword:`!try` 陳述式是否產生例" -"外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比較複雜的情" -"況:" +"如果 :keyword:`finally` 子句存在,則 :keyword:`!finally` 子句會" +"是 :keyword:`try` 陳述式結束前執行的最後一項任務。不論 :keyword:`!try` 陳述式" +"是否產生例外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比" +"較複雜的情況:" -#: ../../tutorial/errors.rst:408 +#: ../../tutorial/errors.rst:409 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " "not handled by an :keyword:`!except` clause, the exception is re-raised " "after the :keyword:`!finally` clause has been executed." msgstr "" -"若一個例外發生於 :keyword:`!try` 子句的執行過程,則該例外會被某個 :keyword:" -"`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理,它會在 :" -"keyword:`!finally` 子句執行後被重新引發。" +"若一個例外發生於 :keyword:`!try` 子句的執行過程,則該例外會被某" +"個 :keyword:`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理," +"它會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:414 +#: ../../tutorial/errors.rst:415 msgid "" -"An exception could occur during execution of an :keyword:`!except` or :" -"keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" -"`!finally` clause has been executed." +"An exception could occur during execution of an :keyword:`!except` " +"or :keyword:`!else` clause. Again, the exception is re-raised after " +"the :keyword:`!finally` clause has been executed." msgstr "" "一個例外可能發生於 :keyword:`!except` 或 :keyword:`!else` 子句的執行過程。同" "樣地,該例外會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:418 +#: ../../tutorial/errors.rst:419 msgid "" -"If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" -"`continue` or :keyword:`return` statement, exceptions are not re-raised." +"If the :keyword:`!finally` clause executes " +"a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement, " +"exceptions are not re-raised." msgstr "" -"如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` 或 :" -"keyword:`return` 陳述式,則例外不會被重新引發。" +"如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` " +"或 :keyword:`return` 陳述式,則例外不會被重新引發。" -#: ../../tutorial/errors.rst:422 +#: ../../tutorial/errors.rst:423 msgid "" -"If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" -"`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " -"will execute just prior to the :keyword:`!break`, :keyword:`!continue` or :" -"keyword:`!return` statement's execution." +"If the :keyword:`!try` statement reaches " +"a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement, " +"the :keyword:`!finally` clause will execute just prior to the :keyword:`!" +"break`, :keyword:`!continue` or :keyword:`!return` statement's execution." msgstr "" -"如果 :keyword:`!try` 陳述式遇到 :keyword:`break`、:keyword:`continue` 或 :" -"keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" +"如果 :keyword:`!try` 陳述式遇到 :keyword:`break`、:keyword:`continue` " +"或 :keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" "break`、:keyword:`!continue` 或 :keyword:`!return` 陳述式之前先執行。" -#: ../../tutorial/errors.rst:428 +#: ../../tutorial/errors.rst:429 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " -"returned value will be the one from the :keyword:`!finally` clause's :" -"keyword:`!return` statement, not the value from the :keyword:`!try` " -"clause's :keyword:`!return` statement." +"returned value will be the one from the :keyword:`!finally` " +"clause's :keyword:`!return` statement, not the value from the :keyword:`!" +"try` clause's :keyword:`!return` statement." msgstr "" "如果 :keyword:`!finally` 子句中包含 :keyword:`!return` 陳述式,則回傳值會是來" -"自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來自 :" -"keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" +"自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來" +"自 :keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" -#: ../../tutorial/errors.rst:434 +#: ../../tutorial/errors.rst:435 msgid "For example::" msgstr "例如: ::" -#: ../../tutorial/errors.rst:436 +#: ../../tutorial/errors.rst:437 msgid "" ">>> def bool_return():\n" "... try:\n" @@ -909,11 +933,11 @@ msgstr "" ">>> bool_return()\n" "False" -#: ../../tutorial/errors.rst:445 +#: ../../tutorial/errors.rst:446 msgid "A more complicated example::" msgstr "另一個比較複雜的範例: ::" -#: ../../tutorial/errors.rst:447 +#: ../../tutorial/errors.rst:448 msgid "" ">>> def divide(x, y):\n" "... try:\n" @@ -969,18 +993,18 @@ msgstr "" " ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" -#: ../../tutorial/errors.rst:474 +#: ../../tutorial/errors.rst:475 msgid "" "As you can see, the :keyword:`finally` clause is executed in any event. " -"The :exc:`TypeError` raised by dividing two strings is not handled by the :" -"keyword:`except` clause and therefore re-raised after the :keyword:`!" +"The :exc:`TypeError` raised by dividing two strings is not handled by " +"the :keyword:`except` clause and therefore re-raised after the :keyword:`!" "finally` clause has been executed." msgstr "" "如你所見,:keyword:`finally` 子句在任何情況下都會被執行。兩個字串相除所引發" "的 :exc:`TypeError` 沒有被 :keyword:`except` 子句處理,因此會在 :keyword:`!" "finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:479 +#: ../../tutorial/errors.rst:480 msgid "" "In real world applications, the :keyword:`finally` clause is useful for " "releasing external resources (such as files or network connections), " @@ -989,11 +1013,11 @@ msgstr "" "在真實應用程式中,:keyword:`finally` 子句對於釋放外部資源(例如檔案或網路連" "線)很有用,無論該資源的使用是否成功。" -#: ../../tutorial/errors.rst:487 +#: ../../tutorial/errors.rst:488 msgid "Predefined Clean-up Actions" msgstr "預定義的清理動作" -#: ../../tutorial/errors.rst:489 +#: ../../tutorial/errors.rst:490 msgid "" "Some objects define standard clean-up actions to be undertaken when the " "object is no longer needed, regardless of whether or not the operation using " @@ -1003,7 +1027,7 @@ msgstr "" "某些物件定義了在物件不再被需要時的標準清理動作,無論使用該物件的作業是成功或" "失敗。請看以下範例,它嘗試開啟一個檔案,並印出檔案內容至螢幕。 ::" -#: ../../tutorial/errors.rst:494 +#: ../../tutorial/errors.rst:495 msgid "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" @@ -1011,7 +1035,7 @@ msgstr "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:497 +#: ../../tutorial/errors.rst:498 msgid "" "The problem with this code is that it leaves the file open for an " "indeterminate amount of time after this part of the code has finished " @@ -1021,11 +1045,11 @@ msgid "" "correctly. ::" msgstr "" "這段程式碼的問題在於,執行完該程式碼後,它讓檔案在一段不確定的時間內處於開啟" -"狀態。在簡單腳本中這不是問題,但對於較大的應用程式來說可能會是個問題。:" -"keyword:`with` 陳述式讓物件(例如檔案)在被使用時,能保證它們總是及時、正確地" -"被清理。 ::" +"狀態。在簡單腳本中這不是問題,但對於較大的應用程式來說可能會是個問" +"題。:keyword:`with` 陳述式讓物件(例如檔案)在被使用時,能保證它們總是及時、" +"正確地被清理。 ::" -#: ../../tutorial/errors.rst:503 +#: ../../tutorial/errors.rst:504 msgid "" "with open(\"myfile.txt\") as f:\n" " for line in f:\n" @@ -1035,7 +1059,7 @@ msgstr "" " for line in f:\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:507 +#: ../../tutorial/errors.rst:508 msgid "" "After the statement is executed, the file *f* is always closed, even if a " "problem was encountered while processing the lines. Objects which, like " @@ -1045,11 +1069,11 @@ msgstr "" "陳述式執行完畢後,就算是在處理內容時遇到問題,檔案 *f* 總是會被關閉。和檔案一" "樣,提供預定義清理動作的物件會在說明文件中表明這一點。" -#: ../../tutorial/errors.rst:515 +#: ../../tutorial/errors.rst:516 msgid "Raising and Handling Multiple Unrelated Exceptions" msgstr "引發及處理多個無關的例外" -#: ../../tutorial/errors.rst:517 +#: ../../tutorial/errors.rst:518 msgid "" "There are situations where it is necessary to report several exceptions that " "have occurred. This is often the case in concurrency frameworks, when " @@ -1061,7 +1085,7 @@ msgstr "" "中經常會出現這種情況,當平行的 (parallel) 某些任務可能已經失效,但還有其他用" "例 (use case) 希望能繼續執行並收集多個例外,而不是只有引發第一個例外時。" -#: ../../tutorial/errors.rst:523 +#: ../../tutorial/errors.rst:524 msgid "" "The builtin :exc:`ExceptionGroup` wraps a list of exception instances so " "that they can be raised together. It is an exception itself, so it can be " @@ -1071,7 +1095,7 @@ msgstr "" "(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像任何" "其他例外一樣被捕獲。 ::" -#: ../../tutorial/errors.rst:527 +#: ../../tutorial/errors.rst:528 msgid "" ">>> def f():\n" "... excs = [OSError('error 1'), SystemError('error 2')]\n" @@ -1123,7 +1147,7 @@ msgstr "" "caught <class 'ExceptionGroup'>: e\n" ">>>" -#: ../../tutorial/errors.rst:552 +#: ../../tutorial/errors.rst:553 msgid "" "By using ``except*`` instead of ``except``, we can selectively handle only " "the exceptions in the group that match a certain type. In the following " @@ -1136,7 +1160,7 @@ msgstr "" "``except*`` 子句分別從該群組中提取一個特定類型的例外,同時讓所有其他的例外都" "傳遞到其他子句,最後再被重新引發。 ::" -#: ../../tutorial/errors.rst:559 +#: ../../tutorial/errors.rst:560 msgid "" ">>> def f():\n" "... raise ExceptionGroup(\n" @@ -1220,7 +1244,7 @@ msgstr "" " +------------------------------------\n" ">>>" -#: ../../tutorial/errors.rst:600 +#: ../../tutorial/errors.rst:601 msgid "" "Note that the exceptions nested in an exception group must be instances, not " "types. This is because in practice the exceptions would typically be ones " @@ -1230,7 +1254,7 @@ msgstr "" "請注意,被巢套在例外群組中的例外必須是實例,而不是類型。這是因為在實務上,這" "些例外通常是已經被程式引發並捕獲的例外,類似以下的模式: ::" -#: ../../tutorial/errors.rst:605 +#: ../../tutorial/errors.rst:606 msgid "" ">>> excs = []\n" "... for test in tests:\n" @@ -1254,11 +1278,11 @@ msgstr "" "... raise ExceptionGroup(\"Test Failures\", excs)\n" "..." -#: ../../tutorial/errors.rst:620 +#: ../../tutorial/errors.rst:621 msgid "Enriching Exceptions with Notes" msgstr "用註解使例外更詳細" -#: ../../tutorial/errors.rst:622 +#: ../../tutorial/errors.rst:623 msgid "" "When an exception is created in order to be raised, it is usually " "initialized with information that describes the error that has occurred. " @@ -1274,7 +1298,7 @@ msgstr "" "的註解清單中。標準的回溯呈現會在例外之後列出所有的註解,並按照其被添加的順序" "來排列。 ::" -#: ../../tutorial/errors.rst:629 +#: ../../tutorial/errors.rst:630 msgid "" ">>> try:\n" "... raise TypeError('bad type')\n" @@ -1306,7 +1330,7 @@ msgstr "" "Add some more information\n" ">>>" -#: ../../tutorial/errors.rst:644 +#: ../../tutorial/errors.rst:645 msgid "" "For example, when collecting exceptions into an exception group, we may want " "to add context information for the individual errors. In the following each " @@ -1315,7 +1339,7 @@ msgstr "" "例如,在將例外收集到例外群組中時,我們可能希望為各個錯誤添加一些上下文的資" "訊。在以下範例中,群組中的每個例外都有一條註解,指示此錯誤是在何時發生。 ::" -#: ../../tutorial/errors.rst:648 +#: ../../tutorial/errors.rst:649 msgid "" ">>> def f():\n" "... raise OSError('operation failed')\n" diff --git a/tutorial/index.po b/tutorial/index.po index 47eb0a648b..1ed8787fa7 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -59,7 +59,7 @@ msgid "" msgstr "" "使用 C 或 C++(或其他可被 C 呼叫的程式語言),可以很容易在 Python 直譯器內新" "增功能函式及資料型別。同時,對可讓使用者自製功能的應用程式來說,Python 也適合" -"作為其擴充用界面語言 (extension language)。" +"作為其擴充用介面語言 (extension language)。" #: ../../tutorial/index.rst:23 msgid "" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 860e9deca2..cf215d9b34 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -41,15 +40,15 @@ msgstr "更華麗的輸出格式" #: ../../tutorial/inputoutput.rst:17 msgid "" "So far we've encountered two ways of writing values: *expression statements* " -"and the :func:`print` function. (A third way is using the :meth:`~io." -"TextIOBase.write` method of file objects; the standard output file can be " -"referenced as ``sys.stdout``. See the Library Reference for more information " -"on this.)" +"and the :func:`print` function. (A third way is using " +"the :meth:`~io.TextIOBase.write` method of file objects; the standard output " +"file can be referenced as ``sys.stdout``. See the Library Reference for more " +"information on this.)" msgstr "" -"目前為止我們已經學過兩種寫值的方式:*運算式陳述 (expression statements)* 與 :" -"func:`print` 函式。(第三種方法是使用檔案物件的 :meth:`~io.TextIOBase.write` " -"方法;標準輸出的檔案是使用 ``sys.stdout`` 來達成的。詳細的資訊請參考對應的函" -"式庫說明。)" +"目前為止我們已經學過兩種寫值的方式:*運算式陳述 (expression statements)* " +"與 :func:`print` 函式。(第三種方法是使用檔案物件" +"的 :meth:`~io.TextIOBase.write` 方法;標準輸出的檔案是使用 ``sys.stdout`` 來" +"達成的。詳細的資訊請參考對應的函式庫說明。)" #: ../../tutorial/inputoutput.rst:22 msgid "" @@ -114,8 +113,8 @@ msgstr "" msgid "" "Notice how the ``yes_votes`` are padded with spaces and a negative sign only " "for negative numbers. The example also prints ``percentage`` multiplied by " -"100, with 2 decimal places and followed by a percent sign (see :ref:" -"`formatspec` for details)." +"100, with 2 decimal places and followed by a percent sign " +"(see :ref:`formatspec` for details)." msgstr "" "請注意 ``yes_votes`` 如何對於負數用空格和負號填補。該範例還會列出 " "``percentage`` 乘以 100,並保留 2 位小數且後面跟著一個百分號(有關詳細資訊," @@ -138,17 +137,17 @@ msgid "" "variables for debugging purposes, you can convert any value to a string with " "the :func:`repr` or :func:`str` functions." msgstr "" -"如果你不需要華麗的輸出,只想快速顯示變數以進行除錯,可以用 :func:`repr` 或 :" -"func:`str` 函式把任何的值轉換為字串。" +"如果你不需要華麗的輸出,只想快速顯示變數以進行除錯,可以用 :func:`repr` " +"或 :func:`str` 函式把任何的值轉換為字串。" #: ../../tutorial/inputoutput.rst:66 msgid "" "The :func:`str` function is meant to return representations of values which " "are fairly human-readable, while :func:`repr` is meant to generate " -"representations which can be read by the interpreter (or will force a :exc:" -"`SyntaxError` if there is no equivalent syntax). For objects which don't " -"have a particular representation for human consumption, :func:`str` will " -"return the same value as :func:`repr`. Many values, such as numbers or " +"representations which can be read by the interpreter (or will force " +"a :exc:`SyntaxError` if there is no equivalent syntax). For objects which " +"don't have a particular representation for human consumption, :func:`str` " +"will return the same value as :func:`repr`. Many values, such as numbers or " "structures like lists and dictionaries, have the same representation using " "either function. Strings, in particular, have two distinct representations." msgstr "" @@ -185,6 +184,26 @@ msgid "" ">>> repr((x, y, ('spam', 'eggs')))\n" "\"(32.5, 40000, ('spam', 'eggs'))\"" msgstr "" +">>> s = 'Hello, world.'\n" +">>> str(s)\n" +"'Hello, world.'\n" +">>> repr(s)\n" +"\"'Hello, world.'\"\n" +">>> str(1/7)\n" +"'0.14285714285714285'\n" +">>> x = 10 * 3.25\n" +">>> y = 200 * 200\n" +">>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'\n" +">>> print(s)\n" +"The value of x is 32.5, and y is 40000...\n" +">>> # 字串的 repr() 會加上字串引號和反斜線:\n" +">>> hello = 'hello, world\\n'\n" +">>> hellos = repr(hello)\n" +">>> print(hellos)\n" +"'hello, world\\n'\n" +">>> # repr() 的引數可以是任何 Python 物件:\n" +">>> repr((x, y, ('spam', 'eggs')))\n" +"\"(32.5, 40000, ('spam', 'eggs'))\"" #: ../../tutorial/inputoutput.rst:98 msgid "" @@ -296,8 +315,8 @@ msgid "" "specifications, see the reference guide for the :ref:`formatspec`." msgstr "" "更多關於 ``=`` 說明符的資訊請見\\ :ref:`自文件性運算式 (self-documenting " -"expressions) <bpo-36817-whatsnew>`。若要參考這些格式化字串的規格,詳見 :ref:" -"`formatspec` 參考指南。" +"expressions) <bpo-36817-whatsnew>`。若要參考這些格式化字串的規格,詳" +"見 :ref:`formatspec` 參考指南。" #: ../../tutorial/inputoutput.rst:166 msgid "The String format() Method" @@ -319,8 +338,8 @@ msgstr "" msgid "" "The brackets and characters within them (called format fields) are replaced " "with the objects passed into the :meth:`str.format` method. A number in the " -"brackets can be used to refer to the position of the object passed into the :" -"meth:`str.format` method. ::" +"brackets can be used to refer to the position of the object passed into " +"the :meth:`str.format` method. ::" msgstr "" "大括號及其內的字元(稱為格式欄位)會被取代為傳遞給 :meth:`str.format` method " "的物件。大括號中的數字表示該物件在傳遞給 :meth:`str.format` method 時所在的位" @@ -403,19 +422,20 @@ msgstr "" #: ../../tutorial/inputoutput.rst:209 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" -">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." -"format(**table))\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: " +"{Dcab:d}'.format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" msgstr "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" -">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." -"format(**table))\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: " +"{Dcab:d}'.format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" #: ../../tutorial/inputoutput.rst:213 msgid "" -"This is particularly useful in combination with the built-in function :func:" -"`vars`, which returns a dictionary containing all local variables::" +"This is particularly useful in combination with the built-in " +"function :func:`vars`, which returns a dictionary containing all local " +"variables::" msgstr "" "與內建函式 :func:`vars` 組合使用時,這種方式特別實用。該函式可以回傳一個包含" "所有區域變數的 dictionary: ::" @@ -470,11 +490,11 @@ msgstr "" #: ../../tutorial/inputoutput.rst:238 msgid "" -"For a complete overview of string formatting with :meth:`str.format`, see :" -"ref:`formatstrings`." +"For a complete overview of string formatting with :meth:`str.format`, " +"see :ref:`formatstrings`." msgstr "" -"關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見\\ :ref:" -"`formatstrings`。" +"關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見" +"\\ :ref:`formatstrings`。" #: ../../tutorial/inputoutput.rst:243 msgid "Manual String Formatting" @@ -520,8 +540,8 @@ msgstr "" #: ../../tutorial/inputoutput.rst:263 msgid "" -"(Note that the one space between each column was added by the way :func:" -"`print` works: it always adds spaces between its arguments.)" +"(Note that the one space between each column was added by the " +"way :func:`print` works: it always adds spaces between its arguments.)" msgstr "" "(請注意,使用 :func:`print` 讓每欄之間加入一個空格的方法:這種方法總是在其引" "數間加入空格。)" @@ -640,9 +660,10 @@ msgid "" "*encoding*. If *encoding* is not specified, the default is platform " "dependent (see :func:`open`). Because UTF-8 is the modern de-facto standard, " "``encoding=\"utf-8\"`` is recommended unless you know that you need to use a " -"different encoding. Appending a ``'b'`` to the mode opens the file in :dfn:" -"`binary mode`. Binary mode data is read and written as :class:`bytes` " -"objects. You can not specify *encoding* when opening file in binary mode." +"different encoding. Appending a ``'b'`` to the mode opens the file " +"in :dfn:`binary mode`. Binary mode data is read and written " +"as :class:`bytes` objects. You can not specify *encoding* when opening file " +"in binary mode." msgstr "" "通常,檔案以 :dfn:`text mode` 開啟,意即,從檔案中讀取或寫入字串時,都以特定" "編碼方式 *encoding* 進行編碼。如未指定 *encoding*,則預設值會取決於系統平台" @@ -657,9 +678,9 @@ msgid "" "endings (``\\n`` on Unix, ``\\r\\n`` on Windows) to just ``\\n``. When " "writing in text mode, the default is to convert occurrences of ``\\n`` back " "to platform-specific line endings. This behind-the-scenes modification to " -"file data is fine for text files, but will corrupt binary data like that in :" -"file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when " -"reading and writing such files." +"file data is fine for text files, but will corrupt binary data like that " +"in :file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode " +"when reading and writing such files." msgstr "" "在文字模式 (text mode) 下,讀取時會預設把平台特定的行尾符號(Unix 上為 " "``\\n``,Windows 上為 ``\\r\\n``)轉換為 ``\\n``。在文字模式下寫入時,預設會" @@ -671,9 +692,9 @@ msgstr "" msgid "" "It is good practice to use the :keyword:`with` keyword when dealing with " "file objects. The advantage is that the file is properly closed after its " -"suite finishes, even if an exception is raised at some point. Using :" -"keyword:`!with` is also much shorter than writing equivalent :keyword:" -"`try`\\ -\\ :keyword:`finally` blocks::" +"suite finishes, even if an exception is raised at some point. " +"Using :keyword:`!with` is also much shorter than writing " +"equivalent :keyword:`try`\\ -\\ :keyword:`finally` blocks::" msgstr "" "在處理檔案物件時,使用 :keyword:`with` 關鍵字是個好習慣。優點是,當它的套件結" "束後,即使在某個時刻引發了例外,檔案仍會正確地被關閉。使用 :keyword:`!with` " @@ -697,8 +718,8 @@ msgstr "" #: ../../tutorial/inputoutput.rst:365 msgid "" -"If you're not using the :keyword:`with` keyword, then you should call ``f." -"close()`` to close the file and immediately free up any system resources " +"If you're not using the :keyword:`with` keyword, then you should call " +"``f.close()`` to close the file and immediately free up any system resources " "used by it." msgstr "" "如果你沒有使用 :keyword:`with` 關鍵字,則應呼叫 ``f.close()`` 關閉檔案,可以" @@ -834,8 +855,8 @@ msgid "" "If you want to read all the lines of a file in a list you can also use " "``list(f)`` or ``f.readlines()``." msgstr "" -"如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 ``f." -"readlines()``。" +"如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 " +"``f.readlines()``。" #: ../../tutorial/inputoutput.rst:437 msgid "" @@ -878,7 +899,7 @@ msgid "" "the file represented as number of bytes from the beginning of the file when " "in binary mode and an opaque number when in text mode." msgstr "" -"``f.tell()`` 回傳一個整數,它給出檔案物件在檔案中的當前位置,在二進制模式下表" +"``f.tell()`` 回傳一個整數,它給出檔案物件在檔案中的目前位置,在二進制模式下表" "示為檔案開始至今的位元組數,在文字模式下表示為一個意義不明的數字。" #: ../../tutorial/inputoutput.rst:455 @@ -893,7 +914,7 @@ msgid "" msgstr "" "使用 ``f.seek(offset, whence)`` 可以改變檔案物件的位置。位置計算方法是從一個" "參考點增加 *offset* 的偏移量;參考點則由引數 *whence* 來選擇。當 *whence* 值" -"為 0 時,表示使用檔案開頭,1 表示使用當前的檔案位置,2 表示使用檔案末端作為參" +"為 0 時,表示使用檔案開頭,1 表示使用目前的檔案位置,2 表示使用檔案末端作為參" "考點。*whence* 可省略,其預設值為 0,即以檔案開頭作為參考點。 ::" #: ../../tutorial/inputoutput.rst:462 @@ -957,18 +978,18 @@ msgid "" "want to save more complex data types like nested lists and dictionaries, " "parsing and serializing by hand becomes complicated." msgstr "" -"字串可以簡單地從檔案中被寫入和讀取。數字則稍嫌麻煩,因為 :meth:`~io." -"TextIOBase.read` method 只回傳字串,這些字串必須傳遞給像 :func:`int` 這樣的函" -"式,它接受 ``'123'`` 這樣的字串,並回傳數值 123。當你想儲存像是巢狀 list 和 " -"dictionary(字典)等複雜的資料類型時,手動剖析 (parsing) 和序列化 " -"(serializing) 就變得複雜。" +"字串可以簡單地從檔案中被寫入和讀取。數字則稍嫌麻煩,因" +"為 :meth:`~io.TextIOBase.read` method 只回傳字串,這些字串必須傳遞給" +"像 :func:`int` 這樣的函式,它接受 ``'123'`` 這樣的字串,並回傳數值 123。當你" +"想儲存像是巢狀 list 和 dictionary(字典)等複雜的資料類型時,手動剖析 " +"(parsing) 和序列化 (serializing) 就變得複雜。" #: ../../tutorial/inputoutput.rst:499 msgid "" "Rather than having users constantly writing and debugging code to save " "complicated data types to files, Python allows you to use the popular data " -"interchange format called `JSON (JavaScript Object Notation) <https://json." -"org>`_. The standard module called :mod:`json` can take Python data " +"interchange format called `JSON (JavaScript Object Notation) <https://" +"json.org>`_. The standard module called :mod:`json` can take Python data " "hierarchies, and convert them to string representations; this process is " "called :dfn:`serializing`. Reconstructing the data from the string " "representation is called :dfn:`deserializing`. Between serializing and " @@ -1012,13 +1033,14 @@ msgstr "" #: ../../tutorial/inputoutput.rst:522 msgid "" -"Another variant of the :func:`~json.dumps` function, called :func:`~json." -"dump`, simply serializes the object to a :term:`text file`. So if ``f`` is " -"a :term:`text file` object opened for writing, we can do this::" +"Another variant of the :func:`~json.dumps` function, " +"called :func:`~json.dump`, simply serializes the object to a :term:`text " +"file`. So if ``f`` is a :term:`text file` object opened for writing, we can " +"do this::" msgstr "" ":func:`~json.dumps` 函式有一個變體,稱為 :func:`~json.dump`,它單純地將物件序" -"列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟的 :term:" -"`text file` 物件,我們可以這樣做: ::" +"列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟" +"的 :term:`text file` 物件,我們可以這樣做: ::" #: ../../tutorial/inputoutput.rst:526 msgid "json.dump(x, f)" @@ -1041,8 +1063,8 @@ msgid "" "JSON files must be encoded in UTF-8. Use ``encoding=\"utf-8\"`` when opening " "JSON file as a :term:`text file` for both of reading and writing." msgstr "" -"JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入的 :" -"term:`text file` 時,要用 ``encoding=\"utf-8\"``。" +"JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入" +"的 :term:`text file` 時,要用 ``encoding=\"utf-8\"``。" #: ../../tutorial/inputoutput.rst:537 msgid "" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index c7d64f4e81..fc1e052dc3 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2021-06-28 20:45+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +31,7 @@ msgid "" "library, which supports various styles of editing. This library has its own " "documentation which we won't duplicate here." msgstr "" -"有些版本的 Python 直譯器支援當前輸入內容的編輯和歷史記錄的替換 (history " +"有些版本的 Python 直譯器支援目前輸入內容的編輯和歷史記錄的替換 (history " "substitution),類似在 Korn shell 和 GNU Bash shell 中的功能。這個功能是用 " "`GNU Readline`_ 函式庫來實作,它支援多種編輯的風格。這個函式庫有它自己的說明" "文件,在這裡我們就不重複了。" @@ -51,19 +50,19 @@ msgid "" "final ``'.'`` and then suggest completions from the attributes of the " "resulting object. Note that this may execute application-defined code if an " "object with a :meth:`~object.__getattr__` method is part of the expression. " -"The default configuration also saves your history into a file named :file:`." -"python_history` in your user directory. The history will be available again " -"during the next interactive interpreter session." +"The default configuration also saves your history into a file " +"named :file:`.python_history` in your user directory. The history will be " +"available again during the next interactive interpreter session." msgstr "" "在直譯器啟動的時候,變數和模組名稱的自動完成功能會被\\ :ref:`自動啟用 " -"<rlcompleter-config>`,所以可以用 :kbd:`Tab` 鍵來呼叫自動完成函式;它會查看 " -"Python 的陳述式名稱、當前區域變數名稱和可用模組名稱。對於像是 ``string.a`` 的" +"<rlcompleter-config>`,所以可以用 :kbd:`Tab` 鍵來叫用自動完成函式;它會查看 " +"Python 的陳述式名稱、目前區域變數名稱和可用模組名稱。對於像是 ``string.a`` 的" "點分隔運算式 (dotted expression),它會對最後一個 ``'.'`` 之前的運算式求值,然" -"後根據求值結果物件的屬性,給予自動完成的建議。請注意,如果一個物件有 :meth:" -"`~object.__getattr__` method(方法),同時又是該運算式的一部份,這樣可能會執" -"行應用程式自定義的程式碼。預設設定也會把你的指令歷史記錄儲存在你的使用者資料" -"夾內,一個名為 :file:`.python_history` 的檔案中。在下一次啟動互動式直譯器時," -"這些歷史記錄依然可以被使用。" +"後根據求值結果物件的屬性,給予自動完成的建議。請注意,如果一個物件" +"有 :meth:`~object.__getattr__` method(方法),同時又是該運算式的一部份,這樣" +"可能會執行應用程式自定義的程式碼。預設設定也會把你的指令歷史記錄儲存在你的使" +"用者資料夾內,一個名為 :file:`.python_history` 的檔案中。在下一次啟動互動式直" +"譯器時,這些歷史記錄依然可以被使用。" #: ../../tutorial/interactive.rst:36 msgid "Alternatives to the Interactive Interpreter" @@ -74,15 +73,15 @@ msgid "" "This facility is an enormous step forward compared to earlier versions of " "the interpreter; however, some wishes are left: It would be nice if the " "proper indentation were suggested on continuation lines (the parser knows if " -"an indent token is required next). The completion mechanism might use the " -"interpreter's symbol table. A command to check (or even suggest) matching " -"parentheses, quotes, etc., would also be useful." +"an :data:`~token.INDENT` token is required next). The completion mechanism " +"might use the interpreter's symbol table. A command to check (or even " +"suggest) matching parentheses, quotes, etc., would also be useful." msgstr "" "與早期版本的直譯器相比,上述功能的出現的確是一個巨大的進步;但還是有一些願望" "沒有被實現:如果能在每次換行時給予適當的縮排建議(剖析器 (parser) 知道下一行" -"是否需要縮排標記 (indent token)),那就更棒了。自動完成機制可能會使用直譯器的" -"符號表。若有一個命令能夠檢查(或甚至建議)括號、引號和其他符號的匹配,那也會" -"很有用。" +"是否需要縮排標記 (:data:`~token.INDENT` token)),那就更棒了。自動完成機制可" +"能會使用直譯器的符號表。若有一個命令能夠檢查(或甚至建議)括號、引號和其他符" +"號的匹配,那也會很有用。" #: ../../tutorial/interactive.rst:45 msgid "" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 24379ff4c5..5f3f9461b1 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -29,20 +29,19 @@ msgid "Invoking the Interpreter" msgstr "啟動直譯器" #: ../../tutorial/interpreter.rst:13 -#, fuzzy msgid "" "The Python interpreter is usually installed as |" "usr_local_bin_python_x_dot_y_literal| on those machines where it is " "available; putting :file:`/usr/local/bin` in your Unix shell's search path " "makes it possible to start it by typing the command:" msgstr "" -"Python 直譯器一般安裝在 :file:`/usr/local/bin/python3.12` 路徑下;將 :file:`/" -"usr/local/bin` 加入Unix shell 的搜索路徑,輸入以下指令就可以啟動 Python:" +"在有安裝的機器上 Python 直譯器通常是被安裝在 |" +"usr_local_bin_python_x_dot_y_literal|;把 :file:`/usr/local/bin` 放在 Unix " +"shell 的搜尋路徑中就可以透過輸入指令來啟動它:" #: ../../tutorial/interpreter.rst:17 -#, fuzzy msgid "python3.13" -msgstr "python3.12" +msgstr "python3.13" #: ../../tutorial/interpreter.rst:21 msgid "" @@ -113,10 +112,10 @@ msgstr "" #: ../../tutorial/interpreter.rst:51 msgid "" "A second way of starting the interpreter is ``python -c command [arg] ...``, " -"which executes the statement(s) in *command*, analogous to the shell's :" -"option:`-c` option. Since Python statements often contain spaces or other " -"characters that are special to the shell, it is usually advised to quote " -"*command* in its entirety." +"which executes the statement(s) in *command*, analogous to the " +"shell's :option:`-c` option. Since Python statements often contain spaces " +"or other characters that are special to the shell, it is usually advised to " +"quote *command* in its entirety." msgstr "" "另一個啟動直譯器的方式為 ``python -c command [arg] ...``,它會執行在 " "*command* 裡的指令(們),行為如同 shell 的 :option:`-c` 選項。因為 Python 的" @@ -134,8 +133,8 @@ msgstr "" #: ../../tutorial/interpreter.rst:61 msgid "" "When a script file is used, it is sometimes useful to be able to run the " -"script and enter interactive mode afterwards. This can be done by passing :" -"option:`-i` before the script." +"script and enter interactive mode afterwards. This can be done by " +"passing :option:`-i` before the script." msgstr "" "當要執行一個腳本檔時,有時候會希望在腳本結束時進入互動模式。此時可在執行腳本" "的指令加入 :option:`-i`。" @@ -167,10 +166,10 @@ msgstr "" "並指派給 ``sys`` 模組的 ``argv`` 變數。你可以執行 ``import sys`` 取得這個串" "列。這個串列的長度至少為一;當沒有給任何腳本名稱和引數時, ``sys.argv[0]`` 為" "空字串。當腳本名為 ``'-'``\\ (指標準輸入)時, ``sys.argv[0]`` 為 ``'-'``。" -"當使用 :option:`-c` *command* 時, ``sys.argv[0]`` 為 ``'-c'``。當使用 :" -"option:`-m` *module* 時, ``sys.argv[0]`` 為該模組存在的完整路徑。其餘非 :" -"option:`-c` *command* 或 :option:`-m` *module* 的選項不會被 Python 直譯器吸收" -"掉,而是留在 ``sys.argv`` 變數中給後續的 command 或 module 使用。" +"當使用 :option:`-c` *command* 時, ``sys.argv[0]`` 為 ``'-c'``。當使" +"用 :option:`-m` *module* 時, ``sys.argv[0]`` 為該模組存在的完整路徑。其餘" +"非 :option:`-c` *command* 或 :option:`-m` *module* 的選項不會被 Python 直譯器" +"吸收掉,而是留在 ``sys.argv`` 變數中給後續的 command 或 module 使用。" #: ../../tutorial/interpreter.rst:89 msgid "Interactive Mode" @@ -192,7 +191,6 @@ msgstr "" "符: ::" #: ../../tutorial/interpreter.rst:98 -#, fuzzy msgid "" "$ python3.13\n" "Python 3.13 (default, April 4 2023, 09:25:04)\n" @@ -201,8 +199,8 @@ msgid "" "information.\n" ">>>" msgstr "" -"$ python3.12\n" -"Python 3.12 (default, April 4 2022, 09:25:04)\n" +"$ python3.13\n" +"Python 3.13 (default, April 4 2023, 09:25:04)\n" "[GCC 10.2.0] on linux\n" "Type \"help\", \"copyright\", \"credits\" or \"license\" for more " "information.\n" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index 4db1924d3e..f55a511ab3 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 03:35+0000\n" +"POT-Creation-Date: 2025-02-20 00:13+0000\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,10 +34,11 @@ msgid "" "that a secondary prompt on a line by itself in an example means you must " "type a blank line; this is used to end a multi-line command." msgstr "" -"在下面的例子中,輸入與輸出的區別在於有無提示字元(prompt,:term:`>>>` 和 :" -"term:`...`\\ ):如果要重做範例,你必須在提示字元出現的時候,輸入提示字元後方" -"的所有內容;那些非提示字元開始的文字行是直譯器的輸出。注意到在範例中,若出現" -"單行只有次提示字元時,代表該行你必須直接換行;這被使用在多行指令結束輸入時。" +"在下面的例子中,輸入與輸出的區別在於有無提示字元(prompt,:term:`>>>` " +"和 :term:`...`\\ ):如果要重做範例,你必須在提示字元出現的時候,輸入提示字元" +"後方的所有內容;那些非提示字元開始的文字行是直譯器的輸出。注意到在範例中,若" +"出現單行只有次提示字元時,代表該行你必須直接換行;這被使用在多行指令結束輸入" +"時。" #: ../../tutorial/introduction.rst:16 msgid "" @@ -120,8 +121,9 @@ msgstr "" #: ../../tutorial/introduction.rst:68 msgid "" "The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the " -"ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:" -"`float`. We will see more about numeric types later in the tutorial." +"ones with a fractional part (e.g. ``5.0``, ``1.6``) have " +"type :class:`float`. We will see more about numeric types later in the " +"tutorial." msgstr "" "整數數字(即 ``2``、``4``、``20``)為 :class:`int` 型態,數字有小數點部份的" "(即 ``5.0``、``1.6``)為 :class:`float` 型態。我們將在之後的教學中看到更多數" @@ -256,15 +258,15 @@ msgstr "" #: ../../tutorial/introduction.rst:132 msgid "" "In addition to :class:`int` and :class:`float`, Python supports other types " -"of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions." -"Fraction`. Python also has built-in support for :ref:`complex numbers " -"<typesnumeric>`, and uses the ``j`` or ``J`` suffix to indicate the " -"imaginary part (e.g. ``3+5j``)." +"of numbers, such as :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Python also has built-in support " +"for :ref:`complex numbers <typesnumeric>`, and uses the ``j`` or ``J`` " +"suffix to indicate the imaginary part (e.g. ``3+5j``)." msgstr "" -"除了 :class:`int` 和 :class:`float`,Python 還支援了其他的數字型態,包含 :" -"class:`~decimal.Decimal` 和 :class:`~fractions.Fraction`。Python 亦內建支援" -"\\ :ref:`複數 (complex numbers) <typesnumeric>`,並使用 ``j`` 和 ``J`` 後綴來" -"指定虛數的部份(即 ``3+5j``)。" +"除了 :class:`int` 和 :class:`float`,Python 還支援了其他的數字型態,包" +"含 :class:`~decimal.Decimal` 和 :class:`~fractions.Fraction`。Python 亦內建支" +"援\\ :ref:`複數 (complex numbers) <typesnumeric>`,並使用 ``j`` 和 ``J`` 後綴" +"來指定虛數的部份(即 ``3+5j``)。" #: ../../tutorial/introduction.rst:142 msgid "Text" @@ -357,14 +359,14 @@ msgstr "" #: ../../tutorial/introduction.rst:197 msgid "" "String literals can span multiple lines. One way is using triple-quotes: " -"``\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically " -"included in the string, but it's possible to prevent this by adding a ``\\`` " -"at the end of the line. In the following example, the initial newline is " -"not included::" +"``\"\"\"...\"\"\"`` or ``'''...'''``. End-of-line characters are " +"automatically included in the string, but it's possible to prevent this by " +"adding a ``\\`` at the end of the line. In the following example, the " +"initial newline is not included::" msgstr "" "字串文本可以跨越數行。其中一方式是使用三個重覆引號:``\"\"\"...\"\"\"`` 或 " -"``'''...'''``。此時換行會被自動加入字串值中,但也可以在換行前加入 ``\\`` 來取" -"消這個行為。在以下的例子中,最初的換行符不會被包含: ::" +"``'''...'''``。此時換行字元會被自動加入字串值中,但也可以在換行前加入 ``\\`` " +"來取消這個行為。在以下的例子中,最初的換行符不會被包含: ::" #: ../../tutorial/introduction.rst:203 msgid "" @@ -796,8 +798,8 @@ msgstr "" #: ../../tutorial/introduction.rst:421 msgid "" -"You can also add new items at the end of the list, by using the :meth:`!list." -"append` *method* (we will see more about methods later)::" +"You can also add new items at the end of the list, by using the :meth:`!" +"list.append` *method* (we will see more about methods later)::" msgstr "" "你也可以在 list 的最後加入新元素,透過使用 :meth:`!list.append` *方法* " "(method)(我們稍後會看到更多方法的說明): ::" diff --git a/tutorial/modules.po b/tutorial/modules.po index 9a828e3f5e..ba0132e688 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-10-23 20:30+0800\n" "Last-Translator: Phil Lin <linooohon@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -122,7 +122,7 @@ msgid "" "it only adds the module name ``fibo`` there. Using the module name you can " "access the functions::" msgstr "" -"這並不會將 ``fibo`` 中定義的函式名稱直接加入當前的 :term:`namespace` 中(詳情" +"這並不會將 ``fibo`` 中定義的函式名稱直接加入目前的 :term:`namespace` 中(詳情" "請見 :ref:`tut-scopes`);它只會加入 ``fibo`` 的模組名稱。使用此模組名稱,就" "可以存取函式: ::" @@ -184,8 +184,8 @@ msgstr "" "每個模組都有它自己的私有命名空間 (namespace),模組內定義的函式會把該模組的私" "有符號表當成全域命名空間使用。因此,模組的作者可以在模組中使用全域變數,而不" "必擔心和使用者的全域變數發生意外的名稱衝突。另一方面,如果你知道自己在做什" -"麼,你可以用這個方式取用模組的全域變數,以和引用函式一樣的寫法,``modname." -"itemname``。" +"麼,你可以用這個方式取用模組的全域變數,以和引用函式一樣的寫法," +"``modname.itemname``。" #: ../../tutorial/modules.rst:86 msgid "" @@ -262,8 +262,8 @@ msgstr "" #: ../../tutorial/modules.rst:116 msgid "" -"If the module name is followed by :keyword:`!as`, then the name following :" -"keyword:`!as` is bound directly to the imported module." +"If the module name is followed by :keyword:`!as`, then the name " +"following :keyword:`!as` is bound directly to the imported module." msgstr "" "如果模組名稱後面出現 :keyword:`!as`,則 :keyword:`!as` 之後的名稱將直接和被 " "import 模組綁定在一起。" @@ -306,13 +306,13 @@ msgid "" "For efficiency reasons, each module is only imported once per interpreter " "session. Therefore, if you change your modules, you must restart the " "interpreter -- or, if it's just one module you want to test interactively, " -"use :func:`importlib.reload`, e.g. ``import importlib; importlib." -"reload(modulename)``." +"use :func:`importlib.reload`, e.g. ``import importlib; " +"importlib.reload(modulename)``." msgstr "" "出於效率原因,每個模組在每個直譯器 session 中僅會被 import 一次。因此,如果你" "更改了模組,則必須重啟直譯器——或者,如果只是一個想要在互動模式下測試的模組," -"可以使用 :func:`importlib.reload`。例如:``import importlib; importlib." -"reload(modulename)``。" +"可以使用 :func:`importlib.reload`。例如:``import importlib; " +"importlib.reload(modulename)``。" #: ../../tutorial/modules.rst:147 msgid "Executing modules as scripts" @@ -390,10 +390,11 @@ msgstr "模組的搜尋路徑" #: ../../tutorial/modules.rst:186 msgid "" "When a module named :mod:`!spam` is imported, the interpreter first searches " -"for a built-in module with that name. These module names are listed in :data:" -"`sys.builtin_module_names`. If not found, it then searches for a file named :" -"file:`spam.py` in a list of directories given by the variable :data:`sys." -"path`. :data:`sys.path` is initialized from these locations:" +"for a built-in module with that name. These module names are listed " +"in :data:`sys.builtin_module_names`. If not found, it then searches for a " +"file named :file:`spam.py` in a list of directories given by the " +"variable :data:`sys.path`. :data:`sys.path` is initialized from these " +"locations:" msgstr "" "Import 一個名為 :mod:`!spam` 的模組時,直譯器首先會搜尋具有該名稱的內建模組。" "模組名稱列在 :data:`sys.builtin_module_names` 當中。如果找不到,接下來會在變" @@ -404,7 +405,7 @@ msgstr "" msgid "" "The directory containing the input script (or the current directory when no " "file is specified)." -msgstr "輸入腳本所位在的資料夾(如未指定檔案時,則是當前資料夾)。" +msgstr "輸入腳本所位在的資料夾(如未指定檔案時,則是目前資料夾)。" #: ../../tutorial/modules.rst:194 msgid "" @@ -419,8 +420,8 @@ msgid "" "The installation-dependent default (by convention including a ``site-" "packages`` directory, handled by the :mod:`site` module)." msgstr "" -"與安裝相關的預設值(按慣例會包含一個 ``site-packages`` 資料夾,它是由 :mod:" -"`site` 模組所處理)。" +"與安裝相關的預設值(按慣例會包含一個 ``site-packages`` 資料夾,它是" +"由 :mod:`site` 模組所處理)。" #: ../../tutorial/modules.rst:199 msgid "More details are at :ref:`sys-path-init`." @@ -518,8 +519,8 @@ msgstr "" #: ../../tutorial/modules.rst:251 msgid "" "A program doesn't run any faster when it is read from a ``.pyc`` file than " -"when it is read from a ``.py`` file; the only thing that's faster about ``." -"pyc`` files is the speed with which they are loaded." +"when it is read from a ``.py`` file; the only thing that's faster about " +"``.pyc`` files is the speed with which they are loaded." msgstr "" "讀取 ``.pyc`` 檔案時,程式的執行速度並不會比讀取 ``.py`` 檔案快。唯一比較快的" "地方是載入的速度。" @@ -627,7 +628,7 @@ msgid "" ">>> import fibo, sys\n" ">>> dir(fibo)\n" "['__name__', 'fib', 'fib2']\n" -">>> dir(sys) \n" +">>> dir(sys)\n" "['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" " '__interactivehook__', '__loader__', '__name__', '__package__', " "'__spec__',\n" @@ -660,7 +661,7 @@ msgstr "" ">>> import fibo, sys\n" ">>> dir(fibo)\n" "['__name__', 'fib', 'fib2']\n" -">>> dir(sys) \n" +">>> dir(sys)\n" "['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" " '__interactivehook__', '__loader__', '__name__', '__package__', " "'__spec__',\n" @@ -717,8 +718,8 @@ msgstr "請注意,它列出所有類型的名稱:變數、模組、函式等 #: ../../tutorial/modules.rst:350 msgid "" ":func:`dir` does not list the names of built-in functions and variables. If " -"you want a list of those, they are defined in the standard module :mod:" -"`builtins`::" +"you want a list of those, they are defined in the standard " +"module :mod:`builtins`::" msgstr "" ":func:`dir` 不會列出內建函式和變數的名稱。如果你想要列出它們,它們被定義在標" "準模組 :mod:`builtins` 內: ::" @@ -726,7 +727,7 @@ msgstr "" #: ../../tutorial/modules.rst:354 msgid "" ">>> import builtins\n" -">>> dir(builtins) \n" +">>> dir(builtins)\n" "['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" " 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" " 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" @@ -759,7 +760,7 @@ msgid "" " 'zip']" msgstr "" ">>> import builtins\n" -">>> dir(builtins) \n" +">>> dir(builtins)\n" "['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" " 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" " 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" @@ -814,22 +815,23 @@ msgstr "" msgid "" "Suppose you want to design a collection of modules (a \"package\") for the " "uniform handling of sound files and sound data. There are many different " -"sound file formats (usually recognized by their extension, for example: :" -"file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to create and " -"maintain a growing collection of modules for the conversion between the " -"various file formats. There are also many different operations you might " -"want to perform on sound data (such as mixing, adding echo, applying an " -"equalizer function, creating an artificial stereo effect), so in addition " -"you will be writing a never-ending stream of modules to perform these " -"operations. Here's a possible structure for your package (expressed in " -"terms of a hierarchical filesystem):" +"sound file formats (usually recognized by their extension, for " +"example: :file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to " +"create and maintain a growing collection of modules for the conversion " +"between the various file formats. There are also many different operations " +"you might want to perform on sound data (such as mixing, adding echo, " +"applying an equalizer function, creating an artificial stereo effect), so in " +"addition you will be writing a never-ending stream of modules to perform " +"these operations. Here's a possible structure for your package (expressed " +"in terms of a hierarchical filesystem):" msgstr "" "假設你想設計一個能統一處理音訊檔案及音訊數據的模組集(「套件」)。因為音訊檔" -"案有很多的不同的格式(通常以它們的副檔名來辨識,例如::file:`.wav`、:file:`." -"aiff`、:file:`.au`\\ ),因此,為了不同檔案格式之間的轉換,你會需要建立和維護" -"一個不斷增長的模組集合。為了要達成對音訊數據的許多不同作業(例如,音訊混合、" -"增加回聲、套用等化器功能、創造人工立體音效),你將編寫一系列無止盡的模組來執" -"行這些作業。以下是你的套件可能的架構(以階層式檔案系統的方式表示):" +"案有很多的不同的格式(通常以它們的副檔名來辨識,例" +"如::file:`.wav`、:file:`.aiff`、:file:`.au`\\ ),因此,為了不同檔案格式之間" +"的轉換,你會需要建立和維護一個不斷增長的模組集合。為了要達成對音訊數據的許多" +"不同作業(例如,音訊混合、增加回聲、套用等化器功能、創造人工立體音效),你將" +"編寫一系列無止盡的模組來執行這些作業。以下是你的套件可能的架構(以階層式檔案" +"系統的方式表示):" #: ../../tutorial/modules.rst:410 msgid "" @@ -860,8 +862,8 @@ msgstr "" #: ../../tutorial/modules.rst:436 msgid "" -"When importing the package, Python searches through the directories on ``sys." -"path`` looking for the package subdirectory." +"When importing the package, Python searches through the directories on " +"``sys.path`` looking for the package subdirectory." msgstr "Import 套件時,Python 會搜尋 ``sys.path`` 裡的目錄,尋找套件的子目錄。" #: ../../tutorial/modules.rst:439 @@ -874,11 +876,11 @@ msgid "" "can just be an empty file, but it can also execute initialization code for " "the package or set the ``__all__`` variable, described later." msgstr "" -"目錄中必須含有 :file:`__init__.py` 檔案,才會被 Pyhon 當成套件(除非有使用 :" -"term:`namespace package`,為一個相對進階的功能);這樣可以避免一些以常用名稱" -"命名(例如 ``string``\\ )的目錄,無意中隱藏了較晚出現在模組搜尋路徑中的有效" -"模組。在最簡單的情況,:file:`__init__.py` 可以只是一個空白檔案;但它也可以執" -"行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。" +"目錄中必須含有 :file:`__init__.py` 檔案,才會被 Pyhon 當成套件(除非有使" +"用 :term:`namespace package`,為一個相對進階的功能);這樣可以避免一些以常用" +"名稱命名(例如 ``string``\\ )的目錄,無意中隱藏了較晚出現在模組搜尋路徑中的" +"有效模組。在最簡單的情況,:file:`__init__.py` 可以只是一個空白檔案;但它也可" +"以執行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。" #: ../../tutorial/modules.rst:447 msgid "" @@ -933,8 +935,8 @@ msgstr "from sound.effects.echo import echofilter" #: ../../tutorial/modules.rst:470 msgid "" -"Again, this loads the submodule :mod:`!echo`, but this makes its function :" -"func:`!echofilter` directly available::" +"Again, this loads the submodule :mod:`!echo`, but this makes its " +"function :func:`!echofilter` directly available::" msgstr "" "同樣地,這樣也會載入子模組 :mod:`!echo`,但它的函式 :func:`!echofilter` 就可" "以直接使用: ::" @@ -949,8 +951,8 @@ msgid "" "submodule (or subpackage) of the package, or some other name defined in the " "package, like a function, class or variable. The ``import`` statement first " "tests whether the item is defined in the package; if not, it assumes it is a " -"module and attempts to load it. If it fails to find it, an :exc:" -"`ImportError` exception is raised." +"module and attempts to load it. If it fails to find it, " +"an :exc:`ImportError` exception is raised." msgstr "" "請注意,使用 ``from package import item`` 時,item 可以是套件的子模組(或子套" "件),也可以是套件中被定義的名稱,像是函式、class (類別)或變數。``import`` " @@ -1001,8 +1003,8 @@ msgstr "" "慣例:如果套件的 :file:`__init__.py` 程式碼有定義一個名為 ``__all__`` 的 " "list,若遇到 ``from package import *`` 的時候,它就會是要被 import 的模組名" "稱。發布套件的新版本時,套件作者可自行決定是否更新此 list。如果套件作者認為沒" -"有人會從他的套件中 import \\*,他也可能會決定不支援這個 list。舉例來說,:" -"file:`sound/effects/__init__.py` 檔案可包含以下程式碼: ::" +"有人會從他的套件中 import \\*,他也可能會決定不支援這個 list。舉例來" +"說,:file:`sound/effects/__init__.py` 檔案可包含以下程式碼: ::" #: ../../tutorial/modules.rst:511 msgid "__all__ = [\"echo\", \"surround\", \"reverse\"]" @@ -1025,8 +1027,8 @@ msgid "" "submodule, because it is shadowed by the locally defined ``reverse`` " "function::" msgstr "" -"請注意,子模組可能會被區域定義 (locally defined) 的名稱遮蔽。例如,如果你在 :" -"file:`sound/effects/__init__.py` 檔案中新增了一個 ``reverse`` 函式,則 " +"請注意,子模組可能會被區域定義 (locally defined) 的名稱遮蔽。例如,如果你" +"在 :file:`sound/effects/__init__.py` 檔案中新增了一個 ``reverse`` 函式,則 " "``from sound.effects import *`` 只會引入兩個子模組 ``echo`` 和 ``surround``," "但\\ *不是* ``reverse`` 子模組,因為它被區域定義的 ``reverse`` 函式遮蔽" "了: ::" @@ -1047,20 +1049,20 @@ msgstr "" msgid "" "If ``__all__`` is not defined, the statement ``from sound.effects import *`` " "does *not* import all submodules from the package :mod:`!sound.effects` into " -"the current namespace; it only ensures that the package :mod:`!sound." -"effects` has been imported (possibly running any initialization code in :" -"file:`__init__.py`) and then imports whatever names are defined in the " +"the current namespace; it only ensures that the package :mod:`!" +"sound.effects` has been imported (possibly running any initialization code " +"in :file:`__init__.py`) and then imports whatever names are defined in the " "package. This includes any names defined (and submodules explicitly loaded) " "by :file:`__init__.py`. It also includes any submodules of the package that " "were explicitly loaded by previous :keyword:`import` statements. Consider " "this code::" msgstr "" "如果 ``__all__`` 沒有被定義,``from sound.effects import *`` 陳述式\\ *並不會" -"*\\ 把 :mod:`!sound.effects` 套件中所有子模組都 import 到當前的命名空間;它只" +"*\\ 把 :mod:`!sound.effects` 套件中所有子模組都 import 到目前的命名空間;它只" "保證 :mod:`!sound.effects` 套件有被 import(可能會運行 :file:`__init__.py` 中" -"的初始化程式碼),然後 import 套件中被定義的全部名稱。這包含 :file:`__init__." -"py` 定義(以及被明確載入的子模組)的任何名稱。它也包括任何之前被 :keyword:" -"`import` 陳述式明確載入的套件子模組。請看以下程式碼: ::" +"的初始化程式碼),然後 import 套件中被定義的全部名稱。這包" +"含 :file:`__init__.py` 定義(以及被明確載入的子模組)的任何名稱。它也包括任何" +"之前被 :keyword:`import` 陳述式明確載入的套件子模組。請看以下程式碼: ::" #: ../../tutorial/modules.rst:541 msgid "" @@ -1075,12 +1077,12 @@ msgstr "" #: ../../tutorial/modules.rst:545 msgid "" "In this example, the :mod:`!echo` and :mod:`!surround` modules are imported " -"in the current namespace because they are defined in the :mod:`!sound." -"effects` package when the ``from...import`` statement is executed. (This " -"also works when ``__all__`` is defined.)" +"in the current namespace because they are defined in the :mod:`!" +"sound.effects` package when the ``from...import`` statement is executed. " +"(This also works when ``__all__`` is defined.)" msgstr "" "此例中,當 ``from...import`` 陳述式被執行時,:mod:`!echo` 和 :mod:`!" -"surround` 模組被 import 進當前的命名空間,因為它們是在 :mod:`!sound.effects` " +"surround` 模組被 import 進目前的命名空間,因為它們是在 :mod:`!sound.effects` " "套件裡定義的。(當 ``__all__`` 有被定義時,這規則也有效。)" #: ../../tutorial/modules.rst:550 @@ -1110,24 +1112,24 @@ msgstr "套件內引用" msgid "" "When packages are structured into subpackages (as with the :mod:`!sound` " "package in the example), you can use absolute imports to refer to submodules " -"of siblings packages. For example, if the module :mod:`!sound.filters." -"vocoder` needs to use the :mod:`!echo` module in the :mod:`!sound.effects` " -"package, it can use ``from sound.effects import echo``." +"of siblings packages. For example, if the module :mod:`!" +"sound.filters.vocoder` needs to use the :mod:`!echo` module in the :mod:`!" +"sound.effects` package, it can use ``from sound.effects import echo``." msgstr "" "當套件的結構為多個子套件的組合時(如同範例中的 :mod:`!sound` 套件),可以使用" -"「絕對 (absolute) import」,引用同層套件中的子模組。例如,要在 :mod:`!sound." -"filters.vocoder` 模組中使用 :mod:`!sound.effects` 中的 :mod:`!echo` 模組時," -"可以用 ``from sound.effects import echo``。" +"「絕對 (absolute) import」,引用同層套件中的子模組。例如,要在 :mod:`!" +"sound.filters.vocoder` 模組中使用 :mod:`!sound.effects` 中的 :mod:`!echo` 模" +"組時,可以用 ``from sound.effects import echo``。" #: ../../tutorial/modules.rst:571 msgid "" "You can also write relative imports, with the ``from module import name`` " "form of import statement. These imports use leading dots to indicate the " -"current and parent packages involved in the relative import. From the :mod:" -"`!surround` module for example, you might use::" +"current and parent packages involved in the relative import. From " +"the :mod:`!surround` module for example, you might use::" msgstr "" "你也可以用 ``from module import name`` 的 import 陳述式,編寫「相對 " -"(relative) import」。這些 import 使用前導句號指示相對 import 中的當前套件和母" +"(relative) import」。這些 import 使用前導句號指示相對 import 中的目前套件和母" "套件。例如,在 :mod:`!urround` 模組中,你可以使用: ::" #: ../../tutorial/modules.rst:576 @@ -1163,10 +1165,10 @@ msgid "" "that file is executed. This variable can be modified; doing so affects " "future searches for modules and subpackages contained in the package." msgstr "" -"套件也支援一個特殊屬性 :attr:`~module.__path__`。它在初始化時是一個字串的\\ :" -"term:`序列 <sequence>`\\ 的 :file:`__init__.py` 檔案所在的目錄名稱,初始化時" -"機是在這個檔案的程式碼被執行之前。這個變數可以被修改,但這樣做會影響將來對套" -"件內的模組和子套件的搜尋。" +"套件也支援一個特殊屬性 :attr:`~module.__path__`。它在初始化時是一個字串的" +"\\ :term:`序列 <sequence>`\\ 的 :file:`__init__.py` 檔案所在的目錄名稱,初始" +"化時機是在這個檔案的程式碼被執行之前。這個變數可以被修改,但這樣做會影響將來" +"對套件內的模組和子套件的搜尋。" #: ../../tutorial/modules.rst:595 msgid "" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index ed03a48a61..854ddf9677 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -49,6 +48,12 @@ msgid "" ">>> os.system('mkdir today') # Run the command mkdir in the system shell\n" "0" msgstr "" +">>> import os\n" +">>> os.getcwd() # 回傳目前的工作目錄\n" +"'C:\\\\Python313'\n" +">>> os.chdir('/server/accesslogs') # 改變目前的工作目錄\n" +">>> os.system('mkdir today') # 在系統 shell 中執行 mkdir 指令\n" +"0" #: ../../tutorial/stdlib.rst:23 msgid "" @@ -133,8 +138,8 @@ msgid "" "arguments are stored in the :mod:`sys` module's *argv* attribute as a list. " "For instance, let's take the following :file:`demo.py` file::" msgstr "" -"通用工具腳本常需要處理命令列引數。這些引數會以 list(串列)形式存放在 :mod:" -"`sys` 模組的 *argv* 屬性中。例如以下 :file:`demo.py` 檔案: ::" +"通用工具腳本常需要處理命令列引數。這些引數會以 list(串列)形式存放" +"在 :mod:`sys` 模組的 *argv* 屬性中。例如以下 :file:`demo.py` 檔案: ::" #: ../../tutorial/stdlib.rst:70 msgid "" @@ -189,9 +194,9 @@ msgstr "" #: ../../tutorial/stdlib.rst:93 msgid "" -"When run at the command line with ``python top.py --lines=5 alpha.txt beta." -"txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` to " -"``['alpha.txt', 'beta.txt']``." +"When run at the command line with ``python top.py --lines=5 alpha.txt " +"beta.txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` " +"to ``['alpha.txt', 'beta.txt']``." msgstr "" "當 ``python top.py --lines=5 alpha.txt beta.txt`` 在命令列執行時,該腳本會將 " "``args.lines`` 設為 ``5``,並將 ``args.filenames`` 設為 ``['alpha.txt', " @@ -215,6 +220,8 @@ msgid "" ">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" "Warning, log file not found starting a new one" msgstr "" +">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" +"Warning, log file not found starting a new one" #: ../../tutorial/stdlib.rst:110 msgid "The most direct way to terminate a script is to use ``sys.exit()``." @@ -303,6 +310,15 @@ msgid "" ">>> random.randrange(6) # random integer chosen from range(6)\n" "4" msgstr "" +">>> import random\n" +">>> random.choice(['apple', 'pear', 'banana'])\n" +"'apple'\n" +">>> random.sample(range(100), 10) # 不重複抽樣\n" +"[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n" +">>> random.random() # 區間 [0.0, 1.0) 中的隨機浮點數\n" +"0.17970987693706186\n" +">>> random.randrange(6) # 從 range(6) 中隨機選擇整數\n" +"4" #: ../../tutorial/stdlib.rst:161 msgid "" @@ -348,8 +364,9 @@ msgid "" "internet protocols. Two of the simplest are :mod:`urllib.request` for " "retrieving data from URLs and :mod:`smtplib` for sending mail::" msgstr "" -"Python 中有許多存取網路以及處理網路協定。最簡單的兩個例子包括 :mod:`urllib." -"request` 模組可以從網址抓取資料以及 :mod:`smtplib` 可以用來寄郵件: ::" +"Python 中有許多存取網路以及處理網路協定。最簡單的兩個例子包" +"括 :mod:`urllib.request` 模組可以從網址抓取資料以及 :mod:`smtplib` 可以用來寄" +"郵件: ::" #: ../../tutorial/stdlib.rst:185 msgid "" @@ -373,6 +390,25 @@ msgid "" "... \"\"\")\n" ">>> server.quit()" msgstr "" +">>> from urllib.request import urlopen\n" +">>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as " +"response:\n" +"... for line in response:\n" +"... line = line.decode() # 將 bytes 轉換為 str\n" +"... if line.startswith('datetime'):\n" +"... print(line.rstrip()) # 移除最後面的換行符號\n" +"...\n" +"datetime: 2022-01-01T01:36:47.689215+00:00\n" +"\n" +">>> import smtplib\n" +">>> server = smtplib.SMTP('localhost')\n" +">>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',\n" +"... \"\"\"To: jcaesar@example.org\n" +"... From: soothsayer@example.org\n" +"...\n" +"... Beware the Ides of March.\n" +"... \"\"\")\n" +">>> server.quit()" #: ../../tutorial/stdlib.rst:204 msgid "(Note that the second example needs a mailserver running on localhost.)" @@ -392,9 +428,7 @@ msgid "" msgstr "" ":mod:`datetime` 模組提供許多 class 可以操作日期以及時間,從簡單從複雜都有。模" "組支援日期與時間的運算,而實作的重點是有效率的成員擷取以達到輸出格式化以及操" -"作。模組也提供支援時區換算的類別。\n" -"\n" -"::" +"作。模組也提供支援時區換算的類別。 ::" #: ../../tutorial/stdlib.rst:218 msgid "" @@ -412,6 +446,19 @@ msgid "" ">>> age.days\n" "14368" msgstr "" +">>> # 能夠輕易建立與格式化\n" +">>> from datetime import date\n" +">>> now = date.today()\n" +">>> now\n" +"datetime.date(2003, 12, 2)\n" +">>> now.strftime(\"%m-%d-%y. %d %b %Y is a %A on the %d day of %B.\")\n" +"'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'\n" +"\n" +">>> # 支援運算\n" +">>> birthday = date(1964, 7, 31)\n" +">>> age = now - birthday\n" +">>> age.days\n" +"14368" #: ../../tutorial/stdlib.rst:236 msgid "Data Compression" @@ -420,13 +467,13 @@ msgstr "資料壓縮" #: ../../tutorial/stdlib.rst:238 msgid "" "Common data archiving and compression formats are directly supported by " -"modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:" -"`zipfile` and :mod:`tarfile`. ::" +"modules " +"including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:`zipfile` " +"and :mod:`tarfile`. ::" msgstr "" -"常見的解壓縮以及壓縮格式都有直接支援的模組。包括::mod:`zlib`、:mod:`gzip`、:" -"mod:`bz2`、:mod:`lzma`、:mod:`zipfile` 以及 :mod:`tarfile`。\n" -"\n" -"::" +"常見的解壓縮以及壓縮格式都有直接支援的模組。包" +"括::mod:`zlib`、:mod:`gzip`、:mod:`bz2`、:mod:`lzma`、:mod:`zipfile` 以" +"及 :mod:`tarfile`。 ::" #: ../../tutorial/stdlib.rst:242 msgid "" @@ -442,6 +489,17 @@ msgid "" ">>> zlib.crc32(s)\n" "226805979" msgstr "" +">>> import zlib\n" +">>> s = b'witch which has which witches wrist watch'\n" +">>> len(s)\n" +"41\n" +">>> t = zlib.compress(s)\n" +">>> len(t)\n" +"37\n" +">>> zlib.decompress(t)\n" +"b'witch which has which witches wrist watch'\n" +">>> zlib.crc32(s)\n" +"226805979" #: ../../tutorial/stdlib.rst:258 msgid "Performance Measurement" @@ -459,11 +517,12 @@ msgstr "" #: ../../tutorial/stdlib.rst:264 msgid "" "For example, it may be tempting to use the tuple packing and unpacking " -"feature instead of the traditional approach to swapping arguments. The :mod:" -"`timeit` module quickly demonstrates a modest performance advantage::" +"feature instead of the traditional approach to swapping arguments. " +"The :mod:`timeit` module quickly demonstrates a modest performance " +"advantage::" msgstr "" -"舉例來說,有人可能會試著用 tuple 的打包機制來交換引數代替傳統的方式。:mod:" -"`timeit` 模組可以迅速地展示效能的進步: ::" +"舉例來說,有人可能會試著用 tuple 的打包機制來交換引數代替傳統的方" +"式。:mod:`timeit` 模組可以迅速地展示效能的進步: ::" #: ../../tutorial/stdlib.rst:268 msgid "" @@ -485,9 +544,9 @@ msgid "" "and :mod:`pstats` modules provide tools for identifying time critical " "sections in larger blocks of code." msgstr "" -"相對於 :mod:`timeit` 模組提供這麼細的粒度,:mod:`profile` 模組以及 :mod:" -"`pstats` 模組則提供了一些在大型的程式碼識別時間使用上關鍵的區塊 (time " -"critical section) 的工具。" +"相對於 :mod:`timeit` 模組提供這麼細的粒度,:mod:`profile` 模組以" +"及 :mod:`pstats` 模組則提供了一些在大型的程式碼識別時間使用上關鍵的區塊 " +"(time critical section) 的工具。" #: ../../tutorial/stdlib.rst:282 msgid "Quality Control" @@ -529,6 +588,16 @@ msgid "" "import doctest\n" "doctest.testmod() # automatically validate the embedded tests" msgstr "" +"def average(values):\n" +" \"\"\"計算數字串列的算術平均數。\n" +"\n" +" >>> print(average([20, 30, 70]))\n" +" 40.0\n" +" \"\"\"\n" +" return sum(values) / len(values)\n" +"\n" +"import doctest\n" +"doctest.testmod() # 自動驗證內嵌的測試" #: ../../tutorial/stdlib.rst:306 msgid "" @@ -555,6 +624,19 @@ msgid "" "\n" "unittest.main() # Calling from the command line invokes all tests" msgstr "" +"import unittest\n" +"\n" +"class TestStatisticalFunctions(unittest.TestCase):\n" +"\n" +" def test_average(self):\n" +" self.assertEqual(average([20, 30, 70]), 40.0)\n" +" self.assertEqual(round(average([1, 5, 7]), 1), 4.3)\n" +" with self.assertRaises(ZeroDivisionError):\n" +" average([])\n" +" with self.assertRaises(TypeError):\n" +" average(20, 30, 70)\n" +"\n" +"unittest.main() # 從命令列呼叫會執行所有測試" #: ../../tutorial/stdlib.rst:328 msgid "Batteries Included" @@ -598,16 +680,16 @@ msgid "" "The :mod:`json` package provides robust support for parsing this popular " "data interchange format. The :mod:`csv` module supports direct reading and " "writing of files in Comma-Separated Value format, commonly supported by " -"databases and spreadsheets. XML processing is supported by the :mod:`xml." -"etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, " -"these modules and packages greatly simplify data interchange between Python " -"applications and other tools." +"databases and spreadsheets. XML processing is supported by " +"the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` " +"packages. Together, these modules and packages greatly simplify data " +"interchange between Python applications and other tools." msgstr "" ":mod:`json` 套件對 JSON 資料交換格式的剖析,提供強大的支援。:mod:`csv` 模組則" -"提供直接讀寫 CSV(以逗號分隔值的檔案格式,通常資料庫和電子表格都有支援)。:" -"mod:`xml.etree.ElementTree`、:mod:`xml.dom` 與 :mod:`xml.sax` 套件則支援 XML " -"的處理。綜觀所有,這些模組和套件都簡化了 Python 應用程式與其他工具之間的資料" -"交換。" +"提供直接讀寫 CSV(以逗號分隔值的檔案格式,通常資料庫和電子表格都有支" +"援)。:mod:`xml.etree.ElementTree`、:mod:`xml.dom` 與 :mod:`xml.sax` 套件則支" +"援 XML 的處理。綜觀所有,這些模組和套件都簡化了 Python 應用程式與其他工具之間" +"的資料交換。" #: ../../tutorial/stdlib.rst:353 msgid "" @@ -620,8 +702,8 @@ msgstr "" #: ../../tutorial/stdlib.rst:357 msgid "" -"Internationalization is supported by a number of modules including :mod:" -"`gettext`, :mod:`locale`, and the :mod:`codecs` package." +"Internationalization is supported by a number of modules " +"including :mod:`gettext`, :mod:`locale`, and the :mod:`codecs` package." msgstr "" "有數種支援國際化的模組,包括 :mod:`gettext`、:mod:`locale` 和 :mod:`codecs` " "等套件。" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index 1b2f36d17e..deded95c48 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -189,15 +189,15 @@ msgstr "" msgid "" "The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when " "a placeholder is not supplied in a dictionary or a keyword argument. For " -"mail-merge style applications, user supplied data may be incomplete and the :" -"meth:`~string.Template.safe_substitute` method may be more appropriate --- " -"it will leave placeholders unchanged if data is missing::" +"mail-merge style applications, user supplied data may be incomplete and " +"the :meth:`~string.Template.safe_substitute` method may be more appropriate " +"--- it will leave placeholders unchanged if data is missing::" msgstr "" -"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那麼 :meth:`~string." -"Template.substitute` method 將引發 :exc:`KeyError`。對於郵件合併 (mail-" -"merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使用 :meth:" -"`~string.Template.safe_substitute` method 會更適當——如果資料有缺少,它會保持" -"佔位符號不變: ::" +"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那" +"麼 :meth:`~string.Template.substitute` method 將引發 :exc:`KeyError`。對於郵" +"件合併 (mail-merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使" +"用 :meth:`~string.Template.safe_substitute` method 會更適當——如果資料有缺少," +"它會保持佔位符號不變: ::" #: ../../tutorial/stdlib2.rst:94 msgid "" @@ -285,20 +285,20 @@ msgstr "二進制資料記錄編排 (Binary Data Record Layouts)" #: ../../tutorial/stdlib2.rst:136 msgid "" -"The :mod:`struct` module provides :func:`~struct.pack` and :func:`~struct." -"unpack` functions for working with variable length binary record formats. " -"The following example shows how to loop through header information in a ZIP " -"file without using the :mod:`zipfile` module. Pack codes ``\"H\"`` and " -"``\"I\"`` represent two and four byte unsigned numbers respectively. The " -"``\"<\"`` indicates that they are standard size and in little-endian byte " -"order::" +"The :mod:`struct` module provides :func:`~struct.pack` " +"and :func:`~struct.unpack` functions for working with variable length binary " +"record formats. The following example shows how to loop through header " +"information in a ZIP file without using the :mod:`zipfile` module. Pack " +"codes ``\"H\"`` and ``\"I\"`` represent two and four byte unsigned numbers " +"respectively. The ``\"<\"`` indicates that they are standard size and in " +"little-endian byte order::" msgstr "" ":mod:`struct` 模組提供了 :func:`~struct.pack` 和 :func:`~struct.unpack` 函" -"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使用 :mod:" -"`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 (header " -"information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位元組的無" -"符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 (little-" -"endian) 位元組順序: ::" +"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使" +"用 :mod:`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 " +"(header information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位" +"元組的無符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 " +"(little-endian) 位元組順序: ::" #: ../../tutorial/stdlib2.rst:144 msgid "" @@ -413,9 +413,10 @@ msgid "" "and more reliable." msgstr "" "儘管這些工具很強大,但很小的設計錯誤也可能導致一些難以重現的問題。所以,任務" -"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使用 :mod:" -"`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使用 :class:" -"`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、更可靠。" +"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使" +"用 :mod:`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使" +"用 :class:`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、" +"更可靠。" #: ../../tutorial/stdlib2.rst:214 msgid "Logging" @@ -424,8 +425,8 @@ msgstr "日誌記錄 (Logging)" #: ../../tutorial/stdlib2.rst:216 msgid "" "The :mod:`logging` module offers a full featured and flexible logging " -"system. At its simplest, log messages are sent to a file or to ``sys." -"stderr``::" +"system. At its simplest, log messages are sent to a file or to " +"``sys.stderr``::" msgstr "" ":mod:`logging` 模組提供功能齊全且富彈性的日誌記錄系統。在最簡單的情況下,日誌" "訊息會被發送到檔案或 ``sys.stderr``: ::" @@ -465,15 +466,16 @@ msgid "" "By default, informational and debugging messages are suppressed and the " "output is sent to standard error. Other output options include routing " "messages through email, datagrams, sockets, or to an HTTP Server. New " -"filters can select different routing based on message priority: :const:" -"`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:" -"`~logging.ERROR`, and :const:`~logging.CRITICAL`." +"filters can select different routing based on message " +"priority: :const:`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:`~logging.ERROR`, " +"and :const:`~logging.CRITICAL`." msgstr "" "在預設情況,資訊和除錯訊息不會被顯示,其輸出會被發送到標準錯誤 (standard " "error)。其他輸出選項包括,將訊息轉發到電子郵件、資料報 (datagram)、網路插座 " "(socket) 或 HTTP 伺服器。新的過濾器可以根據訊息的優先順序,選擇不同的路由 " -"(routing) 方式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:" -"`~logging.WARNING`、:const:`~logging.ERROR` 及 :const:`~logging.CRITICAL`。" +"(routing) 方" +"式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:`~logging.WARNING`、:const:`~logging.ERROR` " +"及 :const:`~logging.CRITICAL`。" #: ../../tutorial/stdlib2.rst:241 msgid "" @@ -716,7 +718,7 @@ msgid "" "results in decimal floating point and binary floating point. The difference " "becomes significant if the results are rounded to the nearest cent::" msgstr "" -"例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮" +"例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮" "點數,會算出不同的答案。如果把計算結果四捨五入到最接近的美分,兩者的差異會更" "顯著: ::" diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index d963db60c2..fdb1401fbd 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -89,7 +89,7 @@ msgstr "" #: ../../tutorial/whatnow.rst:36 msgid "https://docs.python.org: Fast access to Python's documentation." -msgstr "https://docs.python.org:快速訪問 Python 的文件。" +msgstr "https://docs.python.org:快速存取 Python 的文件。" #: ../../tutorial/whatnow.rst:38 msgid "" diff --git a/using/android.po b/using/android.po index 24f937b566..868d2e3659 100644 --- a/using/android.po +++ b/using/android.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-02 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,51 +60,51 @@ msgstr "將 Python 加入 Android 應用程式" #: ../../using/android.rst:30 msgid "" -"These instructions are only needed if you're planning to compile Python for " -"Android yourself. Most users should *not* need to do this. Instead, use one " -"of the following tools, which will provide a much easier experience:" +"Most app developers should use one of the following tools, which will " +"provide a much easier experience:" msgstr "" -#: ../../using/android.rst:34 +#: ../../using/android.rst:33 msgid "" "`Briefcase <https://briefcase.readthedocs.io>`__, from the BeeWare project" msgstr "`Briefcase <https://briefcase.readthedocs.io>`__,由 BeeWare 專案提供" -#: ../../using/android.rst:35 +#: ../../using/android.rst:34 msgid "`Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project" msgstr "`Buildozer <https://buildozer.readthedocs.io>`__,由 Kivy 專案提供" -#: ../../using/android.rst:36 +#: ../../using/android.rst:35 msgid "`Chaquopy <https://chaquo.com/chaquopy>`__" msgstr "`Chaquopy <https://chaquo.com/chaquopy>`__" -#: ../../using/android.rst:37 +#: ../../using/android.rst:36 msgid "" "`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" msgstr "" "`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" -#: ../../using/android.rst:38 +#: ../../using/android.rst:37 msgid "`Termux <https://termux.dev/en/>`__" msgstr "`Termux <https://termux.dev/en/>`__" -#: ../../using/android.rst:40 +#: ../../using/android.rst:39 msgid "" "If you're sure you want to do all of this manually, read on. You can use " "the :source:`testbed app <Android/testbed>` as a guide; each step below " "contains a link to the relevant file." msgstr "" -#: ../../using/android.rst:44 +#: ../../using/android.rst:43 msgid "" -"Build Python by following the instructions in :source:`Android/README.md`." +"Build Python by following the instructions in :source:`Android/README.md`. " +"This will create the directory ``cross-build/HOST/prefix``." msgstr "" #: ../../using/android.rst:46 msgid "" "Add code to your :source:`build.gradle <Android/testbed/app/build.gradle." "kts>` file to copy the following items into your project. All except your " -"own Python code can be copied from ``cross-build/HOST/prefix/lib``:" +"own Python code can be copied from ``prefix/lib``:" msgstr "" #: ../../using/android.rst:50 diff --git a/using/cmdline.po b/using/cmdline.po index 83a4704e76..670d24139c 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,8 +29,8 @@ msgstr "" #: ../../using/cmdline.rst:16 msgid "" -"Other implementations' command line schemes may differ. See :ref:" -"`implementations` for further resources." +"Other implementations' command line schemes may differ. " +"See :ref:`implementations` for further resources." msgstr "" #: ../../using/cmdline.rst:23 @@ -124,9 +124,9 @@ msgstr "" #: ../../using/cmdline.rst:69 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" -"c\"`` and the current directory will be added to the start of :data:`sys." -"path` (allowing modules in that directory to be imported as top level " -"modules)." +"c\"`` and the current directory will be added to the start " +"of :data:`sys.path` (allowing modules in that directory to be imported as " +"top level modules)." msgstr "" #: ../../using/cmdline.rst:74 @@ -134,8 +134,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_command`` with " "argument ``command``." msgstr "" -"引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." -"run_command``。" +"引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 <auditing>` " +"``cpython.run_command``。" #: ../../using/cmdline.rst:78 msgid "" @@ -178,9 +178,10 @@ msgstr "" #: ../../using/cmdline.rst:105 msgid "" -":option:`-I` option can be used to run the script in isolated mode where :" -"data:`sys.path` contains neither the current directory nor the user's site-" -"packages directory. All ``PYTHON*`` environment variables are ignored, too." +":option:`-I` option can be used to run the script in isolated mode " +"where :data:`sys.path` contains neither the current directory nor the user's " +"site-packages directory. All ``PYTHON*`` environment variables are ignored, " +"too." msgstr "" #: ../../using/cmdline.rst:110 @@ -200,8 +201,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_module`` with " "argument ``module-name``." msgstr "" -"引發一個附帶引數 ``module-name`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." -"run_module``。" +"引發一個附帶引數 ``module-name`` 的\\ :ref:`稽核事件 <auditing>` " +"``cpython.run_module``。" #: ../../using/cmdline.rst:119 msgid ":func:`runpy.run_module`" @@ -232,11 +233,11 @@ msgstr "" #: ../../using/cmdline.rst:137 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" -"\"`` and the current directory will be added to the start of :data:`sys." -"path`." +"\"`` and the current directory will be added to the start " +"of :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:790 +#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:796 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_stdin`` with no " "arguments." @@ -273,9 +274,10 @@ msgstr "" #: ../../using/cmdline.rst:163 msgid "" -":option:`-I` option can be used to run the script in isolated mode where :" -"data:`sys.path` contains neither the script's directory nor the user's site-" -"packages directory. All ``PYTHON*`` environment variables are ignored, too." +":option:`-I` option can be used to run the script in isolated mode " +"where :data:`sys.path` contains neither the script's directory nor the " +"user's site-packages directory. All ``PYTHON*`` environment variables are " +"ignored, too." msgstr "" #: ../../using/cmdline.rst:168 @@ -283,8 +285,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_file`` with " "argument ``filename``." msgstr "" -"引發一個附帶引數 ``filename`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." -"run_file``。" +"引發一個附帶引數 ``filename`` 的\\ :ref:`稽核事件 <auditing>` " +"``cpython.run_file``。" #: ../../using/cmdline.rst:171 msgid ":func:`runpy.run_path`" @@ -361,10 +363,11 @@ msgstr "" #: ../../using/cmdline.rst:246 msgid "" -"Issue a warning when converting :class:`bytes` or :class:`bytearray` to :" -"class:`str` without specifying encoding or comparing :class:`!bytes` or :" -"class:`!bytearray` with :class:`!str` or :class:`!bytes` with :class:`int`. " -"Issue an error when the option is given twice (:option:`!-bb`)." +"Issue a warning when converting :class:`bytes` or :class:`bytearray` " +"to :class:`str` without specifying encoding or comparing :class:`!bytes` " +"or :class:`!bytearray` with :class:`!str` or :class:`!bytes` " +"with :class:`int`. Issue an error when the option is given twice (:option:`!-" +"bb`)." msgstr "" #: ../../using/cmdline.rst:251 @@ -396,8 +399,8 @@ msgstr "" #: ../../using/cmdline.rst:276 msgid "" -"Turn on parser debugging output (for expert only). See also the :envvar:" -"`PYTHONDEBUG` environment variable." +"Turn on parser debugging output (for expert only). See also " +"the :envvar:`PYTHONDEBUG` environment variable." msgstr "" #: ../../using/cmdline.rst:279 @@ -408,8 +411,8 @@ msgstr "" #: ../../using/cmdline.rst:285 msgid "" -"Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` and :" -"envvar:`PYTHONHOME`, that might be set." +"Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` " +"and :envvar:`PYTHONHOME`, that might be set." msgstr "" #: ../../using/cmdline.rst:288 @@ -417,26 +420,46 @@ msgid "See also the :option:`-P` and :option:`-I` (isolated) options." msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" #: ../../using/cmdline.rst:293 +msgid "Enter interactive mode after execution." +msgstr "" + +#: ../../using/cmdline.rst:295 msgid "" -"When a script is passed as first argument or the :option:`-c` option is " -"used, enter interactive mode after executing the script or the command, even " -"when :data:`sys.stdin` does not appear to be a terminal. The :envvar:" -"`PYTHONSTARTUP` file is not read." +"Using the :option:`-i` option will enter interactive mode in any of the " +"following circumstances\\:" +msgstr "" + +#: ../../using/cmdline.rst:297 +msgid "When a script is passed as first argument" msgstr "" #: ../../using/cmdline.rst:298 +msgid "When the :option:`-c` option is used" +msgstr "" + +#: ../../using/cmdline.rst:299 +msgid "When the :option:`-m` option is used" +msgstr "" + +#: ../../using/cmdline.rst:301 +msgid "" +"Interactive mode will start even when :data:`sys.stdin` does not appear to " +"be a terminal. The :envvar:`PYTHONSTARTUP` file is not read." +msgstr "" + +#: ../../using/cmdline.rst:304 msgid "" "This can be useful to inspect global variables or a stack trace when a " "script raises an exception. See also :envvar:`PYTHONINSPECT`." msgstr "" -#: ../../using/cmdline.rst:304 +#: ../../using/cmdline.rst:310 msgid "" "Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " "and :option:`-s` options." msgstr "" -#: ../../using/cmdline.rst:307 +#: ../../using/cmdline.rst:313 msgid "" "In isolated mode :data:`sys.path` contains neither the script's directory " "nor the user's site-packages directory. All ``PYTHON*`` environment " @@ -444,66 +467,66 @@ msgid "" "the user from injecting malicious code." msgstr "" -#: ../../using/cmdline.rst:317 +#: ../../using/cmdline.rst:323 msgid "" -"Remove assert statements and any code conditional on the value of :const:" -"`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " -"adding ``.opt-1`` before the ``.pyc`` extension (see :pep:`488`). See also :" -"envvar:`PYTHONOPTIMIZE`." +"Remove assert statements and any code conditional on the value " +"of :const:`__debug__`. Augment the filename for compiled (:term:`bytecode`) " +"files by adding ``.opt-1`` before the ``.pyc`` extension (see :pep:`488`). " +"See also :envvar:`PYTHONOPTIMIZE`." msgstr "" -#: ../../using/cmdline.rst:322 ../../using/cmdline.rst:332 +#: ../../using/cmdline.rst:328 ../../using/cmdline.rst:338 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr "根據 :pep:`488` 修改 ``.pyc`` 檔案名稱。" -#: ../../using/cmdline.rst:328 +#: ../../using/cmdline.rst:334 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" -#: ../../using/cmdline.rst:338 +#: ../../using/cmdline.rst:344 msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" msgstr "" -#: ../../using/cmdline.rst:340 +#: ../../using/cmdline.rst:346 msgid "" "``python -m module`` command line: Don't prepend the current working " "directory." msgstr "" -#: ../../using/cmdline.rst:342 +#: ../../using/cmdline.rst:348 msgid "" "``python script.py`` command line: Don't prepend the script's directory. If " "it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../using/cmdline.rst:344 +#: ../../using/cmdline.rst:350 msgid "" "``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " "empty string, which means the current working directory." msgstr "" -#: ../../using/cmdline.rst:347 +#: ../../using/cmdline.rst:353 msgid "" "See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " "and :option:`-I` (isolated) options." msgstr "" -#: ../../using/cmdline.rst:355 +#: ../../using/cmdline.rst:361 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../using/cmdline.rst:362 +#: ../../using/cmdline.rst:368 msgid "" -"Turn on hash randomization. This option only has an effect if the :envvar:" -"`PYTHONHASHSEED` environment variable is set to ``0``, since hash " -"randomization is enabled by default." +"Turn on hash randomization. This option only has an effect if " +"the :envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since " +"hash randomization is enabled by default." msgstr "" -#: ../../using/cmdline.rst:366 +#: ../../using/cmdline.rst:372 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`~object.__hash__` values of str and bytes objects are " @@ -512,7 +535,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../using/cmdline.rst:372 +#: ../../using/cmdline.rst:378 msgid "" "Hash randomization is intended to provide protection against a denial-of-" "service caused by carefully chosen inputs that exploit the worst case " @@ -520,85 +543,85 @@ msgid "" "http://ocert.org/advisories/ocert-2011-003.html for details." msgstr "" -#: ../../using/cmdline.rst:377 +#: ../../using/cmdline.rst:383 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -#: ../../using/cmdline.rst:382 +#: ../../using/cmdline.rst:388 msgid "The option is no longer ignored." msgstr "" -#: ../../using/cmdline.rst:388 +#: ../../using/cmdline.rst:394 msgid "" -"Don't add the :data:`user site-packages directory <site.USER_SITE>` to :data:" -"`sys.path`." +"Don't add the :data:`user site-packages directory <site.USER_SITE>` " +"to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:391 +#: ../../using/cmdline.rst:397 msgid "See also :envvar:`PYTHONNOUSERSITE`." msgstr "另請參閱 :envvar:`PYTHONNOUSERSITE`。" -#: ../../using/cmdline.rst:395 ../../using/cmdline.rst:887 -#: ../../using/cmdline.rst:899 +#: ../../using/cmdline.rst:401 ../../using/cmdline.rst:893 +#: ../../using/cmdline.rst:905 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../using/cmdline.rst:400 +#: ../../using/cmdline.rst:406 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later (call :func:`site." -"main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" -#: ../../using/cmdline.rst:408 +#: ../../using/cmdline.rst:414 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" -#: ../../using/cmdline.rst:411 +#: ../../using/cmdline.rst:417 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr "另請參閱 :envvar:`PYTHONUNBUFFERED`。" -#: ../../using/cmdline.rst:413 +#: ../../using/cmdline.rst:419 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" -#: ../../using/cmdline.rst:419 +#: ../../using/cmdline.rst:425 msgid "" "Print a message each time a module is initialized, showing the place " -"(filename or built-in module) from which it is loaded. When given twice (:" -"option:`!-vv`), print a message for each file that is checked for when " +"(filename or built-in module) from which it is loaded. When given twice " +"(:option:`!-vv`), print a message for each file that is checked for when " "searching for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../using/cmdline.rst:424 +#: ../../using/cmdline.rst:430 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" -#: ../../using/cmdline.rst:428 +#: ../../using/cmdline.rst:434 msgid "See also :envvar:`PYTHONVERBOSE`." msgstr "另請參閱 :envvar:`PYTHONVERBOSE`。" -#: ../../using/cmdline.rst:434 +#: ../../using/cmdline.rst:440 msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:437 ../../using/cmdline.rst:915 +#: ../../using/cmdline.rst:443 ../../using/cmdline.rst:921 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: ../../using/cmdline.rst:441 +#: ../../using/cmdline.rst:447 msgid "" "-Wdefault # Warn once per call location\n" "-Werror # Convert to exceptions\n" @@ -609,41 +632,41 @@ msgid "" "-Wignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:449 +#: ../../using/cmdline.rst:455 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: ../../using/cmdline.rst:453 +#: ../../using/cmdline.rst:459 msgid "The full form of argument is::" msgstr "完整的引數形式為: ::" -#: ../../using/cmdline.rst:455 +#: ../../using/cmdline.rst:461 msgid "action:message:category:module:lineno" msgstr "action:message:category:module:lineno" -#: ../../using/cmdline.rst:457 +#: ../../using/cmdline.rst:463 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: ../../using/cmdline.rst:461 +#: ../../using/cmdline.rst:467 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: ../../using/cmdline.rst:464 +#: ../../using/cmdline.rst:470 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: ../../using/cmdline.rst:467 +#: ../../using/cmdline.rst:473 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -651,59 +674,59 @@ msgid "" "warning category." msgstr "" -#: ../../using/cmdline.rst:472 +#: ../../using/cmdline.rst:478 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:475 +#: ../../using/cmdline.rst:481 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: ../../using/cmdline.rst:478 +#: ../../using/cmdline.rst:484 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " -"one option, the action for the last matching option is performed. Invalid :" -"option:`-W` options are ignored (though, a warning message is printed about " -"invalid options when the first warning is issued)." +"one option, the action for the last matching option is performed. " +"Invalid :option:`-W` options are ignored (though, a warning message is " +"printed about invalid options when the first warning is issued)." msgstr "" -#: ../../using/cmdline.rst:483 +#: ../../using/cmdline.rst:489 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " -"environment variable and from within a Python program using the :mod:" -"`warnings` module. For example, the :func:`warnings.filterwarnings` function " -"can be used to use a regular expression on the warning message." +"environment variable and from within a Python program using " +"the :mod:`warnings` module. For example, the :func:`warnings.filterwarnings` " +"function can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:488 ../../using/cmdline.rst:927 +#: ../../using/cmdline.rst:494 ../../using/cmdline.rst:933 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: ../../using/cmdline.rst:494 +#: ../../using/cmdline.rst:500 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: ../../using/cmdline.rst:500 +#: ../../using/cmdline.rst:506 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: ../../using/cmdline.rst:503 +#: ../../using/cmdline.rst:509 msgid "" -"``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" -"`PYTHONFAULTHANDLER`." +"``-X faulthandler`` to enable :mod:`faulthandler`. See " +"also :envvar:`PYTHONFAULTHANDLER`." msgstr "" -#: ../../using/cmdline.rst:508 +#: ../../using/cmdline.rst:514 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -711,23 +734,24 @@ msgid "" "build>`." msgstr "" -#: ../../using/cmdline.rst:515 +#: ../../using/cmdline.rst:521 msgid "" -"``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" -"`tracemalloc` module. By default, only the most recent frame is stored in a " -"traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start tracing with a " -"traceback limit of *NFRAME* frames. See :func:`tracemalloc.start` and :" -"envvar:`PYTHONTRACEMALLOC` for more information." +"``-X tracemalloc`` to start tracing Python memory allocations using " +"the :mod:`tracemalloc` module. By default, only the most recent frame is " +"stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start " +"tracing with a traceback limit of *NFRAME* frames. " +"See :func:`tracemalloc.start` and :envvar:`PYTHONTRACEMALLOC` for more " +"information." msgstr "" -#: ../../using/cmdline.rst:524 +#: ../../using/cmdline.rst:530 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " -"length limitation <int_max_str_digits>`. See also :envvar:" -"`PYTHONINTMAXSTRDIGITS`." +"length limitation <int_max_str_digits>`. See " +"also :envvar:`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: ../../using/cmdline.rst:530 +#: ../../using/cmdline.rst:536 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " @@ -736,45 +760,45 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:538 +#: ../../using/cmdline.rst:544 msgid "" "``-X dev``: enable :ref:`Python Development Mode <devmode>`, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" -#: ../../using/cmdline.rst:544 +#: ../../using/cmdline.rst:550 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode <utf8-mode>`. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode <utf8-mode>` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" -#: ../../using/cmdline.rst:551 +#: ../../using/cmdline.rst:557 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " -"rooted at the given directory instead of to the code tree. See also :envvar:" -"`PYTHONPYCACHEPREFIX`." +"rooted at the given directory instead of to the code tree. See " +"also :envvar:`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:557 +#: ../../using/cmdline.rst:563 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " -"locale-specific default encoding is used for opening files. See also :envvar:" -"`PYTHONWARNDEFAULTENCODING`." +"locale-specific default encoding is used for opening files. See " +"also :envvar:`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:563 +#: ../../using/cmdline.rst:569 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " "to every instruction in code objects. This is useful when smaller code " "objects and pyc files are desired as well as suppressing the extra visual " -"location indicators when the interpreter displays tracebacks. See also :" -"envvar:`PYTHONNODEBUGRANGES`." +"location indicators when the interpreter displays tracebacks. See " +"also :envvar:`PYTHONNODEBUGRANGES`." msgstr "" -#: ../../using/cmdline.rst:572 +#: ../../using/cmdline.rst:578 msgid "" "``-X frozen_modules`` determines whether or not frozen modules are ignored " "by the import machinery. A value of ``on`` means they get imported and " @@ -782,11 +806,11 @@ msgid "" "installed Python (the normal case). If it's under development (running from " "the source tree) then the default is ``off``. Note that the :mod:`!" "importlib_bootstrap` and :mod:`!importlib_bootstrap_external` frozen modules " -"are always used, even if this flag is set to ``off``. See also :envvar:" -"`PYTHON_FROZEN_MODULES`." +"are always used, even if this flag is set to ``off``. See " +"also :envvar:`PYTHON_FROZEN_MODULES`." msgstr "" -#: ../../using/cmdline.rst:583 +#: ../../using/cmdline.rst:589 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -795,36 +819,37 @@ msgid "" "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:591 +#: ../../using/cmdline.rst:597 msgid "" "``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF " "support. When this option is provided, the ``perf`` profiler will be able to " "report Python calls using DWARF information. This option is only available " "on some platforms and will do nothing if is not supported on the current " -"system. The default value is \"off\". See also :envvar:" -"`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." +"system. The default value is \"off\". See " +"also :envvar:`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:600 +#: ../../using/cmdline.rst:606 msgid "" -":samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`, :func:`os." -"process_cpu_count`, and :func:`multiprocessing.cpu_count`. *n* must be " -"greater than or equal to 1. This option may be useful for users who need to " -"limit CPU resources of a container system. See also :envvar:" -"`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." +":samp:`-X cpu_count={n}` " +"overrides :func:`os.cpu_count`, :func:`os.process_cpu_count`, " +"and :func:`multiprocessing.cpu_count`. *n* must be greater than or equal to " +"1. This option may be useful for users who need to limit CPU resources of a " +"container system. See also :envvar:`PYTHON_CPU_COUNT`. If *n* is " +"``default``, nothing is overridden." msgstr "" -#: ../../using/cmdline.rst:609 +#: ../../using/cmdline.rst:615 msgid "" ":samp:`-X presite={package.module}` specifies a module that should be " -"imported before the :mod:`site` module is executed and before the :mod:" -"`__main__` module exists. Therefore, the imported module isn't :mod:" -"`__main__`. This can be used to execute code early during Python " +"imported before the :mod:`site` module is executed and before " +"the :mod:`__main__` module exists. Therefore, the imported module " +"isn't :mod:`__main__`. This can be used to execute code early during Python " "initialization. Python needs to be :ref:`built in debug mode <debug-build>` " "for this option to exist. See also :envvar:`PYTHON_PRESITE`." msgstr "" -#: ../../using/cmdline.rst:618 +#: ../../using/cmdline.rst:624 msgid "" ":samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. " "Setting to ``0`` is only available in builds configured with :option:`--" @@ -832,50 +857,50 @@ msgid "" "threaded-cpython`." msgstr "" -#: ../../using/cmdline.rst:625 +#: ../../using/cmdline.rst:631 msgid "" -"It also allows passing arbitrary values and retrieving them through the :" -"data:`sys._xoptions` dictionary." +"It also allows passing arbitrary values and retrieving them through " +"the :data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:630 +#: ../../using/cmdline.rst:636 msgid "Removed the ``-X showalloccount`` option." msgstr "移除 ``-X showalloccount`` 選項。" -#: ../../using/cmdline.rst:633 +#: ../../using/cmdline.rst:639 msgid "Removed the ``-X oldparser`` option." msgstr "移除 ``-X oldparser`` 選項。" -#: ../../using/cmdline.rst:639 +#: ../../using/cmdline.rst:645 msgid "Controlling color" msgstr "" -#: ../../using/cmdline.rst:641 +#: ../../using/cmdline.rst:647 msgid "" "The Python interpreter is configured by default to use colors to highlight " "output in certain situations such as when displaying tracebacks. This " "behavior can be controlled by setting different environment variables." msgstr "" -#: ../../using/cmdline.rst:645 +#: ../../using/cmdline.rst:651 msgid "" "Setting the environment variable ``TERM`` to ``dumb`` will disable color." msgstr "" -#: ../../using/cmdline.rst:647 +#: ../../using/cmdline.rst:653 msgid "" "If the |FORCE_COLOR|_ environment variable is set, then color will be " "enabled regardless of the value of TERM. This is useful on CI systems which " "aren’t terminals but can still display ANSI escape sequences." msgstr "" -#: ../../using/cmdline.rst:651 +#: ../../using/cmdline.rst:657 msgid "" "If the |NO_COLOR|_ environment variable is set, Python will disable all " "color in the output. This takes precedence over ``FORCE_COLOR``." msgstr "" -#: ../../using/cmdline.rst:654 +#: ../../using/cmdline.rst:660 msgid "" "All these environment variables are used also by other tools to control " "color output. To control the color output only in the Python interpreter, " @@ -884,19 +909,19 @@ msgid "" "``FORCE_COLOR``." msgstr "" -#: ../../using/cmdline.rst:669 +#: ../../using/cmdline.rst:675 msgid "Options you shouldn't use" msgstr "你不該使用的選項" -#: ../../using/cmdline.rst:673 +#: ../../using/cmdline.rst:679 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:681 +#: ../../using/cmdline.rst:687 msgid "Environment variables" msgstr "環境變數" -#: ../../using/cmdline.rst:683 +#: ../../using/cmdline.rst:689 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -904,65 +929,65 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:690 +#: ../../using/cmdline.rst:696 msgid "" "Change the location of the standard Python libraries. By default, the " -"libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" -"`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` and :file:" -"`{exec_prefix}` are installation-dependent directories, both defaulting to :" -"file:`/usr/local`." +"libraries are searched in :file:`{prefix}/lib/python{version}` " +"and :file:`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` " +"and :file:`{exec_prefix}` are installation-dependent directories, both " +"defaulting to :file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:696 +#: ../../using/cmdline.rst:702 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:703 +#: ../../using/cmdline.rst:709 msgid "" "Augment the default search path for module files. The format is the same as " -"the shell's :envvar:`PATH`: one or more directory pathnames separated by :" -"data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows). Non-" +"the shell's :envvar:`PATH`: one or more directory pathnames separated " +"by :data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows). Non-" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:708 +#: ../../using/cmdline.rst:714 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:712 +#: ../../using/cmdline.rst:718 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:716 +#: ../../using/cmdline.rst:722 msgid "" -"An additional directory will be inserted in the search path in front of :" -"envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" +"An additional directory will be inserted in the search path in front " +"of :envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" "options`. The search path can be manipulated from within a Python program as " "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:724 +#: ../../using/cmdline.rst:730 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" -#: ../../using/cmdline.rst:732 +#: ../../using/cmdline.rst:738 msgid "" -"If this is set to a non-empty string, it overrides the :data:`sys." -"platlibdir` value." +"If this is set to a non-empty string, it overrides " +"the :data:`sys.platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:740 +#: ../../using/cmdline.rst:746 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -973,7 +998,7 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:747 ../../using/cmdline.rst:749 +#: ../../using/cmdline.rst:753 ../../using/cmdline.rst:755 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_startup`` with the " "filename as the argument when called on startup." @@ -981,86 +1006,86 @@ msgstr "" "引發一個附帶呼叫啟動時的檔案名稱為引數的\\ :ref:`稽核事件 <auditing>` " "``cpython.run_startup``。" -#: ../../using/cmdline.rst:755 +#: ../../using/cmdline.rst:761 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-O` option. If set to an integer, it is equivalent to specifying :" -"option:`-O` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-O` option. If set to an integer, it is equivalent to " +"specifying :option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:762 +#: ../../using/cmdline.rst:768 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " "by the default implementation of :func:`sys.breakpointhook` which itself is " "called by built-in :func:`breakpoint`. If not set, or set to the empty " "string, it is equivalent to the value \"pdb.set_trace\". Setting this to " -"the string \"0\" causes the default implementation of :func:`sys." -"breakpointhook` to do nothing but return immediately." +"the string \"0\" causes the default implementation " +"of :func:`sys.breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:774 +#: ../../using/cmdline.rst:780 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-d` option. If set to an integer, it is equivalent to specifying :" -"option:`-d` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-d` option. If set to an integer, it is equivalent to " +"specifying :option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:778 +#: ../../using/cmdline.rst:784 msgid "" "This environment variable requires a :ref:`debug build of Python <debug-" "build>`, otherwise it's ignored." msgstr "" -#: ../../using/cmdline.rst:784 +#: ../../using/cmdline.rst:790 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-i` option." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:787 +#: ../../using/cmdline.rst:793 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:792 +#: ../../using/cmdline.rst:798 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -#: ../../using/cmdline.rst:795 +#: ../../using/cmdline.rst:801 msgid "" "Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " "executed. Emits audit events." msgstr "" -#: ../../using/cmdline.rst:802 +#: ../../using/cmdline.rst:808 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-u` option." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:808 +#: ../../using/cmdline.rst:814 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-v` option. If set to an integer, it is equivalent to specifying :" -"option:`-v` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-v` option. If set to an integer, it is equivalent to " +"specifying :option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:815 +#: ../../using/cmdline.rst:821 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:821 +#: ../../using/cmdline.rst:827 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:828 +#: ../../using/cmdline.rst:834 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -1068,40 +1093,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:838 +#: ../../using/cmdline.rst:844 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:841 +#: ../../using/cmdline.rst:847 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:845 +#: ../../using/cmdline.rst:851 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:849 +#: ../../using/cmdline.rst:855 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:856 +#: ../../using/cmdline.rst:862 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "<int_max_str_digits>`." msgstr "" -#: ../../using/cmdline.rst:864 +#: ../../using/cmdline.rst:870 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -1109,17 +1134,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:869 +#: ../../using/cmdline.rst:875 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:872 +#: ../../using/cmdline.rst:878 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:875 +#: ../../using/cmdline.rst:881 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -1127,34 +1152,34 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:882 +#: ../../using/cmdline.rst:888 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "<site.USER_SITE>` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:892 +#: ../../using/cmdline.rst:898 msgid "" "Defines the :data:`user base directory <site.USER_BASE>`, which is used to " -"compute the path of the :data:`user site-packages directory <site." -"USER_SITE>` and :ref:`installation paths <sysconfig-user-scheme>` for " +"compute the path of the :data:`user site-packages directory " +"<site.USER_SITE>` and :ref:`installation paths <sysconfig-user-scheme>` for " "``python -m pip install --user``." msgstr "" -#: ../../using/cmdline.rst:904 +#: ../../using/cmdline.rst:910 msgid "" "If this environment variable is set, ``sys.argv[0]`` will be set to its " "value instead of the value got through the C runtime. Only works on macOS." msgstr "" -#: ../../using/cmdline.rst:910 +#: ../../using/cmdline.rst:916 msgid "" "This is equivalent to the :option:`-W` option. If set to a comma separated " "string, it is equivalent to specifying :option:`-W` multiple times, with " "filters later in the list taking precedence over those earlier in the list." msgstr "" -#: ../../using/cmdline.rst:919 +#: ../../using/cmdline.rst:925 msgid "" "PYTHONWARNINGS=default # Warn once per call location\n" "PYTHONWARNINGS=error # Convert to exceptions\n" @@ -1165,16 +1190,16 @@ msgid "" "PYTHONWARNINGS=ignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:933 +#: ../../using/cmdline.rst:939 msgid "" -"If this environment variable is set to a non-empty string, :func:" -"`faulthandler.enable` is called at startup: install a handler for :const:" -"`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:" -"`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python " -"traceback. This is equivalent to :option:`-X` ``faulthandler`` option." +"If this environment variable is set to a non-empty " +"string, :func:`faulthandler.enable` is called at startup: install a handler " +"for :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` " +"and :const:`~signal.SIGILL` signals to dump the Python traceback. This is " +"equivalent to :option:`-X` ``faulthandler`` option." msgstr "" -#: ../../using/cmdline.rst:945 +#: ../../using/cmdline.rst:951 msgid "" "If this environment variable is set to a non-empty string, start tracing " "Python memory allocations using the :mod:`tracemalloc` module. The value of " @@ -1184,101 +1209,101 @@ msgid "" "is equivalent to setting the :option:`-X` ``tracemalloc`` option." msgstr "" -#: ../../using/cmdline.rst:958 +#: ../../using/cmdline.rst:964 msgid "" "If this environment variable is set to a non-empty string, Python will show " "how long each import takes. This is equivalent to setting the :option:`-X` " "``importtime`` option." msgstr "" -#: ../../using/cmdline.rst:967 +#: ../../using/cmdline.rst:973 msgid "" -"If this environment variable is set to a non-empty string, enable the :ref:" -"`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module." +"If this environment variable is set to a non-empty string, enable " +"the :ref:`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:975 +#: ../../using/cmdline.rst:981 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:977 +#: ../../using/cmdline.rst:983 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:979 +#: ../../using/cmdline.rst:985 msgid "" "``default``: use the :ref:`default memory allocators <default-memory-" "allocators>`." msgstr "" -#: ../../using/cmdline.rst:981 +#: ../../using/cmdline.rst:987 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " -"domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" -"`PYMEM_DOMAIN_OBJ`)." +"domains " +"(:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:984 +#: ../../using/cmdline.rst:990 msgid "" -"``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` for :c:macro:" -"`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" -"func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." +"``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` " +"for :c:macro:`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and " +"use the :c:func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:987 +#: ../../using/cmdline.rst:993 msgid "" -"``mimalloc``: use the :ref:`mimalloc allocator <mimalloc>` for :c:macro:" -"`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" -"func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." +"``mimalloc``: use the :ref:`mimalloc allocator <mimalloc>` " +"for :c:macro:`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and " +"use the :c:func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:991 +#: ../../using/cmdline.rst:997 msgid "Install :ref:`debug hooks <pymem-debug-hooks>`:" msgstr "" -#: ../../using/cmdline.rst:993 +#: ../../using/cmdline.rst:999 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "<default-memory-allocators>`." msgstr "" -#: ../../using/cmdline.rst:995 +#: ../../using/cmdline.rst:1001 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:996 +#: ../../using/cmdline.rst:1002 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:997 +#: ../../using/cmdline.rst:1003 msgid "``mimalloc_debug``: same as ``mimalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:1001 +#: ../../using/cmdline.rst:1007 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:1007 +#: ../../using/cmdline.rst:1013 msgid "" -"If set to a non-empty string, Python will print statistics of the :ref:" -"`pymalloc memory allocator <pymalloc>` every time a new pymalloc object " -"arena is created, and on shutdown." +"If set to a non-empty string, Python will print statistics of " +"the :ref:`pymalloc memory allocator <pymalloc>` every time a new pymalloc " +"object arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:1011 +#: ../../using/cmdline.rst:1017 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:1015 +#: ../../using/cmdline.rst:1021 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:1022 +#: ../../using/cmdline.rst:1028 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1286,42 +1311,42 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:1027 +#: ../../using/cmdline.rst:1033 msgid "" -"This may also be enabled at runtime with :func:`sys." -"_enablelegacywindowsfsencoding`." +"This may also be enabled at runtime " +"with :func:`sys._enablelegacywindowsfsencoding`." msgstr "" -#: ../../using/cmdline.rst:1030 ../../using/cmdline.rst:1044 -#: ../../using/cmdline.rst:1095 +#: ../../using/cmdline.rst:1036 ../../using/cmdline.rst:1050 +#: ../../using/cmdline.rst:1101 msgid "Availability" msgstr "" -#: ../../using/cmdline.rst:1032 +#: ../../using/cmdline.rst:1038 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../using/cmdline.rst:1037 +#: ../../using/cmdline.rst:1043 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:1041 +#: ../../using/cmdline.rst:1047 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:1051 +#: ../../using/cmdline.rst:1057 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:1055 +#: ../../using/cmdline.rst:1061 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1332,19 +1357,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:1063 +#: ../../using/cmdline.rst:1069 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:1064 +#: ../../using/cmdline.rst:1070 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:1065 +#: ../../using/cmdline.rst:1071 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:1067 +#: ../../using/cmdline.rst:1073 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1357,17 +1382,18 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:1077 +#: ../../using/cmdline.rst:1083 msgid "" "Configuring one of these locales (either explicitly or via the above " -"implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" -"`error handler <error-handlers>` for :data:`sys.stdin` and :data:`sys." -"stdout` (:data:`sys.stderr` continues to use ``backslashreplace`` as it does " -"in any other locale). This stream handling behavior can be overridden using :" -"envvar:`PYTHONIOENCODING` as usual." +"implicit locale coercion) automatically enables the " +"``surrogateescape`` :ref:`error handler <error-handlers>` " +"for :data:`sys.stdin` and :data:`sys.stdout` (:data:`sys.stderr` continues " +"to use ``backslashreplace`` as it does in any other locale). This stream " +"handling behavior can be overridden using :envvar:`PYTHONIOENCODING` as " +"usual." msgstr "" -#: ../../using/cmdline.rst:1084 +#: ../../using/cmdline.rst:1090 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1375,7 +1401,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:1089 +#: ../../using/cmdline.rst:1095 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1384,43 +1410,43 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:1097 +#: ../../using/cmdline.rst:1103 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`。" -#: ../../using/cmdline.rst:1103 +#: ../../using/cmdline.rst:1109 msgid "" -"If this environment variable is set to a non-empty string, enable :ref:" -"`Python Development Mode <devmode>`, introducing additional runtime checks " -"that are too expensive to be enabled by default. This is equivalent to " -"setting the :option:`-X` ``dev`` option." +"If this environment variable is set to a non-empty string, " +"enable :ref:`Python Development Mode <devmode>`, introducing additional " +"runtime checks that are too expensive to be enabled by default. This is " +"equivalent to setting the :option:`-X` ``dev`` option." msgstr "" -#: ../../using/cmdline.rst:1112 +#: ../../using/cmdline.rst:1118 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``1``,則啟用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1114 +#: ../../using/cmdline.rst:1120 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``0``,則停用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1116 +#: ../../using/cmdline.rst:1122 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:1123 +#: ../../using/cmdline.rst:1129 msgid "" -"If this environment variable is set to a non-empty string, issue a :class:" -"`EncodingWarning` when the locale-specific default encoding is used." +"If this environment variable is set to a non-empty string, issue " +"a :class:`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:1126 +#: ../../using/cmdline.rst:1132 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`。" -#: ../../using/cmdline.rst:1132 +#: ../../using/cmdline.rst:1138 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1429,47 +1455,46 @@ msgid "" "visual location indicators when the interpreter displays tracebacks." msgstr "" -#: ../../using/cmdline.rst:1142 +#: ../../using/cmdline.rst:1148 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" -#: ../../using/cmdline.rst:1145 ../../using/cmdline.rst:1158 +#: ../../using/cmdline.rst:1151 ../../using/cmdline.rst:1164 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" -#: ../../using/cmdline.rst:1147 +#: ../../using/cmdline.rst:1153 msgid "" -"See also the :option:`-X perf <-X>` command-line option and :ref:" -"`perf_profiling`." +"See also the :option:`-X perf <-X>` command-line option " +"and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1154 +#: ../../using/cmdline.rst:1160 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it using DWARF " "information." msgstr "" -#: ../../using/cmdline.rst:1160 +#: ../../using/cmdline.rst:1166 msgid "" -"See also the :option:`-X perf_jit <-X>` command-line option and :ref:" -"`perf_profiling`." +"See also the :option:`-X perf_jit <-X>` command-line option " +"and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1169 +#: ../../using/cmdline.rst:1175 msgid "" "If this variable is set to a positive integer, it overrides the return " "values of :func:`os.cpu_count` and :func:`os.process_cpu_count`." msgstr "" -#: ../../using/cmdline.rst:1172 -#, fuzzy +#: ../../using/cmdline.rst:1178 msgid "See also the :option:`-X cpu_count <-X>` command-line option." -msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" +msgstr "另請參閱 :option:`-X cpu_count <-X>` 命令列選項。" -#: ../../using/cmdline.rst:1178 +#: ../../using/cmdline.rst:1184 msgid "" "If this variable is set to ``on`` or ``off``, it determines whether or not " "frozen modules are ignored by the import machinery. A value of ``on`` means " @@ -1480,68 +1505,68 @@ msgid "" "flag is set to ``off``." msgstr "" -#: ../../using/cmdline.rst:1186 -#, fuzzy +#: ../../using/cmdline.rst:1192 msgid "See also the :option:`-X frozen_modules <-X>` command-line option." -msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" +msgstr "另請參閱 :option:`-X frozen_modules <-X>` 命令列選項。" -#: ../../using/cmdline.rst:1192 +#: ../../using/cmdline.rst:1198 msgid "" "If this variable is set to ``1``, the interpreter will colorize various " -"kinds of output. Setting it to ``0`` deactivates this behavior. See also :" -"ref:`using-on-controlling-color`." +"kinds of output. Setting it to ``0`` deactivates this behavior. See " +"also :ref:`using-on-controlling-color`." msgstr "" -#: ../../using/cmdline.rst:1200 +#: ../../using/cmdline.rst:1206 msgid "" -"If this variable is set to ``1``, the interpreter will not attempt to load " -"the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" -"`readline`, and will instead use the traditional parser-based :term:`REPL`." +"If this variable is set to any value, the interpreter will not attempt to " +"load the Python-based :term:`REPL` that requires :mod:`curses` " +"and :mod:`readline`, and will instead use the traditional parser-" +"based :term:`REPL`." msgstr "" -#: ../../using/cmdline.rst:1209 +#: ../../using/cmdline.rst:1215 msgid "" -"This environment variable can be used to set the location of a ``." -"python_history`` file (by default, it is ``.python_history`` in the user's " -"home directory)." +"This environment variable can be used to set the location of a " +"``.python_history`` file (by default, it is ``.python_history`` in the " +"user's home directory)." msgstr "" -#: ../../using/cmdline.rst:1217 +#: ../../using/cmdline.rst:1223 msgid "" "If this variable is set to ``1``, the global interpreter lock (GIL) will be " "forced on. Setting it to ``0`` forces the GIL off (needs Python configured " "with the :option:`--disable-gil` build option)." msgstr "" -#: ../../using/cmdline.rst:1221 +#: ../../using/cmdline.rst:1227 msgid "" "See also the :option:`-X gil <-X>` command-line option, which takes " "precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`." msgstr "" -#: ../../using/cmdline.rst:1227 +#: ../../using/cmdline.rst:1233 msgid "Debug-mode variables" msgstr "除錯模式變數" -#: ../../using/cmdline.rst:1231 +#: ../../using/cmdline.rst:1237 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:1234 ../../using/cmdline.rst:1242 +#: ../../using/cmdline.rst:1240 ../../using/cmdline.rst:1248 msgid "" "Needs Python configured with the :option:`--with-trace-refs` build option." msgstr "" -#: ../../using/cmdline.rst:1238 +#: ../../using/cmdline.rst:1244 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter into a file under the path given as the value " "to this environment variable." msgstr "" -#: ../../using/cmdline.rst:1248 +#: ../../using/cmdline.rst:1254 msgid "" "If this variable is set to a module, that module will be imported early in " "the interpreter lifecycle, before the :mod:`site` module is executed, and " @@ -1549,22 +1574,22 @@ msgid "" "is not treated as :mod:`__main__`." msgstr "" -#: ../../using/cmdline.rst:1253 +#: ../../using/cmdline.rst:1259 msgid "This can be used to execute code early during Python initialization." msgstr "" -#: ../../using/cmdline.rst:1255 +#: ../../using/cmdline.rst:1261 msgid "" "To import a submodule, use ``package.module`` as the value, like in an " "import statement." msgstr "" -#: ../../using/cmdline.rst:1258 +#: ../../using/cmdline.rst:1264 msgid "" "See also the :option:`-X presite <-X>` command-line option, which takes " "precedence over this variable." msgstr "" -#: ../../using/cmdline.rst:1261 +#: ../../using/cmdline.rst:1267 msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" diff --git a/using/configure.po b/using/configure.po index caaba60971..b23391790f 100644 --- a/using/configure.po +++ b/using/configure.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-13 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,9 +26,8 @@ msgid "Build Requirements" msgstr "建置需求" #: ../../using/configure.rst:10 -#, fuzzy msgid "Features and minimum versions required to build CPython:" -msgstr "建置 CPython 所需的功能:" +msgstr "建置 CPython 所需的功能與最小版本:" #: ../../using/configure.rst:12 msgid "" @@ -37,6 +35,9 @@ msgid "" "features <https://en.wikipedia.org/wiki/" "C11_(C_standard_revision)#Optional_features>`_ are not required." msgstr "" +"一個 `C11 <https://en.cppreference.com/w/c/11>`_ 編譯器。`選擇性 C11 功能 " +"<https://en.wikipedia.org/wiki/" +"C11_(C_standard_revision)#Optional_features>`_\\ 並非必要。" #: ../../using/configure.rst:17 msgid "On Windows, Microsoft Visual Studio 2017 or later is required." @@ -45,9 +46,11 @@ msgstr "在 Windows 上需要 Microsoft Visual Studio 2017 或更新版本。" #: ../../using/configure.rst:19 msgid "" "Support for `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ floating-" -"point numbers and `floating-point Not-a-Number (NaN) <https://en.wikipedia." -"org/wiki/NaN#Floating_point>`_." +"point numbers and `floating-point Not-a-Number (NaN) <https://" +"en.wikipedia.org/wiki/NaN#Floating_point>`_." msgstr "" +"支援 `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ 浮點數與\\ `浮點數" +"非數值 (NaN) <https://en.wikipedia.org/wiki/NaN#Floating_point>`_。" #: ../../using/configure.rst:23 msgid "Support for threads." @@ -58,11 +61,12 @@ msgid "" "OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended " "minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules." msgstr "" +"OpenSSL 1.1.1 是最低版本,OpenSSL 3.0.9 是 :mod:`ssl` 與 :mod:`hashlib` 擴充" +"模組的建議最低版本。" #: ../../using/configure.rst:28 -#, fuzzy msgid "SQLite 3.15.2 for the :mod:`sqlite3` extension module." -msgstr "請見 :mod:`ssl` 模組。" +msgstr "" #: ../../using/configure.rst:30 msgid "Tcl/Tk 8.5.12 for the :mod:`tkinter` module." @@ -70,21 +74,21 @@ msgstr "" #: ../../using/configure.rst:32 msgid "" -"Autoconf 2.71 and aclocal 1.16.5 are required to regenerate the :file:" -"`configure` script." +"Autoconf 2.71 and aclocal 1.16.5 are required to regenerate " +"the :file:`configure` script." msgstr "" #: ../../using/configure.rst:35 -#, fuzzy msgid "Tcl/Tk version 8.3.1 is now required." -msgstr "OpenSSL 1.1.1 現在是必要的。" +msgstr "Tcl/Tk version 8.3.1 現在是必要的。" #: ../../using/configure.rst:38 -#, fuzzy msgid "" "On Windows, Visual Studio 2015 or later is now required. Tcl/Tk version 8.4 " "is now required." -msgstr "在 Windows 上需要 Visual Studio 2015 或更新版本。" +msgstr "" +"在 Windows 上,Visual Studio 2015 或更新版本與 Tcl/Tk version 8.4 現在是必要" +"的。" #: ../../using/configure.rst:42 msgid "" @@ -97,9 +101,8 @@ msgid "Thread support and OpenSSL 1.0.2 are now required." msgstr "對執行緒與 OpenSSL 1.0.2 的支援現在是必要的。" #: ../../using/configure.rst:49 -#, fuzzy msgid "OpenSSL 1.1.1 is now required. Require SQLite 3.7.15." -msgstr "OpenSSL 1.1.1 現在是必要的。" +msgstr "OpenSSL 1.1.1 現在是必要的。需要 SQLite 3.7.15。" #: ../../using/configure.rst:53 msgid "" @@ -178,12 +181,11 @@ msgstr "設定選項" #: ../../using/configure.rst:100 msgid "List all :file:`configure` script options using::" -msgstr "" +msgstr "使用以下命令列出所有 :file:`configure` 腳本選項: ::" #: ../../using/configure.rst:102 -#, fuzzy msgid "./configure --help" -msgstr "設定腳本" +msgstr "./configure --help" #: ../../using/configure.rst:104 msgid "" @@ -203,16 +205,16 @@ msgstr "" #: ../../using/configure.rst:114 msgid "" -"See the :meth:`sqlite3.Connection.enable_load_extension` method of the :mod:" -"`sqlite3` module." +"See the :meth:`sqlite3.Connection.enable_load_extension` method of " +"the :mod:`sqlite3` module." msgstr "" "請見 :mod:`sqlite3` 模組的 :meth:`sqlite3.Connection.enable_load_extension` " "方法。" #: ../../using/configure.rst:121 msgid "" -"Disable IPv6 support (enabled by default if supported), see the :mod:" -"`socket` module." +"Disable IPv6 support (enabled by default if supported), see " +"the :mod:`socket` module." msgstr "停用 IPv6 支援(如果支援的話預設是啟用的),請見 :mod:`socket` 模組。" #: ../../using/configure.rst:126 @@ -238,8 +240,8 @@ msgstr "將 Python 執行檔的後綴設定為 *SUFFIX*。" #: ../../using/configure.rst:138 msgid "" "The default suffix is ``.exe`` on Windows and macOS (``python.exe`` " -"executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, ``." -"wasm`` on WASI, and an empty string on other platforms (``python`` " +"executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, " +"``.wasm`` on WASI, and an empty string on other platforms (``python`` " "executable)." msgstr "" "在 Windows 和 macOS 上預設的後綴是 ``.exe`` (``python.exe`` 執行檔)、在 " @@ -248,8 +250,8 @@ msgstr "" #: ../../using/configure.rst:143 msgid "" -"The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." -"wasm``." +"The default suffix on WASM platform is one of ``.js``, ``.html`` or " +"``.wasm``." msgstr "在 WASM 平台上預設的後綴是 ``.js``、``.html`` 或 ``.wasm`` 中的一個。" #: ../../using/configure.rst:149 @@ -340,8 +342,8 @@ msgstr "" msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" -"share/python-wheels/`` directory and don't install the :mod:`!ensurepip." -"_bundled` package." +"share/python-wheels/`` directory and don't install the :mod:`!" +"ensurepip._bundled` package." msgstr "" #: ../../using/configure.rst:216 @@ -352,7 +354,7 @@ msgstr "" #: ../../using/configure.rst:219 msgid "``check`` (default): :program:`pkg-config` is optional" -msgstr "``check`` (預設)::program:`pkg-config` 是可選的" +msgstr "``check``\\ (預設)::program:`pkg-config` 是可選的" #: ../../using/configure.rst:220 msgid "``yes``: :program:`pkg-config` is mandatory" @@ -379,46 +381,42 @@ msgid "" "cleared." msgstr "" -#: ../../using/configure.rst:236 ../../using/configure.rst:721 +#: ../../using/configure.rst:236 ../../using/configure.rst:725 msgid "Effects:" msgstr "效果:" #: ../../using/configure.rst:238 -#, fuzzy msgid "Add :option:`-X pystats <-X>` command line option." -msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" +msgstr "新增 :option:`-X pystats <-X>` 命令列選項。" #: ../../using/configure.rst:239 -#, fuzzy msgid "Add :envvar:`!PYTHONSTATS` environment variable." -msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" +msgstr "新增 :envvar:`!PYTHONSTATS` 環境變數。" #: ../../using/configure.rst:240 -#, fuzzy msgid "Define the ``Py_STATS`` macro." -msgstr "定義 ``Py_TRACE_REFS`` 巨集。" +msgstr "定義 ``Py_STATS`` 巨集。" #: ../../using/configure.rst:241 -#, fuzzy msgid "Add functions to the :mod:`sys` module:" -msgstr "請見 :mod:`ssl` 模組。" +msgstr "新增函式到 :mod:`sys` 模組。" #: ../../using/configure.rst:243 msgid ":func:`!sys._stats_on`: Turns on statistics gathering." -msgstr "" +msgstr ":func:`!sys._stats_on`:啟用統計資料收集。" #: ../../using/configure.rst:244 msgid ":func:`!sys._stats_off`: Turns off statistics gathering." -msgstr "" +msgstr ":func:`!sys._stats_off`:關閉統計資料收集。" #: ../../using/configure.rst:245 msgid ":func:`!sys._stats_clear`: Clears the statistics." -msgstr "" +msgstr ":func:`!sys._stats_clear`:清除統計資料。" #: ../../using/configure.rst:246 msgid "" ":func:`!sys._stats_dump`: Dump statistics to file, and clears the statistics." -msgstr "" +msgstr ":func:`!sys._stats_dump`:將統計資料轉儲到檔案,並清除統計資料。" #: ../../using/configure.rst:248 msgid "" @@ -426,6 +424,9 @@ msgid "" "tmp/py_stats/`` (Unix) or ``C:\\temp\\py_stats\\`` (Windows). If that " "directory does not exist, results will be printed on stderr." msgstr "" +"統計資料將被轉儲到 ``/tmp/py_stats/`` (Unix) 或 ``C:\\temp\\py_stats\\`` " +"(Windows) 中的任意(可能是唯一的)檔案。如果該目錄不存在,結果將被列印到 " +"stderr。" #: ../../using/configure.rst:252 msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." @@ -510,9 +511,8 @@ msgid "type cache;" msgstr "" #: ../../using/configure.rst:280 -#, fuzzy msgid "optimization attempts;" -msgstr "最佳化旗標。" +msgstr "最佳化嘗試;" #: ../../using/configure.rst:281 msgid "optimization traces created/executed;" @@ -540,14 +540,14 @@ msgstr "" #: ../../using/configure.rst:296 msgid "" -"Enables **experimental** support for running Python without the :term:" -"`global interpreter lock` (GIL): free threading build." +"Enables **experimental** support for running Python without " +"the :term:`global interpreter lock` (GIL): free threading build." msgstr "" #: ../../using/configure.rst:299 msgid "" -"Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` to :data:`sys." -"abiflags`." +"Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` " +"to :data:`sys.abiflags`." msgstr "" #: ../../using/configure.rst:302 @@ -584,218 +584,221 @@ msgid "" "experimental-jit=yes``." msgstr "" -#: ../../using/configure.rst:321 +#: ../../using/configure.rst:319 +msgid "" +"When building CPython with JIT enabled, ensure that your system has Python " +"3.11 or later installed." +msgstr "" + +#: ../../using/configure.rst:325 msgid "Path to ``pkg-config`` utility." msgstr "" -#: ../../using/configure.rst:326 -#, fuzzy +#: ../../using/configure.rst:330 msgid "``pkg-config`` options." -msgstr "設定選項" +msgstr "``pkg-config`` 選項。" -#: ../../using/configure.rst:330 -#, fuzzy +#: ../../using/configure.rst:334 msgid "C compiler options" -msgstr "C 編譯器指令。" +msgstr "C 編譯器選項。" -#: ../../using/configure.rst:334 ../../using/configure.rst:1241 +#: ../../using/configure.rst:338 ../../using/configure.rst:1251 msgid "C compiler command." msgstr "C 編譯器指令。" -#: ../../using/configure.rst:338 ../../using/configure.rst:1253 +#: ../../using/configure.rst:342 ../../using/configure.rst:1263 msgid "C compiler flags." msgstr "C 編譯器旗標。" -#: ../../using/configure.rst:342 -#, fuzzy +#: ../../using/configure.rst:346 msgid "C preprocessor command." -msgstr "C 編譯器指令。" +msgstr "C 預處理器指令。" -#: ../../using/configure.rst:346 +#: ../../using/configure.rst:350 msgid "C preprocessor flags, e.g. :samp:`-I{include_dir}`." -msgstr "" +msgstr "C 預處理器旗標,例如::samp:`-I{include_dir}`。" -#: ../../using/configure.rst:350 ../../using/configure.rst:792 +#: ../../using/configure.rst:354 ../../using/configure.rst:796 msgid "Linker options" msgstr "" -#: ../../using/configure.rst:354 +#: ../../using/configure.rst:358 msgid "Linker flags, e.g. :samp:`-L{library_directory}`." msgstr "" -#: ../../using/configure.rst:358 +#: ../../using/configure.rst:362 msgid "Libraries to pass to the linker, e.g. :samp:`-l{library}`." msgstr "" -#: ../../using/configure.rst:362 +#: ../../using/configure.rst:366 msgid "Name for machine-dependent library files." msgstr "" -#: ../../using/configure.rst:366 +#: ../../using/configure.rst:370 msgid "Options for third-party dependencies" msgstr "" -#: ../../using/configure.rst:373 +#: ../../using/configure.rst:377 msgid "" "C compiler and linker flags to link Python to ``libbz2``, used by :mod:`bz2` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:379 +#: ../../using/configure.rst:383 msgid "" -"C compiler and linker flags for ``libncurses`` or ``libncursesw``, used by :" -"mod:`curses` module, overriding ``pkg-config``." +"C compiler and linker flags for ``libncurses`` or ``libncursesw``, used " +"by :mod:`curses` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:385 +#: ../../using/configure.rst:389 msgid "C compiler and linker flags for ``gdbm``." msgstr "" -#: ../../using/configure.rst:390 +#: ../../using/configure.rst:394 msgid "" "C compiler and linker flags for ``libb2`` (:ref:`BLAKE2 <hashlib-blake2>`), " "used by :mod:`hashlib` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:396 +#: ../../using/configure.rst:400 msgid "" "C compiler and linker flags for ``libedit``, used by :mod:`readline` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:402 +#: ../../using/configure.rst:406 msgid "" "C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:408 +#: ../../using/configure.rst:412 msgid "" "C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:413 +#: ../../using/configure.rst:417 msgid "" "These environment variables have no effect unless :option:`--with-system-" "libmpdec` is specified." msgstr "" -#: ../../using/configure.rst:419 +#: ../../using/configure.rst:423 msgid "" "C compiler and linker flags for ``liblzma``, used by :mod:`lzma` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:425 +#: ../../using/configure.rst:429 msgid "" "C compiler and linker flags for ``libreadline``, used by :mod:`readline` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:431 +#: ../../using/configure.rst:435 msgid "" "C compiler and linker flags for ``libsqlite3``, used by :mod:`sqlite3` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:437 +#: ../../using/configure.rst:441 msgid "" "C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:443 +#: ../../using/configure.rst:447 msgid "C compiler and linker flags for PANEL, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:445 +#: ../../using/configure.rst:449 msgid "" -"C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by :mod:" -"`curses.panel` module, overriding ``pkg-config``." +"C compiler and linker flags for ``libpanel`` or ``libpanelw``, used " +"by :mod:`curses.panel` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:451 +#: ../../using/configure.rst:455 msgid "C compiler and linker flags for TCLTK, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:456 +#: ../../using/configure.rst:460 msgid "" "C compiler and linker flags for ``libzlib``, used by :mod:`gzip` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:461 +#: ../../using/configure.rst:465 msgid "WebAssembly Options" msgstr "WebAssembly 選項" -#: ../../using/configure.rst:465 +#: ../../using/configure.rst:469 msgid "Set build flavor for ``wasm32-emscripten``." msgstr "" -#: ../../using/configure.rst:467 +#: ../../using/configure.rst:471 msgid "``browser`` (default): preload minimal stdlib, default MEMFS." msgstr "" -#: ../../using/configure.rst:468 +#: ../../using/configure.rst:472 msgid "``node``: NODERAWFS and pthread support." msgstr "``node``:對 NODERAWFS 和 pthread 支援。" -#: ../../using/configure.rst:474 +#: ../../using/configure.rst:478 msgid "Turn on dynamic linking support for WASM." msgstr "" -#: ../../using/configure.rst:476 +#: ../../using/configure.rst:480 msgid "" "Dynamic linking enables ``dlopen``. File size of the executable increases " "due to limited dead code elimination and additional features." msgstr "" -#: ../../using/configure.rst:483 +#: ../../using/configure.rst:487 msgid "Turn on pthreads support for WASM." msgstr "" -#: ../../using/configure.rst:489 +#: ../../using/configure.rst:493 msgid "Install Options" msgstr "安裝選項" -#: ../../using/configure.rst:493 +#: ../../using/configure.rst:497 msgid "" -"Install architecture-independent files in PREFIX. On Unix, it defaults to :" -"file:`/usr/local`." +"Install architecture-independent files in PREFIX. On Unix, it defaults " +"to :file:`/usr/local`." msgstr "" -#: ../../using/configure.rst:496 +#: ../../using/configure.rst:500 msgid "This value can be retrieved at runtime using :data:`sys.prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.prefix` 取得。" -#: ../../using/configure.rst:498 +#: ../../using/configure.rst:502 msgid "" "As an example, one can use ``--prefix=\"$HOME/.local/\"`` to install a " "Python in its home directory." msgstr "" -#: ../../using/configure.rst:503 +#: ../../using/configure.rst:507 msgid "" "Install architecture-dependent files in EPREFIX, defaults to :option:`--" "prefix`." msgstr "" -#: ../../using/configure.rst:505 +#: ../../using/configure.rst:509 msgid "This value can be retrieved at runtime using :data:`sys.exec_prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.exec_prefix` 取得" -#: ../../using/configure.rst:509 +#: ../../using/configure.rst:513 msgid "" -"Don't build nor install test modules, like the :mod:`test` package or the :" -"mod:`!_testcapi` extension module (built and installed by default)." +"Don't build nor install test modules, like the :mod:`test` package or " +"the :mod:`!_testcapi` extension module (built and installed by default)." msgstr "" -#: ../../using/configure.rst:516 +#: ../../using/configure.rst:520 msgid "Select the :mod:`ensurepip` command run on Python installation:" msgstr "選擇在 Python 安裝時執行的 :mod:`ensurepip` 命令:" -#: ../../using/configure.rst:518 +#: ../../using/configure.rst:522 msgid "" "``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` " "command." @@ -803,45 +806,45 @@ msgstr "" "``upgrade`` (預設):執行 ``python -m ensurepip --altinstall --upgrade`` 命" "令。" -#: ../../using/configure.rst:520 +#: ../../using/configure.rst:524 msgid "``install``: run ``python -m ensurepip --altinstall`` command;" msgstr "``install``:執行 ``python -m ensurepip --altinstall`` 命令;" -#: ../../using/configure.rst:521 +#: ../../using/configure.rst:525 msgid "``no``: don't run ensurepip;" msgstr "``no``:不要執行 ensurepip;" -#: ../../using/configure.rst:527 +#: ../../using/configure.rst:531 msgid "Performance options" -msgstr "" +msgstr "效能選項" -#: ../../using/configure.rst:529 +#: ../../using/configure.rst:533 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance. The experimental ``--enable-bolt`` flag " "can also be used to improve performance." msgstr "" -#: ../../using/configure.rst:535 +#: ../../using/configure.rst:539 msgid "" "Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` " "(disabled by default)." msgstr "" -#: ../../using/configure.rst:538 +#: ../../using/configure.rst:542 msgid "" "The C compiler Clang requires ``llvm-profdata`` program for PGO. On macOS, " "GCC also requires it: GCC is just an alias to Clang on macOS." msgstr "" -#: ../../using/configure.rst:541 +#: ../../using/configure.rst:545 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" -#: ../../using/configure.rst:547 +#: ../../using/configure.rst:551 msgid "" "During the build, you may encounter compiler warnings about profile data not " "being available for some source files. These warnings are harmless, as only " @@ -850,58 +853,58 @@ msgid "" "profile-instr-unprofiled`` to :envvar:`CFLAGS`." msgstr "" -#: ../../using/configure.rst:556 +#: ../../using/configure.rst:560 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "在 GCC 上使用 ``-fno-semantic-interposition``。" -#: ../../using/configure.rst:561 +#: ../../using/configure.rst:565 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" -#: ../../using/configure.rst:564 +#: ../../using/configure.rst:568 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "預設值:``-m test --pgo --timeout=$(TESTTIMEOUT)``。" -#: ../../using/configure.rst:568 +#: ../../using/configure.rst:572 msgid "Task failure is no longer ignored silently." msgstr "" -#: ../../using/configure.rst:573 +#: ../../using/configure.rst:577 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" -#: ../../using/configure.rst:575 +#: ../../using/configure.rst:579 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" -#: ../../using/configure.rst:580 +#: ../../using/configure.rst:584 msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." msgstr "" -#: ../../using/configure.rst:583 +#: ../../using/configure.rst:587 msgid "" "Use ThinLTO as the default optimization policy on Clang if the compiler " "accepts the flag." msgstr "" -#: ../../using/configure.rst:588 +#: ../../using/configure.rst:592 msgid "" "Enable usage of the `BOLT post-link binary optimizer <https://github.com/" "llvm/llvm-project/tree/main/bolt>`_ (disabled by default)." msgstr "" -#: ../../using/configure.rst:592 +#: ../../using/configure.rst:596 msgid "" "BOLT is part of the LLVM project but is not always included in their binary " "distributions. This flag requires that ``llvm-bolt`` and ``merge-fdata`` are " "available." msgstr "" -#: ../../using/configure.rst:596 +#: ../../using/configure.rst:600 msgid "" "BOLT is still a fairly new project so this flag should be considered " "experimental for now. Because this tool operates on machine code its success " @@ -912,124 +915,124 @@ msgid "" "encouraged." msgstr "" -#: ../../using/configure.rst:604 +#: ../../using/configure.rst:608 msgid "" -"The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS` :" -"program:`configure` variables can be defined to override the default set of " -"arguments for :program:`llvm-bolt` to instrument and apply BOLT data to " -"binaries, respectively." +"The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!" +"BOLT_APPLY_FLAGS` :program:`configure` variables can be defined to override " +"the default set of arguments for :program:`llvm-bolt` to instrument and " +"apply BOLT data to binaries, respectively." msgstr "" -#: ../../using/configure.rst:613 +#: ../../using/configure.rst:617 msgid "" "Arguments to ``llvm-bolt`` when creating a `BOLT optimized binary <https://" "github.com/facebookarchive/BOLT>`_." msgstr "" -#: ../../using/configure.rst:620 +#: ../../using/configure.rst:624 msgid "Arguments to ``llvm-bolt`` when instrumenting binaries." msgstr "" -#: ../../using/configure.rst:626 +#: ../../using/configure.rst:630 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" -#: ../../using/configure.rst:631 +#: ../../using/configure.rst:635 msgid "" "Disable the fast :ref:`mimalloc <mimalloc>` allocator (enabled by default)." msgstr "" -#: ../../using/configure.rst:634 ../../using/configure.rst:641 +#: ../../using/configure.rst:638 ../../using/configure.rst:645 msgid "See also :envvar:`PYTHONMALLOC` environment variable." msgstr "另請參閱 :envvar:`PYTHONMALLOC` 環境變數。" -#: ../../using/configure.rst:638 +#: ../../using/configure.rst:642 msgid "" "Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` " "(enabled by default)." msgstr "" -#: ../../using/configure.rst:645 +#: ../../using/configure.rst:649 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" -#: ../../using/configure.rst:648 +#: ../../using/configure.rst:652 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "不要定義 ``WITH_DOC_STRINGS`` 巨集。" -#: ../../using/configure.rst:650 +#: ../../using/configure.rst:654 msgid "See the ``PyDoc_STRVAR()`` macro." msgstr "請見 ``PyDoc_STRVAR()`` 巨集。" -#: ../../using/configure.rst:654 +#: ../../using/configure.rst:658 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" -#: ../../using/configure.rst:658 +#: ../../using/configure.rst:662 msgid "" "Add ``-fstrict-overflow`` to the C compiler flags (by default we add ``-fno-" "strict-overflow`` instead)." msgstr "" -#: ../../using/configure.rst:665 +#: ../../using/configure.rst:669 msgid "Python Debug Build" msgstr "" -#: ../../using/configure.rst:667 +#: ../../using/configure.rst:671 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" -#: ../../using/configure.rst:670 +#: ../../using/configure.rst:674 msgid "Effects of a debug build:" msgstr "" -#: ../../using/configure.rst:672 +#: ../../using/configure.rst:676 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" -#: ../../using/configure.rst:674 +#: ../../using/configure.rst:678 msgid "Add ``d`` to :data:`sys.abiflags`." msgstr "新增 ``d`` 到 :data:`sys.abiflags`。" -#: ../../using/configure.rst:675 +#: ../../using/configure.rst:679 msgid "Add :func:`!sys.gettotalrefcount` function." msgstr "新增 :func:`!sys.gettotalrefcount` 函式。" -#: ../../using/configure.rst:676 +#: ../../using/configure.rst:680 msgid "Add :option:`-X showrefcount <-X>` command line option." msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" -#: ../../using/configure.rst:677 +#: ../../using/configure.rst:681 msgid "" "Add :option:`-d` command line option and :envvar:`PYTHONDEBUG` environment " "variable to debug the parser." msgstr "" -#: ../../using/configure.rst:679 +#: ../../using/configure.rst:683 msgid "" "Add support for the ``__lltrace__`` variable: enable low-level tracing in " "the bytecode evaluation loop if the variable is defined." msgstr "" -#: ../../using/configure.rst:681 +#: ../../using/configure.rst:685 msgid "" "Install :ref:`debug hooks on memory allocators <default-memory-allocators>` " "to detect buffer overflow and other memory errors." msgstr "" -#: ../../using/configure.rst:683 +#: ../../using/configure.rst:687 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." msgstr "定義 ``Py_DEBUG`` 和 ``Py_REF_DEBUG`` 巨集。" -#: ../../using/configure.rst:684 +#: ../../using/configure.rst:688 msgid "" "Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " @@ -1037,388 +1040,410 @@ msgid "" "option). Main runtime checks:" msgstr "" -#: ../../using/configure.rst:689 +#: ../../using/configure.rst:693 msgid "Add sanity checks on the function arguments." msgstr "" -#: ../../using/configure.rst:690 +#: ../../using/configure.rst:694 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" -#: ../../using/configure.rst:692 +#: ../../using/configure.rst:696 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" -#: ../../using/configure.rst:694 +#: ../../using/configure.rst:698 msgid "Check that deallocator functions don't change the current exception." msgstr "" -#: ../../using/configure.rst:695 +#: ../../using/configure.rst:699 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" -#: ../../using/configure.rst:697 +#: ../../using/configure.rst:701 msgid "" "The :c:macro:`!Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" -#: ../../using/configure.rst:700 +#: ../../using/configure.rst:704 msgid "" "See also the :ref:`Python Development Mode <devmode>` and the :option:`--" "with-trace-refs` configure option." msgstr "" -#: ../../using/configure.rst:703 +#: ../../using/configure.rst:707 msgid "" "Release builds and debug builds are now ABI compatible: defining the " -"``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" -"option:`--with-trace-refs` option)." +"``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see " +"the :option:`--with-trace-refs` option)." msgstr "" -#: ../../using/configure.rst:710 +#: ../../using/configure.rst:714 msgid "Debug options" -msgstr "" +msgstr "偵錯選項" -#: ../../using/configure.rst:714 +#: ../../using/configure.rst:718 msgid "" ":ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" +":ref:`以偵錯模式建置 Python <debug-build>`:定義 ``Py_DEBUG`` 巨集(預設不啟" +"用)。" -#: ../../using/configure.rst:719 +#: ../../using/configure.rst:723 msgid "Enable tracing references for debugging purpose (disabled by default)." -msgstr "" +msgstr "以偵錯為目的啟用參照追蹤(預設不啟用)。" -#: ../../using/configure.rst:723 +#: ../../using/configure.rst:727 msgid "Define the ``Py_TRACE_REFS`` macro." msgstr "定義 ``Py_TRACE_REFS`` 巨集。" -#: ../../using/configure.rst:724 -#, fuzzy +#: ../../using/configure.rst:728 msgid "Add :func:`sys.getobjects` function." -msgstr "新增 :func:`!sys.getobjects` 函式。" +msgstr "新增 :func:`sys.getobjects` 函式。" -#: ../../using/configure.rst:725 +#: ../../using/configure.rst:729 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" -#: ../../using/configure.rst:727 +#: ../../using/configure.rst:731 msgid "" "The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " "objects and reference counts still alive at Python exit." msgstr "" +":envvar:`PYTHONDUMPREFS` 環境變數可以用來在 Python 結束時轉儲仍然有效的物件和" +"參照計數。" -#: ../../using/configure.rst:730 +#: ../../using/configure.rst:734 msgid ":ref:`Statically allocated objects <static-types>` are not traced." -msgstr "" +msgstr "不追蹤\\ :ref:`靜態配置的物件 <static-types>`。" -#: ../../using/configure.rst:734 +#: ../../using/configure.rst:738 msgid "" "This build is now ABI compatible with release build and :ref:`debug build " "<debug-build>`." msgstr "" +"這個建置現在與發佈版本建置和\\ :ref:`偵錯建置 <debug-build>`\\ 具有 ABI 相容" +"性。" -#: ../../using/configure.rst:740 +#: ../../using/configure.rst:744 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" +"啟用 C 斷言建置(預設不啟用):``assert(...);`` 和 " +"``_PyObject_ASSERT(...);``。" -#: ../../using/configure.rst:743 +#: ../../using/configure.rst:747 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." -msgstr "" +msgstr "如果設定,``NDEBUG`` 巨集不會在 :envvar:`OPT` 編譯器變數中定義。" -#: ../../using/configure.rst:746 +#: ../../using/configure.rst:750 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build <debug-" "build>`) which also enables assertions." msgstr "" +"另請參閱 :option:`--with-pydebug` 選項(:ref:`debug build <debug-build>`)," +"它也啟用了斷言。" -#: ../../using/configure.rst:753 +#: ../../using/configure.rst:757 msgid "Enable Valgrind support (default is no)." msgstr "啟用 Valgrind 支援(預設不啟用)。" -#: ../../using/configure.rst:757 +#: ../../using/configure.rst:761 msgid "Enable DTrace support (default is no)." msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:759 +#: ../../using/configure.rst:763 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap <instrumentation>`." msgstr "" +"請參閱\\ :ref:`使用 DTrace 和 SystemTap 檢測 CPython <instrumentation>`。" -#: ../../using/configure.rst:766 +#: ../../using/configure.rst:770 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." -msgstr "" +msgstr "啟用 AddressSanitizer 記憶體錯誤偵測器 ``asan``\\ (預設不啟用)。" -#: ../../using/configure.rst:772 +#: ../../using/configure.rst:776 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." -msgstr "" +msgstr "啟用 MemorySanitizer 分配錯誤偵測器 ``msan``\\ (預設不啟用)。" -#: ../../using/configure.rst:778 +#: ../../using/configure.rst:782 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" +"啟用 UndefinedBehaviorSanitizer 未定義行為偵測器 ``ubsan``\\ (預設不啟用)。" -#: ../../using/configure.rst:785 -#, fuzzy +#: ../../using/configure.rst:789 msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." -msgstr "啟用 DTrace 支援(預設不啟用)。" +msgstr "啟用 ThreadSanitizer 資料競爭偵測器 ``tsan``\\ (預設不啟用)。" -#: ../../using/configure.rst:796 +#: ../../using/configure.rst:800 msgid "Enable building a shared Python library: ``libpython`` (default is no)." -msgstr "" +msgstr "啟用建置共享 Python 函式庫:``libpython``\\ (預設不啟用)。" -#: ../../using/configure.rst:800 +#: ../../using/configure.rst:804 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" +"不要建置 ``libpythonMAJOR.MINOR.a`` 並且不要安裝 ``python.o``\\ (預設會建置" +"並啟用)。" -#: ../../using/configure.rst:807 +#: ../../using/configure.rst:811 msgid "Libraries options" msgstr "函式庫選項" -#: ../../using/configure.rst:811 +#: ../../using/configure.rst:815 msgid "Link against additional libraries (default is no)." msgstr "" -#: ../../using/configure.rst:815 +#: ../../using/configure.rst:819 msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." -msgstr "" +msgstr "使用已安裝的 ``expat`` 函式庫建置 :mod:`!pyexpat` 模組(預設不建置)。" -#: ../../using/configure.rst:820 +#: ../../using/configure.rst:824 msgid "" "Build the ``_decimal`` extension module using an installed ``mpdecimal`` " "library, see the :mod:`decimal` module (default is yes)." msgstr "" +"使用已安裝的 ``mpdecimal`` 函式庫建置 ``_decimal`` 擴充模組,請參" +"閱 :mod:`decimal` 模組(預設建置)。" -#: ../../using/configure.rst:825 +#: ../../using/configure.rst:829 msgid "Default to using the installed ``mpdecimal`` library." -msgstr "" +msgstr "預設使用已安裝的 ``mpdecimal`` 函式庫。" -#: ../../using/configure.rst:828 +#: ../../using/configure.rst:832 msgid "" "A copy of the ``mpdecimal`` library sources will no longer be distributed " "with Python 3.15." -msgstr "" +msgstr "Python 3.15 不再隨附 ``mpdecimal`` 函式庫的原始碼副本。" -#: ../../using/configure.rst:832 +#: ../../using/configure.rst:836 msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." -msgstr "" +msgstr ":option:`LIBMPDEC_CFLAGS` 和 :option:`LIBMPDEC_LIBS`。" -#: ../../using/configure.rst:836 +#: ../../using/configure.rst:840 msgid "Designate a backend library for the :mod:`readline` module." msgstr "" -#: ../../using/configure.rst:838 +#: ../../using/configure.rst:842 msgid "readline: Use readline as the backend." msgstr "" -#: ../../using/configure.rst:839 +#: ../../using/configure.rst:843 msgid "editline: Use editline as the backend." msgstr "" -#: ../../using/configure.rst:845 +#: ../../using/configure.rst:849 msgid "Don't build the :mod:`readline` module (built by default)." -msgstr "" +msgstr "不要建置 :mod:`readline` 模組(預設會建置)。" -#: ../../using/configure.rst:847 +#: ../../using/configure.rst:851 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." msgstr "不要定義 ``HAVE_LIBREADLINE`` 巨集。" -#: ../../using/configure.rst:853 +#: ../../using/configure.rst:857 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:857 +#: ../../using/configure.rst:861 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:861 +#: ../../using/configure.rst:865 msgid "Root of the OpenSSL directory." -msgstr "" +msgstr "OpenSSL 目錄的根目錄。" -#: ../../using/configure.rst:867 +#: ../../using/configure.rst:871 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" msgstr "" -#: ../../using/configure.rst:869 +#: ../../using/configure.rst:873 msgid "``no`` (default): don't set rpath;" msgstr "" -#: ../../using/configure.rst:870 +#: ../../using/configure.rst:874 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" -#: ../../using/configure.rst:872 +#: ../../using/configure.rst:876 msgid "*DIR*: set an explicit rpath." msgstr "" -#: ../../using/configure.rst:878 +#: ../../using/configure.rst:882 msgid "Security Options" -msgstr "" +msgstr "安全性選項" -#: ../../using/configure.rst:882 +#: ../../using/configure.rst:886 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" msgstr "" -#: ../../using/configure.rst:884 +#: ../../using/configure.rst:888 msgid "``siphash13`` (default);" -msgstr "" +msgstr "``siphash13``\\ (預設);" -#: ../../using/configure.rst:885 +#: ../../using/configure.rst:889 msgid "``siphash24``;" msgstr "``siphash24``;" -#: ../../using/configure.rst:886 +#: ../../using/configure.rst:890 msgid "``fnv``." msgstr "``fnv``。" -#: ../../using/configure.rst:890 +#: ../../using/configure.rst:894 msgid "``siphash13`` is added and it is the new default." msgstr "" -#: ../../using/configure.rst:895 +#: ../../using/configure.rst:899 msgid "Built-in hash modules:" msgstr "內建雜湊模組:" -#: ../../using/configure.rst:897 +#: ../../using/configure.rst:901 msgid "``md5``;" msgstr "``md5``;" -#: ../../using/configure.rst:898 +#: ../../using/configure.rst:902 msgid "``sha1``;" msgstr "``sha1``;" -#: ../../using/configure.rst:899 +#: ../../using/configure.rst:903 msgid "``sha256``;" msgstr "``sha256``;" -#: ../../using/configure.rst:900 +#: ../../using/configure.rst:904 msgid "``sha512``;" msgstr "``sha512``;" -#: ../../using/configure.rst:901 +#: ../../using/configure.rst:905 msgid "``sha3`` (with shake);" msgstr "" -#: ../../using/configure.rst:902 +#: ../../using/configure.rst:906 msgid "``blake2``." msgstr "``blake2``。" -#: ../../using/configure.rst:908 +#: ../../using/configure.rst:912 msgid "Override the OpenSSL default cipher suites string:" msgstr "" -#: ../../using/configure.rst:910 +#: ../../using/configure.rst:914 msgid "``python`` (default): use Python's preferred selection;" msgstr "" -#: ../../using/configure.rst:911 +#: ../../using/configure.rst:915 msgid "``openssl``: leave OpenSSL's defaults untouched;" msgstr "" -#: ../../using/configure.rst:912 +#: ../../using/configure.rst:916 msgid "*STRING*: use a custom string" msgstr "" -#: ../../using/configure.rst:914 +#: ../../using/configure.rst:918 msgid "See the :mod:`ssl` module." msgstr "請見 :mod:`ssl` 模組。" -#: ../../using/configure.rst:920 +#: ../../using/configure.rst:924 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" -#: ../../using/configure.rst:924 +#: ../../using/configure.rst:928 msgid "macOS Options" msgstr "macOS 選項" -#: ../../using/configure.rst:926 -#, fuzzy +#: ../../using/configure.rst:930 msgid "See :source:`Mac/README.rst`." -msgstr "參閱 ``Mac/README.rst``。" +msgstr "參閱 :source:`Mac/README.rst`。" -#: ../../using/configure.rst:931 +#: ../../using/configure.rst:935 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -#: ../../using/configure.rst:937 +#: ../../using/configure.rst:941 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -#: ../../using/configure.rst:942 +#: ../../using/configure.rst:946 msgid "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -#: ../../using/configure.rst:945 +#: ../../using/configure.rst:949 msgid "Options:" msgstr "選項:" -#: ../../using/configure.rst:947 -msgid "``universal2``;" -msgstr "``universal2``;" - -#: ../../using/configure.rst:948 -msgid "``32-bit``;" -msgstr "``32-bit``;" - -#: ../../using/configure.rst:949 -msgid "``64-bit``;" -msgstr "``64-bit``;" - -#: ../../using/configure.rst:950 -msgid "``3-way``;" -msgstr "``3-way``;" - #: ../../using/configure.rst:951 -msgid "``intel``;" -msgstr "``intel``;" +msgid "``universal2`` (x86-64 and arm64);" +msgstr "``universal2``\\ (x86-64 與 arm64);" #: ../../using/configure.rst:952 -msgid "``intel-32``;" -msgstr "``intel-32``;" +msgid "``32-bit`` (PPC and i386);" +msgstr "``32-bit``\\ (PPC 與 i386);" #: ../../using/configure.rst:953 -msgid "``intel-64``;" -msgstr "``intel-64``;" +msgid "``64-bit`` (PPC64 and x86-64);" +msgstr "``64-bit``\\ (PPC64 與 x86-64);" #: ../../using/configure.rst:954 -msgid "``all``." -msgstr "``all``。" +msgid "``3-way`` (i386, PPC and x86-64);" +msgstr "``3-way``\\ (i386、PPC 與 x86-64);" + +#: ../../using/configure.rst:955 +msgid "``intel`` (i386 and x86-64);" +msgstr "``intel``\\ (i386 與 x86-64);" + +#: ../../using/configure.rst:956 +msgid "``intel-32`` (i386);" +msgstr "``intel-32``\\ (i386);" + +#: ../../using/configure.rst:957 +msgid "``intel-64`` (x86-64);" +msgstr "``intel-64``\\ (x86-64);" #: ../../using/configure.rst:958 +msgid "``all`` (PPC, i386, PPC64 and x86-64)." +msgstr "``all``\\ (PPC、i386、PPC64 與 x86-64)。" + +#: ../../using/configure.rst:960 msgid "" -"Specify the name for the python framework on macOS only valid when :option:" -"`--enable-framework` is set (default: ``Python``)." +"Note that values for this configuration item are *not* the same as the " +"identifiers used for universal binary wheels on macOS. See the Python " +"Packaging User Guide for details on the `packaging platform compatibility " +"tags used on macOS <https://packaging.python.org/en/latest/specifications/" +"platform-compatibility-tags/#macos>`_" msgstr "" -#: ../../using/configure.rst:964 +#: ../../using/configure.rst:968 +msgid "" +"Specify the name for the python framework on macOS only valid " +"when :option:`--enable-framework` is set (default: ``Python``)." +msgstr "" + +#: ../../using/configure.rst:974 msgid "" "The Python standard library contains strings that are known to trigger " "automated inspection tool errors when submitted for distribution by the " @@ -1427,31 +1452,29 @@ msgid "" "can also be specified. This option is disabled by default." msgstr "" -#: ../../using/configure.rst:973 -#, fuzzy +#: ../../using/configure.rst:983 msgid "iOS Options" -msgstr "macOS 選項" +msgstr "iOS 選項" -#: ../../using/configure.rst:975 -#, fuzzy +#: ../../using/configure.rst:985 msgid "See :source:`iOS/README.rst`." -msgstr "參閱 ``Mac/README.rst``。" +msgstr "參閱 :source:`iOS/README.rst`。" -#: ../../using/configure.rst:979 +#: ../../using/configure.rst:989 msgid "" "Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " "specifying the installation path is mandatory." msgstr "" -#: ../../using/configure.rst:984 +#: ../../using/configure.rst:994 msgid "Specify the name for the framework (default: ``Python``)." -msgstr "" +msgstr "指定框架的名稱(預設值:``Python``)。" -#: ../../using/configure.rst:988 +#: ../../using/configure.rst:998 msgid "Cross Compiling Options" msgstr "" -#: ../../using/configure.rst:990 +#: ../../using/configure.rst:1000 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -1459,28 +1482,28 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: ../../using/configure.rst:997 +#: ../../using/configure.rst:1007 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: ../../using/configure.rst:1001 +#: ../../using/configure.rst:1011 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: ../../using/configure.rst:1005 +#: ../../using/configure.rst:1015 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: ../../using/configure.rst:1011 +#: ../../using/configure.rst:1021 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: ../../using/configure.rst:1013 +#: ../../using/configure.rst:1023 msgid "Example *config.site* file:" -msgstr "" +msgstr "範例 *config.site* 檔案:" -#: ../../using/configure.rst:1015 +#: ../../using/configure.rst:1025 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" @@ -1492,15 +1515,15 @@ msgstr "" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" -#: ../../using/configure.rst:1024 +#: ../../using/configure.rst:1034 msgid "Program to run CPython for the host platform for cross-compilation." msgstr "" -#: ../../using/configure.rst:1029 +#: ../../using/configure.rst:1039 msgid "Cross compiling example::" msgstr "" -#: ../../using/configure.rst:1031 +#: ../../using/configure.rst:1041 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" @@ -1512,64 +1535,65 @@ msgstr "" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" -#: ../../using/configure.rst:1038 +#: ../../using/configure.rst:1048 msgid "Python Build System" -msgstr "" +msgstr "Python 建置系統" -#: ../../using/configure.rst:1041 +#: ../../using/configure.rst:1051 msgid "Main files of the build system" -msgstr "" +msgstr "建置系統的主要檔案" -#: ../../using/configure.rst:1043 +#: ../../using/configure.rst:1053 msgid ":file:`configure.ac` => :file:`configure`;" -msgstr ":file:`configure.ac` => :file:`configure`\\ ;" +msgstr ":file:`configure.ac` => :file:`configure`;" -#: ../../using/configure.rst:1044 +#: ../../using/configure.rst:1054 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" +":file:`Makefile.pre.in` => :file:`Makefile`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1045 +#: ../../using/configure.rst:1055 msgid ":file:`pyconfig.h` (created by :file:`configure`);" -msgstr ":file:`pyconfig.h` (created by :file:`configure`)\\ ;" +msgstr ":file:`pyconfig.h`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1046 +#: ../../using/configure.rst:1056 msgid "" -":file:`Modules/Setup`: C extensions built by the Makefile using :file:" -"`Module/makesetup` shell script;" +":file:`Modules/Setup`: C extensions built by the Makefile " +"using :file:`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:1050 +#: ../../using/configure.rst:1060 msgid "Main build steps" msgstr "主要建置步驟" -#: ../../using/configure.rst:1052 +#: ../../using/configure.rst:1062 msgid "C files (``.c``) are built as object files (``.o``)." -msgstr "" +msgstr "C 檔案(``.c``)被建置為目的檔(``.o``)。" -#: ../../using/configure.rst:1053 +#: ../../using/configure.rst:1063 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:1054 +#: ../../using/configure.rst:1064 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:1056 +#: ../../using/configure.rst:1066 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: ../../using/configure.rst:1059 +#: ../../using/configure.rst:1069 msgid "Main Makefile targets" msgstr "主要 Makefile 目標" -#: ../../using/configure.rst:1062 +#: ../../using/configure.rst:1072 msgid "make" -msgstr "" +msgstr "make" -#: ../../using/configure.rst:1064 +#: ../../using/configure.rst:1074 msgid "" "For the most part, when rebuilding after editing some code or refreshing " "your checkout from upstream, all you need to do is execute ``make``, which " @@ -1580,20 +1604,20 @@ msgid "" "all`` will build. The three choices are:" msgstr "" -#: ../../using/configure.rst:1073 +#: ../../using/configure.rst:1083 msgid "``profile-opt`` (configured with ``--enable-optimizations``)" -msgstr "" +msgstr "``profile-opt``\\ (使用 ``--enable-optimizations`` 配置)" -#: ../../using/configure.rst:1074 +#: ../../using/configure.rst:1084 msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" -msgstr "" +msgstr "``build_wasm``\\ (使用 ``--with-emscripten-target`` 配置)" -#: ../../using/configure.rst:1075 +#: ../../using/configure.rst:1085 msgid "" "``build_all`` (configured without explicitly using either of the others)" -msgstr "" +msgstr "``build_all``\\ (未明確使用其他選項進行配置)" -#: ../../using/configure.rst:1077 +#: ../../using/configure.rst:1087 msgid "" "Depending on the most recent source file changes, Make will rebuild any " "targets (object files and executables) deemed out-of-date, including running " @@ -1606,11 +1630,11 @@ msgid "" "problems, at the expense of longer build times." msgstr "" -#: ../../using/configure.rst:1090 +#: ../../using/configure.rst:1100 msgid "make platform" -msgstr "" +msgstr "make platform" -#: ../../using/configure.rst:1092 +#: ../../using/configure.rst:1102 msgid "" "Build the ``python`` program, but don't build the standard library extension " "modules. This generates a file named ``platform`` which contains a single " @@ -1618,82 +1642,81 @@ msgid "" "arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" -#: ../../using/configure.rst:1099 +#: ../../using/configure.rst:1109 msgid "make profile-opt" -msgstr "" +msgstr "make profile-opt" -#: ../../using/configure.rst:1101 +#: ../../using/configure.rst:1111 msgid "" "Build Python using profile-guided optimization (PGO). You can use the " "configure :option:`--enable-optimizations` option to make this the default " "target of the ``make`` command (``make all`` or just ``make``)." msgstr "" -#: ../../using/configure.rst:1109 +#: ../../using/configure.rst:1119 msgid "make clean" -msgstr "" +msgstr "make clean" -#: ../../using/configure.rst:1111 +#: ../../using/configure.rst:1121 msgid "Remove built files." -msgstr "" +msgstr "移除建置的檔案。" -#: ../../using/configure.rst:1115 +#: ../../using/configure.rst:1125 msgid "make distclean" -msgstr "" +msgstr "make distclean" -#: ../../using/configure.rst:1117 +#: ../../using/configure.rst:1127 msgid "" "In addition to the work done by ``make clean``, remove files created by the " "configure script. ``configure`` will have to be run before building again. " "[#]_" msgstr "" -#: ../../using/configure.rst:1123 +#: ../../using/configure.rst:1133 msgid "make install" -msgstr "" +msgstr "make install" -#: ../../using/configure.rst:1125 +#: ../../using/configure.rst:1135 msgid "Build the ``all`` target and install Python." -msgstr "" +msgstr "建置 ``all`` 目標並安裝 Python。" -#: ../../using/configure.rst:1129 +#: ../../using/configure.rst:1139 msgid "make test" -msgstr "" +msgstr "make test" -#: ../../using/configure.rst:1131 +#: ../../using/configure.rst:1141 msgid "" "Build the ``all`` target and run the Python test suite with the ``--fast-" "ci`` option. Variables:" msgstr "" -#: ../../using/configure.rst:1134 +#: ../../using/configure.rst:1144 msgid "``TESTOPTS``: additional regrtest command-line options." -msgstr "" +msgstr "``TESTOPTS``:額外的 regrtest 命令列選項。" -#: ../../using/configure.rst:1135 +#: ../../using/configure.rst:1145 msgid "``TESTPYTHONOPTS``: additional Python command-line options." -msgstr "" +msgstr "``TESTPYTHONOPTS``:額外的 Python 命令列選項。" -#: ../../using/configure.rst:1136 +#: ../../using/configure.rst:1146 msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." -msgstr "" +msgstr "``TESTTIMEOUT``:秒數表示的超時設定(預設值:10 分鐘)。" -#: ../../using/configure.rst:1140 -#, fuzzy +#: ../../using/configure.rst:1150 msgid "make buildbottest" -msgstr "主要建置步驟" +msgstr "make buildbottest" -#: ../../using/configure.rst:1142 +#: ../../using/configure.rst:1152 msgid "" "This is similar to ``make test``, but uses the ``--slow-ci`` option and " "default timeout of 20 minutes, instead of ``--fast-ci`` option." msgstr "" -#: ../../using/configure.rst:1147 +#: ../../using/configure.rst:1157 msgid "make regen-all" -msgstr "" +msgstr "make regen-all" -#: ../../using/configure.rst:1149 +#: ../../using/configure.rst:1159 msgid "" "Regenerate (almost) all generated files. These include (but are not limited " "to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" @@ -1701,18 +1724,18 @@ msgid "" "files <#generated-files>`_." msgstr "" -#: ../../using/configure.rst:1156 +#: ../../using/configure.rst:1166 msgid "C extensions" msgstr "C 擴充模組" -#: ../../using/configure.rst:1158 +#: ../../using/configure.rst:1168 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: ../../using/configure.rst:1162 +#: ../../using/configure.rst:1172 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1722,31 +1745,38 @@ msgid "" " File \"<stdin>\", line 1, in <module>\n" "AttributeError: module 'sys' has no attribute '__file__'" msgstr "" +">>> import sys\n" +">>> sys\n" +"<module 'sys' (built-in)>\n" +">>> sys.__file__\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"AttributeError: module 'sys' has no attribute '__file__'" -#: ../../using/configure.rst:1172 +#: ../../using/configure.rst:1182 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: ../../using/configure.rst:1176 +#: ../../using/configure.rst:1186 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" -"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio." -"cpython-39-x86_64-linux-gnu.so'>\n" +"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/" +"_asyncio.cpython-39-x86_64-linux-gnu.so'>\n" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" msgstr "" ">>> import _asyncio\n" ">>> _asyncio\n" -"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio." -"cpython-39-x86_64-linux-gnu.so'>\n" +"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/" +"_asyncio.cpython-39-x86_64-linux-gnu.so'>\n" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:1184 +#: ../../using/configure.rst:1194 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1754,304 +1784,314 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:1188 +#: ../../using/configure.rst:1198 msgid "" -"The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and :c:macro:" -"`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined differently " -"depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" +"The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` " +"and :c:macro:`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are " +"defined differently depending if the ``Py_BUILD_CORE_MODULE`` macro is " +"defined:" msgstr "" -#: ../../using/configure.rst:1192 +#: ../../using/configure.rst:1202 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "如果定義了 ``Py_BUILD_CORE_MODULE``,則使用 ``Py_EXPORTED_SYMBOL``" -#: ../../using/configure.rst:1193 +#: ../../using/configure.rst:1203 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "否則使用 ``Py_IMPORTED_SYMBOL``。" -#: ../../using/configure.rst:1195 +#: ../../using/configure.rst:1205 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:1201 +#: ../../using/configure.rst:1211 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:1203 +#: ../../using/configure.rst:1213 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:1207 +#: ../../using/configure.rst:1217 msgid "Preprocessor flags" -msgstr "" +msgstr "預處理器旗標" -#: ../../using/configure.rst:1211 +#: ../../using/configure.rst:1221 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1217 +#: ../../using/configure.rst:1227 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: ../../using/configure.rst:1220 ../../using/configure.rst:1410 +#: ../../using/configure.rst:1230 ../../using/configure.rst:1420 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: ../../using/configure.rst:1230 +#: ../../using/configure.rst:1240 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1232 +#: ../../using/configure.rst:1242 msgid "" -"Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " -"$(CPPFLAGS)``." +"Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $" +"(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:1237 +#: ../../using/configure.rst:1247 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../using/configure.rst:1243 +#: ../../using/configure.rst:1253 msgid "Example: ``gcc -pthread``." -msgstr "" +msgstr "範例:``gcc -pthread``。" -#: ../../using/configure.rst:1247 +#: ../../using/configure.rst:1257 msgid "C++ compiler command." msgstr "C++ 編譯器指令。" -#: ../../using/configure.rst:1249 +#: ../../using/configure.rst:1259 msgid "Example: ``g++ -pthread``." msgstr "範例:``g++ -pthread``。" -#: ../../using/configure.rst:1257 +#: ../../using/configure.rst:1267 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " -"extensions. Use it when a compiler flag should *not* be part of :envvar:" -"`CFLAGS` once Python is installed (:gh:`65320`)." +"extensions. Use it when a compiler flag should *not* be part " +"of :envvar:`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1261 +#: ../../using/configure.rst:1271 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1263 +#: ../../using/configure.rst:1273 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " -"The ``-I`` flags are processed from left to right, and any flags in :envvar:" -"`CFLAGS` would take precedence over user- and package-supplied ``-I`` flags." +"The ``-I`` flags are processed from left to right, and any flags " +"in :envvar:`CFLAGS` would take precedence over user- and package-supplied ``-" +"I`` flags." msgstr "" -#: ../../using/configure.rst:1268 +#: ../../using/configure.rst:1278 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:1276 +#: ../../using/configure.rst:1286 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: ../../using/configure.rst:1283 +#: ../../using/configure.rst:1293 msgid "Extra C compiler flags." msgstr "額外的 C 編譯器旗標。" -#: ../../using/configure.rst:1287 +#: ../../using/configure.rst:1297 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1294 +#: ../../using/configure.rst:1304 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1301 +#: ../../using/configure.rst:1311 msgid "Base compiler flags." msgstr "基本編譯器旗標。" -#: ../../using/configure.rst:1305 +#: ../../using/configure.rst:1315 msgid "Optimization flags." msgstr "最佳化旗標。" -#: ../../using/configure.rst:1309 +#: ../../using/configure.rst:1319 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:1315 +#: ../../using/configure.rst:1325 msgid "Compiler flags used to build a shared library." -msgstr "" +msgstr "用於建置共享函式庫的編譯器旗標。" -#: ../../using/configure.rst:1317 +#: ../../using/configure.rst:1327 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:1321 +#: ../../using/configure.rst:1331 msgid "Extra C flags added for building the interpreter object files." -msgstr "" +msgstr "用於建置直譯器目的檔的額外 C 旗標。" -#: ../../using/configure.rst:1323 +#: ../../using/configure.rst:1333 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" +"預設值:當使用 :option:`--enable-shared` 時為 ``$(CCSHARED)``,否則為空字串。" -#: ../../using/configure.rst:1328 +#: ../../using/configure.rst:1338 msgid "" -"Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " -"$(EXTRA_CFLAGS)``." +"Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $" +"(EXTRA_CFLAGS)``." msgstr "" +"預設值:``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $" +"(EXTRA_CFLAGS)``。" -#: ../../using/configure.rst:1332 +#: ../../using/configure.rst:1342 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" +"預設值:``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" +"internal``。" -#: ../../using/configure.rst:1338 +#: ../../using/configure.rst:1348 msgid "C flags used for building the interpreter object files." -msgstr "" +msgstr "用於建置直譯器目的檔的 C 旗標。" -#: ../../using/configure.rst:1340 +#: ../../using/configure.rst:1350 msgid "" -"Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " -"$(CFLAGSFORSHARED)``." +"Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $" +"(CFLAGSFORSHARED)``." msgstr "" +"預設值:``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $" +"(CFLAGSFORSHARED)``。" -#: ../../using/configure.rst:1346 +#: ../../using/configure.rst:1356 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." -msgstr "" +msgstr "預設值:``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``。" -#: ../../using/configure.rst:1352 +#: ../../using/configure.rst:1362 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:1355 +#: ../../using/configure.rst:1365 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." -msgstr "" +msgstr "預設值:``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``。" -#: ../../using/configure.rst:1361 +#: ../../using/configure.rst:1371 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:1363 +#: ../../using/configure.rst:1373 msgid "Default: empty string (not used)." -msgstr "" +msgstr "預設值:空字串(未使用)。" -#: ../../using/configure.rst:1367 +#: ../../using/configure.rst:1377 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:1371 +#: ../../using/configure.rst:1381 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:1373 +#: ../../using/configure.rst:1383 msgid "Default: ``$(PURIFY) $(CC)``." -msgstr "" +msgstr "預設值:``$(PURIFY) $(CC)``。" -#: ../../using/configure.rst:1377 +#: ../../using/configure.rst:1387 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1379 +#: ../../using/configure.rst:1389 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:1387 +#: ../../using/configure.rst:1397 msgid "" -":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" -"`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of :envvar:" -"`LDFLAGS` once Python is installed (:gh:`65320`)." +":envvar:`LDFLAGS_NODIST` is used in the same manner " +"as :envvar:`CFLAGS_NODIST`. Use it when a linker flag should *not* be part " +"of :envvar:`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1391 +#: ../../using/configure.rst:1401 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1393 +#: ../../using/configure.rst:1403 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" -"L`` flags are processed from left to right, and any flags in :envvar:" -"`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags." +"L`` flags are processed from left to right, and any flags " +"in :envvar:`LDFLAGS` would take precedence over user- and package-supplied " +"``-L`` flags." msgstr "" -#: ../../using/configure.rst:1400 +#: ../../using/configure.rst:1410 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1407 +#: ../../using/configure.rst:1417 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: ../../using/configure.rst:1416 +#: ../../using/configure.rst:1426 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:1419 +#: ../../using/configure.rst:1429 msgid "Example: ``-lrt``." msgstr "範例:``-lrt``。" -#: ../../using/configure.rst:1423 +#: ../../using/configure.rst:1433 msgid "Command to build a shared library." -msgstr "" +msgstr "建置共享函式庫的指令。" -#: ../../using/configure.rst:1425 +#: ../../using/configure.rst:1435 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "預設值:``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1429 +#: ../../using/configure.rst:1439 msgid "Command to build ``libpython`` shared library." -msgstr "" +msgstr "建置 ``libpython`` 共享函式庫的指令。" -#: ../../using/configure.rst:1431 +#: ../../using/configure.rst:1441 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "預設值:``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1435 +#: ../../using/configure.rst:1445 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1439 +#: ../../using/configure.rst:1449 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1445 +#: ../../using/configure.rst:1455 msgid "Linker flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1451 +#: ../../using/configure.rst:1461 msgid "Footnotes" msgstr "註腳" -#: ../../using/configure.rst:1452 +#: ../../using/configure.rst:1462 msgid "" "``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " "It removes all files not known to Git. When bug hunting using ``git " @@ -2060,6 +2100,3 @@ msgid "" "clean build. **Use with care**, as it will delete all files not checked into " "Git, including your new, uncommitted work." msgstr "" - -#~ msgid "Define the ``WITH_EDITLINE`` macro." -#~ msgstr "定義 ``WITH_EDITLINE`` 巨集。" diff --git a/using/editors.po b/using/editors.po index d066d58ae3..7aca16ba10 100644 --- a/using/editors.po +++ b/using/editors.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2025-02-13 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,9 +29,28 @@ msgid "" "checks." msgstr "" -#: ../../using/editors.rst:12 +#: ../../using/editors.rst:14 +msgid "IDLE --- Python editor and shell" +msgstr "IDLE --- Python 編輯器與 shell" + +#: ../../using/editors.rst:16 +msgid "" +"IDLE is Python’s Integrated Development and Learning Environment and is " +"generally bundled with Python installs. If you are on Linux and do not have " +"IDLE installed see :ref:`Installing IDLE on Linux " +"<installing_idle_on_linux>`. For more information see the :ref:`IDLE docs " +"<idle>`." +msgstr "" + +#: ../../using/editors.rst:22 +msgid "Other Editors and IDEs" +msgstr "其他編輯器與 IDE" + +#: ../../using/editors.rst:24 msgid "" -"Please go to `Python Editors <https://wiki.python.org/moin/PythonEditors>`_ " -"and `Integrated Development Environments <https://wiki.python.org/moin/" -"IntegratedDevelopmentEnvironments>`_ for a comprehensive list." +"Python's community wiki has information submitted by the community on " +"Editors and IDEs. Please go to `Python Editors <https://wiki.python.org/moin/" +"PythonEditors>`_ and `Integrated Development Environments <https://" +"wiki.python.org/moin/IntegratedDevelopmentEnvironments>`_ for a " +"comprehensive list." msgstr "" diff --git a/using/ios.po b/using/ios.po index 1f1bd2a519..504db08ea5 100644 --- a/using/ios.po +++ b/using/ios.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-03-14 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -473,20 +473,20 @@ msgid "" msgstr "" #: ../../using/ios.rst:295 -msgid ":c:member:`UTF-8 mode <PyPreConfig.utf8_mode>` is *enabled*;" +msgid "UTF-8 mode (:c:member:`PyPreConfig.utf8_mode`) is *enabled*;" msgstr "" #: ../../using/ios.rst:296 -msgid ":c:member:`Buffered stdio <PyConfig.buffered_stdio>` is *disabled*;" +msgid "Buffered stdio (:c:member:`PyConfig.buffered_stdio`) is *disabled*;" msgstr "" #: ../../using/ios.rst:297 -msgid ":c:member:`Writing bytecode <PyConfig.write_bytecode>` is *disabled*;" +msgid "Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;" msgstr "" #: ../../using/ios.rst:298 msgid "" -":c:member:`Signal handlers <PyConfig.install_signal_handlers>` are *enabled*;" +"Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;" msgstr "" #: ../../using/ios.rst:299 @@ -548,11 +548,77 @@ msgid "" msgstr "" #: ../../using/ios.rst:328 -msgid "App Store Compliance" +msgid "Testing a Python package" msgstr "" #: ../../using/ios.rst:330 msgid "" +"The CPython source tree contains :source:`a testbed project <iOS/testbed>` " +"that is used to run the CPython test suite on the iOS simulator. This " +"testbed can also be used as a testbed project for running your Python " +"library's test suite on iOS." +msgstr "" + +#: ../../using/ios.rst:334 +msgid "" +"After building or obtaining an iOS XCFramework (See :source:`iOS/README.rst` " +"for details), create a clone of the Python iOS testbed project by running:" +msgstr "" + +#: ../../using/ios.rst:337 +msgid "" +"$ python iOS/testbed clone --framework <path/to/Python.xcframework> --app " +"<path/to/module1> --app <path/to/module2> app-testbed" +msgstr "" + +#: ../../using/ios.rst:341 +msgid "" +"You will need to modify the ``iOS/testbed`` reference to point to that " +"directory in the CPython source tree; any folders specified with the ``--" +"app`` flag will be copied into the cloned testbed project. The resulting " +"testbed will be created in the ``app-testbed`` folder. In this example, the " +"``module1`` and ``module2`` would be importable modules at runtime. If your " +"project has additional dependencies, they can be installed into the ``app-" +"testbed/iOSTestbed/app_packages`` folder (using ``pip install --target app-" +"testbed/iOSTestbed/app_packages`` or similar)." +msgstr "" + +#: ../../using/ios.rst:350 +msgid "" +"You can then use the ``app-testbed`` folder to run the test suite for your " +"app, For example, if ``module1.tests`` was the entry point to your test " +"suite, you could run:" +msgstr "" + +#: ../../using/ios.rst:354 +msgid "$ python app-testbed run -- module1.tests" +msgstr "" + +#: ../../using/ios.rst:358 +msgid "" +"This is the equivalent of running ``python -m module1.tests`` on a desktop " +"Python build. Any arguments after the ``--`` will be passed to the testbed " +"as if they were arguments to ``python -m`` on a desktop machine." +msgstr "" + +#: ../../using/ios.rst:362 +msgid "You can also open the testbed project in Xcode by running:" +msgstr "" + +#: ../../using/ios.rst:364 +msgid "$ open app-testbed/iOSTestbed.xcodeproj" +msgstr "" + +#: ../../using/ios.rst:368 +msgid "This will allow you to use the full Xcode suite of tools for debugging." +msgstr "" + +#: ../../using/ios.rst:371 +msgid "App Store Compliance" +msgstr "" + +#: ../../using/ios.rst:373 +msgid "" "The only mechanism for distributing apps to third-party iOS devices is to " "submit the app to the iOS App Store; apps submitted for distribution must " "pass Apple's app review process. This process includes a set of automated " @@ -560,7 +626,7 @@ msgid "" "problematic code." msgstr "" -#: ../../using/ios.rst:335 +#: ../../using/ios.rst:378 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " @@ -568,7 +634,7 @@ msgid "" "Python standard library for an app to pass App Store review." msgstr "" -#: ../../using/ios.rst:340 +#: ../../using/ios.rst:383 msgid "" "The Python source tree contains :source:`a patch file <Mac/Resources/app-" "store-compliance.patch>` that will remove all code that is known to cause " diff --git a/using/unix.po b/using/unix.po index e787864dc8..e33e46374a 100644 --- a/using/unix.po +++ b/using/unix.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,7 +57,7 @@ msgstr "https://www.debian.org/doc/manuals/maint-guide/first.en.html" #: ../../using/unix.rst:30 msgid "for Debian users" -msgstr "對於 Debian 用戶" +msgstr "對於 Debian 使用者" #: ../../using/unix.rst:31 msgid "https://en.opensuse.org/Portal:Packaging" @@ -65,7 +65,7 @@ msgstr "https://en.opensuse.org/Portal:Packaging" #: ../../using/unix.rst:32 msgid "for OpenSuse users" -msgstr "對於 OpenSuse 用戶" +msgstr "對於 OpenSuse 使用者" #: ../../using/unix.rst:33 msgid "" @@ -77,7 +77,7 @@ msgstr "" #: ../../using/unix.rst:34 msgid "for Fedora users" -msgstr "對於 Fedora 用戶" +msgstr "對於 Fedora 使用者" #: ../../using/unix.rst:35 msgid "https://slackbook.org/html/package-management-making-packages.html" @@ -85,25 +85,69 @@ msgstr "https://slackbook.org/html/package-management-making-packages.html" #: ../../using/unix.rst:36 msgid "for Slackware users" -msgstr "對於 Slackware 用戶" +msgstr "對於 Slackware 使用者" -#: ../../using/unix.rst:40 +#: ../../using/unix.rst:41 +msgid "Installing IDLE" +msgstr "安裝 IDLE" + +#: ../../using/unix.rst:43 +msgid "In some cases, IDLE might not be included in your Python installation." +msgstr "在某些情況下,IDLE 可能不會包含在你的 Python 安裝中。" + +#: ../../using/unix.rst:45 +msgid "For Debian and Ubuntu users::" +msgstr "對於 Debian 和 Ubuntu 使用者: ::" + +#: ../../using/unix.rst:47 +msgid "" +"sudo apt update\n" +"sudo apt install idle" +msgstr "" +"sudo apt update\n" +"sudo apt install idle" + +#: ../../using/unix.rst:50 +msgid "For Fedora, RHEL, and CentOS users::" +msgstr "對於 Fedora、RHEL 和 CentOS 使用者: ::" + +#: ../../using/unix.rst:52 +msgid "sudo dnf install python3-idle" +msgstr "sudo dnf install python3-idle" + +#: ../../using/unix.rst:54 +msgid "For SUSE and OpenSUSE users::" +msgstr "對於 SUSE 和 OpenSUSE 使用者: ::" + +#: ../../using/unix.rst:56 +msgid "sudo zypper install python3-idle" +msgstr "sudo zypper install python3-idle" + +#: ../../using/unix.rst:58 +msgid "For Alpine Linux users::" +msgstr "對於 Alpine Linux 使用者: ::" + +#: ../../using/unix.rst:60 +msgid "sudo apk add python3-idle" +msgstr "sudo apk add python3-idle" + +#: ../../using/unix.rst:65 msgid "On FreeBSD and OpenBSD" msgstr "在 FreeBSD 和 OpenBSD 上" -#: ../../using/unix.rst:42 +#: ../../using/unix.rst:67 msgid "FreeBSD users, to add the package use::" -msgstr "FreeBSD 用戶應使用以下命令增加套件: ::" +msgstr "FreeBSD 使用者應使用以下命令增加套件: ::" -#: ../../using/unix.rst:44 +#: ../../using/unix.rst:69 msgid "pkg install python3" msgstr "pkg install python3" -#: ../../using/unix.rst:46 +#: ../../using/unix.rst:71 msgid "OpenBSD users, to add the package use::" -msgstr "OpenBSD 用戶應使用以下命令增加套件: ::" +msgstr "OpenBSD 使用者應使用以下命令增加套件: ::" -#: ../../using/unix.rst:48 +#: ../../using/unix.rst:73 msgid "" "pkg_add -r python\n" "\n" @@ -115,23 +159,23 @@ msgstr "" "pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/<insert your " "architecture here>/python-<version>.tgz" -#: ../../using/unix.rst:52 +#: ../../using/unix.rst:77 msgid "For example i386 users get the 2.5.1 version of Python using::" -msgstr "例如 i386 使用者要獲取 Python 2.5.1 的可用版本: ::" +msgstr "例如 i386 使用者要取得 Python 2.5.1 的可用版本: ::" -#: ../../using/unix.rst:54 +#: ../../using/unix.rst:79 msgid "" -"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." -"tgz" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/" +"python-2.5.1p2.tgz" msgstr "" -"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." -"tgz" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/" +"python-2.5.1p2.tgz" -#: ../../using/unix.rst:60 +#: ../../using/unix.rst:85 msgid "Building Python" msgstr "建置 Python" -#: ../../using/unix.rst:62 +#: ../../using/unix.rst:87 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source <https://www.python.org/downloads/source/>`_. You can download " @@ -139,16 +183,16 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_. (If you want to " "contribute patches, you will need a clone.)" msgstr "" -"如果你想自己編譯 CPython,首先要做的是獲取\\ `原始碼 <https://www.python.org/" +"如果你想自己編譯 CPython,首先要做的是取得\\ `原始碼 <https://www.python.org/" "downloads/source/>`_。你可以下載最新版本的原始碼,也可以直接提取最新的 `clone" "(克隆) <https://devguide.python.org/setup/#getting-the-source-code>`_。(如" "果你想要貢獻修補程式碼,也會需要一份 clone。)" -#: ../../using/unix.rst:68 +#: ../../using/unix.rst:93 msgid "The build process consists of the usual commands::" msgstr "建置過程由幾個常用命令組成: ::" -#: ../../using/unix.rst:70 +#: ../../using/unix.rst:95 msgid "" "./configure\n" "make\n" @@ -158,7 +202,7 @@ msgstr "" "make\n" "make install" -#: ../../using/unix.rst:74 +#: ../../using/unix.rst:99 msgid "" ":ref:`Configuration options <configure-options>` and caveats for specific " "Unix platforms are extensively documented in the :source:`README.rst` file " @@ -168,21 +212,21 @@ msgstr "" "地記錄在 Python 原始碼樹 (source tree) 根目錄下的 :source:`README.rst` 檔案" "中。" -#: ../../using/unix.rst:80 +#: ../../using/unix.rst:105 msgid "" "``make install`` can overwrite or masquerade the :file:`python3` binary. " "``make altinstall`` is therefore recommended instead of ``make install`` " "since it only installs :file:`{exec_prefix}/bin/python{version}`." msgstr "" "``make install`` 可以覆蓋或偽裝 :file:`python3` 二進位制檔案。因此,建議使用 " -"``make altinstall`` 而不是 ``make install``,因為它只安裝 :file:" -"`{exec_prefix}/bin/python{version}`。" +"``make altinstall`` 而不是 ``make install``,因為它只安" +"裝 :file:`{exec_prefix}/bin/python{version}`。" -#: ../../using/unix.rst:86 +#: ../../using/unix.rst:111 msgid "Python-related paths and files" msgstr "與 Python 相關的路徑和檔案" -#: ../../using/unix.rst:88 +#: ../../using/unix.rst:113 msgid "" "These are subject to difference depending on local installation " "conventions; :option:`prefix <--prefix>` and :option:`exec_prefix <--exec-" @@ -192,28 +236,28 @@ msgstr "" "這取決於本地安裝慣例;:option:`prefix <--prefix>` 和 :option:`exec_prefix <--" "exec-prefix>` 相依於安裝方式,應被直譯來讓 GNU 軟體使用;它們也可能相同。" -#: ../../using/unix.rst:93 +#: ../../using/unix.rst:118 msgid "" "For example, on most Linux systems, the default for both is :file:`/usr`." msgstr "例如,在大多數 Linux 系統上,兩者的預設值皆是 :file:`/usr`。" -#: ../../using/unix.rst:96 +#: ../../using/unix.rst:121 msgid "File/directory" msgstr "檔案/目錄" -#: ../../using/unix.rst:96 +#: ../../using/unix.rst:121 msgid "Meaning" msgstr "含意" -#: ../../using/unix.rst:98 +#: ../../using/unix.rst:123 msgid ":file:`{exec_prefix}/bin/python3`" msgstr ":file:`{exec_prefix}/bin/python3`" -#: ../../using/unix.rst:98 +#: ../../using/unix.rst:123 msgid "Recommended location of the interpreter." msgstr "直譯器的推薦位置。" -#: ../../using/unix.rst:100 +#: ../../using/unix.rst:125 msgid "" ":file:`{prefix}/lib/python{version}`, :file:`{exec_prefix}/lib/" "python{version}`" @@ -221,12 +265,12 @@ msgstr "" ":file:`{prefix}/lib/python{version}`、:file:`{exec_prefix}/lib/" "python{version}`" -#: ../../using/unix.rst:100 +#: ../../using/unix.rst:125 msgid "" "Recommended locations of the directories containing the standard modules." msgstr "包含標準模組目錄的推薦位置。" -#: ../../using/unix.rst:103 +#: ../../using/unix.rst:128 msgid "" ":file:`{prefix}/include/python{version}`, :file:`{exec_prefix}/include/" "python{version}`" @@ -234,59 +278,59 @@ msgstr "" ":file:`{prefix}/include/python{version}`、:file:`{exec_prefix}/include/" "python{version}`" -#: ../../using/unix.rst:103 +#: ../../using/unix.rst:128 msgid "" "Recommended locations of the directories containing the include files needed " "for developing Python extensions and embedding the interpreter." msgstr "" "包含開發 Python 擴充套件和嵌入直譯器所需 include 檔案之目錄的推薦位置。" -#: ../../using/unix.rst:111 +#: ../../using/unix.rst:136 msgid "Miscellaneous" msgstr "雜項" -#: ../../using/unix.rst:113 +#: ../../using/unix.rst:138 msgid "" "To easily use Python scripts on Unix, you need to make them executable, e.g. " "with" msgstr "" "要在 Unix 上使用 Python 腳本,你需要讓他們是可執行的 (executable),例如用" -#: ../../using/unix.rst:116 +#: ../../using/unix.rst:141 msgid "$ chmod +x script" msgstr "$ chmod +x script" -#: ../../using/unix.rst:120 +#: ../../using/unix.rst:145 msgid "" "and put an appropriate Shebang line at the top of the script. A good choice " "is usually ::" msgstr "並在腳本的頂部放一個合適的 Shebang。以下通常是個好選擇: ::" -#: ../../using/unix.rst:123 +#: ../../using/unix.rst:148 msgid "#!/usr/bin/env python3" msgstr "#!/usr/bin/env python3" -#: ../../using/unix.rst:125 +#: ../../using/unix.rst:150 msgid "" "which searches for the Python interpreter in the whole :envvar:`PATH`. " "However, some Unices may not have the :program:`env` command, so you may " "need to hardcode ``/usr/bin/python3`` as the interpreter path." msgstr "" -"將在整個 :envvar:`PATH` 中搜索 Python 直譯器。然而某些 Unix 系統可能沒有 :" -"program:`env` 命令,因此你可能需要將 ``/usr/bin/python3`` 寫死 (hardcode) 成" -"直譯器路徑。" +"將在整個 :envvar:`PATH` 中搜尋 Python 直譯器。然而某些 Unix 系統可能沒" +"有 :program:`env` 命令,因此你可能需要將 ``/usr/bin/python3`` 寫死 " +"(hardcode) 成直譯器路徑。" -#: ../../using/unix.rst:129 +#: ../../using/unix.rst:154 msgid "" "To use shell commands in your Python scripts, look at the :mod:`subprocess` " "module." msgstr "要在 Python 腳本中使用 shell 命令,請見 :mod:`subprocess` 模組。" -#: ../../using/unix.rst:134 +#: ../../using/unix.rst:159 msgid "Custom OpenSSL" msgstr "客製化 OpenSSL" -#: ../../using/unix.rst:136 +#: ../../using/unix.rst:161 msgid "" "To use your vendor's OpenSSL configuration and system trust store, locate " "the directory with ``openssl.cnf`` file or symlink in ``/etc``. On most " @@ -299,7 +343,7 @@ msgstr "" "(symlink)。在大多數發行版上,該檔案會是在 ``/etc/ssl`` 或者 ``/etc/pki/tls`` " "中。該目錄亦應包含一個 ``cert.pem`` 檔案和/或一個 ``certs`` 目錄。" -#: ../../using/unix.rst:142 +#: ../../using/unix.rst:167 msgid "" "$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" "/etc/ssl" @@ -307,7 +351,7 @@ msgstr "" "$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" "/etc/ssl" -#: ../../using/unix.rst:147 +#: ../../using/unix.rst:172 msgid "" "Download, build, and install OpenSSL. Make sure you use ``install_sw`` and " "not ``install``. The ``install_sw`` target does not override ``openssl.cnf``." @@ -315,7 +359,7 @@ msgstr "" "下載、建置並安裝 OpenSSL。請確保你使用 ``install_sw`` 而不是 ``install``。" "``install_sw`` 的目標不會覆蓋 ``openssl.cnf``。" -#: ../../using/unix.rst:151 +#: ../../using/unix.rst:176 msgid "" "$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz\n" "$ tar xzf openssl-VERSION\n" @@ -341,7 +385,7 @@ msgstr "" "$ make install_sw\n" "$ popd" -#: ../../using/unix.rst:165 +#: ../../using/unix.rst:190 msgid "" "Build Python with custom OpenSSL (see the configure ``--with-openssl`` and " "``--with-openssl-rpath`` options)" @@ -349,7 +393,7 @@ msgstr "" "使用客製化 OpenSSL 建置 Python(參見配置 ``--with-openssl`` 和 ``--with-" "openssl-rpath`` 選項)" -#: ../../using/unix.rst:168 +#: ../../using/unix.rst:193 msgid "" "$ pushd python-3.x.x\n" "$ ./configure -C \\\n" @@ -367,7 +411,7 @@ msgstr "" "$ make -j8\n" "$ make altinstall" -#: ../../using/unix.rst:180 +#: ../../using/unix.rst:205 msgid "" "Patch releases of OpenSSL have a backwards compatible ABI. You don't need to " "recompile Python to update OpenSSL. It's sufficient to replace the custom " diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index a8df302c59..b5f4fa59a4 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -156,8 +156,8 @@ msgid "" "up to write Python Enhancement Proposals (PEPs), modelled on the internet " "RFC process. PEPs are draft documents that describe a proposed new feature, " "and are continually revised until the community reaches a consensus, either " -"accepting or rejecting the proposal. Quoting from the introduction to :pep:" -"`1`, \"PEP Purpose and Guidelines\":" +"accepting or rejecting the proposal. Quoting from the introduction " +"to :pep:`1`, \"PEP Purpose and Guidelines\":" msgstr "" #: ../../whatsnew/2.0.rst:120 @@ -211,10 +211,10 @@ msgstr "" #: ../../whatsnew/2.0.rst:155 msgid "" "In Python source code, Unicode strings are written as ``u\"string\"``. " -"Arbitrary Unicode characters can be written using a new escape sequence, :" -"samp:`\\\\u{HHHH}`, where *HHHH* is a 4-digit hexadecimal number from 0000 " -"to FFFF. The existing :samp:`\\\\x{HH}` escape sequence can also be used, " -"and octal escapes can be used for characters up to U+01FF, which is " +"Arbitrary Unicode characters can be written using a new escape " +"sequence, :samp:`\\\\u{HHHH}`, where *HHHH* is a 4-digit hexadecimal number " +"from 0000 to FFFF. The existing :samp:`\\\\x{HH}` escape sequence can also " +"be used, and octal escapes can be used for characters up to U+01FF, which is " "represented by ``\\777``." msgstr "" @@ -321,9 +321,9 @@ msgstr "" #: ../../whatsnew/2.0.rst:224 msgid "" "*stream_writer*, similarly, is a class that supports encoding output to a " -"stream. *stream_writer(file_obj)* returns an object that supports the :meth:" -"`!write` and :meth:`!writelines` methods. These methods expect Unicode " -"strings, translating them to the given encoding on output." +"stream. *stream_writer(file_obj)* returns an object that supports " +"the :meth:`!write` and :meth:`!writelines` methods. These methods expect " +"Unicode strings, translating them to the given encoding on output." msgstr "" #: ../../whatsnew/2.0.rst:229 @@ -454,9 +454,9 @@ msgid "" "iterated over. The sequences do not have to be the same length, because " "they are *not* iterated over in parallel, but from left to right; this is " "explained more clearly in the following paragraphs. The elements of the " -"generated list will be the successive values of *expression*. The final :" -"keyword:`!if` clause is optional; if present, *expression* is only evaluated " -"and added to the result if *condition* is true." +"generated list will be the successive values of *expression*. The " +"final :keyword:`!if` clause is optional; if present, *expression* is only " +"evaluated and added to the result if *condition* is true." msgstr "" #: ../../whatsnew/2.0.rst:307 @@ -589,8 +589,8 @@ msgid "" "which was usually a front-end for the :mod:`!strop` module written in C. " "The addition of Unicode posed a difficulty for the :mod:`!strop` module, " "because the functions would all need to be rewritten in order to accept " -"either 8-bit or Unicode strings. For functions such as :func:`!string." -"replace`, which takes 3 string arguments, that means eight possible " +"either 8-bit or Unicode strings. For functions such as :func:`!" +"string.replace`, which takes 3 string arguments, that means eight possible " "permutations, and correspondingly complicated code." msgstr "" @@ -635,11 +635,11 @@ msgstr "" #: ../../whatsnew/2.0.rst:423 msgid "" -"One other method which deserves special mention is :meth:`!join`. The :meth:" -"`!join` method of a string receives one parameter, a sequence of strings, " -"and is equivalent to the :func:`!string.join` function from the old :mod:" -"`string` module, with the arguments reversed. In other words, ``s." -"join(seq)`` is equivalent to the old ``string.join(seq, s)``." +"One other method which deserves special mention is :meth:`!join`. " +"The :meth:`!join` method of a string receives one parameter, a sequence of " +"strings, and is equivalent to the :func:`!string.join` function from the " +"old :mod:`string` module, with the arguments reversed. In other words, " +"``s.join(seq)`` is equivalent to the old ``string.join(seq, s)``." msgstr "" #: ../../whatsnew/2.0.rst:433 @@ -843,11 +843,11 @@ msgstr "" #: ../../whatsnew/2.0.rst:571 msgid "" "Work has been done on porting Python to 64-bit Windows on the Itanium " -"processor, mostly by Trent Mick of ActiveState. (Confusingly, ``sys." -"platform`` is still ``'win32'`` on Win64 because it seems that for ease of " -"porting, MS Visual C++ treats code as 32 bit on Itanium.) PythonWin also " -"supports Windows CE; see the Python CE page at https://pythonce.sourceforge." -"net/ for more information." +"processor, mostly by Trent Mick of ActiveState. (Confusingly, " +"``sys.platform`` is still ``'win32'`` on Win64 because it seems that for " +"ease of porting, MS Visual C++ treats code as 32 bit on Itanium.) PythonWin " +"also supports Windows CE; see the Python CE page at https://" +"pythonce.sourceforge.net/ for more information." msgstr "" #: ../../whatsnew/2.0.rst:577 @@ -864,10 +864,10 @@ msgid "" "confusing :exc:`NameError` exception when code refers to a local variable " "before the variable has been assigned a value. For example, the following " "code raises an exception on the ``print`` statement in both 1.5.2 and 2.0; " -"in 1.5.2 a :exc:`NameError` exception is raised, while 2.0 raises a new :exc:" -"`UnboundLocalError` exception. :exc:`UnboundLocalError` is a subclass of :" -"exc:`NameError`, so any existing code that expects :exc:`NameError` to be " -"raised should still work. ::" +"in 1.5.2 a :exc:`NameError` exception is raised, while 2.0 raises a " +"new :exc:`UnboundLocalError` exception. :exc:`UnboundLocalError` is a " +"subclass of :exc:`NameError`, so any existing code that " +"expects :exc:`NameError` to be raised should still work. ::" msgstr "" #: ../../whatsnew/2.0.rst:590 @@ -877,6 +877,10 @@ msgid "" " i = i + 1\n" "f()" msgstr "" +"def f():\n" +" print \"i=\",i\n" +" i = i + 1\n" +"f()" #: ../../whatsnew/2.0.rst:595 msgid "" @@ -903,27 +907,27 @@ msgstr "" msgid "" "The :func:`int` and :func:`!long` functions now accept an optional \"base\" " "parameter when the first argument is a string. ``int('123', 10)`` returns " -"123, while ``int('123', 16)`` returns 291. ``int(123, 16)`` raises a :exc:" -"`TypeError` exception with the message \"can't convert non-string with " -"explicit base\"." +"123, while ``int('123', 16)`` returns 291. ``int(123, 16)`` raises " +"a :exc:`TypeError` exception with the message \"can't convert non-string " +"with explicit base\"." msgstr "" #: ../../whatsnew/2.0.rst:616 msgid "" "A new variable holding more detailed version information has been added to " "the :mod:`sys` module. ``sys.version_info`` is a tuple ``(major, minor, " -"micro, level, serial)`` For example, in a hypothetical 2.0.1beta1, ``sys." -"version_info`` would be ``(2, 0, 1, 'beta', 1)``. *level* is a string such " -"as ``\"alpha\"``, ``\"beta\"``, or ``\"final\"`` for a final release." +"micro, level, serial)`` For example, in a hypothetical 2.0.1beta1, " +"``sys.version_info`` would be ``(2, 0, 1, 'beta', 1)``. *level* is a string " +"such as ``\"alpha\"``, ``\"beta\"``, or ``\"final\"`` for a final release." msgstr "" #: ../../whatsnew/2.0.rst:622 msgid "" "Dictionaries have an odd new method, ``setdefault(key, default)``, which " "behaves similarly to the existing :meth:`!get` method. However, if the key " -"is missing, :meth:`!setdefault` both returns the value of *default* as :meth:" -"`!get` would do, and also inserts it into the dictionary as the value for " -"*key*. Thus, the following lines of code::" +"is missing, :meth:`!setdefault` both returns the value of *default* " +"as :meth:`!get` would do, and also inserts it into the dictionary as the " +"value for *key*. Thus, the following lines of code::" msgstr "" #: ../../whatsnew/2.0.rst:628 @@ -933,6 +937,10 @@ msgid "" " dict[key] = []\n" " return dict[key]" msgstr "" +"if dict.has_key( key ): return dict[key]\n" +"else:\n" +" dict[key] = []\n" +" return dict[key]" #: ../../whatsnew/2.0.rst:633 msgid "" @@ -944,10 +952,10 @@ msgid "" "The interpreter sets a maximum recursion depth in order to catch runaway " "recursion before filling the C stack and causing a core dump or GPF.. " "Previously this limit was fixed when you compiled Python, but in 2.0 the " -"maximum recursion depth can be read and modified using :func:`sys." -"getrecursionlimit` and :func:`sys.setrecursionlimit`. The default value is " -"1000, and a rough maximum value for a given platform can be found by running " -"a new script, :file:`Misc/find_recursionlimit.py`." +"maximum recursion depth can be read and modified " +"using :func:`sys.getrecursionlimit` and :func:`sys.setrecursionlimit`. The " +"default value is 1000, and a rough maximum value for a given platform can be " +"found by running a new script, :file:`Misc/find_recursionlimit.py`." msgstr "" #: ../../whatsnew/2.0.rst:647 @@ -993,9 +1001,9 @@ msgstr "" msgid "" "Some of the functions in the :mod:`socket` module are still forgiving in " "this way. For example, ``socket.connect( ('hostname', 25) )`` is the " -"correct form, passing a tuple representing an IP address, but ``socket." -"connect('hostname', 25)`` also works. :meth:`socket.connect_ex <socket." -"socket.connect_ex>` and :meth:`socket.bind <socket.socket.bind>` are " +"correct form, passing a tuple representing an IP address, but " +"``socket.connect('hostname', 25)`` also works. :meth:`socket.connect_ex " +"<socket.socket.connect_ex>` and :meth:`socket.bind <socket.socket.bind>` are " "similarly easy-going. 2.0alpha1 tightened these functions up, but because " "the documentation actually used the erroneous multiple argument form, many " "people wrote code which would break with the stricter checking. GvR backed " @@ -1054,11 +1062,11 @@ msgstr "" msgid "" "Taking the :func:`repr` of a float now uses a different formatting precision " "than :func:`str`. :func:`repr` uses ``%.17g`` format string for C's :func:`!" -"sprintf`, while :func:`str` uses ``%.12g`` as before. The effect is that :" -"func:`repr` may occasionally show more decimal places than :func:`str`, for " -"certain numbers. For example, the number 8.1 can't be represented exactly " -"in binary, so ``repr(8.1)`` is ``'8.0999999999999996'``, while str(8.1) is " -"``'8.1'``." +"sprintf`, while :func:`str` uses ``%.12g`` as before. The effect is " +"that :func:`repr` may occasionally show more decimal places " +"than :func:`str`, for certain numbers. For example, the number 8.1 can't " +"be represented exactly in binary, so ``repr(8.1)`` is " +"``'8.0999999999999996'``, while str(8.1) is ``'8.1'``." msgstr "" #: ../../whatsnew/2.0.rst:724 @@ -1094,10 +1102,10 @@ msgstr "" #: ../../whatsnew/2.0.rst:753 msgid "" "Users of Jim Fulton's ExtensionClass module will be pleased to find out that " -"hooks have been added so that ExtensionClasses are now supported by :func:" -"`isinstance` and :func:`issubclass`. This means you no longer have to " -"remember to write code such as ``if type(obj) == myExtensionClass``, but can " -"use the more natural ``if isinstance(obj, myExtensionClass)``." +"hooks have been added so that ExtensionClasses are now supported " +"by :func:`isinstance` and :func:`issubclass`. This means you no longer have " +"to remember to write code such as ``if type(obj) == myExtensionClass``, but " +"can use the more natural ``if isinstance(obj, myExtensionClass)``." msgstr "" #: ../../whatsnew/2.0.rst:759 @@ -1115,8 +1123,8 @@ msgstr "" msgid "" "Vladimir Marangozov's long-awaited malloc restructuring was completed, to " "make it easy to have the Python interpreter use a custom allocator instead " -"of C's standard :c:func:`malloc`. For documentation, read the comments in :" -"file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy " +"of C's standard :c:func:`malloc`. For documentation, read the comments " +"in :file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy " "discussions during which the interface was hammered out, see the web " "archives of the 'patches' and 'python-dev' lists at python.org." msgstr "" @@ -1158,19 +1166,19 @@ msgstr "" #: ../../whatsnew/2.0.rst:796 msgid "" "Three new convenience functions intended for adding constants to a module's " -"dictionary at module initialization time were added: :c:func:" -"`PyModule_AddObject`, :c:func:`PyModule_AddIntConstant`, and :c:func:" -"`PyModule_AddStringConstant`. Each of these functions takes a module " -"object, a null-terminated C string containing the name to be added, and a " -"third argument for the value to be assigned to the name. This third " +"dictionary at module initialization time were " +"added: :c:func:`PyModule_AddObject`, :c:func:`PyModule_AddIntConstant`, " +"and :c:func:`PyModule_AddStringConstant`. Each of these functions takes a " +"module object, a null-terminated C string containing the name to be added, " +"and a third argument for the value to be assigned to the name. This third " "argument is, respectively, a Python object, a C long, or a C string." msgstr "" #: ../../whatsnew/2.0.rst:804 msgid "" -"A wrapper API was added for Unix-style signal handlers. :c:func:" -"`PyOS_getsig` gets a signal handler and :c:func:`PyOS_setsig` will set a new " -"handler." +"A wrapper API was added for Unix-style signal " +"handlers. :c:func:`PyOS_getsig` gets a signal handler " +"and :c:func:`PyOS_setsig` will set a new handler." msgstr "" #: ../../whatsnew/2.0.rst:811 @@ -1208,8 +1216,8 @@ msgstr "" #: ../../whatsnew/2.0.rst:833 msgid "" "In order to use the Distutils, you need to write a :file:`setup.py` script. " -"For the simple case, when the software contains only .py files, a minimal :" -"file:`setup.py` can be just a few lines long::" +"For the simple case, when the software contains only .py files, a " +"minimal :file:`setup.py` can be just a few lines long::" msgstr "" #: ../../whatsnew/2.0.rst:837 @@ -1218,6 +1226,9 @@ msgid "" "setup (name = \"foo\", version = \"1.0\",\n" " py_modules = [\"module1\", \"module2\"])" msgstr "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" py_modules = [\"module1\", \"module2\"])" #: ../../whatsnew/2.0.rst:841 msgid "" @@ -1231,6 +1242,9 @@ msgid "" "setup (name = \"foo\", version = \"1.0\",\n" " packages = [\"package\", \"package.subpackage\"])" msgstr "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" packages = [\"package\", \"package.subpackage\"])" #: ../../whatsnew/2.0.rst:848 msgid "" @@ -1253,6 +1267,18 @@ msgid "" "setup (name = \"PyXML\", version = \"0.5.4\",\n" " ext_modules =[ expat_extension ] )" msgstr "" +"from distutils.core import setup, Extension\n" +"\n" +"expat_extension = Extension('xml.parsers.pyexpat',\n" +" define_macros = [('XML_NS', None)],\n" +" include_dirs = [ 'extensions/expat/xmltok',\n" +" 'extensions/expat/xmlparse' ],\n" +" sources = [ 'extensions/pyexpat.c',\n" +" 'extensions/expat/xmltok/xmltok.c',\n" +" 'extensions/expat/xmltok/xmlrole.c', ]\n" +" )\n" +"setup (name = \"PyXML\", version = \"0.5.4\",\n" +" ext_modules =[ expat_extension ] )" #: ../../whatsnew/2.0.rst:864 msgid "" @@ -1300,11 +1326,12 @@ msgid "" "SAX defines an event-driven interface for parsing XML. To use SAX, you must " "write a SAX handler class. Handler classes inherit from various classes " "provided by SAX, and override various methods that will then be called by " -"the XML parser. For example, the :meth:`~xml.sax.handler.ContentHandler." -"startElement` and :meth:`~xml.sax.handler.ContentHandler.endElement` methods " -"are called for every starting and end tag encountered by the parser, the :" -"meth:`~xml.sax.handler.ContentHandler.characters` method is called for every " -"chunk of character data, and so forth." +"the XML parser. For example, " +"the :meth:`~xml.sax.handler.ContentHandler.startElement` " +"and :meth:`~xml.sax.handler.ContentHandler.endElement` methods are called " +"for every starting and end tag encountered by the parser, " +"the :meth:`~xml.sax.handler.ContentHandler.characters` method is called for " +"every chunk of character data, and so forth." msgstr "" #: ../../whatsnew/2.0.rst:906 @@ -1319,8 +1346,8 @@ msgstr "" #: ../../whatsnew/2.0.rst:912 msgid "" "For example, this little example program defines a handler that prints a " -"message for every starting and ending tag, and then parses the file :file:" -"`hamlet.xml` using it::" +"message for every starting and ending tag, and then parses the " +"file :file:`hamlet.xml` using it::" msgstr "" #: ../../whatsnew/2.0.rst:916 @@ -1379,10 +1406,11 @@ msgstr "" #: ../../whatsnew/2.0.rst:956 msgid "" -"The DOM implementation included with Python lives in the :mod:`xml.dom." -"minidom` module. It's a lightweight implementation of the Level 1 DOM with " -"support for XML namespaces. The :func:`!parse` and :func:`!parseString` " -"convenience functions are provided for generating a DOM tree::" +"The DOM implementation included with Python lives in " +"the :mod:`xml.dom.minidom` module. It's a lightweight implementation of the " +"Level 1 DOM with support for XML namespaces. The :func:`!parse` " +"and :func:`!parseString` convenience functions are provided for generating a " +"DOM tree::" msgstr "" #: ../../whatsnew/2.0.rst:961 @@ -1390,6 +1418,8 @@ msgid "" "from xml.dom import minidom\n" "doc = minidom.parse('hamlet.xml')" msgstr "" +"from xml.dom import minidom\n" +"doc = minidom.parse('hamlet.xml')" #: ../../whatsnew/2.0.rst:964 msgid "" @@ -1409,6 +1439,9 @@ msgid "" "print perslist[0].toxml()\n" "print perslist[1].toxml()" msgstr "" +"perslist = doc.getElementsByTagName( 'PERSONA' )\n" +"print perslist[0].toxml()\n" +"print perslist[1].toxml()" #: ../../whatsnew/2.0.rst:977 msgid "For the *Hamlet* XML file, the above few lines output::" @@ -1419,6 +1452,8 @@ msgid "" "<PERSONA>CLAUDIUS, king of Denmark. </PERSONA>\n" "<PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA>" msgstr "" +"<PERSONA>CLAUDIUS, king of Denmark. </PERSONA>\n" +"<PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA>" #: ../../whatsnew/2.0.rst:982 msgid "" @@ -1493,23 +1528,24 @@ msgstr "模組變更" #: ../../whatsnew/2.0.rst:1031 msgid "" "Lots of improvements and bugfixes were made to Python's extensive standard " -"library; some of the affected modules include :mod:`readline`, :mod:" -"`ConfigParser <configparser>`, :mod:`!cgi`, :mod:`calendar`, :mod:`posix`, :" -"mod:`readline`, :mod:`!xmllib`, :mod:`!aifc`, :mod:`!chunk`, :mod:`wave`, :" -"mod:`random`, :mod:`shelve`, and :mod:`!nntplib`. Consult the CVS logs for " -"the exact patch-by-patch details." +"library; some of the affected modules " +"include :mod:`readline`, :mod:`ConfigParser <configparser>`, :mod:`!" +"cgi`, :mod:`calendar`, :mod:`posix`, :mod:`readline`, :mod:`!xmllib`, :mod:`!" +"aifc`, :mod:`!chunk`, :mod:`wave`, :mod:`random`, :mod:`shelve`, and :mod:`!" +"nntplib`. Consult the CVS logs for the exact patch-by-patch details." msgstr "" #: ../../whatsnew/2.0.rst:1037 msgid "" "Brian Gallew contributed OpenSSL support for the :mod:`socket` module. " "OpenSSL is an implementation of the Secure Socket Layer, which encrypts the " -"data being sent over a socket. When compiling Python, you can edit :file:" -"`Modules/Setup` to include SSL support, which adds an additional function to " -"the :mod:`socket` module: ``socket.ssl(socket, keyfile, certfile)``, which " -"takes a socket object and returns an SSL socket. The :mod:`httplib <http>` " -"and :mod:`urllib` modules were also changed to support ``https://`` URLs, " -"though no one has implemented FTP or SMTP over SSL." +"data being sent over a socket. When compiling Python, you can " +"edit :file:`Modules/Setup` to include SSL support, which adds an additional " +"function to the :mod:`socket` module: ``socket.ssl(socket, keyfile, " +"certfile)``, which takes a socket object and returns an SSL socket. " +"The :mod:`httplib <http>` and :mod:`urllib` modules were also changed to " +"support ``https://`` URLs, though no one has implemented FTP or SMTP over " +"SSL." msgstr "" #: ../../whatsnew/2.0.rst:1046 @@ -1547,10 +1583,10 @@ msgstr "" #: ../../whatsnew/2.0.rst:1065 msgid "" "As mentioned in the earlier discussion of 2.0's Unicode support, the " -"underlying implementation of the regular expressions provided by the :mod:" -"`re` module has been changed. SRE, a new regular expression engine written " -"by Fredrik Lundh and partially funded by Hewlett Packard, supports matching " -"against both 8-bit strings and Unicode strings." +"underlying implementation of the regular expressions provided by " +"the :mod:`re` module has been changed. SRE, a new regular expression engine " +"written by Fredrik Lundh and partially funded by Hewlett Packard, supports " +"matching against both 8-bit strings and Unicode strings." msgstr "" #: ../../whatsnew/2.0.rst:1075 @@ -1608,8 +1644,8 @@ msgid "" "A file's contents can be mapped directly into memory, at which point it " "behaves like a mutable string, so its contents can be read and modified. " "They can even be passed to functions that expect ordinary strings, such as " -"the :mod:`re` module. (Contributed by Sam Rushing, with some extensions by A." -"M. Kuchling.)" +"the :mod:`re` module. (Contributed by Sam Rushing, with some extensions by " +"A.M. Kuchling.)" msgstr "" #: ../../whatsnew/2.0.rst:1109 @@ -1646,9 +1682,9 @@ msgid "" "are tried in a specific order. The user can alter which browser is launched " "by setting the *BROWSER* environment variable. (Originally inspired by Eric " "S. Raymond's patch to :mod:`urllib` which added similar functionality, but " -"the final module comes from code originally implemented by Fred Drake as :" -"file:`Tools/idle/BrowserControl.py`, and adapted for the standard library by " -"Fred.)" +"the final module comes from code originally implemented by Fred Drake " +"as :file:`Tools/idle/BrowserControl.py`, and adapted for the standard " +"library by Fred.)" msgstr "" #: ../../whatsnew/2.0.rst:1133 @@ -1731,8 +1767,8 @@ msgstr "" #: ../../whatsnew/2.0.rst:1178 msgid "" -"Three new keystroke commands: Check module (:kbd:`Alt-F5`), Import module (:" -"kbd:`F5`) and Run script (:kbd:`Ctrl-F5`)." +"Three new keystroke commands: Check module (:kbd:`Alt-F5`), Import module " +"(:kbd:`F5`) and Run script (:kbd:`Ctrl-F5`)." msgstr "" #: ../../whatsnew/2.0.rst:1185 @@ -1749,13 +1785,13 @@ msgstr "" #: ../../whatsnew/2.0.rst:1191 msgid "" -"A number of modules have been moved to the :file:`lib-old` subdirectory: :" -"mod:`!cmp`, :mod:`!cmpcache`, :mod:`!dircmp`, :mod:`!dump`, :mod:`!find`, :" -"mod:`!grep`, :mod:`!packmail`, :mod:`!poly`, :mod:`!util`, :mod:`!" -"whatsound`, :mod:`!zmod`. If you have code which relies on a module that's " -"been moved to :file:`lib-old`, you can simply add that directory to ``sys." -"path`` to get them back, but you're encouraged to update any code that " -"uses these modules." +"A number of modules have been moved to the :file:`lib-old` " +"subdirectory: :mod:`!cmp`, :mod:`!cmpcache`, :mod:`!dircmp`, :mod:`!" +"dump`, :mod:`!find`, :mod:`!grep`, :mod:`!packmail`, :mod:`!poly`, :mod:`!" +"util`, :mod:`!whatsound`, :mod:`!zmod`. If you have code which relies on a " +"module that's been moved to :file:`lib-old`, you can simply add that " +"directory to ``sys.path`` to get them back, but you're encouraged to " +"update any code that uses these modules." msgstr "" #: ../../whatsnew/2.0.rst:1200 diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index 72d4b9a90d..abd0fcd069 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -121,10 +121,11 @@ msgid "" "added to the language to fix this problem. As a first effect, the " "``name=name`` default argument is now unnecessary in the above example. Put " "simply, when a given variable name is not assigned a value within a function " -"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:" -"`import` statements), references to the variable will be looked up in the " -"local namespace of the enclosing scope. A more detailed explanation of the " -"rules, and a dissection of the implementation, can be found in the PEP." +"(by an assignment, or the :keyword:`def`, :keyword:`class`, " +"or :keyword:`import` statements), references to the variable will be looked " +"up in the local namespace of the enclosing scope. A more detailed " +"explanation of the rules, and a dissection of the implementation, can be " +"found in the PEP." msgstr "" #: ../../whatsnew/2.1.rst:77 @@ -227,10 +228,11 @@ msgstr "" msgid "" "While it looks like a normal :keyword:`import` statement, it's not; there " "are strict rules on where such a future statement can be put. They can only " -"be at the top of a module, and must precede any Python code or regular :" -"keyword:`!import` statements. This is because such statements can affect " -"how the Python bytecode compiler parses code and generates bytecode, so they " -"must precede any statement that will result in bytecodes being produced." +"be at the top of a module, and must precede any Python code or " +"regular :keyword:`!import` statements. This is because such statements can " +"affect how the Python bytecode compiler parses code and generates bytecode, " +"so they must precede any statement that will result in bytecodes being " +"produced." msgstr "" #: ../../whatsnew/2.1.rst:153 @@ -327,9 +329,9 @@ msgstr ":meth:`~object.__ne__`" #: ../../whatsnew/2.1.rst:194 msgid "" -"(The magic methods are named after the corresponding Fortran operators ``.LT." -"``. ``.LE.``, &c. Numeric programmers are almost certainly quite familiar " -"with these names and will find them easy to remember.)" +"(The magic methods are named after the corresponding Fortran operators " +"``.LT.``. ``.LE.``, &c. Numeric programmers are almost certainly quite " +"familiar with these names and will find them easy to remember.)" msgstr "" #: ../../whatsnew/2.1.rst:198 @@ -363,8 +365,8 @@ msgstr "" msgid "" "There are also corresponding changes of interest to C programmers; there's a " "new slot ``tp_richcmp`` in type objects and an API for performing a given " -"rich comparison. I won't cover the C API here, but will refer you to :pep:" -"`207`, or to 2.1's C API documentation, for the full list of related " +"rich comparison. I won't cover the C API here, but will refer you " +"to :pep:`207`, or to 2.1's C API documentation, for the full list of related " "functions." msgstr "" @@ -397,8 +399,8 @@ msgstr "" #: ../../whatsnew/2.1.rst:242 msgid "" -"Python 2.1 adds the warning framework to be used in this scheme. It adds a :" -"mod:`warnings` module that provide functions to issue warnings, and to " +"Python 2.1 adds the warning framework to be used in this scheme. It adds " +"a :mod:`warnings` module that provide functions to issue warnings, and to " "filter out warnings that you don't want to be displayed. Third-party modules " "can also use this framework to deprecate old features that they no longer " "wish to support." @@ -440,9 +442,9 @@ msgstr "" msgid "" "Filters can be added to disable certain warnings; a regular expression " "pattern can be applied to the message or to the module name in order to " -"suppress a warning. For example, you may have a program that uses the :mod:" -"`!regex` module and not want to spare the time to convert it to use the :mod:" -"`re` module right now. The warning can be suppressed by calling ::" +"suppress a warning. For example, you may have a program that uses " +"the :mod:`!regex` module and not want to spare the time to convert it to use " +"the :mod:`re` module right now. The warning can be suppressed by calling ::" msgstr "" #: ../../whatsnew/2.1.rst:269 @@ -461,13 +463,13 @@ msgstr "" #: ../../whatsnew/2.1.rst:275 msgid "" -"This adds a filter that will apply only to warnings of the class :class:" -"`DeprecationWarning` triggered in the :mod:`__main__` module, and applies a " -"regular expression to only match the message about the :mod:`!regex` module " -"being deprecated, and will cause such warnings to be ignored. Warnings can " -"also be printed only once, printed every time the offending code is " -"executed, or turned into exceptions that will cause the program to stop " -"(unless the exceptions are caught in the usual way, of course)." +"This adds a filter that will apply only to warnings of the " +"class :class:`DeprecationWarning` triggered in the :mod:`__main__` module, " +"and applies a regular expression to only match the message about the :mod:`!" +"regex` module being deprecated, and will cause such warnings to be ignored. " +"Warnings can also be printed only once, printed every time the offending " +"code is executed, or turned into exceptions that will cause the program to " +"stop (unless the exceptions are caught in the usual way, of course)." msgstr "" #: ../../whatsnew/2.1.rst:283 @@ -535,8 +537,8 @@ msgstr "" msgid "" "In another far-reaching change to the build mechanism, Neil Schemenauer " "restructured things so Python now uses a single makefile that isn't " -"recursive, instead of makefiles in the top directory and in each of the :" -"file:`Python/`, :file:`Parser/`, :file:`Objects/`, and :file:`Modules/` " +"recursive, instead of makefiles in the top directory and in each of " +"the :file:`Python/`, :file:`Parser/`, :file:`Objects/`, and :file:`Modules/` " "subdirectories. This makes building Python faster and also makes hacking " "the Makefiles clearer and simpler." msgstr "" @@ -704,12 +706,13 @@ msgstr "" #: ../../whatsnew/2.1.rst:445 msgid "" -"The dictionary containing attributes can be accessed as the function's :attr:" -"`~function.__dict__`. Unlike the :attr:`~type.__dict__` attribute of class " -"instances, in functions you can actually assign a new dictionary to :attr:" -"`~function.__dict__`, though the new value is restricted to a regular Python " -"dictionary; you *can't* be tricky and set it to a :class:`!UserDict` " -"instance, or any other random object that behaves like a mapping." +"The dictionary containing attributes can be accessed as the " +"function's :attr:`~function.__dict__`. Unlike the :attr:`~type.__dict__` " +"attribute of class instances, in functions you can actually assign a new " +"dictionary to :attr:`~function.__dict__`, though the new value is restricted " +"to a regular Python dictionary; you *can't* be tricky and set it to " +"a :class:`!UserDict` instance, or any other random object that behaves like " +"a mapping." msgstr "" #: ../../whatsnew/2.1.rst:455 @@ -737,9 +740,10 @@ msgid "" "In Python 2.1, the :keyword:`import` statement will work to simulate case-" "sensitivity on case-insensitive platforms. Python will now search for the " "first case-sensitive match by default, raising an :exc:`ImportError` if no " -"such file is found, so ``import file`` will not import a module named ``FILE." -"PY``. Case-insensitive matching can be requested by setting the :envvar:" -"`PYTHONCASEOK` environment variable before starting the Python interpreter." +"such file is found, so ``import file`` will not import a module named " +"``FILE.PY``. Case-insensitive matching can be requested by setting " +"the :envvar:`PYTHONCASEOK` environment variable before starting the Python " +"interpreter." msgstr "" #: ../../whatsnew/2.1.rst:480 @@ -836,17 +840,18 @@ msgstr "" #: ../../whatsnew/2.1.rst:552 msgid "" "As a first small step toward fixing the problem, Python software packaged " -"using the Distutils :command:`sdist` command will include a file named :file:" -"`PKG-INFO` containing information about the package such as its name, " -"version, and author (metadata, in cataloguing terminology). :pep:`241` " -"contains the full list of fields that can be present in the :file:`PKG-INFO` " -"file. As people began to package their software using Python 2.1, more and " -"more packages will include metadata, making it possible to build automated " -"cataloguing systems and experiment with them. With the result experience, " -"perhaps it'll be possible to design a really good catalog and then build " -"support for it into Python 2.2. For example, the Distutils :command:`sdist` " -"and :command:`bdist_\\*` commands could support an ``upload`` option that " -"would automatically upload your package to a catalog server." +"using the Distutils :command:`sdist` command will include a file " +"named :file:`PKG-INFO` containing information about the package such as its " +"name, version, and author (metadata, in cataloguing " +"terminology). :pep:`241` contains the full list of fields that can be " +"present in the :file:`PKG-INFO` file. As people began to package their " +"software using Python 2.1, more and more packages will include metadata, " +"making it possible to build automated cataloguing systems and experiment " +"with them. With the result experience, perhaps it'll be possible to design " +"a really good catalog and then build support for it into Python 2.2. For " +"example, the Distutils :command:`sdist` and :command:`bdist_\\*` commands " +"could support an ``upload`` option that would automatically upload your " +"package to a catalog server." msgstr "" #: ../../whatsnew/2.1.rst:565 @@ -855,8 +860,8 @@ msgid "" "not using Python 2.1, since a new release of the Distutils will be made for " "users of earlier Python versions. Version 1.0.2 of the Distutils includes " "the changes described in :pep:`241`, as well as various bugfixes and " -"enhancements. It will be available from the Distutils SIG at https://www." -"python.org/community/sigs/current/distutils-sig/." +"enhancements. It will be available from the Distutils SIG at https://" +"www.python.org/community/sigs/current/distutils-sig/." msgstr "" #: ../../whatsnew/2.1.rst:574 @@ -881,10 +886,11 @@ msgstr "" msgid "" "Ka-Ping Yee contributed two new modules: :mod:`!inspect.py`, a module for " "getting information about live Python code, and :mod:`!pydoc.py`, a module " -"for interactively converting docstrings to HTML or text. As a bonus, :file:" -"`Tools/scripts/pydoc`, which is now automatically installed, uses :mod:`!" -"pydoc.py` to display documentation given a Python module, package, or class " -"name. For example, ``pydoc xml.dom`` displays the following::" +"for interactively converting docstrings to HTML or text. As a " +"bonus, :file:`Tools/scripts/pydoc`, which is now automatically installed, " +"uses :mod:`!pydoc.py` to display documentation given a Python module, " +"package, or class name. For example, ``pydoc xml.dom`` displays the " +"following::" msgstr "" #: ../../whatsnew/2.1.rst:594 @@ -907,8 +913,8 @@ msgstr "" #: ../../whatsnew/2.1.rst:609 msgid "" -":file:`pydoc` also includes a Tk-based interactive help browser. :file:" -"`pydoc` quickly becomes addictive; try it out!" +":file:`pydoc` also includes a Tk-based interactive help " +"browser. :file:`pydoc` quickly becomes addictive; try it out!" msgstr "" #: ../../whatsnew/2.1.rst:612 @@ -918,18 +924,18 @@ msgid "" "framework based on running embedded examples in docstrings and comparing the " "results against the expected output. PyUnit, contributed by Steve Purcell, " "is a unit testing framework inspired by JUnit, which was in turn an " -"adaptation of Kent Beck's Smalltalk testing framework. See https://pyunit." -"sourceforge.net/ for more information about PyUnit." +"adaptation of Kent Beck's Smalltalk testing framework. See https://" +"pyunit.sourceforge.net/ for more information about PyUnit." msgstr "" #: ../../whatsnew/2.1.rst:620 msgid "" -"The :mod:`difflib` module contains a class, :class:`~difflib." -"SequenceMatcher`, which compares two sequences and computes the changes " -"required to transform one sequence into the other. For example, this module " -"can be used to write a tool similar to the Unix :program:`diff` program, and " -"in fact the sample program :file:`Tools/scripts/ndiff.py` demonstrates how " -"to write such a script." +"The :mod:`difflib` module contains a " +"class, :class:`~difflib.SequenceMatcher`, which compares two sequences and " +"computes the changes required to transform one sequence into the other. For " +"example, this module can be used to write a tool similar to the " +"Unix :program:`diff` program, and in fact the sample program :file:`Tools/" +"scripts/ndiff.py` demonstrates how to write such a script." msgstr "" #: ../../whatsnew/2.1.rst:626 @@ -952,14 +958,14 @@ msgstr "" #: ../../whatsnew/2.1.rst:638 msgid "" -"Ping also contributed another hook for handling uncaught exceptions. :func:" -"`sys.excepthook` can be set to a callable object. When an exception isn't " -"caught by any :keyword:`try`...\\ :keyword:`except` blocks, the exception " -"will be passed to :func:`sys.excepthook`, which can then do whatever it " -"likes. At the Ninth Python Conference, Ping demonstrated an application for " -"this hook: printing an extended traceback that not only lists the stack " -"frames, but also lists the function arguments and the local variables for " -"each frame." +"Ping also contributed another hook for handling uncaught " +"exceptions. :func:`sys.excepthook` can be set to a callable object. When an " +"exception isn't caught by any :keyword:`try`...\\ :keyword:`except` blocks, " +"the exception will be passed to :func:`sys.excepthook`, which can then do " +"whatever it likes. At the Ninth Python Conference, Ping demonstrated an " +"application for this hook: printing an extended traceback that not only " +"lists the stack frames, but also lists the function arguments and the local " +"variables for each frame." msgstr "" #: ../../whatsnew/2.1.rst:646 @@ -1007,11 +1013,11 @@ msgstr "" #: ../../whatsnew/2.1.rst:673 msgid "" "A new implementation-dependent function, ``sys._getframe([depth])``, has " -"been added to return a given frame object from the current call stack. :func:" -"`sys._getframe` returns the frame at the top of the call stack; if the " -"optional integer argument *depth* is supplied, the function returns the " -"frame that is *depth* calls below the top of the stack. For example, ``sys." -"_getframe(1)`` returns the caller's frame object." +"been added to return a given frame object from the current call " +"stack. :func:`sys._getframe` returns the frame at the top of the call " +"stack; if the optional integer argument *depth* is supplied, the function " +"returns the frame that is *depth* calls below the top of the stack. For " +"example, ``sys._getframe(1)`` returns the caller's frame object." msgstr "" #: ../../whatsnew/2.1.rst:680 @@ -1039,9 +1045,9 @@ msgid "" "faster than the system :c:func:`malloc` and have less memory overhead. The " "allocator uses C's :c:func:`!malloc` function to get large pools of memory, " "and then fulfills smaller memory requests from these pools. It can be " -"enabled by providing the :option:`!--with-pymalloc` option to the :program:" -"`configure` script; see :file:`Objects/obmalloc.c` for the implementation " -"details." +"enabled by providing the :option:`!--with-pymalloc` option to " +"the :program:`configure` script; see :file:`Objects/obmalloc.c` for the " +"implementation details." msgstr "" #: ../../whatsnew/2.1.rst:702 @@ -1049,16 +1055,16 @@ msgid "" "Authors of C extension modules should test their code with the object " "allocator enabled, because some incorrect code may break, causing core dumps " "at runtime. There are a bunch of memory allocation functions in Python's C " -"API that have previously been just aliases for the C library's :c:func:" -"`malloc` and :c:func:`free`, meaning that if you accidentally called " -"mismatched functions, the error wouldn't be noticeable. When the object " -"allocator is enabled, these functions aren't aliases of :c:func:`!malloc` " -"and :c:func:`!free` any more, and calling the wrong function to free memory " -"will get you a core dump. For example, if memory was allocated using :c:" -"macro:`PyMem_New`, it has to be freed using :c:func:`PyMem_Del`, not :c:func:" -"`!free`. A few modules included with Python fell afoul of this and had to " -"be fixed; doubtless there are more third-party modules that will have the " -"same problem." +"API that have previously been just aliases for the C " +"library's :c:func:`malloc` and :c:func:`free`, meaning that if you " +"accidentally called mismatched functions, the error wouldn't be noticeable. " +"When the object allocator is enabled, these functions aren't aliases " +"of :c:func:`!malloc` and :c:func:`!free` any more, and calling the wrong " +"function to free memory will get you a core dump. For example, if memory " +"was allocated using :c:macro:`PyMem_New`, it has to be freed " +"using :c:func:`PyMem_Del`, not :c:func:`!free`. A few modules included with " +"Python fell afoul of this and had to be fixed; doubtless there are more " +"third-party modules that will have the same problem." msgstr "" #: ../../whatsnew/2.1.rst:715 @@ -1080,11 +1086,11 @@ msgstr "" #: ../../whatsnew/2.1.rst:726 msgid "" "A new module and method for file objects was also added, contributed by Jeff " -"Epler. The new method, :meth:`!xreadlines`, is similar to the existing :func:" -"`!xrange` built-in. :func:`!xreadlines` returns an opaque sequence object " -"that only supports being iterated over, reading a line on every iteration " -"but not reading the entire file into memory as the existing :meth:`!" -"readlines` method does. You'd use it like this::" +"Epler. The new method, :meth:`!xreadlines`, is similar to the " +"existing :func:`!xrange` built-in. :func:`!xreadlines` returns an opaque " +"sequence object that only supports being iterated over, reading a line on " +"every iteration but not reading the entire file into memory as the " +"existing :meth:`!readlines` method does. You'd use it like this::" msgstr "" #: ../../whatsnew/2.1.rst:733 @@ -1154,10 +1160,10 @@ msgstr "" #: ../../whatsnew/2.1.rst:773 msgid "" -"C extensions which import other modules have been changed to use :c:func:" -"`PyImport_ImportModule`, which means that they will use any import hooks " -"that have been installed. This is also encouraged for third-party " -"extensions that need to import some other module from C code." +"C extensions which import other modules have been changed to " +"use :c:func:`PyImport_ImportModule`, which means that they will use any " +"import hooks that have been installed. This is also encouraged for third-" +"party extensions that need to import some other module from C code." msgstr "" #: ../../whatsnew/2.1.rst:778 diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index a20f58263f..0dd37108b2 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -190,16 +190,16 @@ msgid "" "This means that :keyword:`class` statements that don't have any base classes " "are always classic classes in Python 2.2. (Actually you can also change " "this by setting a module-level variable named :attr:`!__metaclass__` --- " -"see :pep:`253` for the details --- but it's easier to just subclass :class:" -"`object`.)" +"see :pep:`253` for the details --- but it's easier to just " +"subclass :class:`object`.)" msgstr "" #: ../../whatsnew/2.2.rst:126 msgid "" "The type objects for the built-in types are available as built-ins, named " -"using a clever trick. Python has always had built-in functions named :func:" -"`int`, :func:`float`, and :func:`str`. In 2.2, they aren't functions any " -"more, but type objects that behave as factories when called. ::" +"using a clever trick. Python has always had built-in functions " +"named :func:`int`, :func:`float`, and :func:`str`. In 2.2, they aren't " +"functions any more, but type objects that behave as factories when called. ::" msgstr "" #: ../../whatsnew/2.2.rst:131 @@ -434,12 +434,12 @@ msgstr "" #: ../../whatsnew/2.2.rst:265 msgid "" "The lookup rule for classic classes is simple but not very smart; the base " -"classes are searched depth-first, going from left to right. A reference to :" -"meth:`!D.save` will search the classes :class:`!D`, :class:`!B`, and then :" -"class:`!A`, where :meth:`!save` would be found and returned. :meth:`!C." -"save` would never be found at all. This is bad, because if :class:`!C`'s :" -"meth:`!save` method is saving some internal state specific to :class:`!C`, " -"not calling it will result in that state never getting saved." +"classes are searched depth-first, going from left to right. A reference " +"to :meth:`!D.save` will search the classes :class:`!D`, :class:`!B`, and " +"then :class:`!A`, where :meth:`!save` would be found and returned. :meth:`!" +"C.save` would never be found at all. This is bad, because if :class:`!" +"C`'s :meth:`!save` method is saving some internal state specific to :class:`!" +"C`, not calling it will result in that state never getting saved." msgstr "" #: ../../whatsnew/2.2.rst:273 @@ -469,9 +469,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:288 msgid "" -"Following this rule, referring to :meth:`!D.save` will return :meth:`!C." -"save`, which is the behaviour we're after. This lookup rule is the same as " -"the one followed by Common Lisp. A new built-in function, :func:`super`, " +"Following this rule, referring to :meth:`!D.save` will return :meth:`!" +"C.save`, which is the behaviour we're after. This lookup rule is the same " +"as the one followed by Common Lisp. A new built-in function, :func:`super`, " "provides a way to get at a class's superclasses without having to " "reimplement Python's algorithm. The most commonly used form will be " "``super(class, obj)``, which returns a bound superclass object (not the " @@ -506,8 +506,9 @@ msgid "" "A fair number of sophisticated Python classes define hooks for attribute " "access using :meth:`~object.__getattr__`; most commonly this is done for " "convenience, to make code more readable by automatically mapping an " -"attribute access such as ``obj.parent`` into a method call such as ``obj." -"get_parent``. Python 2.2 adds some new ways of controlling attribute access." +"attribute access such as ``obj.parent`` into a method call such as " +"``obj.get_parent``. Python 2.2 adds some new ways of controlling attribute " +"access." msgstr "" #: ../../whatsnew/2.2.rst:318 @@ -532,12 +533,12 @@ msgid "" "However, Python 2.2's support for :dfn:`properties` will often be a simpler " "way to trap attribute references. Writing a :meth:`!__getattr__` method is " "complicated because to avoid recursion you can't use regular attribute " -"accesses inside them, and instead have to mess around with the contents of :" -"attr:`~object.__dict__`. :meth:`~object.__getattr__` methods also end up " -"being called by Python when it checks for other methods such as :meth:" -"`~object.__repr__` or :meth:`!__coerce__`, and so have to be written with " -"this in mind. Finally, calling a function on every attribute access results " -"in a sizable performance loss." +"accesses inside them, and instead have to mess around with the contents " +"of :attr:`~object.__dict__`. :meth:`~object.__getattr__` methods also end up " +"being called by Python when it checks for other methods such " +"as :meth:`~object.__repr__` or :meth:`!__coerce__`, and so have to be " +"written with this in mind. Finally, calling a function on every attribute " +"access results in a sizable performance loss." msgstr "" #: ../../whatsnew/2.2.rst:338 @@ -581,10 +582,10 @@ msgid "" "Finally, it's possible to constrain the list of attributes that can be " "referenced on an object using the new :attr:`~object.__slots__` class " "attribute. Python objects are usually very dynamic; at any time it's " -"possible to define a new attribute on an instance by just doing ``obj." -"new_attr=1``. A new-style class can define a class attribute named :attr:" -"`~object.__slots__` to limit the legal attributes to a particular set of " -"names. An example will make this clear::" +"possible to define a new attribute on an instance by just doing " +"``obj.new_attr=1``. A new-style class can define a class attribute " +"named :attr:`~object.__slots__` to limit the legal attributes to a " +"particular set of names. An example will make this clear::" msgstr "" #: ../../whatsnew/2.2.rst:372 @@ -635,11 +636,11 @@ msgid "" "Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is " "titled \"Making Types Look More Like Classes\", and covers the descriptor " "API. :pep:`253` is titled \"Subtyping Built-in Types\", and describes the " -"changes to type objects that make it possible to subtype built-in objects. :" -"pep:`253` is the more complicated PEP of the two, and at a few points the " -"necessary explanations of types and meta-types may cause your head to " -"explode. Both PEPs were written and implemented by Guido van Rossum, with " -"substantial assistance from the rest of the Zope Corp. team." +"changes to type objects that make it possible to subtype built-in " +"objects. :pep:`253` is the more complicated PEP of the two, and at a few " +"points the necessary explanations of types and meta-types may cause your " +"head to explode. Both PEPs were written and implemented by Guido van " +"Rossum, with substantial assistance from the rest of the Zope Corp. team." msgstr "" #: ../../whatsnew/2.2.rst:413 @@ -692,13 +693,14 @@ msgstr "" #: ../../whatsnew/2.2.rst:443 msgid "" -"In Python 2.2, iteration can be implemented separately, and :meth:`~object." -"__getitem__` methods can be limited to classes that really do support random " -"access. The basic idea of iterators is simple. A new built-in function, " -"``iter(obj)`` or ``iter(C, sentinel)``, is used to get an iterator. " -"``iter(obj)`` returns an iterator for the object *obj*, while ``iter(C, " -"sentinel)`` returns an iterator that will invoke the callable object *C* " -"until it returns *sentinel* to signal that the iterator is done." +"In Python 2.2, iteration can be implemented separately, " +"and :meth:`~object.__getitem__` methods can be limited to classes that " +"really do support random access. The basic idea of iterators is simple. A " +"new built-in function, ``iter(obj)`` or ``iter(C, sentinel)``, is used to " +"get an iterator. ``iter(obj)`` returns an iterator for the object *obj*, " +"while ``iter(C, sentinel)`` returns an iterator that will invoke the " +"callable object *C* until it returns *sentinel* to signal that the iterator " +"is done." msgstr "" #: ../../whatsnew/2.2.rst:451 @@ -706,10 +708,10 @@ msgid "" "Python classes can define an :meth:`!__iter__` method, which should create " "and return a new iterator for the object; if the object is its own iterator, " "this method can just return ``self``. In particular, iterators will usually " -"be their own iterators. Extension types implemented in C can implement a :c:" -"member:`~PyTypeObject.tp_iter` function in order to return an iterator, and " -"extension types that want to behave as iterators can define a :c:member:" -"`~PyTypeObject.tp_iternext` function." +"be their own iterators. Extension types implemented in C can implement " +"a :c:member:`~PyTypeObject.tp_iter` function in order to return an iterator, " +"and extension types that want to behave as iterators can define " +"a :c:member:`~PyTypeObject.tp_iternext` function." msgstr "" #: ../../whatsnew/2.2.rst:458 @@ -759,8 +761,8 @@ msgid "" "In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it " "expects something for which :func:`iter` will return an iterator. For " "backward compatibility and convenience, an iterator is automatically " -"constructed for sequences that don't implement :meth:`!__iter__` or a :c:" -"member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still " +"constructed for sequences that don't implement :meth:`!__iter__` or " +"a :c:member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still " "work. Wherever the Python interpreter loops over a sequence, it's been " "changed to use the iterator protocol. This means you can do things like " "this::" @@ -782,9 +784,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:493 msgid "" -"Iterator support has been added to some of Python's basic types. Calling :" -"func:`iter` on a dictionary will return an iterator which loops over its " -"keys::" +"Iterator support has been added to some of Python's basic types. " +"Calling :func:`iter` on a dictionary will return an iterator which loops " +"over its keys::" msgstr "" #: ../../whatsnew/2.2.rst:496 @@ -826,10 +828,11 @@ msgstr "" #: ../../whatsnew/2.2.rst:513 msgid "" "That's just the default behaviour. If you want to iterate over keys, " -"values, or key/value pairs, you can explicitly call the :meth:`!iterkeys`, :" -"meth:`!itervalues`, or :meth:`!iteritems` methods to get an appropriate " -"iterator. In a minor related change, the :keyword:`in` operator now works on " -"dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``." +"values, or key/value pairs, you can explicitly call the :meth:`!" +"iterkeys`, :meth:`!itervalues`, or :meth:`!iteritems` methods to get an " +"appropriate iterator. In a minor related change, the :keyword:`in` operator " +"now works on dictionaries, so ``key in dict`` is now equivalent to " +"``dict.has_key(key)``." msgstr "" #: ../../whatsnew/2.2.rst:519 @@ -923,11 +926,12 @@ msgid "" "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " "and local variables are preserved. On the next call to the generator's " -"``next()`` method, the function will resume executing immediately after the :" -"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " -"statement isn't allowed inside the :keyword:`!try` block of a :keyword:" -"`try`...\\ :keyword:`finally` statement; read :pep:`255` for a full " -"explanation of the interaction between :keyword:`!yield` and exceptions.)" +"``next()`` method, the function will resume executing immediately after " +"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" +"yield` statement isn't allowed inside the :keyword:`!try` block of " +"a :keyword:`try`...\\ :keyword:`finally` statement; read :pep:`255` for a " +"full explanation of the interaction between :keyword:`!yield` and " +"exceptions.)" msgstr "" #: ../../whatsnew/2.2.rst:584 @@ -1198,20 +1202,21 @@ msgstr "" #: ../../whatsnew/2.2.rst:756 msgid "" -"Classes can define methods called :meth:`~object.__truediv__` and :meth:" -"`~object.__floordiv__` to overload the two division operators. At the C " -"level, there are also slots in the :c:type:`PyNumberMethods` structure so " -"extension types can define the two operators." +"Classes can define methods called :meth:`~object.__truediv__` " +"and :meth:`~object.__floordiv__` to overload the two division operators. At " +"the C level, there are also slots in the :c:type:`PyNumberMethods` structure " +"so extension types can define the two operators." msgstr "" #: ../../whatsnew/2.2.rst:761 msgid "" "Python 2.2 supports some command-line arguments for testing whether code " -"will work with the changed division semantics. Running python with :option:" -"`!-Q warn` will cause a warning to be issued whenever division is applied to " -"two integers. You can use this to find code that's affected by the change " -"and fix it. By default, Python 2.2 will simply perform classic division " -"without a warning; the warning will be turned on by default in Python 2.3." +"will work with the changed division semantics. Running python " +"with :option:`!-Q warn` will cause a warning to be issued whenever division " +"is applied to two integers. You can use this to find code that's affected " +"by the change and fix it. By default, Python 2.2 will simply perform " +"classic division without a warning; the warning will be turned on by default " +"in Python 2.3." msgstr "" #: ../../whatsnew/2.2.rst:771 @@ -1382,10 +1387,11 @@ msgid "" "added to the language to fix this problem. As a first effect, the " "``name=name`` default argument is now unnecessary in the above example. Put " "simply, when a given variable name is not assigned a value within a function " -"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:" -"`import` statements), references to the variable will be looked up in the " -"local namespace of the enclosing scope. A more detailed explanation of the " -"rules, and a dissection of the implementation, can be found in the PEP." +"(by an assignment, or the :keyword:`def`, :keyword:`class`, " +"or :keyword:`import` statements), references to the variable will be looked " +"up in the local namespace of the enclosing scope. A more detailed " +"explanation of the rules, and a dissection of the implementation, can be " +"found in the PEP." msgstr "" #: ../../whatsnew/2.2.rst:889 @@ -1498,8 +1504,8 @@ msgstr "" #: ../../whatsnew/2.2.rst:963 msgid "" -"The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:" -"`2104`. (Contributed by Gerhard Häring.)" +"The new :mod:`hmac` module implements the HMAC algorithm described " +"by :rfc:`2104`. (Contributed by Gerhard Häring.)" msgstr "" #: ../../whatsnew/2.2.rst:966 @@ -1507,18 +1513,19 @@ msgid "" "Several functions that originally returned lengthy tuples now return pseudo-" "sequences that still behave like tuples but also have mnemonic attributes " "such as :attr:`!memberst_mtime` or :attr:`~time.struct_time.tm_year`. The " -"enhanced functions include :func:`~os.stat`, :func:`~os.fstat`, :func:`~os." -"statvfs`, and :func:`~os.fstatvfs` in the :mod:`os` module, and :func:`~time." -"localtime`, :func:`~time.gmtime`, and :func:`~time.strptime` in the :mod:" -"`time` module." +"enhanced functions " +"include :func:`~os.stat`, :func:`~os.fstat`, :func:`~os.statvfs`, " +"and :func:`~os.fstatvfs` in the :mod:`os` module, " +"and :func:`~time.localtime`, :func:`~time.gmtime`, " +"and :func:`~time.strptime` in the :mod:`time` module." msgstr "" #: ../../whatsnew/2.2.rst:973 msgid "" "For example, to obtain a file's size using the old tuples, you'd end up " "writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but " -"now this can be written more clearly as ``file_size = os.stat(filename)." -"st_size``." +"now this can be written more clearly as ``file_size = " +"os.stat(filename).st_size``." msgstr "" #: ../../whatsnew/2.2.rst:977 @@ -1534,9 +1541,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:982 msgid "" -"The :mod:`socket` module can be compiled to support IPv6; specify the :" -"option:`!--enable-ipv6` option to Python's configure script. (Contributed " -"by Jun-ichiro \"itojun\" Hagino.)" +"The :mod:`socket` module can be compiled to support IPv6; specify " +"the :option:`!--enable-ipv6` option to Python's configure script. " +"(Contributed by Jun-ichiro \"itojun\" Hagino.)" msgstr "" #: ../../whatsnew/2.2.rst:986 @@ -1549,13 +1556,13 @@ msgstr "" #: ../../whatsnew/2.2.rst:991 msgid "" -"In the interpreter's interactive mode, there's a new built-in function :func:" -"`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide " -"interactive help. ``help(object)`` displays any available help text about " -"*object*. :func:`help` with no argument puts you in an online help utility, " -"where you can enter the names of functions, classes, or modules to read " -"their help text. (Contributed by Guido van Rossum, using Ka-Ping Yee's :mod:" -"`pydoc` module.)" +"In the interpreter's interactive mode, there's a new built-in " +"function :func:`help` that uses the :mod:`pydoc` module introduced in Python " +"2.1 to provide interactive help. ``help(object)`` displays any available " +"help text about *object*. :func:`help` with no argument puts you in an " +"online help utility, where you can enter the names of functions, classes, or " +"modules to read their help text. (Contributed by Guido van Rossum, using Ka-" +"Ping Yee's :mod:`pydoc` module.)" msgstr "" #: ../../whatsnew/2.2.rst:999 @@ -1607,14 +1614,14 @@ msgstr "" #: ../../whatsnew/2.2.rst:1029 msgid "" -"New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, and :const:" -"`!ascii_uppercase` were added to the :mod:`string` module. There were " -"several modules in the standard library that used :const:`!string.letters` " -"to mean the ranges A-Za-z, but that assumption is incorrect when locales are " -"in use, because :const:`!string.letters` varies depending on the set of " -"legal characters defined by the current locale. The buggy modules have all " -"been fixed to use :const:`!ascii_letters` instead. (Reported by an unknown " -"person; fixed by Fred L. Drake, Jr.)" +"New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, " +"and :const:`!ascii_uppercase` were added to the :mod:`string` module. There " +"were several modules in the standard library that used :const:`!" +"string.letters` to mean the ranges A-Za-z, but that assumption is incorrect " +"when locales are in use, because :const:`!string.letters` varies depending " +"on the set of legal characters defined by the current locale. The buggy " +"modules have all been fixed to use :const:`!ascii_letters` instead. " +"(Reported by an unknown person; fixed by Fred L. Drake, Jr.)" msgstr "" #: ../../whatsnew/2.2.rst:1038 @@ -1659,12 +1666,12 @@ msgstr "" #: ../../whatsnew/2.2.rst:1066 msgid "" "Another low-level API, primarily of interest to implementers of Python " -"debuggers and development tools, was added. :c:func:" -"`PyInterpreterState_Head` and :c:func:`PyInterpreterState_Next` let a caller " -"walk through all the existing interpreter objects; :c:func:" -"`PyInterpreterState_ThreadHead` and :c:func:`PyThreadState_Next` allow " -"looping over all the thread states for a given interpreter. (Contributed by " -"David Beazley.)" +"debuggers and development tools, was " +"added. :c:func:`PyInterpreterState_Head` " +"and :c:func:`PyInterpreterState_Next` let a caller walk through all the " +"existing interpreter objects; :c:func:`PyInterpreterState_ThreadHead` " +"and :c:func:`PyThreadState_Next` allow looping over all the thread states " +"for a given interpreter. (Contributed by David Beazley.)" msgstr "" #: ../../whatsnew/2.2.rst:1073 @@ -1699,8 +1706,8 @@ msgstr "" #: ../../whatsnew/2.2.rst:1087 msgid "" -"Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and :c:" -"func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." +"Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` " +"and :c:func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." msgstr "" #: ../../whatsnew/2.2.rst:1090 @@ -1738,19 +1745,20 @@ msgid "" "Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in " "method definition tables to simplify implementation of methods with no " "arguments or a single untyped argument. Calling such methods is more " -"efficient than calling a corresponding method that uses :c:macro:" -"`METH_VARARGS`. Also, the old :c:macro:`!METH_OLDARGS` style of writing C " -"methods is now officially deprecated." +"efficient than calling a corresponding method that " +"uses :c:macro:`METH_VARARGS`. Also, the old :c:macro:`!METH_OLDARGS` style " +"of writing C methods is now officially deprecated." msgstr "" #: ../../whatsnew/2.2.rst:1115 msgid "" -"Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:" -"`PyOS_vsnprintf` were added to provide cross-platform implementations for " -"the relatively new :c:func:`snprintf` and :c:func:`vsnprintf` C lib APIs. In " -"contrast to the standard :c:func:`sprintf` and :c:func:`!vsprintf` " -"functions, the Python versions check the bounds of the buffer used to " -"protect against buffer overruns. (Contributed by M.-A. Lemburg.)" +"Two new wrapper functions, :c:func:`PyOS_snprintf` " +"and :c:func:`PyOS_vsnprintf` were added to provide cross-platform " +"implementations for the relatively new :c:func:`snprintf` " +"and :c:func:`vsnprintf` C lib APIs. In contrast to the " +"standard :c:func:`sprintf` and :c:func:`!vsprintf` functions, the Python " +"versions check the bounds of the buffer used to protect against buffer " +"overruns. (Contributed by M.-A. Lemburg.)" msgstr "" #: ../../whatsnew/2.2.rst:1122 @@ -1818,8 +1826,8 @@ msgstr "" msgid "" "Weak references, added in Python 2.1 as an extension module, are now part of " "the core because they're used in the implementation of new-style classes. " -"The :exc:`ReferenceError` exception has therefore moved from the :mod:" -"`weakref` module to become a built-in exception." +"The :exc:`ReferenceError` exception has therefore moved from " +"the :mod:`weakref` module to become a built-in exception." msgstr "" #: ../../whatsnew/2.2.rst:1186 @@ -1831,10 +1839,10 @@ msgstr "" #: ../../whatsnew/2.2.rst:1190 msgid "" -"An additional *flags* argument has been added to the built-in function :func:" -"`compile`, so the behaviour of ``__future__`` statements can now be " -"correctly observed in simulated shells, such as those presented by IDLE and " -"other development environments. This is described in :pep:`264`. " +"An additional *flags* argument has been added to the built-in " +"function :func:`compile`, so the behaviour of ``__future__`` statements can " +"now be correctly observed in simulated shells, such as those presented by " +"IDLE and other development environments. This is described in :pep:`264`. " "(Contributed by Michael Hudson.)" msgstr "" @@ -1875,12 +1883,12 @@ msgid "" "Some features of the object returned by the :func:`!xrange` function are now " "deprecated, and trigger warnings when they're accessed; they'll disappear in " "Python 2.3. :class:`!xrange` objects tried to pretend they were full " -"sequence types by supporting slicing, sequence multiplication, and the :" -"keyword:`in` operator, but these features were rarely used and therefore " -"buggy. The :meth:`!tolist` method and the :attr:`!start`, :attr:`!stop`, " -"and :attr:`!step` attributes are also being deprecated. At the C level, the " -"fourth argument to the :c:func:`!PyRange_New` function, ``repeat``, has also " -"been deprecated." +"sequence types by supporting slicing, sequence multiplication, and " +"the :keyword:`in` operator, but these features were rarely used and " +"therefore buggy. The :meth:`!tolist` method and the :attr:`!start`, :attr:`!" +"stop`, and :attr:`!step` attributes are also being deprecated. At the C " +"level, the fourth argument to the :c:func:`!PyRange_New` function, " +"``repeat``, has also been deprecated." msgstr "" #: ../../whatsnew/2.2.rst:1225 @@ -1921,9 +1929,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:1246 msgid "" "On platforms where Python uses the C :c:func:`dlopen` function to load " -"extension modules, it's now possible to set the flags used by :c:func:" -"`dlopen` using the :func:`sys.getdlopenflags` and :func:`sys.setdlopenflags` " -"functions. (Contributed by Bram Stolk.)" +"extension modules, it's now possible to set the flags used " +"by :c:func:`dlopen` using the :func:`sys.getdlopenflags` " +"and :func:`sys.setdlopenflags` functions. (Contributed by Bram Stolk.)" msgstr "" #: ../../whatsnew/2.2.rst:1251 diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 3173149b94..48d3561118 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -104,8 +104,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:66 msgid "" -"The union and intersection of sets can be computed with the :meth:" -"`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " +"The union and intersection of sets can be computed with " +"the :meth:`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " "alternative notation uses the bitwise operators ``&`` and ``|``. Mutable " "sets also have in-place versions of these methods, :meth:`!union_update` " "and :meth:`~frozenset.intersection_update`. ::" @@ -135,8 +135,8 @@ msgid "" "the set of all elements in the union that aren't in the intersection. " "Another way of putting it is that the symmetric difference contains all " "elements that are in exactly one set. Again, there's an alternative " -"notation (``^``), and an in-place version with the ungainly name :meth:" -"`~frozenset.symmetric_difference_update`. ::" +"notation (``^``), and an in-place version with the ungainly " +"name :meth:`~frozenset.symmetric_difference_update`. ::" msgstr "" #: ../../whatsnew/2.3.rst:92 @@ -181,7 +181,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:126 msgid "PEP 255: Simple Generators" -msgstr "" +msgstr "PEP 255:簡單產生器" #: ../../whatsnew/2.3.rst:128 msgid "" @@ -209,7 +209,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:145 msgid "Here's the simplest example of a generator function::" -msgstr "" +msgstr "以下是產生器函式最簡單的範例:" #: ../../whatsnew/2.3.rst:147 msgid "" @@ -217,6 +217,9 @@ msgid "" " for i in range(N):\n" " yield i" msgstr "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" #: ../../whatsnew/2.3.rst:151 msgid "" @@ -234,12 +237,13 @@ msgid "" "of ``i``, similar to a :keyword:`return` statement. The big difference " "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " -"and local variables are preserved. On the next call to the generator's ``." -"next()`` method, the function will resume executing immediately after the :" -"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " -"statement isn't allowed inside the :keyword:`try` block of a :keyword:`!" -"try`...\\ :keyword:`!finally` statement; read :pep:`255` for a full " -"explanation of the interaction between :keyword:`!yield` and exceptions.)" +"and local variables are preserved. On the next call to the generator's " +"``.next()`` method, the function will resume executing immediately after " +"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" +"yield` statement isn't allowed inside the :keyword:`try` block of " +"a :keyword:`!try`...\\ :keyword:`!finally` statement; read :pep:`255` for a " +"full explanation of the interaction between :keyword:`!yield` and " +"exceptions.)" msgstr "" #: ../../whatsnew/2.3.rst:169 @@ -263,6 +267,20 @@ msgid "" " File \"stdin\", line 2, in generate_ints\n" "StopIteration" msgstr "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"<generator object at 0x8117f90>\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +" File \"stdin\", line 2, in generate_ints\n" +"StopIteration" #: ../../whatsnew/2.3.rst:186 msgid "" @@ -354,7 +372,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:247 msgid ":pep:`255` - Simple Generators" -msgstr "" +msgstr ":pep:`255` - 簡單產生器" #: ../../whatsnew/2.3.rst:248 msgid "" @@ -380,14 +398,16 @@ msgid "" "#!/usr/bin/env python\n" "# -*- coding: UTF-8 -*-" msgstr "" +"#!/usr/bin/env python\n" +"# -*- coding: UTF-8 -*-" #: ../../whatsnew/2.3.rst:267 msgid "" "Without such an encoding declaration, the default encoding used is 7-bit " "ASCII. Executing or importing modules that contain string literals with 8-" -"bit characters and have no encoding declaration will result in a :exc:" -"`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be a " -"syntax error." +"bit characters and have no encoding declaration will result in " +"a :exc:`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will " +"be a syntax error." msgstr "" #: ../../whatsnew/2.3.rst:273 @@ -416,8 +436,8 @@ msgstr "" msgid "" "The new :mod:`zipimport` module adds support for importing modules from a " "ZIP-format archive. You don't need to import the module explicitly; it will " -"be automatically imported if a ZIP archive's filename is added to ``sys." -"path``. For example:" +"be automatically imported if a ZIP archive's filename is added to " +"``sys.path``. For example:" msgstr "" #: ../../whatsnew/2.3.rst:296 @@ -443,11 +463,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:314 msgid "" "An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP " -"archive can contain any kind of files, but only files named :file:`\\*.py`, :" -"file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only " -"contains :file:`\\*.py` files, Python will not attempt to modify the archive " -"by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP " -"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow." +"archive can contain any kind of files, but only files " +"named :file:`\\*.py`, :file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. " +"If an archive only contains :file:`\\*.py` files, Python will not attempt to " +"modify the archive by adding the corresponding :file:`\\*.pyc` file, meaning " +"that if a ZIP archive doesn't contain :file:`\\*.pyc` files, importing may " +"be rather slow." msgstr "" #: ../../whatsnew/2.3.rst:321 @@ -465,9 +486,9 @@ msgstr "" msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " -"written by Just van Rossum that uses the import hooks described in :pep:" -"`302`. See section :ref:`section-pep302` for a description of the new import " -"hooks." +"written by Just van Rossum that uses the import hooks described " +"in :pep:`302`. See section :ref:`section-pep302` for a description of the " +"new import hooks." msgstr "" #: ../../whatsnew/2.3.rst:338 @@ -484,10 +505,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:344 msgid "" "Python now allows using arbitrary Unicode strings (within the limitations of " -"the file system) for all functions that expect file names, most notably the :" -"func:`open` built-in function. If a Unicode string is passed to :func:`os." -"listdir`, Python now returns a list of Unicode strings. A new function, :" -"func:`!os.getcwdu`, returns the current directory as a Unicode string." +"the file system) for all functions that expect file names, most notably " +"the :func:`open` built-in function. If a Unicode string is passed " +"to :func:`os.listdir`, Python now returns a list of Unicode strings. A new " +"function, :func:`!os.getcwdu`, returns the current directory as a Unicode " +"string." msgstr "" #: ../../whatsnew/2.3.rst:350 @@ -499,10 +521,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:353 msgid "" "Other systems also allow Unicode strings as file names but convert them to " -"byte strings before passing them to the system, which can cause a :exc:" -"`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " -"strings are supported as file names by checking :attr:`os.path." -"supports_unicode_filenames`, a Boolean value." +"byte strings before passing them to the system, which can cause " +"a :exc:`UnicodeError` to be raised. Applications can test whether arbitrary " +"Unicode strings are supported as file names by " +"checking :const:`os.path.supports_unicode_filenames`, a Boolean value." msgstr "" #: ../../whatsnew/2.3.rst:359 @@ -537,9 +559,9 @@ msgstr "" msgid "" "Python's file objects can now support end of line conventions other than the " "one followed by the platform on which Python is running. Opening a file with " -"the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:" -"`universal newlines` mode. All three line ending conventions will be " -"translated to a ``'\\n'`` in the strings returned by the various file " +"the mode ``'U'`` or ``'rU'`` will open a file for reading " +"in :term:`universal newlines` mode. All three line ending conventions will " +"be translated to a ``'\\n'`` in the strings returned by the various file " "methods such as :meth:`!read` and :meth:`!readline`." msgstr "" @@ -553,9 +575,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:396 msgid "" -"This feature can be disabled when compiling Python by specifying the :option:" -"`!--without-universal-newlines` switch when running Python's :program:" -"`configure` script." +"This feature can be disabled when compiling Python by specifying " +"the :option:`!--without-universal-newlines` switch when running " +"Python's :program:`configure` script." msgstr "" #: ../../whatsnew/2.3.rst:403 @@ -629,15 +651,16 @@ msgstr "" msgid "" "The :class:`~logging.Logger` class is the primary class. Most application " "code will deal with one or more :class:`~logging.Logger` objects, each one " -"used by a particular subsystem of the application. Each :class:`~logging." -"Logger` is identified by a name, and names are organized into a hierarchy " -"using ``.`` as the component separator. For example, you might have :class:" -"`~logging.Logger` instances named ``server``, ``server.auth`` and ``server." -"network``. The latter two instances are below ``server`` in the hierarchy. " -"This means that if you turn up the verbosity for ``server`` or direct " -"``server`` messages to a different handler, the changes will also apply to " -"records logged to ``server.auth`` and ``server.network``. There's also a " -"root :class:`~logging.Logger` that's the parent of all other loggers." +"used by a particular subsystem of the application. " +"Each :class:`~logging.Logger` is identified by a name, and names are " +"organized into a hierarchy using ``.`` as the component separator. For " +"example, you might have :class:`~logging.Logger` instances named ``server``, " +"``server.auth`` and ``server.network``. The latter two instances are below " +"``server`` in the hierarchy. This means that if you turn up the verbosity " +"for ``server`` or direct ``server`` messages to a different handler, the " +"changes will also apply to records logged to ``server.auth`` and " +"``server.network``. There's also a root :class:`~logging.Logger` that's the " +"parent of all other loggers." msgstr "" #: ../../whatsnew/2.3.rst:464 @@ -672,8 +695,8 @@ msgstr "" msgid "" "In the default configuration, informational and debugging messages are " "suppressed and the output is sent to standard error. You can enable the " -"display of informational and debugging messages by calling the :meth:" -"`~logging.Logger.setLevel` method on the root logger." +"display of informational and debugging messages by calling " +"the :meth:`~logging.Logger.setLevel` method on the root logger." msgstr "" #: ../../whatsnew/2.3.rst:486 @@ -730,9 +753,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:519 msgid "" "Log records are usually propagated up the hierarchy, so a message logged to " -"``server.auth`` is also seen by ``server`` and ``root``, but a :class:" -"`~logging.Logger` can prevent this by setting its :attr:`~logging.Logger." -"propagate` attribute to :const:`False`." +"``server.auth`` is also seen by ``server`` and ``root``, but " +"a :class:`~logging.Logger` can prevent this by setting " +"its :attr:`~logging.Logger.propagate` attribute to :const:`False`." msgstr "" #: ../../whatsnew/2.3.rst:523 @@ -743,10 +766,10 @@ msgid "" "any number of different :class:`~logging.Handler` instances. Loggers and " "handlers can also have an attached list of filters, and each filter can " "cause the :class:`~logging.LogRecord` to be ignored or can modify the record " -"before passing it along. When they're finally output, :class:`~logging." -"LogRecord` instances are converted to text by a :class:`~logging.Formatter` " -"class. All of these classes can be replaced by your own specially written " -"classes." +"before passing it along. When they're finally " +"output, :class:`~logging.LogRecord` instances are converted to text by " +"a :class:`~logging.Formatter` class. All of these classes can be replaced " +"by your own specially written classes." msgstr "" #: ../../whatsnew/2.3.rst:533 @@ -773,17 +796,17 @@ msgstr "" #: ../../whatsnew/2.3.rst:552 msgid "" "A Boolean type was added to Python 2.3. Two new constants were added to " -"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. (:const:" -"`True` and :const:`False` constants were added to the built-ins in Python " -"2.2.1, but the 2.2.1 versions are simply set to integer values of 1 and 0 " -"and aren't a different type.)" +"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. " +"(:const:`True` and :const:`False` constants were added to the built-ins in " +"Python 2.2.1, but the 2.2.1 versions are simply set to integer values of 1 " +"and 0 and aren't a different type.)" msgstr "" #: ../../whatsnew/2.3.rst:558 msgid "" "The type object for this new type is named :class:`bool`; the constructor " -"for it takes any Python value and converts it to :const:`True` or :const:" -"`False`. ::" +"for it takes any Python value and converts it to :const:`True` " +"or :const:`False`. ::" msgstr "" #: ../../whatsnew/2.3.rst:561 @@ -829,13 +852,13 @@ msgstr "" msgid "" "Python's Booleans were *not* added for the sake of strict type-checking. A " "very strict language such as Pascal would also prevent you performing " -"arithmetic with Booleans, and would require that the expression in an :" -"keyword:`if` statement always evaluate to a Boolean result. Python is not " -"this strict and never will be, as :pep:`285` explicitly says. This means " -"you can still use any expression in an :keyword:`!if` statement, even ones " -"that evaluate to a list or tuple or some random object. The Boolean type is " -"a subclass of the :class:`int` class so that arithmetic using a Boolean " -"still works. ::" +"arithmetic with Booleans, and would require that the expression in " +"an :keyword:`if` statement always evaluate to a Boolean result. Python is " +"not this strict and never will be, as :pep:`285` explicitly says. This " +"means you can still use any expression in an :keyword:`!if` statement, even " +"ones that evaluate to a list or tuple or some random object. The Boolean " +"type is a subclass of the :class:`int` class so that arithmetic using a " +"Boolean still works. ::" msgstr "" #: ../../whatsnew/2.3.rst:596 @@ -874,9 +897,9 @@ msgstr "" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), " -"\"ignore\" (skipping the character), or \"replace\" (using a question mark " -"in the output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " +"(skipping the character), or \"replace\" (using a question mark in the " +"output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1000,14 +1023,14 @@ msgstr "" msgid "" "``sys.path_hooks`` is a list of callable objects; most often they'll be " "classes. Each callable takes a string containing a path and either returns " -"an importer object that will handle imports from this path or raises an :exc:" -"`ImportError` exception if it can't handle this path." +"an importer object that will handle imports from this path or raises " +"an :exc:`ImportError` exception if it can't handle this path." msgstr "" #: ../../whatsnew/2.3.rst:721 msgid "" -"``sys.path_importer_cache`` caches importer objects for each path, so ``sys." -"path_hooks`` will only need to be traversed once for each path." +"``sys.path_importer_cache`` caches importer objects for each path, so " +"``sys.path_hooks`` will only need to be traversed once for each path." msgstr "" #: ../../whatsnew/2.3.rst:724 @@ -1125,9 +1148,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:797 msgid "" "Different dialects of comma-separated files can be defined and registered; " -"currently there are two dialects, both used by Microsoft Excel. A separate :" -"class:`csv.writer` class will generate comma-separated files from a " -"succession of tuples or lists, quoting strings that contain the delimiter." +"currently there are two dialects, both used by Microsoft Excel. A " +"separate :class:`csv.writer` class will generate comma-separated files from " +"a succession of tuples or lists, quoting strings that contain the delimiter." msgstr "" #: ../../whatsnew/2.3.rst:805 @@ -1175,10 +1198,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:836 msgid "" "To reduce the pickling overhead for new-style classes, a new interface for " -"customizing pickling was added using three special methods: :meth:`~object." -"__getstate__`, :meth:`~object.__setstate__`, and :meth:`~object." -"__getnewargs__`. Consult :pep:`307` for the full semantics of these " -"methods." +"customizing pickling was added using three special " +"methods: :meth:`~object.__getstate__`, :meth:`~object.__setstate__`, " +"and :meth:`~object.__getnewargs__`. Consult :pep:`307` for the full " +"semantics of these methods." msgstr "" #: ../../whatsnew/2.3.rst:841 @@ -1552,10 +1575,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1044 msgid "" "Most type objects are now callable, so you can use them to create new " -"objects such as functions, classes, and modules. (This means that the :mod:" -"`!new` module can be deprecated in a future Python version, because you can " -"now use the type objects available in the :mod:`types` module.) For example, " -"you can create a new module object with the following code:" +"objects such as functions, classes, and modules. (This means that " +"the :mod:`!new` module can be deprecated in a future Python version, because " +"you can now use the type objects available in the :mod:`types` module.) For " +"example, you can create a new module object with the following code:" msgstr "" #: ../../whatsnew/2.3.rst:1052 @@ -1579,16 +1602,16 @@ msgid "" "A new warning, :exc:`PendingDeprecationWarning` was added to indicate " "features which are in the process of being deprecated. The warning will " "*not* be printed by default. To check for use of features that will be " -"deprecated in the future, supply :option:`-Walways::" -"PendingDeprecationWarning:: <-W>` on the command line or use :func:`warnings." -"filterwarnings`." +"deprecated in the future, supply :option:`-" +"Walways::PendingDeprecationWarning:: <-W>` on the command line or " +"use :func:`warnings.filterwarnings`." msgstr "" #: ../../whatsnew/2.3.rst:1065 msgid "" "The process of deprecating string-based exceptions, as in ``raise \"Error " -"occurred\"``, has begun. Raising a string will now trigger :exc:" -"`PendingDeprecationWarning`." +"occurred\"``, has begun. Raising a string will now " +"trigger :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/2.3.rst:1069 @@ -1663,8 +1686,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" -"`~type.__bases__` attributes of new-style classes. There are some " +"been removed: you can now assign to the :attr:`~type.__name__` " +"and :attr:`~type.__bases__` attributes of new-style classes. There are some " "restrictions on what can be assigned to :attr:`!__bases__` along the lines " "of those relating to assigning to an instance's :attr:`~object.__class__` " "attribute." @@ -1794,8 +1817,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1202 msgid "" "The ``SET_LINENO`` opcode is now gone. This may provide a small speed " -"increase, depending on your compiler's idiosyncrasies. See section :ref:" -"`23section-other` for a longer explanation. (Removed by Michael Hudson.)" +"increase, depending on your compiler's idiosyncrasies. See " +"section :ref:`23section-other` for a longer explanation. (Removed by Michael " +"Hudson.)" msgstr "" #: ../../whatsnew/2.3.rst:1206 @@ -1856,18 +1880,19 @@ msgid "" "incompatibilities. When upgrading to Python 2.3, if the new interpreter is " "compiled with a new version of the underlying BerkeleyDB library, you will " "almost certainly have to convert your database files to the new version. " -"You can do this fairly easily with the new scripts :file:`db2pickle.py` and :" -"file:`pickle2db.py` which you will find in the distribution's :file:`Tools/" -"scripts` directory. If you've already been using the PyBSDDB package and " -"importing it as :mod:`!bsddb3`, you will have to change your ``import`` " -"statements to import it as :mod:`!bsddb`." +"You can do this fairly easily with the new scripts :file:`db2pickle.py` " +"and :file:`pickle2db.py` which you will find in the " +"distribution's :file:`Tools/scripts` directory. If you've already been " +"using the PyBSDDB package and importing it as :mod:`!bsddb3`, you will have " +"to change your ``import`` statements to import it as :mod:`!bsddb`." msgstr "" #: ../../whatsnew/2.3.rst:1249 msgid "" "The new :mod:`bz2` module is an interface to the bz2 data compression " -"library. bz2-compressed data is usually smaller than corresponding :mod:" -"`zlib`\\ -compressed data. (Contributed by Gustavo Niemeyer.)" +"library. bz2-compressed data is usually smaller than " +"corresponding :mod:`zlib`\\ -compressed data. (Contributed by Gustavo " +"Niemeyer.)" msgstr "" #: ../../whatsnew/2.3.rst:1253 @@ -1901,18 +1926,18 @@ msgstr "" #: ../../whatsnew/2.3.rst:1270 msgid "" -"Other minor changes to Distutils: it now checks for the :envvar:`CC`, :" -"envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, and :envvar:`CPPFLAGS` " -"environment variables, using them to override the settings in Python's " -"configuration (contributed by Robert Weber)." +"Other minor changes to Distutils: it now checks for " +"the :envvar:`CC`, :envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, " +"and :envvar:`CPPFLAGS` environment variables, using them to override the " +"settings in Python's configuration (contributed by Robert Weber)." msgstr "" #: ../../whatsnew/2.3.rst:1275 msgid "" "Previously the :mod:`doctest` module would only search the docstrings of " "public methods and functions for test cases, but it now also examines " -"private ones as well. The :func:`~doctest.DocTestSuite` function creates a :" -"class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." +"private ones as well. The :func:`~doctest.DocTestSuite` function creates " +"a :class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." msgstr "" #: ../../whatsnew/2.3.rst:1280 @@ -1925,10 +1950,10 @@ msgstr "" msgid "" "The :mod:`getopt` module gained a new function, :func:`~getopt.gnu_getopt`, " "that supports the same arguments as the existing :func:`~getopt.getopt` " -"function but uses GNU-style scanning mode. The existing :func:`~getopt." -"getopt` stops processing options as soon as a non-option argument is " -"encountered, but in GNU-style mode processing continues, meaning that " -"options and arguments can be mixed. For example::" +"function but uses GNU-style scanning mode. The " +"existing :func:`~getopt.getopt` stops processing options as soon as a non-" +"option argument is encountered, but in GNU-style mode processing continues, " +"meaning that options and arguments can be mixed. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1289 @@ -1975,10 +2000,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1314 msgid "" -"The :mod:`heapq` module provides :func:`~heapq.heappush` and :func:`~heapq." -"heappop` functions for adding and removing items while maintaining the heap " -"property on top of some other mutable Python sequence type. Here's an " -"example that uses a Python list::" +"The :mod:`heapq` module provides :func:`~heapq.heappush` " +"and :func:`~heapq.heappop` functions for adding and removing items while " +"maintaining the heap property on top of some other mutable Python sequence " +"type. Here's an example that uses a Python list::" msgstr "" #: ../../whatsnew/2.3.rst:1318 @@ -2063,8 +2088,8 @@ msgid "" "stamps are floats. For compatibility, when using the tuple interface of " "the :class:`~os.stat_result` time stamps will be represented as integers. " "When using named fields (a feature first introduced in Python 2.2), time " -"stamps are still represented as integers, unless :func:`!os." -"stat_float_times` is invoked to enable float return values::" +"stamps are still represented as integers, unless :func:`!" +"os.stat_float_times` is invoked to enable float return values::" msgstr "" #: ../../whatsnew/2.3.rst:1376 @@ -2118,8 +2143,8 @@ msgid "" "The parser objects provided by the :mod:`pyexpat <xml.parsers.expat>` module " "can now optionally buffer character data, resulting in fewer calls to your " "character data handler and therefore faster performance. Setting the parser " -"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute to :" -"const:`True` will enable buffering." +"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute " +"to :const:`True` will enable buffering." msgstr "" #: ../../whatsnew/2.3.rst:1410 @@ -2164,8 +2189,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1438 msgid "" -"The :mod:`readline` module also gained a number of new functions: :func:" -"`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " +"The :mod:`readline` module also gained a number of new " +"functions: :func:`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " "and :func:`~readline.redisplay`." msgstr "" @@ -2201,9 +2226,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1459 msgid "" -"Support for more advanced POSIX signal handling was added to the :mod:" -"`signal` but then removed again as it proved impossible to make it work " -"reliably across platforms." +"Support for more advanced POSIX signal handling was added to " +"the :mod:`signal` but then removed again as it proved impossible to make it " +"work reliably across platforms." msgstr "" #: ../../whatsnew/2.3.rst:1463 @@ -2238,8 +2263,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1481 msgid "" -"The new :mod:`tarfile` module allows reading from and writing to :program:" -"`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" +"The new :mod:`tarfile` module allows reading from and writing " +"to :program:`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" msgstr "" #: ../../whatsnew/2.3.rst:1484 @@ -2249,8 +2274,8 @@ msgid "" "string and returns a list containing the text split into lines of no more " "than the chosen width. The ``fill(text, width)`` function returns a single " "string, reformatted to fit into lines no longer than the chosen width. (As " -"you can guess, :func:`~textwrap.fill` is built on top of :func:`~textwrap." -"wrap`. For example::" +"you can guess, :func:`~textwrap.fill` is built on top " +"of :func:`~textwrap.wrap`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1491 @@ -2274,21 +2299,21 @@ msgstr "" #: ../../whatsnew/2.3.rst:1506 msgid "" "The module also contains a :class:`~textwrap.TextWrapper` class that " -"actually implements the text wrapping strategy. Both the :class:`~textwrap." -"TextWrapper` class and the :func:`~textwrap.wrap` and :func:`~textwrap.fill` " -"functions support a number of additional keyword arguments for fine-tuning " -"the formatting; consult the module's documentation for details. (Contributed " -"by Greg Ward.)" +"actually implements the text wrapping strategy. Both " +"the :class:`~textwrap.TextWrapper` class and the :func:`~textwrap.wrap` " +"and :func:`~textwrap.fill` functions support a number of additional keyword " +"arguments for fine-tuning the formatting; consult the module's documentation " +"for details. (Contributed by Greg Ward.)" msgstr "" #: ../../whatsnew/2.3.rst:1512 msgid "" -"The :mod:`!thread` and :mod:`threading` modules now have companion modules, :" -"mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-nothing " -"implementation of the :mod:`!thread` module's interface for platforms where " -"threads are not supported. The intention is to simplify thread-aware " -"modules (ones that *don't* rely on threads to run) by putting the following " -"code at the top::" +"The :mod:`!thread` and :mod:`threading` modules now have companion " +"modules, :mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-" +"nothing implementation of the :mod:`!thread` module's interface for " +"platforms where threads are not supported. The intention is to simplify " +"thread-aware modules (ones that *don't* rely on threads to run) by putting " +"the following code at the top::" msgstr "" #: ../../whatsnew/2.3.rst:1519 @@ -2302,12 +2327,13 @@ msgstr "" #: ../../whatsnew/2.3.rst:1524 msgid "" "In this example, :mod:`!_threading` is used as the module name to make it " -"clear that the module being used is not necessarily the actual :mod:" -"`threading` module. Code can call functions and use classes in :mod:`!" -"_threading` whether or not threads are supported, avoiding an :keyword:`if` " -"statement and making the code slightly clearer. This module will not " -"magically make multithreaded code run without threads; code that waits for " -"another thread to return or to do something will simply hang forever." +"clear that the module being used is not necessarily the " +"actual :mod:`threading` module. Code can call functions and use classes " +"in :mod:`!_threading` whether or not threads are supported, avoiding " +"an :keyword:`if` statement and making the code slightly clearer. This " +"module will not magically make multithreaded code run without threads; code " +"that waits for another thread to return or to do something will simply hang " +"forever." msgstr "" #: ../../whatsnew/2.3.rst:1532 @@ -2361,9 +2387,9 @@ msgid "" "a command, passing it to the correct thread, and waiting for the results. " "Other interfaces can't be handled automatically but :mod:`!Tkinter` will now " "raise an exception on such an access so that you can at least find out about " -"the problem. See https://mail.python.org/pipermail/python-dev/2002-" -"December/031107.html for a more detailed explanation of this change. " -"(Implemented by Martin von Löwis.)" +"the problem. See https://mail.python.org/pipermail/python-dev/2002-December/" +"031107.html for a more detailed explanation of this change. (Implemented by " +"Martin von Löwis.)" msgstr "" #: ../../whatsnew/2.3.rst:1572 @@ -2413,8 +2439,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1598 msgid "" "Adding the mix-in as a superclass provides the full dictionary interface " -"whenever the class defines :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. For example::" +"whenever the class " +"defines :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1602 @@ -2464,9 +2491,9 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.3.rst:1641 msgid "" "The DOM implementation in :mod:`xml.dom.minidom` can now generate XML output " -"in a particular encoding by providing an optional encoding argument to the :" -"meth:`~xml.dom.minidom.Node.toxml` and :meth:`~xml.dom.minidom.Node." -"toprettyxml` methods of DOM nodes." +"in a particular encoding by providing an optional encoding argument to " +"the :meth:`~xml.dom.minidom.Node.toxml` " +"and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of DOM nodes." msgstr "" #: ../../whatsnew/2.3.rst:1645 @@ -2523,9 +2550,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1681 msgid "" -"Date and time types suitable for expressing timestamps were added as the :" -"mod:`datetime` module. The types don't support different calendars or many " -"fancy features, and just stick to the basics of representing time." +"Date and time types suitable for expressing timestamps were added as " +"the :mod:`datetime` module. The types don't support different calendars or " +"many fancy features, and just stick to the basics of representing time." msgstr "" #: ../../whatsnew/2.3.rst:1685 @@ -2533,19 +2560,19 @@ msgid "" "The three primary types are: :class:`~datetime.date`, representing a day, " "month, and year; :class:`~datetime.time`, consisting of hour, minute, and " "second; and :class:`~datetime.datetime`, which contains all the attributes " -"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also a :" -"class:`~datetime.timedelta` class representing differences between two " +"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also " +"a :class:`~datetime.timedelta` class representing differences between two " "points in time, and time zone logic is implemented by classes inheriting " "from the abstract :class:`~datetime.tzinfo` class." msgstr "" #: ../../whatsnew/2.3.rst:1692 msgid "" -"You can create instances of :class:`~datetime.date` and :class:`~datetime." -"time` by either supplying keyword arguments to the appropriate constructor, " -"e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a " -"number of class methods. For example, the :meth:`~datetime.date.today` " -"class method returns the current local date." +"You can create instances of :class:`~datetime.date` " +"and :class:`~datetime.time` by either supplying keyword arguments to the " +"appropriate constructor, e.g. ``datetime.date(year=1972, month=10, " +"day=15)``, or by using one of a number of class methods. For example, " +"the :meth:`~datetime.date.today` class method returns the current local date." msgstr "" #: ../../whatsnew/2.3.rst:1698 @@ -2586,12 +2613,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1720 msgid "" "Instances can be compared, hashed, and converted to strings (the result is " -"the same as that of :meth:`~datetime.datetime.isoformat`). :class:" -"`~datetime.date` and :class:`~datetime.datetime` instances can be subtracted " -"from each other, and added to :class:`~datetime.timedelta` instances. The " -"largest missing feature is that there's no standard library support for " -"parsing strings and getting back a :class:`~datetime.date` or :class:" -"`~datetime.datetime`." +"the same as that " +"of :meth:`~datetime.datetime.isoformat`). :class:`~datetime.date` " +"and :class:`~datetime.datetime` instances can be subtracted from each other, " +"and added to :class:`~datetime.timedelta` instances. The largest missing " +"feature is that there's no standard library support for parsing strings and " +"getting back a :class:`~datetime.date` or :class:`~datetime.datetime`." msgstr "" #: ../../whatsnew/2.3.rst:1727 @@ -2635,8 +2662,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1756 msgid "" -"Parsing a command line is then done by calling the :meth:`~optparse." -"OptionParser.parse_args` method. ::" +"Parsing a command line is then done by calling " +"the :meth:`~optparse.OptionParser.parse_args` method. ::" msgstr "" #: ../../whatsnew/2.3.rst:1758 @@ -2755,22 +2782,23 @@ msgstr "" #: ../../whatsnew/2.3.rst:1842 msgid "" "To allocate and free an undistinguished chunk of memory use the \"raw " -"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:" -"func:`PyMem_Free`." +"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1845 msgid "" "The \"object memory\" family is the interface to the pymalloc facility " "described above and is biased towards a large number of \"small\" " -"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:" -"func:`PyObject_Free`." +"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1849 msgid "" -"To allocate and free Python objects, use the \"object\" family :c:macro:" -"`PyObject_New`, :c:macro:`PyObject_NewVar`, and :c:func:`PyObject_Del`." +"To allocate and free Python objects, use the \"object\" " +"family :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, " +"and :c:func:`PyObject_Del`." msgstr "" #: ../../whatsnew/2.3.rst:1852 @@ -2778,8 +2806,8 @@ msgid "" "Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides " "debugging features to catch memory overwrites and doubled frees in both " "extension modules and in the interpreter itself. To enable this support, " -"compile a debugging version of the Python interpreter by running :program:" -"`configure` with :option:`!--with-pydebug`." +"compile a debugging version of the Python interpreter by " +"running :program:`configure` with :option:`!--with-pydebug`." msgstr "" #: ../../whatsnew/2.3.rst:1858 @@ -2804,25 +2832,26 @@ msgstr "" #: ../../whatsnew/2.3.rst:1876 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.3.rst:1878 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.3.rst:1880 msgid "" "The cycle detection implementation used by the garbage collection has proven " "to be stable, so it's now been made mandatory. You can no longer compile " -"Python without it, and the :option:`!--with-cycle-gc` switch to :program:" -"`configure` has been removed." +"Python without it, and the :option:`!--with-cycle-gc` switch " +"to :program:`configure` has been removed." msgstr "" #: ../../whatsnew/2.3.rst:1885 msgid "" -"Python can now optionally be built as a shared library (:file:`libpython2.3." -"so`) by supplying :option:`!--enable-shared` when running Python's :program:" -"`configure` script. (Contributed by Ondrej Palkovsky.)" +"Python can now optionally be built as a shared library " +"(:file:`libpython2.3.so`) by supplying :option:`!--enable-shared` when " +"running Python's :program:`configure` script. (Contributed by Ondrej " +"Palkovsky.)" msgstr "" #: ../../whatsnew/2.3.rst:1889 @@ -2837,8 +2866,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1894 msgid "" "The interpreter can be compiled without any docstrings for the built-in " -"functions and modules by supplying :option:`!--without-doc-strings` to the :" -"program:`configure` script. This makes the Python executable about 10% " +"functions and modules by supplying :option:`!--without-doc-strings` to " +"the :program:`configure` script. This makes the Python executable about 10% " "smaller, but will also mean that you can't get help for Python's built-ins. " "(Contributed by Gustavo Niemeyer.)" msgstr "" @@ -2857,9 +2886,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1907 msgid "" ":c:func:`PyArg_ParseTuple` accepts new format characters for various sizes " -"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` for :c:expr:" -"`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and ``K`` for :c:" -"expr:`unsigned long long`." +"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` " +"for :c:expr:`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and " +"``K`` for :c:expr:`unsigned long long`." msgstr "" #: ../../whatsnew/2.3.rst:1912 @@ -2871,9 +2900,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1915 msgid "" "File objects now manage their internal string buffer differently, increasing " -"it exponentially when needed. This results in the benchmark tests in :file:" -"`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds to 1.7 " -"seconds, according to one measurement)." +"it exponentially when needed. This results in the benchmark tests " +"in :file:`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds " +"to 1.7 seconds, according to one measurement)." msgstr "" #: ../../whatsnew/2.3.rst:1920 @@ -2892,12 +2921,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`~type.__module__` and :" -"attr:`~type.__name__` attributes. In summary, you will want to ensure the " -"type's dictionary contains a ``'__module__'`` key; making the module name " -"the part of the type name leading up to the final period will no longer have " -"the desired effect. For more detail, read the API reference documentation " -"or the source." +"aware of a change in the rules relating to the :attr:`~type.__module__` " +"and :attr:`~type.__name__` attributes. In summary, you will want to ensure " +"the type's dictionary contains a ``'__module__'`` key; making the module " +"name the part of the type name leading up to the final period will no longer " +"have the desired effect. For more detail, read the API reference " +"documentation or the source." msgstr "" #: ../../whatsnew/2.3.rst:1938 @@ -2909,11 +2938,11 @@ msgid "" "Support for a port to IBM's OS/2 using the EMX runtime environment was " "merged into the main Python source tree. EMX is a POSIX emulation layer " "over the OS/2 system APIs. The Python port for EMX tries to support all the " -"POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:" -"`!fork` and :func:`fcntl` are restricted by the limitations of the " -"underlying emulation layer. The standard OS/2 port, which uses IBM's Visual " -"Age compiler, also gained support for case-sensitive import semantics as " -"part of the integration of the EMX port into CVS. (Contributed by Andrew " +"POSIX-like capability exposed by the EMX runtime, and mostly " +"succeeds; :func:`!fork` and :func:`fcntl` are restricted by the limitations " +"of the underlying emulation layer. The standard OS/2 port, which uses IBM's " +"Visual Age compiler, also gained support for case-sensitive import semantics " +"as part of the integration of the EMX port into CVS. (Contributed by Andrew " "MacIntyre.)" msgstr "" @@ -2934,8 +2963,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1957 msgid "" -"Other new platforms now supported by Python include AtheOS (http://www." -"atheos.cx/), GNU/Hurd, and OpenVMS." +"Other new platforms now supported by Python include AtheOS (http://" +"www.atheos.cx/), GNU/Hurd, and OpenVMS." msgstr "" #: ../../whatsnew/2.3.rst:1966 @@ -3005,10 +3034,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:2006 msgid "" -"A nifty new feature is that trace functions can now assign to the :attr:" -"`~frame.f_lineno` attribute of frame objects, changing the line that will be " -"executed next. A ``jump`` command has been added to the :mod:`pdb` debugger " -"taking advantage of this new feature. (Implemented by Richie Hindle.)" +"A nifty new feature is that trace functions can now assign to " +"the :attr:`~frame.f_lineno` attribute of frame objects, changing the line " +"that will be executed next. A ``jump`` command has been added to " +"the :mod:`pdb` debugger taking advantage of this new feature. (Implemented " +"by Richie Hindle.)" msgstr "" #: ../../whatsnew/2.3.rst:2015 @@ -3057,9 +3087,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:2039 msgid "" -"Large octal and hex literals such as ``0xffffffff`` now trigger a :exc:" -"`FutureWarning`. Currently they're stored as 32-bit numbers and result in a " -"negative value, but in Python 2.4 they'll become positive long integers." +"Large octal and hex literals such as ``0xffffffff`` now trigger " +"a :exc:`FutureWarning`. Currently they're stored as 32-bit numbers and " +"result in a negative value, but in Python 2.4 they'll become positive long " +"integers." msgstr "" #: ../../whatsnew/2.3.rst:2043 diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 7c50822863..0d58bc66af 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -136,10 +136,11 @@ msgstr "" msgid "" "The lengthy transition process for this PEP, begun in Python 2.2, takes " "another step forward in Python 2.4. In 2.3, certain integer operations that " -"would behave differently after int/long unification triggered :exc:" -"`FutureWarning` warnings and returned values limited to 32 or 64 bits " -"(depending on your platform). In 2.4, these expressions no longer produce a " -"warning and instead produce a different result that's usually a long integer." +"would behave differently after int/long unification " +"triggered :exc:`FutureWarning` warnings and returned values limited to 32 or " +"64 bits (depending on your platform). In 2.4, these expressions no longer " +"produce a warning and instead produce a different result that's usually a " +"long integer." msgstr "" #: ../../whatsnew/2.4.rst:99 @@ -182,6 +183,9 @@ msgid "" "for link in links:\n" " ..." msgstr "" +"links = [link for link in get_all_links() if not link.followed]\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:129 msgid "instead of ::" @@ -194,6 +198,10 @@ msgid "" " continue\n" " ..." msgstr "" +"for link in get_all_links():\n" +" if link.followed:\n" +" continue\n" +" ..." #: ../../whatsnew/2.4.rst:136 msgid "" @@ -215,6 +223,9 @@ msgid "" "for link in links:\n" " ..." msgstr "" +"links = (link for link in get_all_links() if not link.followed)\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:148 msgid "" @@ -268,6 +279,8 @@ msgid "" ">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" "'2: The Best of Times'" msgstr "" +">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:183 msgid "" @@ -295,6 +308,10 @@ msgid "" ">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" "'2: The Best of Times'" msgstr "" +">>> import string\n" +">>> t = string.Template('$page: $title')\n" +">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:200 msgid "" @@ -309,6 +326,9 @@ msgid "" ">>> t.safe_substitute({'page':3})\n" "'3: $title'" msgstr "" +">>> t = string.Template('$page: $title')\n" +">>> t.safe_substitute({'page':3})\n" +"'3: $title'" #: ../../whatsnew/2.4.rst:211 msgid ":pep:`292` - Simpler String Substitutions" @@ -326,10 +346,10 @@ msgstr "" msgid "" "Python 2.2 extended Python's object model by adding static methods and class " "methods, but it didn't extend Python's syntax to provide any new way of " -"defining static or class methods. Instead, you had to write a :keyword:" -"`def` statement in the usual way, and pass the resulting method to a :func:" -"`staticmethod` or :func:`classmethod` function that would wrap up the " -"function as a method of the new type. Your code would look like this::" +"defining static or class methods. Instead, you had to write " +"a :keyword:`def` statement in the usual way, and pass the resulting method " +"to a :func:`staticmethod` or :func:`classmethod` function that would wrap up " +"the function as a method of the new type. Your code would look like this::" msgstr "" #: ../../whatsnew/2.4.rst:227 @@ -343,8 +363,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:233 msgid "" -"If the method was very long, it would be easy to miss or forget the :func:" -"`classmethod` invocation after the function body." +"If the method was very long, it would be easy to miss or forget " +"the :func:`classmethod` invocation after the function body." msgstr "" #: ../../whatsnew/2.4.rst:236 @@ -378,6 +398,11 @@ msgid "" " def meth (cls):\n" " ..." msgstr "" +"class C:\n" +"\n" +" @classmethod\n" +" def meth (cls):\n" +" ..." #: ../../whatsnew/2.4.rst:256 msgid "" @@ -393,6 +418,11 @@ msgid "" "def f ():\n" " ..." msgstr "" +"@A\n" +"@B\n" +"@C\n" +"def f ():\n" +" ..." #: ../../whatsnew/2.4.rst:265 msgid "It's equivalent to the following pre-decorator code::" @@ -403,6 +433,8 @@ msgid "" "def f(): ...\n" "f = A(B(C(f)))" msgstr "" +"def f(): ...\n" +"f = A(B(C(f)))" #: ../../whatsnew/2.4.rst:270 msgid "" @@ -438,6 +470,18 @@ msgid "" "'decorated'\n" ">>>" msgstr "" +">>> def deco(func):\n" +"... func.attr = 'decorated'\n" +"... return func\n" +"...\n" +">>> @deco\n" +"... def f(): pass\n" +"...\n" +">>> f\n" +"<function f at 0x402ef0d4>\n" +">>> f.attr\n" +"'decorated'\n" +">>>" #: ../../whatsnew/2.4.rst:295 msgid "" @@ -462,6 +506,20 @@ msgid "" "def p2(arg):\n" " print arg*2" msgstr "" +"def require_int (func):\n" +" def wrapper (arg):\n" +" assert isinstance(arg, int)\n" +" return func(arg)\n" +"\n" +" return wrapper\n" +"\n" +"@require_int\n" +"def p1 (arg):\n" +" print arg\n" +"\n" +"@require_int\n" +"def p2(arg):\n" +" print arg*2" #: ../../whatsnew/2.4.rst:313 msgid "" @@ -484,6 +542,9 @@ msgid "" "_deco = C(args)\n" "f = A(B(_deco(f)))" msgstr "" +"def f(): ...\n" +"_deco = C(args)\n" +"f = A(B(_deco(f)))" #: ../../whatsnew/2.4.rst:325 msgid "" @@ -536,6 +597,12 @@ msgid "" "2\n" "1" msgstr "" +">>> for i in reversed(xrange(1,4)):\n" +"... print i\n" +"...\n" +"3\n" +"2\n" +"1" #: ../../whatsnew/2.4.rst:360 msgid "" @@ -546,8 +613,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:363 msgid "" "Note that :func:`reversed` only accepts sequences, not arbitrary iterators. " -"If you want to reverse an iterator, first convert it to a list with :func:" -"`list`. ::" +"If you want to reverse an iterator, first convert it to a list " +"with :func:`list`. ::" msgstr "" #: ../../whatsnew/2.4.rst:367 @@ -581,13 +648,14 @@ msgstr "" #: ../../whatsnew/2.4.rst:386 msgid "" "The standard library provides a number of ways to execute a subprocess, " -"offering different features and different levels of complexity. ``os." -"system(command)`` is easy to use, but slow (it runs a shell process which " -"executes the command) and dangerous (you have to be careful about escaping " -"the shell's metacharacters). The :mod:`!popen2` module offers classes that " -"can capture standard output and standard error from the subprocess, but the " -"naming is confusing. The :mod:`subprocess` module cleans this up, " -"providing a unified interface that offers all the features you might need." +"offering different features and different levels of complexity. " +"``os.system(command)`` is easy to use, but slow (it runs a shell process " +"which executes the command) and dangerous (you have to be careful about " +"escaping the shell's metacharacters). The :mod:`!popen2` module offers " +"classes that can capture standard output and standard error from the " +"subprocess, but the naming is confusing. The :mod:`subprocess` module " +"cleans this up, providing a unified interface that offers all the features " +"you might need." msgstr "" #: ../../whatsnew/2.4.rst:395 @@ -605,6 +673,11 @@ msgid "" " cwd=None, env=None, universal_newlines=False,\n" " startupinfo=None, creationflags=0):" msgstr "" +"class Popen(args, bufsize=0, executable=None,\n" +" stdin=None, stdout=None, stderr=None,\n" +" preexec_fn=None, close_fds=False, shell=False,\n" +" cwd=None, env=None, universal_newlines=False,\n" +" startupinfo=None, creationflags=0):" #: ../../whatsnew/2.4.rst:405 msgid "" @@ -649,26 +722,27 @@ msgstr "" #: ../../whatsnew/2.4.rst:430 msgid "" -"*universal_newlines* opens the child's input and output using Python's :term:" -"`universal newlines` feature." +"*universal_newlines* opens the child's input and output using " +"Python's :term:`universal newlines` feature." msgstr "" #: ../../whatsnew/2.4.rst:433 msgid "" -"Once you've created the :class:`Popen` instance, you can call its :meth:" -"`wait` method to pause until the subprocess has exited, :meth:`poll` to " -"check if it's exited without pausing, or ``communicate(data)`` to send the " -"string *data* to the subprocess's standard input. ``communicate(data)`` " -"then reads any data that the subprocess has sent to its standard output or " -"standard error, returning a tuple ``(stdout_data, stderr_data)``." +"Once you've created the :class:`Popen` instance, you can call " +"its :meth:`wait` method to pause until the subprocess has " +"exited, :meth:`poll` to check if it's exited without pausing, or " +"``communicate(data)`` to send the string *data* to the subprocess's standard " +"input. ``communicate(data)`` then reads any data that the subprocess has " +"sent to its standard output or standard error, returning a tuple " +"``(stdout_data, stderr_data)``." msgstr "" #: ../../whatsnew/2.4.rst:440 msgid "" -":func:`call` is a shortcut that passes its arguments along to the :class:" -"`Popen` constructor, waits for the command to complete, and returns the " -"status code of the subprocess. It can serve as a safer analog to :func:`os." -"system`::" +":func:`call` is a shortcut that passes its arguments along to " +"the :class:`Popen` constructor, waits for the command to complete, and " +"returns the status code of the subprocess. It can serve as a safer analog " +"to :func:`os.system`::" msgstr "" #: ../../whatsnew/2.4.rst:444 @@ -681,6 +755,13 @@ msgid "" " # dpkg returned an error\n" " ..." msgstr "" +"sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\n" +"if sts == 0:\n" +" # 成功\n" +" ...\n" +"else:\n" +" # dpkg 回傳一個錯誤\n" +" ..." #: ../../whatsnew/2.4.rst:452 msgid "" @@ -784,6 +865,8 @@ msgid "" ">>> 1.1\n" "1.1000000000000001" msgstr "" +">>> 1.1\n" +"1.1000000000000001" #: ../../whatsnew/2.4.rst:521 msgid "" @@ -816,10 +899,10 @@ msgstr ":class:`Decimal` 型別" #: ../../whatsnew/2.4.rst:540 msgid "" "A new module, :mod:`decimal`, was added to Python's standard library. It " -"contains two classes, :class:`Decimal` and :class:`Context`. :class:" -"`Decimal` instances represent numbers, and :class:`Context` instances are " -"used to wrap up various settings such as the precision and default rounding " -"mode." +"contains two classes, :class:`Decimal` " +"and :class:`Context`. :class:`Decimal` instances represent numbers, " +"and :class:`Context` instances are used to wrap up various settings such as " +"the precision and default rounding mode." msgstr "" #: ../../whatsnew/2.4.rst:545 @@ -838,6 +921,11 @@ msgid "" ">>> decimal.Decimal(\"1.1\")\n" "Decimal(\"1.1\")" msgstr "" +">>> import decimal\n" +">>> decimal.Decimal(1972)\n" +"Decimal(\"1972\")\n" +">>> decimal.Decimal(\"1.1\")\n" +"Decimal(\"1.1\")" #: ../../whatsnew/2.4.rst:556 msgid "" @@ -850,6 +938,8 @@ msgid "" ">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" "Decimal(\"-14.75\")" msgstr "" +">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" +"Decimal(\"-14.75\")" #: ../../whatsnew/2.4.rst:562 msgid "" @@ -875,6 +965,11 @@ msgid "" ">>> decimal.Decimal('%.12f' % f)\n" "Decimal(\"1.100000000000\")" msgstr "" +">>> f = 1.1\n" +">>> decimal.Decimal(str(f))\n" +"Decimal(\"1.1\")\n" +">>> decimal.Decimal('%.12f' % f)\n" +"Decimal(\"1.100000000000\")" #: ../../whatsnew/2.4.rst:578 msgid "" @@ -902,6 +997,22 @@ msgid "" " ...\n" "decimal.InvalidOperation: x ** (non-integer)" msgstr "" +">>> a = decimal.Decimal('35.72')\n" +">>> b = decimal.Decimal('1.73')\n" +">>> a+b\n" +"Decimal(\"37.45\")\n" +">>> a-b\n" +"Decimal(\"33.99\")\n" +">>> a*b\n" +"Decimal(\"61.7956\")\n" +">>> a/b\n" +"Decimal(\"20.64739884393063583815028902\")\n" +">>> a ** 2\n" +"Decimal(\"1275.9184\")\n" +">>> a**b\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.InvalidOperation: x ** (non-integer)" #: ../../whatsnew/2.4.rst:599 msgid "" @@ -920,6 +1031,14 @@ msgid "" "types.\n" ">>>" msgstr "" +">>> a + 4\n" +"Decimal(\"39.72\")\n" +">>> a + 4.5\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: You can interact Decimal only with int, long or Decimal data " +"types.\n" +">>>" #: ../../whatsnew/2.4.rst:610 msgid "" @@ -939,12 +1058,18 @@ msgid "" ">>> cmath.sqrt(-d)\n" "351364.18288201344j" msgstr "" +">>> import math, cmath\n" +">>> d = decimal.Decimal('123456789012.345')\n" +">>> math.sqrt(d)\n" +"351364.18288201344\n" +">>> cmath.sqrt(-d)\n" +"351364.18288201344j" #: ../../whatsnew/2.4.rst:623 msgid "" -":class:`Decimal` instances have a :meth:`sqrt` method that returns a :class:" -"`Decimal`, but if you need other things such as trigonometric functions " -"you'll have to implement them. ::" +":class:`Decimal` instances have a :meth:`sqrt` method that returns " +"a :class:`Decimal`, but if you need other things such as trigonometric " +"functions you'll have to implement them. ::" msgstr "" #: ../../whatsnew/2.4.rst:627 @@ -952,6 +1077,8 @@ msgid "" ">>> d.sqrt()\n" "Decimal(\"351364.1828820134592177245001\")" msgstr "" +">>> d.sqrt()\n" +"Decimal(\"351364.1828820134592177245001\")" #: ../../whatsnew/2.4.rst:632 msgid "The :class:`Context` type" @@ -970,8 +1097,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:639 msgid "" ":attr:`rounding` specifies the rounding mode. The :mod:`decimal` module has " -"constants for the various possibilities: :const:`ROUND_DOWN`, :const:" -"`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, and various others." +"constants for the various " +"possibilities: :const:`ROUND_DOWN`, :const:`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, " +"and various others." msgstr "" #: ../../whatsnew/2.4.rst:643 @@ -984,10 +1112,10 @@ msgstr "" #: ../../whatsnew/2.4.rst:648 msgid "" -"There's a thread-local default context available by calling :func:" -"`getcontext`; you can change the properties of this context to alter the " -"default precision, rounding, or trap handling. The following example shows " -"the effect of changing the precision of the default context::" +"There's a thread-local default context available by " +"calling :func:`getcontext`; you can change the properties of this context to " +"alter the default precision, rounding, or trap handling. The following " +"example shows the effect of changing the precision of the default context::" msgstr "" #: ../../whatsnew/2.4.rst:653 @@ -1000,6 +1128,13 @@ msgid "" ">>> decimal.Decimal(1) / decimal.Decimal(7)\n" "Decimal(\"0.142857143\")" msgstr "" +">>> decimal.getcontext().prec\n" +"28\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.1428571428571428571428571429\")\n" +">>> decimal.getcontext().prec = 9\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.142857143\")" #: ../../whatsnew/2.4.rst:661 msgid "" @@ -1019,6 +1154,14 @@ msgid "" "Decimal(\"Infinity\")\n" ">>>" msgstr "" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.DivisionByZero: x / 0\n" +">>> decimal.getcontext().traps[decimal.DivisionByZero] = False\n" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Decimal(\"Infinity\")\n" +">>>" #: ../../whatsnew/2.4.rst:674 msgid "" @@ -1088,6 +1231,10 @@ msgid "" " CGIXMLRPCRequestHandler,\\\n" " resolve_dotted_attribute" msgstr "" +"from SimpleXMLRPCServer import SimpleXMLRPCServer,\\\n" +" SimpleXMLRPCRequestHandler,\\\n" +" CGIXMLRPCRequestHandler,\\\n" +" resolve_dotted_attribute" #: ../../whatsnew/2.4.rst:713 msgid "" @@ -1103,6 +1250,10 @@ msgid "" " CGIXMLRPCRequestHandler,\n" " resolve_dotted_attribute)" msgstr "" +"from SimpleXMLRPCServer import (SimpleXMLRPCServer,\n" +" SimpleXMLRPCRequestHandler,\n" +" CGIXMLRPCRequestHandler,\n" +" resolve_dotted_attribute)" #: ../../whatsnew/2.4.rst:722 msgid "" @@ -1156,8 +1307,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:756 msgid "" -"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts a :c:expr:" -"`double` to an ASCII string." +"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts " +"a :c:expr:`double` to an ASCII string." msgstr "" #: ../../whatsnew/2.4.rst:759 @@ -1165,9 +1316,9 @@ msgid "" "The code for these functions came from the GLib library (`https://developer-" "old.gnome.org/glib/2.26/ <http://web.archive.org/web/20210306104320/https://" "developer.gnome.org/glib/2.26/>`__), whose developers kindly relicensed the " -"relevant functions and donated them to the Python Software Foundation. The :" -"mod:`locale` module can now change the numeric locale, letting extensions " -"such as GTK+ produce the correct results." +"relevant functions and donated them to the Python Software Foundation. " +"The :mod:`locale` module can now change the numeric locale, letting " +"extensions such as GTK+ produce the correct results." msgstr "" #: ../../whatsnew/2.4.rst:768 @@ -1216,9 +1367,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:792 msgid "" -"The :meth:`dict.update` method now accepts the same argument forms as the :" -"class:`dict` constructor. This includes any mapping, any iterable of key/" -"value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" +"The :meth:`dict.update` method now accepts the same argument forms as " +"the :class:`dict` constructor. This includes any mapping, any iterable of " +"key/value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:796 @@ -1230,9 +1381,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:800 msgid "" -"Strings also gained an :meth:`rsplit` method that works like the :meth:" -"`split` method but splits from the end of the string. (Contributed by Sean " -"Reifschneider.) ::" +"Strings also gained an :meth:`rsplit` method that works like " +"the :meth:`split` method but splits from the end of the string. " +"(Contributed by Sean Reifschneider.) ::" msgstr "" #: ../../whatsnew/2.4.rst:804 @@ -1242,12 +1393,16 @@ msgid "" "'www.python.org'.rsplit('.', 1)\n" "['www.python', 'org']" msgstr "" +">>> 'www.python.org'.split('.', 1)\n" +"['www', 'python.org']\n" +"'www.python.org'.rsplit('.', 1)\n" +"['www.python', 'org']" #: ../../whatsnew/2.4.rst:809 msgid "" -"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the :" -"meth:`sort` method of lists. These parameters make some common usages of :" -"meth:`sort` simpler. All of these parameters are optional." +"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to " +"the :meth:`sort` method of lists. These parameters make some common usages " +"of :meth:`sort` simpler. All of these parameters are optional." msgstr "" #: ../../whatsnew/2.4.rst:813 @@ -1255,8 +1410,8 @@ msgid "" "For the *cmp* parameter, the value should be a comparison function that " "takes two parameters and returns -1, 0, or +1 depending on how the " "parameters compare. This function will then be used to sort the list. " -"Previously this was the only parameter that could be provided to :meth:" -"`sort`." +"Previously this was the only parameter that could be provided " +"to :meth:`sort`." msgstr "" #: ../../whatsnew/2.4.rst:818 @@ -1308,8 +1463,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:849 msgid "" "Finally, the *reverse* parameter takes a Boolean value. If the value is " -"true, the list will be sorted into reverse order. Instead of ``L.sort(); L." -"reverse()``, you can now write ``L.sort(reverse=True)``." +"true, the list will be sorted into reverse order. Instead of ``L.sort(); " +"L.reverse()``, you can now write ``L.sort(reverse=True)``." msgstr "" #: ../../whatsnew/2.4.rst:853 @@ -1373,8 +1528,8 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.4.rst:894 ../../whatsnew/2.4.rst:1520 msgid "" -"Integer operations will no longer trigger an :exc:`OverflowWarning`. The :" -"exc:`OverflowWarning` warning will disappear in Python 2.5." +"Integer operations will no longer trigger an :exc:`OverflowWarning`. " +"The :exc:`OverflowWarning` warning will disappear in Python 2.5." msgstr "" #: ../../whatsnew/2.4.rst:897 @@ -1396,9 +1551,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:907 msgid "" "The :func:`zip` built-in function and :func:`itertools.izip` now return an " -"empty list if called with no arguments. Previously they raised a :exc:" -"`TypeError` exception. This makes them more suitable for use with variable " -"length argument lists::" +"empty list if called with no arguments. Previously they raised " +"a :exc:`TypeError` exception. This makes them more suitable for use with " +"variable length argument lists::" msgstr "" #: ../../whatsnew/2.4.rst:912 @@ -1434,36 +1589,38 @@ msgstr "最佳化" msgid "" "The inner loops for list and tuple slicing were optimized and now run about " "one-third faster. The inner loops for dictionaries were also optimized, " -"resulting in performance boosts for :meth:`keys`, :meth:`values`, :meth:" -"`items`, :meth:`iterkeys`, :meth:`itervalues`, and :meth:`iteritems`. " -"(Contributed by Raymond Hettinger.)" +"resulting in performance boosts " +"for :meth:`keys`, :meth:`values`, :meth:`items`, :meth:`iterkeys`, :meth:`itervalues`, " +"and :meth:`iteritems`. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:942 msgid "" "The machinery for growing and shrinking lists was optimized for speed and " "for space efficiency. Appending and popping from lists now runs faster due " -"to more efficient code paths and less frequent use of the underlying system :" -"c:func:`realloc`. List comprehensions also benefit. :meth:`list.extend` " -"was also optimized and no longer converts its argument into a temporary list " -"before extending the base list. (Contributed by Raymond Hettinger.)" +"to more efficient code paths and less frequent use of the underlying " +"system :c:func:`realloc`. List comprehensions also " +"benefit. :meth:`list.extend` was also optimized and no longer converts its " +"argument into a temporary list before extending the base list. (Contributed " +"by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:949 msgid "" ":func:`list`, :func:`tuple`, :func:`map`, :func:`filter`, and :func:`zip` " -"now run several times faster with non-sequence arguments that supply a :meth:" -"`__len__` method. (Contributed by Raymond Hettinger.)" +"now run several times faster with non-sequence arguments that supply " +"a :meth:`__len__` method. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:953 msgid "" -"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, and :meth:" -"`dict.__contains__` are now implemented as :class:`method_descriptor` " -"objects rather than :class:`wrapper_descriptor` objects. This form of " -"access doubles their performance and makes them more suitable for use as " -"arguments to functionals: ``map(mydict.__getitem__, keylist)``. (Contributed " -"by Raymond Hettinger.)" +"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, " +"and :meth:`dict.__contains__` are now implemented " +"as :class:`method_descriptor` objects rather " +"than :class:`wrapper_descriptor` objects. This form of access doubles " +"their performance and makes them more suitable for use as arguments to " +"functionals: ``map(mydict.__getitem__, keylist)``. (Contributed by Raymond " +"Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:960 @@ -1612,18 +1769,18 @@ msgstr "" msgid "" "The :mod:`ConfigParser <configparser>` classes have been enhanced slightly. " "The :meth:`~configparser.ConfigParser.read` method now returns a list of the " -"files that were successfully parsed, and the :meth:`~configparser." -"ConfigParser.set` method raises :exc:`TypeError` if passed a *value* " -"argument that isn't a string. (Contributed by John Belmonte and David " -"Goodger.)" +"files that were successfully parsed, and " +"the :meth:`~configparser.ConfigParser.set` method raises :exc:`TypeError` if " +"passed a *value* argument that isn't a string. (Contributed by John " +"Belmonte and David Goodger.)" msgstr "" #: ../../whatsnew/2.4.rst:1060 msgid "" -"The :mod:`curses` module now supports the ncurses extension :func:" -"`use_default_colors`. On platforms where the terminal supports " -"transparency, this makes it possible to use a transparent background. " -"(Contributed by Jörg Lehmann.)" +"The :mod:`curses` module now supports the ncurses " +"extension :func:`use_default_colors`. On platforms where the terminal " +"supports transparency, this makes it possible to use a transparent " +"background. (Contributed by Jörg Lehmann.)" msgstr "" #: ../../whatsnew/2.4.rst:1065 @@ -1649,19 +1806,19 @@ msgstr "" msgid "" "The :mod:`heapq` module has been converted to C. The resulting tenfold " "improvement in speed makes the module suitable for handling high volumes of " -"data. In addition, the module has two new functions :func:`nlargest` and :" -"func:`nsmallest` that use heaps to find the N largest or smallest values in " -"a dataset without the expense of a full sort. (Contributed by Raymond " -"Hettinger.)" +"data. In addition, the module has two new functions :func:`nlargest` " +"and :func:`nsmallest` that use heaps to find the N largest or smallest " +"values in a dataset without the expense of a full sort. (Contributed by " +"Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:1084 msgid "" "The :mod:`httplib <http>` module now contains constants for HTTP status " "codes defined in various HTTP-related RFC documents. Constants have names " -"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, and :const:" -"`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed by Andrew " -"Eland.)" +"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, " +"and :const:`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed " +"by Andrew Eland.)" msgstr "" #: ../../whatsnew/2.4.rst:1090 @@ -1703,12 +1860,23 @@ msgid "" "0 [12, 14]\n" ">>>" msgstr "" +">>> import itertools\n" +">>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]\n" +">>> for key_val, it in itertools.groupby(L, lambda x: x % 2):\n" +"... print key_val, list(it)\n" +"...\n" +"0 [2, 4, 6]\n" +"1 [7]\n" +"0 [8]\n" +"1 [9, 11]\n" +"0 [12, 14]\n" +">>>" #: ../../whatsnew/2.4.rst:1118 msgid "" -":func:`groupby` is typically used with sorted input. The logic for :func:" -"`groupby` is similar to the Unix ``uniq`` filter which makes it handy for " -"eliminating, counting, or identifying duplicate elements::" +":func:`groupby` is typically used with sorted input. The logic " +"for :func:`groupby` is similar to the Unix ``uniq`` filter which makes it " +"handy for eliminating, counting, or identifying duplicate elements::" msgstr "" #: ../../whatsnew/2.4.rst:1122 @@ -1771,19 +1939,19 @@ msgstr "" #: ../../whatsnew/2.4.rst:1165 msgid "" -"A number of functions were added to the :mod:`locale` module, such as :func:" -"`bind_textdomain_codeset` to specify a particular encoding and a family of :" -"func:`!l\\*gettext` functions that return messages in the chosen encoding. " -"(Contributed by Gustavo Niemeyer.)" +"A number of functions were added to the :mod:`locale` module, such " +"as :func:`bind_textdomain_codeset` to specify a particular encoding and a " +"family of :func:`!l\\*gettext` functions that return messages in the chosen " +"encoding. (Contributed by Gustavo Niemeyer.)" msgstr "" #: ../../whatsnew/2.4.rst:1170 msgid "" -"Some keyword arguments were added to the :mod:`logging` package's :func:" -"`basicConfig` function to simplify log configuration. The default behavior " -"is to log messages to standard error, but various keyword arguments can be " -"specified to log to a particular file, change the logging format, or set the " -"logging level. For example::" +"Some keyword arguments were added to the :mod:`logging` " +"package's :func:`basicConfig` function to simplify log configuration. The " +"default behavior is to log messages to standard error, but various keyword " +"arguments can be specified to log to a particular file, change the logging " +"format, or set the logging level. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1176 @@ -1798,15 +1966,15 @@ msgstr "" msgid "" "Other additions to the :mod:`logging` package include a ``log(level, msg)`` " "convenience method, as well as a :class:`TimedRotatingFileHandler` class " -"that rotates its log files at a timed interval. The module already had :" -"class:`RotatingFileHandler`, which rotated logs once the file exceeded a " -"certain size. Both classes derive from a new :class:`BaseRotatingHandler` " +"that rotates its log files at a timed interval. The module already " +"had :class:`RotatingFileHandler`, which rotated logs once the file exceeded " +"a certain size. Both classes derive from a new :class:`BaseRotatingHandler` " "class that can be used to implement other rotating handlers." msgstr "" #: ../../whatsnew/2.4.rst:1188 msgid "(Changes implemented by Vinay Sajip.)" -msgstr "" +msgstr "(由 Vinay Sajip 所實作。)" #: ../../whatsnew/2.4.rst:1190 msgid "" @@ -1828,8 +1996,8 @@ msgid "" "Two new functions were added to the :mod:`operator` module, " "``attrgetter(attr)`` and ``itemgetter(index)``. Both functions return " "callables that take a single argument and return the corresponding attribute " -"or item; these callables make excellent data extractors when used with :func:" -"`map` or :func:`sorted`. For example::" +"or item; these callables make excellent data extractors when used " +"with :func:`map` or :func:`sorted`. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1205 @@ -1855,11 +2023,11 @@ msgstr "" #: ../../whatsnew/2.4.rst:1221 msgid "" "The long-term plan is to deprecate the :mod:`!rfc822` module in some future " -"Python release in favor of the :mod:`email` package. To this end, the :func:" -"`email.Utils.formatdate <email.utils.formatdate>` function has been changed " -"to make it usable as a replacement for :func:`!rfc822.formatdate`. You may " -"want to write new e-mail processing code with this in mind. (Change " -"implemented by Anthony Baxter.)" +"Python release in favor of the :mod:`email` package. To this end, " +"the :func:`email.Utils.formatdate <email.utils.formatdate>` function has " +"been changed to make it usable as a replacement for :func:`!" +"rfc822.formatdate`. You may want to write new e-mail processing code with " +"this in mind. (Change implemented by Anthony Baxter.)" msgstr "" #: ../../whatsnew/2.4.rst:1227 @@ -1977,12 +2145,18 @@ msgid "" "data.number = 42\n" "data.url = ('www.python.org', 80)" msgstr "" +"import threading\n" +"\n" +"data = threading.local()\n" +"data.number = 42\n" +"data.url = ('www.python.org', 80)" #: ../../whatsnew/2.4.rst:1298 msgid "" -"Other threads can assign and retrieve their own values for the :attr:" -"`number` and :attr:`url` attributes. You can subclass :class:`local` to " -"initialize attributes or to add methods. (Contributed by Jim Fulton.)" +"Other threads can assign and retrieve their own values for " +"the :attr:`number` and :attr:`url` attributes. You can " +"subclass :class:`local` to initialize attributes or to add methods. " +"(Contributed by Jim Fulton.)" msgstr "" #: ../../whatsnew/2.4.rst:1302 @@ -2037,9 +2211,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:1338 msgid "" -":mod:`urllib2 <urllib.request>` has been changed to interact with :mod:" -"`cookielib <http.cookiejar>`: :class:`HTTPCookieProcessor` manages a cookie " -"jar that is used when accessing URLs." +":mod:`urllib2 <urllib.request>` has been changed to interact " +"with :mod:`cookielib <http.cookiejar>`: :class:`HTTPCookieProcessor` manages " +"a cookie jar that is used when accessing URLs." msgstr "" #: ../../whatsnew/2.4.rst:1342 @@ -2053,9 +2227,9 @@ msgstr "doctest" #: ../../whatsnew/2.4.rst:1350 msgid "" "The :mod:`doctest` module underwent considerable refactoring thanks to " -"Edward Loper and Tim Peters. Testing can still be as simple as running :" -"func:`doctest.testmod`, but the refactorings allow customizing the module's " -"operation in various ways" +"Edward Loper and Tim Peters. Testing can still be as simple as " +"running :func:`doctest.testmod`, but the refactorings allow customizing the " +"module's operation in various ways" msgstr "" #: ../../whatsnew/2.4.rst:1355 @@ -2094,6 +2268,11 @@ msgid "" "\n" "runner.summarize(verbose=1)" msgstr "" +"runner = doctest.DocTestRunner()\n" +"for t in tests:\n" +" tried, failed = runner.run(t)\n" +"\n" +"runner.summarize(verbose=1)" #: ../../whatsnew/2.4.rst:1380 msgid "The above example produces the following output::" @@ -2107,6 +2286,11 @@ msgid "" "2 passed and 0 failed.\n" "Test passed." msgstr "" +"1 items passed all tests:\n" +" 2 tests in f\n" +"2 tests in 1 items.\n" +"2 passed and 0 failed.\n" +"Test passed." #: ../../whatsnew/2.4.rst:1388 msgid "" @@ -2132,6 +2316,11 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def o (n):\n" +" \"\"\">>> o(1)\n" +"<__main__.C instance at 0x...>\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1404 msgid "Another special string, ``<BLANKLINE>``, matches a blank line::" @@ -2145,13 +2334,18 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def p (n):\n" +" \"\"\">>> p(1)\n" +"<BLANKLINE>\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1412 msgid "" "Another new capability is producing a diff-style display of the output by " -"specifying the :const:`doctest.REPORT_UDIFF` (unified diffs), :const:" -"`doctest.REPORT_CDIFF` (context diffs), or :const:`doctest.REPORT_NDIFF` " -"(delta-style) option flags. For example::" +"specifying the :const:`doctest.REPORT_UDIFF` (unified " +"diffs), :const:`doctest.REPORT_CDIFF` (context diffs), " +"or :const:`doctest.REPORT_NDIFF` (delta-style) option flags. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1417 @@ -2188,10 +2382,21 @@ msgid "" " +rather\n" "**********************************************************************" msgstr "" +"**********************************************************************\n" +"File \"t.py\", line 15, in g\n" +"Failed example:\n" +" g(4)\n" +"Differences (unified diff with -expected +actual):\n" +" @@ -2,3 +2,3 @@\n" +" is\n" +" a\n" +" -lengthy\n" +" +rather\n" +"**********************************************************************" #: ../../whatsnew/2.4.rst:1449 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.4.rst:1451 msgid "Some of the changes to Python's build process and to the C API are:" @@ -2240,9 +2445,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:1476 msgid "" -"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same as :c:" -"func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of " -"a number of arguments. (Contributed by Greg Chapman.)" +"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same " +"as :c:func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` " +"instead of a number of arguments. (Contributed by Greg Chapman.)" msgstr "" #: ../../whatsnew/2.4.rst:1480 @@ -2256,20 +2461,20 @@ msgstr "" #: ../../whatsnew/2.4.rst:1485 msgid "" "Python can now be built with additional profiling for the interpreter " -"itself, intended as an aid to people developing the Python core. Providing :" -"option:`!--enable-profiling` to the :program:`configure` script will let you " -"profile the interpreter with :program:`gprof`, and providing the :option:`!--" -"with-tsc` switch enables profiling using the Pentium's Time-Stamp-Counter " -"register. Note that the :option:`!--with-tsc` switch is slightly misnamed, " -"because the profiling feature also works on the PowerPC platform, though " -"that processor architecture doesn't call that register \"the TSC " -"register\". (Contributed by Jeremy Hylton.)" +"itself, intended as an aid to people developing the Python core. " +"Providing :option:`!--enable-profiling` to the :program:`configure` script " +"will let you profile the interpreter with :program:`gprof`, and providing " +"the :option:`!--with-tsc` switch enables profiling using the Pentium's Time-" +"Stamp-Counter register. Note that the :option:`!--with-tsc` switch is " +"slightly misnamed, because the profiling feature also works on the PowerPC " +"platform, though that processor architecture doesn't call that register " +"\"the TSC register\". (Contributed by Jeremy Hylton.)" msgstr "" #: ../../whatsnew/2.4.rst:1495 msgid "" -"The :c:type:`!tracebackobject` type has been renamed to :c:type:" -"`PyTracebackObject`." +"The :c:type:`!tracebackobject` type has been renamed " +"to :c:type:`PyTracebackObject`." msgstr "" #: ../../whatsnew/2.4.rst:1502 @@ -2354,8 +2559,8 @@ msgstr "" msgid "" "The :func:`signals.signal` function now raises a :exc:`RuntimeError` " "exception for certain illegal values; previously these errors would pass " -"silently. For example, you can no longer set a handler on the :const:" -"`SIGKILL` signal." +"silently. For example, you can no longer set a handler on " +"the :const:`SIGKILL` signal." msgstr "" #: ../../whatsnew/2.4.rst:1560 diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index e426c7db93..dc93ea0d80 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -55,10 +55,10 @@ msgid "" "statement will make writing cleanup code easier (section :ref:`pep-343`). " "Values can now be passed into generators (section :ref:`pep-342`). Imports " "are now visible as either absolute or relative (section :ref:`pep-328`). " -"Some corner cases of exception handling are handled better (section :ref:" -"`pep-341`). All these improvements are worthwhile, but they're improvements " -"to one specific language feature or another; none of them are broad " -"modifications to Python's semantics." +"Some corner cases of exception handling are handled better " +"(section :ref:`pep-341`). All these improvements are worthwhile, but " +"they're improvements to one specific language feature or another; none of " +"them are broad modifications to Python's semantics." msgstr "" #: ../../whatsnew/2.5.rst:34 @@ -252,8 +252,8 @@ msgstr "" msgid "" "Here's another example, from a program that uses PyGTK. Here a context-" "sensitive pop-up menu is being constructed dynamically. The callback " -"provided for the menu option is a partially applied version of the :meth:" -"`open_item` method, where the first argument has been provided. ::" +"provided for the menu option is a partially applied version of " +"the :meth:`open_item` method, where the first argument has been provided. ::" msgstr "" #: ../../whatsnew/2.5.rst:165 @@ -442,8 +442,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:274 msgid "" -"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` and :" -"mod:`pkg.string` submodules." +"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` " +"and :mod:`pkg.string` submodules." msgstr "" #: ../../whatsnew/2.5.rst:277 @@ -451,9 +451,9 @@ msgid "" "Consider the code in the :file:`main.py` module. What happens if it " "executes the statement ``import string``? In Python 2.4 and earlier, it " "will first look in the package's directory to perform a relative import, " -"finds :file:`pkg/string.py`, imports the contents of that file as the :mod:" -"`pkg.string` module, and that module is bound to the name ``string`` in the :" -"mod:`pkg.main` module's namespace." +"finds :file:`pkg/string.py`, imports the contents of that file as " +"the :mod:`pkg.string` module, and that module is bound to the name " +"``string`` in the :mod:`pkg.main` module's namespace." msgstr "" #: ../../whatsnew/2.5.rst:284 @@ -470,11 +470,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:292 msgid "" "Reading code which relies on relative imports is also less clear, because a " -"reader may be confused about which module, :mod:`string` or :mod:`pkg." -"string`, is intended to be used. Python users soon learned not to duplicate " -"the names of standard library modules in the names of their packages' " -"submodules, but you can't protect against having your submodule's name being " -"used for a new module added in a future version of Python." +"reader may be confused about which module, :mod:`string` " +"or :mod:`pkg.string`, is intended to be used. Python users soon learned not " +"to duplicate the names of standard library modules in the names of their " +"packages' submodules, but you can't protect against having your submodule's " +"name being used for a new module added in a future version of Python." msgstr "" #: ../../whatsnew/2.5.rst:299 @@ -505,10 +505,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:315 msgid "" "This imports the :mod:`string` module relative to the current package, so " -"in :mod:`pkg.main` this will import *name1* and *name2* from :mod:`pkg." -"string`. Additional leading periods perform the relative import starting " -"from the parent of the current package. For example, code in the :mod:`A.B." -"C` module can do::" +"in :mod:`pkg.main` this will import *name1* and *name2* " +"from :mod:`pkg.string`. Additional leading periods perform the relative " +"import starting from the parent of the current package. For example, code " +"in the :mod:`A.B.C` module can do::" msgstr "" #: ../../whatsnew/2.5.rst:320 @@ -559,11 +559,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:349 msgid "" "The :mod:`runpy` module implements a more sophisticated import mechanism so " -"that it's now possible to run modules in a package such as :mod:`pychecker." -"checker`. The module also supports alternative import mechanisms such as " -"the :mod:`zipimport` module. This means you can add a .zip archive's path " -"to ``sys.path`` and then use the :option:`-m` switch to execute code from " -"the archive." +"that it's now possible to run modules in a package such " +"as :mod:`pychecker.checker`. The module also supports alternative import " +"mechanisms such as the :mod:`zipimport` module. This means you can add " +"a .zip archive's path to ``sys.path`` and then use the :option:`-m` switch " +"to execute code from the archive." msgstr "" #: ../../whatsnew/2.5.rst:359 @@ -624,10 +624,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:393 msgid "" "The code in *block-1* is executed. If the code raises an exception, the " -"various :keyword:`except` blocks are tested: if the exception is of class :" -"class:`Exception1`, *handler-1* is executed; otherwise if it's of class :" -"class:`Exception2`, *handler-2* is executed, and so forth. If no exception " -"is raised, the *else-block* is executed." +"various :keyword:`except` blocks are tested: if the exception is of " +"class :class:`Exception1`, *handler-1* is executed; otherwise if it's of " +"class :class:`Exception2`, *handler-2* is executed, and so forth. If no " +"exception is raised, the *else-block* is executed." msgstr "" #: ../../whatsnew/2.5.rst:399 @@ -711,8 +711,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:451 msgid "" -"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ -" -"expression must always be parenthesized except when it occurs at the top-" +"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ " +"-expression must always be parenthesized except when it occurs at the top-" "level expression on the right-hand side of an assignment. This means you " "can write ``val = yield i`` but have to use parentheses when there's an " "operation, as in ``val = (yield i) + 12``.)" @@ -722,8 +722,8 @@ msgstr "" msgid "" "Values are sent into a generator by calling its ``send(value)`` method. The " "generator's code is then resumed and the :keyword:`yield` expression returns " -"the specified *value*. If the regular :meth:`next` method is called, the :" -"keyword:`!yield` returns :const:`None`." +"the specified *value*. If the regular :meth:`next` method is called, " +"the :keyword:`!yield` returns :const:`None`." msgstr "" #: ../../whatsnew/2.5.rst:463 @@ -805,19 +805,19 @@ msgstr "" msgid "" ":meth:`close` raises a new :exc:`GeneratorExit` exception inside the " "generator to terminate the iteration. On receiving this exception, the " -"generator's code must either raise :exc:`GeneratorExit` or :exc:" -"`StopIteration`. Catching the :exc:`GeneratorExit` exception and returning " -"a value is illegal and will trigger a :exc:`RuntimeError`; if the function " -"raises some other exception, that exception is propagated to the caller. :" -"meth:`close` will also be called by Python's garbage collector when the " -"generator is garbage-collected." +"generator's code must either raise :exc:`GeneratorExit` " +"or :exc:`StopIteration`. Catching the :exc:`GeneratorExit` exception and " +"returning a value is illegal and will trigger a :exc:`RuntimeError`; if the " +"function raises some other exception, that exception is propagated to the " +"caller. :meth:`close` will also be called by Python's garbage collector " +"when the generator is garbage-collected." msgstr "" #: ../../whatsnew/2.5.rst:512 msgid "" "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " -"suggest using a ``try: ... finally:`` suite instead of catching :exc:" -"`GeneratorExit`." +"suggest using a ``try: ... finally:`` suite instead of " +"catching :exc:`GeneratorExit`." msgstr "" #: ../../whatsnew/2.5.rst:515 @@ -842,21 +842,22 @@ msgid "" "obvious. :meth:`close` is called when a generator is garbage-collected, so " "this means the generator's code gets one last chance to run before the " "generator is destroyed. This last chance means that ``try...finally`` " -"statements in generators can now be guaranteed to work; the :keyword:" -"`finally` clause will now always get a chance to run. The syntactic " -"restriction that you couldn't mix :keyword:`yield` statements with a ``try..." -"finally`` suite has therefore been removed. This seems like a minor bit of " -"language trivia, but using generators and ``try...finally`` is actually " -"necessary in order to implement the :keyword:`with` statement described by :" -"pep:`343`. I'll look at this new statement in the following section." +"statements in generators can now be guaranteed to work; " +"the :keyword:`finally` clause will now always get a chance to run. The " +"syntactic restriction that you couldn't mix :keyword:`yield` statements with " +"a ``try...finally`` suite has therefore been removed. This seems like a " +"minor bit of language trivia, but using generators and ``try...finally`` is " +"actually necessary in order to implement the :keyword:`with` statement " +"described by :pep:`343`. I'll look at this new statement in the following " +"section." msgstr "" #: ../../whatsnew/2.5.rst:536 msgid "" -"Another even more esoteric effect of this change: previously, the :attr:" -"`gi_frame` attribute of a generator was always a frame object. It's now " -"possible for :attr:`gi_frame` to be ``None`` once the generator has been " -"exhausted." +"Another even more esoteric effect of this change: previously, " +"the :attr:`gi_frame` attribute of a generator was always a frame object. " +"It's now possible for :attr:`gi_frame` to be ``None`` once the generator has " +"been exhausted." msgstr "" #: ../../whatsnew/2.5.rst:544 @@ -925,8 +926,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:577 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.5.rst:581 @@ -939,9 +940,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:586 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" #: ../../whatsnew/2.5.rst:590 @@ -982,8 +983,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:611 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" #: ../../whatsnew/2.5.rst:614 @@ -1047,8 +1048,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:654 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.5.rst:658 @@ -1065,12 +1066,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:664 msgid "" "If *BLOCK* raises an exception, the ``__exit__(type, value, traceback)`` is " -"called with the exception details, the same values returned by :func:`sys." -"exc_info`. The method's return value controls whether the exception is re-" -"raised: any false value re-raises the exception, and ``True`` will result in " -"suppressing it. You'll only rarely want to suppress the exception, because " -"if you do the author of the code containing the ':keyword:`with`' statement " -"will never realize anything went wrong." +"called with the exception details, the same values returned " +"by :func:`sys.exc_info`. The method's return value controls whether the " +"exception is re-raised: any false value re-raises the exception, and " +"``True`` will result in suppressing it. You'll only rarely want to suppress " +"the exception, because if you do the author of the code containing the " +"':keyword:`with`' statement will never realize anything went wrong." msgstr "" #: ../../whatsnew/2.5.rst:672 @@ -1112,8 +1113,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:693 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" #: ../../whatsnew/2.5.rst:697 @@ -1194,8 +1195,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -1327,12 +1328,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:828 msgid "" "This rearrangement was done because people often want to catch all " -"exceptions that indicate program errors. :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit` aren't errors, though, and usually represent an explicit action " -"such as the user hitting :kbd:`Control-C` or code calling :func:`sys.exit`. " -"A bare ``except:`` will catch all exceptions, so you commonly need to list :" -"exc:`KeyboardInterrupt` and :exc:`SystemExit` in order to re-raise them. " -"The usual pattern is::" +"exceptions that indicate program errors. :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit` aren't errors, though, and usually represent an " +"explicit action such as the user hitting :kbd:`Control-C` or code " +"calling :func:`sys.exit`. A bare ``except:`` will catch all exceptions, so " +"you commonly need to list :exc:`KeyboardInterrupt` and :exc:`SystemExit` in " +"order to re-raise them. The usual pattern is::" msgstr "" #: ../../whatsnew/2.5.rst:835 @@ -1410,9 +1411,9 @@ msgstr "" msgid "" "A limit of 2147483647 items doesn't really matter on a 32-bit platform " "because you'll run out of memory before hitting the length limit. Each list " -"item requires space for a pointer, which is 4 bytes, plus space for a :c:" -"type:`PyObject` representing the item. 2147483647\\*4 is already more bytes " -"than a 32-bit address space can contain." +"item requires space for a pointer, which is 4 bytes, plus space for " +"a :c:type:`PyObject` representing the item. 2147483647\\*4 is already more " +"bytes than a 32-bit address space can contain." msgstr "" #: ../../whatsnew/2.5.rst:894 @@ -1431,19 +1432,21 @@ msgstr "" #: ../../whatsnew/2.5.rst:904 msgid "" "This change most strongly affects authors of C extension modules. Python " -"strings and container types such as lists and tuples now use :c:type:" -"`Py_ssize_t` to store their size. Functions such as :c:func:`PyList_Size` " -"now return :c:type:`Py_ssize_t`. Code in extension modules may therefore " -"need to have some variables changed to :c:type:`Py_ssize_t`." +"strings and container types such as lists and tuples now " +"use :c:type:`Py_ssize_t` to store their size. Functions such " +"as :c:func:`PyList_Size` now return :c:type:`Py_ssize_t`. Code in " +"extension modules may therefore need to have some variables changed " +"to :c:type:`Py_ssize_t`." msgstr "" #: ../../whatsnew/2.5.rst:910 msgid "" "The :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` functions have a " -"new conversion code, ``n``, for :c:type:`Py_ssize_t`. :c:func:" -"`PyArg_ParseTuple`'s ``s#`` and ``t#`` still output :c:expr:`int` by " -"default, but you can define the macro :c:macro:`PY_SSIZE_T_CLEAN` before " -"including :file:`Python.h` to make them return :c:type:`Py_ssize_t`." +"new conversion code, ``n``, " +"for :c:type:`Py_ssize_t`. :c:func:`PyArg_ParseTuple`'s ``s#`` and ``t#`` " +"still output :c:expr:`int` by default, but you can define the " +"macro :c:macro:`PY_SSIZE_T_CLEAN` before including :file:`Python.h` to " +"make them return :c:type:`Py_ssize_t`." msgstr "" #: ../../whatsnew/2.5.rst:916 @@ -1478,9 +1481,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:941 msgid "" "Slicing can't just use the existing :meth:`__int__` method because that " -"method is also used to implement coercion to integers. If slicing used :" -"meth:`__int__`, floating-point numbers would also become legal slice indexes " -"and that's clearly an undesirable behaviour." +"method is also used to implement coercion to integers. If slicing " +"used :meth:`__int__`, floating-point numbers would also become legal slice " +"indexes and that's clearly an undesirable behaviour." msgstr "" #: ../../whatsnew/2.5.rst:946 @@ -1503,8 +1506,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:953 msgid "" "The return value must be either a Python integer or long integer. The " -"interpreter will check that the type returned is correct, and raises a :exc:" -"`TypeError` if this requirement isn't met." +"interpreter will check that the type returned is correct, and raises " +"a :exc:`TypeError` if this requirement isn't met." msgstr "" #: ../../whatsnew/2.5.rst:957 @@ -1538,9 +1541,9 @@ msgid "" "The :class:`dict` type has a new hook for letting subclasses provide a " "default value when a key isn't contained in the dictionary. When a key isn't " "found, the dictionary's ``__missing__(key)`` method will be called. This " -"hook is used to implement the new :class:`defaultdict` class in the :mod:" -"`collections` module. The following example defines a dictionary that " -"returns zero for any missing key::" +"hook is used to implement the new :class:`defaultdict` class in " +"the :mod:`collections` module. The following example defines a dictionary " +"that returns zero for any missing key::" msgstr "" #: ../../whatsnew/2.5.rst:985 @@ -1657,11 +1660,11 @@ msgstr "(由 Steven Bethard 和 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.5.rst:1045 msgid "" "Two new built-in functions, :func:`any` and :func:`all`, evaluate whether an " -"iterator contains any true or false values. :func:`any` returns :const:" -"`True` if any value returned by the iterator is true; otherwise it will " -"return :const:`False`. :func:`all` returns :const:`True` only if all of the " -"values returned by the iterator evaluate as true. (Suggested by Guido van " -"Rossum, and implemented by Raymond Hettinger.)" +"iterator contains any true or false values. :func:`any` " +"returns :const:`True` if any value returned by the iterator is true; " +"otherwise it will return :const:`False`. :func:`all` returns :const:`True` " +"only if all of the values returned by the iterator evaluate as true. " +"(Suggested by Guido van Rossum, and implemented by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1052 @@ -1670,8 +1673,8 @@ msgid "" "integer or a regular integer. If a long integer is returned, the hash of " "that value is taken. In earlier versions the hash value was required to be " "a regular integer, but in 2.5 the :func:`id` built-in was changed to always " -"return non-negative numbers, and users often seem to use ``id(self)`` in :" -"meth:`__hash__` methods (though this is discouraged)." +"return non-negative numbers, and users often seem to use ``id(self)`` " +"in :meth:`__hash__` methods (though this is discouraged)." msgstr "" #: ../../whatsnew/2.5.rst:1061 @@ -1732,12 +1735,12 @@ msgid "" "One error that Python programmers sometimes make is forgetting to include " "an :file:`__init__.py` module in a package directory. Debugging this mistake " "can be confusing, and usually requires running Python with the :option:`-v` " -"switch to log all the paths searched. In Python 2.5, a new :exc:" -"`ImportWarning` warning is triggered when an import would have picked up a " -"directory as a package but no :file:`__init__.py` was found. This warning " -"is silently ignored by default; provide the :option:`-Wd <-W>` option when " -"running the Python executable to display the warning message. (Implemented " -"by Thomas Wouters.)" +"switch to log all the paths searched. In Python 2.5, a " +"new :exc:`ImportWarning` warning is triggered when an import would have " +"picked up a directory as a package but no :file:`__init__.py` was found. " +"This warning is silently ignored by default; provide the :option:`-Wd <-W>` " +"option when running the Python executable to display the warning message. " +"(Implemented by Thomas Wouters.)" msgstr "" #: ../../whatsnew/2.5.rst:1102 @@ -1807,11 +1810,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1147 msgid "" -"When they were introduced in Python 2.4, the built-in :class:`set` and :" -"class:`frozenset` types were built on top of Python's dictionary type. In " -"2.5 the internal data structure has been customized for implementing sets, " -"and as a result sets will use a third less memory and are somewhat faster. " -"(Implemented by Raymond Hettinger.)" +"When they were introduced in Python 2.4, the built-in :class:`set` " +"and :class:`frozenset` types were built on top of Python's dictionary " +"type. In 2.5 the internal data structure has been customized for " +"implementing sets, and as a result sets will use a third less memory and are " +"somewhat faster. (Implemented by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1153 @@ -1838,8 +1841,8 @@ msgid "" "methods. Iteration uses an internal buffer and the :meth:`!read\\*` " "methods don't use that buffer. Instead they would return the data " "following the buffer, causing the data to appear out of order. Mixing " -"iteration and these methods will now trigger a :exc:`ValueError` from the :" -"meth:`!read\\*` method. (Implemented by Thomas Wouters.)" +"iteration and these methods will now trigger a :exc:`ValueError` from " +"the :meth:`!read\\*` method. (Implemented by Thomas Wouters.)" msgstr "" #: ../../whatsnew/2.5.rst:1178 @@ -1852,8 +1855,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1182 msgid "" "The :mod:`re` module got a 1 or 2% speedup by switching to Python's " -"allocator functions instead of the system's :c:func:`malloc` and :c:func:" -"`free`. (Contributed by Jack Diederich at the NeedForSpeed sprint.)" +"allocator functions instead of the system's :c:func:`malloc` " +"and :c:func:`free`. (Contributed by Jack Diederich at the NeedForSpeed " +"sprint.)" msgstr "" #: ../../whatsnew/2.5.rst:1186 @@ -1911,16 +1915,15 @@ msgstr "" #: ../../whatsnew/2.5.rst:1228 msgid "" -"The :mod:`codecs` module gained support for incremental codecs. The :func:" -"`codec.lookup` function now returns a :class:`CodecInfo` instance instead of " -"a tuple. :class:`CodecInfo` instances behave like a 4-tuple to preserve " -"backward compatibility but also have the attributes :attr:`encode`, :attr:" -"`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:" -"`streamwriter`, and :attr:`streamreader`. Incremental codecs can receive " -"input and produce output in multiple chunks; the output is the same as if " -"the entire input was fed to the non-incremental codec. See the :mod:`codecs` " -"module documentation for details. (Designed and implemented by Walter " -"Dörwald.)" +"The :mod:`codecs` module gained support for incremental codecs. " +"The :func:`codec.lookup` function now returns a :class:`CodecInfo` instance " +"instead of a tuple. :class:`CodecInfo` instances behave like a 4-tuple to " +"preserve backward compatibility but also have the " +"attributes :attr:`encode`, :attr:`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:`streamwriter`, " +"and :attr:`streamreader`. Incremental codecs can receive input and produce " +"output in multiple chunks; the output is the same as if the entire input was " +"fed to the non-incremental codec. See the :mod:`codecs` module documentation " +"for details. (Designed and implemented by Walter Dörwald.)" msgstr "" #: ../../whatsnew/2.5.rst:1240 @@ -1986,10 +1989,11 @@ msgstr "(由 Guido van Rossum 所貢獻。)" #: ../../whatsnew/2.5.rst:1271 msgid "" -"The :class:`deque` double-ended queue type supplied by the :mod:" -"`collections` module now has a ``remove(value)`` method that removes the " -"first occurrence of *value* in the queue, raising :exc:`ValueError` if the " -"value isn't found. (Contributed by Raymond Hettinger.)" +"The :class:`deque` double-ended queue type supplied by " +"the :mod:`collections` module now has a ``remove(value)`` method that " +"removes the first occurrence of *value* in the queue, " +"raising :exc:`ValueError` if the value isn't found. (Contributed by Raymond " +"Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1276 @@ -2022,12 +2026,12 @@ msgstr "" msgid "" "The :mod:`csv` module, which parses files in comma-separated value format, " "received several enhancements and a number of bugfixes. You can now set the " -"maximum size in bytes of a field by calling the ``csv." -"field_size_limit(new_limit)`` function; omitting the *new_limit* argument " -"will return the currently set limit. The :class:`reader` class now has a :" -"attr:`line_num` attribute that counts the number of physical lines read from " -"the source; records can span multiple physical lines, so :attr:`line_num` is " -"not the same as the number of records read." +"maximum size in bytes of a field by calling the " +"``csv.field_size_limit(new_limit)`` function; omitting the *new_limit* " +"argument will return the currently set limit. The :class:`reader` class now " +"has a :attr:`line_num` attribute that counts the number of physical lines " +"read from the source; records can span multiple physical lines, " +"so :attr:`line_num` is not the same as the number of records read." msgstr "" #: ../../whatsnew/2.5.rst:1301 @@ -2083,10 +2087,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1330 msgid "" -"An *encoding* parameter was added to the :func:`testfile` function and the :" -"class:`DocFileSuite` class to specify the file's encoding. This makes it " -"easier to use non-ASCII characters in tests contained within a docstring. " -"(Contributed by Bjorn Tillenius.)" +"An *encoding* parameter was added to the :func:`testfile` function and " +"the :class:`DocFileSuite` class to specify the file's encoding. This makes " +"it easier to use non-ASCII characters in tests contained within a " +"docstring. (Contributed by Bjorn Tillenius.)" msgstr "" #: ../../whatsnew/2.5.rst:1337 @@ -2099,12 +2103,12 @@ msgstr "" msgid "" "The :mod:`fileinput` module was made more flexible. Unicode filenames are " "now supported, and a *mode* parameter that defaults to ``\"r\"`` was added " -"to the :func:`input` function to allow opening files in binary or :term:" -"`universal newlines` mode. Another new parameter, *openhook*, lets you use " -"a function other than :func:`open` to open the input files. Once you're " -"iterating over the set of files, the :class:`FileInput` object's new :meth:" -"`~fileinput.fileno` returns the file descriptor for the currently opened " -"file. (Contributed by Georg Brandl.)" +"to the :func:`input` function to allow opening files in binary " +"or :term:`universal newlines` mode. Another new parameter, *openhook*, lets " +"you use a function other than :func:`open` to open the input files. Once " +"you're iterating over the set of files, the :class:`FileInput` object's " +"new :meth:`~fileinput.fileno` returns the file descriptor for the currently " +"opened file. (Contributed by Georg Brandl.)" msgstr "" #: ../../whatsnew/2.5.rst:1354 @@ -2171,9 +2175,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1393 msgid "" -"To format strings with multiple %char specifiers, use the new :func:" -"`format_string` function that works like :func:`format` but also supports " -"mixing %char specifiers with arbitrary text." +"To format strings with multiple %char specifiers, use the " +"new :func:`format_string` function that works like :func:`format` but also " +"supports mixing %char specifiers with arbitrary text." msgstr "" #: ../../whatsnew/2.5.rst:1397 @@ -2218,9 +2222,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1425 msgid "" -"New module: the :mod:`!msilib` module allows creating Microsoft Installer :" -"file:`.msi` files and CAB files. Some support for reading the :file:`.msi` " -"database is also included. (Contributed by Martin von Löwis.)" +"New module: the :mod:`!msilib` module allows creating Microsoft " +"Installer :file:`.msi` files and CAB files. Some support for reading " +"the :file:`.msi` database is also included. (Contributed by Martin von " +"Löwis.)" msgstr "" #: ../../whatsnew/2.5.rst:1429 @@ -2233,11 +2238,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1433 msgid "" "The :mod:`operator` module's :func:`itemgetter` and :func:`attrgetter` " -"functions now support multiple fields. A call such as ``operator." -"attrgetter('a', 'b')`` will return a function that retrieves the :attr:`a` " -"and :attr:`b` attributes. Combining this new feature with the :meth:`sort` " -"method's ``key`` parameter lets you easily sort lists using multiple " -"fields. (Contributed by Raymond Hettinger.)" +"functions now support multiple fields. A call such as " +"``operator.attrgetter('a', 'b')`` will return a function that retrieves " +"the :attr:`a` and :attr:`b` attributes. Combining this new feature with " +"the :meth:`sort` method's ``key`` parameter lets you easily sort lists " +"using multiple fields. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1440 @@ -2251,19 +2256,19 @@ msgstr "" #: ../../whatsnew/2.5.rst:1445 msgid "" -"The :mod:`os` module underwent several changes. The :attr:" -"`stat_float_times` variable now defaults to true, meaning that :func:`os." -"stat` will now return time values as floats. (This doesn't necessarily mean " -"that :func:`os.stat` will return times that are precise to fractions of a " -"second; not all systems support such precision.)" +"The :mod:`os` module underwent several changes. " +"The :attr:`stat_float_times` variable now defaults to true, meaning " +"that :func:`os.stat` will now return time values as floats. (This doesn't " +"necessarily mean that :func:`os.stat` will return times that are precise to " +"fractions of a second; not all systems support such precision.)" msgstr "" #: ../../whatsnew/2.5.rst:1451 msgid "" -"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, and :const:`os." -"SEEK_END` have been added; these are the parameters to the :func:`os.lseek` " -"function. Two new constants for locking are :const:`os.O_SHLOCK` and :const:" -"`os.O_EXLOCK`." +"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, " +"and :const:`os.SEEK_END` have been added; these are the parameters to " +"the :func:`os.lseek` function. Two new constants for locking " +"are :const:`os.O_SHLOCK` and :const:`os.O_EXLOCK`." msgstr "" #: ../../whatsnew/2.5.rst:1456 @@ -2281,9 +2286,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1465 msgid "" "On FreeBSD, the :func:`os.stat` function now returns times with nanosecond " -"resolution, and the returned object now has :attr:`st_gen` and :attr:" -"`st_birthtime`. The :attr:`st_flags` attribute is also available, if the " -"platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" +"resolution, and the returned object now has :attr:`st_gen` " +"and :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, " +"if the platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" msgstr "" #: ../../whatsnew/2.5.rst:1472 @@ -2314,9 +2319,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1490 msgid "" -"The pybench benchmark suite by Marc-André Lemburg is now included in the :" -"file:`Tools/pybench` directory. The pybench suite is an improvement on the " -"commonly used :file:`pystone.py` program because pybench provides a more " +"The pybench benchmark suite by Marc-André Lemburg is now included in " +"the :file:`Tools/pybench` directory. The pybench suite is an improvement on " +"the commonly used :file:`pystone.py` program because pybench provides a more " "detailed measurement of the interpreter's speed. It times particular " "operations such as function calls, tuple slicing, method lookups, and " "numeric operations, instead of performing many different operations and " @@ -2342,8 +2347,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1507 msgid "" "The old :mod:`regex` and :mod:`regsub` modules, which have been deprecated " -"ever since Python 2.0, have finally been deleted. Other deleted modules: :" -"mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." +"ever since Python 2.0, have finally been deleted. Other deleted " +"modules: :mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." msgstr "" #: ../../whatsnew/2.5.rst:1511 @@ -2356,9 +2361,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1516 msgid "" -"The :mod:`rlcompleter` module is no longer dependent on importing the :mod:" -"`readline` module and therefore now works on non-Unix platforms. (Patch from " -"Robert Kiendl.)" +"The :mod:`rlcompleter` module is no longer dependent on importing " +"the :mod:`readline` module and therefore now works on non-Unix platforms. " +"(Patch from Robert Kiendl.)" msgstr "" #: ../../whatsnew/2.5.rst:1522 @@ -2375,8 +2380,8 @@ msgid "" "The :mod:`socket` module now supports :const:`AF_NETLINK` sockets on Linux, " "thanks to a patch from Philippe Biondi. Netlink sockets are a Linux-" "specific mechanism for communications between a user-space process and " -"kernel code; an introductory article about them is at https://www." -"linuxjournal.com/article/7356. In Python code, netlink addresses are " +"kernel code; an introductory article about them is at https://" +"www.linuxjournal.com/article/7356. In Python code, netlink addresses are " "represented as a tuple of 2 integers, ``(pid, group_mask)``." msgstr "" @@ -2391,9 +2396,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1541 msgid "" -"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, and :meth:" -"`getproto` accessor methods to retrieve the family, type, and protocol " -"values for the socket." +"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, " +"and :meth:`getproto` accessor methods to retrieve the family, type, and " +"protocol values for the socket." msgstr "" #: ../../whatsnew/2.5.rst:1545 @@ -2404,12 +2409,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:1548 msgid "" -"The :mod:`struct` is now faster because it compiles format strings into :" -"class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. This " -"is similar to how the :mod:`re` module lets you create compiled regular " -"expression objects. You can still use the module-level :func:`pack` and :" -"func:`unpack` functions; they'll create :class:`Struct` objects and cache " -"them. Or you can use :class:`Struct` instances directly::" +"The :mod:`struct` is now faster because it compiles format strings " +"into :class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. " +"This is similar to how the :mod:`re` module lets you create compiled regular " +"expression objects. You can still use the module-level :func:`pack` " +"and :func:`unpack` functions; they'll create :class:`Struct` objects and " +"cache them. Or you can use :class:`Struct` instances directly::" msgstr "" #: ../../whatsnew/2.5.rst:1555 @@ -2450,10 +2455,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1575 msgid "" -"This information is also available to C extensions via the :c:func:" -"`Py_GetBuildInfo` function that returns a string of build information like " -"this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. (Contributed by " -"Barry Warsaw.)" +"This information is also available to C extensions via " +"the :c:func:`Py_GetBuildInfo` function that returns a string of build " +"information like this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. " +"(Contributed by Barry Warsaw.)" msgstr "" #: ../../whatsnew/2.5.rst:1580 @@ -2466,11 +2471,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1585 msgid "" -"The :class:`TarFile` class in the :mod:`tarfile` module now has an :meth:" -"`extractall` method that extracts all members from the archive into the " -"current working directory. It's also possible to set a different directory " -"as the extraction target, and to unpack only a subset of the archive's " -"members." +"The :class:`TarFile` class in the :mod:`tarfile` module now has " +"an :meth:`extractall` method that extracts all members from the archive into " +"the current working directory. It's also possible to set a different " +"directory as the extraction target, and to unpack only a subset of the " +"archive's members." msgstr "" #: ../../whatsnew/2.5.rst:1590 @@ -2533,35 +2538,35 @@ msgstr "(由 Ka-Ping Yee 所貢獻。)" #: ../../whatsnew/2.5.rst:1634 msgid "" -"The :mod:`weakref` module's :class:`WeakKeyDictionary` and :class:" -"`WeakValueDictionary` types gained new methods for iterating over the weak " -"references contained in the dictionary. :meth:`iterkeyrefs` and :meth:" -"`keyrefs` methods were added to :class:`WeakKeyDictionary`, and :meth:" -"`itervaluerefs` and :meth:`valuerefs` were added to :class:" -"`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" +"The :mod:`weakref` module's :class:`WeakKeyDictionary` " +"and :class:`WeakValueDictionary` types gained new methods for iterating over " +"the weak references contained in the dictionary. :meth:`iterkeyrefs` " +"and :meth:`keyrefs` methods were added to :class:`WeakKeyDictionary`, " +"and :meth:`itervaluerefs` and :meth:`valuerefs` were added " +"to :class:`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" msgstr "" #: ../../whatsnew/2.5.rst:1641 msgid "" "The :mod:`webbrowser` module received a number of enhancements. It's now " "usable as a script with ``python -m webbrowser``, taking a URL as the " -"argument; there are a number of switches to control the behaviour (:option:" -"`!-n` for a new browser window, :option:`!-t` for a new tab). New module-" -"level functions, :func:`open_new` and :func:`open_new_tab`, were added to " -"support this. The module's :func:`open` function supports an additional " -"feature, an *autoraise* parameter that signals whether to raise the open " -"window when possible. A number of additional browsers were added to the " -"supported list such as Firefox, Opera, Konqueror, and elinks. (Contributed " -"by Oleg Broytmann and Georg Brandl.)" +"argument; there are a number of switches to control the behaviour " +"(:option:`!-n` for a new browser window, :option:`!-t` for a new tab). New " +"module-level functions, :func:`open_new` and :func:`open_new_tab`, were " +"added to support this. The module's :func:`open` function supports an " +"additional feature, an *autoraise* parameter that signals whether to raise " +"the open window when possible. A number of additional browsers were added to " +"the supported list such as Firefox, Opera, Konqueror, and elinks. " +"(Contributed by Oleg Broytmann and Georg Brandl.)" msgstr "" #: ../../whatsnew/2.5.rst:1653 msgid "" -"The :mod:`xmlrpclib <xmlrpc.client>` module now supports returning :class:" -"`~datetime.datetime` objects for the XML-RPC date type. Supply " -"``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function or the :" -"class:`!Unmarshaller` class to enable this feature. (Contributed by Skip " -"Montanaro.)" +"The :mod:`xmlrpclib <xmlrpc.client>` module now supports " +"returning :class:`~datetime.datetime` objects for the XML-RPC date type. " +"Supply ``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function " +"or the :class:`!Unmarshaller` class to enable this feature. (Contributed by " +"Skip Montanaro.)" msgstr "" #: ../../whatsnew/2.5.rst:1660 @@ -2594,10 +2599,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1687 msgid "" -"To load a shared library or DLL, you must create an instance of the :class:" -"`CDLL` class and provide the name or path of the shared library or DLL. Once " -"that's done, you can call arbitrary functions by accessing them as " -"attributes of the :class:`CDLL` object. ::" +"To load a shared library or DLL, you must create an instance of " +"the :class:`CDLL` class and provide the name or path of the shared library " +"or DLL. Once that's done, you can call arbitrary functions by accessing them " +"as attributes of the :class:`CDLL` object. ::" msgstr "" #: ../../whatsnew/2.5.rst:1692 @@ -2614,14 +2619,15 @@ msgstr "" #: ../../whatsnew/2.5.rst:1697 msgid "" -"Type constructors for the various C types are provided: :func:`c_int`, :func:" -"`c_float`, :func:`c_double`, :func:`c_char_p` (equivalent to :c:expr:`char " -"\\*`), and so forth. Unlike Python's types, the C versions are all mutable; " -"you can assign to their :attr:`value` attribute to change the wrapped " -"value. Python integers and strings will be automatically converted to the " -"corresponding C types, but for other types you must call the correct type " -"constructor. (And I mean *must*; getting it wrong will often result in the " -"interpreter crashing with a segmentation fault.)" +"Type constructors for the various C types are " +"provided: :func:`c_int`, :func:`c_float`, :func:`c_double`, :func:`c_char_p` " +"(equivalent to :c:expr:`char \\*`), and so forth. Unlike Python's types, " +"the C versions are all mutable; you can assign to their :attr:`value` " +"attribute to change the wrapped value. Python integers and strings will be " +"automatically converted to the corresponding C types, but for other types " +"you must call the correct type constructor. (And I mean *must*; getting " +"it wrong will often result in the interpreter crashing with a segmentation " +"fault.)" msgstr "" #: ../../whatsnew/2.5.rst:1706 @@ -2644,8 +2650,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1715 msgid "" -"C functions are assumed to return integers, but you can set the :attr:" -"`restype` attribute of the function object to change this::" +"C functions are assumed to return integers, but you can set " +"the :attr:`restype` attribute of the function object to change this::" msgstr "" #: ../../whatsnew/2.5.rst:1718 @@ -2664,12 +2670,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:1724 msgid "" -":mod:`ctypes` also provides a wrapper for Python's C API as the ``ctypes." -"pythonapi`` object. This object does *not* release the global interpreter " -"lock before calling a function, because the lock must be held when calling " -"into the interpreter's code. There's a :class:`~ctypes.py_object` type " -"constructor that will create a :c:expr:`PyObject *` pointer. A simple " -"usage::" +":mod:`ctypes` also provides a wrapper for Python's C API as the " +"``ctypes.pythonapi`` object. This object does *not* release the global " +"interpreter lock before calling a function, because the lock must be held " +"when calling into the interpreter's code. There's " +"a :class:`~ctypes.py_object` type constructor that will create " +"a :c:expr:`PyObject *` pointer. A simple usage::" msgstr "" #: ../../whatsnew/2.5.rst:1730 @@ -2697,10 +2703,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1740 msgid "" ":mod:`ctypes` has been around for a while, but people still write and " -"distribution hand-coded extension modules because you can't rely on :mod:" -"`ctypes` being present. Perhaps developers will begin to write Python " -"wrappers atop a library accessed through :mod:`ctypes` instead of extension " -"modules, now that :mod:`ctypes` is included with core Python." +"distribution hand-coded extension modules because you can't rely " +"on :mod:`ctypes` being present. Perhaps developers will begin to write " +"Python wrappers atop a library accessed through :mod:`ctypes` instead of " +"extension modules, now that :mod:`ctypes` is included with core Python." msgstr "" #: ../../whatsnew/2.5.rst:1749 @@ -2775,8 +2781,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1790 msgid "" -"Once you have an :class:`ElementTree` instance, you can call its :meth:" -"`getroot` method to get the root :class:`Element` node." +"Once you have an :class:`ElementTree` instance, you can call " +"its :meth:`getroot` method to get the root :class:`Element` node." msgstr "" #: ../../whatsnew/2.5.rst:1793 @@ -2912,8 +2918,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1837 msgid "" -"Comments and processing instructions are also represented as :class:" -"`Element` nodes. To check if a node is a comment or processing " +"Comments and processing instructions are also represented " +"as :class:`Element` nodes. To check if a node is a comment or processing " "instructions::" msgstr "" @@ -3222,9 +3228,9 @@ msgstr "wsgiref 套件" #: ../../whatsnew/2.5.rst:2042 msgid "" "The Web Server Gateway Interface (WSGI) v1.0 defines a standard interface " -"between web servers and Python web applications and is described in :pep:" -"`333`. The :mod:`wsgiref` package is a reference implementation of the WSGI " -"specification." +"between web servers and Python web applications and is described " +"in :pep:`333`. The :mod:`wsgiref` package is a reference implementation of " +"the WSGI specification." msgstr "" #: ../../whatsnew/2.5.rst:2049 @@ -3276,11 +3282,11 @@ msgstr "由 Phillip J. Eby 撰寫 PEP。" #: ../../whatsnew/2.5.rst:2080 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.5.rst:2082 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.5.rst:2084 msgid "" @@ -3301,9 +3307,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2094 msgid "" "The largest change to the C API came from :pep:`353`, which modifies the " -"interpreter to use a :c:type:`Py_ssize_t` type definition instead of :c:expr:" -"`int`. See the earlier section :ref:`pep-353` for a discussion of this " -"change." +"interpreter to use a :c:type:`Py_ssize_t` type definition instead " +"of :c:expr:`int`. See the earlier section :ref:`pep-353` for a discussion " +"of this change." msgstr "" #: ../../whatsnew/2.5.rst:2099 @@ -3316,9 +3322,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2104 msgid "" -"It's possible for Python code to obtain AST objects by using the :func:" -"`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the value of " -"the *flags* parameter::" +"It's possible for Python code to obtain AST objects by using " +"the :func:`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the " +"value of the *flags* parameter::" msgstr "" #: ../../whatsnew/2.5.rst:2108 @@ -3343,13 +3349,13 @@ msgstr "" #: ../../whatsnew/2.5.rst:2117 msgid "" -"No official documentation has been written for the AST code yet, but :pep:" -"`339` discusses the design. To start learning about the code, read the " -"definition of the various AST nodes in :file:`Parser/Python.asdl`. A Python " -"script reads this file and generates a set of C structure definitions in :" -"file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` and :c:" -"func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, take " -"Python source as input and return the root of an AST representing the " +"No official documentation has been written for the AST code yet, " +"but :pep:`339` discusses the design. To start learning about the code, read " +"the definition of the various AST nodes in :file:`Parser/Python.asdl`. A " +"Python script reads this file and generates a set of C structure definitions " +"in :file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` " +"and :c:func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, " +"take Python source as input and return the root of an AST representing the " "contents. This AST can then be turned into a code object by :c:func:`!" "PyAST_Compile`. For more information, read the source code, and then ask " "questions on python-dev." @@ -3379,31 +3385,32 @@ msgstr "" msgid "" "Note that this change means extension modules must be more careful when " "allocating memory. Python's API has many different functions for allocating " -"memory that are grouped into families. For example, :c:func:" -"`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free` are one " -"family that allocates raw memory, while :c:func:`PyObject_Malloc`, :c:func:" -"`PyObject_Realloc`, and :c:func:`PyObject_Free` are another family that's " -"supposed to be used for creating Python objects." +"memory that are grouped into families. For " +"example, :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free` are one family that allocates raw memory, " +"while :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free` are another family that's supposed to be used " +"for creating Python objects." msgstr "" #: ../../whatsnew/2.5.rst:2152 msgid "" -"Previously these different families all reduced to the platform's :c:func:" -"`malloc` and :c:func:`free` functions. This meant it didn't matter if you " -"got things wrong and allocated memory with the ``PyMem`` function but freed " -"it with the ``PyObject`` function. With 2.5's changes to obmalloc, these " -"families now do different things and mismatches will probably result in a " -"segfault. You should carefully test your C extension modules with Python " -"2.5." +"Previously these different families all reduced to the " +"platform's :c:func:`malloc` and :c:func:`free` functions. This meant it " +"didn't matter if you got things wrong and allocated memory with the " +"``PyMem`` function but freed it with the ``PyObject`` function. With 2.5's " +"changes to obmalloc, these families now do different things and mismatches " +"will probably result in a segfault. You should carefully test your C " +"extension modules with Python 2.5." msgstr "" #: ../../whatsnew/2.5.rst:2159 msgid "" "The built-in set types now have an official C API. Call :c:func:`PySet_New` " -"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` and :" -"c:func:`PySet_Discard` to add and remove elements, and :c:func:" -"`PySet_Contains` and :c:func:`PySet_Size` to examine the set's state. " -"(Contributed by Raymond Hettinger.)" +"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` " +"and :c:func:`PySet_Discard` to add and remove elements, " +"and :c:func:`PySet_Contains` and :c:func:`PySet_Size` to examine the set's " +"state. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:2165 @@ -3421,9 +3428,9 @@ msgid "" "``Py_LOCAL(type)`` declares the function as returning a value of the " "specified *type* and uses a fast-calling qualifier. " "``Py_LOCAL_INLINE(type)`` does the same thing and also requests the function " -"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before :" -"file:`python.h` is included, a set of more aggressive optimizations are " -"enabled for the module; you should benchmark the results to find out if " +"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined " +"before :file:`python.h` is included, a set of more aggressive optimizations " +"are enabled for the module; you should benchmark the results to find out if " "these optimizations actually make the code faster. (Contributed by Fredrik " "Lundh at the NeedForSpeed sprint.)" msgstr "" @@ -3472,14 +3479,14 @@ msgstr "" #: ../../whatsnew/2.5.rst:2210 msgid "" -"MacOS X (10.3 and higher): dynamic loading of modules now uses the :c:func:" -"`dlopen` function instead of MacOS-specific functions." +"MacOS X (10.3 and higher): dynamic loading of modules now uses " +"the :c:func:`dlopen` function instead of MacOS-specific functions." msgstr "" #: ../../whatsnew/2.5.rst:2213 msgid "" -"MacOS X: an :option:`!--enable-universalsdk` switch was added to the :" -"program:`configure` script that compiles the interpreter as a universal " +"MacOS X: an :option:`!--enable-universalsdk` switch was added to " +"the :program:`configure` script that compiles the interpreter as a universal " "binary able to run on both PowerPC and Intel processors. (Contributed by " "Ronald Oussoren; :issue:`2573`.)" msgstr "" @@ -3512,8 +3519,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2238 msgid "" "Previously, the :attr:`gi_frame` attribute of a generator was always a frame " -"object. Because of the :pep:`342` changes described in section :ref:" -"`pep-342`, it's now possible for :attr:`gi_frame` to be ``None``." +"object. Because of the :pep:`342` changes described in " +"section :ref:`pep-342`, it's now possible for :attr:`gi_frame` to be " +"``None``." msgstr "" #: ../../whatsnew/2.5.rst:2242 @@ -3550,11 +3558,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:2261 msgid "" -"Library: The :mod:`SimpleXMLRPCServer <xmlrpc.server>` and :mod:" -"`DocXMLRPCServer <xmlrpc.server>` classes now have a :attr:`rpc_paths` " -"attribute that constrains XML-RPC operations to a limited set of URL paths; " -"the default is to allow only ``'/'`` and ``'/RPC2'``. Setting :attr:" -"`rpc_paths` to ``None`` or an empty tuple disables this path checking." +"Library: The :mod:`SimpleXMLRPCServer <xmlrpc.server>` " +"and :mod:`DocXMLRPCServer <xmlrpc.server>` classes now have " +"a :attr:`rpc_paths` attribute that constrains XML-RPC operations to a " +"limited set of URL paths; the default is to allow only ``'/'`` and ``'/" +"RPC2'``. Setting :attr:`rpc_paths` to ``None`` or an empty tuple disables " +"this path checking." msgstr "" #: ../../whatsnew/2.5.rst:2267 diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index c5606c2af5..029e00fe3a 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -34,6 +34,8 @@ msgid "" "This article explains the new features in Python 2.6, released on October 1, " "2008. The release schedule is described in :pep:`361`." msgstr "" +"本文介紹了已於 2008 年 10 月 1 日發布的 Python 2.6 有哪些新功能。發布時間表請" +"見 :pep:`361`。" #: ../../whatsnew/2.6.rst:53 msgid "" @@ -42,8 +44,9 @@ msgid "" "incorporates new features and syntax from 3.0 while remaining compatible " "with existing code by not removing older features or syntax. When it's not " "possible to do that, Python 2.6 tries to do what it can, adding " -"compatibility functions in a :mod:`future_builtins` module and a :option:" -"`!-3` switch to warn about usages that will become unsupported in 3.0." +"compatibility functions in a :mod:`future_builtins` module and " +"a :option:`!-3` switch to warn about usages that will become unsupported in " +"3.0." msgstr "" #: ../../whatsnew/2.6.rst:62 @@ -104,8 +107,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:106 msgid "" -"The addition of :func:`functools.reduce` as a synonym for the built-in :func:" -"`reduce` function." +"The addition of :func:`functools.reduce` as a synonym for the built-" +"in :func:`reduce` function." msgstr "" #: ../../whatsnew/2.6.rst:109 @@ -123,16 +126,17 @@ msgid "" "A new command-line switch, :option:`!-3`, enables warnings about features " "that will be removed in Python 3.0. You can run code with this switch to " "see how much work will be necessary to port code to 3.0. The value of this " -"switch is available to Python code as the boolean variable :data:`sys." -"py3kwarning`, and to C extension code as :c:data:`!Py_Py3kWarningFlag`." +"switch is available to Python code as the boolean " +"variable :data:`sys.py3kwarning`, and to C extension code as :c:data:`!" +"Py_Py3kWarningFlag`." msgstr "" #: ../../whatsnew/2.6.rst:126 msgid "" -"The 3\\ *xxx* series of PEPs, which contains proposals for Python 3.0. :pep:" -"`3000` describes the development process for Python 3.0. Start with :pep:" -"`3100` that describes the general goals for Python 3.0, and then explore the " -"higher-numbered PEPs that propose specific features." +"The 3\\ *xxx* series of PEPs, which contains proposals for Python " +"3.0. :pep:`3000` describes the development process for Python 3.0. Start " +"with :pep:`3100` that describes the general goals for Python 3.0, and then " +"explore the higher-numbered PEPs that propose specific features." msgstr "" #: ../../whatsnew/2.6.rst:134 @@ -165,8 +169,8 @@ msgid "" "posted a call for issue trackers, asking volunteers to set up different " "products and import some of the bugs and patches from SourceForge. Four " "different trackers were examined: `Jira <https://www.atlassian.com/software/" -"jira/>`__, `Launchpad <https://launchpad.net/>`__, `Roundup <https://roundup." -"sourceforge.io/>`__, and `Trac <https://trac.edgewall.org/>`__. The " +"jira/>`__, `Launchpad <https://launchpad.net/>`__, `Roundup <https://" +"roundup.sourceforge.io/>`__, and `Trac <https://trac.edgewall.org/>`__. The " "committee eventually settled on Jira and Roundup as the two candidates. " "Jira is a commercial product that offers no-cost hosted instances to free-" "software projects; Roundup is an open-source project that requires " @@ -188,8 +192,8 @@ msgid "" "Hosting of the Python bug tracker is kindly provided by `Upfront Systems " "<https://upfrontsoftware.co.za>`__ of Stellenbosch, South Africa. Martin " "von Löwis put a lot of effort into importing existing bugs and patches from " -"SourceForge; his scripts for this import operation are at ``https://svn." -"python.org/view/tracker/importer/`` and may be useful to other projects " +"SourceForge; his scripts for this import operation are at ``https://" +"svn.python.org/view/tracker/importer/`` and may be useful to other projects " "wishing to move from SourceForge to Roundup." msgstr "" @@ -199,7 +203,7 @@ msgstr "https://bugs.python.org" #: ../../whatsnew/2.6.rst:183 msgid "The Python bug tracker." -msgstr "" +msgstr "Python 問題追蹤系統。" #: ../../whatsnew/2.6.rst:185 msgid "https://bugs.jython.org:" @@ -207,7 +211,7 @@ msgstr "https://bugs.jython.org:" #: ../../whatsnew/2.6.rst:186 msgid "The Jython bug tracker." -msgstr "" +msgstr "Jython 問題追蹤系統。" #: ../../whatsnew/2.6.rst:188 msgid "https://roundup.sourceforge.io/" @@ -223,11 +227,11 @@ msgstr "https://svn.python.org/view/tracker/importer/" #: ../../whatsnew/2.6.rst:192 msgid "Martin von Löwis's conversion scripts." -msgstr "" +msgstr "Martin von Löwis 的轉換腳本。" #: ../../whatsnew/2.6.rst:195 msgid "New Documentation Format: reStructuredText Using Sphinx" -msgstr "" +msgstr "新文件格式:使用 Sphinx 的 reStructuredText" #: ../../whatsnew/2.6.rst:197 msgid "" @@ -269,38 +273,38 @@ msgstr "" #: ../../whatsnew/2.6.rst:226 msgid "" "Sphinx is a standalone package that can be used for writing, and almost two " -"dozen other projects (`listed on the Sphinx web site <https://www.sphinx-doc." -"org/en/master/examples.html>`__) have adopted Sphinx as their documentation " -"tool." +"dozen other projects (`listed on the Sphinx web site <https://www.sphinx-" +"doc.org/en/master/examples.html>`__) have adopted Sphinx as their " +"documentation tool." msgstr "" #: ../../whatsnew/2.6.rst:233 msgid "`Documenting Python <https://devguide.python.org/documenting/>`__" -msgstr "" +msgstr "`Python 文件撰寫 <https://devguide.python.org/documenting/>`__" #: ../../whatsnew/2.6.rst:234 msgid "Describes how to write for Python's documentation." -msgstr "" +msgstr "說明如何為 Python 撰寫文件。" #: ../../whatsnew/2.6.rst:236 msgid "`Sphinx <https://www.sphinx-doc.org/>`__" -msgstr "" +msgstr "`Sphinx <https://www.sphinx-doc.org/>`__" #: ../../whatsnew/2.6.rst:237 msgid "Documentation and code for the Sphinx toolchain." -msgstr "" +msgstr "Sphinx 工具鏈的文件和程式碼。" #: ../../whatsnew/2.6.rst:239 msgid "`Docutils <https://docutils.sourceforge.io>`__" -msgstr "" +msgstr "`Docutils <https://docutils.sourceforge.io>`__" #: ../../whatsnew/2.6.rst:240 msgid "The underlying reStructuredText parser and toolset." -msgstr "" +msgstr "底層 reStructuredText 剖析器和工具集。" #: ../../whatsnew/2.6.rst:246 msgid "PEP 343: The 'with' statement" -msgstr "" +msgstr "PEP 343:'with' 陳述式" #: ../../whatsnew/2.6.rst:248 msgid "" @@ -333,12 +337,14 @@ msgid "" "with expression [as variable]:\n" " with-block" msgstr "" +"with expression [as variable]:\n" +" with-block" #: ../../whatsnew/2.6.rst:269 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods)." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods)." msgstr "" #: ../../whatsnew/2.6.rst:273 @@ -351,9 +357,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:278 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" #: ../../whatsnew/2.6.rst:282 @@ -370,6 +376,10 @@ msgid "" " print line\n" " ... more processing code ..." msgstr "" +"with open('/etc/passwd', 'r') as f:\n" +" for line in f:\n" +" print line\n" +" ... 更多處理程式碼 ..." #: ../../whatsnew/2.6.rst:290 msgid "" @@ -380,8 +390,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:296 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" #: ../../whatsnew/2.6.rst:299 @@ -445,8 +455,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:339 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.6.rst:343 @@ -458,19 +468,19 @@ msgstr "" #: ../../whatsnew/2.6.rst:347 msgid "The code in *BLOCK* is executed." -msgstr "" +msgstr "*BLOCK* 中的程式碼會被執行。" #: ../../whatsnew/2.6.rst:349 msgid "" -"If *BLOCK* raises an exception, the context manager's :meth:`~object." -"__exit__` method is called with three arguments, the exception details " -"(``type, value, traceback``, the same values returned by :func:`sys." -"exc_info`, which can also be ``None`` if no exception occurred). The " -"method's return value controls whether an exception is re-raised: any false " -"value re-raises the exception, and ``True`` will result in suppressing it. " -"You'll only rarely want to suppress the exception, because if you do the " -"author of the code containing the ':keyword:`with`' statement will never " -"realize anything went wrong." +"If *BLOCK* raises an exception, the context " +"manager's :meth:`~object.__exit__` method is called with three arguments, " +"the exception details (``type, value, traceback``, the same values returned " +"by :func:`sys.exc_info`, which can also be ``None`` if no exception " +"occurred). The method's return value controls whether an exception is re-" +"raised: any false value re-raises the exception, and ``True`` will result in " +"suppressing it. You'll only rarely want to suppress the exception, because " +"if you do the author of the code containing the ':keyword:`with`' statement " +"will never realize anything went wrong." msgstr "" #: ../../whatsnew/2.6.rst:358 @@ -508,12 +518,17 @@ msgid "" " cursor.execute('delete from ...')\n" " # ... more operations ..." msgstr "" +"db_connection = DatabaseConnection()\n" +"with db_connection as cursor:\n" +" cursor.execute('insert into ...')\n" +" cursor.execute('delete from ...')\n" +" # ... 更多操作 ..." #: ../../whatsnew/2.6.rst:379 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" #: ../../whatsnew/2.6.rst:383 @@ -593,8 +608,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`!yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -625,6 +640,22 @@ msgid "" "with db_transaction(db) as cursor:\n" " ..." msgstr "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def db_transaction(connection):\n" +" cursor = connection.cursor()\n" +" try:\n" +" yield cursor\n" +" except:\n" +" connection.rollback()\n" +" raise\n" +" else:\n" +" connection.commit()\n" +"\n" +"db = DatabaseConnection()\n" +"with db_transaction(db) as cursor:\n" +" ..." #: ../../whatsnew/2.6.rst:463 msgid "" @@ -641,6 +672,9 @@ msgid "" "with nested (db_transaction(db), lock) as (cursor, locked):\n" " ..." msgstr "" +"lock = threading.Lock()\n" +"with nested (db_transaction(db), lock) as (cursor, locked):\n" +" ..." #: ../../whatsnew/2.6.rst:472 msgid "" @@ -658,10 +692,16 @@ msgid "" " for line in f:\n" " sys.stdout.write(line)" msgstr "" +"import urllib, sys\n" +"from contextlib import closing\n" +"\n" +"with closing(urllib.urlopen('http://www.yahoo.com')) as f:\n" +" for line in f:\n" +" sys.stdout.write(line)" #: ../../whatsnew/2.6.rst:486 msgid ":pep:`343` - The \"with\" statement" -msgstr "" +msgstr ":pep:`343` - \"with\" 陳述式" #: ../../whatsnew/2.6.rst:487 msgid "" @@ -721,11 +761,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:530 msgid "Unix and Mac OS X: :file:`~/.local/`" -msgstr "" +msgstr "Unix 和 Mac OS X::file:`~/.local/`" #: ../../whatsnew/2.6.rst:531 msgid "Windows: :file:`%APPDATA%/Python`" -msgstr "" +msgstr "Windows::file:`%APPDATA%/Python`" #: ../../whatsnew/2.6.rst:533 msgid "" @@ -739,9 +779,9 @@ msgid "" "If you don't like the default directory, it can be overridden by an " "environment variable. :envvar:`PYTHONUSERBASE` sets the root directory used " "for all Python versions supporting this feature. On Windows, the directory " -"for application-specific data can be changed by setting the :envvar:" -"`APPDATA` environment variable. You can also modify the :file:`site.py` " -"file for your Python installation." +"for application-specific data can be changed by setting " +"the :envvar:`APPDATA` environment variable. You can also modify " +"the :file:`site.py` file for your Python installation." msgstr "" #: ../../whatsnew/2.6.rst:544 @@ -773,14 +813,15 @@ msgstr "" #: ../../whatsnew/2.6.rst:567 msgid "" -"The :mod:`multiprocessing` module started out as an exact emulation of the :" -"mod:`threading` module using processes instead of threads. That goal was " -"discarded along the path to Python 2.6, but the general approach of the " +"The :mod:`multiprocessing` module started out as an exact emulation of " +"the :mod:`threading` module using processes instead of threads. That goal " +"was discarded along the path to Python 2.6, but the general approach of the " "module is still similar. The fundamental class is the :class:`Process`, " -"which is passed a callable object and a collection of arguments. The :meth:" -"`start` method sets the callable running in a subprocess, after which you " -"can call the :meth:`is_alive` method to check whether the subprocess is " -"still running and the :meth:`join` method to wait for the process to exit." +"which is passed a callable object and a collection of arguments. " +"The :meth:`start` method sets the callable running in a subprocess, after " +"which you can call the :meth:`is_alive` method to check whether the " +"subprocess is still running and the :meth:`join` method to wait for the " +"process to exit." msgstr "" #: ../../whatsnew/2.6.rst:577 @@ -822,6 +863,35 @@ msgid "" " result = queue.get()\n" " print 'Factorial', N, '=', result" msgstr "" +"import time\n" +"from multiprocessing import Process, Queue\n" +"\n" +"\n" +"def factorial(queue, N):\n" +" \"計算階乘。\"\n" +" # 如果 N 是 4 的倍數,則此函式將花費更多時間。\n" +" if (N % 4) == 0:\n" +" time.sleep(.05 * N/4)\n" +"\n" +" # 計算結果\n" +" fact = 1L\n" +" for i in range(1, N+1):\n" +" fact = fact * i\n" +"\n" +" # 將結果放進佇列裡\n" +" queue.put(fact)\n" +"\n" +"if __name__ == '__main__':\n" +" queue = Queue()\n" +"\n" +" N = 5\n" +"\n" +" p = Process(target=factorial, args=(queue, N))\n" +" p.start()\n" +" p.join()\n" +"\n" +" result = queue.get()\n" +" print 'Factorial', N, '=', result" #: ../../whatsnew/2.6.rst:614 msgid "" @@ -838,10 +908,10 @@ msgid "" "Two other classes, :class:`Pool` and :class:`Manager`, provide higher-level " "interfaces. :class:`Pool` will create a fixed number of worker processes, " "and requests can then be distributed to the workers by calling :meth:`apply` " -"or :meth:`apply_async` to add a single request, and :meth:`map` or :meth:" -"`map_async` to add a number of requests. The following code uses a :class:" -"`Pool` to spread requests across 5 worker processes and retrieve a list of " -"results::" +"or :meth:`apply_async` to add a single request, and :meth:`map` " +"or :meth:`map_async` to add a number of requests. The following code uses " +"a :class:`Pool` to spread requests across 5 worker processes and retrieve a " +"list of results::" msgstr "" #: ../../whatsnew/2.6.rst:630 @@ -856,6 +926,15 @@ msgid "" "for v in result:\n" " print v" msgstr "" +"from multiprocessing import Pool\n" +"\n" +"def factorial(N, dictionary):\n" +" \"計算階乘。\"\n" +" ...\n" +"p = Pool(5)\n" +"result = p.map(factorial, range(1, 1000, 10))\n" +"for v in result:\n" +" print v" #: ../../whatsnew/2.6.rst:640 msgid "This produces the following output::" @@ -870,6 +949,12 @@ msgid "" "33452526613163807108170062053440751665152000000000\n" "..." msgstr "" +"1\n" +"39916800\n" +"51090942171709440000\n" +"8222838654177922817725562880000000\n" +"33452526613163807108170062053440751665152000000000\n" +"..." #: ../../whatsnew/2.6.rst:649 msgid "" @@ -1004,8 +1089,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:744 msgid "" ">>> import sys\n" -">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." -"format(sys)\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" "Platform: darwin\n" "Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" "[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" @@ -1014,6 +1099,16 @@ msgid "" ">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" "'Content-type: video/mp4'" msgstr "" +">>> import sys\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" +"Platform: darwin\n" +"Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" +"[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" +"\n" +">>> import mimetypes\n" +">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" +"'Content-type: video/mp4'" #: ../../whatsnew/2.6.rst:754 msgid "" @@ -1065,11 +1160,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:787 msgid "Character" -msgstr "" +msgstr "字元" #: ../../whatsnew/2.6.rst:787 msgid "Effect" -msgstr "" +msgstr "效果" #: ../../whatsnew/2.6.rst:789 msgid "< (default)" @@ -1117,6 +1212,10 @@ msgid "" ">>> '{0:e}'.format(3.75)\n" "'3.750000e+00'" msgstr "" +">>> '{0:g}'.format(3.75)\n" +"'3.75'\n" +">>> '{0:e}'.format(3.75)\n" +"'3.750000e+00'" #: ../../whatsnew/2.6.rst:804 msgid "" @@ -1223,6 +1322,11 @@ msgid "" " else:\n" " return str(self)" msgstr "" +"def __format__(self, format_spec):\n" +" if isinstance(format_spec, unicode):\n" +" return unicode(str(self))\n" +" else:\n" +" return str(self)" #: ../../whatsnew/2.6.rst:836 msgid "" @@ -1235,6 +1339,8 @@ msgid "" ">>> format(75.6564, '.2f')\n" "'75.66'" msgstr "" +">>> format(75.6564, '.2f')\n" +"'75.66'" #: ../../whatsnew/2.6.rst:846 msgid ":ref:`formatstrings`" @@ -1274,6 +1380,8 @@ msgid "" ">>> from __future__ import print_function\n" ">>> print('# of entries', len(dictionary), file=sys.stderr)" msgstr "" +">>> from __future__ import print_function\n" +">>> print('# of entries', len(dictionary), file=sys.stderr)" #: ../../whatsnew/2.6.rst:869 msgid "The signature of the new function is::" @@ -1281,7 +1389,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:871 msgid "def print(*args, sep=' ', end='\\n', file=None)" -msgstr "" +msgstr "def print(*args, sep=' ', end='\\n', file=None)" #: ../../whatsnew/2.6.rst:874 msgid "The parameters are:" @@ -1307,7 +1415,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:884 msgid ":pep:`3105` - Make print a function" -msgstr "" +msgstr ":pep:`3105` - 將 print 變成函式" #: ../../whatsnew/2.6.rst:885 msgid "PEP written by Georg Brandl." @@ -1330,14 +1438,19 @@ msgid "" "except TypeError, ValueError: # Wrong!\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError, ValueError: # 錯誤!\n" +" ..." #: ../../whatsnew/2.6.rst:902 msgid "" -"The author is probably trying to catch both :exc:`TypeError` and :exc:" -"`ValueError` exceptions, but this code actually does something different: it " -"will catch :exc:`TypeError` and bind the resulting exception object to the " -"local name ``\"ValueError\"``. The :exc:`ValueError` exception will not be " -"caught at all. The correct code specifies a tuple of exceptions::" +"The author is probably trying to catch both :exc:`TypeError` " +"and :exc:`ValueError` exceptions, but this code actually does something " +"different: it will catch :exc:`TypeError` and bind the resulting exception " +"object to the local name ``\"ValueError\"``. The :exc:`ValueError` " +"exception will not be caught at all. The correct code specifies a tuple of " +"exceptions::" msgstr "" #: ../../whatsnew/2.6.rst:909 @@ -1347,6 +1460,10 @@ msgid "" "except (TypeError, ValueError):\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except (TypeError, ValueError):\n" +" ..." #: ../../whatsnew/2.6.rst:914 msgid "" @@ -1369,6 +1486,10 @@ msgid "" "except TypeError as exc:\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError as exc:\n" +" ..." #: ../../whatsnew/2.6.rst:927 msgid "" @@ -1394,10 +1515,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:945 msgid "" "Python 3.0 adopts Unicode as the language's fundamental string type and " -"denotes 8-bit literals differently, either as ``b'string'`` or using a :" -"class:`bytes` constructor. For future compatibility, Python 2.6 adds :class:" -"`bytes` as a synonym for the :class:`str` type, and it also supports the " -"``b''`` notation." +"denotes 8-bit literals differently, either as ``b'string'`` or using " +"a :class:`bytes` constructor. For future compatibility, Python 2.6 " +"adds :class:`bytes` as a synonym for the :class:`str` type, and it also " +"supports the ``b''`` notation." msgstr "" #: ../../whatsnew/2.6.rst:952 @@ -1405,8 +1526,8 @@ msgid "" "The 2.6 :class:`str` differs from 3.0's :class:`bytes` type in various ways; " "most notably, the constructor is completely different. In 3.0, ``bytes([65, " "66, 67])`` is 3 elements long, containing the bytes representing ``ABC``; in " -"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing the :" -"func:`str` of the list." +"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing " +"the :func:`str` of the list." msgstr "" #: ../../whatsnew/2.6.rst:958 @@ -1414,9 +1535,9 @@ msgid "" "The primary use of :class:`bytes` in 2.6 will be to write tests of object " "type such as ``isinstance(x, bytes)``. This will help the 2to3 converter, " "which can't tell whether 2.x code intends strings to contain either " -"characters or 8-bit bytes; you can now use either :class:`bytes` or :class:" -"`str` to represent your intention exactly, and the resulting code will also " -"be correct in Python 3.0." +"characters or 8-bit bytes; you can now use either :class:`bytes` " +"or :class:`str` to represent your intention exactly, and the resulting code " +"will also be correct in Python 3.0." msgstr "" #: ../../whatsnew/2.6.rst:965 @@ -1435,15 +1556,20 @@ msgid "" "\n" "print len(s) # 12 Unicode characters" msgstr "" +"from __future__ import unicode_literals\n" +"\n" +"s = ('\\u751f\\u3080\\u304e\\u3000\\u751f\\u3054'\n" +" '\\u3081\\u3000\\u751f\\u305f\\u307e\\u3054')\n" +"\n" +"print len(s) # 12 個 Unicode 字元" #: ../../whatsnew/2.6.rst:977 msgid "" "At the C level, Python 3.0 will rename the existing 8-bit string type, " "called :c:type:`!PyStringObject` in Python 2.x, to :c:type:`PyBytesObject`. " -"Python 2.6 uses ``#define`` to support using the names :c:func:" -"`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:" -"`PyBytes_FromStringAndSize`, and all the other functions and macros used " -"with strings." +"Python 2.6 uses ``#define`` to support using the " +"names :c:func:`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:`PyBytes_FromStringAndSize`, " +"and all the other functions and macros used with strings." msgstr "" #: ../../whatsnew/2.6.rst:984 @@ -1465,12 +1591,23 @@ msgid "" ">>> unicode(str(b), 'utf-8')\n" "u'\\u31ef \\u3244'" msgstr "" +">>> bytearray([65, 66, 67])\n" +"bytearray(b'ABC')\n" +">>> b = bytearray(u'\\u21ef\\u3244', 'utf-8')\n" +">>> b\n" +"bytearray(b'\\xe2\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> b[0] = '\\xe3'\n" +">>> b\n" +"bytearray(b'\\xe3\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> unicode(str(b), 'utf-8')\n" +"u'\\u31ef \\u3244'" #: ../../whatsnew/2.6.rst:999 msgid "" -"Byte arrays support most of the methods of string types, such as :meth:" -"`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some of the " -"methods of lists, such as :meth:`append`, :meth:`pop`, and :meth:`reverse`." +"Byte arrays support most of the methods of string types, such " +"as :meth:`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some " +"of the methods of lists, such as :meth:`append`, :meth:`pop`, " +"and :meth:`reverse`." msgstr "" #: ../../whatsnew/2.6.rst:1006 @@ -1481,11 +1618,17 @@ msgid "" ">>> b\n" "bytearray(b'ABCde')" msgstr "" +">>> b = bytearray('ABC')\n" +">>> b.append('d')\n" +">>> b.append(ord('e'))\n" +">>> b\n" +"bytearray(b'ABCde')" #: ../../whatsnew/2.6.rst:1012 msgid "" -"There's also a corresponding C API, with :c:func:`PyByteArray_FromObject`, :" -"c:func:`PyByteArray_FromStringAndSize`, and various other functions." +"There's also a corresponding C API, " +"with :c:func:`PyByteArray_FromObject`, :c:func:`PyByteArray_FromStringAndSize`, " +"and various other functions." msgstr "" #: ../../whatsnew/2.6.rst:1019 @@ -1498,16 +1641,16 @@ msgstr "" #: ../../whatsnew/2.6.rst:1027 msgid "PEP 3116: New I/O Library" -msgstr "" +msgstr "PEP 3116:新 I/O 函式庫" #: ../../whatsnew/2.6.rst:1029 msgid "" "Python's built-in file objects support a number of methods, but file-like " "objects don't necessarily support all of them. Objects that imitate files " -"usually support :meth:`read` and :meth:`write`, but they may not support :" -"meth:`readline`, for example. Python 3.0 introduces a layered I/O library " -"in the :mod:`io` module that separates buffering and text-handling features " -"from the fundamental read and write operations." +"usually support :meth:`read` and :meth:`write`, but they may not " +"support :meth:`readline`, for example. Python 3.0 introduces a layered I/O " +"library in the :mod:`io` module that separates buffering and text-handling " +"features from the fundamental read and write operations." msgstr "" #: ../../whatsnew/2.6.rst:1037 @@ -1518,12 +1661,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:1040 msgid "" -":class:`RawIOBase` defines raw I/O operations: :meth:`read`, :meth:" -"`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " +":class:`RawIOBase` defines raw I/O " +"operations: :meth:`read`, :meth:`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " "and :meth:`close`. Most of the methods of this class will often map to a " -"single system call. There are also :meth:`readable`, :meth:`writable`, and :" -"meth:`seekable` methods for determining what operations a given object will " -"allow." +"single system call. There are also :meth:`readable`, :meth:`writable`, " +"and :meth:`seekable` methods for determining what operations a given object " +"will allow." msgstr "" #: ../../whatsnew/2.6.rst:1048 @@ -1536,37 +1679,37 @@ msgstr "" msgid "" ":class:`BufferedIOBase` is an abstract base class that buffers data in " "memory to reduce the number of system calls used, making I/O processing more " -"efficient. It supports all of the methods of :class:`RawIOBase`, and adds a :" -"attr:`raw` attribute holding the underlying raw object." +"efficient. It supports all of the methods of :class:`RawIOBase`, and adds " +"a :attr:`raw` attribute holding the underlying raw object." msgstr "" #: ../../whatsnew/2.6.rst:1058 msgid "" -"There are five concrete classes implementing this ABC. :class:" -"`BufferedWriter` and :class:`BufferedReader` are for objects that support " -"write-only or read-only usage that have a :meth:`seek` method for random " -"access. :class:`BufferedRandom` objects support read and write access upon " -"the same underlying stream, and :class:`BufferedRWPair` is for objects such " -"as TTYs that have both read and write operations acting upon unconnected " -"streams of data. The :class:`BytesIO` class supports reading, writing, and " -"seeking over an in-memory buffer." +"There are five concrete classes implementing this " +"ABC. :class:`BufferedWriter` and :class:`BufferedReader` are for objects " +"that support write-only or read-only usage that have a :meth:`seek` method " +"for random access. :class:`BufferedRandom` objects support read and write " +"access upon the same underlying stream, and :class:`BufferedRWPair` is for " +"objects such as TTYs that have both read and write operations acting upon " +"unconnected streams of data. The :class:`BytesIO` class supports reading, " +"writing, and seeking over an in-memory buffer." msgstr "" #: ../../whatsnew/2.6.rst:1071 msgid "" ":class:`TextIOBase`: Provides functions for reading and writing strings " -"(remember, strings will be Unicode in Python 3.0), and supporting :term:" -"`universal newlines`. :class:`TextIOBase` defines the :meth:`readline` " -"method and supports iteration upon objects." +"(remember, strings will be Unicode in Python 3.0), and " +"supporting :term:`universal newlines`. :class:`TextIOBase` defines " +"the :meth:`readline` method and supports iteration upon objects." msgstr "" #: ../../whatsnew/2.6.rst:1077 msgid "" "There are two concrete implementations. :class:`TextIOWrapper` wraps a " "buffered I/O object, supporting all of the methods for text I/O and adding " -"a :attr:`buffer` attribute for access to the underlying object. :class:" -"`StringIO` simply buffers everything in memory without ever writing anything " -"to disk." +"a :attr:`buffer` attribute for access to the underlying " +"object. :class:`StringIO` simply buffers everything in memory without ever " +"writing anything to disk." msgstr "" #: ../../whatsnew/2.6.rst:1083 @@ -1693,19 +1836,19 @@ msgid "" "It probably means that accessing items with ``obj[1]`` works. Does it imply " "that setting items with ``obj[2] = value`` works? Or that the object will " "have :meth:`keys`, :meth:`values`, and :meth:`items` methods? What about " -"the iterative variants such as :meth:`iterkeys`? :meth:`copy` and :meth:" -"`update`? Iterating over the object with :func:`iter`?" +"the iterative variants such as :meth:`iterkeys`? :meth:`copy` " +"and :meth:`update`? Iterating over the object with :func:`iter`?" msgstr "" #: ../../whatsnew/2.6.rst:1178 msgid "" "The Python 2.6 :mod:`collections` module includes a number of different ABCs " "that represent these distinctions. :class:`Iterable` indicates that a class " -"defines :meth:`__iter__`, and :class:`Container` means the class defines a :" -"meth:`__contains__` method and therefore supports ``x in y`` expressions. " -"The basic dictionary interface of getting items, setting items, and :meth:" -"`keys`, :meth:`values`, and :meth:`items`, is defined by the :class:" -"`MutableMapping` ABC." +"defines :meth:`__iter__`, and :class:`Container` means the class defines " +"a :meth:`__contains__` method and therefore supports ``x in y`` " +"expressions. The basic dictionary interface of getting items, setting " +"items, and :meth:`keys`, :meth:`values`, and :meth:`items`, is defined by " +"the :class:`MutableMapping` ABC." msgstr "" #: ../../whatsnew/2.6.rst:1187 @@ -1721,6 +1864,10 @@ msgid "" "class Storage(collections.MutableMapping):\n" " ..." msgstr "" +"import collections\n" +"\n" +"class Storage(collections.MutableMapping):\n" +" ..." #: ../../whatsnew/2.6.rst:1196 msgid "" @@ -1738,14 +1885,20 @@ msgid "" "\n" "collections.MutableMapping.register(Storage)" msgstr "" +"import collections\n" +"\n" +"class Storage:\n" +" ...\n" +"\n" +"collections.MutableMapping.register(Storage)" #: ../../whatsnew/2.6.rst:1207 msgid "" -"For classes that you write, deriving from the ABC is probably clearer. The :" -"meth:`register` method is useful when you've written a new ABC that can " -"describe an existing type or class, or if you want to declare that some " -"third-party class implements an ABC. For example, if you defined a :class:" -"`PrintableType` ABC, it's legal to do::" +"For classes that you write, deriving from the ABC is probably clearer. " +"The :meth:`register` method is useful when you've written a new ABC that " +"can describe an existing type or class, or if you want to declare that some " +"third-party class implements an ABC. For example, if you defined " +"a :class:`PrintableType` ABC, it's legal to do::" msgstr "" #: ../../whatsnew/2.6.rst:1214 @@ -1755,6 +1908,10 @@ msgid "" "PrintableType.register(float)\n" "PrintableType.register(str)" msgstr "" +"# 註冊 Python 的型別\n" +"PrintableType.register(int)\n" +"PrintableType.register(float)\n" +"PrintableType.register(str)" #: ../../whatsnew/2.6.rst:1219 msgid "" @@ -1775,6 +1932,9 @@ msgid "" " if not isinstance(d, collections.MutableMapping):\n" " raise ValueError(\"Mapping object expected, not %r\" % d)" msgstr "" +"def func(d):\n" +" if not isinstance(d, collections.MutableMapping):\n" +" raise ValueError(\"Mapping object expected, not %r\" % d)" #: ../../whatsnew/2.6.rst:1230 msgid "" @@ -1811,24 +1971,41 @@ msgid "" " def draw(self, x, y, scale):\n" " ..." msgstr "" +"from abc import ABCMeta, abstractmethod\n" +"\n" +"class Drawable():\n" +" __metaclass__ = ABCMeta\n" +"\n" +" @abstractmethod\n" +" def draw(self, x, y, scale=1.0):\n" +" pass\n" +"\n" +" def draw_doubled(self, x, y):\n" +" self.draw(x, y, scale=2.0)\n" +"\n" +"\n" +"class Square(Drawable):\n" +" def draw(self, x, y, scale):\n" +" ..." #: ../../whatsnew/2.6.rst:1258 msgid "" "In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method renders " "the object at twice its size and can be implemented in terms of other " "methods described in :class:`Drawable`. Classes implementing this ABC " -"therefore don't need to provide their own implementation of :meth:" -"`draw_doubled`, though they can do so. An implementation of :meth:`draw` is " -"necessary, though; the ABC can't provide a useful generic implementation." +"therefore don't need to provide their own implementation " +"of :meth:`draw_doubled`, though they can do so. An implementation " +"of :meth:`draw` is necessary, though; the ABC can't provide a useful generic " +"implementation." msgstr "" #: ../../whatsnew/2.6.rst:1266 msgid "" -"You can apply the ``@abstractmethod`` decorator to methods such as :meth:" -"`draw` that must be implemented; Python will then raise an exception for " -"classes that don't define the method. Note that the exception is only raised " -"when you actually try to create an instance of a subclass lacking the " -"method::" +"You can apply the ``@abstractmethod`` decorator to methods such " +"as :meth:`draw` that must be implemented; Python will then raise an " +"exception for classes that don't define the method. Note that the exception " +"is only raised when you actually try to create an instance of a subclass " +"lacking the method::" msgstr "" #: ../../whatsnew/2.6.rst:1272 @@ -1843,6 +2020,15 @@ msgid "" "draw\n" ">>>" msgstr "" +">>> class Circle(Drawable):\n" +"... pass\n" +"...\n" +">>> c = Circle()\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"TypeError: Can't instantiate abstract class Circle with abstract methods " +"draw\n" +">>>" #: ../../whatsnew/2.6.rst:1281 msgid "" @@ -1859,6 +2045,12 @@ msgid "" "def readonly(self):\n" " return self._x" msgstr "" +"from abc import abstractproperty\n" +"...\n" +"\n" +"@abstractproperty\n" +"def readonly(self):\n" +" return self._x" #: ../../whatsnew/2.6.rst:1291 msgid "Subclasses must then define a :meth:`readonly` property." @@ -1898,6 +2090,10 @@ msgid "" ">>> 0b101111\n" "47" msgstr "" +">>> 0o21, 2*8 + 1\n" +"(17, 17)\n" +">>> 0b101111\n" +"47" #: ../../whatsnew/2.6.rst:1320 msgid "" @@ -1915,6 +2111,12 @@ msgid "" ">>> bin(173)\n" "'0b10101101'" msgstr "" +">>> oct(42)\n" +"'052'\n" +">>> future_builtins.oct(42)\n" +"'0o52'\n" +">>> bin(173)\n" +"'0b10101101'" #: ../../whatsnew/2.6.rst:1331 msgid "" @@ -1935,6 +2137,14 @@ msgid "" ">>> int('0b1101', 0)\n" "13" msgstr "" +">>> int ('0o52', 0)\n" +"42\n" +">>> int('1101', 2)\n" +"13\n" +">>> int('0b1101', 2)\n" +"13\n" +">>> int('0b1101', 0)\n" +"13" #: ../../whatsnew/2.6.rst:1348 msgid ":pep:`3127` - Integer Literal Support and Syntax" @@ -1961,10 +2171,14 @@ msgid "" "class A:\n" " pass" msgstr "" +"@foo\n" +"@bar\n" +"class A:\n" +" pass" #: ../../whatsnew/2.6.rst:1367 msgid "This is equivalent to::" -msgstr "" +msgstr "這等價於: ::" #: ../../whatsnew/2.6.rst:1369 msgid "" @@ -1973,6 +2187,10 @@ msgid "" "\n" "A = foo(bar(A))" msgstr "" +"class A:\n" +" pass\n" +"\n" +"A = foo(bar(A))" #: ../../whatsnew/2.6.rst:1376 msgid ":pep:`3129` - Class Decorators" @@ -1989,8 +2207,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1386 msgid "" "Python 3.0 adds several abstract base classes for numeric types inspired by " -"Scheme's numeric tower. These classes were backported to 2.6 as the :mod:" -"`numbers` module." +"Scheme's numeric tower. These classes were backported to 2.6 as " +"the :mod:`numbers` module." msgstr "" #: ../../whatsnew/2.6.rst:1390 @@ -2020,9 +2238,9 @@ msgstr "" msgid "" ":class:`Rational` numbers derive from :class:`Real`, have :attr:`numerator` " "and :attr:`denominator` properties, and can be converted to floats. Python " -"2.6 adds a simple rational-number class, :class:`Fraction`, in the :mod:" -"`fractions` module. (It's called :class:`Fraction` instead of :class:" -"`Rational` to avoid a name clash with :class:`numbers.Rational`.)" +"2.6 adds a simple rational-number class, :class:`Fraction`, in " +"the :mod:`fractions` module. (It's called :class:`Fraction` instead " +"of :class:`Rational` to avoid a name clash with :class:`numbers.Rational`.)" msgstr "" #: ../../whatsnew/2.6.rst:1412 @@ -2035,11 +2253,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:1417 msgid "" -"In Python 3.0, the PEP slightly redefines the existing builtins :func:" -"`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new one, :func:" -"`math.trunc`, that's been backported to Python 2.6. :func:`math.trunc` " -"rounds toward zero, returning the closest :class:`Integral` that's between " -"the function's argument and zero." +"In Python 3.0, the PEP slightly redefines the existing " +"builtins :func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a " +"new one, :func:`math.trunc`, that's been backported to Python " +"2.6. :func:`math.trunc` rounds toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero." msgstr "" #: ../../whatsnew/2.6.rst:1425 @@ -2093,6 +2311,15 @@ msgid "" ">>> a/b\n" "Fraction(5, 3)" msgstr "" +">>> from fractions import Fraction\n" +">>> a = Fraction(2, 3)\n" +">>> b = Fraction(2, 5)\n" +">>> float(a), float(b)\n" +"(0.66666666666666663, 0.40000000000000002)\n" +">>> a+b\n" +"Fraction(16, 15)\n" +">>> a/b\n" +"Fraction(5, 3)" #: ../../whatsnew/2.6.rst:1455 msgid "" @@ -2110,6 +2337,12 @@ msgid "" ">>> (1./3) .as_integer_ratio()\n" "(6004799503160661L, 18014398509481984L)" msgstr "" +">>> (2.5) .as_integer_ratio()\n" +"(5, 2)\n" +">>> (3.1415) .as_integer_ratio()\n" +"(7074029114692207L, 2251799813685248L)\n" +">>> (1./3) .as_integer_ratio()\n" +"(6004799503160661L, 18014398509481984L)" #: ../../whatsnew/2.6.rst:1467 msgid "" @@ -2147,10 +2380,10 @@ msgid "" "The :func:`hasattr` function was catching and ignoring all errors, under the " "assumption that they meant a :meth:`__getattr__` method was failing somehow " "and the return value of :func:`hasattr` would therefore be ``False``. This " -"logic shouldn't be applied to :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit`, however; Python 2.6 will no longer discard such exceptions " -"when :func:`hasattr` encounters them. (Fixed by Benjamin Peterson; :issue:" -"`2196`.)" +"logic shouldn't be applied to :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit`, however; Python 2.6 will no longer discard such " +"exceptions when :func:`hasattr` encounters them. (Fixed by Benjamin " +"Peterson; :issue:`2196`.)" msgstr "" #: ../../whatsnew/2.6.rst:1498 @@ -2171,6 +2404,14 @@ msgid "" ">>> f(**ud)\n" "['a', 'b']" msgstr "" +">>> def f(**kw):\n" +"... print sorted(kw)\n" +"...\n" +">>> ud=UserDict.UserDict()\n" +">>> ud['a'] = 1\n" +">>> ud['b'] = 'string'\n" +">>> f(**ud)\n" +"['a', 'b']" #: ../../whatsnew/2.6.rst:1511 msgid "(Contributed by Alexander Belopolsky; :issue:`1686487`.)" @@ -2190,6 +2431,11 @@ msgid "" ">>> f(1,2,3, *(4,5,6), keyword=13)\n" "(1, 2, 3, 4, 5, 6) {'keyword': 13}" msgstr "" +">>> def f(*args, **kw):\n" +"... print args, kw\n" +"...\n" +">>> f(1,2,3, *(4,5,6), keyword=13)\n" +"(1, 2, 3, 4, 5, 6) {'keyword': 13}" #: ../../whatsnew/2.6.rst:1522 msgid "" @@ -2201,8 +2447,9 @@ msgstr "" msgid "" "A new builtin, ``next(iterator, [default])`` returns the next item from the " "specified iterator. If the *default* argument is supplied, it will be " -"returned if *iterator* has been exhausted; otherwise, the :exc:" -"`StopIteration` exception will be raised. (Backported in :issue:`2719`.)" +"returned if *iterator* has been exhausted; otherwise, " +"the :exc:`StopIteration` exception will be raised. (Backported " +"in :issue:`2719`.)" msgstr "" #: ../../whatsnew/2.6.rst:1531 @@ -2234,10 +2481,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:1549 msgid "" -"Properties now have three attributes, :attr:`getter`, :attr:`setter` and :" -"attr:`deleter`, that are decorators providing useful shortcuts for adding a " -"getter, setter or deleter function to an existing property. You would use " -"them like this::" +"Properties now have three attributes, :attr:`getter`, :attr:`setter` " +"and :attr:`deleter`, that are decorators providing useful shortcuts for " +"adding a getter, setter or deleter function to an existing property. You " +"would use them like this::" msgstr "" #: ../../whatsnew/2.6.rst:1554 @@ -2264,12 +2511,33 @@ msgid "" " def x(self, value):\n" " self._x = value / 2" msgstr "" +"class C(object):\n" +" @property\n" +" def x(self):\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x\n" +"\n" +"class D(C):\n" +" @C.x.getter\n" +" def x(self):\n" +" return self._x * 2\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value / 2" #: ../../whatsnew/2.6.rst:1576 msgid "" -"Several methods of the built-in set types now accept multiple iterables: :" -"meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:" -"`update`, :meth:`difference` and :meth:`difference_update`." +"Several methods of the built-in set types now accept multiple " +"iterables: :meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:`update`, :meth:`difference` " +"and :meth:`difference_update`." msgstr "" #: ../../whatsnew/2.6.rst:1584 @@ -2291,15 +2559,15 @@ msgid "" "Many floating-point features were added. The :func:`float` function will " "now turn the string ``nan`` into an IEEE 754 Not A Number value, and " "``+inf`` and ``-inf`` into positive or negative infinity. This works on any " -"platform with IEEE 754 semantics. (Contributed by Christian Heimes; :issue:" -"`1635`.)" +"platform with IEEE 754 semantics. (Contributed by Christian " +"Heimes; :issue:`1635`.)" msgstr "" #: ../../whatsnew/2.6.rst:1598 msgid "" "Other functions in the :mod:`math` module, :func:`isinf` and :func:`isnan`, " -"return true if their floating-point argument is infinite or Not A Number. (:" -"issue:`1640`)" +"return true if their floating-point argument is infinite or Not A Number. " +"(:issue:`1640`)" msgstr "" #: ../../whatsnew/2.6.rst:1602 @@ -2323,6 +2591,14 @@ msgid "" ">>> b.hex()\n" "'0x1.5555555555555p-2'" msgstr "" +">>> a = 3.75\n" +">>> a.hex()\n" +"'0x1.e000000000000p+1'\n" +">>> float.fromhex('0x1.e000000000000p+1')\n" +"3.75\n" +">>> b=1./3\n" +">>> b.hex()\n" +"'0x1.5555555555555p-2'" #: ../../whatsnew/2.6.rst:1619 msgid "" @@ -2347,9 +2623,9 @@ msgid "" "objects have a default hash method that uses ``id(obj)`` as the hash value. " "There's no tidy way to remove the :meth:`__hash__` method inherited from a " "parent class, so assigning ``None`` was implemented as an override. At the " -"C level, extensions can set ``tp_hash`` to :c:func:" -"`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury Forgeot " -"d'Arc; :issue:`2235`.)" +"C level, extensions can set ``tp_hash`` " +"to :c:func:`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury " +"Forgeot d'Arc; :issue:`2235`.)" msgstr "" #: ../../whatsnew/2.6.rst:1640 @@ -2363,8 +2639,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1646 msgid "" "Generator objects now have a :attr:`gi_code` attribute that refers to the " -"original code object backing the generator. (Contributed by Collin Winter; :" -"issue:`1473257`.)" +"original code object backing the generator. (Contributed by Collin " +"Winter; :issue:`1473257`.)" msgstr "" #: ../../whatsnew/2.6.rst:1650 @@ -2377,8 +2653,8 @@ msgstr "" msgid "" "The :func:`complex` constructor now accepts strings containing parenthesized " "complex numbers, meaning that ``complex(repr(cplx))`` will now round-trip " -"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). (:" -"issue:`1491866`)" +"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). " +"(:issue:`1491866`)" msgstr "" #: ../../whatsnew/2.6.rst:1659 @@ -2386,8 +2662,8 @@ msgid "" "The string :meth:`translate` method now accepts ``None`` as the translation " "table parameter, which is treated as the identity transformation. This " "makes it easier to carry out operations that only delete characters. " -"(Contributed by Bengt Richter and implemented by Raymond Hettinger; :issue:" -"`1193128`.)" +"(Contributed by Bengt Richter and implemented by Raymond " +"Hettinger; :issue:`1193128`.)" msgstr "" #: ../../whatsnew/2.6.rst:1665 @@ -2395,26 +2671,26 @@ msgid "" "The built-in :func:`dir` function now checks for a :meth:`__dir__` method on " "the objects it receives. This method must return a list of strings " "containing the names of valid attributes for the object, and lets the object " -"control the value that :func:`dir` produces. Objects that have :meth:" -"`__getattr__` or :meth:`__getattribute__` methods can use this to advertise " -"pseudo-attributes they will honor. (:issue:`1591665`)" +"control the value that :func:`dir` produces. Objects that " +"have :meth:`__getattr__` or :meth:`__getattribute__` methods can use this to " +"advertise pseudo-attributes they will honor. (:issue:`1591665`)" msgstr "" #: ../../whatsnew/2.6.rst:1673 msgid "" "Instance method objects have new attributes for the object and function " -"comprising the method; the new synonym for :attr:`!im_self` is :attr:" -"`~method.__self__`, and :attr:`!im_func` is also available as :attr:`~method." -"__func__`. The old names are still supported in Python 2.6, but are gone in " -"3.0." +"comprising the method; the new synonym for :attr:`!im_self` " +"is :attr:`~method.__self__`, and :attr:`!im_func` is also available " +"as :attr:`~method.__func__`. The old names are still supported in Python " +"2.6, but are gone in 3.0." msgstr "" #: ../../whatsnew/2.6.rst:1679 msgid "" -"An obscure change: when you use the :func:`locals` function inside a :" -"keyword:`class` statement, the resulting dictionary no longer returns free " -"variables. (Free variables, in this case, are variables referenced in the :" -"keyword:`!class` statement that aren't attributes of the class.)" +"An obscure change: when you use the :func:`locals` function inside " +"a :keyword:`class` statement, the resulting dictionary no longer returns " +"free variables. (Free variables, in this case, are variables referenced in " +"the :keyword:`!class` statement that aren't attributes of the class.)" msgstr "" #: ../../whatsnew/2.6.rst:1688 @@ -2425,8 +2701,8 @@ msgstr "最佳化" msgid "" "The :mod:`warnings` module has been rewritten in C. This makes it possible " "to invoke warnings from the parser, and may also make the interpreter's " -"startup faster. (Contributed by Neal Norwitz and Brett Cannon; :issue:" -"`1631171`.)" +"startup faster. (Contributed by Neal Norwitz and Brett " +"Cannon; :issue:`1631171`.)" msgstr "" #: ../../whatsnew/2.6.rst:1695 @@ -2477,9 +2753,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1729 msgid "" "Unicode strings now use faster code for detecting whitespace and line " -"breaks; this speeds up the :meth:`split` method by about 25% and :meth:" -"`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory usage is " -"reduced by using pymalloc for the Unicode string's data." +"breaks; this speeds up the :meth:`split` method by about 25% " +"and :meth:`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory " +"usage is reduced by using pymalloc for the Unicode string's data." msgstr "" #: ../../whatsnew/2.6.rst:1735 @@ -2582,8 +2858,8 @@ msgstr "" msgid "" "The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated " "from the :mod:`!cgi` module to the :mod:`urlparse <urllib.parse>` module. " -"The versions still available in the :mod:`!cgi` module will trigger :exc:" -"`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." +"The versions still available in the :mod:`!cgi` module will " +"trigger :exc:`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." msgstr "" #: ../../whatsnew/2.6.rst:1815 @@ -2627,8 +2903,8 @@ msgid "" "The revisions also improved the numerical soundness of the :mod:`cmath` " "module. For all functions, the real and imaginary parts of the results are " "accurate to within a few units of least precision (ulps) whenever possible. " -"See :issue:`1381` for the details. The branch cuts for :func:`asinh`, :func:" -"`atanh`: and :func:`atan` have also been corrected." +"See :issue:`1381` for the details. The branch cuts " +"for :func:`asinh`, :func:`atanh`: and :func:`atan` have also been corrected." msgstr "" #: ../../whatsnew/2.6.rst:1841 @@ -2675,9 +2951,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1870 msgid "" "Several places in the standard library that returned tuples have been " -"modified to return :func:`namedtuple` instances. For example, the :meth:" -"`Decimal.as_tuple` method now returns a named tuple with :attr:`sign`, :attr:" -"`digits`, and :attr:`exponent` fields." +"modified to return :func:`namedtuple` instances. For example, " +"the :meth:`Decimal.as_tuple` method now returns a named tuple " +"with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields." msgstr "" #: ../../whatsnew/2.6.rst:1877 @@ -2701,14 +2977,24 @@ msgid "" ">>> dq\n" "deque([2, 3, 4], maxlen=3)" msgstr "" +">>> from collections import deque\n" +">>> dq=deque(maxlen=3)\n" +">>> dq\n" +"deque([], maxlen=3)\n" +">>> dq.append(1); dq.append(2); dq.append(3)\n" +">>> dq\n" +"deque([1, 2, 3], maxlen=3)\n" +">>> dq.append(4)\n" +">>> dq\n" +"deque([2, 3, 4], maxlen=3)" #: ../../whatsnew/2.6.rst:1898 msgid "" "The :mod:`Cookie <http.cookies>` module's :class:`~http.cookies.Morsel` " "objects now support an :attr:`~http.cookies.Morsel.httponly` attribute. In " "some browsers. cookies with this attribute set cannot be accessed or " -"manipulated by JavaScript code. (Contributed by Arvin Schnell; :issue:" -"`1638033`.)" +"manipulated by JavaScript code. (Contributed by Arvin " +"Schnell; :issue:`1638033`.)" msgstr "" #: ../../whatsnew/2.6.rst:1903 @@ -2729,16 +3015,16 @@ msgstr "" msgid "" "The :class:`Textbox` class in the :mod:`curses.textpad` module now supports " "editing in insert mode as well as overwrite mode. Insert mode is enabled by " -"supplying a true value for the *insert_mode* parameter when creating the :" -"class:`Textbox` instance." +"supplying a true value for the *insert_mode* parameter when creating " +"the :class:`Textbox` instance." msgstr "" #: ../../whatsnew/2.6.rst:1918 msgid "" "The :mod:`datetime` module's :meth:`strftime` methods now support a ``%f`` " "format code that expands to the number of microseconds in the object, zero-" -"padded on the left to six places. (Contributed by Skip Montanaro; :issue:" -"`1158`.)" +"padded on the left to six places. (Contributed by Skip " +"Montanaro; :issue:`1158`.)" msgstr "" #: ../../whatsnew/2.6.rst:1923 @@ -2758,6 +3044,12 @@ msgid "" ">>> Decimal(1000).log10()\n" "Decimal(\"3\")" msgstr "" +">>> Decimal(1).exp()\n" +"Decimal(\"2.718281828459045235360287471\")\n" +">>> Decimal(\"2.7182818\").ln()\n" +"Decimal(\"0.9999999895305022877376682436\")\n" +">>> Decimal(1000).log10()\n" +"Decimal(\"3\")" #: ../../whatsnew/2.6.rst:1935 msgid "" @@ -2781,20 +3073,21 @@ msgstr "" #: ../../whatsnew/2.6.rst:1946 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`ftplib.FTP` class constructor as well as the :meth:" -"`connect` method. (Added by Facundo Batista.) Also, the :class:`FTP` " -"class's :meth:`storbinary` and :meth:`storlines` now take an optional " -"*callback* parameter that will be called with each block of data after the " -"data has been sent. (Contributed by Phil Schwartz; :issue:`1221598`.)" +"was added to the :class:`ftplib.FTP` class constructor as well as " +"the :meth:`connect` method. (Added by Facundo Batista.) Also, " +"the :class:`FTP` class's :meth:`storbinary` and :meth:`storlines` now take " +"an optional *callback* parameter that will be called with each block of data " +"after the data has been sent. (Contributed by Phil " +"Schwartz; :issue:`1221598`.)" msgstr "" #: ../../whatsnew/2.6.rst:1954 msgid "" -"The :func:`reduce` built-in function is also available in the :mod:" -"`functools` module. In Python 3.0, the builtin has been dropped and :func:" -"`reduce` is only available from :mod:`functools`; currently there are no " -"plans to drop the builtin in the 2.x series. (Patched by Christian Heimes; :" -"issue:`1739906`.)" +"The :func:`reduce` built-in function is also available in " +"the :mod:`functools` module. In Python 3.0, the builtin has been dropped " +"and :func:`reduce` is only available from :mod:`functools`; currently there " +"are no plans to drop the builtin in the 2.x series. (Patched by Christian " +"Heimes; :issue:`1739906`.)" msgstr "" #: ../../whatsnew/2.6.rst:1960 @@ -2809,8 +3102,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1966 msgid "" "The :func:`glob.glob` function can now return Unicode filenames if a Unicode " -"path was used and Unicode filenames are matched within the directory. (:" -"issue:`1001604`)" +"path was used and Unicode filenames are matched within the directory. " +"(:issue:`1001604`)" msgstr "" #: ../../whatsnew/2.6.rst:1970 @@ -2826,6 +3119,8 @@ msgid "" ">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" "[1, 2, 3, 5, 8, 9, 16]" msgstr "" +">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" +"[1, 2, 3, 5, 8, 9, 16]" #: ../../whatsnew/2.6.rst:1978 msgid "" @@ -2837,17 +3132,18 @@ msgstr "" #: ../../whatsnew/2.6.rst:1983 msgid "" ":mod:`heapq` is now implemented to only use less-than comparison, instead of " -"the less-than-or-equal comparison it previously used. This makes :mod:" -"`heapq`'s usage of a type match the :meth:`list.sort` method. (Contributed " -"by Raymond Hettinger.)" +"the less-than-or-equal comparison it previously used. This " +"makes :mod:`heapq`'s usage of a type match the :meth:`list.sort` method. " +"(Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.6.rst:1989 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`httplib.HTTPConnection <http.client." -"HTTPConnection>` and :class:`HTTPSConnection <http.client.HTTPSConnection>` " -"class constructors. (Added by Facundo Batista.)" +"was added to the :class:`httplib.HTTPConnection " +"<http.client.HTTPConnection>` and :class:`HTTPSConnection " +"<http.client.HTTPSConnection>` class constructors. (Added by Facundo " +"Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:1994 @@ -2860,8 +3156,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2000 msgid "" -"Some new functions in the module include :func:`isgenerator`, :func:" -"`isgeneratorfunction`, and :func:`isabstract`." +"Some new functions in the module " +"include :func:`isgenerator`, :func:`isgeneratorfunction`, " +"and :func:`isabstract`." msgstr "" #: ../../whatsnew/2.6.rst:2004 @@ -2880,6 +3177,8 @@ msgid "" ">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" "((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" msgstr "" +">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" +"((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" #: ../../whatsnew/2.6.rst:2013 msgid "" @@ -2895,6 +3194,10 @@ msgid "" " (2, 4), (2, 5), (2, 6),\n" " (3, 4), (3, 5), (3, 6)]" msgstr "" +">>> list(itertools.product([1,2,3], [4,5,6]))\n" +"[(1, 4), (1, 5), (1, 6),\n" +" (2, 4), (2, 5), (2, 6),\n" +" (3, 4), (3, 5), (3, 6)]" #: ../../whatsnew/2.6.rst:2022 msgid "" @@ -2909,6 +3212,9 @@ msgid "" "[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" " (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" msgstr "" +">>> list(itertools.product([1,2], repeat=3))\n" +"[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" +" (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" #: ../../whatsnew/2.6.rst:2031 msgid "With two iterables, *2N*-tuples are returned. ::" @@ -2922,6 +3228,11 @@ msgid "" " (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" " (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" msgstr "" +">>> list(itertools.product([1,2], [3,4], repeat=2))\n" +"[(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),\n" +" (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),\n" +" (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" +" (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" #: ../../whatsnew/2.6.rst:2039 msgid "" @@ -2939,6 +3250,13 @@ msgid "" "[('1', '2', '3'), ('1', '2', '4'),\n" " ('1', '3', '4'), ('2', '3', '4')]" msgstr "" +">>> list(itertools.combinations('123', 2))\n" +"[('1', '2'), ('1', '3'), ('2', '3')]\n" +">>> list(itertools.combinations('123', 3))\n" +"[('1', '2', '3')]\n" +">>> list(itertools.combinations('1234', 3))\n" +"[('1', '2', '3'), ('1', '2', '4'),\n" +" ('1', '3', '4'), ('2', '3', '4')]" #: ../../whatsnew/2.6.rst:2050 msgid "" @@ -2955,14 +3273,20 @@ msgid "" " (3, 1), (3, 2), (3, 4),\n" " (4, 1), (4, 2), (4, 3)]" msgstr "" +">>> list(itertools.permutations([1,2,3,4], 2))\n" +"[(1, 2), (1, 3), (1, 4),\n" +" (2, 1), (2, 3), (2, 4),\n" +" (3, 1), (3, 2), (3, 4),\n" +" (4, 1), (4, 2), (4, 3)]" #: ../../whatsnew/2.6.rst:2060 msgid "" "``itertools.chain(*iterables)`` is an existing function in :mod:`itertools` " -"that gained a new constructor in Python 2.6. ``itertools.chain." -"from_iterable(iterable)`` takes a single iterable that should return other " -"iterables. :func:`chain` will then return all the elements of the first " -"iterable, then all the elements of the second, and so on. ::" +"that gained a new constructor in Python 2.6. " +"``itertools.chain.from_iterable(iterable)`` takes a single iterable that " +"should return other iterables. :func:`chain` will then return all the " +"elements of the first iterable, then all the elements of the second, and so " +"on. ::" msgstr "" #: ../../whatsnew/2.6.rst:2067 @@ -2970,6 +3294,8 @@ msgid "" ">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" "[1, 2, 3, 4, 5, 6]" msgstr "" +">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" +"[1, 2, 3, 4, 5, 6]" #: ../../whatsnew/2.6.rst:2070 msgid "(All contributed by Raymond Hettinger.)" @@ -2977,11 +3303,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:2072 msgid "" -"The :mod:`logging` module's :class:`FileHandler` class and its subclasses :" -"class:`WatchedFileHandler`, :class:`RotatingFileHandler`, and :class:" -"`TimedRotatingFileHandler` now have an optional *delay* parameter to their " -"constructors. If *delay* is true, opening of the log file is deferred until " -"the first :meth:`emit` call is made. (Contributed by Vinay Sajip.)" +"The :mod:`logging` module's :class:`FileHandler` class and its " +"subclasses :class:`WatchedFileHandler`, :class:`RotatingFileHandler`, " +"and :class:`TimedRotatingFileHandler` now have an optional *delay* parameter " +"to their constructors. If *delay* is true, opening of the log file is " +"deferred until the first :meth:`emit` call is made. (Contributed by Vinay " +"Sajip.)" msgstr "" #: ../../whatsnew/2.6.rst:2079 @@ -3033,9 +3360,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:2108 msgid "" -":func:`trunc` rounds a number toward zero, returning the closest :class:" -"`Integral` that's between the function's argument and zero. Added as part of " -"the backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__." +":func:`trunc` rounds a number toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero. " +"Added as part of the backport of `PEP 3141's type hierarchy for numbers " +"<#pep-3141>`__." msgstr "" #: ../../whatsnew/2.6.rst:2113 @@ -3053,8 +3381,8 @@ msgid "" "``sqrt(float('NaN'))`` should return a NaN on all IEEE 754 platforms. Where " "Annex 'F' of the C99 standard recommends signaling 'divide-by-zero' or " "'invalid', Python will raise :exc:`ValueError`. Where Annex 'F' of the C99 " -"standard recommends signaling 'overflow', Python will raise :exc:" -"`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" +"standard recommends signaling 'overflow', Python will " +"raise :exc:`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" msgstr "" #: ../../whatsnew/2.6.rst:2127 @@ -3103,6 +3431,12 @@ msgid "" ">>> inst_name(help)\n" "'_Helper'" msgstr "" +">>> inst_name = operator.attrgetter(\n" +"... '__class__.__name__')\n" +">>> inst_name('')\n" +"'str'\n" +">>> inst_name(help)\n" +"'_Helper'" #: ../../whatsnew/2.6.rst:2157 msgid "(Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)" @@ -3155,16 +3489,16 @@ msgid "" "In the :mod:`os.path` module, the :func:`splitext` function has been changed " "to not split on leading period characters. This produces better results when " "operating on Unix's dot-files. For example, ``os.path.splitext('.ipython')`` " -"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. (:issue:" -"`1115886`)" +"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. " +"(:issue:`1115886`)" msgstr "" #: ../../whatsnew/2.6.rst:2196 msgid "" "A new function, ``os.path.relpath(path, start='.')``, returns a relative " "path from the ``start`` path, if it's supplied, or from the current working " -"directory to the destination ``path``. (Contributed by Richard Barran; :" -"issue:`1339796`.)" +"directory to the destination ``path``. (Contributed by Richard " +"Barran; :issue:`1339796`.)" msgstr "" #: ../../whatsnew/2.6.rst:2201 @@ -3217,6 +3551,16 @@ msgid "" " +-- StandardError\n" " ..." msgstr "" +">>> import pkgutil\n" +">>> print pkgutil.get_data('test', 'exception_hierarchy.txt')\n" +"BaseException\n" +" +-- SystemExit\n" +" +-- KeyboardInterrupt\n" +" +-- GeneratorExit\n" +" +-- Exception\n" +" +-- StopIteration\n" +" +-- StandardError\n" +" ..." #: ../../whatsnew/2.6.rst:2236 msgid "(Contributed by Paul Moore; :issue:`2439`.)" @@ -3224,9 +3568,9 @@ msgstr "(由 Paul Moore 貢獻;:issue:`2439`。)" #: ../../whatsnew/2.6.rst:2238 msgid "" -"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting their :" -"attr:`buffer_size` attribute to change the size of the buffer used to hold " -"character data. (Contributed by Achim Gaedke; :issue:`1137`.)" +"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting " +"their :attr:`buffer_size` attribute to change the size of the buffer used to " +"hold character data. (Contributed by Achim Gaedke; :issue:`1137`.)" msgstr "" #: ../../whatsnew/2.6.rst:2243 @@ -3281,10 +3625,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2280 msgid "" -"The :mod:`sched` module's :class:`scheduler` instances now have a read-only :" -"attr:`queue` attribute that returns the contents of the scheduler's queue, " -"represented as a list of named tuples with the fields ``(time, priority, " -"action, argument)``. (Contributed by Raymond Hettinger; :issue:`1861`.)" +"The :mod:`sched` module's :class:`scheduler` instances now have a read-" +"only :attr:`queue` attribute that returns the contents of the scheduler's " +"queue, represented as a list of named tuples with the fields ``(time, " +"priority, action, argument)``. (Contributed by Raymond " +"Hettinger; :issue:`1861`.)" msgstr "" #: ../../whatsnew/2.6.rst:2286 @@ -3320,6 +3665,8 @@ msgid "" "shutil.copytree('Doc/library', '/tmp/library',\n" " ignore=shutil.ignore_patterns('*~', '.svn'))" msgstr "" +"shutil.copytree('Doc/library', '/tmp/library',\n" +" ignore=shutil.ignore_patterns('*~', '.svn'))" #: ../../whatsnew/2.6.rst:2310 msgid "(Contributed by Tarek Ziadé; :issue:`2663`.)" @@ -3340,11 +3687,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2322 msgid "" "Event loops will use this by opening a pipe to create two descriptors, one " -"for reading and one for writing. The writable descriptor will be passed to :" -"func:`set_wakeup_fd`, and the readable descriptor will be added to the list " -"of descriptors monitored by the event loop via :c:func:`!select` or :c:func:" -"`!poll`. On receiving a signal, a byte will be written and the main event " -"loop will be woken up, avoiding the need to poll." +"for reading and one for writing. The writable descriptor will be passed " +"to :func:`set_wakeup_fd`, and the readable descriptor will be added to the " +"list of descriptors monitored by the event loop via :c:func:`!select` " +"or :c:func:`!poll`. On receiving a signal, a byte will be written and the " +"main event loop will be woken up, avoiding the need to poll." msgstr "" #: ../../whatsnew/2.6.rst:2330 @@ -3381,8 +3728,8 @@ msgstr "" msgid "" "An implementation of the LMTP protocol (:rfc:`2033`) was also added to the " "module. LMTP is used in place of SMTP when transferring e-mail between " -"agents that don't manage a mail queue. (LMTP implemented by Leif Hedstrom; :" -"issue:`957003`.)" +"agents that don't manage a mail queue. (LMTP implemented by Leif " +"Hedstrom; :issue:`957003`.)" msgstr "" #: ../../whatsnew/2.6.rst:2356 @@ -3414,12 +3761,12 @@ msgstr "" msgid "" "The base classes in the :mod:`SocketServer <socketserver>` module now " "support calling a :meth:`~socketserver.BaseServer.handle_timeout` method " -"after a span of inactivity specified by the server's :attr:`~socketserver." -"BaseServer.timeout` attribute. (Contributed by Michael Pomraning.) The :" -"meth:`~socketserver.BaseServer.serve_forever` method now takes an optional " -"poll interval measured in seconds, controlling how often the server will " -"check for a shutdown request. (Contributed by Pedro Werneck and Jeffrey " -"Yasskin; :issue:`742598`, :issue:`1193577`.)" +"after a span of inactivity specified by the " +"server's :attr:`~socketserver.BaseServer.timeout` attribute. (Contributed " +"by Michael Pomraning.) The :meth:`~socketserver.BaseServer.serve_forever` " +"method now takes an optional poll interval measured in seconds, controlling " +"how often the server will check for a shutdown request. (Contributed by " +"Pedro Werneck and Jeffrey Yasskin; :issue:`742598`, :issue:`1193577`.)" msgstr "" #: ../../whatsnew/2.6.rst:2383 @@ -3437,10 +3784,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2391 msgid "" "The :class:`~subprocess.Popen` objects provided by the :mod:`subprocess` " -"module now have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess." -"Popen.kill`, and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :" -"meth:`!send_signal` only supports the :py:const:`~signal.SIGTERM` signal, " -"and all these methods are aliases for the Win32 API function :c:func:`!" +"module now " +"have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess.Popen.kill`, " +"and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :meth:`!" +"send_signal` only supports the :py:const:`~signal.SIGTERM` signal, and all " +"these methods are aliases for the Win32 API function :c:func:`!" "TerminateProcess`. (Contributed by Christian Heimes.)" msgstr "" @@ -3448,10 +3796,10 @@ msgstr "" msgid "" "A new variable in the :mod:`sys` module, :attr:`float_info`, is an object " "containing information derived from the :file:`float.h` file about the " -"platform's floating-point support. Attributes of this object include :attr:" -"`mant_dig` (number of digits in the mantissa), :attr:`epsilon` (smallest " -"difference between 1.0 and the next largest value representable), and " -"several others. (Contributed by Christian Heimes; :issue:`1534`.)" +"platform's floating-point support. Attributes of this object " +"include :attr:`mant_dig` (number of digits in the mantissa), :attr:`epsilon` " +"(smallest difference between 1.0 and the next largest value representable), " +"and several others. (Contributed by Christian Heimes; :issue:`1534`.)" msgstr "" #: ../../whatsnew/2.6.rst:2406 @@ -3479,9 +3827,9 @@ msgstr "" msgid "" "A new function, :func:`getsizeof`, takes a Python object and returns the " "amount of memory used by the object, measured in bytes. Built-in objects " -"return correct results; third-party extensions may not, but can define a :" -"meth:`__sizeof__` method to return the object's size. (Contributed by Robert " -"Schuppenies; :issue:`2898`.)" +"return correct results; third-party extensions may not, but can define " +"a :meth:`__sizeof__` method to return the object's size. (Contributed by " +"Robert Schuppenies; :issue:`2898`.)" msgstr "" #: ../../whatsnew/2.6.rst:2432 @@ -3504,6 +3852,8 @@ msgid "" "tar = tarfile.open(\"output.tar\", \"w\",\n" " format=tarfile.PAX_FORMAT)" msgstr "" +"tar = tarfile.open(\"output.tar\", \"w\",\n" +" format=tarfile.PAX_FORMAT)" #: ../../whatsnew/2.6.rst:2444 msgid "" @@ -3531,9 +3881,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2462 msgid "" -"An optional ``timeout`` parameter was added to the :class:`!telnetlib." -"Telnet` class constructor, specifying a timeout measured in seconds. (Added " -"by Facundo Batista.)" +"An optional ``timeout`` parameter was added to the :class:`!" +"telnetlib.Telnet` class constructor, specifying a timeout measured in " +"seconds. (Added by Facundo Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:2466 @@ -3555,17 +3905,18 @@ msgstr "" #: ../../whatsnew/2.6.rst:2476 msgid "" "The :class:`NamedTemporaryFile` and :class:`SpooledTemporaryFile` classes " -"both work as context managers, so you can write ``with tempfile." -"NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander Belopolsky; :" -"issue:`2021`.)" +"both work as context managers, so you can write ``with " +"tempfile.NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander " +"Belopolsky; :issue:`2021`.)" msgstr "" #: ../../whatsnew/2.6.rst:2481 msgid "" "The :mod:`test.test_support <test.support>` module gained a number of " -"context managers useful for writing tests. :func:`~test.support.os_helper." -"EnvironmentVarGuard` is a context manager that temporarily changes " -"environment variables and automatically restores them to their old values." +"context managers useful for writing " +"tests. :func:`~test.support.os_helper.EnvironmentVarGuard` is a context " +"manager that temporarily changes environment variables and automatically " +"restores them to their old values." msgstr "" #: ../../whatsnew/2.6.rst:2487 @@ -3583,6 +3934,10 @@ msgid "" " f = urllib.urlopen('https://sf.net')\n" " ..." msgstr "" +"with test_support.TransientResource(IOError,\n" +" errno=errno.ETIMEDOUT):\n" +" f = urllib.urlopen('https://sf.net')\n" +" ..." #: ../../whatsnew/2.6.rst:2498 msgid "" @@ -3634,22 +3989,22 @@ msgstr "(由 Dwayne Bailey 貢獻;:issue:`1581073`。)" #: ../../whatsnew/2.6.rst:2531 msgid "" -"The :mod:`threading` module API is being changed to use properties such as :" -"attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, and " -"some methods have been renamed to use underscores instead of camel-case; for " -"example, the :meth:`activeCount` method is renamed to :meth:`active_count`. " -"Both the 2.6 and 3.0 versions of the module support the same properties and " -"renamed methods, but don't remove the old methods. No date has been set for " -"the deprecation of the old APIs in Python 3.x; the old APIs won't be removed " -"in any 2.x version. (Carried out by several people, most notably Benjamin " -"Peterson.)" +"The :mod:`threading` module API is being changed to use properties such " +"as :attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, " +"and some methods have been renamed to use underscores instead of camel-case; " +"for example, the :meth:`activeCount` method is renamed " +"to :meth:`active_count`. Both the 2.6 and 3.0 versions of the module " +"support the same properties and renamed methods, but don't remove the old " +"methods. No date has been set for the deprecation of the old APIs in Python " +"3.x; the old APIs won't be removed in any 2.x version. (Carried out by " +"several people, most notably Benjamin Peterson.)" msgstr "" #: ../../whatsnew/2.6.rst:2542 msgid "" -"The :mod:`threading` module's :class:`Thread` objects gained an :attr:" -"`ident` property that returns the thread's identifier, a nonzero integer. " -"(Contributed by Gregory P. Smith; :issue:`2871`.)" +"The :mod:`threading` module's :class:`Thread` objects gained " +"an :attr:`ident` property that returns the thread's identifier, a nonzero " +"integer. (Contributed by Gregory P. Smith; :issue:`2871`.)" msgstr "" #: ../../whatsnew/2.6.rst:2547 @@ -3658,8 +4013,8 @@ msgid "" "statement being timed and for the setup code. Two convenience functions were " "added for creating :class:`Timer` instances: ``repeat(stmt, setup, time, " "repeat, number)`` and ``timeit(stmt, setup, time, number)`` create an " -"instance and call the corresponding method. (Contributed by Erik Demaine; :" -"issue:`1533909`.)" +"instance and call the corresponding method. (Contributed by Erik " +"Demaine; :issue:`1533909`.)" msgstr "" #: ../../whatsnew/2.6.rst:2556 @@ -3735,6 +4090,12 @@ msgid "" "urllib2.URLError: <urlopen error timed out>\n" ">>>" msgstr "" +">>> u = urllib2.urlopen(\"http://slow.example.com\",\n" +" timeout=3)\n" +"Traceback (most recent call last):\n" +" ...\n" +"urllib2.URLError: <urlopen error timed out>\n" +">>>" #: ../../whatsnew/2.6.rst:2592 msgid "(Added by Facundo Batista.)" @@ -3763,14 +4124,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2607 msgid "" -"The XML-RPC :class:`SimpleXMLRPCServer <xmlrpc.server>` and :class:" -"`DocXMLRPCServer <xmlrpc.server>` classes can now be prevented from " -"immediately opening and binding to their socket by passing ``False`` as the " -"*bind_and_activate* constructor parameter. This can be used to modify the " -"instance's :attr:`allow_reuse_address` attribute before calling the :meth:" -"`server_bind` and :meth:`server_activate` methods to open the socket and " -"begin listening for connections. (Contributed by Peter Parente; :issue:" -"`1599845`.)" +"The XML-RPC :class:`SimpleXMLRPCServer <xmlrpc.server>` " +"and :class:`DocXMLRPCServer <xmlrpc.server>` classes can now be prevented " +"from immediately opening and binding to their socket by passing ``False`` as " +"the *bind_and_activate* constructor parameter. This can be used to modify " +"the instance's :attr:`allow_reuse_address` attribute before calling " +"the :meth:`server_bind` and :meth:`server_activate` methods to open the " +"socket and begin listening for connections. (Contributed by Peter " +"Parente; :issue:`1599845`.)" msgstr "" #: ../../whatsnew/2.6.rst:2616 @@ -3787,14 +4148,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2624 msgid "" "The :mod:`xmlrpclib <xmlrpc.client>` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`) The code can also handle dates before 1900 " -"(contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented " -"by using ``<i8>`` in XML-RPC responses (contributed by Riku Lindblad; :issue:" -"`2985`)." +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also " +"handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-" +"bit integers represented by using ``<i8>`` in XML-RPC responses (contributed " +"by Riku Lindblad; :issue:`2985`)." msgstr "" #: ../../whatsnew/2.6.rst:2634 @@ -3848,8 +4209,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2671 msgid "" -"The :func:`parse` function takes an expression and returns an AST. The :func:" -"`dump` function outputs a representation of a tree, suitable for debugging::" +"The :func:`parse` function takes an expression and returns an AST. " +"The :func:`dump` function outputs a representation of a tree, suitable for " +"debugging::" msgstr "" #: ../../whatsnew/2.6.rst:2675 @@ -3864,6 +4226,15 @@ msgid "" "\"\"\")\n" "print ast.dump(t)" msgstr "" +"import ast\n" +"\n" +"t = ast.parse(\"\"\"\n" +"d = {}\n" +"for i in 'abcdefghijklm':\n" +" d[i + i] = ord(i) - ord('a') + 1\n" +"print d\n" +"\"\"\")\n" +"print ast.dump(t)" #: ../../whatsnew/2.6.rst:2685 msgid "This outputs a deeply nested tree::" @@ -3902,6 +4273,36 @@ msgid "" " ], nl=True)\n" " ])" msgstr "" +"Module(body=[\n" +" Assign(targets=[\n" +" Name(id='d', ctx=Store())\n" +" ], value=Dict(keys=[], values=[]))\n" +" For(target=Name(id='i', ctx=Store()),\n" +" iter=Str(s='abcdefghijklm'), body=[\n" +" Assign(targets=[\n" +" Subscript(value=\n" +" Name(id='d', ctx=Load()),\n" +" slice=\n" +" Index(value=\n" +" BinOp(left=Name(id='i', ctx=Load()), op=Add(),\n" +" right=Name(id='i', ctx=Load()))), ctx=Store())\n" +" ], value=\n" +" BinOp(left=\n" +" BinOp(left=\n" +" Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Name(id='i', ctx=Load())\n" +" ], keywords=[], starargs=None, kwargs=None),\n" +" op=Sub(), right=Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Str(s='a')\n" +" ], keywords=[], starargs=None, kwargs=None)),\n" +" op=Add(), right=Num(n=1)))\n" +" ], orelse=[])\n" +" Print(dest=None, values=[\n" +" Name(id='d', ctx=Load())\n" +" ], nl=True)\n" +" ])" #: ../../whatsnew/2.6.rst:2718 msgid "" @@ -3923,6 +4324,13 @@ msgid "" " ...\n" "ValueError: malformed string" msgstr "" +">>> literal = '(\"a\", \"b\", {2:4, 3:8, 1:2})'\n" +">>> print ast.literal_eval(literal)\n" +"('a', 'b', {1: 2, 2: 4, 3: 8})\n" +">>> print ast.literal_eval('\"a\" + \"b\"')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: malformed string" #: ../../whatsnew/2.6.rst:2734 msgid "" @@ -3963,8 +4371,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2761 msgid "" -"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` or :" -"meth:`__oct__` methods, these versions will call the :meth:`__index__` " +"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` " +"or :meth:`__oct__` methods, these versions will call the :meth:`__index__` " "method and convert the result to hexadecimal or octal. :func:`oct` will use " "the new ``0o`` notation for its result." msgstr "" @@ -4080,10 +4488,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:2853 msgid "" -"All :mod:`ctypes` data types now support :meth:`from_buffer` and :meth:" -"`from_buffer_copy` methods that create a ctypes instance based on a provided " -"buffer object. :meth:`from_buffer_copy` copies the contents of the object, " -"while :meth:`from_buffer` will share the same memory area." +"All :mod:`ctypes` data types now support :meth:`from_buffer` " +"and :meth:`from_buffer_copy` methods that create a ctypes instance based on " +"a provided buffer object. :meth:`from_buffer_copy` copies the contents of " +"the object, while :meth:`from_buffer` will share the same memory area." msgstr "" #: ../../whatsnew/2.6.rst:2860 @@ -4104,8 +4512,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2870 msgid "" -"The Win32 LastError variable is similarly supported by the :func:`DLL`, :" -"func:`OleDLL`, and :func:`WinDLL` functions. You supply " +"The Win32 LastError variable is similarly supported by " +"the :func:`DLL`, :func:`OleDLL`, and :func:`WinDLL` functions. You supply " "``use_last_error=True`` as a keyword parameter and then call the module-" "level methods :meth:`set_last_error` and :meth:`get_last_error`." msgstr "" @@ -4150,8 +4558,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2908 ../../whatsnew/2.6.rst:3262 msgid "" -"String exceptions have been removed. Attempting to use them raises a :exc:" -"`TypeError`." +"String exceptions have been removed. Attempting to use them raises " +"a :exc:`TypeError`." msgstr "" #: ../../whatsnew/2.6.rst:2911 @@ -4170,13 +4578,13 @@ msgstr "" #: ../../whatsnew/2.6.rst:2921 msgid "" -"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!bgenlocations`, :" -"mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!Canvas`, :mod:`!compiler`, :" -"mod:`!dircache`, :mod:`!dl`, :mod:`!fpformat`, :mod:`!gensuitemodule`, :mod:" -"`!ihooks`, :mod:`!imageop`, :mod:`!imgfile`, :mod:`!linuxaudiodev`, :mod:`!" -"mhlib`, :mod:`!mimetools`, :mod:`!multifile`, :mod:`!new`, :mod:`!pure`, :" -"mod:`!statvfs`, :mod:`!sunaudiodev`, :mod:`!test.testall`, and :mod:`!" -"toaiff`." +"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!" +"bgenlocations`, :mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!" +"Canvas`, :mod:`!compiler`, :mod:`!dircache`, :mod:`!dl`, :mod:`!" +"fpformat`, :mod:`!gensuitemodule`, :mod:`!ihooks`, :mod:`!imageop`, :mod:`!" +"imgfile`, :mod:`!linuxaudiodev`, :mod:`!mhlib`, :mod:`!mimetools`, :mod:`!" +"multifile`, :mod:`!new`, :mod:`!pure`, :mod:`!statvfs`, :mod:`!" +"sunaudiodev`, :mod:`!test.testall`, and :mod:`!toaiff`." msgstr "" #: ../../whatsnew/2.6.rst:2946 @@ -4225,17 +4633,17 @@ msgstr "" #: ../../whatsnew/2.6.rst:2974 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.6.rst:2976 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.6.rst:2978 msgid "" "Python now must be compiled with C89 compilers (after 19 years!). This " -"means that the Python source tree has dropped its own implementations of :c:" -"func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " +"means that the Python source tree has dropped its own implementations " +"of :c:func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " "library." msgstr "" @@ -4248,11 +4656,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2988 msgid "" -"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. The :" -"program:`configure` script can take a :option:`!--with-universal-archs=[32-" -"bit|64-bit|all]` switch, controlling whether the binaries are built for 32-" -"bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both. " -"(Contributed by Ronald Oussoren.)" +"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. " +"The :program:`configure` script can take a :option:`!--with-universal-" +"archs=[32-bit|64-bit|all]` switch, controlling whether the binaries are " +"built for 32-bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), " +"or both. (Contributed by Ronald Oussoren.)" msgstr "" #: ../../whatsnew/2.6.rst:2995 @@ -4294,9 +4702,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:3021 msgid "" -"The BerkeleyDB module now has a C API object, available as ``bsddb.db." -"api``. This object can be used by other C extensions that wish to use the :" -"mod:`bsddb` module for their own purposes. (Contributed by Duncan Grisby.)" +"The BerkeleyDB module now has a C API object, available as " +"``bsddb.db.api``. This object can be used by other C extensions that wish " +"to use the :mod:`bsddb` module for their own purposes. (Contributed by " +"Duncan Grisby.)" msgstr "" #: ../../whatsnew/2.6.rst:3026 @@ -4324,11 +4733,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:3044 msgid "" "Importing modules simultaneously in two different threads no longer " -"deadlocks; it will now raise an :exc:`ImportError`. A new API function, :c:" -"func:`PyImport_ImportModuleNoBlock`, will look for a module in ``sys." -"modules`` first, then try to import it after acquiring an import lock. If " -"the import lock is held by another thread, an :exc:`ImportError` is raised. " -"(Contributed by Christian Heimes.)" +"deadlocks; it will now raise an :exc:`ImportError`. A new API " +"function, :c:func:`PyImport_ImportModuleNoBlock`, will look for a module in " +"``sys.modules`` first, then try to import it after acquiring an import " +"lock. If the import lock is held by another thread, an :exc:`ImportError` " +"is raised. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3052 @@ -4363,25 +4772,26 @@ msgstr "" msgid "" "Many C extensions define their own little macro for adding integers and " "strings to the module's dictionary in the ``init*`` function. Python 2.6 " -"finally defines standard macros for adding values to a module, :c:macro:" -"`PyModule_AddStringMacro` and :c:macro:`PyModule_AddIntMacro()`. " -"(Contributed by Christian Heimes.)" +"finally defines standard macros for adding values to a " +"module, :c:macro:`PyModule_AddStringMacro` " +"and :c:macro:`PyModule_AddIntMacro()`. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3082 msgid "" "Some macros were renamed in both 3.0 and 2.6 to make it clearer that they " -"are macros, not functions. :c:macro:`!Py_Size()` became :c:macro:" -"`Py_SIZE()`, :c:macro:`!Py_Type()` became :c:macro:`Py_TYPE()`, and :c:macro:" -"`!Py_Refcnt()` became :c:macro:`Py_REFCNT()`. The mixed-case macros are " -"still available in Python 2.6 for backward compatibility. (:issue:`1629`)" +"are macros, not functions. :c:macro:`!Py_Size()` " +"became :c:macro:`Py_SIZE()`, :c:macro:`!Py_Type()` " +"became :c:macro:`Py_TYPE()`, and :c:macro:`!Py_Refcnt()` " +"became :c:macro:`Py_REFCNT()`. The mixed-case macros are still available in " +"Python 2.6 for backward compatibility. (:issue:`1629`)" msgstr "" #: ../../whatsnew/2.6.rst:3091 msgid "" "Distutils now places C extensions it builds in a different directory when " -"running on a debug version of Python. (Contributed by Collin Winter; :issue:" -"`1530959`.)" +"running on a debug version of Python. (Contributed by Collin " +"Winter; :issue:`1530959`.)" msgstr "" #: ../../whatsnew/2.6.rst:3095 @@ -4450,27 +4860,27 @@ msgstr "" #: ../../whatsnew/2.6.rst:3142 msgid "" -"The :mod:`socket` module's socket objects now have an :meth:`~socket.socket." -"ioctl` method that provides a limited interface to the :c:func:`WSAIoctl` " -"system interface." +"The :mod:`socket` module's socket objects now have " +"an :meth:`~socket.socket.ioctl` method that provides a limited interface to " +"the :c:func:`WSAIoctl` system interface." msgstr "" #: ../../whatsnew/2.6.rst:3146 msgid "" -"The :mod:`_winreg <winreg>` module now has a function, :func:`~winreg." -"ExpandEnvironmentStrings`, that expands environment variable references such " -"as ``%NAME%`` in an input string. The handle objects provided by this " -"module now support the context protocol, so they can be used in :keyword:" -"`with` statements. (Contributed by Christian Heimes.)" +"The :mod:`_winreg <winreg>` module now has a " +"function, :func:`~winreg.ExpandEnvironmentStrings`, that expands environment " +"variable references such as ``%NAME%`` in an input string. The handle " +"objects provided by this module now support the context protocol, so they " +"can be used in :keyword:`with` statements. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3153 msgid "" ":mod:`_winreg <winreg>` also has better support for x64 systems, exposing " -"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` functions, " -"which enable and disable registry reflection for 32-bit processes running on " -"64-bit systems. (:issue:`1753245`)" +"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` functions, which enable and disable " +"registry reflection for 32-bit processes running on 64-bit systems. " +"(:issue:`1753245`)" msgstr "" #: ../../whatsnew/2.6.rst:3159 @@ -4493,24 +4903,25 @@ msgstr "" #: ../../whatsnew/2.6.rst:3174 msgid "" -"The :mod:`!macfs` module has been removed. This in turn required the :func:" -"`!macostools.touched` function to be removed because it depended on the :mod:" -"`!macfs` module. (:issue:`1490190`)" +"The :mod:`!macfs` module has been removed. This in turn required " +"the :func:`!macostools.touched` function to be removed because it depended " +"on the :mod:`!macfs` module. (:issue:`1490190`)" msgstr "" #: ../../whatsnew/2.6.rst:3178 msgid "" "Many other Mac OS modules have been deprecated and will be removed in Python " "3.0: :mod:`!_builtinSuites`, :mod:`!aepack`, :mod:`!aetools`, :mod:`!" -"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!appletrunner`, :" -"mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!autoGIL`, :mod:`!Carbon`, :" -"mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!ColorPicker`, :mod:`!" -"EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!FrameWork`, :mod:`!" -"findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!icopen`, :mod:`!" -"macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!macostools`, :mod:`!" -"macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!Netscape`, :mod:`!" -"OSATerminology`, :mod:`!pimp`, :mod:`!PixMapWrapper`, :mod:`!StdSuites`, :" -"mod:`!SystemEvents`, :mod:`!Terminal`, and :mod:`!terminalcommand`." +"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!" +"appletrunner`, :mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!" +"autoGIL`, :mod:`!Carbon`, :mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!" +"ColorPicker`, :mod:`!EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!" +"FrameWork`, :mod:`!findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!" +"icopen`, :mod:`!macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!" +"macostools`, :mod:`!macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!" +"Netscape`, :mod:`!OSATerminology`, :mod:`!pimp`, :mod:`!" +"PixMapWrapper`, :mod:`!StdSuites`, :mod:`!SystemEvents`, :mod:`!Terminal`, " +"and :mod:`!terminalcommand`." msgstr "" #: ../../whatsnew/2.6.rst:3221 @@ -4522,10 +4933,10 @@ msgid "" "A number of old IRIX-specific modules were deprecated and will be removed in " "Python 3.0: :mod:`!al` and :mod:`!AL`, :mod:`!cd`, :mod:`!cddb`, :mod:`!" "cdplayer`, :mod:`!CL` and :mod:`!cl`, :mod:`!DEVICE`, :mod:`!ERRNO`, :mod:`!" -"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!GET`, :mod:" -"`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!IOCTL`, :mod:`!" -"jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` and :mod:`!sv`, :mod:" -"`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." +"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!" +"GET`, :mod:`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!" +"IOCTL`, :mod:`!jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` " +"and :mod:`!sv`, :mod:`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." msgstr "" #: ../../whatsnew/2.6.rst:3253 @@ -4564,9 +4975,9 @@ msgstr "" msgid "" "The :class:`Decimal` constructor now accepts leading and trailing whitespace " "when passed a string. Previously it would raise an :exc:`InvalidOperation` " -"exception. On the other hand, the :meth:`create_decimal` method of :class:" -"`Context` objects now explicitly disallows extra whitespace, raising a :exc:" -"`ConversionSyntax` exception." +"exception. On the other hand, the :meth:`create_decimal` method " +"of :class:`Context` objects now explicitly disallows extra whitespace, " +"raising a :exc:`ConversionSyntax` exception." msgstr "" #: ../../whatsnew/2.6.rst:3284 @@ -4592,20 +5003,20 @@ msgstr "" #: ../../whatsnew/2.6.rst:3298 msgid "" -"The :mod:`socket` module exception :exc:`socket.error` now inherits from :" -"exc:`IOError`. Previously it wasn't a subclass of :exc:`StandardError` but " -"now it is, through :exc:`IOError`. (Implemented by Gregory P. Smith; :issue:" -"`1706815`.)" +"The :mod:`socket` module exception :exc:`socket.error` now inherits " +"from :exc:`IOError`. Previously it wasn't a subclass " +"of :exc:`StandardError` but now it is, through :exc:`IOError`. (Implemented " +"by Gregory P. Smith; :issue:`1706815`.)" msgstr "" #: ../../whatsnew/2.6.rst:3303 msgid "" "The :mod:`xmlrpclib <xmlrpc.client>` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`)" +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`)" msgstr "" #: ../../whatsnew/2.6.rst:3310 diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 8eaa5f46cd..8e84e172e9 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,11 +39,11 @@ msgstr "" msgid "" "Numeric handling has been improved in many ways, for both floating-point " "numbers and for the :class:`~decimal.Decimal` class. There are some useful " -"additions to the standard library, such as a greatly enhanced :mod:" -"`unittest` module, the :mod:`argparse` module for parsing command-line " -"options, convenient :class:`~collections.OrderedDict` and :class:" -"`~collections.Counter` classes in the :mod:`collections` module, and many " -"other improvements." +"additions to the standard library, such as a greatly " +"enhanced :mod:`unittest` module, the :mod:`argparse` module for parsing " +"command-line options, convenient :class:`~collections.OrderedDict` " +"and :class:`~collections.Counter` classes in the :mod:`collections` module, " +"and many other improvements." msgstr "" #: ../../whatsnew/2.7.rst:63 @@ -59,9 +59,9 @@ msgid "" "features, but instead provides a convenient overview. For full details, you " "should refer to the documentation for Python 2.7 at https://docs.python.org. " "If you want to understand the rationale for the design and implementation, " -"refer to the PEP for a particular new feature or the issue on https://bugs." -"python.org in which a change was discussed. Whenever possible, \"What's New " -"in Python\" links to the bug/patch item for each change." +"refer to the PEP for a particular new feature or the issue on https://" +"bugs.python.org in which a change was discussed. Whenever possible, " +"\"What's New in Python\" links to the bug/patch item for each change." msgstr "" #: ../../whatsnew/2.7.rst:80 @@ -168,10 +168,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:151 msgid "" "However, there are increasingly many users of Python-based applications who " -"are not directly involved in the development of those applications. :exc:" -"`DeprecationWarning` messages are irrelevant to such users, making them " -"worry about an application that's actually working correctly and burdening " -"application developers with responding to these concerns." +"are not directly involved in the development of those " +"applications. :exc:`DeprecationWarning` messages are irrelevant to such " +"users, making them worry about an application that's actually working " +"correctly and burdening application developers with responding to these " +"concerns." msgstr "" #: ../../whatsnew/2.7.rst:158 @@ -248,8 +249,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:192 msgid "" -"Float-to-string and string-to-float conversions are correctly rounded. The :" -"func:`round` function is also now correctly rounded." +"Float-to-string and string-to-float conversions are correctly rounded. " +"The :func:`round` function is also now correctly rounded." msgstr "" #: ../../whatsnew/2.7.rst:194 @@ -287,8 +288,8 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, 2.7 introduces a new :class:" -"`~collections.OrderedDict` class in the :mod:`collections` module." +"the experiences from those implementations, 2.7 introduces a " +"new :class:`~collections.OrderedDict` class in the :mod:`collections` module." msgstr "" #: ../../whatsnew/2.7.rst:222 @@ -307,6 +308,12 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('second', 2), ('third', 3)]" msgstr "" +">>> from collections import OrderedDict\n" +">>> d = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> d.items()\n" +"[('first', 1), ('second', 2), ('third', 3)]" #: ../../whatsnew/2.7.rst:233 msgid "" @@ -320,6 +327,9 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('second', 4), ('third', 3)]" msgstr "" +">>> d['second'] = 4\n" +">>> d.items()\n" +"[('first', 1), ('second', 4), ('third', 3)]" #: ../../whatsnew/2.7.rst:240 msgid "Deleting an entry and reinserting it will move it to the end::" @@ -332,6 +342,10 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('third', 3), ('second', 5)]" msgstr "" +">>> del d['second']\n" +">>> d['second'] = 5\n" +">>> d.items()\n" +"[('first', 1), ('third', 3), ('second', 5)]" #: ../../whatsnew/2.7.rst:247 msgid "" @@ -353,6 +367,15 @@ msgid "" ">>> od.popitem(last=False)\n" "(1, 0)" msgstr "" +">>> od = OrderedDict([(x,0) for x in range(20)])\n" +">>> od.popitem()\n" +"(19, 0)\n" +">>> od.popitem()\n" +"(18, 0)\n" +">>> od.popitem(last=False)\n" +"(0, 0)\n" +">>> od.popitem(last=False)\n" +"(1, 0)" #: ../../whatsnew/2.7.rst:262 msgid "" @@ -375,6 +398,18 @@ msgid "" ">>> od1 == od2\n" "True" msgstr "" +">>> od1 = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> od2 = OrderedDict([('third', 3),\n" +"... ('first', 1),\n" +"... ('second', 2)])\n" +">>> od1 == od2\n" +"False\n" +">>> # Move 'third' key to the end\n" +">>> del od2['third']; od2['third'] = 3\n" +">>> od1 == od2\n" +"True" #: ../../whatsnew/2.7.rst:278 msgid "" @@ -406,9 +441,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:294 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns an ordered dictionary with the values " -"appearing in the same order as the underlying tuple indices." +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns an ordered dictionary with " +"the values appearing in the same order as the underlying tuple indices." msgstr "" #: ../../whatsnew/2.7.rst:298 @@ -461,6 +496,8 @@ msgid "" ">>> '{:20,.2f}'.format(18446744073709551616.0)\n" "'18,446,744,073,709,551,616.00'" msgstr "" +">>> '{:20,.2f}'.format(18446744073709551616.0)\n" +"'18,446,744,073,709,551,616.00'" #: ../../whatsnew/2.7.rst:333 msgid "When formatting an integer, include the comma after the width:" @@ -495,14 +532,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:355 msgid "" "This means Python now supports three different modules for parsing command-" -"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. The :" -"mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " +"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. " +"The :mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " "function, so it remains useful if you're writing a Python prototype that " "will eventually be rewritten in C. :mod:`optparse` becomes redundant, but " "there are no plans to remove it because there are many scripts still using " -"it, and there's no automated way to update these scripts. (Making the :mod:" -"`argparse` API consistent with :mod:`optparse`'s interface was discussed but " -"rejected as too messy and difficult.)" +"it, and there's no automated way to update these scripts. (Making " +"the :mod:`argparse` API consistent with :mod:`optparse`'s interface was " +"discussed but rejected as too messy and difficult.)" msgstr "" #: ../../whatsnew/2.7.rst:366 @@ -563,6 +600,20 @@ msgid "" " -o FILE direct output to FILE instead of stdout\n" " -C NUM display NUM lines of added context" msgstr "" +"-> ./python.exe argparse-example.py --help\n" +"usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs " +"[inputs ...]]\n" +"\n" +"Command-line example.\n" +"\n" +"positional arguments:\n" +" inputs input filenames (default is stdin)\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" -v produce verbose output\n" +" -o FILE direct output to FILE instead of stdout\n" +" -C NUM display NUM lines of added context" #: ../../whatsnew/2.7.rst:410 msgid "" @@ -584,6 +635,17 @@ msgid "" " 'context': 4,\n" " 'inputs': ['file1', 'file2']}" msgstr "" +"-> ./python.exe argparse-example.py -v\n" +"{'output': None,\n" +" 'is_verbose': True,\n" +" 'context': 0,\n" +" 'inputs': []}\n" +"\n" +"-> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2\n" +"{'output': '/tmp/output',\n" +" 'is_verbose': True,\n" +" 'context': 4,\n" +" 'inputs': ['file1', 'file2']}" #: ../../whatsnew/2.7.rst:425 msgid "" @@ -592,9 +654,9 @@ msgid "" "passing ``'*'``, 1 or more by passing ``'+'``, or an optional argument with " "``'?'``. A top-level parser can contain sub-parsers to define subcommands " "that have different sets of switches, as in ``svn commit``, ``svn " -"checkout``, etc. You can specify an argument's type as :class:`~argparse." -"FileType`, which will automatically open files for you and understands that " -"``'-'`` means standard input or output." +"checkout``, etc. You can specify an argument's type " +"as :class:`~argparse.FileType`, which will automatically open files for you " +"and understands that ``'-'`` means standard input or output." msgstr "" #: ../../whatsnew/2.7.rst:437 @@ -611,8 +673,8 @@ msgstr ":ref:`upgrading-optparse-code`" #: ../../whatsnew/2.7.rst:441 msgid "" -"Part of the Python documentation, describing how to convert code that uses :" -"mod:`optparse`." +"Part of the Python documentation, describing how to convert code that " +"uses :mod:`optparse`." msgstr "" #: ../../whatsnew/2.7.rst:444 @@ -639,10 +701,10 @@ msgstr "" msgid "" "All this flexibility can require a lot of configuration. You can write " "Python statements to create objects and set their properties, but a complex " -"set-up requires verbose but boring code. :mod:`logging` also supports a :" -"func:`~logging.config.fileConfig` function that parses a file, but the file " -"format doesn't support configuring filters, and it's messier to generate " -"programmatically." +"set-up requires verbose but boring code. :mod:`logging` also supports " +"a :func:`~logging.config.fileConfig` function that parses a file, but the " +"file format doesn't support configuring filters, and it's messier to " +"generate programmatically." msgstr "" #: ../../whatsnew/2.7.rst:462 @@ -718,8 +780,8 @@ msgstr "" msgid "" "The :class:`~logging.handlers.SysLogHandler` class now supports syslogging " "over TCP. The constructor has a *socktype* parameter giving the type of " -"socket to use, either :const:`socket.SOCK_DGRAM` for UDP or :const:`socket." -"SOCK_STREAM` for TCP. The default protocol remains UDP." +"socket to use, either :const:`socket.SOCK_DGRAM` for UDP " +"or :const:`socket.SOCK_STREAM` for TCP. The default protocol remains UDP." msgstr "" #: ../../whatsnew/2.7.rst:529 @@ -727,15 +789,16 @@ msgid "" ":class:`~logging.Logger` instances gained a :meth:`~logging.Logger.getChild` " "method that retrieves a descendant logger using a relative path. For " "example, once you retrieve a logger by doing ``log = getLogger('app')``, " -"calling ``log.getChild('network.listen')`` is equivalent to ``getLogger('app." -"network.listen')``." +"calling ``log.getChild('network.listen')`` is equivalent to " +"``getLogger('app.network.listen')``." msgstr "" #: ../../whatsnew/2.7.rst:535 msgid "" -"The :class:`~logging.LoggerAdapter` class gained an :meth:`~logging.Logger." -"isEnabledFor` method that takes a *level* and returns whether the underlying " -"logger would process a message of that level of importance." +"The :class:`~logging.LoggerAdapter` class gained " +"an :meth:`~logging.Logger.isEnabledFor` method that takes a *level* and " +"returns whether the underlying logger would process a message of that level " +"of importance." msgstr "" #: ../../whatsnew/2.7.rst:544 @@ -752,17 +815,18 @@ msgstr "" #: ../../whatsnew/2.7.rst:550 msgid "" -"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:" -"`~dict.items` are different in Python 3.x. They return an object called a :" -"dfn:`view` instead of a fully materialized list." +"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` are different in Python 3.x. They return an object " +"called a :dfn:`view` instead of a fully materialized list." msgstr "" #: ../../whatsnew/2.7.rst:554 msgid "" -"It's not possible to change the return values of :meth:`~dict.keys`, :meth:" -"`~dict.values`, and :meth:`~dict.items` in Python 2.7 because too much code " -"would break. Instead the 3.x versions were added under the new names :meth:" -"`!viewkeys`, :meth:`!viewvalues`, and :meth:`!viewitems`." +"It's not possible to change the return values " +"of :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:`~dict.items` in " +"Python 2.7 because too much code would break. Instead the 3.x versions were " +"added under the new names :meth:`!viewkeys`, :meth:`!viewvalues`, " +"and :meth:`!viewitems`." msgstr "" #: ../../whatsnew/2.7.rst:562 @@ -773,6 +837,11 @@ msgid "" ">>> d.viewkeys()\n" "dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" msgstr "" +">>> d = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d\n" +"{0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}\n" +">>> d.viewkeys()\n" +"dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" #: ../../whatsnew/2.7.rst:568 msgid "" @@ -789,6 +858,12 @@ msgid "" ">>> d1.viewkeys() | range(0, 30)\n" "set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" msgstr "" +">>> d1 = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d2 = dict((i**.5, i) for i in range(1000))\n" +">>> d1.viewkeys() & d2.viewkeys()\n" +"set([0.0, 10.0, 20.0, 30.0])\n" +">>> d1.viewkeys() | range(0, 30)\n" +"set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" #: ../../whatsnew/2.7.rst:579 msgid "" @@ -805,6 +880,12 @@ msgid "" ">>> vk\n" "dict_keys([0, 130, 260, 10, ..., 250])" msgstr "" +">>> vk = d.viewkeys()\n" +">>> vk\n" +"dict_keys([0, 130, 10, ..., 250])\n" +">>> d[260] = '&'\n" +">>> vk\n" +"dict_keys([0, 130, 260, 10, ..., 250])" #: ../../whatsnew/2.7.rst:589 msgid "" @@ -821,12 +902,18 @@ msgid "" " File \"<stdin>\", line 1, in <module>\n" "RuntimeError: dictionary changed size during iteration" msgstr "" +">>> for k in vk:\n" +"... d[k*2] = k\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"RuntimeError: dictionary changed size during iteration" #: ../../whatsnew/2.7.rst:599 msgid "" "You can use the view methods in Python 2.x code, and the 2to3 converter will " -"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, and :" -"meth:`~dict.items` methods." +"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` methods." msgstr "" #: ../../whatsnew/2.7.rst:605 @@ -835,8 +922,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:606 msgid "" -"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre Vassalotti; :" -"issue:`1967`." +"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre " +"Vassalotti; :issue:`1967`." msgstr "" #: ../../whatsnew/2.7.rst:611 @@ -878,6 +965,11 @@ msgid "" "[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" ">>>" msgstr "" +">>> m2.tobytes()\n" +"'abcdefghijklmnopqrstuvwxyz'\n" +">>> m2.tolist()\n" +"[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" +">>>" #: ../../whatsnew/2.7.rst:643 msgid "" @@ -956,6 +1048,10 @@ msgid "" ">>> {('a'*x) for x in range(6)}\n" "set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" msgstr "" +">>> {x: x*x for x in range(6)}\n" +"{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}\n" +">>> {('a'*x) for x in range(6)}\n" +"set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" #: ../../whatsnew/2.7.rst:707 msgid "Backported by Alexandre Vassalotti; :issue:`2333`." @@ -976,7 +1072,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:717 msgid "is equivalent to::" -msgstr "" +msgstr "等價於: ::" #: ../../whatsnew/2.7.rst:719 msgid "" @@ -996,16 +1092,18 @@ msgid "" "(Proposed in https://codereview.appspot.com/53094; implemented by Georg " "Brandl.)" msgstr "" +"(於 https://codereview.appspot.com/53094 提出;由 Georg Brandl 實作。)" #: ../../whatsnew/2.7.rst:729 msgid "" "Conversions between floating-point numbers and strings are now correctly " "rounded on most platforms. These conversions occur in many different " -"places: :func:`str` on floats and complex numbers; the :class:`float` and :" -"class:`complex` constructors; numeric formatting; serializing and " -"deserializing floats and complex numbers using the :mod:`marshal`, :mod:" -"`pickle` and :mod:`json` modules; parsing of float and imaginary literals in " -"Python code; and :class:`~decimal.Decimal`-to-float conversion." +"places: :func:`str` on floats and complex numbers; the :class:`float` " +"and :class:`complex` constructors; numeric formatting; serializing and " +"deserializing floats and complex numbers using " +"the :mod:`marshal`, :mod:`pickle` and :mod:`json` modules; parsing of float " +"and imaginary literals in Python code; and :class:`~decimal.Decimal`-to-" +"float conversion." msgstr "" #: ../../whatsnew/2.7.rst:741 @@ -1028,8 +1126,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:757 msgid "" -"Implemented by Eric Smith and Mark Dickinson, using David Gay's :file:`dtoa." -"c` library; :issue:`7117`." +"Implemented by Eric Smith and Mark Dickinson, using David " +"Gay's :file:`dtoa.c` library; :issue:`7117`." msgstr "" #: ../../whatsnew/2.7.rst:760 @@ -1050,6 +1148,11 @@ msgid "" ">>> n - long(float(n))\n" "65535L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935283e+20\n" +">>> n - long(float(n))\n" +"65535L" #: ../../whatsnew/2.7.rst:773 msgid "" @@ -1065,6 +1168,11 @@ msgid "" ">>> n - long(float(n))\n" "-1L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935289e+20\n" +">>> n - long(float(n))\n" +"-1L" #: ../../whatsnew/2.7.rst:782 msgid "(Implemented by Mark Dickinson; :issue:`3166`.)" @@ -1097,6 +1205,10 @@ msgid "" ">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" "'2009:4:Sunday'" msgstr "" +">>> '{}:{}:{}'.format(2009, 04, 'Sunday')\n" +"'2009:4:Sunday'\n" +">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" +"'2009:4:Sunday'" #: ../../whatsnew/2.7.rst:800 msgid "" @@ -1126,9 +1238,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:818 msgid "" -"A low-level change: the :meth:`object.__format__` method now triggers a :exc:" -"`PendingDeprecationWarning` if it's passed a format string, because the :" -"meth:`!__format__` method for :class:`object` converts the object to a " +"A low-level change: the :meth:`object.__format__` method now triggers " +"a :exc:`PendingDeprecationWarning` if it's passed a format string, because " +"the :meth:`!__format__` method for :class:`object` converts the object to a " "string representation and formats that. Previously the method silently " "applied the format string to the string representation, but that could hide " "mistakes in Python code. If you're supplying formatting information such as " @@ -1155,6 +1267,16 @@ msgid "" ">>> (n+1).bit_length()\n" "124" msgstr "" +">>> n = 37\n" +">>> bin(n)\n" +"'0b100101'\n" +">>> n.bit_length()\n" +"6\n" +">>> n = 2**123-1\n" +">>> n.bit_length()\n" +"123\n" +">>> (n+1).bit_length()\n" +"124" #: ../../whatsnew/2.7.rst:843 msgid "(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)" @@ -1171,15 +1293,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:851 msgid "" "It's now possible for a subclass of the built-in :class:`!unicode` type to " -"override the :meth:`!__unicode__` method. (Implemented by Victor Stinner; :" -"issue:`1583863`.)" +"override the :meth:`!__unicode__` method. (Implemented by Victor " +"Stinner; :issue:`1583863`.)" msgstr "" #: ../../whatsnew/2.7.rst:855 msgid "" "The :class:`bytearray` type's :meth:`~bytearray.translate` method now " -"accepts ``None`` as its first argument. (Fixed by Georg Brandl; :issue:" -"`4759`.)" +"accepts ``None`` as its first argument. (Fixed by Georg " +"Brandl; :issue:`4759`.)" msgstr "" #: ../../whatsnew/2.7.rst:861 @@ -1202,8 +1324,8 @@ msgstr "" msgid "" "Two new encodings are now supported: \"cp720\", used primarily for Arabic " "text; and \"cp858\", a variant of CP 850 that adds the euro symbol. (CP720 " -"contributed by Alexander Belchenko and Amaury Forgeot d'Arc in :issue:" -"`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" +"contributed by Alexander Belchenko and Amaury Forgeot d'Arc " +"in :issue:`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" msgstr "" #: ../../whatsnew/2.7.rst:879 @@ -1212,14 +1334,14 @@ msgid "" "the :exc:`IOError` exception when trying to open a directory on POSIX " "platforms (noted by Jan Kaliszewski; :issue:`4764`), and now explicitly " "checks for and forbids writing to read-only file objects instead of trusting " -"the C library to catch and report the error (fixed by Stefan Krah; :issue:" -"`5677`)." +"the C library to catch and report the error (fixed by Stefan " +"Krah; :issue:`5677`)." msgstr "" #: ../../whatsnew/2.7.rst:886 msgid "" -"The Python tokenizer now translates line endings itself, so the :func:" -"`compile` built-in function now accepts code using any line-ending " +"The Python tokenizer now translates line endings itself, so " +"the :func:`compile` built-in function now accepts code using any line-ending " "convention. Additionally, it no longer requires that the code end in a " "newline." msgstr "" @@ -1235,15 +1357,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:896 msgid "" "It's now possible to create weak references to old-style class objects. New-" -"style classes were always weak-referenceable. (Fixed by Antoine Pitrou; :" -"issue:`8268`.)" +"style classes were always weak-referenceable. (Fixed by Antoine " +"Pitrou; :issue:`8268`.)" msgstr "" #: ../../whatsnew/2.7.rst:900 msgid "" "When a module object is garbage-collected, the module's dictionary is now " -"only cleared if no one else is holding a reference to the dictionary (:issue:" -"`7140`)." +"only cleared if no one else is holding a reference to the dictionary " +"(:issue:`7140`)." msgstr "" #: ../../whatsnew/2.7.rst:909 @@ -1268,7 +1390,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:924 msgid "export PYTHONWARNINGS=all,error:::Cookie:0" -msgstr "" +msgstr "export PYTHONWARNINGS=all,error:::Cookie:0" #: ../../whatsnew/2.7.rst:930 msgid "Optimizations" @@ -1281,8 +1403,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:934 msgid "" "A new opcode was added to perform the initial setup for :keyword:`with` " -"statements, looking up the :meth:`~object.__enter__` and :meth:`~object." -"__exit__` methods. (Contributed by Benjamin Peterson.)" +"statements, looking up the :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods. (Contributed by Benjamin Peterson.)" msgstr "" #: ../../whatsnew/2.7.rst:938 @@ -1336,6 +1458,9 @@ msgid "" ">>> sys.long_info\n" "sys.long_info(bits_per_digit=30, sizeof_digit=4)" msgstr "" +">>> import sys\n" +">>> sys.long_info\n" +"sys.long_info(bits_per_digit=30, sizeof_digit=4)" #: ../../whatsnew/2.7.rst:978 msgid "(Contributed by Mark Dickinson; :issue:`4258`.)" @@ -1369,8 +1494,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:999 msgid "" "List comprehensions with an ``if`` condition are compiled into faster " -"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey Yasskin; :" -"issue:`4715`.)" +"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey " +"Yasskin; :issue:`4715`.)" msgstr "" #: ../../whatsnew/2.7.rst:1003 @@ -1399,8 +1524,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1020 msgid "" "The :mod:`!cPickle` module now special-cases dictionaries, nearly halving " -"the time required to pickle them. (Contributed by Collin Winter; :issue:" -"`5670`.)" +"the time required to pickle them. (Contributed by Collin " +"Winter; :issue:`5670`.)" msgstr "" #: ../../whatsnew/2.7.rst:1027 @@ -1422,8 +1547,8 @@ msgid "" "feature for skipping modules. The constructor now takes an iterable " "containing glob-style patterns such as ``django.*``; the debugger will not " "step into stack frames from a module that matches one of these patterns. " -"(Contributed by Maru Newby after a suggestion by Senthil Kumaran; :issue:" -"`5142`.)" +"(Contributed by Maru Newby after a suggestion by Senthil " +"Kumaran; :issue:`5142`.)" msgstr "" #: ../../whatsnew/2.7.rst:1043 @@ -1465,7 +1590,7 @@ msgid "" ">>> for letter in 'here is a sample of english text':\n" "... c[letter] += 1\n" "...\n" -">>> c \n" +">>> c\n" "Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" "'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" "'p': 1, 'r': 1, 'x': 1})\n" @@ -1474,16 +1599,29 @@ msgid "" ">>> c['z']\n" "0" msgstr "" +">>> from collections import Counter\n" +">>> c = Counter()\n" +">>> for letter in 'here is a sample of english text':\n" +"... c[letter] += 1\n" +"...\n" +">>> c\n" +"Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" +"'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" +"'p': 1, 'r': 1, 'x': 1})\n" +">>> c['e']\n" +"5\n" +">>> c['z']\n" +"0" #: ../../whatsnew/2.7.rst:1081 msgid "" -"There are three additional :class:`~collections.Counter` methods. :meth:" -"`~collections.Counter.most_common` returns the N most common elements and " -"their counts. :meth:`~collections.Counter.elements` returns an iterator " -"over the contained elements, repeating each element as many times as its " -"count. :meth:`~collections.Counter.subtract` takes an iterable and subtracts " -"one for each element instead of adding; if the argument is a dictionary or " -"another :class:`Counter`, the counts are subtracted. ::" +"There are three additional :class:`~collections.Counter` " +"methods. :meth:`~collections.Counter.most_common` returns the N most common " +"elements and their counts. :meth:`~collections.Counter.elements` returns an " +"iterator over the contained elements, repeating each element as many times " +"as its count. :meth:`~collections.Counter.subtract` takes an iterable and " +"subtracts one for each element instead of adding; if the argument is a " +"dictionary or another :class:`Counter`, the counts are subtracted. ::" msgstr "" #: ../../whatsnew/2.7.rst:1091 @@ -1504,7 +1642,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1104 msgid "Contributed by Raymond Hettinger; :issue:`1696199`." -msgstr "" +msgstr "由 Raymond Hettinger 貢獻;:issue:`1696199`。" #: ../../whatsnew/2.7.rst:1108 msgid "" @@ -1514,13 +1652,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1111 msgid "" -"New method: The :class:`~collections.deque` data type now has a :meth:" -"`~collections.deque.count` method that returns the number of contained " -"elements equal to the supplied argument *x*, and a :meth:`~collections.deque." -"reverse` method that reverses the elements of the deque in-place. :class:" -"`~collections.deque` also exposes its maximum length as the read-only :attr:" -"`~collections.deque.maxlen` attribute. (Both features added by Raymond " -"Hettinger.)" +"New method: The :class:`~collections.deque` data type now has " +"a :meth:`~collections.deque.count` method that returns the number of " +"contained elements equal to the supplied argument *x*, and " +"a :meth:`~collections.deque.reverse` method that reverses the elements of " +"the deque in-place. :class:`~collections.deque` also exposes its maximum " +"length as the read-only :attr:`~collections.deque.maxlen` attribute. (Both " +"features added by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.7.rst:1119 @@ -1598,28 +1736,30 @@ msgstr "" #: ../../whatsnew/2.7.rst:1174 msgid "" "The :mod:`ctypes` module now always converts ``None`` to a C ``NULL`` " -"pointer for arguments declared as pointers. (Changed by Thomas Heller; :" -"issue:`4606`.) The underlying `libffi library <https://sourceware.org/" -"libffi/>`__ has been updated to version 3.0.9, containing various fixes for " -"different platforms. (Updated by Matthias Klose; :issue:`8142`.)" +"pointer for arguments declared as pointers. (Changed by Thomas " +"Heller; :issue:`4606`.) The underlying `libffi library <https://" +"sourceware.org/libffi/>`__ has been updated to version 3.0.9, containing " +"various fixes for different platforms. (Updated by Matthias " +"Klose; :issue:`8142`.)" msgstr "" #: ../../whatsnew/2.7.rst:1181 msgid "" "New method: the :mod:`datetime` module's :class:`~datetime.timedelta` class " "gained a :meth:`~datetime.timedelta.total_seconds` method that returns the " -"number of seconds in the duration. (Contributed by Brian Quinlan; :issue:" -"`5788`.)" +"number of seconds in the duration. (Contributed by Brian " +"Quinlan; :issue:`5788`.)" msgstr "" #: ../../whatsnew/2.7.rst:1185 msgid "" -"New method: the :class:`~decimal.Decimal` class gained a :meth:`~decimal." -"Decimal.from_float` class method that performs an exact conversion of a " -"floating-point number to a :class:`!Decimal`. This exact conversion strives " -"for the closest decimal approximation to the floating-point representation's " -"value; the resulting decimal value will therefore still include the " -"inaccuracy, if any. For example, ``Decimal.from_float(0.1)`` returns " +"New method: the :class:`~decimal.Decimal` class gained " +"a :meth:`~decimal.Decimal.from_float` class method that performs an exact " +"conversion of a floating-point number to a :class:`!Decimal`. This exact " +"conversion strives for the closest decimal approximation to the floating-" +"point representation's value; the resulting decimal value will therefore " +"still include the inaccuracy, if any. For example, " +"``Decimal.from_float(0.1)`` returns " "``Decimal('0.1000000000000000055511151231257827021181583404541015625')``. " "(Implemented by Raymond Hettinger; :issue:`4796`.)" msgstr "" @@ -1640,32 +1780,33 @@ msgstr "" msgid "" "The constructor for :class:`~decimal.Decimal` now accepts floating-point " "numbers (added by Raymond Hettinger; :issue:`8257`) and non-European Unicode " -"characters such as Arabic-Indic digits (contributed by Mark Dickinson; :" -"issue:`6595`)." +"characters such as Arabic-Indic digits (contributed by Mark " +"Dickinson; :issue:`6595`)." msgstr "" #: ../../whatsnew/2.7.rst:1210 msgid "" "Most of the methods of the :class:`~decimal.Context` class now accept " "integers as well as :class:`~decimal.Decimal` instances; the only exceptions " -"are the :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context." -"is_canonical` methods. (Patch by Juan José Conti; :issue:`7633`.)" +"are the :meth:`~decimal.Context.canonical` " +"and :meth:`~decimal.Context.is_canonical` methods. (Patch by Juan José " +"Conti; :issue:`7633`.)" msgstr "" #: ../../whatsnew/2.7.rst:1215 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:`~str." -"format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which is more sensible for numeric " -"types. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`~str.format` method, the default alignment was previously " +"left-alignment. This has been changed to right-alignment, which is more " +"sensible for numeric types. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" #: ../../whatsnew/2.7.rst:1220 ../../whatsnew/2.7.rst:2484 msgid "" -"Comparisons involving a signaling NaN value (or ``sNAN``) now signal :const:" -"`~decimal.InvalidOperation` instead of silently returning a true or false " -"value depending on the comparison operator. Quiet NaN values (or ``NaN``) " -"are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" +"Comparisons involving a signaling NaN value (or ``sNAN``) now " +"signal :const:`~decimal.InvalidOperation` instead of silently returning a " +"true or false value depending on the comparison operator. Quiet NaN values " +"(or ``NaN``) are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" msgstr "" #: ../../whatsnew/2.7.rst:1226 @@ -1695,16 +1836,16 @@ msgstr "" msgid "" "The :mod:`email` module's :class:`~email.message.Message` class will now " "accept a Unicode-valued payload, automatically converting the payload to the " -"encoding specified by :attr:`!output_charset`. (Added by R. David Murray; :" -"issue:`1368247`.)" +"encoding specified by :attr:`!output_charset`. (Added by R. David " +"Murray; :issue:`1368247`.)" msgstr "" #: ../../whatsnew/2.7.rst:1247 msgid "" -"The :class:`~fractions.Fraction` class now accepts a single float or :class:" -"`~decimal.Decimal` instance, or two rational numbers, as arguments to its " -"constructor. (Implemented by Mark Dickinson; rationals added in :issue:" -"`5812`, and float/decimal in :issue:`8294`.)" +"The :class:`~fractions.Fraction` class now accepts a single float " +"or :class:`~decimal.Decimal` instance, or two rational numbers, as arguments " +"to its constructor. (Implemented by Mark Dickinson; rationals added " +"in :issue:`5812`, and float/decimal in :issue:`8294`.)" msgstr "" #: ../../whatsnew/2.7.rst:1253 @@ -1718,36 +1859,37 @@ msgstr "" msgid "" "New class: :class:`~ftplib.FTP_TLS` in the :mod:`ftplib` module provides " "secure FTP connections using TLS encapsulation of authentication as well as " -"subsequent control and data transfers. (Contributed by Giampaolo Rodola; :" -"issue:`2054`.)" +"subsequent control and data transfers. (Contributed by Giampaolo " +"Rodola; :issue:`2054`.)" msgstr "" #: ../../whatsnew/2.7.rst:1266 msgid "" "The :meth:`~ftplib.FTP.storbinary` method for binary uploads can now restart " -"uploads thanks to an added *rest* parameter (patch by Pablo Mouzo; :issue:" -"`6845`.)" +"uploads thanks to an added *rest* parameter (patch by Pablo " +"Mouzo; :issue:`6845`.)" msgstr "" #: ../../whatsnew/2.7.rst:1270 msgid "" -"New class decorator: :func:`~functools.total_ordering` in the :mod:" -"`functools` module takes a class that defines an :meth:`~object.__eq__` " -"method and one of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:" -"`~object.__gt__`, or :meth:`~object.__ge__`, and generates the missing " -"comparison methods. Since the :meth:`!__cmp__` method is being deprecated " -"in Python 3.x, this decorator makes it easier to define ordered classes. " -"(Added by Raymond Hettinger; :issue:`5479`.)" +"New class decorator: :func:`~functools.total_ordering` in " +"the :mod:`functools` module takes a class that defines " +"an :meth:`~object.__eq__` method and one " +"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"or :meth:`~object.__ge__`, and generates the missing comparison methods. " +"Since the :meth:`!__cmp__` method is being deprecated in Python 3.x, this " +"decorator makes it easier to define ordered classes. (Added by Raymond " +"Hettinger; :issue:`5479`.)" msgstr "" #: ../../whatsnew/2.7.rst:1278 msgid "" "New function: :func:`~functools.cmp_to_key` will take an old-style " "comparison function that expects two arguments and return a new callable " -"that can be used as the *key* parameter to functions such as :func:" -"`sorted`, :func:`min` and :func:`max`, etc. The primary intended use is to " -"help with making code compatible with Python 3.x. (Added by Raymond " -"Hettinger.)" +"that can be used as the *key* parameter to functions such " +"as :func:`sorted`, :func:`min` and :func:`max`, etc. The primary intended " +"use is to help with making code compatible with Python 3.x. (Added by " +"Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.7.rst:1285 @@ -1761,12 +1903,12 @@ msgstr "" msgid "" "The :mod:`gzip` module's :class:`~gzip.GzipFile` now supports the context " "management protocol, so you can write ``with gzip.GzipFile(...) as f:`` " -"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements the :" -"class:`io.BufferedIOBase` ABC, so you can wrap it with :class:`io." -"BufferedReader` for faster processing (contributed by Nir Aides; :issue:" -"`7471`). It's also now possible to override the modification time recorded " -"in a gzipped file by providing an optional timestamp to the constructor. " -"(Contributed by Jacques Frechet; :issue:`4272`.)" +"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements " +"the :class:`io.BufferedIOBase` ABC, so you can wrap it " +"with :class:`io.BufferedReader` for faster processing (contributed by Nir " +"Aides; :issue:`7471`). It's also now possible to override the modification " +"time recorded in a gzipped file by providing an optional timestamp to the " +"constructor. (Contributed by Jacques Frechet; :issue:`4272`.)" msgstr "" #: ../../whatsnew/2.7.rst:1299 @@ -1786,18 +1928,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:1309 msgid "" -"The default :class:`~http.client.HTTPResponse` class used by the :mod:" -"`httplib <http>` module now supports buffering, resulting in much faster " -"reading of HTTP responses. (Contributed by Kristján Valur Jónsson; :issue:" -"`4879`.)" +"The default :class:`~http.client.HTTPResponse` class used by " +"the :mod:`httplib <http>` module now supports buffering, resulting in much " +"faster reading of HTTP responses. (Contributed by Kristján Valur " +"Jónsson; :issue:`4879`.)" msgstr "" #: ../../whatsnew/2.7.rst:1313 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now support a *source_address* parameter, a " -"``(host, port)`` 2-tuple giving the source address that will be used for the " -"connection. (Contributed by Eldon Ziegler; :issue:`3972`.)" +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now support a " +"*source_address* parameter, a ``(host, port)`` 2-tuple giving the source " +"address that will be used for the connection. (Contributed by Eldon " +"Ziegler; :issue:`3972`.)" msgstr "" #: ../../whatsnew/2.7.rst:1318 @@ -1840,7 +1983,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1346 msgid "Contributed by George Sakkis; :issue:`3135`." -msgstr "" +msgstr "由 George Sakkis 貢獻;:issue:`3135`。" #: ../../whatsnew/2.7.rst:1348 msgid "" @@ -1852,8 +1995,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1353 msgid "" -"One minor resulting change: the :class:`io.TextIOBase` class now has an :" -"attr:`~io.TextIOBase.errors` attribute giving the error setting used for " +"One minor resulting change: the :class:`io.TextIOBase` class now has " +"an :attr:`~io.TextIOBase.errors` attribute giving the error setting used for " "encoding and decoding errors (one of ``'strict'``, ``'replace'``, " "``'ignore'``)." msgstr "" @@ -1861,10 +2004,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1358 msgid "" "The :class:`io.FileIO` class now raises an :exc:`OSError` when passed an " -"invalid file descriptor. (Implemented by Benjamin Peterson; :issue:" -"`4991`.) The :meth:`~io.IOBase.truncate` method now preserves the file " -"position; previously it would change the file position to the end of the new " -"file. (Fixed by Pascal Chambon; :issue:`6939`.)" +"invalid file descriptor. (Implemented by Benjamin " +"Peterson; :issue:`4991`.) The :meth:`~io.IOBase.truncate` method now " +"preserves the file position; previously it would change the file position to " +"the end of the new file. (Fixed by Pascal Chambon; :issue:`6939`.)" msgstr "" #: ../../whatsnew/2.7.rst:1364 @@ -1905,9 +2048,9 @@ msgstr "" msgid "" "The :func:`itertools.count` function now has a *step* argument that allows " "incrementing by values other than 1. :func:`~itertools.count` also now " -"allows keyword arguments, and using non-integer values such as floats or :" -"class:`~decimal.Decimal` instances. (Implemented by Raymond Hettinger; :" -"issue:`5032`.)" +"allows keyword arguments, and using non-integer values such as floats " +"or :class:`~decimal.Decimal` instances. (Implemented by Raymond " +"Hettinger; :issue:`5032`.)" msgstr "" #: ../../whatsnew/2.7.rst:1391 @@ -1944,13 +2087,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1412 msgid "" -"New functions: the :mod:`math` module gained :func:`~math.erf` and :func:" -"`~math.erfc` for the error function and the complementary error function, :" -"func:`~math.expm1` which computes ``e**x - 1`` with more precision than " -"using :func:`~math.exp` and subtracting 1, :func:`~math.gamma` for the Gamma " -"function, and :func:`~math.lgamma` for the natural log of the Gamma " -"function. (Contributed by Mark Dickinson and nirinA raseliarison; :issue:" -"`3366`.)" +"New functions: the :mod:`math` module gained :func:`~math.erf` " +"and :func:`~math.erfc` for the error function and the complementary error " +"function, :func:`~math.expm1` which computes ``e**x - 1`` with more " +"precision than using :func:`~math.exp` and subtracting " +"1, :func:`~math.gamma` for the Gamma function, and :func:`~math.lgamma` for " +"the natural log of the Gamma function. (Contributed by Mark Dickinson and " +"nirinA raseliarison; :issue:`3366`.)" msgstr "" #: ../../whatsnew/2.7.rst:1420 @@ -1979,13 +2122,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:1437 msgid "" -"New functions: the :mod:`os` module wraps the following POSIX system calls: :" -"func:`~os.getresgid` and :func:`~os.getresuid`, which return the real, " -"effective, and saved GIDs and UIDs; :func:`~os.setresgid` and :func:`~os." -"setresuid`, which set real, effective, and saved GIDs and UIDs to new " -"values; :func:`~os.initgroups`, which initialize the group access list for " -"the current process. (GID/UID functions contributed by Travis H.; :issue:" -"`6508`. Support for initgroups added by Jean-Paul Calderone; :issue:`7333`.)" +"New functions: the :mod:`os` module wraps the following POSIX system " +"calls: :func:`~os.getresgid` and :func:`~os.getresuid`, which return the " +"real, effective, and saved GIDs and UIDs; :func:`~os.setresgid` " +"and :func:`~os.setresuid`, which set real, effective, and saved GIDs and " +"UIDs to new values; :func:`~os.initgroups`, which initialize the group " +"access list for the current process. (GID/UID functions contributed by " +"Travis H.; :issue:`6508`. Support for initgroups added by Jean-Paul " +"Calderone; :issue:`7333`.)" msgstr "" #: ../../whatsnew/2.7.rst:1447 @@ -1997,11 +2141,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:1451 msgid "" -"In the :mod:`os.path` module, the :func:`~os.path.normpath` and :func:`~os." -"path.abspath` functions now preserve Unicode; if their input path is a " -"Unicode string, the return value is also a Unicode string. (:meth:`~os.path." -"normpath` fixed by Matt Giuca in :issue:`5827`; :meth:`~os.path.abspath` " -"fixed by Ezio Melotti in :issue:`3426`.)" +"In the :mod:`os.path` module, the :func:`~os.path.normpath` " +"and :func:`~os.path.abspath` functions now preserve Unicode; if their input " +"path is a Unicode string, the return value is also a Unicode string. " +"(:meth:`~os.path.normpath` fixed by Matt Giuca " +"in :issue:`5827`; :meth:`~os.path.abspath` fixed by Ezio Melotti " +"in :issue:`3426`.)" msgstr "" #: ../../whatsnew/2.7.rst:1457 @@ -2013,24 +2158,26 @@ msgstr "" #: ../../whatsnew/2.7.rst:1461 msgid "" -"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, and :func:`~re." -"subn` now accept an optional *flags* argument, for consistency with the " -"other functions in the module. (Added by Gregory P. Smith.)" +"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, " +"and :func:`~re.subn` now accept an optional *flags* argument, for " +"consistency with the other functions in the module. (Added by Gregory P. " +"Smith.)" msgstr "" #: ../../whatsnew/2.7.rst:1465 msgid "" "New function: :func:`~runpy.run_path` in the :mod:`runpy` module will " "execute the code at a provided *path* argument. *path* can be the path of a " -"Python source file (:file:`example.py`), a compiled bytecode file (:file:" -"`example.pyc`), a directory (:file:`./package/`), or a zip archive (:file:" -"`example.zip`). If a directory or zip path is provided, it will be added to " -"the front of ``sys.path`` and the module :mod:`__main__` will be imported. " -"It's expected that the directory or zip contains a :file:`__main__.py`; if " -"it doesn't, some other :file:`__main__.py` might be imported from a location " -"later in ``sys.path``. This makes more of the machinery of :mod:`runpy` " -"available to scripts that want to mimic the way Python's command line " -"processes an explicit path name. (Added by Nick Coghlan; :issue:`6816`.)" +"Python source file (:file:`example.py`), a compiled bytecode file " +"(:file:`example.pyc`), a directory (:file:`./package/`), or a zip archive " +"(:file:`example.zip`). If a directory or zip path is provided, it will be " +"added to the front of ``sys.path`` and the module :mod:`__main__` will be " +"imported. It's expected that the directory or zip contains " +"a :file:`__main__.py`; if it doesn't, some other :file:`__main__.py` might " +"be imported from a location later in ``sys.path``. This makes more of the " +"machinery of :mod:`runpy` available to scripts that want to mimic the way " +"Python's command line processes an explicit path name. (Added by Nick " +"Coghlan; :issue:`6816`.)" msgstr "" #: ../../whatsnew/2.7.rst:1479 @@ -2054,27 +2201,28 @@ msgstr "" msgid "" "The :mod:`signal` module no longer re-installs the signal handler unless " "this is truly necessary, which fixes a bug that could make it impossible to " -"catch the EINTR signal robustly. (Fixed by Charles-Francois Natali; :issue:" -"`8354`.)" +"catch the EINTR signal robustly. (Fixed by Charles-Francois " +"Natali; :issue:`8354`.)" msgstr "" #: ../../whatsnew/2.7.rst:1495 msgid "" "New functions: in the :mod:`site` module, three new functions return various " "site- and user-specific paths. :func:`~site.getsitepackages` returns a list " -"containing all global site-packages directories, :func:`~site." -"getusersitepackages` returns the path of the user's site-packages directory, " -"and :func:`~site.getuserbase` returns the value of the :data:`~site." -"USER_BASE` environment variable, giving the path to a directory that can be " -"used to store data. (Contributed by Tarek Ziadé; :issue:`6693`.)" +"containing all global site-packages " +"directories, :func:`~site.getusersitepackages` returns the path of the " +"user's site-packages directory, and :func:`~site.getuserbase` returns the " +"value of the :data:`~site.USER_BASE` environment variable, giving the path " +"to a directory that can be used to store data. (Contributed by Tarek " +"Ziadé; :issue:`6693`.)" msgstr "" #: ../../whatsnew/2.7.rst:1506 msgid "" -"The :mod:`site` module now reports exceptions occurring when the :mod:" -"`sitecustomize` module is imported, and will no longer catch and swallow " -"the :exc:`KeyboardInterrupt` exception. (Fixed by Victor Stinner; :issue:" -"`3137`.)" +"The :mod:`site` module now reports exceptions occurring when " +"the :mod:`sitecustomize` module is imported, and will no longer catch and " +"swallow the :exc:`KeyboardInterrupt` exception. (Fixed by Victor " +"Stinner; :issue:`3137`.)" msgstr "" #: ../../whatsnew/2.7.rst:1511 @@ -2086,25 +2234,27 @@ msgstr "" #: ../../whatsnew/2.7.rst:1516 msgid "" -"The :meth:`~socket.socket.recv_into` and :meth:`~socket.socket." -"recvfrom_into` methods will now write into objects that support the buffer " -"API, most usefully the :class:`bytearray` and :class:`memoryview` objects. " -"(Implemented by Antoine Pitrou; :issue:`8104`.)" +"The :meth:`~socket.socket.recv_into` " +"and :meth:`~socket.socket.recvfrom_into` methods will now write into objects " +"that support the buffer API, most usefully the :class:`bytearray` " +"and :class:`memoryview` objects. (Implemented by Antoine " +"Pitrou; :issue:`8104`.)" msgstr "" #: ../../whatsnew/2.7.rst:1521 msgid "" -"The :mod:`SocketServer <socketserver>` module's :class:`~socketserver." -"TCPServer` class now supports socket timeouts and disabling the Nagle " -"algorithm. The :attr:`!disable_nagle_algorithm` class attribute defaults to " -"``False``; if overridden to be true, new request connections will have the " -"TCP_NODELAY option set to prevent buffering many small sends into a single " -"TCP packet. The :attr:`~socketserver.BaseServer.timeout` class attribute can " -"hold a timeout in seconds that will be applied to the request socket; if no " -"request is received within that time, :meth:`~socketserver.BaseServer." -"handle_timeout` will be called and :meth:`~socketserver.BaseServer." -"handle_request` will return. (Contributed by Kristján Valur Jónsson; :issue:" -"`6192` and :issue:`6267`.)" +"The :mod:`SocketServer <socketserver>` " +"module's :class:`~socketserver.TCPServer` class now supports socket timeouts " +"and disabling the Nagle algorithm. The :attr:`!disable_nagle_algorithm` " +"class attribute defaults to ``False``; if overridden to be true, new request " +"connections will have the TCP_NODELAY option set to prevent buffering many " +"small sends into a single TCP packet. " +"The :attr:`~socketserver.BaseServer.timeout` class attribute can hold a " +"timeout in seconds that will be applied to the request socket; if no request " +"is received within that " +"time, :meth:`~socketserver.BaseServer.handle_timeout` will be called " +"and :meth:`~socketserver.BaseServer.handle_request` will return. " +"(Contributed by Kristján Valur Jónsson; :issue:`6192` and :issue:`6267`.)" msgstr "" #: ../../whatsnew/2.7.rst:1533 @@ -2113,18 +2263,19 @@ msgid "" "of the `pysqlite package <https://github.com/ghaering/pysqlite>`__. Version " "2.6.0 includes a number of bugfixes, and adds the ability to load SQLite " "extensions from shared libraries. Call the ``enable_load_extension(True)`` " -"method to enable extensions, and then call :meth:`~sqlite3.Connection." -"load_extension` to load a particular shared library. (Updated by Gerhard " -"Häring.)" +"method to enable extensions, and then " +"call :meth:`~sqlite3.Connection.load_extension` to load a particular shared " +"library. (Updated by Gerhard Häring.)" msgstr "" #: ../../whatsnew/2.7.rst:1540 msgid "" "The :mod:`ssl` module's :class:`~ssl.SSLSocket` objects now support the " -"buffer API, which fixed a test suite failure (fix by Antoine Pitrou; :issue:" -"`7133`) and automatically set OpenSSL's :c:macro:`!SSL_MODE_AUTO_RETRY`, " -"which will prevent an error code being returned from :meth:`recv` operations " -"that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:`8222`)." +"buffer API, which fixed a test suite failure (fix by Antoine " +"Pitrou; :issue:`7133`) and automatically set OpenSSL's :c:macro:`!" +"SSL_MODE_AUTO_RETRY`, which will prevent an error code being returned " +"from :meth:`recv` operations that trigger an SSL renegotiation (fix by " +"Antoine Pitrou; :issue:`8222`)." msgstr "" #: ../../whatsnew/2.7.rst:1547 @@ -2146,10 +2297,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:1560 msgid "" -"The version of OpenSSL being used is now available as the module attributes :" -"const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl.OPENSSL_VERSION_INFO` (a " -"5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by " -"Antoine Pitrou; :issue:`8321`.)" +"The version of OpenSSL being used is now available as the module " +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by Antoine " +"Pitrou; :issue:`8321`.)" msgstr "" #: ../../whatsnew/2.7.rst:1566 @@ -2165,10 +2317,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:1575 msgid "" -"New function: the :mod:`subprocess` module's :func:`~subprocess." -"check_output` runs a command with a specified set of arguments and returns " -"the command's output as a string when the command runs without error, or " -"raises a :exc:`~subprocess.CalledProcessError` exception otherwise." +"New function: the :mod:`subprocess` " +"module's :func:`~subprocess.check_output` runs a command with a specified " +"set of arguments and returns the command's output as a string when the " +"command runs without error, or raises " +"a :exc:`~subprocess.CalledProcessError` exception otherwise." msgstr "" #: ../../whatsnew/2.7.rst:1582 @@ -2196,10 +2349,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1596 msgid "" -"New function: :func:`~symtable.Symbol.is_declared_global` in the :mod:" -"`symtable` module returns true for variables that are explicitly declared to " -"be global, false for ones that are implicitly global. (Contributed by Jeremy " -"Hylton.)" +"New function: :func:`~symtable.Symbol.is_declared_global` in " +"the :mod:`symtable` module returns true for variables that are explicitly " +"declared to be global, false for ones that are implicitly global. " +"(Contributed by Jeremy Hylton.)" msgstr "" #: ../../whatsnew/2.7.rst:1601 ../../whatsnew/2.7.rst:2500 @@ -2211,7 +2364,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1605 msgid "" -"The :attr:`sys.version_info` value is now a named tuple, with attributes " +"The :data:`sys.version_info` value is now a named tuple, with attributes " "named :attr:`!major`, :attr:`!minor`, :attr:`!micro`, :attr:`!releaselevel`, " "and :attr:`!serial`. (Contributed by Ross Light; :issue:`4285`.)" msgstr "" @@ -2219,8 +2372,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1610 msgid "" ":func:`sys.getwindowsversion` also returns a named tuple, with attributes " -"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!platform`, :" -"attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" +"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!" +"platform`, :attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" "service_pack_minor`, :attr:`!suite_mask`, and :attr:`!product_type`. " "(Contributed by Brian Curtin; :issue:`7766`.)" msgstr "" @@ -2245,8 +2398,8 @@ msgid "" "file will be excluded from the resulting archive. This is more powerful " "than the existing *exclude* argument, which has therefore been deprecated. " "(Added by Lars Gustäbel; :issue:`6856`.) The :class:`~tarfile.TarFile` class " -"also now supports the context management protocol. (Added by Lars Gustäbel; :" -"issue:`7232`.)" +"also now supports the context management protocol. (Added by Lars " +"Gustäbel; :issue:`7232`.)" msgstr "" #: ../../whatsnew/2.7.rst:1636 @@ -2263,10 +2416,10 @@ msgstr "" msgid "" "The Unicode database provided by the :mod:`unicodedata` module is now used " "internally to determine which characters are numeric, whitespace, or " -"represent line breaks. The database also includes information from the :" -"file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury Forgeot " -"d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 (updated by " -"Florent Xicluna; :issue:`8024`)." +"represent line breaks. The database also includes information from " +"the :file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury " +"Forgeot d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 " +"(updated by Florent Xicluna; :issue:`8024`)." msgstr "" #: ../../whatsnew/2.7.rst:1651 ../../whatsnew/2.7.rst:2512 @@ -2306,8 +2459,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1678 msgid "" "The :mod:`urlparse <urllib.parse>` module also supports IPv6 literal " -"addresses as defined by :rfc:`2732` (contributed by Senthil Kumaran; :issue:" -"`2987`)." +"addresses as defined by :rfc:`2732` (contributed by Senthil " +"Kumaran; :issue:`2987`)." msgstr "" #: ../../whatsnew/2.7.rst:1681 @@ -2336,13 +2489,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1700 msgid "" -"The XML-RPC client and server, provided by the :mod:`xmlrpclib <xmlrpc." -"client>` and :mod:`SimpleXMLRPCServer <xmlrpc.server>` modules, have " +"The XML-RPC client and server, provided by the :mod:`xmlrpclib " +"<xmlrpc.client>` and :mod:`SimpleXMLRPCServer <xmlrpc.server>` modules, have " "improved performance by supporting HTTP/1.1 keep-alive and by optionally " "using gzip encoding to compress the XML being exchanged. The gzip " -"compression is controlled by the :attr:`!encode_threshold` attribute of :" -"class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size in " -"bytes; responses larger than this will be compressed. (Contributed by " +"compression is controlled by the :attr:`!encode_threshold` attribute " +"of :class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size " +"in bytes; responses larger than this will be compressed. (Contributed by " "Kristján Valur Jónsson; :issue:`6267`.)" msgstr "" @@ -2357,9 +2510,9 @@ msgstr "" msgid "" ":mod:`zipfile` now also supports archiving empty directories and extracts " "them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.) Reading files out " -"of an archive is faster, and interleaving :meth:`read() <io.BufferedIOBase." -"read>` and :meth:`readline() <io.IOBase.readline>` now works correctly. " -"(Contributed by Nir Aides; :issue:`7610`.)" +"of an archive is faster, and interleaving :meth:`read() " +"<io.BufferedIOBase.read>` and :meth:`readline() <io.IOBase.readline>` now " +"works correctly. (Contributed by Nir Aides; :issue:`7610`.)" msgstr "" #: ../../whatsnew/2.7.rst:1720 @@ -2388,8 +2541,8 @@ msgid "" "useful for implementers of Python interpreters and to users who wish to " "write new importers that can participate in the import process. Python 2.7 " "doesn't contain the complete :mod:`importlib` package, but instead has a " -"tiny subset that contains a single function, :func:`~importlib." -"import_module`." +"tiny subset that contains a single " +"function, :func:`~importlib.import_module`." msgstr "" #: ../../whatsnew/2.7.rst:1747 @@ -2505,10 +2658,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1818 msgid "" -"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added in :" -"issue:`2983`. An alternate version called ``Tile.py``, written by Martin " -"Franklin and maintained by Kevin Walzer, was proposed for inclusion in :" -"issue:`2618`, but the authors argued that Guilherme Polo's work was more " +"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added " +"in :issue:`2983`. An alternate version called ``Tile.py``, written by " +"Martin Franklin and maintained by Kevin Walzer, was proposed for inclusion " +"in :issue:`2618`, but the authors argued that Guilherme Polo's work was more " "comprehensive." msgstr "" @@ -2580,8 +2733,8 @@ msgstr "" msgid "" ":option:`-f <unittest -f>` or :option:`!--failfast` makes test execution " "stop immediately when a test fails instead of continuing to execute further " -"tests. (Suggested by Cliff Dyer and implemented by Michael Foord; :issue:" -"`8074`.)" +"tests. (Suggested by Cliff Dyer and implemented by Michael " +"Foord; :issue:`8074`.)" msgstr "" #: ../../whatsnew/2.7.rst:1874 @@ -2599,13 +2752,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1881 msgid "" -"The error messages for :meth:`~unittest.TestCase.assertEqual`, :meth:" -"`~unittest.TestCase.assertTrue`, and :meth:`~unittest.TestCase.assertFalse` " -"failures now provide more information. If you set the :attr:`~unittest." -"TestCase.longMessage` attribute of your :class:`~unittest.TestCase` classes " -"to true, both the standard error message and any additional message you " -"provide will be printed for failures. (Added by Michael Foord; :issue:" -"`5663`.)" +"The error messages " +"for :meth:`~unittest.TestCase.assertEqual`, :meth:`~unittest.TestCase.assertTrue`, " +"and :meth:`~unittest.TestCase.assertFalse` failures now provide more " +"information. If you set the :attr:`~unittest.TestCase.longMessage` " +"attribute of your :class:`~unittest.TestCase` classes to true, both the " +"standard error message and any additional message you provide will be " +"printed for failures. (Added by Michael Foord; :issue:`5663`.)" msgstr "" #: ../../whatsnew/2.7.rst:1888 @@ -2628,22 +2781,24 @@ msgstr "(由 Antoine Pitrou 實作;:issue:`4444`。)" #: ../../whatsnew/2.7.rst:1899 msgid "" "Module- and class-level setup and teardown fixtures are now supported. " -"Modules can contain :func:`~unittest.setUpModule` and :func:`~unittest." -"tearDownModule` functions. Classes can have :meth:`~unittest.TestCase." -"setUpClass` and :meth:`~unittest.TestCase.tearDownClass` methods that must " -"be defined as class methods (using ``@classmethod`` or equivalent). These " -"functions and methods are invoked when the test runner switches to a test " -"case in a different module or class." +"Modules can contain :func:`~unittest.setUpModule` " +"and :func:`~unittest.tearDownModule` functions. Classes can " +"have :meth:`~unittest.TestCase.setUpClass` " +"and :meth:`~unittest.TestCase.tearDownClass` methods that must be defined as " +"class methods (using ``@classmethod`` or equivalent). These functions and " +"methods are invoked when the test runner switches to a test case in a " +"different module or class." msgstr "" #: ../../whatsnew/2.7.rst:1907 msgid "" -"The methods :meth:`~unittest.TestCase.addCleanup` and :meth:`~unittest." -"TestCase.doCleanups` were added. :meth:`~unittest.TestCase.addCleanup` lets " -"you add cleanup functions that will be called unconditionally (after :meth:" -"`~unittest.TestCase.setUp` if :meth:`~unittest.TestCase.setUp` fails, " -"otherwise after :meth:`~unittest.TestCase.tearDown`). This allows for much " -"simpler resource allocation and deallocation during tests (:issue:`5679`)." +"The methods :meth:`~unittest.TestCase.addCleanup` " +"and :meth:`~unittest.TestCase.doCleanups` were " +"added. :meth:`~unittest.TestCase.addCleanup` lets you add cleanup functions " +"that will be called unconditionally (after :meth:`~unittest.TestCase.setUp` " +"if :meth:`~unittest.TestCase.setUp` fails, otherwise " +"after :meth:`~unittest.TestCase.tearDown`). This allows for much simpler " +"resource allocation and deallocation during tests (:issue:`5679`)." msgstr "" #: ../../whatsnew/2.7.rst:1915 @@ -2656,31 +2811,31 @@ msgstr "" #: ../../whatsnew/2.7.rst:1920 msgid "" -":meth:`~unittest.TestCase.assertIsNone` and :meth:`~unittest.TestCase." -"assertIsNotNone` take one expression and verify that the result is or is not " -"``None``." +":meth:`~unittest.TestCase.assertIsNone` " +"and :meth:`~unittest.TestCase.assertIsNotNone` take one expression and " +"verify that the result is or is not ``None``." msgstr "" #: ../../whatsnew/2.7.rst:1923 msgid "" -":meth:`~unittest.TestCase.assertIs` and :meth:`~unittest.TestCase." -"assertIsNot` take two values and check whether the two values evaluate to " -"the same object or not. (Added by Michael Foord; :issue:`2578`.)" +":meth:`~unittest.TestCase.assertIs` " +"and :meth:`~unittest.TestCase.assertIsNot` take two values and check whether " +"the two values evaluate to the same object or not. (Added by Michael " +"Foord; :issue:`2578`.)" msgstr "" #: ../../whatsnew/2.7.rst:1927 msgid "" -":meth:`~unittest.TestCase.assertIsInstance` and :meth:`~unittest.TestCase." -"assertNotIsInstance` check whether the resulting object is an instance of a " -"particular class, or of one of a tuple of classes. (Added by Georg Brandl; :" -"issue:`7031`.)" +":meth:`~unittest.TestCase.assertIsInstance` " +"and :meth:`~unittest.TestCase.assertNotIsInstance` check whether the " +"resulting object is an instance of a particular class, or of one of a tuple " +"of classes. (Added by Georg Brandl; :issue:`7031`.)" msgstr "" #: ../../whatsnew/2.7.rst:1932 msgid "" -":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase." -"assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, and :meth:" -"`~unittest.TestCase.assertLessEqual` compare two quantities." +":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase.assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, " +"and :meth:`~unittest.TestCase.assertLessEqual` compare two quantities." msgstr "" #: ../../whatsnew/2.7.rst:1936 @@ -2693,10 +2848,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1941 msgid "" -":meth:`assertRegexpMatches() <unittest.TestCase.assertRegex>` and :meth:" -"`assertNotRegexpMatches() <unittest.TestCase.assertNotRegex>` checks whether " -"the first argument is a string matching or not matching the regular " -"expression provided as the second argument (:issue:`8038`)." +":meth:`assertRegexpMatches() <unittest.TestCase.assertRegex>` " +"and :meth:`assertNotRegexpMatches() <unittest.TestCase.assertNotRegex>` " +"checks whether the first argument is a string matching or not matching the " +"regular expression provided as the second argument (:issue:`8038`)." msgstr "" #: ../../whatsnew/2.7.rst:1946 @@ -2709,8 +2864,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:1951 msgid "" -":meth:`~unittest.TestCase.assertIn` and :meth:`~unittest.TestCase." -"assertNotIn` tests whether *first* is or is not in *second*." +":meth:`~unittest.TestCase.assertIn` " +"and :meth:`~unittest.TestCase.assertNotIn` tests whether *first* is or is " +"not in *second*." msgstr "" #: ../../whatsnew/2.7.rst:1954 @@ -2727,13 +2883,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:1960 msgid "" -"Similarly, :meth:`~unittest.TestCase.assertListEqual` and :meth:`~unittest." -"TestCase.assertTupleEqual` compare the specified types and explain any " -"differences without necessarily printing their full values; these methods " -"are now used by default when comparing lists and tuples using :meth:" -"`~unittest.TestCase.assertEqual`. More generally, :meth:`~unittest.TestCase." -"assertSequenceEqual` compares two sequences and can optionally check whether " -"both sequences are of a particular type." +"Similarly, :meth:`~unittest.TestCase.assertListEqual` " +"and :meth:`~unittest.TestCase.assertTupleEqual` compare the specified types " +"and explain any differences without necessarily printing their full values; " +"these methods are now used by default when comparing lists and tuples " +"using :meth:`~unittest.TestCase.assertEqual`. More " +"generally, :meth:`~unittest.TestCase.assertSequenceEqual` compares two " +"sequences and can optionally check whether both sequences are of a " +"particular type." msgstr "" #: ../../whatsnew/2.7.rst:1968 @@ -2747,45 +2904,47 @@ msgstr "" #: ../../whatsnew/2.7.rst:1973 msgid "" -":meth:`~unittest.TestCase.assertAlmostEqual` and :meth:`~unittest.TestCase." -"assertNotAlmostEqual` test whether *first* and *second* are approximately " -"equal. This method can either round their difference to an optionally " -"specified number of *places* (the default is 7) and compare it to zero, or " -"require the difference to be smaller than a supplied *delta* value." +":meth:`~unittest.TestCase.assertAlmostEqual` " +"and :meth:`~unittest.TestCase.assertNotAlmostEqual` test whether *first* and " +"*second* are approximately equal. This method can either round their " +"difference to an optionally specified number of *places* (the default is 7) " +"and compare it to zero, or require the difference to be smaller than a " +"supplied *delta* value." msgstr "" #: ../../whatsnew/2.7.rst:1979 msgid "" -":meth:`~unittest.TestLoader.loadTestsFromName` properly honors the :attr:" -"`~unittest.TestLoader.suiteClass` attribute of the :class:`~unittest." -"TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" +":meth:`~unittest.TestLoader.loadTestsFromName` properly honors " +"the :attr:`~unittest.TestLoader.suiteClass` attribute of " +"the :class:`~unittest.TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" msgstr "" #: ../../whatsnew/2.7.rst:1983 msgid "" "A new hook lets you extend the :meth:`~unittest.TestCase.assertEqual` method " -"to handle new data types. The :meth:`~unittest.TestCase." -"addTypeEqualityFunc` method takes a type object and a function. The function " -"will be used when both of the objects being compared are of the specified " -"type. This function should compare the two objects and raise an exception " -"if they don't match; it's a good idea for the function to provide additional " -"information about why the two objects aren't matching, much as the new " -"sequence comparison methods do." +"to handle new data types. " +"The :meth:`~unittest.TestCase.addTypeEqualityFunc` method takes a type " +"object and a function. The function will be used when both of the objects " +"being compared are of the specified type. This function should compare the " +"two objects and raise an exception if they don't match; it's a good idea for " +"the function to provide additional information about why the two objects " +"aren't matching, much as the new sequence comparison methods do." msgstr "" #: ../../whatsnew/2.7.rst:1992 msgid "" -":func:`unittest.main` now takes an optional ``exit`` argument. If false, :" -"func:`~unittest.main` doesn't call :func:`sys.exit`, allowing :func:" -"`~unittest.main` to be used from the interactive interpreter. (Contributed " -"by J. Pablo Fernández; :issue:`3379`.)" +":func:`unittest.main` now takes an optional ``exit`` argument. If " +"false, :func:`~unittest.main` doesn't call :func:`sys.exit`, " +"allowing :func:`~unittest.main` to be used from the interactive interpreter. " +"(Contributed by J. Pablo Fernández; :issue:`3379`.)" msgstr "" #: ../../whatsnew/2.7.rst:1997 msgid "" -":class:`~unittest.TestResult` has new :meth:`~unittest.TestResult." -"startTestRun` and :meth:`~unittest.TestResult.stopTestRun` methods that are " -"called immediately before and after a test run. (Contributed by Robert " +":class:`~unittest.TestResult` has " +"new :meth:`~unittest.TestResult.startTestRun` " +"and :meth:`~unittest.TestResult.stopTestRun` methods that are called " +"immediately before and after a test run. (Contributed by Robert " "Collins; :issue:`5728`.)" msgstr "" @@ -2844,16 +3003,16 @@ msgstr "" #: ../../whatsnew/2.7.rst:2031 msgid "" "ElementTree's code for converting trees to a string has been significantly " -"reworked, making it roughly twice as fast in many cases. The :meth:" -"`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " +"reworked, making it roughly twice as fast in many cases. " +"The :meth:`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` " +"and :meth:`Element.write` methods now have a *method* parameter that can be " "\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " "elements as ``<empty></empty>`` instead of ``<empty/>``, and text mode will " -"skip over elements and only output the text chunks. If you set the :attr:" -"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " -"leave its children in place, the element will be omitted when the tree is " -"written out, so you don't need to do more extensive rearrangement to remove " -"a single element." +"skip over elements and only output the text chunks. If you set " +"the :attr:`~xml.etree.ElementTree.Element.tag` attribute of an element to " +"``None`` but leave its children in place, the element will be omitted when " +"the tree is written out, so you don't need to do more extensive " +"rearrangement to remove a single element." msgstr "" #: ../../whatsnew/2.7.rst:2044 @@ -2861,17 +3020,18 @@ msgid "" "Namespace handling has also been improved. All ``xmlns:<whatever>`` " "declarations are now output on the root element, not scattered throughout " "the resulting XML. You can set the default namespace for a tree by setting " -"the :attr:`default_namespace` attribute and can register new prefixes with :" -"meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you can use " -"the true/false *xml_declaration* parameter to suppress the XML declaration." +"the :attr:`default_namespace` attribute and can register new prefixes " +"with :meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you " +"can use the true/false *xml_declaration* parameter to suppress the XML " +"declaration." msgstr "" #: ../../whatsnew/2.7.rst:2052 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.extend` appends the items from a sequence to the " -"element's children. Elements themselves behave like sequences, so it's easy " -"to move children from one element to another::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.extend` appends the items from " +"a sequence to the element's children. Elements themselves behave like " +"sequences, so it's easy to move children from one element to another::" msgstr "" #: ../../whatsnew/2.7.rst:2058 @@ -2890,19 +3050,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:2069 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.iter` yields the children of the element as a " -"generator. It's also possible to write ``for child in elem:`` to loop over " -"an element's children. The existing method :meth:`!getiterator` is now " -"deprecated, as is :meth:`!getchildren` which constructs and returns a list " -"of children." +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.iter` yields the children of " +"the element as a generator. It's also possible to write ``for child in " +"elem:`` to loop over an element's children. The existing method :meth:`!" +"getiterator` is now deprecated, as is :meth:`!getchildren` which constructs " +"and returns a list of children." msgstr "" #: ../../whatsnew/2.7.rst:2076 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.itertext` yields all chunks of text that are descendants " -"of the element. For example::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.itertext` yields all chunks of " +"text that are descendants of the element. For example::" msgstr "" #: ../../whatsnew/2.7.rst:2080 @@ -2928,19 +3088,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:2095 msgid "" "Fredrik Lundh develops ElementTree and produced the 1.3 version; you can " -"read his article describing 1.3 at https://web.archive.org/" -"web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " +"read his article describing 1.3 at https://web.archive.org/web/" +"20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " "Xicluna updated the version included with Python, after discussions on " "python-dev and in :issue:`6472`.)" msgstr "" #: ../../whatsnew/2.7.rst:2105 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.7.rst:2107 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.7.rst:2109 msgid "" @@ -2968,8 +3128,8 @@ msgstr "" msgid "" ":c:func:`Py_AddPendingCall` is now thread-safe, letting any worker thread " "submit notifications to the main Python thread. This is particularly useful " -"for asynchronous IO operations. (Contributed by Kristján Valur Jónsson; :" -"issue:`4293`.)" +"for asynchronous IO operations. (Contributed by Kristján Valur " +"Jónsson; :issue:`4293`.)" msgstr "" #: ../../whatsnew/2.7.rst:2131 @@ -3000,11 +3160,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2150 msgid "" -"New functions: :c:func:`PyLong_AsLongAndOverflow` and :c:func:" -"`PyLong_AsLongLongAndOverflow` approximates a Python long integer as a C :c:" -"expr:`long` or :c:expr:`long long`. If the number is too large to fit into " -"the output type, an *overflow* flag is set and returned to the caller. " -"(Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.)" +"New functions: :c:func:`PyLong_AsLongAndOverflow` " +"and :c:func:`PyLong_AsLongLongAndOverflow` approximates a Python long " +"integer as a C :c:expr:`long` or :c:expr:`long long`. If the number is too " +"large to fit into the output type, an *overflow* flag is set and returned to " +"the caller. (Contributed by Case Van Horsen; :issue:`7528` " +"and :issue:`7767`.)" msgstr "" #: ../../whatsnew/2.7.rst:2157 @@ -3050,14 +3211,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2183 msgid "" -"New macros: the Python header files now define the following macros: :c:" -"macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:" -"`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:" -"`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, and :c:macro:`Py_TOUPPER`. All of " -"these functions are analogous to the C standard macros for classifying " -"characters, but ignore the current locale setting, because in several places " -"Python needs to analyze characters in a locale-independent way. (Added by " -"Eric Smith; :issue:`5793`.)" +"New macros: the Python header files now define the following " +"macros: :c:macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, " +"and :c:macro:`Py_TOUPPER`. All of these functions are analogous to the C " +"standard macros for classifying characters, but ignore the current locale " +"setting, because in several places Python needs to analyze characters in a " +"locale-independent way. (Added by Eric Smith; :issue:`5793`.)" msgstr "" #: ../../whatsnew/2.7.rst:2201 @@ -3102,16 +3261,17 @@ msgstr "" #: ../../whatsnew/2.7.rst:2230 msgid "" -"The :c:func:`Py_Finalize` function now calls the internal :func:`!threading." -"_shutdown` function; this prevents some exceptions from being raised when an " -"interpreter shuts down. (Patch by Adam Olsen; :issue:`1722344`.)" +"The :c:func:`Py_Finalize` function now calls the internal :func:`!" +"threading._shutdown` function; this prevents some exceptions from being " +"raised when an interpreter shuts down. (Patch by Adam " +"Olsen; :issue:`1722344`.)" msgstr "" #: ../../whatsnew/2.7.rst:2235 msgid "" "When using the :c:type:`PyMemberDef` structure to define attributes of a " -"type, Python will no longer let you try to delete or set a :c:macro:" -"`T_STRING_INPLACE` attribute." +"type, Python will no longer let you try to delete or set " +"a :c:macro:`T_STRING_INPLACE` attribute." msgstr "" #: ../../whatsnew/2.7.rst:2241 @@ -3124,8 +3284,8 @@ msgstr "" msgid "" "New configure option: the :option:`!--with-system-expat` switch allows " "building the :mod:`pyexpat <xml.parsers.expat>` module to use the system " -"Expat library. (Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:" -"`7609`.)" +"Expat library. (Contributed by Arfrever Frehtes Taifersar " +"Arahesis; :issue:`7609`.)" msgstr "" #: ../../whatsnew/2.7.rst:2249 @@ -3133,8 +3293,8 @@ msgid "" "New configure option: the :option:`!--with-valgrind` option will now disable " "the pymalloc allocator, which is difficult for the Valgrind memory-error " "detector to analyze correctly. Valgrind will therefore be better at " -"detecting memory leaks and overruns. (Contributed by James Henstridge; :" -"issue:`2422`.)" +"detecting memory leaks and overruns. (Contributed by James " +"Henstridge; :issue:`2422`.)" msgstr "" #: ../../whatsnew/2.7.rst:2256 @@ -3149,8 +3309,8 @@ msgid "" "The :program:`configure` script now checks for floating-point rounding bugs " "on certain 32-bit Intel chips and defines a :c:macro:`X87_DOUBLE_ROUNDING` " "preprocessor definition. No code currently uses this definition, but it's " -"available if anyone wishes to use it. (Added by Mark Dickinson; :issue:" -"`2937`.)" +"available if anyone wishes to use it. (Added by Mark " +"Dickinson; :issue:`2937`.)" msgstr "" #: ../../whatsnew/2.7.rst:2267 @@ -3180,12 +3340,12 @@ msgstr "" msgid "" "Python 3.1 adds a new C datatype, :c:type:`PyCapsule`, for providing a C API " "to an extension module. A capsule is essentially the holder of a C ``void " -"*`` pointer, and is made available as a module attribute; for example, the :" -"mod:`socket` module's API is exposed as ``socket.CAPI``, and :mod:" -"`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can import the " -"module, access its dictionary to get the capsule object, and then get the " -"``void *`` pointer, which will usually point to an array of pointers to the " -"module's various API functions." +"*`` pointer, and is made available as a module attribute; for example, " +"the :mod:`socket` module's API is exposed as ``socket.CAPI``, " +"and :mod:`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can " +"import the module, access its dictionary to get the capsule object, and then " +"get the ``void *`` pointer, which will usually point to an array of pointers " +"to the module's various API functions." msgstr "" #: ../../whatsnew/2.7.rst:2292 @@ -3223,8 +3383,8 @@ msgid "" "Python 2.7 now uses capsules internally to provide various extension-module " "APIs, but the :c:func:`!PyCObject_AsVoidPtr` was modified to handle " "capsules, preserving compile-time compatibility with the :c:type:`!" -"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal a :" -"exc:`PendingDeprecationWarning`, which is silent by default." +"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal " +"a :exc:`PendingDeprecationWarning`, which is silent by default." msgstr "" #: ../../whatsnew/2.7.rst:2322 @@ -3239,11 +3399,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2331 msgid "" -"The :mod:`msvcrt` module now contains some constants from the :file:" -"`crtassem.h` header file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:" -"`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, and :data:`~msvcrt." -"LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David Cournapeau; :issue:" -"`4365`.)" +"The :mod:`msvcrt` module now contains some constants from " +"the :file:`crtassem.h` header " +"file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, " +"and :data:`~msvcrt.LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David " +"Cournapeau; :issue:`4365`.)" msgstr "" #: ../../whatsnew/2.7.rst:2338 @@ -3251,9 +3411,10 @@ msgid "" "The :mod:`_winreg <winreg>` module for accessing the registry now implements " "the :func:`~winreg.CreateKeyEx` and :func:`~winreg.DeleteKeyEx` functions, " "extended versions of previously supported functions that take several extra " -"arguments. The :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` were also " -"tested and documented. (Implemented by Brian Curtin: :issue:`7347`.)" +"arguments. " +"The :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` were also tested and documented. " +"(Implemented by Brian Curtin: :issue:`7347`.)" msgstr "" #: ../../whatsnew/2.7.rst:2346 @@ -3266,11 +3427,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2350 msgid "" "The :func:`os.kill` function now works on Windows. The signal value can be " -"the constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal." -"CTRL_BREAK_EVENT`, or any integer. The first two constants will send :kbd:" -"`Control-C` and :kbd:`Control-Break` keystroke events to subprocesses; any " -"other value will use the :c:func:`!TerminateProcess` API. (Contributed by " -"Miki Tebeka; :issue:`1220212`.)" +"the " +"constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal.CTRL_BREAK_EVENT`, " +"or any integer. The first two constants will send :kbd:`Control-C` " +"and :kbd:`Control-Break` keystroke events to subprocesses; any other value " +"will use the :c:func:`!TerminateProcess` API. (Contributed by Miki " +"Tebeka; :issue:`1220212`.)" msgstr "" #: ../../whatsnew/2.7.rst:2357 @@ -3291,10 +3453,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2369 msgid "" -"The path ``/Library/Python/2.7/site-packages`` is now appended to ``sys." -"path``, in order to share added packages between the system installation and " -"a user-installed copy of the same version. (Changed by Ronald Oussoren; :" -"issue:`4865`.)" +"The path ``/Library/Python/2.7/site-packages`` is now appended to " +"``sys.path``, in order to share added packages between the system " +"installation and a user-installed copy of the same version. (Changed by " +"Ronald Oussoren; :issue:`4865`.)" msgstr "" #: ../../whatsnew/2.7.rst:2376 @@ -3315,10 +3477,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2389 msgid "" -"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with the :func:`~socket." -"socket` methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket." -"setsockopt` to select an alternate routing table, is now available in the :" -"mod:`socket` module. (Added by Kyle VanderBeek; :issue:`8235`.)" +"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with " +"the :func:`~socket.socket` " +"methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket.setsockopt` " +"to select an alternate routing table, is now available in the :mod:`socket` " +"module. (Added by Kyle VanderBeek; :issue:`8235`.)" msgstr "" #: ../../whatsnew/2.7.rst:2395 @@ -3337,8 +3500,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2405 msgid "" -"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms in :" -"file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" +"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms " +"in :file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" msgstr "" #: ../../whatsnew/2.7.rst:2409 @@ -3354,9 +3517,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2416 msgid "" "The :file:`regrtest.py` script now takes a :option:`!--randseed=` switch " -"that takes an integer that will be used as the random seed for the :option:" -"`!-r` option that executes tests in random order. The :option:`!-r` option " -"also reports the seed that was used (Added by Collin Winter.)" +"that takes an integer that will be used as the random seed for " +"the :option:`!-r` option that executes tests in random order. The :option:`!-" +"r` option also reports the seed that was used (Added by Collin Winter.)" msgstr "" #: ../../whatsnew/2.7.rst:2422 @@ -3379,7 +3542,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2439 msgid "Porting to Python 2.7" -msgstr "" +msgstr "移植至 Python 2.7" #: ../../whatsnew/2.7.rst:2441 msgid "" @@ -3398,8 +3561,8 @@ msgstr "" msgid "" "The string :meth:`format` method changed the default precision used for " "floating-point and complex numbers from 6 decimal places to 12, which " -"matches the precision used by :func:`str`. (Changed by Eric Smith; :issue:" -"`5920`.)" +"matches the precision used by :func:`str`. (Changed by Eric " +"Smith; :issue:`5920`.)" msgstr "" #: ../../whatsnew/2.7.rst:2454 @@ -3413,10 +3576,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2460 msgid "" -"Due to a bug in Python 2.6, the *exc_value* parameter to :meth:`~object." -"__exit__` methods was often the string representation of the exception, not " -"an instance. This was fixed in 2.7, so *exc_value* will be an instance as " -"expected. (Fixed by Florent Xicluna; :issue:`7853`.)" +"Due to a bug in Python 2.6, the *exc_value* parameter " +"to :meth:`~object.__exit__` methods was often the string representation of " +"the exception, not an instance. This was fixed in 2.7, so *exc_value* will " +"be an instance as expected. (Fixed by Florent Xicluna; :issue:`7853`.)" msgstr "" #: ../../whatsnew/2.7.rst:2470 @@ -3426,18 +3589,18 @@ msgstr "" #: ../../whatsnew/2.7.rst:2472 msgid "" "Operations with :class:`~datetime.datetime` instances that resulted in a " -"year falling outside the supported range didn't always raise :exc:" -"`OverflowError`. Such errors are now checked more carefully and will now " -"raise the exception. (Reported by Mark Leander, patch by Anand B. Pillai and " -"Alexander Belopolsky; :issue:`7150`.)" +"year falling outside the supported range didn't always " +"raise :exc:`OverflowError`. Such errors are now checked more carefully and " +"will now raise the exception. (Reported by Mark Leander, patch by Anand B. " +"Pillai and Alexander Belopolsky; :issue:`7150`.)" msgstr "" #: ../../whatsnew/2.7.rst:2478 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:" -"`format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which might change the output of your " -"programs. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`format` method, the default alignment was previously left-" +"alignment. This has been changed to right-alignment, which might change the " +"output of your programs. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" #: ../../whatsnew/2.7.rst:2490 @@ -3468,9 +3631,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2545 msgid "" -"Use the new :c:func:`PyOS_string_to_double` function instead of the old :c:" -"func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, which " -"are now deprecated." +"Use the new :c:func:`PyOS_string_to_double` function instead of the " +"old :c:func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, " +"which are now deprecated." msgstr "" #: ../../whatsnew/2.7.rst:2549 @@ -3512,8 +3675,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2580 msgid "" -"In debug mode, the ``[xxx refs]`` statistic is not written by default, the :" -"envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " +"In debug mode, the ``[xxx refs]`` statistic is not written by default, " +"the :envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " "(Contributed by Victor Stinner; :issue:`31733`.)" msgstr "" @@ -3522,8 +3685,8 @@ msgid "" "When Python is compiled with ``COUNT_ALLOC`` defined, allocation counts are " "no longer dumped by default anymore: the :envvar:`!PYTHONSHOWALLOCCOUNT` " "environment variable must now also be set. Moreover, allocation counts are " -"now dumped into stderr, rather than stdout. (Contributed by Victor Stinner; :" -"issue:`31692`.)" +"now dumped into stderr, rather than stdout. (Contributed by Victor " +"Stinner; :issue:`31692`.)" msgstr "" #: ../../whatsnew/2.7.rst:2593 @@ -3586,8 +3749,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2626 msgid "" "OpenSSL 1.0.1h was upgraded for the official Windows installers published on " -"python.org. (Contributed by Zachary Ware in :issue:`21671` for :cve:" -"`2014-0224`.)" +"python.org. (Contributed by Zachary Ware in :issue:`21671` " +"for :cve:`2014-0224`.)" msgstr "" #: ../../whatsnew/2.7.rst:2629 @@ -3617,10 +3780,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2643 msgid "" -":data:`hashlib.algorithms_guaranteed` and :data:`hashlib." -"algorithms_available` were backported from Python 3 to make it easier for " -"Python 2 applications to select the strongest available hash algorithm. " -"(Contributed by Alex Gaynor in :issue:`21307`)" +":data:`hashlib.algorithms_guaranteed` " +"and :data:`hashlib.algorithms_available` were backported from Python 3 to " +"make it easier for Python 2 applications to select the strongest available " +"hash algorithm. (Contributed by Alex Gaynor in :issue:`21307`)" msgstr "" #: ../../whatsnew/2.7.rst:2650 @@ -3684,7 +3847,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2690 msgid "Documentation Changes" -msgstr "" +msgstr "文件更動" #: ../../whatsnew/2.7.rst:2692 msgid "" @@ -3699,8 +3862,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2700 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" #: ../../whatsnew/2.7.rst:2706 @@ -3720,9 +3883,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2713 msgid "" -":pep:`476` updated :mod:`httplib <http>` and modules which use it, such as :" -"mod:`urllib2 <urllib.request>` and :mod:`xmlrpclib <xmlrpc.client>`, to now " -"verify that the server presents a certificate which is signed by a " +":pep:`476` updated :mod:`httplib <http>` and modules which use it, such " +"as :mod:`urllib2 <urllib.request>` and :mod:`xmlrpclib <xmlrpc.client>`, to " +"now verify that the server presents a certificate which is signed by a " "Certificate Authority in the platform trust store and whose hostname matches " "the hostname being requested by default, significantly improving security " "for many applications. This change was made in the Python 2.7.9 release." @@ -3805,8 +3968,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2772 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/2.7.rst:2775 ../../whatsnew/2.7.rst:2788 diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 029b569e43..ed4c8da527 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-12-11 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,7 +72,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:95 msgid "Print Is A Function" -msgstr "" +msgstr "Print 是一個函式" #: ../../whatsnew/3.0.rst:97 msgid "" @@ -80,6 +80,8 @@ msgid "" "with keyword arguments to replace most of the special syntax of the old " "``print`` statement (:pep:`3105`). Examples::" msgstr "" +"``print`` 陳述式已經被 :func:`print` 函式所取代,且舊 ``print`` 陳述式的大部" +"分特殊語法也被關鍵字引數所取代 (:pep:`3105`)。範例如下: ::" #: ../../whatsnew/3.0.rst:101 msgid "" @@ -146,30 +148,30 @@ msgstr "" #: ../../whatsnew/3.0.rst:145 msgid "Some well-known APIs no longer return lists:" -msgstr "" +msgstr "一些眾所周知的 API 不再回傳串列:" #: ../../whatsnew/3.0.rst:147 msgid "" -":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict." -"values` return \"views\" instead of lists. For example, this no longer " -"works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` instead (this " -"works in Python 2.5 too and is just as efficient)." +":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` " +"and :meth:`dict.values` return \"views\" instead of lists. For example, " +"this no longer works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` " +"instead (this works in Python 2.5 too and is just as efficient)." msgstr "" #: ../../whatsnew/3.0.rst:153 msgid "" -"Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and :meth:`dict." -"itervalues` methods are no longer supported." +"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!" +"dict.itervalues` methods are no longer supported." msgstr "" #: ../../whatsnew/3.0.rst:156 msgid "" ":func:`map` and :func:`filter` return iterators. If you really need a list " -"and the input sequences are all of equal length, a quick fix is to wrap :" -"func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix is " -"often to use a list comprehension (especially when the original code uses :" -"keyword:`lambda`), or rewriting the code so it doesn't need a list at all. " -"Particularly tricky is :func:`map` invoked for the side effects of the " +"and the input sequences are all of equal length, a quick fix is to " +"wrap :func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix " +"is often to use a list comprehension (especially when the original code " +"uses :keyword:`lambda`), or rewriting the code so it doesn't need a list at " +"all. Particularly tricky is :func:`map` invoked for the side effects of the " "function; the correct transformation is to use a regular :keyword:`for` loop " "(since creating a list would just be wasteful)." msgstr "" @@ -177,21 +179,21 @@ msgstr "" #: ../../whatsnew/3.0.rst:167 msgid "" "If the input sequences are not of equal length, :func:`map` will stop at the " -"termination of the shortest of the sequences. For full compatibility with :" -"func:`map` from Python 2.x, also wrap the sequences in :func:`itertools." -"zip_longest`, e.g. ``map(func, *sequences)`` becomes ``list(map(func, " -"itertools.zip_longest(*sequences)))``." +"termination of the shortest of the sequences. For full compatibility " +"with :func:`map` from Python 2.x, also wrap the sequences " +"in :func:`itertools.zip_longest`, e.g. ``map(func, *sequences)`` becomes " +"``list(map(func, itertools.zip_longest(*sequences)))``." msgstr "" #: ../../whatsnew/3.0.rst:173 msgid "" -":func:`range` now behaves like :func:`xrange` used to behave, except it " +":func:`range` now behaves like :func:`!xrange` used to behave, except it " "works with values of arbitrary size. The latter no longer exists." msgstr "" #: ../../whatsnew/3.0.rst:177 msgid ":func:`zip` now returns an iterator." -msgstr "" +msgstr ":func:`zip` 現在會回傳一個疊代器。" #: ../../whatsnew/3.0.rst:180 msgid "Ordering Comparisons" @@ -215,18 +217,19 @@ msgstr "" #: ../../whatsnew/3.0.rst:195 msgid "" -":meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* " -"argument providing a comparison function. Use the *key* argument instead. N." -"B. the *key* and *reverse* arguments are now \"keyword-only\"." +":meth:`sorted` and :meth:`list.sort` no longer accept the *cmp* argument " +"providing a comparison function. Use the *key* argument instead. N.B. the " +"*key* and *reverse* arguments are now \"keyword-only\"." msgstr "" #: ../../whatsnew/3.0.rst:200 msgid "" -"The :func:`cmp` function should be treated as gone, and the :meth:`__cmp__` " -"special method is no longer supported. Use :meth:`__lt__` for sorting, :" -"meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as needed. " -"(If you really need the :func:`cmp` functionality, you could use the " -"expression ``(a > b) - (a < b)`` as the equivalent for ``cmp(a, b)``.)" +"The :func:`!cmp` function should be treated as gone, and the :meth:`!" +"__cmp__` special method is no longer supported. Use :meth:`~object.__lt__` " +"for sorting, :meth:`~object.__eq__` with :meth:`~object.__hash__`, and other " +"rich comparisons as needed. (If you really need the :func:`!cmp` " +"functionality, you could use the expression ``(a > b) - (a < b)`` as the " +"equivalent for ``cmp(a, b)``.)" msgstr "" #: ../../whatsnew/3.0.rst:207 @@ -235,9 +238,9 @@ msgstr "整數" #: ../../whatsnew/3.0.rst:209 msgid "" -":pep:`237`: Essentially, :class:`long` renamed to :class:`int`. That is, " +":pep:`237`: Essentially, :class:`!long` renamed to :class:`int`. That is, " "there is only one built-in integral type, named :class:`int`; but it behaves " -"mostly like the old :class:`long` type." +"mostly like the old :class:`!long` type." msgstr "" #: ../../whatsnew/3.0.rst:213 @@ -249,12 +252,12 @@ msgstr "" #: ../../whatsnew/3.0.rst:217 msgid "" -"The :data:`sys.maxint` constant was removed, since there is no longer a " +"The :data:`!sys.maxint` constant was removed, since there is no longer a " "limit to the value of integers. However, :data:`sys.maxsize` can be used as " "an integer larger than any practical list or string index. It conforms to " -"the implementation's \"natural\" integer size and is typically the same as :" -"data:`sys.maxint` in previous releases on the same platform (assuming the " -"same build options)." +"the implementation's \"natural\" integer size and is typically the same " +"as :data:`!sys.maxint` in previous releases on the same platform (assuming " +"the same build options)." msgstr "" #: ../../whatsnew/3.0.rst:224 @@ -282,14 +285,14 @@ msgstr "" msgid "" "Python 3.0 uses the concepts of *text* and (binary) *data* instead of " "Unicode strings and 8-bit strings. All text is Unicode; however *encoded* " -"Unicode is represented as binary data. The type used to hold text is :class:" -"`str`, the type used to hold data is :class:`bytes`. The biggest difference " -"with the 2.x situation is that any attempt to mix text and data in Python " -"3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode and 8-bit " -"strings in Python 2.x, it would work if the 8-bit string happened to contain " -"only 7-bit (ASCII) bytes, but you would get :exc:`UnicodeDecodeError` if it " -"contained non-ASCII values. This value-specific behavior has caused " -"numerous sad faces over the years." +"Unicode is represented as binary data. The type used to hold text " +"is :class:`str`, the type used to hold data is :class:`bytes`. The biggest " +"difference with the 2.x situation is that any attempt to mix text and data " +"in Python 3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode " +"and 8-bit strings in Python 2.x, it would work if the 8-bit string happened " +"to contain only 7-bit (ASCII) bytes, but you would " +"get :exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-" +"specific behavior has caused numerous sad faces over the years." msgstr "" #: ../../whatsnew/3.0.rst:250 @@ -298,9 +301,9 @@ msgid "" "uses Unicode, encodings or binary data most likely has to change. The " "change is for the better, as in the 2.x world there were numerous bugs " "having to do with mixing encoded and unencoded text. To be prepared in " -"Python 2.x, start using :class:`unicode` for all unencoded text, and :class:" -"`str` for binary or encoded data only. Then the ``2to3`` tool will do most " -"of the work for you." +"Python 2.x, start using :class:`!unicode` for all unencoded text, " +"and :class:`str` for binary or encoded data only. Then the ``2to3`` tool " +"will do most of the work for you." msgstr "" #: ../../whatsnew/3.0.rst:258 @@ -312,10 +315,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:261 msgid "" "As the :class:`str` and :class:`bytes` types cannot be mixed, you must " -"always explicitly convert between them. Use :meth:`str.encode` to go from :" -"class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go from :class:" -"`bytes` to :class:`str`. You can also use ``bytes(s, encoding=...)`` and " -"``str(b, encoding=...)``, respectively." +"always explicitly convert between them. Use :meth:`str.encode` to go " +"from :class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go " +"from :class:`bytes` to :class:`str`. You can also use ``bytes(s, " +"encoding=...)`` and ``str(b, encoding=...)``, respectively." msgstr "" #: ../../whatsnew/3.0.rst:268 @@ -323,7 +326,8 @@ msgid "" "Like :class:`str`, the :class:`bytes` type is immutable. There is a " "separate *mutable* type to hold buffered binary data, :class:`bytearray`. " "Nearly all APIs that accept :class:`bytes` also accept :class:`bytearray`. " -"The mutable API is based on :class:`collections.MutableSequence`." +"The mutable API is based on :class:`collections.MutableSequence " +"<collections.abc.MutableSequence>`." msgstr "" #: ../../whatsnew/3.0.rst:274 @@ -338,11 +342,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:281 msgid "" -"The built-in :class:`basestring` abstract type was removed. Use :class:" -"`str` instead. The :class:`str` and :class:`bytes` types don't have " -"functionality enough in common to warrant a shared base class. The ``2to3`` " -"tool (see below) replaces every occurrence of :class:`basestring` with :" -"class:`str`." +"The built-in :class:`!basestring` abstract type was removed. " +"Use :class:`str` instead. The :class:`str` and :class:`bytes` types don't " +"have functionality enough in common to warrant a shared base class. The " +"``2to3`` tool (see below) replaces every occurrence of :class:`!basestring` " +"with :class:`str`." msgstr "" #: ../../whatsnew/3.0.rst:287 @@ -365,10 +369,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:304 msgid "" -"The initial values of :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." -"stderr` are now unicode-only text files (i.e., they are instances of :class:" -"`io.TextIOBase`). To read and write bytes data with these streams, you need " -"to use their :data:`io.TextIOBase.buffer` attribute." +"The initial values of :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr` are now unicode-only text files (i.e., they are " +"instances of :class:`io.TextIOBase`). To read and write bytes data with " +"these streams, you need to use their :data:`io.TextIOBase.buffer` attribute." msgstr "" #: ../../whatsnew/3.0.rst:310 @@ -377,14 +381,14 @@ msgid "" "can present platform-specific problems because on some platforms filenames " "are arbitrary byte strings. (On the other hand, on Windows filenames are " "natively stored as Unicode.) As a work-around, most APIs (e.g. :func:`open` " -"and many functions in the :mod:`os` module) that take filenames accept :" -"class:`bytes` objects as well as strings, and a few APIs have a way to ask " -"for a :class:`bytes` return value. Thus, :func:`os.listdir` returns a list " -"of :class:`bytes` instances if the argument is a :class:`bytes` instance, " -"and :func:`os.getcwdb` returns the current working directory as a :class:" -"`bytes` instance. Note that when :func:`os.listdir` returns a list of " -"strings, filenames that cannot be decoded properly are omitted rather than " -"raising :exc:`UnicodeError`." +"and many functions in the :mod:`os` module) that take filenames " +"accept :class:`bytes` objects as well as strings, and a few APIs have a way " +"to ask for a :class:`bytes` return value. Thus, :func:`os.listdir` returns " +"a list of :class:`bytes` instances if the argument is a :class:`bytes` " +"instance, and :func:`os.getcwdb` returns the current working directory as " +"a :class:`bytes` instance. Note that when :func:`os.listdir` returns a list " +"of strings, filenames that cannot be decoded properly are omitted rather " +"than raising :exc:`UnicodeError`." msgstr "" #: ../../whatsnew/3.0.rst:325 @@ -416,8 +420,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:340 msgid "" "The :mod:`!StringIO` and :mod:`!cStringIO` modules are gone. Instead, " -"import the :mod:`io` module and use :class:`io.StringIO` or :class:`io." -"BytesIO` for text and data respectively." +"import the :mod:`io` module and use :class:`io.StringIO` " +"or :class:`io.BytesIO` for text and data respectively." msgstr "" #: ../../whatsnew/3.0.rst:344 @@ -436,16 +440,16 @@ msgstr "" #: ../../whatsnew/3.0.rst:354 msgid "New Syntax" -msgstr "" +msgstr "新增語法" #: ../../whatsnew/3.0.rst:356 msgid "" ":pep:`3107`: Function argument and return value annotations. This provides " "a standardized way of annotating a function's parameters and return value. " "There are no semantics attached to such annotations except that they can be " -"introspected at runtime using the :attr:`~object.__annotations__` " -"attribute. The intent is to encourage experimentation through metaclasses, " -"decorators or frameworks." +"introspected at runtime using the :attr:`!__annotations__` attribute. The " +"intent is to encourage experimentation through metaclasses, decorators or " +"frameworks." msgstr "" #: ../../whatsnew/3.0.rst:363 @@ -468,8 +472,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:374 msgid "" ":pep:`3104`: :keyword:`nonlocal` statement. Using ``nonlocal x`` you can " -"now assign directly to a variable in an outer (but non-global) scope. :" -"keyword:`!nonlocal` is a new reserved word." +"now assign directly to a variable in an outer (but non-global) " +"scope. :keyword:`!nonlocal` is a new reserved word." msgstr "" #: ../../whatsnew/3.0.rst:378 @@ -482,11 +486,12 @@ msgstr "" #: ../../whatsnew/3.0.rst:383 msgid "(a, *rest, b) = range(5)" -msgstr "" +msgstr "(a, *rest, b) = range(5)" #: ../../whatsnew/3.0.rst:385 msgid "This sets *a* to ``0``, *b* to ``4``, and *rest* to ``[1, 2, 3]``." msgstr "" +"這會將 *a* 設為 ``0``、將 *b* 設為 ``4``,並將 *rest* 設為 ``[1, 2, 3]``。" #: ../../whatsnew/3.0.rst:387 msgid "" @@ -526,8 +531,8 @@ msgstr "語法變更" #: ../../whatsnew/3.0.rst:408 msgid "" -":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement syntax: :samp:" -"`raise [{expr} [from {expr}]]`. See below." +":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement " +"syntax: :samp:`raise [{expr} [from {expr}]]`. See below." msgstr "" #: ../../whatsnew/3.0.rst:411 @@ -544,8 +549,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:417 msgid "" -"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` *exc* :" -"keyword:`!as` *var*. See :pep:`3110`." +"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` " +"*exc* :keyword:`!as` *var*. See :pep:`3110`." msgstr "" #: ../../whatsnew/3.0.rst:420 @@ -558,20 +563,25 @@ msgid "" " __metaclass__ = M\n" " ..." msgstr "" +"class C:\n" +" __metaclass__ = M\n" +" ..." #: ../../whatsnew/3.0.rst:426 msgid "you must now use::" -msgstr "" +msgstr "現在必須使用: ::" #: ../../whatsnew/3.0.rst:428 msgid "" "class C(metaclass=M):\n" " ..." msgstr "" +"class C(metaclass=M):\n" +" ..." #: ../../whatsnew/3.0.rst:431 msgid "" -"The module-global :data:`__metaclass__` variable is no longer supported. " +"The module-global :data:`!__metaclass__` variable is no longer supported. " "(It was a crutch to make it easier to default to new-style classes without " "deriving every class from :class:`object`.)" msgstr "" @@ -606,11 +616,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:456 msgid "Removed backticks (use :func:`repr` instead)." -msgstr "" +msgstr "移除反引號(請改用 :func:`repr`)。" #: ../../whatsnew/3.0.rst:458 msgid "Removed ``<>`` (use ``!=`` instead)." -msgstr "移除 ``<>``\\ (請改用 ``!=``\\ )。" +msgstr "移除 ``<>``\\ (請改用 ``!=``)。" #: ../../whatsnew/3.0.rst:460 msgid "" @@ -683,9 +693,10 @@ msgstr ":ref:`pep-0371`。" msgid "" ":ref:`pep-3101`. Note: the 2.6 description mentions the :meth:`format` " "method for both 8-bit and Unicode strings. In 3.0, only the :class:`str` " -"type (text strings with Unicode support) supports this method; the :class:" -"`bytes` type does not. The plan is to eventually make this the only API for " -"string formatting, and to start deprecating the ``%`` operator in Python 3.1." +"type (text strings with Unicode support) supports this method; " +"the :class:`bytes` type does not. The plan is to eventually make this the " +"only API for string formatting, and to start deprecating the ``%`` operator " +"in Python 3.1." msgstr "" #: ../../whatsnew/3.0.rst:507 @@ -713,26 +724,27 @@ msgid "" ":ref:`pep-3116`. The :mod:`io` module is now the standard way of doing file " "I/O. The built-in :func:`open` function is now an alias for :func:`io.open` " "and has additional keyword arguments *encoding*, *errors*, *newline* and " -"*closefd*. Also note that an invalid *mode* argument now raises :exc:" -"`ValueError`, not :exc:`IOError`. The binary file object underlying a text " -"file object can be accessed as :attr:`f.buffer` (but beware that the text " -"object maintains a buffer of itself in order to speed up the encoding and " -"decoding operations)." +"*closefd*. Also note that an invalid *mode* argument now " +"raises :exc:`ValueError`, not :exc:`IOError`. The binary file object " +"underlying a text file object can be accessed as :attr:`!f.buffer` (but " +"beware that the text object maintains a buffer of itself in order to speed " +"up the encoding and decoding operations)." msgstr "" #: ../../whatsnew/3.0.rst:529 msgid "" -":ref:`pep-3118`. The old builtin :func:`buffer` is now really gone; the new " -"builtin :func:`memoryview` provides (mostly) similar functionality." +":ref:`pep-3118`. The old builtin :func:`!buffer` is now really gone; the " +"new builtin :func:`memoryview` provides (mostly) similar functionality." msgstr "" #: ../../whatsnew/3.0.rst:533 msgid "" -":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the :mod:" -"`collections` module plays a somewhat more prominent role in the language " -"now, and built-in collection types like :class:`dict` and :class:`list` " -"conform to the :class:`collections.MutableMapping` and :class:`collections." -"MutableSequence` ABCs, respectively." +":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in " +"the :mod:`collections` module plays a somewhat more prominent role in the " +"language now, and built-in collection types like :class:`dict` " +"and :class:`list` conform to the :class:`collections.MutableMapping " +"<collections.abc.MutableMapping>` and :class:`collections.MutableSequence " +"<collections.abc.MutableSequence>` ABCs, respectively." msgstr "" #: ../../whatsnew/3.0.rst:539 @@ -778,8 +790,8 @@ msgid "" "The :mod:`!bsddb3` package was removed because its presence in the core " "standard library has proved over time to be a particular burden for the core " "developers due to testing instability and Berkeley DB's release schedule. " -"However, the package is alive and well, externally maintained at https://www." -"jcea.es/programacion/pybsddb.htm." +"However, the package is alive and well, externally maintained at https://" +"www.jcea.es/programacion/pybsddb.htm." msgstr "" #: ../../whatsnew/3.0.rst:572 @@ -884,8 +896,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:606 msgid "" -":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!dumbdbm`, :" -"mod:`!gdbm`, :mod:`!whichdb`)." +":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!" +"dumbdbm`, :mod:`!gdbm`, :mod:`!whichdb`)." msgstr "" ":mod:`dbm`\\ (:mod:`!anydbm`、:mod:`!dbhash`、:mod:`!dbm`、:mod:`!" "dumbdbm`、:mod:`!gdbm`、:mod:`!whichdb`\\ )。" @@ -905,10 +917,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:615 msgid "" -":mod:`tkinter` (all :mod:`Tkinter`-related modules except :mod:`turtle`). " -"The target audience of :mod:`turtle` doesn't really care about :mod:" -"`tkinter`. Also note that as of Python 2.6, the functionality of :mod:" -"`turtle` has been greatly enhanced." +":mod:`tkinter` (all ``Tkinter``-related modules except :mod:`turtle`). The " +"target audience of :mod:`turtle` doesn't really care about :mod:`tkinter`. " +"Also note that as of Python 2.6, the functionality of :mod:`turtle` has been " +"greatly enhanced." msgstr "" #: ../../whatsnew/3.0.rst:620 @@ -938,35 +950,39 @@ msgstr "移除 :mod:`!sets`。請使用內建的 :func:`set` 類別。" #: ../../whatsnew/3.0.rst:631 msgid "" -"Cleanup of the :mod:`sys` module: removed :func:`sys.exitfunc`, :func:`sys." -"exc_clear`, :data:`sys.exc_type`, :data:`sys.exc_value`, :data:`sys." -"exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" +"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!" +"sys.exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!" +"sys.exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" msgstr "" #: ../../whatsnew/3.0.rst:636 msgid "" -"Cleanup of the :class:`array.array` type: the :meth:`read` and :meth:`write` " -"methods are gone; use :meth:`fromfile` and :meth:`tofile` instead. Also, " -"the ``'c'`` typecode for array is gone -- use either ``'b'`` for bytes or " -"``'u'`` for Unicode characters." +"Cleanup of the :class:`array.array` type: the :meth:`!read` and :meth:`!" +"write` methods are gone; use :meth:`~array.array.fromfile` " +"and :meth:`~array.array.tofile` instead. Also, the ``'c'`` typecode for " +"array is gone -- use either ``'b'`` for bytes or ``'u'`` for Unicode " +"characters." msgstr "" #: ../../whatsnew/3.0.rst:642 msgid "" -"Cleanup of the :mod:`operator` module: removed :func:`sequenceIncludes` and :" -"func:`isCallable`." +"Cleanup of the :mod:`operator` module: removed :func:`!sequenceIncludes` " +"and :func:`!isCallable`." msgstr "" +"清理 :mod:`operator` 模組:移除 :func:`!sequenceIncludes` 和 :func:`!" +"isCallable`。" #: ../../whatsnew/3.0.rst:645 msgid "" "Cleanup of the :mod:`!thread` module: :func:`!acquire_lock` and :func:`!" -"release_lock` are gone; use :meth:`~threading.Lock.acquire` and :meth:" -"`~threading.Lock.release` instead." +"release_lock` are gone; use :meth:`~threading.Lock.acquire` " +"and :meth:`~threading.Lock.release` instead." msgstr "" #: ../../whatsnew/3.0.rst:649 -msgid "Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API." -msgstr "清理 :mod:`random` 模組:移除 :func:`jumpahead` API。" +msgid "" +"Cleanup of the :mod:`random` module: removed the :func:`!jumpahead` API." +msgstr "清理 :mod:`random` 模組:移除 :func:`!jumpahead` API。" #: ../../whatsnew/3.0.rst:651 msgid "The :mod:`!new` module is gone." @@ -974,8 +990,8 @@ msgstr "移除 :mod:`!new` 模組。" #: ../../whatsnew/3.0.rst:653 msgid "" -"The functions :func:`os.tmpnam`, :func:`os.tempnam` and :func:`os.tmpfile` " -"have been removed in favor of the :mod:`tempfile` module." +"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!" +"os.tmpfile` have been removed in favor of the :mod:`tempfile` module." msgstr "" #: ../../whatsnew/3.0.rst:657 @@ -986,19 +1002,19 @@ msgstr "" #: ../../whatsnew/3.0.rst:661 msgid "" -":data:`string.letters` and its friends (:data:`string.lowercase` and :data:" -"`string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " -"instead. (The reason for the removal is that :data:`string.letters` and " -"friends had locale-specific behavior, which is a bad idea for such " +":data:`!string.letters` and its friends (:data:`!string.lowercase` " +"and :data:`!string.uppercase`) are gone. Use :data:`string.ascii_letters` " +"etc. instead. (The reason for the removal is that :data:`!string.letters` " +"and friends had locale-specific behavior, which is a bad idea for such " "attractively named global \"constants\".)" msgstr "" #: ../../whatsnew/3.0.rst:668 msgid "" -"Renamed module :mod:`__builtin__` to :mod:`builtins` (removing the " -"underscores, adding an 's'). The :data:`__builtins__` variable found in " -"most global namespaces is unchanged. To modify a builtin, you should use :" -"mod:`builtins`, not :data:`__builtins__`!" +"Renamed module :mod:`!__builtin__` to :mod:`builtins` (removing the " +"underscores, adding an 's'). The :data:`!__builtins__` variable found in " +"most global namespaces is unchanged. To modify a builtin, you should " +"use :mod:`builtins`, not :data:`!__builtins__`!" msgstr "" #: ../../whatsnew/3.0.rst:675 @@ -1025,31 +1041,32 @@ msgstr "" #: ../../whatsnew/3.0.rst:690 msgid "" -":pep:`352`: All exceptions must be derived (directly or indirectly) from :" -"exc:`BaseException`. This is the root of the exception hierarchy. This is " -"not new as a recommendation, but the *requirement* to inherit from :exc:" -"`BaseException` is new. (Python 2.6 still allowed classic classes to be " -"raised, and placed no restriction on what you can catch.) As a consequence, " -"string exceptions are finally truly and utterly dead." +":pep:`352`: All exceptions must be derived (directly or indirectly) " +"from :exc:`BaseException`. This is the root of the exception hierarchy. " +"This is not new as a recommendation, but the *requirement* to inherit " +"from :exc:`BaseException` is new. (Python 2.6 still allowed classic classes " +"to be raised, and placed no restriction on what you can catch.) As a " +"consequence, string exceptions are finally truly and utterly dead." msgstr "" #: ../../whatsnew/3.0.rst:698 msgid "" -"Almost all exceptions should actually derive from :exc:`Exception`; :exc:" -"`BaseException` should only be used as a base class for exceptions that " -"should only be handled at the top level, such as :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`. The recommended idiom for handling all exceptions " -"except for this latter category is to use :keyword:`except` :exc:`Exception`." +"Almost all exceptions should actually derive " +"from :exc:`Exception`; :exc:`BaseException` should only be used as a base " +"class for exceptions that should only be handled at the top level, such " +"as :exc:`SystemExit` or :exc:`KeyboardInterrupt`. The recommended idiom for " +"handling all exceptions except for this latter category is to " +"use :keyword:`except` :exc:`Exception`." msgstr "" #: ../../whatsnew/3.0.rst:705 -msgid ":exc:`StandardError` was removed." -msgstr ":exc:`StandardError` 被移除。" +msgid ":exc:`!StandardError` was removed." +msgstr ":exc:`!StandardError` 已被移除。" #: ../../whatsnew/3.0.rst:707 msgid "" -"Exceptions no longer behave as sequences. Use the :attr:`args` attribute " -"instead." +"Exceptions no longer behave as sequences. Use " +"the :attr:`~BaseException.args` attribute instead." msgstr "" #: ../../whatsnew/3.0.rst:710 @@ -1065,8 +1082,8 @@ msgstr "" msgid "" ":pep:`3110`: Catching exceptions. You must now use :samp:`except " "{SomeException} as {variable}` instead of :samp:`except {SomeException}, " -"{variable}`. Moreover, the *variable* is explicitly deleted when the :" -"keyword:`except` block is left." +"{variable}`. Moreover, the *variable* is explicitly deleted when " +"the :keyword:`except` block is left." msgstr "" #: ../../whatsnew/3.0.rst:722 @@ -1090,19 +1107,19 @@ msgid "" "object, probably an exception that was previously caught). In this case, the " "primary exception is stored on the :attr:`~BaseException.__cause__` " "attribute of the secondary exception. The traceback printed when an " -"unhandled exception occurs walks the chain of :attr:`!__cause__` and :attr:" -"`~BaseException.__context__` attributes and prints a separate traceback for " -"each component of the chain, with the primary exception at the top. (Java " -"users may recognize this behavior.)" +"unhandled exception occurs walks the chain of :attr:`!__cause__` " +"and :attr:`~BaseException.__context__` attributes and prints a separate " +"traceback for each component of the chain, with the primary exception at the " +"top. (Java users may recognize this behavior.)" msgstr "" #: ../../whatsnew/3.0.rst:743 msgid "" -":pep:`3134`: Exception objects now store their traceback as the :attr:" -"`~BaseException.__traceback__` attribute. This means that an exception " -"object now contains all the information pertaining to an exception, and " -"there are fewer reasons to use :func:`sys.exc_info` (though the latter is " -"not removed)." +":pep:`3134`: Exception objects now store their traceback as " +"the :attr:`~BaseException.__traceback__` attribute. This means that an " +"exception object now contains all the information pertaining to an " +"exception, and there are fewer reasons to use :func:`sys.exc_info` (though " +"the latter is not removed)." msgstr "" #: ../../whatsnew/3.0.rst:749 @@ -1122,8 +1139,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:761 msgid "" -"``!=`` now returns the opposite of ``==``, unless ``==`` returns :data:" -"`NotImplemented`." +"``!=`` now returns the opposite of ``==``, unless ``==`` " +"returns :data:`NotImplemented`." msgstr "" #: ../../whatsnew/3.0.rst:764 @@ -1135,39 +1152,39 @@ msgstr "" #: ../../whatsnew/3.0.rst:768 msgid "" -":meth:`__getslice__`, :meth:`__setslice__` and :meth:`__delslice__` were " +":meth:`!__getslice__`, :meth:`!__setslice__` and :meth:`!__delslice__` were " "killed. The syntax ``a[i:j]`` now translates to ``a.__getitem__(slice(i, " -"j))`` (or :meth:`__setitem__` or :meth:`__delitem__`, when used as an " -"assignment or deletion target, respectively)." +"j))`` (or :meth:`~object.__setitem__` or :meth:`~object.__delitem__`, when " +"used as an assignment or deletion target, respectively)." msgstr "" #: ../../whatsnew/3.0.rst:774 msgid "" -":pep:`3114`: the standard :meth:`next` method has been renamed to :meth:" -"`~iterator.__next__`." +":pep:`3114`: the standard :meth:`next` method has been renamed " +"to :meth:`~iterator.__next__`." msgstr "" #: ../../whatsnew/3.0.rst:777 msgid "" -"The :meth:`__oct__` and :meth:`__hex__` special methods are removed -- :func:" -"`oct` and :func:`hex` use :meth:`__index__` now to convert the argument to " -"an integer." +"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed " +"-- :func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert " +"the argument to an integer." msgstr "" #: ../../whatsnew/3.0.rst:781 -msgid "Removed support for :attr:`__members__` and :attr:`__methods__`." -msgstr "移除對 :attr:`__members__` 和 :attr:`__methods__` 的支援。" +msgid "Removed support for :attr:`!__members__` and :attr:`!__methods__`." +msgstr "移除對 :attr:`!__members__` 和 :attr:`!__methods__` 的支援。" #: ../../whatsnew/3.0.rst:783 msgid "" -"The function attributes named :attr:`!func_X` have been renamed to use the :" -"attr:`!__X__` form, freeing up these names in the function attribute " -"namespace for user-defined attributes. To wit, :attr:`!func_closure`, :attr:" -"`!func_code`, :attr:`!func_defaults`, :attr:`!func_dict`, :attr:`!" -"func_doc`, :attr:`!func_globals`, :attr:`!func_name` were renamed to :attr:" -"`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function." -"__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:" -"`~function.__globals__`, :attr:`~function.__name__`, respectively." +"The function attributes named :attr:`!func_X` have been renamed to use " +"the :attr:`!__X__` form, freeing up these names in the function attribute " +"namespace for user-defined attributes. To wit, :attr:`!" +"func_closure`, :attr:`!func_code`, :attr:`!func_defaults`, :attr:`!" +"func_dict`, :attr:`!func_doc`, :attr:`!func_globals`, :attr:`!func_name` " +"were renamed " +"to :attr:`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function.__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:`~function.__globals__`, :attr:`~function.__name__`, " +"respectively." msgstr "" #: ../../whatsnew/3.0.rst:794 @@ -1189,7 +1206,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:805 msgid "" -":pep:`3111`: :func:`raw_input` was renamed to :func:`input`. That is, the " +":pep:`3111`: :func:`!raw_input` was renamed to :func:`input`. That is, the " "new :func:`input` function reads a line from :data:`sys.stdin` and returns " "it with the trailing newline stripped. It raises :exc:`EOFError` if the " "input is terminated prematurely. To get the old behavior of :func:`input`, " @@ -1198,8 +1215,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:811 msgid "" -"A new built-in function :func:`next` was added to call the :meth:`~iterator." -"__next__` method on an object." +"A new built-in function :func:`next` was added to call " +"the :meth:`~iterator.__next__` method on an object." msgstr "" #: ../../whatsnew/3.0.rst:814 @@ -1214,60 +1231,60 @@ msgid "" msgstr "" #: ../../whatsnew/3.0.rst:823 -msgid "Moved :func:`intern` to :func:`sys.intern`." +msgid "Moved :func:`!intern` to :func:`sys.intern`." msgstr "" #: ../../whatsnew/3.0.rst:825 msgid "" -"Removed: :func:`apply`. Instead of ``apply(f, args)`` use ``f(*args)``." -msgstr "" +"Removed: :func:`!apply`. Instead of ``apply(f, args)`` use ``f(*args)``." +msgstr "移除 :func:`!apply`。請使用 ``f(*args)`` 來替換 ``apply(f, args)``。" #: ../../whatsnew/3.0.rst:828 msgid "" "Removed :func:`callable`. Instead of ``callable(f)`` you can use " -"``isinstance(f, collections.Callable)``. The :func:`operator.isCallable` " +"``isinstance(f, collections.Callable)``. The :func:`!operator.isCallable` " "function is also gone." msgstr "" #: ../../whatsnew/3.0.rst:832 msgid "" -"Removed :func:`coerce`. This function no longer serves a purpose now that " +"Removed :func:`!coerce`. This function no longer serves a purpose now that " "classic classes are gone." msgstr "" #: ../../whatsnew/3.0.rst:835 msgid "" -"Removed :func:`execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." -"read())``." +"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use " +"``exec(open(fn).read())``." msgstr "" -"移除 :func:`execfile`。請使用 ``exec(open(fn).read())`` 來替換 " +"移除 :func:`!execfile`。請使用 ``exec(open(fn).read())`` 來替換 " "``execfile(fn)``。" #: ../../whatsnew/3.0.rst:838 msgid "" -"Removed the :class:`file` type. Use :func:`open`. There are now several " +"Removed the :class:`!file` type. Use :func:`open`. There are now several " "different kinds of streams that open can return in the :mod:`io` module." msgstr "" #: ../../whatsnew/3.0.rst:841 msgid "" -"Removed :func:`reduce`. Use :func:`functools.reduce` if you really need it; " -"however, 99 percent of the time an explicit :keyword:`for` loop is more " +"Removed :func:`!reduce`. Use :func:`functools.reduce` if you really need " +"it; however, 99 percent of the time an explicit :keyword:`for` loop is more " "readable." msgstr "" #: ../../whatsnew/3.0.rst:845 -msgid "Removed :func:`reload`. Use :func:`!imp.reload`." -msgstr "" +msgid "Removed :func:`!reload`. Use :func:`!imp.reload`." +msgstr "移除 :func:`!reload`。請使用 :func:`!imp.reload`。" #: ../../whatsnew/3.0.rst:847 msgid "" -"Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator instead." +"Removed. :meth:`!dict.has_key` -- use the :keyword:`in` operator instead." msgstr "" #: ../../whatsnew/3.0.rst:854 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.0.rst:856 msgid "" @@ -1305,9 +1322,9 @@ msgstr "" #: ../../whatsnew/3.0.rst:873 msgid "" -"New C API :c:func:`PyImport_ImportModuleNoBlock`, works like :c:func:" -"`PyImport_ImportModule` but won't block on the import lock (returning an " -"error instead)." +"New C API :c:func:`PyImport_ImportModuleNoBlock`, works " +"like :c:func:`PyImport_ImportModule` but won't block on the import lock " +"(returning an error instead)." msgstr "" #: ../../whatsnew/3.0.rst:877 @@ -1325,7 +1342,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:886 msgid "Performance" -msgstr "" +msgstr "效能" #: ../../whatsnew/3.0.rst:888 msgid "" @@ -1373,8 +1390,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:920 msgid "" "It is not recommended to try to write source code that runs unchanged under " -"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, e." -"g. avoiding ``print`` statements, metaclasses, and much more. If you are " +"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, " +"e.g. avoiding ``print`` statements, metaclasses, and much more. If you are " "maintaining a library that needs to support both Python 2.6 and Python 3.0, " "the best approach is to modify step 3 above by editing the 2.6 version of " "the source code and running the ``2to3`` translator again, rather than " diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index df59f43bf2..627d4d2ac6 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -46,8 +46,8 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, a new :class:`collections." -"OrderedDict` class has been introduced." +"the experiences from those implementations, a " +"new :class:`collections.OrderedDict` class has been introduced." msgstr "" #: ../../whatsnew/3.1.rst:62 @@ -139,8 +139,8 @@ msgstr "" #: ../../whatsnew/3.1.rst:123 msgid "" -"The supported types are :class:`int`, :class:`float`, :class:`complex` and :" -"class:`decimal.Decimal`." +"The supported types are :class:`int`, :class:`float`, :class:`complex` " +"and :class:`decimal.Decimal`." msgstr "" #: ../../whatsnew/3.1.rst:126 @@ -243,10 +243,10 @@ msgstr "(由 Eric Smith 貢獻;:issue:`5237`。)" msgid "" "The :func:`!string.maketrans` function is deprecated and is replaced by new " "static methods, :meth:`bytes.maketrans` and :meth:`bytearray.maketrans`. " -"This change solves the confusion around which types were supported by the :" -"mod:`string` module. Now, :class:`str`, :class:`bytes`, and :class:" -"`bytearray` each have their own **maketrans** and **translate** methods with " -"intermediate translation tables of the appropriate type." +"This change solves the confusion around which types were supported by " +"the :mod:`string` module. Now, :class:`str`, :class:`bytes`, " +"and :class:`bytearray` each have their own **maketrans** and **translate** " +"methods with intermediate translation tables of the appropriate type." msgstr "" #: ../../whatsnew/3.1.rst:184 @@ -438,13 +438,13 @@ msgstr "(由 Raymond Hettinger 和 Mark Dickinso 貢獻。)" #: ../../whatsnew/3.1.rst:285 msgid "" -"The :mod:`itertools` module grew two new functions. The :func:`itertools." -"combinations_with_replacement` function is one of four for generating " -"combinatorics including permutations and Cartesian products. The :func:" -"`itertools.compress` function mimics its namesake from APL. Also, the " -"existing :func:`itertools.count` function now has an optional *step* " -"argument and can accept any type of counting sequence including :class:" -"`fractions.Fraction` and :class:`decimal.Decimal`::" +"The :mod:`itertools` module grew two new functions. " +"The :func:`itertools.combinations_with_replacement` function is one of four " +"for generating combinatorics including permutations and Cartesian products. " +"The :func:`itertools.compress` function mimics its namesake from APL. Also, " +"the existing :func:`itertools.count` function now has an optional *step* " +"argument and can accept any type of counting sequence " +"including :class:`fractions.Fraction` and :class:`decimal.Decimal`::" msgstr "" #: ../../whatsnew/3.1.rst:294 @@ -522,10 +522,11 @@ msgstr "(由 Gregory Smith 貢獻。)" #: ../../whatsnew/3.1.rst:330 msgid "" -"The :mod:`logging` module now implements a simple :class:`logging." -"NullHandler` class for applications that are not using logging but are " -"calling library code that does. Setting-up a null handler will suppress " -"spurious warnings such as \"No handlers could be found for logger foo\"::" +"The :mod:`logging` module now implements a " +"simple :class:`logging.NullHandler` class for applications that are not " +"using logging but are calling library code that does. Setting-up a null " +"handler will suppress spurious warnings such as \"No handlers could be found " +"for logger foo\"::" msgstr "" #: ../../whatsnew/3.1.rst:335 @@ -553,8 +554,8 @@ msgstr "(由 Andi Vajda 貢獻;:issue:`4195`。)" #: ../../whatsnew/3.1.rst:346 msgid "" -"The :mod:`pdb` module can now access and display source code loaded via :mod:" -"`zipimport` (or any other conformant :pep:`302` loader)." +"The :mod:`pdb` module can now access and display source code loaded " +"via :mod:`zipimport` (or any other conformant :pep:`302` loader)." msgstr "" #: ../../whatsnew/3.1.rst:349 @@ -631,13 +632,11 @@ msgstr "" #: ../../whatsnew/3.1.rst:383 msgid "" -"In addition, several new assertion methods were added including :meth:" -"`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase." -"assertDictEqual`, :meth:`!assertDictContainsSubset`, :meth:`~unittest." -"TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :" -"meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " -"<unittest.TestCase.assertRaisesRegex>`, :meth:`~unittest.TestCase." -"assertIsNone`, and :meth:`~unittest.TestCase.assertIsNotNone`." +"In addition, several new assertion methods were added " +"including :meth:`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase.assertDictEqual`, :meth:`!" +"assertDictContainsSubset`, :meth:`~unittest.TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " +"<unittest.TestCase.assertRaisesRegex>`, :meth:`~unittest.TestCase.assertIsNone`, " +"and :meth:`~unittest.TestCase.assertIsNotNone`." msgstr "" #: ../../whatsnew/3.1.rst:394 @@ -771,8 +770,8 @@ msgstr "" #: ../../whatsnew/3.1.rst:469 msgid "" -"(Contributed by Antoine Pitrou along with a number of other participants, :" -"issue:`4753`)." +"(Contributed by Antoine Pitrou along with a number of other " +"participants, :issue:`4753`)." msgstr "(由 Antoine Pitrou 和其他一些參與者共同貢獻,:issue:`4753`)。" #: ../../whatsnew/3.1.rst:472 @@ -828,11 +827,11 @@ msgstr "(由 Roger D. Serwy 貢獻;:issue:`5150`。)" #: ../../whatsnew/3.1.rst:500 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.1.rst:502 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.1.rst:504 msgid "" @@ -882,7 +881,7 @@ msgstr "(由 Mark Dickinson 和 Lisandro Dalcrin 貢獻;:issue:`5175`。)" #: ../../whatsnew/3.1.rst:530 msgid "" "Deprecated :c:func:`!PyNumber_Int`. Use :c:func:`PyNumber_Long` instead." -msgstr "" +msgstr "已棄用 :c:func:`!PyNumber_Int`。請改用 :c:func:`PyNumber_Long`。" #: ../../whatsnew/3.1.rst:532 msgid "(Contributed by Mark Dickinson; :issue:`4910`.)" @@ -950,6 +949,25 @@ msgid "" " 2.718281828459045\n" "**********************************************************************" msgstr "" +"def e():\n" +" '''計算自然對數的底。\n" +"\n" +" >>> e()\n" +" 2.7182818284590451\n" +"\n" +" '''\n" +" return sum(1/math.factorial(x) for x in reversed(range(30)))\n" +"\n" +"doctest.testmod()\n" +"\n" +"**********************************************************************\n" +"Failed example:\n" +" e()\n" +"Expected:\n" +" 2.7182818284590451\n" +"Got:\n" +" 2.718281828459045\n" +"**********************************************************************" #: ../../whatsnew/3.1.rst:576 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index ee2fe63fc7..6413962e02 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -32,8 +32,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.10.rst:47 msgid "" "This article explains the new features in Python 3.10, compared to 3.9. " -"Python 3.10 was released on October 4, 2021. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.10 was released on October 4, 2021. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.10 與 3.9 相比多了哪些新功能。Python 3.10 已於 2021 年 " "10 月 4 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -216,15 +216,15 @@ msgstr "" #: ../../whatsnew/3.10.rst:142 msgid "" -"This new syntax uses the non LL(1) capacities of the new parser. Check :pep:" -"`617` for more details." +"This new syntax uses the non LL(1) capacities of the new parser. " +"Check :pep:`617` for more details." msgstr "" "此新語法使用新剖析器的非 LL(1) 功能。檢查 :pep:`617` 了解更多詳細資訊。" #: ../../whatsnew/3.10.rst:145 msgid "" -"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou in :" -"issue:`12782` and :issue:`40334`.)" +"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou " +"in :issue:`12782` and :issue:`40334`.)" msgstr "" "(由 Guido van Rossum、Pablo Galindo 和 Lysandros Nikolaou 在 :issue:`12782` " "和 :issue:`40334` 中貢獻。)" @@ -309,8 +309,8 @@ msgstr "這些改進是受到 PyPy 直譯器的啟發。" #: ../../whatsnew/3.10.rst:191 msgid "" -"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya in :" -"issue:`40176`.)" +"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya " +"in :issue:`40176`.)" msgstr "" "(由 Pablo Galindo 在 :issue:`42864` 和 Batuhan Taskaya 在 :issue:`40176` 中" "貢獻。)" @@ -718,12 +718,12 @@ msgstr "影格 (frame) 物件的 :attr:`~frame.f_lineno` 屬性總會包含預 msgid "" "The :attr:`~codeobject.co_lnotab` attribute of :ref:`code objects <code-" "objects>` is deprecated and will be removed in 3.12. Code that needs to " -"convert from offset to line number should use the new :meth:`~codeobject." -"co_lines` method instead." +"convert from offset to line number should use the " +"new :meth:`~codeobject.co_lines` method instead." msgstr "" ":ref:`程式碼物件 <code-objects>`\\ 的 :attr:`~codeobject.co_lnotab` 屬性已棄" -"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新的 :meth:" -"`~codeobject.co_lines` 方法。" +"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新" +"的 :meth:`~codeobject.co_lines` 方法。" #: ../../whatsnew/3.10.rst:412 msgid "PEP 634: Structural Pattern Matching" @@ -849,7 +849,7 @@ msgid "" "of the subject's type and shape." msgstr "" "雖然使用巢狀 \"if\" 陳述式的「命令式 (imperative)」指令系列可用於完成類似於結" -"構模式匹配的操作,但它不如「聲明式 (declarative)」方法清晰。相反地,「聲明" +"構模式匹配的操作,但它不如「宣告式 (declarative)」方法清晰。相反地,「聲明" "式」方法規定了匹配所需滿足的條件,並且因其明確表達模式而更具可讀性。雖然結構" "模式匹配可以用其最簡單的形式達成,將變數與 case 陳述式中的字面值進行比較,但" "它對 Python 的真正價值在於它對主語的型態和特徵的處理。" @@ -1220,8 +1220,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:684 msgid "" -"For the full specification see :pep:`634`. Motivation and rationale are in :" -"pep:`635`, and a longer tutorial is in :pep:`636`." +"For the full specification see :pep:`634`. Motivation and rationale are " +"in :pep:`635`, and a longer tutorial is in :pep:`636`." msgstr "" "有關完整規範,請參閱 :pep:`634`。動機和基本原理位於 :pep:`635` 中,較完整的教" "學位於 :pep:`636` 中。" @@ -1254,9 +1254,9 @@ msgid "" "emitted when :data:`sys.flags.warn_default_encoding <sys.flags>` is true and " "locale-specific default encoding is used." msgstr "" -"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。當 :data:`sys.flags." -"warn_default_encoding <sys.flags>` 為 true 且使用特定於語言環境的預設編碼時," -"會發出該信號。" +"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。" +"當 :data:`sys.flags.warn_default_encoding <sys.flags>` 為 true 且使用特定於語" +"言環境的預設編碼時,會發出該信號。" #: ../../whatsnew/3.10.rst:706 msgid "" @@ -1276,8 +1276,8 @@ msgstr "與型別提示相關的新功能" #: ../../whatsnew/3.10.rst:716 msgid "" -"This section covers major changes affecting :pep:`484` type hints and the :" -"mod:`typing` module." +"This section covers major changes affecting :pep:`484` type hints and " +"the :mod:`typing` module." msgstr "本節介紹影響 :pep:`484` 型別提示和 :mod:`typing` 模組的主要更改。" #: ../../whatsnew/3.10.rst:721 @@ -1291,16 +1291,16 @@ msgid "" "of using :data:`typing.Union`, especially in type hints." msgstr "" "引入了一種新的聯集運算子,該運算子啟用像是 ``X | Y`` 的語法。這提供了一種在型" -"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使用 :data:`typing." -"Union`。" +"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使" +"用 :data:`typing.Union`。" #: ../../whatsnew/3.10.rst:727 msgid "" "In previous versions of Python, to apply a type hint for functions accepting " "arguments of multiple types, :data:`typing.Union` was used::" msgstr "" -"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使用 :data:" -"`typing.Union`: ::" +"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使" +"用 :data:`typing.Union`: ::" #: ../../whatsnew/3.10.rst:730 msgid "" @@ -1324,8 +1324,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:740 msgid "" -"This new syntax is also accepted as the second argument to :func:" -"`isinstance` and :func:`issubclass`::" +"This new syntax is also accepted as the second argument " +"to :func:`isinstance` and :func:`issubclass`::" msgstr "" "這種新語法也接受作為 :func:`isinstance` 和 :func:`issubclass` 的第二個引" "數: ::" @@ -1388,12 +1388,11 @@ msgstr "" #: ../../whatsnew/3.10.rst:769 msgid "" -"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing." -"Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing." -"ParamSpecKwargs`, and :pep:`612` for more details." +"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing.Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, " +"and :pep:`612` for more details." msgstr "" -"請參閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing." -"Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " +"請參" +"閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing.Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " "和 :pep:`612` 以了解更多詳情。" #: ../../whatsnew/3.10.rst:773 @@ -1457,8 +1456,8 @@ msgstr "PEP 647:使用者定義的型別防護" msgid "" ":data:`~typing.TypeGuard` has been added to the :mod:`typing` module to " "annotate type guard functions and improve information provided to static " -"type checkers during type narrowing. For more information, please see :data:" -"`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." +"type checkers during type narrowing. For more information, please " +"see :data:`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." msgstr "" ":data:`~typing.TypeGuard`\\ (型別防護)已新增到 :mod:`typing` 模組中,用以註" "釋型別防護函式並改進在型別窄縮 (type narrowing) 期間提供給靜態型別檢查器的資" @@ -1483,20 +1482,20 @@ msgid "" "population count. (Contributed by Niklas Fiekas in :issue:`29882`.)" msgstr "" ":class:`int` 型別有一個新方法 :meth:`int.bit_count`,回傳給定整數的二進位展開" -"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas 在 :" -"issue:`29882` 中貢獻。)" +"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas " +"在 :issue:`29882` 中貢獻。)" #: ../../whatsnew/3.10.rst:816 msgid "" -"The views returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict." -"items` now all have a ``mapping`` attribute that gives a :class:`types." -"MappingProxyType` object wrapping the original dictionary. (Contributed by " -"Dennis Sweeney in :issue:`40890`.)" +"The views returned by :meth:`dict.keys`, :meth:`dict.values` " +"and :meth:`dict.items` now all have a ``mapping`` attribute that gives " +"a :class:`types.MappingProxyType` object wrapping the original dictionary. " +"(Contributed by Dennis Sweeney in :issue:`40890`.)" msgstr "" ":meth:`dict.keys`、:meth:`dict.values` 和 :meth:`dict.items` 回傳的視圖 " -"(view) 現在都有一個 ``mapping`` 屬性,該屬性提供 :class:`types." -"MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney 在 :issue:`40890` " -"中貢獻。)" +"(view) 現在都有一個 ``mapping`` 屬性,該屬性提" +"供 :class:`types.MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney " +"在 :issue:`40890` 中貢獻。)" #: ../../whatsnew/3.10.rst:821 msgid "" @@ -1511,13 +1510,15 @@ msgid "" "Builtin and extension functions that take integer arguments no longer " "accept :class:`~decimal.Decimal`\\ s, :class:`~fractions.Fraction`\\ s and " "other objects that can be converted to integers only with a loss (e.g. that " -"have the :meth:`~object.__int__` method but do not have the :meth:`~object." -"__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.)" -msgstr "" -"採用整數引數的內建函式和擴充函式不再接受 :class:`~decimal.Decimal`、:class:" -"`~fractions.Fraction` 以及其他只能在有損失的情況下轉換為整數的物件(例如有 :" -"meth:`~object.__int__` 方法,但沒有 :meth:`~object.__index__` 方法)。(由 " -"Serhiy Storchaka 在 :issue:`37999` 中貢獻。)" +"have the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). (Contributed by Serhiy Storchaka " +"in :issue:`37999`.)" +msgstr "" +"採用整數引數的內建函式和擴充函式不再接" +"受 :class:`~decimal.Decimal`、:class:`~fractions.Fraction` 以及其他只能在有損" +"失的情況下轉換為整數的物件(例如有 :meth:`~object.__int__` 方法,但沒" +"有 :meth:`~object.__index__` 方法)。(由 Serhiy Storchaka 在 :issue:`37999` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:831 msgid "" @@ -1547,7 +1548,7 @@ msgid "" msgstr "" "函式有一個新的 ``__builtins__`` 屬性,用於在執行函式時查找內建符號,而不是查" "找 ``__globals__['__builtins__']`` 。如果 ``__globals__[\"__builtins__\"]`` " -"存在,則屬性會以此做初始化,否則從當前內建物件 (builtins) 初始化。(由 Mark " +"存在,則屬性會以此做初始化,否則從目前內建物件 (builtins) 初始化。(由 Mark " "Shannon 在 :issue:`42990` 中貢獻。)" #: ../../whatsnew/3.10.rst:844 @@ -1557,21 +1558,21 @@ msgid "" "respectively. (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang " "in :issue:`31861`.)" msgstr "" -"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` 和 :" -"func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 Justin " -"Wang 在 :issue:`31861` 中貢獻。)" +"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` " +"和 :func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 " +"Justin Wang 在 :issue:`31861` 中貢獻。)" #: ../../whatsnew/3.10.rst:849 msgid "" -"Static methods (:func:`@staticmethod <staticmethod>`) and class methods (:" -"func:`@classmethod <classmethod>`) now inherit the method attributes " +"Static methods (:func:`@staticmethod <staticmethod>`) and class methods " +"(:func:`@classmethod <classmethod>`) now inherit the method attributes " "(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``, " "``__annotations__``) and have a new ``__wrapped__`` attribute. Moreover, " "static methods are now callable as regular functions. (Contributed by Victor " "Stinner in :issue:`43682`.)" msgstr "" -"靜態方法 (:func:`@staticmethod <staticmethod>`) 和類別方法 (:func:" -"`@classmethod <classmethod>`) 現在繼承方法屬性 (``__module__``, " +"靜態方法 (:func:`@staticmethod <staticmethod>`) 和類別方法 " +"(:func:`@classmethod <classmethod>`) 現在繼承方法屬性 (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__``, ``__annotations__``) 並有一個新" "的 ``__wrapped__`` 屬性。此外,靜態方法現在可以像是常規函式般呼叫。(由 " "Victor Stinner 在 :issue:`43682` 中貢獻。)" @@ -1580,8 +1581,8 @@ msgstr "" msgid "" "Annotations for complex targets (everything beside ``simple name`` targets " "defined by :pep:`526`) no longer cause any runtime effects with ``from " -"__future__ import annotations``. (Contributed by Batuhan Taskaya in :issue:" -"`42737`.)" +"__future__ import annotations``. (Contributed by Batuhan Taskaya " +"in :issue:`42737`.)" msgstr "" "複雜目標(除 :pep:`526` 定義的 ``simple name`` 目標之外的所有內容)的註釋不再" "使用 ``from __future__ import comments`` 造成任何執行環境 (runtime) 影響。" @@ -1597,15 +1598,15 @@ msgid "" msgstr "" "類別和模組物件現在會根據需求來延遲建立 (lazy-create) 空的註釋字典 " "(annotations dicts)。註釋字典存儲在物件的 ``__dict__`` 中以達成向後相容性。這" -"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參閱 :ref:" -"`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" +"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參" +"閱 :ref:`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" #: ../../whatsnew/3.10.rst:867 msgid "" "Annotations consist of ``yield``, ``yield from``, ``await`` or named " "expressions are now forbidden under ``from __future__ import annotations`` " -"due to their side effects. (Contributed by Batuhan Taskaya in :issue:" -"`42725`.)" +"due to their side effects. (Contributed by Batuhan Taskaya " +"in :issue:`42725`.)" msgstr "" "附名運算式或由 ``yield``、``yield from``、``await`` 組成的註釋現在在 ``from " "__future__ import comments`` 下被禁止,因為它們有些不預期的行為。(由 " @@ -1624,12 +1625,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:877 msgid "" -"Hashes of NaN values of both :class:`float` type and :class:`decimal." -"Decimal` type now depend on object identity. Formerly, they always hashed to " -"``0`` even though NaN values are not equal to one another. This caused " -"potentially quadratic runtime behavior due to excessive hash collisions when " -"creating dictionaries and sets containing multiple NaNs. (Contributed by " -"Raymond Hettinger in :issue:`43475`.)" +"Hashes of NaN values of both :class:`float` type " +"and :class:`decimal.Decimal` type now depend on object identity. Formerly, " +"they always hashed to ``0`` even though NaN values are not equal to one " +"another. This caused potentially quadratic runtime behavior due to excessive " +"hash collisions when creating dictionaries and sets containing multiple " +"NaNs. (Contributed by Raymond Hettinger in :issue:`43475`.)" msgstr "" ":class:`float` 型別和 :class:`decimal.Decimal` 型別的 NaN 值的雜湊值現在取決" "於物件的標識值 (identity)。以前即使 NaN 值彼此不相等,它們也總是被雜湊為 " @@ -1640,11 +1641,11 @@ msgstr "" #: ../../whatsnew/3.10.rst:884 msgid "" "A :exc:`SyntaxError` (instead of a :exc:`NameError`) will be raised when " -"deleting the :const:`__debug__` constant. (Contributed by Donghee Na in :" -"issue:`45000`.)" +"deleting the :const:`__debug__` constant. (Contributed by Donghee Na " +"in :issue:`45000`.)" msgstr "" -"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不是 :exc:" -"`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" +"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不" +"是 :exc:`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" #: ../../whatsnew/3.10.rst:887 msgid "" @@ -1673,9 +1674,9 @@ msgstr "asyncio" #: ../../whatsnew/3.10.rst:903 msgid "" -"Add missing :meth:`~asyncio.events.AbstractEventLoop." -"connect_accepted_socket` method. (Contributed by Alex Grönholm in :issue:" -"`41332`.)" +"Add " +"missing :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " +"method. (Contributed by Alex Grönholm in :issue:`41332`.)" msgstr "" "新增缺少的 :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " "方法。(由 Alex Grönholm 在 :issue:`41332` 中貢獻。)" @@ -1705,8 +1706,8 @@ msgid "" "Zackery Spytz in :issue:`31956`.)" msgstr "" ":class:`array.array` 的 :meth:`~array.array.index` 方法現在具有可選的 " -"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz 在 :issue:" -"`31956` 中貢獻。)" +"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz " +"在 :issue:`31956` 中貢獻。)" #: ../../whatsnew/3.10.rst:921 msgid "asynchat, asyncore, smtpd" @@ -1718,8 +1719,8 @@ msgid "" "since Python 3.6. An import-time :class:`DeprecationWarning` has now been " "added to all three of these modules." msgstr "" -"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時的 :class:" -"`DeprecationWarning` 現已新增到這三個模組中。" +"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時" +"的 :class:`DeprecationWarning` 現已新增到這三個模組中。" #: ../../whatsnew/3.10.rst:927 msgid "base64" @@ -1751,8 +1752,9 @@ msgstr "bisect" #: ../../whatsnew/3.10.rst:941 msgid "" -"Added the possibility of providing a *key* function to the APIs in the :mod:" -"`bisect` module. (Contributed by Raymond Hettinger in :issue:`4356`.)" +"Added the possibility of providing a *key* function to the APIs in " +"the :mod:`bisect` module. (Contributed by Raymond Hettinger " +"in :issue:`4356`.)" msgstr "" "新增向 :mod:`bisect` 模組 API 提供 *key* 函式的可能性。(由 Raymond " "Hettinger 在 :issue:`4356` 中貢獻。)" @@ -1766,7 +1768,7 @@ msgid "" "Add a :func:`codecs.unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" -"新增 :func:`codecs.unregister` 函式來取消註冊 (unregister) 一個編解碼器的搜索" +"新增 :func:`codecs.unregister` 函式來取消註冊 (unregister) 一個編解碼器的搜尋" "功能。(Hai Shi 在 :issue:`41842` 中貢獻。)" #: ../../whatsnew/3.10.rst:951 @@ -1776,28 +1778,29 @@ msgstr "collections.abc" #: ../../whatsnew/3.10.rst:953 msgid "" "The ``__args__`` of the :ref:`parameterized generic <types-genericalias>` " -"for :class:`collections.abc.Callable` are now consistent with :data:`typing." -"Callable`. :class:`collections.abc.Callable` generic now flattens type " -"parameters, similar to what :data:`typing.Callable` currently does. This " -"means that ``collections.abc.Callable[[int, str], str]`` will have " -"``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " +"for :class:`collections.abc.Callable` are now consistent " +"with :data:`typing.Callable`. :class:`collections.abc.Callable` generic now " +"flattens type parameters, similar to what :data:`typing.Callable` currently " +"does. This means that ``collections.abc.Callable[[int, str], str]`` will " +"have ``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " "str)``. To allow this change, :class:`types.GenericAlias` can now be " -"subclassed, and a subclass will be returned when subscripting the :class:" -"`collections.abc.Callable` type. Note that a :exc:`TypeError` may be raised " -"for invalid forms of parameterizing :class:`collections.abc.Callable` which " -"may have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" +"subclassed, and a subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Note that a :exc:`TypeError` " +"may be raised for invalid forms of " +"parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" ":class:`collections.abc.Callable` 的\\ :ref:`參數化泛型 (parameterized " -"generic) <types-genericalias>` 的 ``__args__`` 現在與 :data:`typing." -"Callable` 一致。:class:`collections.abc.Callable` 泛型現在會將型別參數攤平," -"類似於 :data:`typing.Callable` 目前的做法。這意味著 ``collections.abc." -"Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;在以" -"前這是 ``([int, str], str)``。為了允許此更改,現在可以對 :class:`types." -"GenericAlias` 進行子類別化,並且在下標 (subscript) :class:`collections.abc." -"Callable` 型別時將回傳子類別。請注意,對於無效形式的 :class:`collections.abc." -"Callable` 參數化可能會引發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無" -"引發例外地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢獻。)" +"generic) <types-genericalias>` 的 ``__args__`` 現在" +"與 :data:`typing.Callable` 一致。:class:`collections.abc.Callable` 泛型現在會" +"將型別參數攤平,類似於 :data:`typing.Callable` 目前的做法。這意味著 " +"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " +"``__args__``;在以前這是 ``([int, str], str)``。為了允許此更改,現在可以" +"對 :class:`types.GenericAlias` 進行子類別化,並且在下標 " +"(subscript) :class:`collections.abc.Callable` 型別時將回傳子類別。請注意,對" +"於無效形式的 :class:`collections.abc.Callable` 參數化可能會引" +"發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無引發例外地傳遞。(由 " +"Ken Jin 在 :issue:`42195` 中貢獻。)" #: ../../whatsnew/3.10.rst:966 msgid "contextlib" @@ -1836,17 +1839,18 @@ msgstr "curses" #: ../../whatsnew/3.10.rst:981 msgid "" "The extended color functions added in ncurses 6.1 will be used transparently " -"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses." -"init_pair`, and :func:`curses.pair_content`. A new function, :func:`curses." -"has_extended_color_support`, indicates whether extended color support is " -"provided by the underlying ncurses library. (Contributed by Jeffrey " -"Kintscher and Hans Petter Jansson in :issue:`36982`.)" -msgstr "" -"ncurses 6.1 中新增的擴充顏色函式將由 :func:`curses.color_content`、:func:" -"`curses.init_color`、:func:`curses.init_pair` 和 :func:`curses.pair_content` " -"透明地使用。新函式 :func:`curses.has_extended_color_support` 表示了底層的 " -"ncurses 函式庫是否支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter " -"Jansson 在 :issue:`36982` 中貢獻。)" +"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses.init_pair`, " +"and :func:`curses.pair_content`. A new " +"function, :func:`curses.has_extended_color_support`, indicates whether " +"extended color support is provided by the underlying ncurses library. " +"(Contributed by Jeffrey Kintscher and Hans Petter Jansson in :issue:`36982`.)" +msgstr "" +"ncurses 6.1 中新增的擴充顏色函式將" +"由 :func:`curses.color_content`、:func:`curses.init_color`、:func:`curses.init_pair` " +"和 :func:`curses.pair_content` 透明地使用。新函" +"式 :func:`curses.has_extended_color_support` 表示了底層的 ncurses 函式庫是否" +"支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter Jansson " +"在 :issue:`36982` 中貢獻。)" #: ../../whatsnew/3.10.rst:988 msgid "" @@ -1991,18 +1995,18 @@ msgid "" "3.12. Its functionality for specifying package builds has already been " "completely replaced by third-party packages ``setuptools`` and " "``packaging``, and most other commonly used APIs are available elsewhere in " -"the standard library (such as :mod:`platform`, :mod:`shutil`, :mod:" -"`subprocess` or :mod:`sysconfig`). There are no plans to migrate any other " -"functionality from ``distutils``, and applications that are using other " -"functions should plan to make private copies of the code. Refer to :pep:" -"`632` for discussion." +"the standard library (such " +"as :mod:`platform`, :mod:`shutil`, :mod:`subprocess` or :mod:`sysconfig`). " +"There are no plans to migrate any other functionality from ``distutils``, " +"and applications that are using other functions should plan to make private " +"copies of the code. Refer to :pep:`632` for discussion." msgstr "" "整個 ``distutils`` 套件已被棄用,將在 Python 3.12 中刪除。它指定套件建置的功" "能已經完全被第三方套件 ``setuptools`` 和 ``packaging`` 所取代,並且大多數其他" -"常用的 API 都可以在標準函式庫的其他地方被找到(例如 :mod:`platform` 、:mod:" -"`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。目前沒有將 ``distutils`` " -"遷移任何其他地方的計畫,且使用其他功能的應用程式應該開始規劃如何取得程式碼的" -"私有副本。請參閱 :pep:`632` 的討論。" +"常用的 API 都可以在標準函式庫的其他地方被找到(例" +"如 :mod:`platform` 、:mod:`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。" +"目前沒有將 ``distutils`` 遷移任何其他地方的計畫,且使用其他功能的應用程式應該" +"開始規劃如何取得程式碼的私有副本。請參閱 :pep:`632` 的討論。" #: ../../whatsnew/3.10.rst:1072 msgid "" @@ -2011,8 +2015,8 @@ msgid "" "Windows. (Contributed by Victor Stinner in :issue:`42802`.)" msgstr "" "Python 3.8 中不推薦使用的 ``bdist_wininst`` 命令已被刪除。現在建議使用 " -"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner 在 :" -"issue:`42802` 中貢獻。)" +"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner " +"在 :issue:`42802` 中貢獻。)" #: ../../whatsnew/3.10.rst:1078 msgid "doctest" @@ -2021,8 +2025,8 @@ msgstr "doctest" #: ../../whatsnew/3.10.rst:1080 ../../whatsnew/3.10.rst:1215 #: ../../whatsnew/3.10.rst:1242 ../../whatsnew/3.10.rst:1341 msgid "" -"When a module does not define ``__loader__``, fall back to ``__spec__." -"loader``. (Contributed by Brett Cannon in :issue:`42133`.)" +"When a module does not define ``__loader__``, fall back to " +"``__spec__.loader``. (Contributed by Brett Cannon in :issue:`42133`.)" msgstr "" "當模組未定義 ``__loader__`` 時,回退到 ``__spec__.loader`` 。(由 Brett " "Cannon 在 :issue:`42133` 中貢獻。)" @@ -2036,8 +2040,8 @@ msgid "" ":func:`encodings.normalize_encoding` now ignores non-ASCII characters. " "(Contributed by Hai Shi in :issue:`39337`.)" msgstr "" -":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi 在 :" -"issue:`39337` 中貢獻。)" +":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi " +"在 :issue:`39337` 中貢獻。)" #: ../../whatsnew/3.10.rst:1090 msgid "enum" @@ -2045,23 +2049,25 @@ msgstr "enum" #: ../../whatsnew/3.10.rst:1092 msgid "" -":class:`~enum.Enum` :func:`~object.__repr__` now returns ``enum_name." -"member_name`` and :func:`~object.__str__` now returns ``member_name``. " -"Stdlib enums available as module constants have a :func:`repr` of " -"``module_name.member_name``. (Contributed by Ethan Furman in :issue:`40066`.)" +":class:`~enum.Enum` :func:`~object.__repr__` now returns " +"``enum_name.member_name`` and :func:`~object.__str__` now returns " +"``member_name``. Stdlib enums available as module constants have " +"a :func:`repr` of ``module_name.member_name``. (Contributed by Ethan Furman " +"in :issue:`40066`.)" msgstr "" -":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 ``enum_name." -"member_name`` 、:func:`~object.__str__` 現在會回傳 ``member_name`` 。可用作模" -"組常數的標準函式庫列舉會有 ``module_name.member_name`` 的 :func:`repr`。(由 " -"Ethan Furman 在 :issue:`40066` 中貢獻。)" +":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 " +"``enum_name.member_name`` 、:func:`~object.__str__` 現在會回傳 " +"``member_name`` 。可用作模組常數的標準函式庫列舉會有 " +"``module_name.member_name`` 的 :func:`repr`。(由 Ethan Furman " +"在 :issue:`40066` 中貢獻。)" #: ../../whatsnew/3.10.rst:1097 msgid "" "Add :class:`enum.StrEnum` for enums where all members are strings. " "(Contributed by Ethan Furman in :issue:`41816`.)" msgstr "" -"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman 在 :" -"issue:`41816` 中貢獻。)" +"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman " +"在 :issue:`41816` 中貢獻。)" #: ../../whatsnew/3.10.rst:1101 msgid "fileinput" @@ -2069,8 +2075,9 @@ msgstr "fileinput" #: ../../whatsnew/3.10.rst:1103 msgid "" -"Add *encoding* and *errors* parameters in :func:`fileinput.input` and :class:" -"`fileinput.FileInput`. (Contributed by Inada Naoki in :issue:`43712`.)" +"Add *encoding* and *errors* parameters in :func:`fileinput.input` " +"and :class:`fileinput.FileInput`. (Contributed by Inada Naoki " +"in :issue:`43712`.)" msgstr "" "在 :func:`fileinput.input` 和 :class:`fileinput.FileInput` 中新增 *encoding* " "和 *errors* 參數。(由 Inada Naoki 在 :issue:`43712` 中貢獻。)" @@ -2092,8 +2099,8 @@ msgstr "faulthandler" #: ../../whatsnew/3.10.rst:1114 msgid "" "The :mod:`faulthandler` module now detects if a fatal error occurs during a " -"garbage collector collection. (Contributed by Victor Stinner in :issue:" -"`44466`.)" +"garbage collector collection. (Contributed by Victor Stinner " +"in :issue:`44466`.)" msgstr "" ":mod:`faulthandler` 模組現在可以檢測垃圾收集器 (garbage collector) 在收集期間" "是否發生嚴重錯誤。(由 Victor Stinner 在 :issue:`44466` 中貢獻。)" @@ -2104,12 +2111,13 @@ msgstr "gc" #: ../../whatsnew/3.10.rst:1121 msgid "" -"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and :" -"func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)" +"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` " +"and :func:`gc.get_referents`. (Contributed by Pablo Galindo " +"in :issue:`43439`.)" msgstr "" -"為 :func:`gc.get_objects`、:func:`gc.get_referrers` 和 :func:`gc." -"get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo 在 :issue:" -"`43439` 中貢獻。)" +"為 :func:`gc.get_objects`、:func:`gc.get_referrers` " +"和 :func:`gc.get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo " +"在 :issue:`43439` 中貢獻。)" #: ../../whatsnew/3.10.rst:1125 msgid "glob" @@ -2117,12 +2125,12 @@ msgstr "glob" #: ../../whatsnew/3.10.rst:1127 msgid "" -"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and :func:" -"`~glob.iglob` which allow to specify the root directory for searching. " -"(Contributed by Serhiy Storchaka in :issue:`38144`.)" +"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` " +"and :func:`~glob.iglob` which allow to specify the root directory for " +"searching. (Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" "在 :func:`~glob.glob` 和 :func:`~glob.iglob` 中新增 *root_dir* 和 *dir_fd* 參" -"數,允許指定搜索的根目錄。(由 Serhiy Storchaka 在 :issue:`38144` 中貢獻。)" +"數,允許指定搜尋的根目錄。(由 Serhiy Storchaka 在 :issue:`38144` 中貢獻。)" #: ../../whatsnew/3.10.rst:1132 msgid "hashlib" @@ -2133,8 +2141,8 @@ msgid "" "The hashlib module requires OpenSSL 1.1.1 or newer. (Contributed by " "Christian Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" -"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes 在 :pep:" -"`644` 和 :issue:`43669` 中貢獻。)" +"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes " +"在 :pep:`644` 和 :issue:`43669` 中貢獻。)" #: ../../whatsnew/3.10.rst:1137 msgid "" @@ -2151,8 +2159,8 @@ msgid "" "with OpenSSL support. (Contributed by Christian Heimes in :issue:`43880`.)" msgstr "" "純 Python 的 :func:`~hashlib.pbkdf2_hmac` 回退已被棄用。將來只有在有 OpenSSL " -"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes 在 :issue:" -"`43880` 中貢獻。)" +"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes " +"在 :issue:`43880` 中貢獻。)" #: ../../whatsnew/3.10.rst:1146 msgid "hmac" @@ -2163,8 +2171,8 @@ msgid "" "The hmac module now uses OpenSSL's HMAC implementation internally. " "(Contributed by Christian Heimes in :issue:`40645`.)" msgstr "" -"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes 在 :" -"issue:`40645` 中貢獻。)" +"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes " +"在 :issue:`40645` 中貢獻。)" #: ../../whatsnew/3.10.rst:1152 msgid "IDLE and idlelib" @@ -2173,10 +2181,10 @@ msgstr "IDLE 和 idlelib" #: ../../whatsnew/3.10.rst:1154 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" -"`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton " +"in :issue:`43008`.)" msgstr "" -"讓 IDLE 調用 :func:`sys.excepthook` (在沒有 ``-n`` 的情況下啟動時)。使用者" +"讓 IDLE 叫用 :func:`sys.excepthook` (在沒有 ``-n`` 的情況下啟動時)。使用者" "掛鉤 (user hooks) 在以前是被忽略的。(由 Ken Hilton 在 :issue:`43008` 中貢" "獻。)" @@ -2185,10 +2193,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " +"in :issue:`33962`.)" msgstr "" "重新排列設定對話框。將 General 分頁拆分為 Windows 和 Shell/Ed 分頁。將擴充 " "Help 選單的幫助來源移至 Extensions 分頁。為新選項騰出空間並縮短對話框,而後者" @@ -2210,9 +2218,9 @@ msgid "" "the selected text. This option also appears on the context menu for the " "text. (Contributed by Tal Einat in :issue:`37903`.)" msgstr "" -"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元(``..." -"``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側邊欄操" -"作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " +"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元" +"(``...``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側" +"邊欄操作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " "prompts)」的情境選單,這會將側邊欄中提示字元與所選文字並排,此選項也會出現在" "文字的情境選單上。(由 Tal Einat 在 :issue:`37903` 中貢獻。)" @@ -2229,11 +2237,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:1182 msgid "" -"Highlight the new :ref:`soft keywords <soft-keywords>` :keyword:`match`, :" -"keyword:`case <match>`, and :keyword:`_ <wildcard-patterns>` in pattern-" -"matching statements. However, this highlighting is not perfect and will be " -"incorrect in some rare cases, including some ``_``-s in ``case`` patterns. " -"(Contributed by Tal Einat in :issue:`44010`.)" +"Highlight the new :ref:`soft keywords <soft-" +"keywords>` :keyword:`match`, :keyword:`case <match>`, and :keyword:`_ " +"<wildcard-patterns>` in pattern-matching statements. However, this " +"highlighting is not perfect and will be incorrect in some rare cases, " +"including some ``_``-s in ``case`` patterns. (Contributed by Tal Einat " +"in :issue:`44010`.)" msgstr "" "突顯 (highlight) 模式匹配陳述式中的新\\ :ref:`軟關鍵字 (soft keywords) <soft-" "keywords>` :keyword:`match`、:keyword:`case <match>` 和 :keyword:`_ " @@ -2257,8 +2266,8 @@ msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy 在 :gh:" -"`95191` 中貢獻。)" +"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy " +"在 :gh:`95191` 中貢獻。)" #: ../../whatsnew/3.10.rst:1197 msgid "importlib.metadata" @@ -2269,19 +2278,19 @@ msgid "" "Feature parity with ``importlib_metadata`` 4.6 (`history <https://importlib-" "metadata.readthedocs.io/en/latest/history.html>`_)." msgstr "" -"與 ``importlib_metadata`` 4.6 功能相同(`歷史 <https://importlib-metadata." -"readthedocs.io/en/latest/history.html>`_)。" +"與 ``importlib_metadata`` 4.6 功能相同(`歷史 <https://importlib-" +"metadata.readthedocs.io/en/latest/history.html>`_)。" #: ../../whatsnew/3.10.rst:1202 msgid "" ":ref:`importlib.metadata entry points <entry-points>` now provide a nicer " -"experience for selecting entry points by group and name through a new :ref:" -"`importlib.metadata.EntryPoints <entry-points>` class. See the Compatibility " -"Note in the docs for more info on the deprecation and usage." +"experience for selecting entry points by group and name through a " +"new :ref:`importlib.metadata.EntryPoints <entry-points>` class. See the " +"Compatibility Note in the docs for more info on the deprecation and usage." msgstr "" -":ref:`importlib.metadata 入口點 <entry-points>`\\ 現在透過新的 :ref:" -"`importlib.metadata.EntryPoints <entry-points>` 類別提供了以群組和名稱選擇入" -"口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" +":ref:`importlib.metadata 入口點 <entry-points>`\\ 現在透過新" +"的 :ref:`importlib.metadata.EntryPoints <entry-points>` 類別提供了以群組和名" +"稱選擇入口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" #: ../../whatsnew/3.10.rst:1208 msgid "" @@ -2290,8 +2299,8 @@ msgid "" "their :ref:`importlib.metadata.Distribution <distributions>`." msgstr "" "新增了 :ref:`importlib.metadata.packages_distributions() <package-" -"distributions>` 用於將頂階 Python 模組和套件解析出 :ref:`importlib.metadata." -"Distribution <distributions>`。" +"distributions>` 用於將頂階 Python 模組和套件解析" +"出 :ref:`importlib.metadata.Distribution <distributions>`。" #: ../../whatsnew/3.10.rst:1213 msgid "inspect" @@ -2303,25 +2312,27 @@ msgid "" "defined on an object. It works around the quirks of accessing the " "annotations on various types of objects, and makes very few assumptions " "about the object it examines. :func:`inspect.get_annotations` can also " -"correctly un-stringize stringized annotations. :func:`inspect." -"get_annotations` is now considered best practice for accessing the " -"annotations dict defined on any Python object; for more information on best " -"practices for working with annotations, please see :ref:`annotations-howto`. " -"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature." -"from_callable`, and :func:`!inspect.Signature.from_function` now call :func:" -"`inspect.get_annotations` to retrieve annotations. This means :func:`inspect." -"signature` and :func:`inspect.Signature.from_callable` can also now un-" -"stringize stringized annotations. (Contributed by Larry Hastings in :issue:" -"`43817`.)" +"correctly un-stringize stringized " +"annotations. :func:`inspect.get_annotations` is now considered best " +"practice for accessing the annotations dict defined on any Python object; " +"for more information on best practices for working with annotations, please " +"see :ref:`annotations-howto`. " +"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature.from_callable`, " +"and :func:`!inspect.Signature.from_function` now " +"call :func:`inspect.get_annotations` to retrieve annotations. This " +"means :func:`inspect.signature` and :func:`inspect.Signature.from_callable` " +"can also now un-stringize stringized annotations. (Contributed by Larry " +"Hastings in :issue:`43817`.)" msgstr "" "新增 :func:`inspect.get_annotations`,它可以安全地計算物件上定義的註釋。它是" "存取各種型別物件註釋的怪作法 (quirks) 的變通解法 (work around),並且對其檢查" "的物件做出很少的假設。 :func:`inspect.get_annotations` 也可以正確地取消字串化" "註釋 (stringized annotations)。 :func:`inspect.get_annotations` 現在被認為是" "存取任何 Python 物件上定義的註釋字典的最佳實踐;有關使用註釋的最佳實踐的更多" -"資訊,請參閱 :ref:`annotations-howto`。相關地,:func:`inspect.signature`、:" -"func:`inspect.Signature.from_callable` 和 :func:`!inspect.Signature." -"from_function` 現在呼叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" +"資訊,請參閱 :ref:`annotations-howto`。相關" +"地,:func:`inspect.signature`、:func:`inspect.Signature.from_callable` " +"和 :func:`!inspect.Signature.from_function` 現在呼" +"叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" "著 :func:`inspect.signature` 和 :func:`inspect.Signature.from_callable` 現在" "也可以取消字串化註釋。(由 Larry Hastings 在 :issue:`43817` 中貢獻。)" @@ -2331,8 +2342,8 @@ msgstr "itertools" #: ../../whatsnew/3.10.rst:1236 msgid "" -"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger in :issue:" -"`38200`.)" +"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger " +"in :issue:`38200`.)" msgstr "" "新增 :func:`itertools.pairwise`。(由 Raymond Hettinger 在 :issue:`38200` 中" "貢獻。)" @@ -2350,14 +2361,14 @@ msgid "" "Add :func:`os.cpu_count` support for VxWorks RTOS. (Contributed by Peixing " "Xin in :issue:`41440`.)" msgstr "" -"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin 在 :issue:" -"`41440` 中貢獻。)" +"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin " +"在 :issue:`41440` 中貢獻。)" #: ../../whatsnew/3.10.rst:1251 msgid "" "Add a new function :func:`os.eventfd` and related helpers to wrap the " -"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes in :issue:" -"`41001`.)" +"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes " +"in :issue:`41001`.)" msgstr "" "新增函式 :func:`os.eventfd` 和相關幫助程式來包裝 Linux 上的 ``eventfd2`` 系統" "呼叫。(由 Christian Heimes 在 :issue:`41001` 中貢獻。)" @@ -2377,12 +2388,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:1260 msgid "" "Add :const:`~os.O_EVTONLY`, :const:`~os.O_FSYNC`, :const:`~os.O_SYMLINK` " -"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na in :" -"issue:`43106`.)" +"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na " +"in :issue:`43106`.)" msgstr "" -"為 macOS 新增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os." -"O_SYMLINK` 和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` " -"中貢獻。)" +"為 macOS 新" +"增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os.O_SYMLINK` " +"和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` 中貢獻。)" #: ../../whatsnew/3.10.rst:1265 msgid "os.path" @@ -2395,8 +2406,8 @@ msgid "" "symlink loop is encountered. (Contributed by Barney Gale in :issue:`43757`.)" msgstr "" ":func:`os.path.realpath` 現在接受一個 *strict* 僅限關鍵字引數。當設定為 " -"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引發 :exc:" -"`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" +"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引" +"發 :exc:`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" #: ../../whatsnew/3.10.rst:1273 msgid "pathlib" @@ -2412,8 +2423,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:1278 msgid "" -"Add negative indexing support to :attr:`PurePath.parents <pathlib.PurePath." -"parents>`. (Contributed by Yaroslav Pankovych in :issue:`21041`.)" +"Add negative indexing support to :attr:`PurePath.parents " +"<pathlib.PurePath.parents>`. (Contributed by Yaroslav Pankovych " +"in :issue:`21041`.)" msgstr "" "向 :attr:`PurePath.parents <pathlib.PurePath.parents>` 新增負索引支援。(由 " "Yaroslav Pankovych 在 :issue:`21041` 中貢獻。)" @@ -2421,20 +2433,20 @@ msgstr "" #: ../../whatsnew/3.10.rst:1282 msgid "" "Add :meth:`Path.hardlink_to <pathlib.Path.hardlink_to>` method that " -"supersedes :meth:`!link_to`. The new method has the same argument order as :" -"meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale in :issue:" -"`39950`.)" +"supersedes :meth:`!link_to`. The new method has the same argument order " +"as :meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale " +"in :issue:`39950`.)" msgstr "" -"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to <pathlib.Path." -"hardlink_to>` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` 具有相同的引數" -"順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" +"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to " +"<pathlib.Path.hardlink_to>` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` " +"具有相同的引數順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" #: ../../whatsnew/3.10.rst:1287 msgid "" ":meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a " "*follow_symlinks* keyword-only argument for consistency with corresponding " -"functions in the :mod:`os` module. (Contributed by Barney Gale in :issue:" -"`39906`.)" +"functions in the :mod:`os` module. (Contributed by Barney Gale " +"in :issue:`39906`.)" msgstr "" ":meth:`pathlib.Path.stat` 和 :meth:`~pathlib.Path.chmod` 現在接受 " "*follow_symlinks* 僅限關鍵字引數,以與 :mod:`os` 模組中的相應函式保持一致。" @@ -2445,16 +2457,15 @@ msgid "platform" msgstr "platform" #: ../../whatsnew/3.10.rst:1295 -#, fuzzy msgid "" "Add :func:`platform.freedesktop_os_release` to retrieve operation system " "identification from `freedesktop.org os-release <https://www.freedesktop.org/" "software/systemd/man/os-release.html>`_ standard file. (Contributed by " "Christian Heimes in :issue:`28468`.)" msgstr "" -"新增 :func:`platform.freedesktop_os_release()` 以從 `freedesktop.org os-" +"新增 :func:`platform.freedesktop_os_release` 以從 `freedesktop.org os-" "release <https://www.freedesktop.org/software/systemd/man/os-release.html>`_ " -"標準檔案中檢索出作業系統標識。(由 Christian Heimes 在 :issue:`28468` 中貢" +"標準檔案中檢索出作業系統識別。(由 Christian Heimes 在 :issue:`28468` 中貢" "獻。)" #: ../../whatsnew/3.10.rst:1301 @@ -2486,7 +2497,7 @@ msgid "" "Add ``--quiet`` option to command-line interface of :mod:`py_compile`. " "(Contributed by Gregory Schevchenko in :issue:`38731`.)" msgstr "" -"將 ``--quiet`` 選項新增到 :mod:`py_compile` 的命令列界面。(由 Gregory " +"將 ``--quiet`` 選項新增到 :mod:`py_compile` 的命令列介面。(由 Gregory " "Schevchenko 在 :issue:`38731` 中貢獻。)" #: ../../whatsnew/3.10.rst:1316 @@ -2496,13 +2507,14 @@ msgstr "pyclbr" #: ../../whatsnew/3.10.rst:1318 msgid "" "Add an ``end_lineno`` attribute to the ``Function`` and ``Class`` objects in " -"the tree returned by :func:`pyclbr.readmodule` and :func:`pyclbr." -"readmodule_ex`. It matches the existing (start) ``lineno``. (Contributed by " -"Aviral Srivastava in :issue:`38307`.)" +"the tree returned by :func:`pyclbr.readmodule` " +"and :func:`pyclbr.readmodule_ex`. It matches the existing (start) " +"``lineno``. (Contributed by Aviral Srivastava in :issue:`38307`.)" msgstr "" -"將 ``end_lineno`` 屬性新增到 :func:`pyclbr.readmodule` 和 :func:`pyclbr." -"readmodule_ex` 回傳的樹中的 ``Function`` 和 ``Class`` 物件。它與現有的(開" -"始) ``lineno`` 匹配。(由 Aviral Srivastava 在 :issue:`38307` 中貢獻。)" +"將 ``end_lineno`` 屬性新增到 :func:`pyclbr.readmodule` " +"和 :func:`pyclbr.readmodule_ex` 回傳的樹中的 ``Function`` 和 ``Class`` 物件。" +"它與現有的(開始) ``lineno`` 匹配。(由 Aviral Srivastava 在 :issue:`38307` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:1324 msgid "shelve" @@ -2514,9 +2526,9 @@ msgid "" "default instead of :mod:`pickle` protocol ``3`` when creating shelves. " "(Contributed by Zackery Spytz in :issue:`34204`.)" msgstr "" -"現在,:mod:`shelve` 模組在建立 shelve 時預設使用 :const:`pickle." -"DEFAULT_PROTOCOL`,而不是 :mod:`pickle` 的協議 ``3``。(由 Zackery Spytz 在 :" -"issue:`34204` 中貢獻。)" +"現在,:mod:`shelve` 模組在建立 shelve 時預設使" +"用 :const:`pickle.DEFAULT_PROTOCOL`,而不是 :mod:`pickle` 的協議 ``3``。(由 " +"Zackery Spytz 在 :issue:`34204` 中貢獻。)" #: ../../whatsnew/3.10.rst:1331 msgid "statistics" @@ -2524,9 +2536,10 @@ msgstr "statistics" #: ../../whatsnew/3.10.rst:1333 msgid "" -"Add :func:`~statistics.covariance`, Pearson's :func:`~statistics." -"correlation`, and simple :func:`~statistics.linear_regression` functions. " -"(Contributed by Tymoteusz Wołodźko in :issue:`38490`.)" +"Add :func:`~statistics.covariance`, " +"Pearson's :func:`~statistics.correlation`, and " +"simple :func:`~statistics.linear_regression` functions. (Contributed by " +"Tymoteusz Wołodźko in :issue:`38490`.)" msgstr "" "新增 :func:`~statistics.covariance`、Pearson :func:`~statistics.correlation` " "和簡單 :func:`~statistics.linear_regression` 函式。(由 Tymoteusz Wołodźko " @@ -2553,8 +2566,8 @@ msgid "" "Add option to create MPTCP sockets with ``IPPROTO_MPTCP`` (Contributed by " "Rui Cunha in :issue:`43571`.)" msgstr "" -"新增使用 ``IPPROTO_MPTCP`` 建立 MPTCP socket 的選項(由 Rui Cunha 在 :issue:" -"`43571` 中貢獻。)" +"新增使用 ``IPPROTO_MPTCP`` 建立 MPTCP socket 的選項(由 Rui Cunha " +"在 :issue:`43571` 中貢獻。)" #: ../../whatsnew/3.10.rst:1353 msgid "" @@ -2578,44 +2591,45 @@ msgstr "" #: ../../whatsnew/3.10.rst:1362 msgid "" -"The ssl module has preliminary support for OpenSSL 3.0.0 and new option :" -"const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian Heimes in :" -"issue:`38820`, :issue:`43794`, :issue:`43788`, :issue:`43791`, :issue:" -"`43799`, :issue:`43920`, :issue:`43789`, and :issue:`43811`.)" +"The ssl module has preliminary support for OpenSSL 3.0.0 and new " +"option :const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian " +"Heimes " +"in :issue:`38820`, :issue:`43794`, :issue:`43788`, :issue:`43791`, :issue:`43799`, :issue:`43920`, :issue:`43789`, " +"and :issue:`43811`.)" msgstr "" -"ssl 模組初步支援 OpenSSL 3.0.0 和新選項 :const:`~ssl." -"OP_IGNORE_UNEXPECTED_EOF`。(由 Christian Heimes 於 :issue:`38820`、:issue:" -"`43794`、:issue:`43788`、:issue:`43791`、:issue:`43799`、:issue:`43920`、:" -"issue:`43789` 和 :issue:`43811` 貢獻。)" +"ssl 模組初步支援 OpenSSL 3.0.0 和新選" +"項 :const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`。(由 Christian Heimes " +"於 :issue:`38820`、:issue:`43794`、:issue:`43788`、:issue:`43791`、:issue:`43799`、:issue:`43920`、:issue:`43789` " +"和 :issue:`43811` 貢獻。)" #: ../../whatsnew/3.10.rst:1368 msgid "" -"Deprecated function and use of deprecated constants now result in a :exc:" -"`DeprecationWarning`. :attr:`ssl.SSLContext.options` has :data:`~ssl." -"OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and therefore " -"cannot warn about setting the flag again. The :ref:`deprecation section " -"<whatsnew310-deprecated>` has a list of deprecated features. (Contributed by " -"Christian Heimes in :issue:`43880`.)" -msgstr "" -"已棄用函式和使用已棄用常數現在會導致 :exc:`DeprecationWarning`。 :attr:`ssl." -"SSLContext.options` 預設設定有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl." -"OP_NO_SSLv3`,因此無法再次發出設定該旗標的警告。:ref:`棄用部分 <whatsnew310-" -"deprecated>`\\ 包含已棄用功能的列表。(由 Christian Heimes 在 :issue:`43880` " -"中貢獻。)" +"Deprecated function and use of deprecated constants now result in " +"a :exc:`DeprecationWarning`. :attr:`ssl.SSLContext.options` " +"has :data:`~ssl.OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and " +"therefore cannot warn about setting the flag again. The :ref:`deprecation " +"section <whatsnew310-deprecated>` has a list of deprecated features. " +"(Contributed by Christian Heimes in :issue:`43880`.)" +msgstr "" +"已棄用函式和使用已棄用常數現在會導" +"致 :exc:`DeprecationWarning`。 :attr:`ssl.SSLContext.options` 預設設定" +"有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl.OP_NO_SSLv3`,因此無法再次發出設定" +"該旗標的警告。:ref:`棄用部分 <whatsnew310-deprecated>`\\ 包含已棄用功能的列" +"表。(由 Christian Heimes 在 :issue:`43880` 中貢獻。)" #: ../../whatsnew/3.10.rst:1376 msgid "" "The ssl module now has more secure default settings. Ciphers without forward " "secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits " -"weak RSA, DH, and ECC keys with less than 112 bits of security. :class:`~ssl." -"SSLContext` defaults to minimum protocol version TLS 1.2. Settings are based " -"on Hynek Schlawack's research. (Contributed by Christian Heimes in :issue:" -"`43998`.)" +"weak RSA, DH, and ECC keys with less than 112 bits of " +"security. :class:`~ssl.SSLContext` defaults to minimum protocol version TLS " +"1.2. Settings are based on Hynek Schlawack's research. (Contributed by " +"Christian Heimes in :issue:`43998`.)" msgstr "" "ssl 模組現在具有更安全的預設設定。預設情況下禁用沒有前向保密或 SHA-1 MAC 的密" -"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密鑰。 :class:" -"`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek Schlawack 的研" -"究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" +"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密" +"鑰。 :class:`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek " +"Schlawack 的研究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" #: ../../whatsnew/3.10.rst:1383 msgid "" @@ -2649,8 +2663,8 @@ msgid "" "A new verify flag :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added. " "(Contributed by l0x in :issue:`40849`.)" msgstr "" -"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x 在 :issue:" -"`40849` 中貢獻。)" +"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x " +"在 :issue:`40849` 中貢獻。)" #: ../../whatsnew/3.10.rst:1398 msgid "sqlite3" @@ -2658,13 +2672,15 @@ msgstr "sqlite3" #: ../../whatsnew/3.10.rst:1400 msgid "" -"Add audit events for :func:`~sqlite3.connect/handle`, :meth:`~sqlite3." -"Connection.enable_load_extension`, and :meth:`~sqlite3.Connection." -"load_extension`. (Contributed by Erlend E. Aasland in :issue:`43762`.)" +"Add audit events for :func:`~sqlite3.connect/" +"handle`, :meth:`~sqlite3.Connection.enable_load_extension`, " +"and :meth:`~sqlite3.Connection.load_extension`. (Contributed by Erlend E. " +"Aasland in :issue:`43762`.)" msgstr "" -"新增 :func:`~sqlite3.connect/handle`、:meth:`~sqlite3.Connection." -"enable_load_extension` 和 :meth:`~sqlite3.Connection.load_extension` 的稽核事" -"件。(由 Erlend E. Aasland 在 :issue:`43762` 中貢獻。)" +"新增 :func:`~sqlite3.connect/" +"handle`、:meth:`~sqlite3.Connection.enable_load_extension` " +"和 :meth:`~sqlite3.Connection.load_extension` 的稽核事件。(由 Erlend E. " +"Aasland 在 :issue:`43762` 中貢獻。)" #: ../../whatsnew/3.10.rst:1406 msgid "sys" @@ -2708,12 +2724,13 @@ msgstr "threading" #: ../../whatsnew/3.10.rst:1426 msgid "" "Add :func:`threading.gettrace` and :func:`threading.getprofile` to retrieve " -"the functions set by :func:`threading.settrace` and :func:`threading." -"setprofile` respectively. (Contributed by Mario Corchero in :issue:`42251`.)" +"the functions set by :func:`threading.settrace` " +"and :func:`threading.setprofile` respectively. (Contributed by Mario " +"Corchero in :issue:`42251`.)" msgstr "" -"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取得 :" -"func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。(由 " -"Mario Corchero 在 :issue:`42251` 中貢獻。)" +"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取" +"得 :func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。" +"(由 Mario Corchero 在 :issue:`42251` 中貢獻。)" #: ../../whatsnew/3.10.rst:1431 msgid "" @@ -2721,9 +2738,9 @@ msgid "" "of :func:`threading.excepthook` in case it is set to a broken or a different " "value. (Contributed by Mario Corchero in :issue:`42308`.)" msgstr "" -"新增 :data:`threading.__excepthook__` 以允許取得 :func:`threading." -"excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 Mario Corchero 在 :" -"issue:`42308` 中貢獻。)" +"新增 :data:`threading.__excepthook__` 以允許取" +"得 :func:`threading.excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 " +"Mario Corchero 在 :issue:`42308` 中貢獻。)" #: ../../whatsnew/3.10.rst:1437 msgid "traceback" @@ -2731,15 +2748,14 @@ msgstr "traceback" #: ../../whatsnew/3.10.rst:1439 msgid "" -"The :func:`~traceback.format_exception`, :func:`~traceback." -"format_exception_only`, and :func:`~traceback.print_exception` functions can " -"now take an exception object as a positional-only argument. (Contributed by " -"Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" +"The :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " +"and :func:`~traceback.print_exception` functions can now take an exception " +"object as a positional-only argument. (Contributed by Zackery Spytz and " +"Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback." -"format_exception_only` 和 :func:`~traceback.print_exception` 函式現在可以將例" -"外物件作為僅限位置引數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:" -"`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " +"和 :func:`~traceback.print_exception` 函式現在可以將例外物件作為僅限位置引" +"數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" #: ../../whatsnew/3.10.rst:1446 msgid "types" @@ -2747,14 +2763,14 @@ msgstr "types" #: ../../whatsnew/3.10.rst:1448 msgid "" -"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` and :data:" -"`types.NotImplementedType` classes, providing a new set of types readily " -"interpretable by type checkers. (Contributed by Bas van Beek in :issue:" -"`41810`.)" +"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` " +"and :data:`types.NotImplementedType` classes, providing a new set of types " +"readily interpretable by type checkers. (Contributed by Bas van Beek " +"in :issue:`41810`.)" msgstr "" -"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` 和 :data:`types." -"NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型別。(由 Bas van " -"Beek 在 :issue:`41810` 中貢獻。)" +"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` " +"和 :data:`types.NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型" +"別。(由 Bas van Beek 在 :issue:`41810` 中貢獻。)" #: ../../whatsnew/3.10.rst:1454 msgid "typing" @@ -2766,8 +2782,9 @@ msgstr "有關重大更改,請參閱\\ :ref:`new-feat-related-type-hints`。" #: ../../whatsnew/3.10.rst:1458 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform with :pep:" -"`586` and to match the behavior of static type checkers specified in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform " +"with :pep:`586` and to match the behavior of static type checkers specified " +"in the PEP." msgstr "" ":class:`typing.Literal` 的行為已更改為符合 :pep:`586` 並匹配 PEP 中指定的靜態" "型別檢查器的行為。" @@ -2799,7 +2816,7 @@ msgid "" "Note that declaring ``Literal`` with unhashable parameters will not throw an " "error::" msgstr "" -"如果 ``Literal`` 物件的任ㄧ參數不是\\ :term:`可雜湊的 <hashable>`,那麼它們現" +"如果 ``Literal`` 物件的任一參數不是\\ :term:`可雜湊的 <hashable>`,那麼它們現" "在將在相等性比較期間引發 :exc:`TypeError` 例外。請注意,使用不可雜湊的參數宣" "告 ``Literal`` 不會引發錯誤: ::" @@ -2826,19 +2843,20 @@ msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" #: ../../whatsnew/3.10.rst:1481 msgid "" "Add new function :func:`typing.is_typeddict` to introspect if an annotation " -"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader in :issue:" -"`41792`.)" +"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader " +"in :issue:`41792`.)" msgstr "" -"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否為 :" -"class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢獻。)" +"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否" +"為 :class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1485 msgid "" "Subclasses of ``typing.Protocol`` which only have data variables declared " "will now raise a ``TypeError`` when checked with ``isinstance`` unless they " "are decorated with :func:`~typing.runtime_checkable`. Previously, these " -"checks passed silently. Users should decorate their subclasses with the :" -"func:`!runtime_checkable` decorator if they want runtime protocols. " +"checks passed silently. Users should decorate their subclasses with " +"the :func:`!runtime_checkable` decorator if they want runtime protocols. " "(Contributed by Yurii Karabas in :issue:`38908`.)" msgstr "" "僅宣告了資料變數的 ``typing.Protocol`` 子類別現在在使用 ``isinstance`` 檢查時" @@ -2849,16 +2867,16 @@ msgstr "" #: ../../whatsnew/3.10.rst:1493 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" -"exc:`DeprecationWarning`. These submodules have been deprecated since " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules have been deprecated since " "Python 3.8 and will be removed in a future version of Python. Anything " "belonging to those submodules should be imported directly from :mod:`typing` " "instead. (Contributed by Sebastian Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" -"`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來版本的 " -"Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引入。 " -"(由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" +"出 :exc:`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來" +"版本的 Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引" +"入。 (由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" #: ../../whatsnew/3.10.rst:1501 msgid "unittest" @@ -2870,43 +2888,43 @@ msgid "" "existing :meth:`~unittest.TestCase.assertLogs`. (Contributed by Kit Yan Choi " "in :issue:`39385`.)" msgstr "" -"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有的 :meth:" -"`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi 在 :issue:`39385` 中貢" -"獻。)" +"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有" +"的 :meth:`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi " +"在 :issue:`39385` 中貢獻。)" #: ../../whatsnew/3.10.rst:1508 msgid "urllib.parse" msgstr "urllib.parse" #: ../../whatsnew/3.10.rst:1510 -#, fuzzy msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " -"as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" -"`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " -"newer W3C recommendations, this has been changed to allow only a single " -"separator key, with ``&`` as the default. This change also affects :func:`!" -"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " -"functions internally. For more details, please see their respective " -"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " -"in :issue:`42967`.)" -msgstr "" -"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` 和 :func:" -"`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " +"as query parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their " +"respective documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran " +"and Ken Jin in :issue:`42967`.)" +msgstr "" +"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` " +"和 :func:`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " "parameter) 的分隔符號。出於安全考慮,並且為了符合更新的 W3C 建議,已將其更改" -"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`cgi.parse` 和 :" -"func:`cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細資" -"訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin 在 :" -"issue:`42967` 中貢獻。)" +"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`!cgi.parse` " +"和 :func:`!cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細" +"資訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin " +"在 :issue:`42967` 中貢獻。)" #: ../../whatsnew/3.10.rst:1520 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.10.rst:1528 @@ -2915,9 +2933,9 @@ msgstr "xml" #: ../../whatsnew/3.10.rst:1530 msgid "" -"Add a :class:`~xml.sax.handler.LexicalHandler` class to the :mod:`xml.sax." -"handler` module. (Contributed by Jonathan Gossage and Zackery Spytz in :" -"issue:`35018`.)" +"Add a :class:`~xml.sax.handler.LexicalHandler` class to " +"the :mod:`xml.sax.handler` module. (Contributed by Jonathan Gossage and " +"Zackery Spytz in :issue:`35018`.)" msgstr "" "新增 :class:`~xml.sax.handler.LexicalHandler` 類別到 :mod:`xml.sax.handler` " "模組。(由 Jonathan Gossage 和 Zackery Spytz 在 :issue:`35018` 中貢獻。)" @@ -2928,14 +2946,15 @@ msgstr "zipimport" #: ../../whatsnew/3.10.rst:1536 msgid "" -"Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter." -"find_spec`, :meth:`zipimport.zipimporter.create_module`, and :meth:" -"`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon in :issue:" -"`42131`.)" +"Add methods related " +"to :pep:`451`: :meth:`~zipimport.zipimporter.find_spec`, :meth:`zipimport.zipimporter.create_module`, " +"and :meth:`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " +"in :issue:`42131`.)" msgstr "" -"新增與 :pep:`451` 相關的方法::meth:`~zipimport.zipimporter.find_spec`、:" -"meth:`zipimport.zipimporter.create_module` 和 :meth:`zipimport.zipimporter." -"exec_module`。(由 Brett Cannon 在 :issue:`42131` 中貢獻。)" +"新增與 :pep:`451` 相關的方" +"法::meth:`~zipimport.zipimporter.find_spec`、:meth:`zipimport.zipimporter.create_module` " +"和 :meth:`zipimport.zipimporter.exec_module`。(由 Brett Cannon " +"在 :issue:`42131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1541 msgid "" @@ -2952,8 +2971,8 @@ msgstr "最佳化" #: ../../whatsnew/3.10.rst:1548 msgid "" "Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster " -"(around 30--40% for small objects). (Contributed by Serhiy Storchaka in :" -"issue:`41334`.)" +"(around 30--40% for small objects). (Contributed by Serhiy Storchaka " +"in :issue:`41334`.)" msgstr "" "建構函式 :func:`str`、:func:`bytes` 和 :func:`bytearray` 現在更快了(對於小型" "物件大約快了 30--40%)。(由 Serhiy Storchaka 在 :issue:`41334` 中貢獻。)" @@ -2961,10 +2980,10 @@ msgstr "" #: ../../whatsnew/3.10.rst:1552 msgid "" "The :mod:`runpy` module now imports fewer modules. The ``python3 -m module-" -"name`` command startup time is 1.4x faster in average. On Linux, ``python3 -" -"I -m module-name`` imports 69 modules on Python 3.9, whereas it only imports " -"51 modules (-18) on Python 3.10. (Contributed by Victor Stinner in :issue:" -"`41006` and :issue:`41718`.)" +"name`` command startup time is 1.4x faster in average. On Linux, ``python3 " +"-I -m module-name`` imports 69 modules on Python 3.9, whereas it only " +"imports 51 modules (-18) on Python 3.10. (Contributed by Victor Stinner " +"in :issue:`41006` and :issue:`41718`.)" msgstr "" ":mod:`runpy` 模組現在引入更少的模組。``python3 -m module-name`` 指令啟動時間" "平均快了 1.4 倍。在 Linux 上,``python3 -I -m module-name`` 在 Python 3.9 上" @@ -2989,10 +3008,10 @@ msgid "" "When building Python with :option:`--enable-optimizations` now ``-fno-" "semantic-interposition`` is added to both the compile and link line. This " "speeds builds of the Python interpreter created with :option:`--enable-" -"shared` with ``gcc`` by up to 30%. See `this article <https://developers." -"redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-faster-" -"python-3-8-run-speeds/>`_ for more details. (Contributed by Victor Stinner " -"and Pablo Galindo in :issue:`38980`.)" +"shared` with ``gcc`` by up to 30%. See `this article <https://" +"developers.redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-" +"faster-python-3-8-run-speeds/>`_ for more details. (Contributed by Victor " +"Stinner and Pablo Galindo in :issue:`38980`.)" msgstr "" "當使用 :option:`--enable-optimizations` 建置 Python 時,現在 ``-fno-semantic-" "interposition`` 被新增到編譯和鏈接列 (link line) 中。這使得使用 :option:`--" @@ -3003,18 +3022,18 @@ msgstr "" #: ../../whatsnew/3.10.rst:1572 msgid "" -"Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` / :mod:" -"`zlib` modules, and add ``.readall()`` function to ``_compression." -"DecompressReader`` class. bz2 decompression is now 1.09x ~ 1.17x faster, " -"lzma decompression 1.20x ~ 1.32x faster, ``GzipFile.read(-1)`` 1.11x ~ 1.18x " -"faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:" -"`41486`)" +"Use a new output buffer management code " +"for :mod:`bz2` / :mod:`lzma` / :mod:`zlib` modules, and add ``.readall()`` " +"function to ``_compression.DecompressReader`` class. bz2 decompression is " +"now 1.09x ~ 1.17x faster, lzma decompression 1.20x ~ 1.32x faster, " +"``GzipFile.read(-1)`` 1.11x ~ 1.18x faster. (Contributed by Ma Lin, reviewed " +"by Gregory P. Smith, in :issue:`41486`)" msgstr "" "對 :mod:`bz2` / :mod:`lzma` / :mod:`zlib` 模組使用新的輸出緩衝區管理程式碼," "並將 ``.readall()`` 函式新增到 ``_compression.DecompressReader`` 類別。 bz2 " "解壓縮速度提高了 1.09x ~ 1.17x,lzma 解壓縮速度提高了 1.20x ~ 1.32x," -"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin 於 :issue:" -"`41486` 貢獻、由 Gregory P. Smith 審閱)" +"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin " +"於 :issue:`41486` 貢獻、由 Gregory P. Smith 審閱)" #: ../../whatsnew/3.10.rst:1578 msgid "" @@ -3037,33 +3056,35 @@ msgid "" "algorithm to avoid quadratic behavior on long strings. (Contributed by " "Dennis Sweeney in :issue:`41972`)" msgstr "" -"像是 ``str1 in str2`` 和 ``str2.find(str1)`` 之類的子字串搜索函式現在有時會使" -"用 Crochemore & Perrin 的「雙向」字串搜索演算法來避免作用於長字串上時發生二次" +"像是 ``str1 in str2`` 和 ``str2.find(str1)`` 之類的子字串搜尋函式現在有時會使" +"用 Crochemore & Perrin 的「雙向」字串搜尋演算法來避免作用於長字串上時發生二次" "方行為 (quadratic behavior)。(由 Dennis Sweeney 在 :issue:`41972` 中貢獻)" #: ../../whatsnew/3.10.rst:1590 msgid "" "Add micro-optimizations to ``_PyType_Lookup()`` to improve type attribute " "cache lookup performance in the common case of cache hits. This makes the " -"interpreter 1.04 times faster on average. (Contributed by Dino Viehland in :" -"issue:`43452`.)" +"interpreter 1.04 times faster on average. (Contributed by Dino Viehland " +"in :issue:`43452`.)" msgstr "" "向 ``_PyType_Lookup()`` 新增微最佳化以提高快取命中的常見情況下的型別屬性快取" -"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland 在 :issue:" -"`43452` 中貢獻。)" +"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland " +"在 :issue:`43452` 中貢獻。)" #: ../../whatsnew/3.10.rst:1594 msgid "" "The following built-in functions now support the faster :pep:`590` " -"vectorcall calling convention: :func:`map`, :func:`filter`, :func:" -"`reversed`, :func:`bool` and :func:`float`. (Contributed by Donghee Na and " -"Jeroen Demeyer in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:" -"`41873` and :issue:`41870`.)" -msgstr "" -"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣例::func:`map`、:" -"func:`filter`、:func:`reversed`、:func:`bool` 和 :func:`float`。(由 Donghee " -"Na 和 Jeroen Demeyer 在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:" -"issue:`41873` 和 :issue:`41870` 中貢獻。)" +"vectorcall calling " +"convention: :func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` " +"and :func:`float`. (Contributed by Donghee Na and Jeroen Demeyer " +"in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:`41873` " +"and :issue:`41870`.)" +msgstr "" +"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣" +"例::func:`map`、:func:`filter`、:func:`reversed`、:func:`bool` " +"和 :func:`float`。(由 Donghee Na 和 Jeroen Demeyer " +"在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:issue:`41873` " +"和 :issue:`41870` 中貢獻。)" #: ../../whatsnew/3.10.rst:1598 msgid "" @@ -3073,10 +3094,10 @@ msgid "" "in :mod:`gzip` and :mod:`lzma` have always been. (Contributed by Inada " "Naoki in :issue:`43785`.)" msgstr "" -"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使得 :" -"class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就像 :mod:" -"`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki 在 :issue:`43785` 中" -"貢獻。)" +"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使" +"得 :class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就" +"像 :mod:`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki " +"在 :issue:`43785` 中貢獻。)" #: ../../whatsnew/3.10.rst:1606 ../../whatsnew/3.10.rst:2212 msgid "Deprecated" @@ -3089,44 +3110,46 @@ msgid "" "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). Starting in this release, a " "deprecation warning is raised if the numeric literal is immediately followed " -"by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:" -"`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In future releases it " -"will be changed to syntax warning, and finally to syntax error. (Contributed " -"by Serhiy Storchaka in :issue:`43833`.)" +"by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In future releases it will be changed to syntax warning, " +"and finally to syntax error. (Contributed by Serhiy Storchaka " +"in :issue:`43833`.)" msgstr "" "目前 Python 接受緊跟關鍵字的數字字面值 (numeric literals),例如 ``0in x``、" "``1or x``、``0if 1else 2``。它允許了令人困惑和不明確的運算式,例如 ``[0x1for " "x in y]`` (可以直譯為 ``[0x1 for x in y]`` 或 ``[0x1f or x in y]`` )。從此" -"版本開始,如果數字字面值後緊跟關鍵字 :keyword:`and`、:keyword:`else`、:" -"keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` 與 :keyword:`or` " -"其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法警告,最後成為為" -"語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" +"版本開始,如果數字字面值後緊跟關鍵" +"字 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"與 :keyword:`or` 其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法" +"警告,最後成為為語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" #: ../../whatsnew/3.10.rst:1619 msgid "" "Starting in this release, there will be a concerted effort to begin cleaning " "up old import semantics that were kept for Python 2.7 compatibility. " -"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded by :meth:" -"`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader." -"load_module` (superseded by :meth:`~importlib.abc.Loader.exec_module`), :" -"meth:`!module_repr` (which the import system takes care of for you), the " +"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded " +"by :meth:`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader.load_module` " +"(superseded by :meth:`~importlib.abc.Loader.exec_module`), :meth:`!" +"module_repr` (which the import system takes care of for you), the " "``__package__`` attribute (superseded by ``__spec__.parent``), the " "``__loader__`` attribute (superseded by ``__spec__.loader``), and the " "``__cached__`` attribute (superseded by ``__spec__.cached``) will slowly be " -"removed (as well as other classes and methods in :mod:`importlib`). :exc:" -"`ImportWarning` and/or :exc:`DeprecationWarning` will be raised as " -"appropriate to help identify code which needs updating during this " -"transition." +"removed (as well as other classes and methods " +"in :mod:`importlib`). :exc:`ImportWarning` and/or :exc:`DeprecationWarning` " +"will be raised as appropriate to help identify code which needs updating " +"during this transition." msgstr "" "從這個版本開始,我們將齊心協力開始清理為相容 Python 2.7 而保留的舊引入語義。" -"具體來說, :meth:`!find_loader`/:meth:`!find_module` (被 :meth:`~importlib." -"abc.MetaPathFinder.find_spec` 取代)、:meth:`~importlib.abc.Loader." -"load_module` (被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!" -"module_repr` (引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__." -"parent`` 取代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 " -"``__cached__`` 屬性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:" -"`importlib` 中的其他類別和方法)。將酌情引發 :exc:`ImportWarning` 和/或 :exc:" -"`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" +"具體來說, :meth:`!find_loader`/:meth:`!find_module` " +"(被 :meth:`~importlib.abc.MetaPathFinder.find_spec` 取" +"代)、:meth:`~importlib.abc.Loader.load_module` " +"(被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!module_repr` " +"(引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__.parent`` 取" +"代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 ``__cached__`` 屬" +"性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:`importlib` 中的其他" +"類別和方法)。將酌情引發 :exc:`ImportWarning` 和/" +"或 :exc:`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" #: ../../whatsnew/3.10.rst:1636 msgid "" @@ -3135,28 +3158,29 @@ msgid "" "more information." msgstr "" "整個 ``distutils`` 命名空間已棄用,將在 Python 3.12 中刪除。請參閱\\ :ref:`模" -"組更改 <distutils-deprecated>` 以獲取更多資訊。" +"組更改 <distutils-deprecated>` 以取得更多資訊。" #: ../../whatsnew/3.10.rst:1640 msgid "" -"Non-integer arguments to :func:`random.randrange` are deprecated. The :exc:" -"`ValueError` is deprecated in favor of a :exc:`TypeError`. (Contributed by " -"Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" +"Non-integer arguments to :func:`random.randrange` are deprecated. " +"The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`. " +"(Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" msgstr "" ":func:`random.randrange` 的非整數引數已棄用。:exc:`ValueError` 已被棄用,取而" -"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger 在 :" -"issue:`37319` 中貢獻。)" +"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger " +"在 :issue:`37319` 中貢獻。)" #: ../../whatsnew/3.10.rst:1644 msgid "" "The various ``load_module()`` methods of :mod:`importlib` have been " -"documented as deprecated since Python 3.6, but will now also trigger a :exc:" -"`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` instead. " -"(Contributed by Brett Cannon in :issue:`26131`.)" +"documented as deprecated since Python 3.6, but will now also trigger " +"a :exc:`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` " +"instead. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" ":mod:`importlib` 的各種 ``load_module()`` 方法自 Python 3.6 起已被記錄為已棄" -"用,但現在也會觸發 :exc:`DeprecationWarning`。請改用 :meth:`~importlib.abc." -"Loader.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +"用,但現在也會觸發 :exc:`DeprecationWarning`。請改" +"用 :meth:`~importlib.abc.Loader.exec_module`。(由 Brett Cannon " +"在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1650 msgid "" @@ -3164,18 +3188,20 @@ msgid "" "for :meth:`~zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " "in :issue:`26131`.)" msgstr "" -":meth:`!zimport.zipimporter.load_module` 已被棄用,請用 :meth:`~zipimport." -"zipimporter.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +":meth:`!zimport.zipimporter.load_module` 已被棄用,請" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Brett Cannon " +"在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1654 msgid "" "The use of :meth:`~importlib.abc.Loader.load_module` by the import system " -"now triggers an :exc:`ImportWarning` as :meth:`~importlib.abc.Loader." -"exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" +"now triggers an :exc:`ImportWarning` " +"as :meth:`~importlib.abc.Loader.exec_module` is preferred. (Contributed by " +"Brett Cannon in :issue:`26131`.)" msgstr "" -"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸發 :exc:" -"`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是當前首選。" -"(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸" +"發 :exc:`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是目" +"前首選。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1659 msgid "" @@ -3188,78 +3214,86 @@ msgid "" msgstr "" "引入系統使用 :meth:`!importlib.abc.MetaPathFinder.find_module` 和 :meth:`!" "importlib.abc.PathEntryFinder.find_module` 現在會觸發 :exc:`ImportWarning`," -"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` 和 :meth:`importlib.abc." -"PathEntryFinder.find_spec` 分別是替代方案的首選。你可以使用 :func:`importlib." -"util.spec_from_loader` 來幫助移植。(由 Brett Cannon 在 :issue:`42134` 中貢" -"獻。)" +"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` " +"和 :meth:`importlib.abc.PathEntryFinder.find_spec` 分別是替代方案的首選。你可" +"以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " +"在 :issue:`42134` 中貢獻。)" #: ../../whatsnew/3.10.rst:1668 msgid "" "The use of :meth:`!importlib.abc.PathEntryFinder.find_loader` by the import " -"system now triggers an :exc:`ImportWarning` as :meth:`importlib.abc." -"PathEntryFinder.find_spec` is preferred. You can use :func:`importlib.util." -"spec_from_loader` to help in porting. (Contributed by Brett Cannon in :issue:" -"`43672`.)" +"system now triggers an :exc:`ImportWarning` " +"as :meth:`importlib.abc.PathEntryFinder.find_spec` is preferred. You can " +"use :func:`importlib.util.spec_from_loader` to help in porting. (Contributed " +"by Brett Cannon in :issue:`43672`.)" msgstr "" -"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸發 :" -"exc:`ImportWarning`,因為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是" -"首選。你可以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 " -"Brett Cannon 在 :issue:`43672` 中貢獻。)" +"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸" +"發 :exc:`ImportWarning`,因" +"為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是首選。你可以使" +"用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " +"在 :issue:`43672` 中貢獻。)" #: ../../whatsnew/3.10.rst:1674 msgid "" -"The various implementations of :meth:`!importlib.abc.MetaPathFinder." -"find_module` ( :meth:`!importlib.machinery.BuiltinImporter.find_module`, :" -"meth:`!importlib.machinery.FrozenImporter.find_module`, :meth:`!importlib." -"machinery.WindowsRegistryFinder.find_module`, :meth:`!importlib.machinery." -"PathFinder.find_module`, :meth:`!importlib.abc.MetaPathFinder." -"find_module` ), :meth:`!importlib.abc.PathEntryFinder.find_module` ( :meth:`!" -"importlib.machinery.FileFinder.find_module` ), and :meth:`!importlib.abc." -"PathEntryFinder.find_loader` ( :meth:`!importlib.machinery.FileFinder." -"find_loader` ) now raise :exc:`DeprecationWarning` and are slated for " -"removal in Python 3.12 (previously they were documented as deprecated in " -"Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" +"The various implementations of :meth:`!" +"importlib.abc.MetaPathFinder.find_module` ( :meth:`!" +"importlib.machinery.BuiltinImporter.find_module`, :meth:`!" +"importlib.machinery.FrozenImporter.find_module`, :meth:`!" +"importlib.machinery.WindowsRegistryFinder.find_module`, :meth:`!" +"importlib.machinery.PathFinder.find_module`, :meth:`!" +"importlib.abc.MetaPathFinder.find_module` ), :meth:`!" +"importlib.abc.PathEntryFinder.find_module` ( :meth:`!" +"importlib.machinery.FileFinder.find_module` ), and :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` ( :meth:`!" +"importlib.machinery.FileFinder.find_loader` ) now " +"raise :exc:`DeprecationWarning` and are slated for removal in Python 3.12 " +"(previously they were documented as deprecated in Python 3.4). (Contributed " +"by Brett Cannon in :issue:`42135`.)" msgstr "" ":meth:`!importlib.abc.MetaPathFinder.find_module` 的各種實作(:meth:`!" -"importlib.machinery.BuiltinImporter.find_module`、:meth:`!importlib." -"machinery.FrozenImporter.find_module`、:meth:`!importlib.machinery." -"WindowsRegistryFinder.find_module`、:meth:`!importlib.machinery.PathFinder." -"find_module`、:meth:`!importlib.abc.MetaPathFinder.find_module` )、:meth:`!" -"importlib.abc.PathEntryFinder.find_module` (:meth:`!importlib.machinery." -"FileFinder.find_module` ) 和 :meth:`!importlib.abc.PathEntryFinder." -"find_loader` (:meth:`!importlib.machinery.FileFinder.find_loader` ) 現在引" +"importlib.machinery.BuiltinImporter.find_module`、:meth:`!" +"importlib.machinery.FrozenImporter.find_module`、:meth:`!" +"importlib.machinery.WindowsRegistryFinder.find_module`、:meth:`!" +"importlib.machinery.PathFinder.find_module`、:meth:`!" +"importlib.abc.MetaPathFinder.find_module` )、:meth:`!" +"importlib.abc.PathEntryFinder.find_module` (:meth:`!" +"importlib.machinery.FileFinder.find_module` ) 和 :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` (:meth:`!" +"importlib.machinery.FileFinder.find_loader` ) 現在引" "發 :exc:`DeprecationWarning` 並計劃在 Python 3.12 中刪除(之前它們已在 " "Python 3.4 中被記錄為已棄用)。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" #: ../../whatsnew/3.10.rst:1689 msgid "" -":class:`!importlib.abc.Finder` is deprecated (including its sole method, :" -"meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` and :class:" -"`importlib.abc.PathEntryFinder` no longer inherit from the class. Users " -"should inherit from one of these two classes as appropriate instead. " +":class:`!importlib.abc.Finder` is deprecated (including its sole " +"method, :meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder` no longer inherit from the class. " +"Users should inherit from one of these two classes as appropriate instead. " "(Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" ":class:`!importlib.abc.Finder` 已被棄用(包括其唯一方法 :meth:`!" -"find_module`)。:class:`importlib.abc.MetaPathFinder` 和 :class:`importlib." -"abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據需求來選擇其一以繼承。" -"(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" +"find_module`)。:class:`importlib.abc.MetaPathFinder` " +"和 :class:`importlib.abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據" +"需求來選擇其一以繼承。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" #: ../../whatsnew/3.10.rst:1696 msgid "" "The deprecations of :mod:`!imp`, :func:`!importlib.find_loader`, :func:`!" -"importlib.util.set_package_wrapper`, :func:`!importlib.util." -"set_loader_wrapper`, :func:`!importlib.util.module_for_loader`, :class:`!" -"pkgutil.ImpImporter`, and :class:`!pkgutil.ImpLoader` have all been updated " -"to list Python 3.12 as the slated version of removal (they began raising :" -"exc:`DeprecationWarning` in previous versions of Python). (Contributed by " -"Brett Cannon in :issue:`43720`.)" -msgstr "" -"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!importlib.util." -"set_package_wrapper`、:func:`!importlib.util.set_loader_wrapper`、:func:`!" +"importlib.util.set_package_wrapper`, :func:`!" +"importlib.util.set_loader_wrapper`, :func:`!" +"importlib.util.module_for_loader`, :class:`!pkgutil.ImpImporter`, " +"and :class:`!pkgutil.ImpLoader` have all been updated to list Python 3.12 as " +"the slated version of removal (they began raising :exc:`DeprecationWarning` " +"in previous versions of Python). (Contributed by Brett Cannon " +"in :issue:`43720`.)" +msgstr "" +"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!" +"importlib.util.set_package_wrapper`、:func:`!" +"importlib.util.set_loader_wrapper`、:func:`!" "importlib.util.module_for_loader`、:class:`!pkgutil.ImpImporter` 和 :class:`!" "pkgutil.ImpLoader` 均已更新,將於 Python 3.12 列為預定的刪除版本(它們開始在" -"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon 在 :" -"issue:`43720` 中貢獻。)" +"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon " +"在 :issue:`43720` 中貢獻。)" #: ../../whatsnew/3.10.rst:1706 msgid "" @@ -3274,22 +3308,22 @@ msgstr "" #: ../../whatsnew/3.10.rst:1712 msgid "" -":meth:`!importlib.abc.Loader.module_repr`, :meth:`!importlib.machinery." -"FrozenLoader.module_repr`, and :meth:`!importlib.machinery.BuiltinLoader." -"module_repr` are deprecated and slated for removal in Python 3.12. " -"(Contributed by Brett Cannon in :issue:`42136`.)" +":meth:`!importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.machinery.FrozenLoader.module_repr`, and :meth:`!" +"importlib.machinery.BuiltinLoader.module_repr` are deprecated and slated for " +"removal in Python 3.12. (Contributed by Brett Cannon in :issue:`42136`.)" msgstr "" -":meth:`!importlib.abc.Loader.module_repr`、:meth:`!importlib.machinery." -"FrozenLoader.module_repr` 和 :meth:`!importlib.machinery.BuiltinLoader." -"module_repr` 已棄用並計劃在 Python 3.12 中刪除。(由 Brett Cannon 在 :issue:" -"`42136` 中貢獻。)" +":meth:`!importlib.abc.Loader.module_repr`、:meth:`!" +"importlib.machinery.FrozenLoader.module_repr` 和 :meth:`!" +"importlib.machinery.BuiltinLoader.module_repr` 已棄用並計劃在 Python 3.12 中" +"刪除。(由 Brett Cannon 在 :issue:`42136` 中貢獻。)" #: ../../whatsnew/3.10.rst:1718 msgid "" "``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python " "3.3, when it was made an alias to :class:`str`. It is now deprecated, " -"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland in :" -"issue:`42264`.)" +"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland " +"in :issue:`42264`.)" msgstr "" "自 Python 3.3 起,``sqlite3.OptimizedUnicode`` 就沒有文件記錄並且已過時,當時" "它被用作 :class:`str` 的別名。它現已被棄用,並計劃在 Python 3.12 中刪除。" @@ -3358,8 +3392,8 @@ msgid "" "3.12. Use :meth:`pathlib.Path.hardlink_to` instead. (Contributed by Barney " "Gale in :issue:`39950`.)" msgstr "" -":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改用 :" -"meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" +":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改" +"用 :meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" "獻。)" #: ../../whatsnew/3.10.rst:1756 @@ -3367,8 +3401,8 @@ msgid "" "``cgi.log()`` is deprecated and slated for removal in Python 3.12. " "(Contributed by Inada Naoki in :issue:`41139`.)" msgstr "" -"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki 在 :issue:" -"`41139` 中貢獻。)" +"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki " +"在 :issue:`41139` 中貢獻。)" #: ../../whatsnew/3.10.rst:1759 msgid "" @@ -3382,25 +3416,27 @@ msgstr "" msgid "" ":data:`!OP_NO_SSLv2`, :data:`!OP_NO_SSLv3`, :data:`!OP_NO_TLSv1`, :data:`!" "OP_NO_TLSv1_1`, :data:`!OP_NO_TLSv1_2`, and :data:`!OP_NO_TLSv1_3` are " -"replaced by :attr:`~ssl.SSLContext.minimum_version` and :attr:`~ssl." -"SSLContext.maximum_version`." +"replaced by :attr:`~ssl.SSLContext.minimum_version` " +"and :attr:`~ssl.SSLContext.maximum_version`." msgstr "" ":data:`!OP_NO_SSLv2`、:data:`!OP_NO_SSLv3`、:data:`!OP_NO_TLSv1`、:data:`!" "OP_NO_TLSv1_1`、:data:`!OP_NO_TLSv1_2`、和 :data:`!OP_NO_TLSv1_3` 已被替換" -"為 :attr:`~ssl.sslSSLContext.minimum_version` 和 :attr:`~ssl.sslSSLContext." -"maximum_version`。" +"為 :attr:`~ssl.sslSSLContext.minimum_version` " +"和 :attr:`~ssl.sslSSLContext.maximum_version`。" #: ../../whatsnew/3.10.rst:1768 msgid "" -":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!PROTOCOL_SSLv23`, :" -"data:`!PROTOCOL_TLSv1`, :data:`!PROTOCOL_TLSv1_1`, :data:`!" -"PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are deprecated in favor of :" -"const:`~ssl.PROTOCOL_TLS_CLIENT` and :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!" +"PROTOCOL_SSLv23`, :data:`!PROTOCOL_TLSv1`, :data:`!" +"PROTOCOL_TLSv1_1`, :data:`!PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are " +"deprecated in favor of :const:`~ssl.PROTOCOL_TLS_CLIENT` " +"and :const:`~ssl.PROTOCOL_TLS_SERVER`" msgstr "" -":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!PROTOCOL_SSLv23`、:" -"data:`!PROTOCOL_TLSv1`、:data:`!PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` " -"和 :const:`!PROTOCOL_TLS` 已棄用,取而代之的是 :const:`~ssl." -"PROTOCOL_TLS_CLIENT` 和 :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!" +"PROTOCOL_SSLv23`、:data:`!PROTOCOL_TLSv1`、:data:`!" +"PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` 和 :const:`!PROTOCOL_TLS` 已棄" +"用,取而代之的是 :const:`~ssl.PROTOCOL_TLS_CLIENT` " +"和 :const:`~ssl.PROTOCOL_TLS_SERVER`" #: ../../whatsnew/3.10.rst:1774 msgid ":func:`!wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" @@ -3416,11 +3452,11 @@ msgstr ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" #: ../../whatsnew/3.10.rst:1780 msgid "" -"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and :meth:`ssl." -"SSLContext.set_npn_protocols` are replaced by ALPN." +"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` " +"and :meth:`ssl.SSLContext.set_npn_protocols` are replaced by ALPN." msgstr "" -"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` 和 :meth:`ssl." -"SSLContext.set_npn_protocols` 已被 ALPN 取代。" +"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` " +"和 :meth:`ssl.SSLContext.set_npn_protocols` 已被 ALPN 取代。" #: ../../whatsnew/3.10.rst:1783 msgid "" @@ -3435,16 +3471,16 @@ msgstr "" #: ../../whatsnew/3.10.rst:1788 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" -"exc:`DeprecationWarning`. These submodules will be removed in a future " -"version of Python. Anything belonging to these submodules should be " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules will be removed in a " +"future version of Python. Anything belonging to these submodules should be " "imported directly from :mod:`typing` instead. (Contributed by Sebastian " "Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" -"`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這些子模組" -"的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau 在 :issue:" -"`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" +"出 :exc:`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這" +"些子模組的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau " +"在 :issue:`38291` 中貢獻。)" #: ../../whatsnew/3.10.rst:1797 ../../whatsnew/3.10.rst:2220 msgid "Removed" @@ -3454,8 +3490,8 @@ msgstr "已刪除" msgid "" "Removed special methods ``__int__``, ``__float__``, ``__floordiv__``, " "``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and " -"``__rdivmod__`` of the :class:`complex` class. They always raised a :exc:" -"`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" +"``__rdivmod__`` of the :class:`complex` class. They always raised " +"a :exc:`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" msgstr "" "刪除了 :class:`complex` 類別的特殊方法 ``__int__``、``__float__``、" "``__floordiv__``、``__mod__``、``__divmod__``、``__rfloordiv__``、" @@ -3467,8 +3503,8 @@ msgid "" "The ``ParserBase.error()`` method from the private and undocumented " "``_markupbase`` module has been removed. :class:`html.parser.HTMLParser` is " "the only subclass of ``ParserBase`` and its ``error()`` implementation was " -"already removed in Python 3.5. (Contributed by Berker Peksag in :issue:" -"`31844`.)" +"already removed in Python 3.5. (Contributed by Berker Peksag " +"in :issue:`31844`.)" msgstr "" "``_markupbase`` 模組中私有、未於文件記錄的 ``ParserBase.error()`` 方法已被刪" "除。:class:`html.parser.HTMLParser` 是 ``ParserBase`` 的唯一子類別,它的 " @@ -3479,12 +3515,12 @@ msgstr "" msgid "" "Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal " "PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was " -"moved to the internal C API. (Contributed by Victor Stinner in :issue:" -"`42157`.)" +"moved to the internal C API. (Contributed by Victor Stinner " +"in :issue:`42157`.)" msgstr "" "刪除了 ``unicodedata.ucnhash_CAPI`` 屬性,該屬性是內部 PyCapsule 物件。相關的" -"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner 在 :" -"issue:`42157` 中貢獻。)" +"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner " +"在 :issue:`42157` 中貢獻。)" #: ../../whatsnew/3.10.rst:1816 msgid "" @@ -3528,24 +3564,24 @@ msgid "" "now due to the :mod:`!_warnings` module was converted to a builtin module in " "2.6. (Contributed by Hai Shi in :issue:`42599`.)" msgstr "" -"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因為 :mod:" -"`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi 在 :issue:`42599` 中" -"貢獻。)" +"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因" +"為 :mod:`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi " +"在 :issue:`42599` 中貢獻。)" #: ../../whatsnew/3.10.rst:1837 msgid "" "Remove deprecated aliases to :ref:`collections-abstract-base-classes` from " -"the :mod:`collections` module. (Contributed by Victor Stinner in :issue:" -"`37324`.)" +"the :mod:`collections` module. (Contributed by Victor Stinner " +"in :issue:`37324`.)" msgstr "" "從 :mod:`collections` 模組中刪除已棄用的、對 :ref:`collections-abstract-base-" "classes` 的別名。(由 Victor Stinner 在 :issue:`37324` 中貢獻。)" #: ../../whatsnew/3.10.rst:1841 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" -"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " -"Python 3.8. The motivation behind this change is multifold:" +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " +"'s :doc:`high-level API <../library/asyncio-api-index>` following " +"deprecation in Python 3.8. The motivation behind this change is multifold:" msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。這一變化的背後動機是多方面的:" @@ -3560,7 +3596,7 @@ msgid "" "thread's running event loop since Python 3.7. There isn't a need to pass " "the event loop to the API in most normal use cases." msgstr "" -"自 Python 3.7 以來,高階 API 中的函式一直隱式獲取當前執行緒正在運行的事件循" +"自 Python 3.7 以來,高階 API 中的函式一直隱式取得目前執行緒正在運行的事件循" "環。在大多數正常用例中,不需要將事件循環傳遞給 API。" #: ../../whatsnew/3.10.rst:1849 @@ -3574,16 +3610,16 @@ msgid "" "Note that the low-level API will still accept ``loop``. See :ref:`changes-" "python-api` for examples of how to replace existing code." msgstr "" -"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參閱 :" -"ref:`changes-python-api`。" +"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參" +"閱 :ref:`changes-python-api`。" #: ../../whatsnew/3.10.rst:1855 ../../whatsnew/3.10.rst:1927 msgid "" "(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle " "Stanley in :issue:`42392`.)" msgstr "" -"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley 在 :issue:" -"`42392` 中貢獻。)" +"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley " +"在 :issue:`42392` 中貢獻。)" #: ../../whatsnew/3.10.rst:1860 ../../whatsnew/3.10.rst:2147 msgid "Porting to Python 3.10" @@ -3615,26 +3651,27 @@ msgstr "" #: ../../whatsnew/3.10.rst:1880 msgid "Changes in the Python API" -msgstr "Python API 的變化" +msgstr "Python API 的變更" #: ../../whatsnew/3.10.rst:1882 msgid "" -"The *etype* parameters of the :func:`~traceback.format_exception`, :func:" -"`~traceback.format_exception_only`, and :func:`~traceback.print_exception` " -"functions in the :mod:`traceback` module have been renamed to *exc*. " -"(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" +"The *etype* parameters of " +"the :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " +"and :func:`~traceback.print_exception` functions in the :mod:`traceback` " +"module have been renamed to *exc*. (Contributed by Zackery Spytz and " +"Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback." -"format_exception_only` 和 :mod:`traceback` 模組中的 :func:`~traceback." -"print_exception` 函式的 *etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 " -"Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " +"和 :mod:`traceback` 模組中的 :func:`~traceback.print_exception` 函式的 " +"*etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 Matthias Bussonnier " +"在 :issue:`26389` 中貢獻。)" #: ../../whatsnew/3.10.rst:1888 msgid "" -":mod:`atexit`: At Python exit, if a callback registered with :func:`atexit." -"register` fails, its exception is now logged. Previously, only some " -"exceptions were logged, and the last exception was always silently ignored. " -"(Contributed by Victor Stinner in :issue:`42639`.)" +":mod:`atexit`: At Python exit, if a callback registered " +"with :func:`atexit.register` fails, its exception is now logged. Previously, " +"only some exceptions were logged, and the last exception was always silently " +"ignored. (Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" ":mod:`atexit`:在 Python 退出時,如果一個使用 :func:`atexit.register` 註冊的" "回呼 (callback) 失敗,該例外現在會被記錄下來。在以前只記錄一些例外,並且最後" @@ -3649,34 +3686,35 @@ msgid "" "accesses the arguments via :func:`typing.get_args` or ``__args__`` need to " "account for this change. Furthermore, :exc:`TypeError` may be raised for " "invalid forms of parameterizing :class:`collections.abc.Callable` which may " -"have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" -msgstr "" -":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似於 :data:" -"`typing.Callable` 目前的做法。這意味著 ``collections.abc.Callable[[int, " -"str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;以前這是 ``([int, " -"str], str)``。透過 :func:`typing.get_args` 或 ``__args__`` 存取參數的程式碼需" -"要考慮此變更。此外,對於無效形式的參數化 :class:`collections.abc.Callable`," -"可能會引發 :exc:`TypeError`,而在 Python 3.9 中,該參數可能已被默默地傳遞。" -"(由 Ken Jin 在 :issue:`42195` 中貢獻。)" +"have passed silently in Python 3.9. (Contributed by Ken Jin " +"in :issue:`42195`.)" +msgstr "" +":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似" +"於 :data:`typing.Callable` 目前的做法。這意味著 " +"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " +"``__args__``;以前這是 ``([int, str], str)``。透過 :func:`typing.get_args` " +"或 ``__args__`` 存取參數的程式碼需要考慮此變更。此外,對於無效形式的參數" +"化 :class:`collections.abc.Callable`,可能會引發 :exc:`TypeError`,而在 " +"Python 3.9 中,該參數可能已被默默地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1904 msgid "" ":meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError` " "instead of :exc:`DeprecationWarning` if the given parameter will not fit in " -"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland in :issue:" -"`42393`.)" +"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland " +"in :issue:`42393`.)" msgstr "" -"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned integer),:meth:" -"`socket.htons` 和 :meth:`socket.ntohs` 現在會引發 :exc:`OverflowError` 而不" -"是 :exc:`DeprecationWarning`。(由 Erlend E. Aasland 在 :issue:`42393` 中貢" -"獻。)" +"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned " +"integer),:meth:`socket.htons` 和 :meth:`socket.ntohs` 現在會引" +"發 :exc:`OverflowError` 而不是 :exc:`DeprecationWarning`。(由 Erlend E. " +"Aasland 在 :issue:`42393` 中貢獻。)" #: ../../whatsnew/3.10.rst:1909 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" -"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " -"Python 3.8." +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " +"'s :doc:`high-level API <../library/asyncio-api-index>` following " +"deprecation in Python 3.8." msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。" @@ -3711,24 +3749,25 @@ msgid "" "running event loop (e.g. running in another thread's event loop), consider " "using :func:`asyncio.run_coroutine_threadsafe` instead." msgstr "" -"如果 ``foo()`` 被專門設計為 *不* 在當前執行緒的事件循環中運行(例如在另一個執" +"如果 ``foo()`` 被專門設計為 *不* 在目前執行緒的事件循環中運行(例如在另一個執" "行緒的事件循環中運行),請考慮改用 :func:`asyncio.run_coroutine_threadsafe`。" #: ../../whatsnew/3.10.rst:1930 msgid "" "The :data:`types.FunctionType` constructor now inherits the current builtins " "if the *globals* dictionary has no ``\"__builtins__\"`` key, rather than " -"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` and :" -"func:`exec` functions. Defining a function with ``def function(...): ...`` " -"in Python is not affected, globals cannot be overridden with this syntax: it " -"also inherits the current builtins. (Contributed by Victor Stinner in :issue:" -"`42990`.)" -msgstr "" -"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵,則 :data:`types." -"FunctionType` 建構函式現在會繼承當前的內建物件,而不是使用 ``{\"None\": None}" -"``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 Python 中使用 ``def " -"function(...): ...`` 定義函式不受影響,全域變數不能用此語法覆蓋:它也繼承當前" -"的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢獻。)" +"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` " +"and :func:`exec` functions. Defining a function with ``def " +"function(...): ...`` in Python is not affected, globals cannot be overridden " +"with this syntax: it also inherits the current builtins. (Contributed by " +"Victor Stinner in :issue:`42990`.)" +msgstr "" +"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵," +"則 :data:`types.FunctionType` 建構函式現在會繼承目前的內建物件,而不是使用 " +"``{\"None\": None}``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 " +"Python 中使用 ``def function(...): ...`` 定義函式不受影響,全域變數不能用此語" +"法覆蓋:它也繼承目前的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1939 msgid "Changes in the C API" @@ -3782,14 +3821,15 @@ msgstr "" msgid "" "To compile a file given a ``char *`` filename, explicitly open the file, " "read it and compile the result. One way to do this is using the :py:mod:`io` " -"module with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :" -"c:func:`PyBytes_AsString` and :c:func:`Py_CompileString`, as sketched below. " -"(Declarations and error handling are omitted.) ::" +"module " +"with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :c:func:`PyBytes_AsString` " +"and :c:func:`Py_CompileString`, as sketched below. (Declarations and error " +"handling are omitted.) ::" msgstr "" "要編譯給定 ``char *`` 檔案名稱的檔案,請顯式打開該檔案,讀取它並編譯結果。一" -"種方法是使用 :py:mod:`io` 模組和 :c:func:`PyImport_ImportModule`、:c:func:" -"`PyObject_CallMethod`、:c:func:`PyBytes_AsString` 和 :c:func:" -"`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" +"種方法是使用 :py:mod:`io` 模組" +"和 :c:func:`PyImport_ImportModule`、:c:func:`PyObject_CallMethod`、:c:func:`PyBytes_AsString` " +"和 :c:func:`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" #: ../../whatsnew/3.10.rst:1966 msgid "" @@ -3816,8 +3856,8 @@ msgid "" "string. This means that this number needs to be multiplied by 2 to be used " "with APIs that expect a byte offset instead (like :c:func:`PyCode_Addr2Line` " "for example). Notice as well that the :attr:`!f_lasti` member of " -"``FrameObject`` objects is not considered stable: please use :c:func:" -"`PyFrame_GetLineNumber` instead." +"``FrameObject`` objects is not considered stable: please " +"use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" "對於 ``FrameObject`` 物件,:attr:`~frame.f_lasti` 成員現在表示了字碼偏移量 " "(wordcode offset),而不是位元組碼字串的簡單偏移量。這意味著這個數字需要乘以 " @@ -3871,8 +3911,8 @@ msgid "" "The :mod:`atexit` module must now always be built as a built-in module. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner 在 :issue:" -"`42639` 中貢獻。)" +":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner " +"在 :issue:`42639` 中貢獻。)" #: ../../whatsnew/3.10.rst:2004 msgid "" @@ -3881,8 +3921,8 @@ msgid "" "Petazzoni and Peixing Xin in :issue:`27640`.)" msgstr "" "將 :option:`--disable-test-modules` 選項新增到 ``configure`` 腳本中:不建置也" -"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin 在 :" -"issue:`27640` 中貢獻。)" +"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin " +"在 :issue:`27640` 中貢獻。)" #: ../../whatsnew/3.10.rst:2008 msgid "" @@ -3901,12 +3941,12 @@ msgstr "" msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" -"share/python-wheels/`` directory and don't install the ``ensurepip." -"_bundled`` package." +"share/python-wheels/`` directory and don't install the " +"``ensurepip._bundled`` package." msgstr "" "一些 Linux 發行版的打包策略建議不要一併包入依賴項目。例如,Fedora 在 ``/usr/" -"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 ``ensurepip." -"_bundled`` 套件。" +"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 " +"``ensurepip._bundled`` 套件。" #: ../../whatsnew/3.10.rst:2019 msgid "(Contributed by Victor Stinner in :issue:`42856`.)" @@ -3919,8 +3959,8 @@ msgid "" "library and not install the ``python.o`` object file." msgstr "" "新增 :option:`configure --without-static-libpython 選項 <--without-static-" -"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 ``python." -"o`` 目標檔案。" +"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 " +"``python.o`` 目標檔案。" #: ../../whatsnew/3.10.rst:2025 msgid "(Contributed by Victor Stinner in :issue:`43103`.)" @@ -3966,8 +4006,9 @@ msgid "" "and ABI stability guarantees along with best practices for using the Stable " "ABI." msgstr "" -"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定義。 :" -"ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實踐。" +"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定" +"義。 :ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實" +"踐。" #: ../../whatsnew/3.10.rst:2050 msgid "(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)" @@ -3975,9 +4016,9 @@ msgstr "(由 Petr Viktorin 在 :pep:`652` 和 :issue:`43795` 中貢獻。)" #: ../../whatsnew/3.10.rst:2055 msgid "" -"The result of :c:func:`PyNumber_Index` now always has exact type :class:" -"`int`. Previously, the result could have been an instance of a subclass of " -"``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" +"The result of :c:func:`PyNumber_Index` now always has exact " +"type :class:`int`. Previously, the result could have been an instance of a " +"subclass of ``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" msgstr "" ":c:func:`PyNumber_Index` 的結果現在都具有精確的 :class:`int` 型別。在以前,結" "果可能是 ``int`` 子類別的實例。(由 Serhiy Storchaka 在 :issue:`40792` 中貢" @@ -3990,27 +4031,28 @@ msgid "" "Python executable. (Contributed by Victor Stinner in :issue:`23427`.)" msgstr "" "將新的 :c:member:`~PyConfig.orig_argv` 成員新增到 :c:type:`PyConfig` 結構:傳" -"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner 在 :issue:" -"`23427` 中貢獻。)" +"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner " +"在 :issue:`23427` 中貢獻。)" #: ../../whatsnew/3.10.rst:2064 msgid "" -"The :c:func:`PyDateTime_DATE_GET_TZINFO` and :c:func:" -"`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing the " -"``tzinfo`` attributes of :class:`datetime.datetime` and :class:`datetime." -"time` objects. (Contributed by Zackery Spytz in :issue:`30155`.)" +"The :c:func:`PyDateTime_DATE_GET_TZINFO` " +"and :c:func:`PyDateTime_TIME_GET_TZINFO` macros have been added for " +"accessing the ``tzinfo`` attributes of :class:`datetime.datetime` " +"and :class:`datetime.time` objects. (Contributed by Zackery Spytz " +"in :issue:`30155`.)" msgstr "" -"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` 和 :c:func:" -"`PyDateTime_TIME_GET_TZINFO` 巨集,用於存取 :class:`datetime.datetime` 和 :" -"class:`datetime.time` 物件的 ``tzinfo`` 屬性。(由 Zackery Spytz 在 :issue:" -"`30155` 中貢獻。)" +"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` " +"和 :c:func:`PyDateTime_TIME_GET_TZINFO` 巨集,用於存" +"取 :class:`datetime.datetime` 和 :class:`datetime.time` 物件的 ``tzinfo`` 屬" +"性。(由 Zackery Spytz 在 :issue:`30155` 中貢獻。)" #: ../../whatsnew/3.10.rst:2070 msgid "" "Add a :c:func:`PyCodec_Unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" -"新增 :c:func:`PyCodec_Unregister` 函式來取消註冊編解碼器搜索函式。(由 Hai " +"新增 :c:func:`PyCodec_Unregister` 函式來取消註冊編解碼器搜尋函式。(由 Hai " "Shi 在 :issue:`41842` 中貢獻。)" #: ../../whatsnew/3.10.rst:2074 @@ -4032,13 +4074,13 @@ msgstr "" #: ../../whatsnew/3.10.rst:2081 msgid "" -"Add :c:func:`PyModule_AddObjectRef` function: similar to :c:func:" -"`PyModule_AddObject` but don't steal a reference to the value on success. " -"(Contributed by Victor Stinner in :issue:`1635741`.)" +"Add :c:func:`PyModule_AddObjectRef` function: similar " +"to :c:func:`PyModule_AddObject` but don't steal a reference to the value on " +"success. (Contributed by Victor Stinner in :issue:`1635741`.)" msgstr "" -"新增 :c:func:`PyModule_AddObjectRef` 函式:類似於 :c:func:" -"`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor Stinner 在 :issue:" -"`1635741` 中貢獻。)" +"新增 :c:func:`PyModule_AddObjectRef` 函式:類似" +"於 :c:func:`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor " +"Stinner 在 :issue:`1635741` 中貢獻。)" #: ../../whatsnew/3.10.rst:2086 msgid "" @@ -4051,9 +4093,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2090 msgid "" -"The :c:func:`PyType_FromSpecWithBases` and :c:func:" -"`PyType_FromModuleAndSpec` functions now accept a single class as the " -"*bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" +"The :c:func:`PyType_FromSpecWithBases` " +"and :c:func:`PyType_FromModuleAndSpec` functions now accept a single class " +"as the *bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" msgstr "" ":c:func:`PyType_FromSpecWithBases` 和 :c:func:`PyType_FromModuleAndSpec` 函式" "現在接受單個類別作為 *bases* 引數。(由 Serhiy Storchaka 在 :issue:`42423` 中" @@ -4097,12 +4139,12 @@ msgid "" "The limited C API is now supported if :ref:`Python is built in debug mode " "<debug-build>` (if the ``Py_DEBUG`` macro is defined). In the limited C API, " "the :c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now " -"implemented as opaque function calls, rather than accessing directly the :c:" -"member:`PyObject.ob_refcnt` member, if Python is built in debug mode and the " -"``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became possible to " -"support the limited C API in debug mode because the :c:type:`PyObject` " -"structure is the same in release and debug mode since Python 3.8 (see :issue:" -"`36465`)." +"implemented as opaque function calls, rather than accessing directly " +"the :c:member:`PyObject.ob_refcnt` member, if Python is built in debug mode " +"and the ``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became " +"possible to support the limited C API in debug mode because " +"the :c:type:`PyObject` structure is the same in release and debug mode since " +"Python 3.8 (see :issue:`36465`)." msgstr "" "如 :ref:`Python 是在除錯模式 (debug mode) <debug-build>` 下建置的(如果有定" "義 ``Py_DEBUG`` 巨集),現在會支援受限 C API。在受限 C API 中,如果 Python 是" @@ -4115,8 +4157,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:2120 msgid "" "The limited C API is still not supported in the :option:`--with-trace-refs` " -"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner in :" -"issue:`43688`.)" +"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner " +"in :issue:`43688`.)" msgstr "" ":option:`--with-trace-refs` 特殊建置(``Py_TRACE_REFS`` 巨集)仍不支援受限 C " "API。(由 Victor Stinner 在 :issue:`43688` 中貢獻。)" @@ -4124,28 +4166,29 @@ msgstr "" #: ../../whatsnew/3.10.rst:2124 msgid "" "Add the :c:func:`Py_Is(x, y) <Py_Is>` function to test if the *x* object is " -"the *y* object, the same as ``x is y`` in Python. Add also the :c:func:" -"`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions to test if " -"an object is, respectively, the ``None`` singleton, the ``True`` singleton " -"or the ``False`` singleton. (Contributed by Victor Stinner in :issue:" -"`43753`.)" +"the *y* object, the same as ``x is y`` in Python. Add also " +"the :c:func:`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions " +"to test if an object is, respectively, the ``None`` singleton, the ``True`` " +"singleton or the ``False`` singleton. (Contributed by Victor Stinner " +"in :issue:`43753`.)" msgstr "" "新增 :c:func:`Py_Is(x, y) <Py_Is>` 函式來測試 *x* 物件是否為 *y* 物件,與 " -"Python 中的 ``x is y`` 相同。還新增 :c:func:`Py_IsNone`、:c:func:" -"`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別測試物件是否為 ``None`` 單例、 " -"``True`` 單例或 ``False`` 單例。(由 Victor Stinner 在 :issue:`43753` 中貢" -"獻。)" +"Python 中的 ``x is y`` 相同。還新" +"增 :c:func:`Py_IsNone`、:c:func:`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別" +"測試物件是否為 ``None`` 單例、 ``True`` 單例或 ``False`` 單例。(由 Victor " +"Stinner 在 :issue:`43753` 中貢獻。)" #: ../../whatsnew/3.10.rst:2131 msgid "" -"Add new functions to control the garbage collector from C code: :c:func:" -"`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. These " -"functions allow to activate, deactivate and query the state of the garbage " -"collector from C code without having to import the :mod:`gc` module." +"Add new functions to control the garbage collector from C " +"code: :c:func:`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. " +"These functions allow to activate, deactivate and query the state of the " +"garbage collector from C code without having to import the :mod:`gc` module." msgstr "" -"新增函式以從 C 程式碼控制垃圾收集器::c:func:`PyGC_Enable()`、:c:func:" -"`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。這些函式使得能夠從 C 程式碼啟" -"用、停用和查詢垃圾收集器的狀態,而無需引入 :mod:`gc` 模組。" +"新增函式以從 C 程式碼控制垃圾收集" +"器::c:func:`PyGC_Enable()`、:c:func:`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。" +"這些函式使得能夠從 C 程式碼啟用、停用和查詢垃圾收集器的狀態,而無需引" +"入 :mod:`gc` 模組。" #: ../../whatsnew/3.10.rst:2138 msgid "" @@ -4162,21 +4205,21 @@ msgid "" "(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)" msgstr "" "新增 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標用於建立不可變型別物件:無法" -"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland 在 :issue:" -"`43908` 中貢獻。)" +"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland " +"在 :issue:`43908` 中貢獻。)" #: ../../whatsnew/3.10.rst:2149 msgid "" -"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use :c:func:" -"`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use ``#``: " -"``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. See :" -"ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner in :issue:" -"`40943`.)" +"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to " +"use :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use " +"``#``: ``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. " +"See :ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner " +"in :issue:`40943`.)" msgstr "" -"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` 和 :" -"c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、``s#``、" -"``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` 和 :pep:" -"`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" +"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` " +"和 :c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、" +"``s#``、``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` " +"和 :pep:`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" #: ../../whatsnew/3.10.rst:2155 msgid "" @@ -4210,9 +4253,9 @@ msgid "" "for historical reason. It is no longer allowed. (Contributed by Victor " "Stinner in :issue:`40839`.)" msgstr "" -"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼叫 :c:func:" -"`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner 在 :issue:" -"`40839` 中貢獻。)" +"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼" +"叫 :c:func:`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner " +"在 :issue:`40839` 中貢獻。)" #: ../../whatsnew/3.10.rst:2170 msgid "" @@ -4237,57 +4280,58 @@ msgstr "" #: ../../whatsnew/3.10.rst:2179 msgid "" -":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:" -"func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and :c:func:" -"`Py_GetProgramName` functions now return ``NULL`` if called before :c:func:" -"`Py_Initialize` (before Python is initialized). Use the new :ref:`init-" -"config` API to get the :ref:`init-path-config`. (Contributed by Victor " -"Stinner in :issue:`42260`.)" +":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` " +"and :c:func:`Py_GetProgramName` functions now return ``NULL`` if called " +"before :c:func:`Py_Initialize` (before Python is initialized). Use the " +"new :ref:`init-config` API to get the :ref:`init-path-config`. (Contributed " +"by Victor Stinner in :issue:`42260`.)" msgstr "" -"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼叫,:c:func:" -"`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:" -"`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` 和 :c:func:" -"`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-config` API 來獲" -"取 :ref:`init-path-config`。(由 Victor Stinner 在 :issue:`42260` 中貢獻。)" +"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼" +"叫,:c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` " +"和 :c:func:`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-" +"config` API 來取得 :ref:`init-path-config`。(由 Victor Stinner " +"在 :issue:`42260` 中貢獻。)" #: ../../whatsnew/3.10.rst:2186 msgid "" -":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and :c:func:" -"`PyCell_SET` macros can no longer be used as l-value or r-value. For " -"example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) = " -"x`` now fail with a compiler error. It prevents bugs like ``if " +":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` " +"and :c:func:`PyCell_SET` macros can no longer be used as l-value or r-value. " +"For example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) " +"= x`` now fail with a compiler error. It prevents bugs like ``if " "(PyList_SET_ITEM (a, b, c) < 0) ...`` test. (Contributed by Zackery Spytz " "and Victor Stinner in :issue:`30459`.)" msgstr "" -":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` 和 :c:func:" -"`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如,``x = " -"PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失敗並出" -"現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` 測試之" -"類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢獻。)" +":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` " +"和 :c:func:`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如," +"``x = PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失" +"敗並出現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` " +"測試之類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:2193 msgid "" "The non-limited API files ``odictobject.h``, ``parser_interface.h``, " -"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, ``pyfpe." -"h``, and ``pytime.h`` have been moved to the ``Include/cpython`` directory. " -"These files must not be included directly, as they are already included in " -"``Python.h``; see :ref:`api-includes`. If they have been included directly, " -"consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :" -"issue:`35134`.)" -msgstr "" -"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、``picklebufobject." -"h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、``pyfpe.h`` 和 ``pytime." -"h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接被引入,因為它們已於 " -"``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直接引入它們,請考慮改為" -"引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` 中貢獻。)" +"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, " +"``pyfpe.h``, and ``pytime.h`` have been moved to the ``Include/cpython`` " +"directory. These files must not be included directly, as they are already " +"included in ``Python.h``; see :ref:`api-includes`. If they have been " +"included directly, consider including ``Python.h`` instead. (Contributed by " +"Nicholas Sim in :issue:`35134`.)" +msgstr "" +"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、" +"``picklebufobject.h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、" +"``pyfpe.h`` 和 ``pytime.h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接" +"被引入,因為它們已於 ``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直" +"接引入它們,請考慮改為引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:2201 msgid "" "Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable " "type objects. Do not rely on :c:macro:`Py_TPFLAGS_HEAPTYPE` to decide if a " "type object is mutable or not; check if :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` " -"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland in :" -"issue:`43908`.)" +"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland " +"in :issue:`43908`.)" msgstr "" "使用 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標來建立不可變型別物件。不要依" "賴 :c:macro:`Py_TPFLAGS_HEAPTYPE` 來決定型別物件是否可變;應改為檢查是否設定" @@ -4323,27 +4367,27 @@ msgstr "" #: ../../whatsnew/3.10.rst:2225 msgid "" -"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or :c:macro:" -"`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` " +"or :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" -"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` 或 :c:macro:" -"`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` " +"或 :c:macro:`PyUnicode_GET_LENGTH`" #: ../../whatsnew/3.10.rst:2227 msgid "" -"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" -"`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` " +"or :c:func:`PyUnicode_FromFormat`" msgstr "" -"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" -"`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` " +"或 :c:func:`PyUnicode_FromFormat`" #: ../../whatsnew/3.10.rst:2229 msgid "" -"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use :c:func:" -"`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: " +"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使用 :c:func:" -"`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使" +"用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" #: ../../whatsnew/3.10.rst:2231 msgid "``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`" @@ -4355,11 +4399,11 @@ msgstr "``Py_UNICODE_strncmp``:使用 :c:func:`PyUnicode_Tailmatch`" #: ../../whatsnew/3.10.rst:2233 msgid "" -"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use :c:func:" -"`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: " +"use :c:func:`PyUnicode_FindChar`" msgstr "" -"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使用 :c:func:" -"`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使" +"用 :c:func:`PyUnicode_FindChar`" #: ../../whatsnew/3.10.rst:2236 msgid "" @@ -4371,17 +4415,18 @@ msgstr "" #: ../../whatsnew/3.10.rst:2239 msgid "" -"Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:" -"`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki in :issue:`41103`.)" +"Removed ``PyLong_FromUnicode()``. Please migrate " +"to :c:func:`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki " +"in :issue:`41103`.)" msgstr "" "刪除了 ``PyLong_FromUnicode()``。請改用 :c:func:`PyLong_FromUnicodeObject`。" "(由 Inada Naoki 在 :issue:`41103` 中貢獻。)" #: ../../whatsnew/3.10.rst:2242 msgid "" -"Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:" -"`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` (Contributed " -"by Inada Naoki in :issue:`41103`.)" +"Removed ``PyUnicode_AsUnicodeCopy()``. Please " +"use :c:func:`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` " +"(Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" "刪除了 ``PyUnicode_AsUnicodeCopy()``。請改用 :c:func:`PyUnicode_AsUCS4Copy` " "或 :c:func:`PyUnicode_AsWideCharString` (由 Inada Naoki 在 :issue:`41103` 中" @@ -4400,9 +4445,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2250 msgid "" "Removed undocumented macros ``Py_ALLOW_RECURSION`` and " -"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:" -"type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka in :" -"issue:`41936`.)" +"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of " +"the :c:type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka " +"in :issue:`41936`.)" msgstr "" "刪除了未被說明文件記錄的巨集 ``Py_ALLOW_RECURSION`` 和 " "``Py_END_ALLOW_RECURSION`` 以及 :c:type:`PyInterpreterState` 結構的 " @@ -4411,8 +4456,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2255 msgid "" "Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing " -"Python already implicitly installs signal handlers: see :c:member:`PyConfig." -"install_signal_handlers`. (Contributed by Victor Stinner in :issue:`41713`.)" +"Python already implicitly installs signal handlers: " +"see :c:member:`PyConfig.install_signal_handlers`. (Contributed by Victor " +"Stinner in :issue:`41713`.)" msgstr "" "刪除了未被說明文件記錄的 ``PyOS_InitInterrupts()`` 函式。初始化 Python 已經隱" "式安裝信號處理程式:請參閱 :c:member:`PyConfig.install_signal_handlers`。" @@ -4463,8 +4509,8 @@ msgid "" "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" -"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 ``symtable." -"h`` 標頭檔被排除在受限 C API 之外而無法使用。" +"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 " +"``symtable.h`` 標頭檔被排除在受限 C API 之外而無法使用。" #: ../../whatsnew/3.10.rst:2278 msgid "" @@ -4498,8 +4544,8 @@ msgstr "" "刪除 ``ast.h``、``asdl.h`` 和 ``Python-ast.h`` 標頭檔。這些函式沒有文件記錄," "並且被排除在受限 C API 之外。這些標頭檔定義的大多數名稱都沒有前綴 ``Py``,因" "此可能會產生名稱衝突。例如,``Python-ast.h`` 定義了一個 ``Yield`` 巨集,它與 " -"Windows ``<winbase.h>`` 標頭使用的 ``Yield`` 有名稱衝突。請改用 Python :mod:" -"`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" +"Windows ``<winbase.h>`` 標頭使用的 ``Yield`` 有名稱衝突。請改用 " +"Python :mod:`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" #: ../../whatsnew/3.10.rst:2295 msgid "" @@ -4553,8 +4599,8 @@ msgid "" "These functions were undocumented and excluded from the limited C API. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner 在 :" -"issue:`43244` 中貢獻。)" +"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner " +"在 :issue:`43244` 中貢獻。)" #: ../../whatsnew/3.10.rst:2312 msgid "Remove the ``pyarena.h`` header file with functions:" @@ -4579,8 +4625,8 @@ msgstr "``PyArena_AddPyObject()``" #: ../../whatsnew/3.10.rst:2319 msgid "" "These functions were undocumented, excluded from the limited C API, and were " -"only used internally by the compiler. (Contributed by Victor Stinner in :" -"issue:`43244`.)" +"only used internally by the compiler. (Contributed by Victor Stinner " +"in :issue:`43244`.)" msgstr "" "這些函式沒有文件記錄、被排除在受限 C API 之外,並僅被編譯器於內部使用。(由 " "Victor Stinner 在 :issue:`43244` 中貢獻。)" @@ -4619,8 +4665,8 @@ msgid "" "The deprecated :mod:`!mailcap` module now refuses to inject unsafe text " "(filenames, MIME types, parameters) into shell commands. Instead of using " "such text, it will warn and act as if a match was not found (or for test " -"commands, as if the test failed). (Contributed by Petr Viktorin in :gh:" -"`98966`.)" +"commands, as if the test failed). (Contributed by Petr Viktorin " +"in :gh:`98966`.)" msgstr "" #: ../../whatsnew/3.10.rst:2350 diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 0d18eb3a67..468df5d85e 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -33,8 +33,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.11.rst:47 msgid "" "This article explains the new features in Python 3.11, compared to 3.10. " -"Python 3.11 was released on October 24, 2022. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.11 was released on October 24, 2022. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "此文章解釋了 Python 3.11 和 3.10 相比多了哪些新功能。Python 3.11 於 2022 年 " "10 月 24 日發布。完整細節請見 :ref:`changelog`。" @@ -46,8 +46,8 @@ msgstr "發布重點摘要" #: ../../whatsnew/3.11.rst:60 msgid "" "Python 3.11 is between 10-60% faster than Python 3.10. On average, we " -"measured a 1.25x speedup on the standard benchmark suite. See :ref:" -"`whatsnew311-faster-cpython` for details." +"measured a 1.25x speedup on the standard benchmark suite. " +"See :ref:`whatsnew311-faster-cpython` for details." msgstr "" "Python 3.11 比 Python 3.10 快了 10-60%。我們使用了標準基準量測套裝軟體 " "(benchmark suite) 測得平均加速了 1.25x。細節請見\\ :ref:`whatsnew311-faster-" @@ -244,13 +244,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:159 msgid "" "Additionally, the information used by the enhanced traceback feature is made " -"available via a general API, that can be used to correlate :term:`bytecode` :" -"ref:`instructions <bytecodes>` with source code location. This information " -"can be retrieved using:" +"available via a general API, that can be used to " +"correlate :term:`bytecode` :ref:`instructions <bytecodes>` with source code " +"location. This information can be retrieved using:" msgstr "" -"此外,強化回溯特性所使用的資訊可以透過一般的 API 來取得,以用來使 :term:" -"`bytecode` :ref:`指示 (instruction) <bytecodes>`\\ 與原始碼位置相互關聯。此項" -"資訊可以用以下方式取得:" +"此外,強化回溯特性所使用的資訊可以透過一般的 API 來取得,以用來" +"使 :term:`bytecode` :ref:`指示 (instruction) <bytecodes>`\\ 與原始碼位置相互" +"關聯。此項資訊可以用以下方式取得:" #: ../../whatsnew/3.11.rst:164 msgid "The :meth:`codeobject.co_positions` method in Python." @@ -265,8 +265,8 @@ msgid "" "See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan " "Taskaya and Ammar Askar in :issue:`43950`.)" msgstr "" -"詳情請見 :pep:`657`。(由 Pablo Galindo、Batuhan Taskaya 與 Ammar Askar 於 :" -"issue:`43950` 中所貢獻。)" +"詳情請見 :pep:`657`。(由 Pablo Galindo、Batuhan Taskaya 與 Ammar Askar " +"於 :issue:`43950` 中所貢獻。)" #: ../../whatsnew/3.11.rst:171 msgid "" @@ -274,8 +274,8 @@ msgid "" "may result in a small increase in interpreter memory usage and disk usage " "for compiled Python files. To avoid storing the extra information and " "deactivate printing the extra traceback information, use the :option:`-X " -"no_debug_ranges <-X>` command line option or the :envvar:" -"`PYTHONNODEBUGRANGES` environment variable." +"no_debug_ranges <-X>` command line option or " +"the :envvar:`PYTHONNODEBUGRANGES` environment variable." msgstr "" "這個特性必須要將欄的位置 (column position) 儲存於 :ref:`codeobjects`,這可能" "會導致直譯器用於編譯 Python 檔案的記憶體使用量與硬碟使用量增加。為了避免儲存" @@ -289,16 +289,16 @@ msgstr "PEP 654:例外群組與 ``except*``" #: ../../whatsnew/3.11.rst:185 msgid "" ":pep:`654` introduces language features that enable a program to raise and " -"handle multiple unrelated exceptions simultaneously. The builtin types :exc:" -"`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible to group " -"exceptions and raise them together, and the new :keyword:`except* " +"handle multiple unrelated exceptions simultaneously. The builtin " +"types :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible " +"to group exceptions and raise them together, and the new :keyword:`except* " "<except_star>` syntax generalizes :keyword:`except` to match subgroups of " "exception groups." msgstr "" ":pep:`654` 引入了新的的語言特性,可讓程式同時引發並處理多個相互無關的例外。內" "建型別 :exc:`ExceptionGroup` 和 :exc:`BaseExceptionGroup` 使得程式可為多個例" -"外組成群組並同時引發,新的 :keyword:`except* <except_star>` 語法也將 :" -"keyword:`except` 泛用化、能夠比對例外群組的子群組。" +"外組成群組並同時引發,新的 :keyword:`except* <except_star>` 語法也" +"將 :keyword:`except` 泛用化、能夠比對例外群組的子群組。" #: ../../whatsnew/3.11.rst:192 msgid "See :pep:`654` for more details." @@ -346,33 +346,33 @@ msgstr "Windows ``py.exe`` 啟動程式 (launcher) 的改進" #: ../../whatsnew/3.11.rst:219 msgid "" "The copy of the :ref:`launcher` included with Python 3.11 has been " -"significantly updated. It now supports company/tag syntax as defined in :pep:" -"`514` using the :samp:`-V:{<company>}/{<tag>}` argument instead of the " -"limited :samp:`-{<major>}.{<minor>}`. This allows launching distributions " -"other than ``PythonCore``, the one hosted on `python.org <https://www.python." -"org>`_." +"significantly updated. It now supports company/tag syntax as defined " +"in :pep:`514` using the :samp:`-V:{<company>}/{<tag>}` argument instead of " +"the limited :samp:`-{<major>}.{<minor>}`. This allows launching " +"distributions other than ``PythonCore``, the one hosted on `python.org " +"<https://www.python.org>`_." msgstr "" -"Python 3.11 所包含的 :ref:`launcher` 複製品有了顯著的改善。它現在支援 :pep:" -"`514` 所定義的公司/標籤 (tag) 語法,可用 :samp:`-V:{<company>}/{<tag>}` 引數" -"來取代受限的 :samp:`-{<major>}.{<minor>}`。這允許了 `python.org <https://www." -"python.org>`_ 上的 ``PythonCore`` 以外的發行版本發布。" +"Python 3.11 所包含的 :ref:`launcher` 複製品有了顯著的改善。它現在支" +"援 :pep:`514` 所定義的公司/標籤 (tag) 語法,可用 :samp:`-V:{<company>}/" +"{<tag>}` 引數來取代受限的 :samp:`-{<major>}.{<minor>}`。這允許了 `python.org " +"<https://www.python.org>`_ 上的 ``PythonCore`` 以外的發行版本發布。" #: ../../whatsnew/3.11.rst:225 msgid "" "When using ``-V:`` selectors, either company or tag can be omitted, but all " "installs will be searched. For example, ``-V:OtherPython/`` will select the " -"\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-" -"V:/3.11`` will select the \"best\" distribution with tag ``3.11``." +"\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-V:/" +"3.11`` will select the \"best\" distribution with tag ``3.11``." msgstr "" -"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜索所有安裝。例如,``-V:" -"OtherPython/`` 將選擇 ``OtherPython`` 註冊的「最佳」標籤,而 ``-V:3.11`` 或 " -"``-V:/3.11`` 將選擇帶有 ``3.11`` 標籤的「最佳」發行版。" +"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜尋所有安裝。例如,``-" +"V:OtherPython/`` 將選擇 ``OtherPython`` 註冊的「最佳」標籤,而 ``-V:3.11`` " +"或 ``-V:/3.11`` 將選擇帶有 ``3.11`` 標籤的「最佳」發行版。" #: ../../whatsnew/3.11.rst:230 msgid "" -"When using the legacy :samp:`-{<major>}`, :samp:`-{<major>}.{<minor>}`, :" -"samp:`-{<major>}-{<bitness>}` or :samp:`-{<major>}.{<minor>}-{<bitness>}` " -"arguments, all existing behaviour should be preserved from past versions, " +"When using the legacy :samp:`-{<major>}`, :samp:`-{<major>}.{<minor>}" +"`, :samp:`-{<major>}-{<bitness>}` or :samp:`-{<major>}.{<minor>}-{<bitness>}" +"` arguments, all existing behaviour should be preserved from past versions, " "and only releases from ``PythonCore`` will be selected. However, the ``-64`` " "suffix now implies \"not 32-bit\" (not necessarily x86-64), as there are " "multiple supported 64-bit platforms. 32-bit runtimes are detected by " @@ -393,8 +393,8 @@ msgstr "型別提示相關的新特性" #: ../../whatsnew/3.11.rst:246 msgid "" -"This section covers major changes affecting :pep:`484` type hints and the :" -"mod:`typing` module." +"This section covers major changes affecting :pep:`484` type hints and " +"the :mod:`typing` module." msgstr "" "這個部分涵蓋影響 :pep:`484` 型別提示 (type hints) 與 :mod:`typing` 模組的重大" "變更。" @@ -406,10 +406,10 @@ msgstr "PEP 646:可變參數泛型 (variadic generics)" #: ../../whatsnew/3.11.rst:255 msgid "" ":pep:`484` previously introduced :data:`~typing.TypeVar`, enabling creation " -"of generics parameterised with a single type. :pep:`646` adds :data:`~typing." -"TypeVarTuple`, enabling parameterisation with an *arbitrary* number of " -"types. In other words, a :data:`~typing.TypeVarTuple` is a *variadic* type " -"variable, enabling *variadic* generics." +"of generics parameterised with a single type. :pep:`646` " +"adds :data:`~typing.TypeVarTuple`, enabling parameterisation with an " +"*arbitrary* number of types. In other words, a :data:`~typing.TypeVarTuple` " +"is a *variadic* type variable, enabling *variadic* generics." msgstr "" ":pep:`484` 先前引入了 :data:`~typing.TypeVar`,開啟了帶有單一型別的泛型參數" "化。:pep:`646` 新增 :data:`~typing.TypeVarTuple`,開啟了帶有\\ *任意*\\ 數量" @@ -450,9 +450,9 @@ msgstr "PEP 655:標記獨立 ``TypedDict`` 項目為必要或不必要" #: ../../whatsnew/3.11.rst:280 msgid "" ":data:`~typing.Required` and :data:`~typing.NotRequired` provide a " -"straightforward way to mark whether individual items in a :class:`~typing." -"TypedDict` must be present. Previously, this was only possible using " -"inheritance." +"straightforward way to mark whether individual items in " +"a :class:`~typing.TypedDict` must be present. Previously, this was only " +"possible using inheritance." msgstr "" ":data:`~typing.Required` 與 :data:`~typing.NotRequired` 提供了標記一個獨立項" "目在 :class:`~typing.TypedDict` 中是否必須存在的直覺方法。在這之前,這只有透" @@ -524,9 +524,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:322 msgid "" -"Common use cases include alternative constructors provided as :func:" -"`classmethod <classmethod>`\\s, and :meth:`~object.__enter__` methods that " -"return ``self``::" +"Common use cases include alternative constructors provided " +"as :func:`classmethod <classmethod>`\\s, and :meth:`~object.__enter__` " +"methods that return ``self``::" msgstr "" "常見用例包括作為 :func:`classmethod <classmethod>` 的替代建構函式和會回傳 " "``self`` 的 :meth:`~object.__enter__` 方法: ::" @@ -644,8 +644,8 @@ msgid "" ":data:`~typing.dataclass_transform` may be used to decorate a class, " "metaclass, or a function that is itself a decorator. The presence of " "``@dataclass_transform()`` tells a static type checker that the decorated " -"object performs runtime \"magic\" that transforms a class, giving it :func:" -"`dataclass <dataclasses.dataclass>`-like behaviors." +"object performs runtime \"magic\" that transforms a class, giving " +"it :func:`dataclass <dataclasses.dataclass>`-like behaviors." msgstr "" ":data:`~typing.dataclass_transform` 可以用來裝飾一個類別、元類別 " "(metaclass)、或是一個本身就是裝飾器的函式。``@dataclass_transform()`` 的存在" @@ -700,8 +700,8 @@ msgid "" "python-dev@python.org/message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/>`__ for more " "information." msgstr "" -":pep:`563` 標註的推遲求值 (Postponed Evaluation of Annotations)(\\ ``from " -"__future__ import annotations`` :ref:`future 陳述式 <future>`\\ )最初計劃在 " +":pep:`563` 推遲對註釋的求值 (Postponed Evaluation of Annotations)(``from " +"__future__ import annotations`` :ref:`future 陳述式 <future>`)最初計劃在 " "Python 3.10 中發布,但已被無限期擱置。請參閱\\ `來自指導委員會 (Steering " "Counsil) 的訊息 <https://mail.python.org/archives/list/python-dev@python.org/" "message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/>`__\\ 以獲得更多資訊。" @@ -732,51 +732,51 @@ msgstr "" #: ../../whatsnew/3.11.rst:447 msgid "" -"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in :" -"keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` for " -"objects that do not support the :term:`context manager` protocol, and in :" -"keyword:`async with` statements and :meth:`contextlib.AsyncExitStack." -"enter_async_context` for objects not supporting the :term:`asynchronous " -"context manager` protocol. (Contributed by Serhiy Storchaka in :issue:" -"`12022` and :issue:`44471`.)" +"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` " +"in :keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` " +"for objects that do not support the :term:`context manager` protocol, and " +"in :keyword:`async with` statements " +"and :meth:`contextlib.AsyncExitStack.enter_async_context` for objects not " +"supporting the :term:`asynchronous context manager` protocol. (Contributed " +"by Serhiy Storchaka in :issue:`12022` and :issue:`44471`.)" msgstr "" "現在在不支援 :term:`context manager` 協議的物件上使用 :keyword:`with` 陳述式" "和 :meth:`contextlib.ExitStack.enter_context` 或在不支援 :term:`asynchronous " -"context manager` 協議的物件上使用 :keyword:`async with` 陳述式和 :meth:" -"`contextlib.AsyncExitStack.enter_async_context`,會引發 :exc:`TypeError` 而不" -"是 :exc:`AttributeError`。(由 Serhiy Storchaka 在 :issue:`12022` 和 :issue:" -"`44471` 中貢獻。)" +"context manager` 協議的物件上使用 :keyword:`async with` 陳述式" +"和 :meth:`contextlib.AsyncExitStack.enter_async_context`,會引" +"發 :exc:`TypeError` 而不是 :exc:`AttributeError`。(由 Serhiy Storchaka " +"在 :issue:`12022` 和 :issue:`44471` 中貢獻。)" #: ../../whatsnew/3.11.rst:455 msgid "" "Added :meth:`object.__getstate__`, which provides the default implementation " "of the :meth:`!__getstate__` method. :mod:`copy`\\ing and :mod:`pickle`\\ing " -"instances of subclasses of builtin types :class:`bytearray`, :class:`set`, :" -"class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections." -"deque`, :class:`weakref.WeakSet`, and :class:`datetime.tzinfo` now copies " -"and pickles instance attributes implemented as :term:`slots <__slots__>`. " -"This change has an unintended side effect: It trips up a small minority of " -"existing Python projects not expecting :meth:`object.__getstate__` to exist. " -"See the later comments on :gh:`70766` for discussions of what workarounds " -"such code may need. (Contributed by Serhiy Storchaka in :issue:`26579`.)" +"instances of subclasses of builtin " +"types :class:`bytearray`, :class:`set`, :class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections.deque`, :class:`weakref.WeakSet`, " +"and :class:`datetime.tzinfo` now copies and pickles instance attributes " +"implemented as :term:`slots <__slots__>`. This change has an unintended side " +"effect: It trips up a small minority of existing Python projects not " +"expecting :meth:`object.__getstate__` to exist. See the later comments " +"on :gh:`70766` for discussions of what workarounds such code may need. " +"(Contributed by Serhiy Storchaka in :issue:`26579`.)" msgstr "" #: ../../whatsnew/3.11.rst:470 msgid "" "Added a :option:`-P` command line option and a :envvar:`PYTHONSAFEPATH` " -"environment variable, which disable the automatic prepending to :data:`sys." -"path` of the script's directory when running a script, or the current " -"directory when using :option:`-c` and :option:`-m`. This ensures only stdlib " -"and installed modules are picked up by :keyword:`import`, and avoids " -"unintentionally or maliciously shadowing modules with those in a local (and " -"typically user-writable) directory. (Contributed by Victor Stinner in :gh:" -"`57684`.)" +"environment variable, which disable the automatic prepending " +"to :data:`sys.path` of the script's directory when running a script, or the " +"current directory when using :option:`-c` and :option:`-m`. This ensures " +"only stdlib and installed modules are picked up by :keyword:`import`, and " +"avoids unintentionally or maliciously shadowing modules with those in a " +"local (and typically user-writable) directory. (Contributed by Victor " +"Stinner in :gh:`57684`.)" msgstr "" "新增了一個 :option:`-P` 命令列選項和一個 :envvar:`PYTHONSAFEPATH` 環境變數," -"它們禁用了當使用 :option:`-c` 和 :option:`-m` 以在運行腳本或當前目錄時自動添" -"加到腳本目錄的 :data:`sys.path`。這確保只有 stdlib 和已安裝的模組會被 :" -"keyword:`import` 取用,以避免不小心或被惡意地將模組與本地(通常是使用者可寫入" -"的)目錄中的模組重疊。(由 Victor Stinner 在 :gh:`57684` 中貢獻。)" +"它們禁用了當使用 :option:`-c` 和 :option:`-m` 以在運行腳本或目前目錄時自動添" +"加到腳本目錄的 :data:`sys.path`。這確保只有 stdlib 和已安裝的模組會" +"被 :keyword:`import` 取用,以避免不小心或被惡意地將模組與本地(通常是使用者可" +"寫入的)目錄中的模組重疊。(由 Victor Stinner 在 :gh:`57684` 中貢獻。)" #: ../../whatsnew/3.11.rst:481 msgid "" @@ -797,10 +797,10 @@ msgid "" "Thomas Grainger in :gh:`91181`.)" msgstr "" ":data:`sys.path` 不再接受位元組。支援已在 Python 3.2 和 3.6 之間的某個時間停" -"止,直到 Python 3.10.0 發布後才引起人們的注意。此外,由於混合使用 :class:" -"`str` 和 :class:`bytes` 鍵時 :option:`-b` 和 :data:`sys.path_importer_cache` " -"會出現的交互作用,恢復這項支援會出現問題。(由 Thomas Grainger 在 :gh:" -"`91181` 中貢獻。)" +"止,直到 Python 3.10.0 發布後才引起人們的注意。此外,由於混合使" +"用 :class:`str` 和 :class:`bytes` 鍵時 :option:`-b` " +"和 :data:`sys.path_importer_cache` 會出現的交互作用,恢復這項支援會出現問題。" +"(由 Thomas Grainger 在 :gh:`91181` 中貢獻。)" #: ../../whatsnew/3.11.rst:497 msgid "Other CPython Implementation Changes" @@ -808,15 +808,15 @@ msgstr "其他 CPython 實作更動" #: ../../whatsnew/3.11.rst:499 msgid "" -"The special methods :meth:`~object.__complex__` for :class:`complex` and :" -"meth:`~object.__bytes__` for :class:`bytes` are implemented to support the :" -"class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` protocols. " -"(Contributed by Mark Dickinson and Donghee Na in :issue:`24234`.)" +"The special methods :meth:`~object.__complex__` for :class:`complex` " +"and :meth:`~object.__bytes__` for :class:`bytes` are implemented to support " +"the :class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` " +"protocols. (Contributed by Mark Dickinson and Donghee Na in :issue:`24234`.)" msgstr "" "為支援 :class:`typing.SupportsComplex` 與 :class:`typing.SupportsBytes` 協" -"定,實作了 :class:`complex` 與 :class:`bytes` 的特殊方法 :meth:`~object." -"__complex__` 與 :meth:`~object.__bytes__`。(由 Mark Dickinson 和 Donghee Na " -"於 :issue:`24234` 中所貢獻。)" +"定,實作了 :class:`complex` 與 :class:`bytes` 的特殊方" +"法 :meth:`~object.__complex__` 與 :meth:`~object.__bytes__`。(由 Mark " +"Dickinson 和 Donghee Na 於 :issue:`24234` 中所貢獻。)" #: ../../whatsnew/3.11.rst:504 msgid "" @@ -830,20 +830,20 @@ msgstr "" "新增 ``siphash13`` 以作為內部的雜湊演算法,它有與 ``siphash24`` 相似的安全特" "性,但是在處理較長的輸入時會更快一些。現在是 :class:`str`、:class:`bytes` 和" "一些其他型別的 :func:`hash` 預設演算法。:pep:`552` :ref:`基於雜湊的 .pyc 檔" -"案 <pyc-invalidation>` 現在也使用 ``siphash13``。(由 Inada Naoki 於 :issue:" -"`29410` 中貢獻。)" +"案 <pyc-invalidation>` 現在也使用 ``siphash13``。(由 Inada Naoki " +"於 :issue:`29410` 中貢獻。)" #: ../../whatsnew/3.11.rst:513 msgid "" "When an active exception is re-raised by a :keyword:`raise` statement with " -"no parameters, the traceback attached to this exception is now always ``sys." -"exc_info()[1].__traceback__``. This means that changes made to the traceback " -"in the current :keyword:`except` clause are reflected in the re-raised " -"exception. (Contributed by Irit Katriel in :issue:`45711`.)" +"no parameters, the traceback attached to this exception is now always " +"``sys.exc_info()[1].__traceback__``. This means that changes made to the " +"traceback in the current :keyword:`except` clause are reflected in the re-" +"raised exception. (Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" "當一個仍有效的例外被 :keyword:`raise` 陳述式在沒有參數的情況下重新引發,被附" "於該例外的追蹤資訊現在都會是 ``sys.exc_info()[1].__traceback__``。這代表對於" -"當前 :keyword:`except` 子句的追蹤上做的改動會反映在被重複引發的例外上。(由 " +"目前 :keyword:`except` 子句的追蹤上做的改動會反映在被重複引發的例外上。(由 " "Irit Katriel 於 :issue:`45711` 中貢獻。)" #: ../../whatsnew/3.11.rst:519 @@ -876,9 +876,10 @@ msgid "" "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" -"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始化 :data:" -"`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須被設為 " -"1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` 的值。" +"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始" +"化 :data:`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須" +"被設為 1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` " +"的值。" #: ../../whatsnew/3.11.rst:536 msgid "" @@ -889,9 +890,9 @@ msgid "" "help-all`. (Contributed by Éric Araujo in :issue:`46142`.)" msgstr "" ":option:`--help` 選項的輸出現在會在 50 列、80 欄的大小之內,:ref:`Python 環境" -"變數 <using-on-envvars>`\\ 和 :option:`-X` 選項的資訊現在能夠分別透過 :" -"option:`--help-env` 和 :option:`--help-xoptions` 旗標與 :option:`--help-all` " -"一起使用來取得。(由 Éric Araujo 於 :issue:`46142` 中貢獻。)" +"變數 <using-on-envvars>`\\ 和 :option:`-X` 選項的資訊現在能夠分別透" +"過 :option:`--help-env` 和 :option:`--help-xoptions` 旗標與 :option:`--help-" +"all` 一起使用來取得。(由 Éric Araujo 於 :issue:`46142` 中貢獻。)" #: ../../whatsnew/3.11.rst:543 msgid "" @@ -907,11 +908,11 @@ msgid "" msgstr "" "在除 2(binary、二進制)、4、8(octal、八進制)、16(hexadecimal、十六進制)" "或 32 以外的基數中,例如以 10(decimal、十進制)為基數,進行 :class:`int` " -"和 :class:`str` 之間的轉換且字串形式的位數超過限制,現在會引發 :exc:" -"`ValueError`,以避免由於演算法複雜性而導致的潛在阻斷服務攻擊 (denial of " -"service attacks)。這是針對 :cve:`2020-10735` 的緩解措施,可以透過環境變數、命" -"令列旗標或 :mod:`sys` API 來設定或禁用此限制。請參閱\\ :ref:`整數字串轉換長度" -"限制 <int_max_str_digits>` 文件。預設限制為字串形式的 4300 位數字。" +"和 :class:`str` 之間的轉換且字串形式的位數超過限制,現在會引" +"發 :exc:`ValueError`,以避免由於演算法複雜性而導致的潛在阻斷服務攻擊 (denial " +"of service attacks)。這是針對 :cve:`2020-10735` 的緩解措施,可以透過環境變" +"數、命令列旗標或 :mod:`sys` API 來設定或禁用此限制。請參閱\\ :ref:`整數字串轉" +"換長度限制 <int_max_str_digits>` 文件。預設限制為字串形式的 4300 位數字。" #: ../../whatsnew/3.11.rst:557 msgid "New Modules" @@ -945,9 +946,9 @@ msgstr "asyncio" msgid "" "Added the :class:`~asyncio.TaskGroup` class, an :ref:`asynchronous context " "manager <async-context-managers>` holding a group of tasks that will wait " -"for all of them upon exit. For new code this is recommended over using :func:" -"`~asyncio.create_task` and :func:`~asyncio.gather` directly. (Contributed by " -"Yury Selivanov and others in :gh:`90908`.)" +"for all of them upon exit. For new code this is recommended over " +"using :func:`~asyncio.create_task` and :func:`~asyncio.gather` directly. " +"(Contributed by Yury Selivanov and others in :gh:`90908`.)" msgstr "" "添加了 :class:`~asyncio.TaskGroup` 類別,為一個會持有任務群組並在退出時等待全" "部完成的\\ :ref:`非同步情境管理器 (asynchronous context manager) <async-" @@ -959,8 +960,8 @@ msgstr "" msgid "" "Added :func:`~asyncio.timeout`, an asynchronous context manager for setting " "a timeout on asynchronous operations. For new code this is recommended over " -"using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov in :" -"gh:`90927`.)" +"using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov " +"in :gh:`90927`.)" msgstr "" "新增 :func:`~asyncio.timeout`,是一個用來為一個非同步操作設置超時的非同步情境" "管理器,新的程式建議直接使用它以取代 :func:`~asyncio.wait_for`。(由 Andrew " @@ -986,9 +987,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:599 msgid "" -"Added keyword argument *all_errors* to :meth:`asyncio.loop." -"create_connection` so that multiple connection errors can be raised as an :" -"exc:`ExceptionGroup`." +"Added keyword argument *all_errors* " +"to :meth:`asyncio.loop.create_connection` so that multiple connection errors " +"can be raised as an :exc:`ExceptionGroup`." msgstr "" "在 :meth:`asyncio.loop.create_connection` 新增關鍵字引數 *all_errors*,這樣多" "個連接錯誤就可以一起用一個 :exc:`ExceptionGroup` 來引發。" @@ -996,25 +997,27 @@ msgstr "" #: ../../whatsnew/3.11.rst:602 msgid "" "Added the :meth:`asyncio.StreamWriter.start_tls` method for upgrading " -"existing stream-based connections to TLS. (Contributed by Ian Good in :issue:" -"`34975`.)" +"existing stream-based connections to TLS. (Contributed by Ian Good " +"in :issue:`34975`.)" msgstr "" "新增 :meth:`asyncio.StreamWriter.start_tls` 方法,用來將已存在的串流連線升級" "至 TLS。(由 Ian Good 於 :issue:`34975` 中貢獻。)" #: ../../whatsnew/3.11.rst:606 msgid "" -"Added raw datagram socket functions to the event loop: :meth:`~asyncio.loop." -"sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` and :meth:`~asyncio.loop." -"sock_recvfrom_into`. These have implementations in :class:`~asyncio." -"SelectorEventLoop` and :class:`~asyncio.ProactorEventLoop`. (Contributed by " -"Alex Grönholm in :issue:`46805`.)" +"Added raw datagram socket functions to the event " +"loop: :meth:`~asyncio.loop.sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` " +"and :meth:`~asyncio.loop.sock_recvfrom_into`. These have implementations " +"in :class:`~asyncio.SelectorEventLoop` " +"and :class:`~asyncio.ProactorEventLoop`. (Contributed by Alex Grönholm " +"in :issue:`46805`.)" msgstr "" -"在事件迴圈增加原始資料元 (raw datagram) socket 函式::meth:`~asyncio.loop." -"sock_sendto`、:meth:`~asyncio.loop.sock_recvfrom` 和 :meth:`~asyncio.loop." -"sock_recvfrom_into`。以上在 :class:`~asyncio.SelectorEventLoop` 和 :class:" -"`~asyncio.ProactorEventLoop` 中都有實作。(由 Alex Grönholm 在 :issue:" -"`46805` 中貢獻。)" +"在事件迴圈增加原始資料元 (raw datagram) socket 函" +"式::meth:`~asyncio.loop.sock_sendto`、:meth:`~asyncio.loop.sock_recvfrom` " +"和 :meth:`~asyncio.loop.sock_recvfrom_into`。以上" +"在 :class:`~asyncio.SelectorEventLoop` " +"和 :class:`~asyncio.ProactorEventLoop` 中都有實作。(由 Alex Grönholm " +"在 :issue:`46805` 中貢獻。)" #: ../../whatsnew/3.11.rst:614 msgid "" @@ -1022,9 +1025,9 @@ msgid "" "methods to :class:`~asyncio.Task`. These are primarily intended for internal " "use, notably by :class:`~asyncio.TaskGroup`." msgstr "" -"於 :class:`~asyncio.Task` 新增 :meth:`~asyncio.Task.cancelling` 和 :meth:" -"`~asyncio.Task.uncancel` 方法。這些預期是只用於內部,尤其是 :class:`~asyncio." -"TaskGroup`。" +"於 :class:`~asyncio.Task` 新增 :meth:`~asyncio.Task.cancelling` " +"和 :meth:`~asyncio.Task.uncancel` 方法。這些預期是只用於內部,尤其" +"是 :class:`~asyncio.TaskGroup`。" #: ../../whatsnew/3.11.rst:623 msgid "contextlib" @@ -1036,9 +1039,9 @@ msgid "" "the current working directory and then restore it on exit. Simple wrapper " "around :func:`~os.chdir`. (Contributed by Filipe Laíns in :issue:`25625`)" msgstr "" -"添加了非平行安全的 :func:`~contextlib.chdir` 情境管理器來更改當前工作目錄,然" -"後在退出時恢復它。:func:`~os.chdir` 的簡單包裝器。(由 Filipe Laíns 在 :" -"issue:`25625` 中貢獻)" +"添加了非平行安全的 :func:`~contextlib.chdir` 情境管理器來更改目前工作目錄,然" +"後在退出時恢復它。:func:`~os.chdir` 的簡單包裝器。(由 Filipe Laíns " +"在 :issue:`25625` 中貢獻)" #: ../../whatsnew/3.11.rst:633 msgid "dataclasses" @@ -1046,10 +1049,10 @@ msgstr "dataclasses" #: ../../whatsnew/3.11.rst:635 msgid "" -"Change field default mutability check, allowing only defaults which are :" -"term:`hashable` instead of any object which is not an instance of :class:" -"`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. Smith in :" -"issue:`44674`.)" +"Change field default mutability check, allowing only defaults which " +"are :term:`hashable` instead of any object which is not an instance " +"of :class:`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. " +"Smith in :issue:`44674`.)" msgstr "" "更改欄位預設的可變性檢查 (mutability check),僅允許預設值是 :term:`hashable` " "而不是任何非 :class:`dict`、:class:`list` 或 :class:`set` 實例的物件。(由 " @@ -1061,8 +1064,9 @@ msgstr "datetime" #: ../../whatsnew/3.11.rst:646 msgid "" -"Add :const:`datetime.UTC`, a convenience alias for :attr:`datetime.timezone." -"utc`. (Contributed by Kabir Kwatra in :gh:`91973`.)" +"Add :const:`datetime.UTC`, a convenience alias " +"for :attr:`datetime.timezone.utc`. (Contributed by Kabir Kwatra " +"in :gh:`91973`.)" msgstr "" "新增 :const:`datetime.UTC`,一個 :attr:`datetime.timezone.utc` 的方便別名。" "(由 Kabir Kwatra 於 :gh:`91973` 所貢獻。)" @@ -1074,10 +1078,10 @@ msgid "" "ISO 8601 formats (barring only those that support fractional hours and " "minutes). (Contributed by Paul Ganssle in :gh:`80010`.)" msgstr "" -":meth:`datetime.date.fromisoformat`、:meth:`datetime.time.fromisoformat` 和 :" -"meth:`datetime.datetime.fromisoformat` 現在可以用來剖析大部分的 ISO 8601 格式" -"(除了那些支援分數形式的小時與分鐘)。(由 Paul Ganssle 於 :gh:`80010` 中所貢" -"獻。)" +":meth:`datetime.date.fromisoformat`、:meth:`datetime.time.fromisoformat` " +"和 :meth:`datetime.datetime.fromisoformat` 現在可以用來剖析大部分的 ISO 8601 " +"格式(除了那些支援分數形式的小時與分鐘)。(由 Paul Ganssle 於 :gh:`80010` 中" +"所貢獻。)" #: ../../whatsnew/3.11.rst:658 msgid "enum" @@ -1099,44 +1103,45 @@ msgstr "增加 :class:`~enum.StrEnum`,列舉 (enum) 內的成員必須是字 #: ../../whatsnew/3.11.rst:666 msgid "" -"Added :class:`~enum.ReprEnum`, which only modifies the :meth:`~object." -"__repr__` of members while returning their literal values (rather than " -"names) for :meth:`~object.__str__` and :meth:`~object.__format__` (used by :" -"func:`str`, :func:`format` and :term:`f-string`\\s)." +"Added :class:`~enum.ReprEnum`, which only modifies " +"the :meth:`~object.__repr__` of members while returning their literal values " +"(rather than names) for :meth:`~object.__str__` " +"and :meth:`~object.__format__` (used by :func:`str`, :func:`format` " +"and :term:`f-string`\\s)." msgstr "" "新增 :class:`~enum.ReprEnum`,它只修改成員的 :meth:`~object.__repr__`,同時回" -"傳成員的文本值 (literal value)(而不是名稱),以用於(為 :func:`str`、:func:" -"`format` 和 :term:`f-string` 所使用的)\\ :meth:`~object.__str__` 和 :meth:" -"`~object.__format__`。" +"傳成員的文本值 (literal value)(而不是名稱),以用於" +"(為 :func:`str`、:func:`format` 和 :term:`f-string` 所使用的)" +"\\ :meth:`~object.__str__` 和 :meth:`~object.__format__`。" #: ../../whatsnew/3.11.rst:672 msgid "" -"Changed :meth:`Enum.__format__() <enum.Enum.__format__>` (the default for :" -"func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always produce " -"the same result as :meth:`Enum.__str__() <enum.Enum.__str__>`: for enums " -"inheriting from :class:`~enum.ReprEnum` it will be the member's value; for " -"all other enums it will be the enum and member name (e.g. ``Color.RED``)." +"Changed :meth:`Enum.__format__() <enum.Enum.__format__>` (the default " +"for :func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always " +"produce the same result as :meth:`Enum.__str__() <enum.Enum.__str__>`: for " +"enums inheriting from :class:`~enum.ReprEnum` it will be the member's value; " +"for all other enums it will be the enum and member name (e.g. ``Color.RED``)." msgstr "" -"改變了 :meth:`Enum.__format__() <enum.Enum.__format__>` (被 :func:" -"`format`、:meth:`str.format` 和 :term:`f-string` 預設使用),以使其與 :meth:" -"`enum.Enum.__str__ <enum.Enum.__str__>` 產生相同結果:對於繼承自 :class:" -"`~enum.ReprEnum` 的列舉,這會是成員之值;而其他的列舉會是列舉與成員名稱(例" -"如 ``Color.RED``)。" +"改變了 :meth:`Enum.__format__() <enum.Enum.__format__>` " +"(被 :func:`format`、:meth:`str.format` 和 :term:`f-string` 預設使用),以使" +"其與 :meth:`enum.Enum.__str__ <enum.Enum.__str__>` 產生相同結果:對於繼承" +"自 :class:`~enum.ReprEnum` 的列舉,這會是成員之值;而其他的列舉會是列舉與成員" +"名稱(例如 ``Color.RED``)。" #: ../../whatsnew/3.11.rst:678 msgid "" -"Added a new *boundary* class parameter to :class:`~enum.Flag` enums and the :" -"class:`~enum.FlagBoundary` enum with its options, to control how to handle " -"out-of-range flag values." +"Added a new *boundary* class parameter to :class:`~enum.Flag` enums and " +"the :class:`~enum.FlagBoundary` enum with its options, to control how to " +"handle out-of-range flag values." msgstr "" -"新增 *boundary* 類別參數與其選項到 :class:`~enum.Flag` 列舉和 :class:`~enum." -"FlagBoundary` 列舉以控制處理超出範圍旗標數值的方法。" +"新增 *boundary* 類別參數與其選項到 :class:`~enum.Flag` 列舉" +"和 :class:`~enum.FlagBoundary` 列舉以控制處理超出範圍旗標數值的方法。" #: ../../whatsnew/3.11.rst:682 msgid "" -"Added the :func:`~enum.verify` enum decorator and the :class:`~enum." -"EnumCheck` enum with its options, to check enum classes against several " -"specific constraints." +"Added the :func:`~enum.verify` enum decorator and " +"the :class:`~enum.EnumCheck` enum with its options, to check enum classes " +"against several specific constraints." msgstr "" "新增了 :func:`~enum.verify` 列舉裝飾器和 :class:`~enum.EnumCheck` 列舉及其選" "項,以根據幾個特定限制檢查列舉類別。" @@ -1151,34 +1156,35 @@ msgstr "" #: ../../whatsnew/3.11.rst:689 msgid "" -"Added the :func:`~enum.property` decorator, which works like :func:" -"`property` except for enums. Use this instead of :func:`types." -"DynamicClassAttribute`." +"Added the :func:`~enum.property` decorator, which works " +"like :func:`property` except for enums. Use this instead " +"of :func:`types.DynamicClassAttribute`." msgstr "" "新增 :func:`~enum.property` 裝飾器,它的作用類似 :func:`property` 但是是用於" "列舉,用以替代 :func:`types.DynamicClassAttribute`。" #: ../../whatsnew/3.11.rst:693 msgid "" -"Added the :func:`~enum.global_enum` enum decorator, which adjusts :meth:" -"`~object.__repr__` and :meth:`~object.__str__` to show values as members of " -"their module rather than the enum class. For example, ``'re.ASCII'`` for " -"the :const:`~re.ASCII` member of :class:`re.RegexFlag` rather than " -"``'RegexFlag.ASCII'``." +"Added the :func:`~enum.global_enum` enum decorator, which " +"adjusts :meth:`~object.__repr__` and :meth:`~object.__str__` to show values " +"as members of their module rather than the enum class. For example, " +"``'re.ASCII'`` for the :const:`~re.ASCII` member of :class:`re.RegexFlag` " +"rather than ``'RegexFlag.ASCII'``." msgstr "" "新增 :func:`~enum.global_enum` 列舉裝飾器,用來調整 :meth:`~object.__repr__` " -"和 :meth:`~object.__str__` 以模組成員形式而非列舉類別來顯示值。例如,:class:" -"`re.RegexFlag` 的 :const:`~re.ASCII` 成員的 ``'re.ASCII'``,而非 " +"和 :meth:`~object.__str__` 以模組成員形式而非列舉類別來顯示值。例" +"如,:class:`re.RegexFlag` 的 :const:`~re.ASCII` 成員的 ``'re.ASCII'``,而非 " "``'RegexFlag.ASCII'``。" #: ../../whatsnew/3.11.rst:699 msgid "" -"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration and :keyword:" -"`in`/:keyword:`not in` on its members. For example, the following now works: " -"``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" +"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration " +"and :keyword:`in`/:keyword:`not in` on its members. For example, the " +"following now works: ``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, " +"AFlag.TWO)``" msgstr "" -"強化 :class:`~enum.Flag` 以支援使用 :func:`len`、疊代 (iteration) 和 :" -"keyword:`in`/:keyword:`not in` 於其成員。例如,以下程式現在能夠作用了:" +"強化 :class:`~enum.Flag` 以支援使用 :func:`len`、疊代 (iteration) " +"和 :keyword:`in`/:keyword:`not in` 於其成員。例如,以下程式現在能夠作用了:" "``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" #: ../../whatsnew/3.11.rst:704 @@ -1187,9 +1193,9 @@ msgid "" "defined before :meth:`~object.__init_subclass__` is called; :func:`dir` now " "includes methods, etc., from mixed-in data types." msgstr "" -"更改了 :class:`~enum.Enum` 和 :class:`~enum.Flag` 以在呼叫 :meth:`~object." -"__init_subclass__` 之前就定義成員;:func:`dir` 現在包括來自混合資料型別的方" -"法。" +"更改了 :class:`~enum.Enum` 和 :class:`~enum.Flag` 以在呼" +"叫 :meth:`~object.__init_subclass__` 之前就定義成員;:func:`dir` 現在包括來自" +"混合資料型別的方法。" #: ../../whatsnew/3.11.rst:709 msgid "" @@ -1242,11 +1248,11 @@ msgstr "functools" #: ../../whatsnew/3.11.rst:743 msgid "" -":func:`functools.singledispatch` now supports :data:`types.UnionType` and :" -"data:`typing.Union` as annotations to the dispatch argument.::" +":func:`functools.singledispatch` now supports :data:`types.UnionType` " +"and :data:`typing.Union` as annotations to the dispatch argument.::" msgstr "" -":func:`functools.singledispatch` 現在支援 :data:`types.UnionType` 和 :data:" -"`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" +":func:`functools.singledispatch` 現在支援 :data:`types.UnionType` " +"和 :data:`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" #: ../../whatsnew/3.11.rst:746 msgid "" @@ -1272,6 +1278,27 @@ msgid "" "... print(i, elem)\n" "..." msgstr "" +">>> from functools import singledispatch\n" +">>> @singledispatch\n" +"... def fun(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Let me just say,\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> @fun.register\n" +"... def _(arg: int | float, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> from typing import Union\n" +">>> @fun.register\n" +"... def _(arg: Union[list, set], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)\n" +"..." #: ../../whatsnew/3.11.rst:768 msgid "(Contributed by Yurii Karabas in :issue:`46014`.)" @@ -1284,13 +1311,14 @@ msgstr "gzip" #: ../../whatsnew/3.11.rst:776 msgid "" "The :func:`gzip.compress` function is now faster when used with the " -"**mtime=0** argument as it delegates the compression entirely to a single :" -"func:`zlib.compress` operation. There is one side effect of this change: The " -"gzip file header contains an \"OS\" byte in its header. That was " -"traditionally always set to a value of 255 representing \"unknown\" by the :" -"mod:`gzip` module. Now, when using :func:`~gzip.compress` with **mtime=0**, " -"it may be set to a different value by the underlying zlib C library Python " -"was linked against. (See :gh:`112346` for details on the side effect.)" +"**mtime=0** argument as it delegates the compression entirely to a " +"single :func:`zlib.compress` operation. There is one side effect of this " +"change: The gzip file header contains an \"OS\" byte in its header. That was " +"traditionally always set to a value of 255 representing \"unknown\" by " +"the :mod:`gzip` module. Now, when using :func:`~gzip.compress` with " +"**mtime=0**, it may be set to a different value by the underlying zlib C " +"library Python was linked against. (See :gh:`112346` for details on the side " +"effect.)" msgstr "" #: ../../whatsnew/3.11.rst:789 @@ -1344,8 +1372,8 @@ msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -"當帶有輸入與輸出地儲存 Shell 時,也會包含提示字元。(由 Terry Jan Reedy 於 :" -"gh:`95191` 中所貢獻。)" +"當帶有輸入與輸出地儲存 Shell 時,也會包含提示字元。(由 Terry Jan Reedy " +"於 :gh:`95191` 中所貢獻。)" #: ../../whatsnew/3.11.rst:822 msgid "inspect" @@ -1364,11 +1392,12 @@ msgstr "" #: ../../whatsnew/3.11.rst:828 msgid "" "Add :func:`~inspect.ismethodwrapper` for checking if the type of an object " -"is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :" -"issue:`29418`.)" +"is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik " +"in :issue:`29418`.)" msgstr "" -"新增 :func:`inspect.ismethodwrapper`,用來檢查一個物件的型別是否為 :class:" -"`~types.MethodWrapperType`。(由 Hakan Çelik 於 :issue:`29418` 中所貢獻。)" +"新增 :func:`inspect.ismethodwrapper`,用來檢查一個物件的型別是否" +"為 :class:`~types.MethodWrapperType`。(由 Hakan Çelik 於 :issue:`29418` 中所" +"貢獻。)" #: ../../whatsnew/3.11.rst:832 msgid "" @@ -1378,10 +1407,10 @@ msgid "" "interfaces) that includes the extended :pep:`657` position information (end " "line number, column and end column). The affected functions are:" msgstr "" -"更改 :mod:`inspect` 模組中與幀相關的函式以回傳新的 :class:`~inspect." -"FrameInfo` 和 :class:`~inspect.Traceback` 類別實例(向後相容之前類似於 :term:" -"`named tuple` 的介面),包括擴充的 :pep:`657` 位置資訊(結束行號、欄和結束" -"欄)。受影響的功能是:" +"更改 :mod:`inspect` 模組中與幀相關的函式以回傳新" +"的 :class:`~inspect.FrameInfo` 和 :class:`~inspect.Traceback` 類別實例(向後" +"相容之前類似於 :term:`named tuple` 的介面),包括擴充的 :pep:`657` 位置資訊" +"(結束行號、欄和結束欄)。受影響的功能是:" #: ../../whatsnew/3.11.rst:838 msgid ":func:`inspect.getframeinfo`" @@ -1414,10 +1443,10 @@ msgstr "locale" #: ../../whatsnew/3.11.rst:852 msgid "" "Add :func:`locale.getencoding` to get the current locale encoding. It is " -"similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" -"`Python UTF-8 Mode <utf8-mode>`." +"similar to ``locale.getpreferredencoding(False)`` but ignores " +"the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "" -"新增 :func:`locale.getencoding` 以取得當前的區域編碼 (locale encoding)。和 " +"新增 :func:`locale.getencoding` 以取得目前的區域編碼 (locale encoding)。和 " "``locale.getpreferredencoding(False)`` 類似但不考慮 :ref:`Python UTF-8 模式 " "<utf8-mode>`。" @@ -1428,9 +1457,9 @@ msgstr "logging" #: ../../whatsnew/3.11.rst:862 msgid "" "Added :func:`~logging.getLevelNamesMapping` to return a mapping from logging " -"level names (e.g. ``'CRITICAL'``) to the values of their corresponding :ref:" -"`levels` (e.g. ``50``, by default). (Contributed by Andrei Kulakovin in :gh:" -"`88024`.)" +"level names (e.g. ``'CRITICAL'``) to the values of their " +"corresponding :ref:`levels` (e.g. ``50``, by default). (Contributed by " +"Andrei Kulakovin in :gh:`88024`.)" msgstr "" "新增 :func:`~logging.getLevelNamesMapping` 以回傳一個日誌級別名稱(例如 " "``'CRITICAL'``)指到對應的 :ref:`levels` 數值(例如,預設為 ``50``)的對映。" @@ -1438,17 +1467,19 @@ msgstr "" #: ../../whatsnew/3.11.rst:867 msgid "" -"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method to :" -"class:`~logging.handlers.SysLogHandler`, to match :meth:`SocketHandler." -"createSocket() <logging.handlers.SocketHandler.createSocket>`. It is called " -"automatically during handler initialization and when emitting an event, if " -"there is no active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" +"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method " +"to :class:`~logging.handlers.SysLogHandler`, to " +"match :meth:`SocketHandler.createSocket() " +"<logging.handlers.SocketHandler.createSocket>`. It is called automatically " +"during handler initialization and when emitting an event, if there is no " +"active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" msgstr "" -"添加了一個 :meth:`~logging.handlers.SysLogHandler.createSocket` 方法到 :" -"class:`~logging.handlers.SysLogHandler`,以匹配 :meth:`SocketHandler." -"createSocket() <logging.handlers.SocketHandler.createSocket>` 。如果沒有已啟" -"用的 socket,它會在處理程式初始化期間和發出一個事件時自動呼叫。(由 Kirill " -"Pinchuk 在 :gh:`88457` 中貢獻。)" +"添加了一個 :meth:`~logging.handlers.SysLogHandler.createSocket` 方法" +"到 :class:`~logging.handlers.SysLogHandler`,以匹" +"配 :meth:`SocketHandler.createSocket() " +"<logging.handlers.SocketHandler.createSocket>` 。如果沒有已啟用的 socket,它" +"會在處理程式初始化期間和發出一個事件時自動呼叫。(由 Kirill Pinchuk " +"在 :gh:`88457` 中貢獻。)" #: ../../whatsnew/3.11.rst:879 msgid "math" @@ -1459,29 +1490,29 @@ msgid "" "Add :func:`math.exp2`: return 2 raised to the power of x. (Contributed by " "Gideon Mitchell in :issue:`45917`.)" msgstr "" -"新增 :func:`math.exp2`:回傳 2 的 x 次方。(由 Gideon Mitchell 於 :issue:" -"`45917` 中所貢獻。)" +"新增 :func:`math.exp2`:回傳 2 的 x 次方。(由 Gideon Mitchell " +"於 :issue:`45917` 中所貢獻。)" #: ../../whatsnew/3.11.rst:884 msgid "" "Add :func:`math.cbrt`: return the cube root of x. (Contributed by Ajith " "Ramachandran in :issue:`44357`.)" msgstr "" -"新增 :func:`math.cbrt`:回傳 x 的立方根。(由 Ajith Ramachandran 於 :issue:" -"`44357` 中所貢獻。)" +"新增 :func:`math.cbrt`:回傳 x 的立方根。(由 Ajith Ramachandran " +"於 :issue:`44357` 中所貢獻。)" #: ../../whatsnew/3.11.rst:887 msgid "" "The behaviour of two :func:`math.pow` corner cases was changed, for " -"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, -" -"math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. Previously " -"they raised :exc:`ValueError`. (Contributed by Mark Dickinson in :issue:" -"`44339`.)" +"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, " +"-math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. " +"Previously they raised :exc:`ValueError`. (Contributed by Mark Dickinson " +"in :issue:`44339`.)" msgstr "" "為了與 IEEE 754 規範保持一致,更改了兩個 :func:`math.pow` 邊角案例 (corner " "case) 的行為。``math.pow(0.0, -math.inf)`` 和 ``math.pow(-0.0, -math.inf)`` " -"現在回傳 ``inf``,之前它們會引發 :exc:`ValueError`。(由 Mark Dickinson 在 :" -"issue:`44339` 中貢獻。)" +"現在回傳 ``inf``,之前它們會引發 :exc:`ValueError`。(由 Mark Dickinson " +"在 :issue:`44339` 中貢獻。)" #: ../../whatsnew/3.11.rst:893 msgid "" @@ -1497,9 +1528,9 @@ msgstr "operator" #: ../../whatsnew/3.11.rst:902 msgid "" -"A new function ``operator.call`` has been added, such that ``operator." -"call(obj, *args, **kwargs) == obj(*args, **kwargs)``. (Contributed by Antony " -"Lee in :issue:`44019`.)" +"A new function ``operator.call`` has been added, such that " +"``operator.call(obj, *args, **kwargs) == obj(*args, **kwargs)``. " +"(Contributed by Antony Lee in :issue:`44019`.)" msgstr "" "新增 ``operator.call`` 函式,使得 ``operator.call(obj, *args, **kwargs) == " "obj(*args, **kwargs)``。(由 Antony Lee 於 :issue:`44019` 中所貢獻。)" @@ -1511,8 +1542,8 @@ msgstr "os" #: ../../whatsnew/3.11.rst:912 msgid "" "On Windows, :func:`os.urandom` now uses ``BCryptGenRandom()``, instead of " -"``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na in :" -"issue:`44611`.)" +"``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na " +"in :issue:`44611`.)" msgstr "" "在 Windows 上,:func:`os.urandom` 現在使用 ``BCryptGenRandom()`` 以取代被棄用" "的 ``CryptGenRandom()``。(由 Donghee Na 於 :issue:`44611` 中所貢獻。)" @@ -1524,9 +1555,9 @@ msgstr "pathlib" #: ../../whatsnew/3.11.rst:922 msgid "" ":meth:`~pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` return only " -"directories if *pattern* ends with a pathname components separator: :data:" -"`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke Kawasima in :issue:" -"`22276` and :issue:`33392`.)" +"directories if *pattern* ends with a pathname components " +"separator: :data:`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke " +"Kawasima in :issue:`22276` and :issue:`33392`.)" msgstr "" "如果 *pattern* 以路徑名稱元件分隔符號 :data:`~os.sep` 或 :data:`~os.altsep` " "結尾,:meth:`~pathlib.Path.glob` 和 :meth:`~pathlib.Path.rglob` 只回傳目錄。" @@ -1544,8 +1575,8 @@ msgid "" msgstr "" "現在規則運算式 (regular expression) 是有支援原子性群組 (atomic grouping) " "(``(?>...)``) 和佔有性量詞 (possessive quantifier) (``*+``, ``++``, ``?+``, " -"``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka 在 :issue:" -"`433030` 中貢獻。)" +"``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka " +"在 :issue:`433030` 中貢獻。)" #: ../../whatsnew/3.11.rst:941 msgid "shutil" @@ -1556,8 +1587,8 @@ msgid "" "Add optional parameter *dir_fd* in :func:`shutil.rmtree`. (Contributed by " "Serhiy Storchaka in :issue:`46245`.)" msgstr "" -"新增 :func:`shutil.rmtree` 的可選參數 *dir_fd*。(由 Serhiy Storchaka 於 :" -"issue:`46245` 中所貢獻。)" +"新增 :func:`shutil.rmtree` 的可選參數 *dir_fd*。(由 Serhiy Storchaka " +"於 :issue:`46245` 中所貢獻。)" #: ../../whatsnew/3.11.rst:950 msgid "socket" @@ -1565,8 +1596,8 @@ msgstr "socket" #: ../../whatsnew/3.11.rst:952 msgid "" -"Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner in :issue:" -"`30512`.)" +"Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner " +"in :issue:`30512`.)" msgstr "" "新增 NetBSD 對於 CAN Socket 的支援。(由 Thomas Klausner 於 :issue:`30512` 中" "所貢獻。)" @@ -1578,8 +1609,8 @@ msgid "" "raising the last error. (Contributed by Irit Katriel in :issue:`29980`.)" msgstr "" "當連接失敗時,:meth:`~socket.create_connection` 有個選項可以引發一個包含所有" -"錯誤的 :exc:`ExceptionGroup`,而非只引發最後一個錯誤。(由 Irit Katriel 於 :" -"issue:`29980` 中貢獻。)" +"錯誤的 :exc:`ExceptionGroup`,而非只引發最後一個錯誤。(由 Irit Katriel " +"於 :issue:`29980` 中貢獻。)" #: ../../whatsnew/3.11.rst:964 msgid "sqlite3" @@ -1587,48 +1618,49 @@ msgstr "sqlite3" #: ../../whatsnew/3.11.rst:966 msgid "" -"You can now disable the authorizer by passing :const:`None` to :meth:" -"`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. Aasland in :" -"issue:`44491`.)" +"You can now disable the authorizer by passing :const:`None` " +"to :meth:`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. " +"Aasland in :issue:`44491`.)" msgstr "" -"現在可以透過將 :const:`None` 傳遞給 :meth:`~sqlite3.Connection." -"set_authorizer` 來停用 authorizer。(由 Erlend E. Aasland 於 :issue:`44491` " -"中貢獻。)" +"現在可以透過將 :const:`None` 傳遞" +"給 :meth:`~sqlite3.Connection.set_authorizer` 來停用 authorizer。(由 " +"Erlend E. Aasland 於 :issue:`44491` 中貢獻。)" #: ../../whatsnew/3.11.rst:970 msgid "" "Collation name :meth:`~sqlite3.Connection.create_collation` can now contain " -"any Unicode character. Collation names with invalid characters now raise :" -"exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " +"any Unicode character. Collation names with invalid characters now " +"raise :exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " "(Contributed by Erlend E. Aasland in :issue:`44688`.)" msgstr "" "定序 (collation) 名稱 :meth:`~sqlite3.Connection.create_collation` 現在可以包" -"含任何 Unicode 字元。帶有無效字元的定序名稱現在會引發 :exc:" -"`UnicodeEncodeError` 而不是 :exc:`sqlite3.ProgrammingError`。(由 Erlend E. " -"Aasland 在 :issue:`44688` 中貢獻。)" +"含任何 Unicode 字元。帶有無效字元的定序名稱現在會引" +"發 :exc:`UnicodeEncodeError` 而不是 :exc:`sqlite3.ProgrammingError`。(由 " +"Erlend E. Aasland 在 :issue:`44688` 中貢獻。)" #: ../../whatsnew/3.11.rst:975 msgid "" -":mod:`sqlite3` exceptions now include the SQLite extended error code as :" -"attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name as :attr:" -"`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, Daniel " -"Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" +":mod:`sqlite3` exceptions now include the SQLite extended error code " +"as :attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name " +"as :attr:`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, " +"Daniel Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" msgstr "" -":mod:`sqlite3` 例外現在包含 SQLite 擴充錯誤碼和 SQLite 錯誤名稱(分別為 :" -"attr:`~sqlite3.Error.sqlite_errorcode` 和 :attr:`~sqlite3.Error." -"sqlite_errorname`)。(由 Aviv Palivoda、Daniel Shahaf 和 Erlend E. Aasland " -"在 :issue:`16379` 和 :issue:`24139` 中貢獻。)" +":mod:`sqlite3` 例外現在包含 SQLite 擴充錯誤碼和 SQLite 錯誤名稱(分別" +"為 :attr:`~sqlite3.Error.sqlite_errorcode` " +"和 :attr:`~sqlite3.Error.sqlite_errorname`)。(由 Aviv Palivoda、Daniel " +"Shahaf 和 Erlend E. Aasland 在 :issue:`16379` 和 :issue:`24139` 中貢獻。)" #: ../../whatsnew/3.11.rst:981 msgid "" -"Add :meth:`~sqlite3.Connection.setlimit` and :meth:`~sqlite3.Connection." -"getlimit` to :class:`sqlite3.Connection` for setting and getting SQLite " -"limits by connection basis. (Contributed by Erlend E. Aasland in :issue:" -"`45243`.)" +"Add :meth:`~sqlite3.Connection.setlimit` " +"and :meth:`~sqlite3.Connection.getlimit` to :class:`sqlite3.Connection` for " +"setting and getting SQLite limits by connection basis. (Contributed by " +"Erlend E. Aasland in :issue:`45243`.)" msgstr "" -"將 :meth:`~sqlite3.Connection.setlimit` 和 :meth:`~sqlite3.Connection." -"getlimit` 新增到 :class:`sqlite3.Connection` 以根據連線來設定和取得 SQLite 限" -"制。(由 Erlend E. Aasland 在 :issue:`45243` 中貢獻。)" +"將 :meth:`~sqlite3.Connection.setlimit` " +"和 :meth:`~sqlite3.Connection.getlimit` 新增到 :class:`sqlite3.Connection` 以" +"根據連線來設定和取得 SQLite 限制。(由 Erlend E. Aasland 在 :issue:`45243` 中" +"貢獻。)" #: ../../whatsnew/3.11.rst:986 msgid "" @@ -1659,40 +1691,43 @@ msgid "" "(Contributed by Erlend E. Aasland in :issue:`44092`.)" msgstr "" "跨越不同回滾 (rollback) 的拿取動作不再引發 :exc:`~sqlite3.InterfaceError`,我" -"們將其留給 SQLite 函式庫來處理這些情況。(由 Erlend E. Aasland 在 :issue:" -"`44092` 中貢獻。)" +"們將其留給 SQLite 函式庫來處理這些情況。(由 Erlend E. Aasland " +"在 :issue:`44092` 中貢獻。)" #: ../../whatsnew/3.11.rst:1000 msgid "" -"Add :meth:`~sqlite3.Connection.serialize` and :meth:`~sqlite3.Connection." -"deserialize` to :class:`sqlite3.Connection` for serializing and " -"deserializing databases. (Contributed by Erlend E. Aasland in :issue:" -"`41930`.)" +"Add :meth:`~sqlite3.Connection.serialize` " +"and :meth:`~sqlite3.Connection.deserialize` to :class:`sqlite3.Connection` " +"for serializing and deserializing databases. (Contributed by Erlend E. " +"Aasland in :issue:`41930`.)" msgstr "" -"將 :meth:`~sqlite3.Connection.serialize` 和 :meth:`~sqlite3.Connection." -"deserialize` 新增到 :class:`sqlite3.Connection` 以用於序列化和反序列化資料" -"庫。(由 Erlend E. Aasland 在 :issue:`41930` 中貢獻。)" +"將 :meth:`~sqlite3.Connection.serialize` " +"和 :meth:`~sqlite3.Connection.deserialize` 新增" +"到 :class:`sqlite3.Connection` 以用於序列化和反序列化資料庫。(由 Erlend E. " +"Aasland 在 :issue:`41930` 中貢獻。)" #: ../../whatsnew/3.11.rst:1005 msgid "" -"Add :meth:`~sqlite3.Connection.create_window_function` to :class:`sqlite3." -"Connection` for creating aggregate window functions. (Contributed by Erlend " -"E. Aasland in :issue:`34916`.)" +"Add :meth:`~sqlite3.Connection.create_window_function` " +"to :class:`sqlite3.Connection` for creating aggregate window functions. " +"(Contributed by Erlend E. Aasland in :issue:`34916`.)" msgstr "" -"於 :class:`sqlite3.Connection` 加入 :meth:`~sqlite3.Connection." -"create_window_function` 已建立聚合視窗函式 (aggregate window function)。(由 " -"Erlend E. Aasland 於 :issue:`34916` 中貢獻。)" +"於 :class:`sqlite3.Connection` 加" +"入 :meth:`~sqlite3.Connection.create_window_function` 已建立聚合視窗函式 " +"(aggregate window function)。(由 Erlend E. Aasland 於 :issue:`34916` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1009 msgid "" -"Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. :" -"class:`sqlite3.Blob` allows incremental I/O operations on blobs. " -"(Contributed by Aviv Palivoda and Erlend E. Aasland in :issue:`24905`.)" +"Add :meth:`~sqlite3.Connection.blobopen` " +"to :class:`sqlite3.Connection`. :class:`sqlite3.Blob` allows incremental I/O " +"operations on blobs. (Contributed by Aviv Palivoda and Erlend E. Aasland " +"in :issue:`24905`.)" msgstr "" -"在 :class:`sqlite3.Connection` 新增 :meth:`~sqlite3.Connection.blobopen`。 :" -"class:`sqlite3.Blob` 允許對 blob 進行增量 I/O 操作 (incremental I/O " -"operations)。(由 Aviv Palivoda 和 Erlend E. Aasland 在 :issue:`24905` 中貢" -"獻。)" +"在 :class:`sqlite3.Connection` 新" +"增 :meth:`~sqlite3.Connection.blobopen`。 :class:`sqlite3.Blob` 允許對 blob " +"進行增量 I/O 操作 (incremental I/O operations)。(由 Aviv Palivoda 和 Erlend " +"E. Aasland 在 :issue:`24905` 中貢獻。)" #: ../../whatsnew/3.11.rst:1017 msgid "string" @@ -1700,15 +1735,15 @@ msgstr "string" #: ../../whatsnew/3.11.rst:1019 msgid "" -"Add :meth:`~string.Template.get_identifiers` and :meth:`~string.Template." -"is_valid` to :class:`string.Template`, which respectively return all valid " -"placeholders, and whether any invalid placeholders are present. (Contributed " -"by Ben Kehoe in :gh:`90465`.)" +"Add :meth:`~string.Template.get_identifiers` " +"and :meth:`~string.Template.is_valid` to :class:`string.Template`, which " +"respectively return all valid placeholders, and whether any invalid " +"placeholders are present. (Contributed by Ben Kehoe in :gh:`90465`.)" msgstr "" -"新增 :meth:`~string.Template.get_identifiers` 和 :meth:`~string.Template." -"is_valid` 於 :class:`string.Template`,分別能夠回傳所有合格的預留位置 " -"(placeholder) 與是否有任何不合格的預留位置存在。(由 Ben Kehoe 於 :gh:" -"`90465` 中貢獻。)" +"新增 :meth:`~string.Template.get_identifiers` " +"和 :meth:`~string.Template.is_valid` 於 :class:`string.Template`,分別能夠回" +"傳所有合格的預留位置 (placeholder) 與是否有任何不合格的預留位置存在。(由 " +"Ben Kehoe 於 :gh:`90465` 中貢獻。)" #: ../../whatsnew/3.11.rst:1029 msgid "sys" @@ -1719,8 +1754,8 @@ msgid "" ":func:`sys.exc_info` now derives the ``type`` and ``traceback`` fields from " "the ``value`` (the exception instance), so when an exception is modified " "while it is being handled, the changes are reflected in the results of " -"subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel in :" -"issue:`45711`.)" +"subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel " +"in :issue:`45711`.)" msgstr "" ":func:`sys.exc_info` 現在從 ``value``\\ (例外實例)衍生出 ``type`` 和 " "``traceback`` 欄位,因此當例外在處理過程中被修改時,變更會反映在 :func:`!" @@ -1729,20 +1764,20 @@ msgstr "" #: ../../whatsnew/3.11.rst:1037 msgid "" "Add :func:`sys.exception` which returns the active exception instance " -"(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :" -"issue:`46328`.)" +"(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel " +"in :issue:`46328`.)" msgstr "" -"新增會回傳活躍例外實例 (active exception instance) 的 :func:`sys." -"exception`\\ (等價於 ``sys.exc_info()[1]``\\ )。(由 Irit Katriel 於 :" -"issue:`46328` 中所貢獻。)" +"新增會回傳活躍例外實例 (active exception instance) " +"的 :func:`sys.exception`\\ (等價於 ``sys.exc_info()[1]``\\ )。(由 Irit " +"Katriel 於 :issue:`46328` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1041 msgid "" "Add the :data:`sys.flags.safe_path <sys.flags>` flag. (Contributed by Victor " "Stinner in :gh:`57684`.)" msgstr "" -"新增 :data:`sys.flags.safe_path <sys.flags>` 旗標。(由 Victor Stinner 於 :" -"gh:`57684` 中所貢獻。)" +"新增 :data:`sys.flags.safe_path <sys.flags>` 旗標。(由 Victor Stinner " +"於 :gh:`57684` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1048 msgid "sysconfig" @@ -1764,7 +1799,7 @@ msgstr "" "新增了三個\\ :ref:`安裝方案 <installation_paths>`\\ (*posix_venv*、" "*nt_venv* 和 *venv*),它們在 Python 建立新的虛擬環境或在虛擬環境中執行環境使" "用。前兩個方案(*posix_venv* 和 *nt_venv*)是非 Windows 和 Windows 作業系統所" -"特有的,*venv* 本質上會根據 Python 運行的操作系統來做為其中之一的別名。這對修" +"特有的,*venv* 本質上會根據 Python 運行的作業系統來做為其中之一的別名。這對修" "改 :func:`sysconfig.get_preferred_scheme` 的下游發布者很有用。建立新虛擬環境" "的第三方程式碼應該使用新的 *venv* 安裝方案來確定路徑,就像 :mod:`venv` 一樣。" "(由 Miro Hrončok 在 :issue:`45413` 中貢獻。)" @@ -1778,13 +1813,13 @@ msgid "" ":class:`~tempfile.SpooledTemporaryFile` objects now fully implement the " "methods of :class:`io.BufferedIOBase` or :class:`io.TextIOBase` (depending " "on file mode). This lets them work correctly with APIs that expect file-like " -"objects, such as compression modules. (Contributed by Carey Metcalfe in :gh:" -"`70363`.)" +"objects, such as compression modules. (Contributed by Carey Metcalfe " +"in :gh:`70363`.)" msgstr "" -":class:`~tempfile.SpooledTemporaryFile` 物件現在完整實作了 :class:`io." -"BufferedIOBase` 或 :class:`io.TextIOBase` 的方法(取決於檔案模式),這使它們" -"能夠正確地使用需要類檔案物件的 API,例如壓縮模組。(由 Carey Metcalfe 在 :gh:" -"`70363` 中貢獻。)" +":class:`~tempfile.SpooledTemporaryFile` 物件現在完整實作" +"了 :class:`io.BufferedIOBase` 或 :class:`io.TextIOBase` 的方法(取決於檔案模" +"式),這使它們能夠正確地使用需要類檔案物件的 API,例如壓縮模組。(由 Carey " +"Metcalfe 在 :gh:`70363` 中貢獻。)" #: ../../whatsnew/3.11.rst:1080 msgid "threading" @@ -1796,13 +1831,13 @@ msgid "" "(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses " "the monotonic clock (:const:`time.CLOCK_MONOTONIC`) for the timeout, rather " "than using the system clock (:const:`time.CLOCK_REALTIME`), to not be " -"affected by system clock changes. (Contributed by Victor Stinner in :issue:" -"`41710`.)" +"affected by system clock changes. (Contributed by Victor Stinner " +"in :issue:`41710`.)" msgstr "" "在 Unix 上,如果 ``sem_clockwait()`` 函式在 C 函式庫(glibc 2.30 與其更新的版" -"本)中可被使用,則 :meth:`threading.Lock.acquire` 方法現在會使用單調時鐘 (:" -"const:`time. CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 (:" -"const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " +"本)中可被使用,則 :meth:`threading.Lock.acquire` 方法現在會使用單調時鐘 " +"(:const:`time. CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 " +"(:const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " "在 :issue:`41710` 中貢獻。)" #: ../../whatsnew/3.11.rst:1093 @@ -1818,9 +1853,10 @@ msgid "" "Benjamin Szőke and Victor Stinner in :issue:`21302`.)" msgstr "" "在 Unix 上,如果可用的話,:func:`time.sleep` 現在會使用 " -"``clock_nanosleep()`` 或 ``nanosleep()`` 函式,其解析度為 1 納秒(10\\ :sup:" -"`-9` 秒),而不是使用解析度為 1 微秒(10\\ :sup:`-6` 秒)的 ``select()``。" -"(由 Benjamin Szőke 和 Victor Stinner 在 :issue:`21302` 中貢獻。)" +"``clock_nanosleep()`` 或 ``nanosleep()`` 函式,其解析度為 1 納秒" +"(10\\ :sup:`-9` 秒),而不是使用解析度為 1 微秒(10\\ :sup:`-6` 秒)的 " +"``select()``。(由 Benjamin Szőke 和 Victor Stinner 在 :issue:`21302` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1101 msgid "" @@ -1829,15 +1865,15 @@ msgid "" "hardware/drivers/kernel/high-resolution-timers>`_ which has a resolution of " "100 nanoseconds (10\\ :sup:`-7` seconds). Previously, it had a resolution of " "1 millisecond (10\\ :sup:`-3` seconds). (Contributed by Benjamin Szőke, " -"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` and :issue:" -"`45429`.)" +"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` " +"and :issue:`45429`.)" msgstr "" "在 Windows 8.1 或更新的平台上,:func:`time.sleep` 現在使用了一個基於\\ `高解" "析度計時器 <https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/" "high-resolution-timers>`_\\ 的可等待 (waitable) 計時器,解析度為 100 奈秒" "(即 10\\ :sup:`-7` 秒)。在這之前,它只有 1 微秒(10\\ :sup:`-3` 秒) 的解析" -"度。(由 Benjamin Szőke、Donghee Na、Eryk Sun 和 Victor Stinner 於 :issue:" -"`21302` 與 :issue:`45429` 中貢獻。)" +"度。(由 Benjamin Szőke、Donghee Na、Eryk Sun 和 Victor Stinner " +"於 :issue:`21302` 與 :issue:`45429` 中貢獻。)" #: ../../whatsnew/3.11.rst:1112 msgid "tkinter" @@ -1868,13 +1904,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1129 msgid "" -"Add :func:`traceback.TracebackException.print`, which prints the formatted :" -"exc:`~traceback.TracebackException` instance to a file. (Contributed by Irit " -"Katriel in :issue:`33809`.)" +"Add :func:`traceback.TracebackException.print`, which prints the " +"formatted :exc:`~traceback.TracebackException` instance to a file. " +"(Contributed by Irit Katriel in :issue:`33809`.)" msgstr "" -"新增 :func:`traceback.TracebackException.print`,它會印出格式化的 :exc:" -"`~traceback.TracebackException` 實例至一個檔案。(由 Irit Katriel 在 :issue:" -"`33809` 中貢獻。)" +"新增 :func:`traceback.TracebackException.print`,它會印出格式化" +"的 :exc:`~traceback.TracebackException` 實例至一個檔案。(由 Irit Katriel " +"在 :issue:`33809` 中貢獻。)" #: ../../whatsnew/3.11.rst:1137 msgid "typing" @@ -1886,14 +1922,16 @@ msgstr "重大變更請見 :ref:`new-feat-related-type-hints-311`。" #: ../../whatsnew/3.11.rst:1141 msgid "" -"Add :func:`typing.assert_never` and :class:`typing.Never`. :func:`typing." -"assert_never` is useful for asking a type checker to confirm that a line of " -"code is not reachable. At runtime, it raises an :exc:`AssertionError`. " -"(Contributed by Jelle Zijlstra in :gh:`90633`.)" +"Add :func:`typing.assert_never` " +"and :class:`typing.Never`. :func:`typing.assert_never` is useful for asking " +"a type checker to confirm that a line of code is not reachable. At runtime, " +"it raises an :exc:`AssertionError`. (Contributed by Jelle Zijlstra " +"in :gh:`90633`.)" msgstr "" -"新增 :func:`typing.assert_never` 和 :class:`typing.Never`。 :func:`typing." -"assert_never` 可用於要型別檢查器確認某行程式碼是否不可觸及。在執行環境,它會" -"引發 :exc:`AssertionError`。(由 Jelle Zijlstra 在 :gh:`90633` 中貢獻。)" +"新增 :func:`typing.assert_never` " +"和 :class:`typing.Never`。 :func:`typing.assert_never` 可用於要型別檢查器確認" +"某行程式碼是否不可觸及。在執行環境,它會引發 :exc:`AssertionError`。(由 " +"Jelle Zijlstra 在 :gh:`90633` 中貢獻。)" #: ../../whatsnew/3.11.rst:1147 msgid "" @@ -1921,16 +1959,16 @@ msgid "" ":data:`typing.TypedDict` types can now be generic. (Contributed by Samodya " "Abeysiriwardane in :gh:`89026`.)" msgstr "" -":data:`typing.TypedDict` 型別現可為泛型。(由 Samodya Abeysiriwardane 於 :gh:" -"`89026` 中所貢獻。)" +":data:`typing.TypedDict` 型別現可為泛型。(由 Samodya Abeysiriwardane " +"於 :gh:`89026` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1160 msgid "" ":class:`~typing.NamedTuple` types can now be generic. (Contributed by Serhiy " "Storchaka in :issue:`43923`.)" msgstr "" -":class:`~typing.NamedTuple` 型別現可為泛型。(由 Serhiy Storchaka 於 :issue:" -"`43923` 中所貢獻。)" +":class:`~typing.NamedTuple` 型別現可為泛型。(由 Serhiy Storchaka " +"於 :issue:`43923` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1163 msgid "" @@ -1953,8 +1991,8 @@ msgstr "" msgid "" "The :func:`typing.get_overloads` function can be used for introspecting the " "overloads of a function. :func:`typing.clear_overloads` can be used to clear " -"all registered overloads of a function. (Contributed by Jelle Zijlstra in :" -"gh:`89263`.)" +"all registered overloads of a function. (Contributed by Jelle Zijlstra " +"in :gh:`89263`.)" msgstr "" ":func:`typing.get_overloads` 函式可用於自我檢查 (introspect) 一個函式的過載 " "(overload)。:func:`typing.clear_overloads` 可用於清除一個函式的所有已註冊過" @@ -1993,28 +2031,28 @@ msgid "" "references in :ref:`PEP 585 generic aliases <types-genericalias>`. " "(Contributed by Niklas Rosenstein in :gh:`85542`.)" msgstr "" -"作為\\ :ref:`PEP 585 泛化別名 <types-genericalias>`\\ 中的前向參照,:func:" -"`typing.get_type_hints` 現支援了為字串求值 (evaluate)。(由 Niklas " +"作為\\ :ref:`PEP 585 泛化別名 <types-genericalias>`\\ 中的前向參" +"照,:func:`typing.get_type_hints` 現支援了為字串求值 (evaluate)。(由 Niklas " "Rosenstein 在 :gh:`85542` 中貢獻。)" #: ../../whatsnew/3.11.rst:1192 msgid "" ":func:`typing.get_type_hints` no longer adds :data:`~typing.Optional` to " -"parameters with ``None`` as a default. (Contributed by Nikita Sobolev in :gh:" -"`90353`.)" +"parameters with ``None`` as a default. (Contributed by Nikita Sobolev " +"in :gh:`90353`.)" msgstr "" ":func:`typing.get_type_hints` 不再將 :data:`~typing.Optional` 新增到預設為 " "``None`` 的參數中。(由 Nikita Sobolev 在 :gh:`90353` 中貢獻。)" #: ../../whatsnew/3.11.rst:1196 msgid "" -":func:`typing.get_type_hints` now supports evaluating bare stringified :data:" -"`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard in :gh:" -"`90711`.)" +":func:`typing.get_type_hints` now supports evaluating bare " +"stringified :data:`~typing.ClassVar` annotations. (Contributed by Gregory " +"Beauregard in :gh:`90711`.)" msgstr "" ":func:`typing.get_type_hints` 現在支援為無修飾 (bare) 字串化 (stringified) " -"的 :data:`~typing.ClassVar` 標註來求值。(由 Gregory Beauregard 在 :gh:" -"`90711` 中貢獻。)" +"的 :data:`~typing.ClassVar` 標註來求值。(由 Gregory Beauregard " +"在 :gh:`90711` 中貢獻。)" #: ../../whatsnew/3.11.rst:1200 msgid "" @@ -2043,17 +2081,21 @@ msgstr "unittest" #: ../../whatsnew/3.11.rst:1219 msgid "" -"Added methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest." -"TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :" -"meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of class :class:" -"`~unittest.IsolatedAsyncioTestCase` and function :func:`unittest." -"enterModuleContext`. (Contributed by Serhiy Storchaka in :issue:`45046`.)" -msgstr "" -"新增 :class:`~unittest.TestCase` 類別的 :meth:`~unittest.TestCase." -"enterContext` 與 :meth:`~unittest.TestCase.enterClassContext` 方法、 :class:" -"`~unittest.IsolatedAsyncioTestCase` 類別 的 :meth:`~unittest." -"IsolatedAsyncioTestCase.enterAsyncContext` 方法、:func:`unittest." -"enterModuleContext` 函式。(由 Serhiy Storchaka 於 :issue:`45046` 貢獻。)" +"Added methods :meth:`~unittest.TestCase.enterContext` " +"and :meth:`~unittest.TestCase.enterClassContext` of " +"class :class:`~unittest.TestCase`, " +"method :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of " +"class :class:`~unittest.IsolatedAsyncioTestCase` and " +"function :func:`unittest.enterModuleContext`. (Contributed by Serhiy " +"Storchaka in :issue:`45046`.)" +msgstr "" +"新增 :class:`~unittest.TestCase` 類別" +"的 :meth:`~unittest.TestCase.enterContext` " +"與 :meth:`~unittest.TestCase.enterClassContext` 方" +"法、 :class:`~unittest.IsolatedAsyncioTestCase` 類別 " +"的 :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` 方" +"法、:func:`unittest.enterModuleContext` 函式。(由 Serhiy Storchaka " +"於 :issue:`45046` 貢獻。)" #: ../../whatsnew/3.11.rst:1231 msgid "venv" @@ -2067,8 +2109,8 @@ msgid "" "installation scheme is the default. That means that downstream distributors " "can change the default sysconfig install scheme without changing behavior of " "virtual environments. Third party code that also creates new virtual " -"environments should do the same. (Contributed by Miro Hrončok in :issue:" -"`45413`.)" +"environments should do the same. (Contributed by Miro Hrončok " +"in :issue:`45413`.)" msgstr "" "建立新的 Python 虛擬環境時,*venv* :ref:`sysconfig 安裝方案 " "<installation_paths>`\\ 會被用於確定環境內的路徑。當 Python 在虛擬環境中運行" @@ -2082,10 +2124,10 @@ msgstr "warnings" #: ../../whatsnew/3.11.rst:1249 msgid "" -":func:`warnings.catch_warnings` now accepts arguments for :func:`warnings." -"simplefilter`, providing a more concise way to locally ignore warnings or " -"convert them to errors. (Contributed by Zac Hatfield-Dodds in :issue:" -"`47074`.)" +":func:`warnings.catch_warnings` now accepts arguments " +"for :func:`warnings.simplefilter`, providing a more concise way to locally " +"ignore warnings or convert them to errors. (Contributed by Zac Hatfield-" +"Dodds in :issue:`47074`.)" msgstr "" ":func:`warnings.catch_warnings` 現在接受 :func:`warnings.simplefilter` 的引" "數,提供了一種更簡潔的方法來在本地端忽略警告或將它們轉換為錯誤。(由 Zac " @@ -2097,8 +2139,8 @@ msgstr "zipfile" #: ../../whatsnew/3.11.rst:1259 msgid "" -"Added support for specifying member name encoding for reading metadata in a :" -"class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " +"Added support for specifying member name encoding for reading metadata in " +"a :class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " "Stephen J. Turnbull and Serhiy Storchaka in :issue:`28080`.)" msgstr "" "新增了對指定成員名稱編碼的支援,以便在 :class:`~zipfile.ZipFile` 的目錄和檔案" @@ -2115,13 +2157,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1267 msgid "" -"Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` and :attr:" -"`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by Miguel " -"Brito in :gh:`88261`.)" +"Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` " +"and :attr:`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by " +"Miguel Brito in :gh:`88261`.)" msgstr "" -"於 :class:`zipfile.Path` 新增 :attr:`~zipfile.Path.stem`、:attr:`~zipfile." -"Path.suffix` 和 :attr:`~zipfile.Path.suffixes`。(由 Miguel Brito 於 :gh:" -"`88261` 貢獻。)" +"於 :class:`zipfile.Path` 新" +"增 :attr:`~zipfile.Path.stem`、:attr:`~zipfile.Path.suffix` " +"和 :attr:`~zipfile.Path.suffixes`。(由 Miguel Brito 於 :gh:`88261` 貢獻。)" #: ../../whatsnew/3.11.rst:1275 msgid "Optimizations" @@ -2129,8 +2171,9 @@ msgstr "最佳化" #: ../../whatsnew/3.11.rst:1277 msgid "" -"This section covers specific optimizations independent of the :ref:" -"`whatsnew311-faster-cpython` project, which is covered in its own section." +"This section covers specific optimizations independent of " +"the :ref:`whatsnew311-faster-cpython` project, which is covered in its own " +"section." msgstr "" "這個部分會涵蓋到特定的最佳化,但獨立於擁有自己一個說明的\\ :ref:`whatsnew311-" "faster-cpython` 計畫。" @@ -2151,8 +2194,8 @@ msgstr "" msgid "" "Integer division (``//``) is better tuned for optimization by compilers. It " "is now around 20% faster on x86-64 when dividing an :class:`int` by a value " -"smaller than ``2**30``. (Contributed by Gregory P. Smith and Tim Peters in :" -"gh:`90564`.)" +"smaller than ``2**30``. (Contributed by Gregory P. Smith and Tim Peters " +"in :gh:`90564`.)" msgstr "" "整數除法 (``//``) 為了編譯器最佳化而被調校過。現在將 :class:`int` 除以小於 " "``2**30`` 的值時,在 x86-64 上快了大約 20%。(由 Gregory P. Smith 和 Tim " @@ -2168,20 +2211,21 @@ msgstr "" #: ../../whatsnew/3.11.rst:1294 msgid "" -"Resizing lists is streamlined for the common case, speeding up :meth:`list." -"append` by ≈15% and simple :term:`list comprehension`\\s by up to 20-30% " -"(Contributed by Dennis Sweeney in :gh:`91165`.)" +"Resizing lists is streamlined for the common case, speeding " +"up :meth:`list.append` by ≈15% and simple :term:`list comprehension`\\s by " +"up to 20-30% (Contributed by Dennis Sweeney in :gh:`91165`.)" msgstr "" "調整 list 大小在常見情況下增進了效能,為 :meth:`list.append` 加快了約 15% 並" -"為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney 在 :" -"gh:`91165` 中貢獻。)" +"為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney " +"在 :gh:`91165` 中貢獻。)" #: ../../whatsnew/3.11.rst:1299 msgid "" "Dictionaries don't store hash values when all keys are Unicode objects, " -"decreasing :class:`dict` size. For example, ``sys.getsizeof(dict." -"fromkeys(\"abcdefg\"))`` is reduced from 352 bytes to 272 bytes (23% " -"smaller) on 64-bit platforms. (Contributed by Inada Naoki in :issue:`46845`.)" +"decreasing :class:`dict` size. For example, " +"``sys.getsizeof(dict.fromkeys(\"abcdefg\"))`` is reduced from 352 bytes to " +"272 bytes (23% smaller) on 64-bit platforms. (Contributed by Inada Naoki " +"in :issue:`46845`.)" msgstr "" "當所有鍵都是 Unicode 物件時,字典不存儲雜湊值,減少了 :class:`dict` 的大小。" "例如,``sys.getsizeof(dict.fromkeys(\"abcdefg\"))`` 在 64-bit 平台上從 352 位" @@ -2195,8 +2239,8 @@ msgid "" "for a ≈60 MiB file. (Contributed by msoxzw in :gh:`91487`.)" msgstr "" "使用 :class:`asyncio.DatagramProtocol` 以透過 UDP 傳輸大文件時,現在速度提高" -"了幾個數量級,傳輸 ≈60 MiB 檔案的速度提高了 100 多倍。(由 msoxzw 在 :gh:" -"`91487` 中貢獻。)" +"了幾個數量級,傳輸 ≈60 MiB 檔案的速度提高了 100 多倍。(由 msoxzw " +"在 :gh:`91487` 中貢獻。)" #: ../../whatsnew/3.11.rst:1310 msgid "" @@ -2205,21 +2249,22 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`37295`.)" msgstr "" ":mod:`math` 函式 :func:`~math.comb` 和 :func:`~math.perm` 針對較大引數現在快" -"了 ≈10 倍(對於更大的 *k* 有更大的加速)。(由 Serhiy Storchaka 在 :issue:" -"`37295` 中貢獻。)" +"了 ≈10 倍(對於更大的 *k* 有更大的加速)。(由 Serhiy Storchaka " +"在 :issue:`37295` 中貢獻。)" #: ../../whatsnew/3.11.rst:1314 msgid "" -"The :mod:`statistics` functions :func:`~statistics.mean`, :func:`~statistics." -"variance` and :func:`~statistics.stdev` now consume iterators in one pass " -"rather than converting them to a :class:`list` first. This is twice as fast " -"and can save substantial memory. (Contributed by Raymond Hettinger in :gh:" -"`90415`.)" +"The :mod:`statistics` " +"functions :func:`~statistics.mean`, :func:`~statistics.variance` " +"and :func:`~statistics.stdev` now consume iterators in one pass rather than " +"converting them to a :class:`list` first. This is twice as fast and can save " +"substantial memory. (Contributed by Raymond Hettinger in :gh:`90415`.)" msgstr "" -":mod:`statistics` 函式 :func:`~statistics.mean`、:func:`~statistics." -"variance` 和 :func:`~statistics.stdev` 現在會一次性的消耗疊代器,而不是先將它" -"們轉換為 :class:`list`,這讓速度提升為兩倍並可以節省大量記憶體空間。(由 " -"Raymond Hettinger 在 :gh:`90415` 中貢獻。)" +":mod:`statistics` 函" +"式 :func:`~statistics.mean`、:func:`~statistics.variance` " +"和 :func:`~statistics.stdev` 現在會一次性的消耗疊代器,而不是先將它們轉換" +"為 :class:`list`,這讓速度提升為兩倍並可以節省大量記憶體空間。(由 Raymond " +"Hettinger 在 :gh:`90415` 中貢獻。)" #: ../../whatsnew/3.11.rst:1320 msgid "" @@ -2252,9 +2297,9 @@ msgid "" "startup` and :ref:`whatsnew311-faster-runtime`. Optimizations not covered by " "this project are listed separately under :ref:`whatsnew311-optimizations`." msgstr "" -"此計畫專注在 Python 的 :ref:`whatsnew311-faster-startup` 和 :ref:" -"`whatsnew311-faster-runtime`。不在此專案內的最佳化被獨立列出在 :ref:" -"`whatsnew311-optimizations`。" +"此計畫專注在 Python 的 :ref:`whatsnew311-faster-startup` " +"和 :ref:`whatsnew311-faster-runtime`。不在此專案內的最佳化被獨立列出" +"在 :ref:`whatsnew311-optimizations`。" #: ../../whatsnew/3.11.rst:1346 msgid "Faster Startup" @@ -2287,9 +2332,9 @@ msgid "" "statically allocated by the interpreter. This reduces the steps in module " "execution process to:" msgstr "" -"在 Python 3.11 中,核心模組在 Python 啟動時必須被「凍結」,這意味著它們的\\ :" -"ref:`程式碼物件 <codeobjects>`\\ (和位元組碼)是由直譯器靜態分配的。這將模組" -"執行過程中的步驟減少為:" +"在 Python 3.11 中,核心模組在 Python 啟動時必須被「凍結」,這意味著它們的" +"\\ :ref:`程式碼物件 <codeobjects>`\\ (和位元組碼)是由直譯器靜態分配的。這將" +"模組執行過程中的步驟減少為:" #: ../../whatsnew/3.11.rst:1367 msgid "Statically allocated code object -> Evaluate" @@ -2345,10 +2390,10 @@ msgstr "" #: ../../whatsnew/3.11.rst:1396 msgid "" "Old-style :ref:`frame objects <frame-objects>` are now created only when " -"requested by debuggers or by Python introspection functions such as :func:" -"`sys._getframe` and :func:`inspect.currentframe`. For most user code, no " -"frame objects are created at all. As a result, nearly all Python functions " -"calls have sped up significantly. We measured a 3-7% speedup in " +"requested by debuggers or by Python introspection functions such " +"as :func:`sys._getframe` and :func:`inspect.currentframe`. For most user " +"code, no frame objects are created at all. As a result, nearly all Python " +"functions calls have sped up significantly. We measured a 3-7% speedup in " "pyperformance." msgstr "" "舊式\\ :ref:`幀物件 <frame-objects>`\\ 現在僅在除錯器或 Python 自我檢查函式" @@ -2388,13 +2433,14 @@ msgid "" "Most Python function calls now consume no C stack space, speeding them up. " "In simple recursive functions like fibonacci or factorial, we observed a " "1.7x speedup. This also means recursive functions can recurse significantly " -"deeper (if the user increases the recursion limit with :func:`sys." -"setrecursionlimit`). We measured a 1-3% improvement in pyperformance." +"deeper (if the user increases the recursion limit " +"with :func:`sys.setrecursionlimit`). We measured a 1-3% improvement in " +"pyperformance." msgstr "" "現在大多數 Python 函式的呼叫因為不會佔用 C 堆疊空間而被加速。在斐波那契 " "(fibonacci) 或階乘等簡單遞迴函式中,觀察到 1.7 倍的加速。這也意味著遞迴函式可" -"以遞迴得更深(如果使用者有增加\\ :func:`遞迴限制 <sys." -"setrecursionlimit>`\\ )。我們在 pyperformance 測得 1-3% 的改進。" +"以遞迴得更深(如果使用者有增加\\ :func:`遞迴限制 " +"<sys.setrecursionlimit>`\\ )。我們在 pyperformance 測得 1-3% 的改進。" #: ../../whatsnew/3.11.rst:1427 msgid "(Contributed by Pablo Galindo and Mark Shannon in :issue:`45256`.)" @@ -2422,11 +2468,11 @@ msgid "" "more specialized one. This specialized operation uses fast paths available " "only to those use cases/types, which generally outperform their generic " "counterparts. This also brings in another concept called *inline caching*, " -"where Python caches the results of expensive operations directly in the :" -"term:`bytecode`." +"where Python caches the results of expensive operations directly in " +"the :term:`bytecode`." msgstr "" "在執行環境,Python 將嘗試在執行中的程式碼內尋找常用模式和型別穩定,然後 " -"Python 將用更特化的操作替換當前操作。這種特化操作運用了僅適用於那些用例/型別" +"Python 將用更特化的操作替換目前操作。這種特化操作運用了僅適用於那些用例/型別" "的快速路徑,這通常優於它們的泛用對應 (generic counterparts)。這也引入了另一個" "稱為\\ *行內快取 (inline caching)*\\ 的概念,其中 Python 將繁重操作的結果直接" "快取在\\ :term:`位元組碼 <bytecode>`\\ 中。" @@ -2455,13 +2501,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1457 msgid "" -"(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. See :" -"pep:`659` for more information. Implementation by Mark Shannon and Brandt " -"Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" +"(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. " +"See :pep:`659` for more information. Implementation by Mark Shannon and " +"Brandt Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" msgstr "" -"(PEP 由 Mark Shannon 撰寫、概念啟發自 Stefan Brunthaler。詳情請見 :pep:" -"`659`。由 Mark Shannon 和 Brandt Bucher 實作,Irit Katriel 和 Dennis Sweeney " -"亦提供了額外的幫助。)" +"(PEP 由 Mark Shannon 撰寫、概念啟發自 Stefan Brunthaler。詳情請" +"見 :pep:`659`。由 Mark Shannon 和 Brandt Bucher 實作,Irit Katriel 和 Dennis " +"Sweeney 亦提供了額外的幫助。)" #: ../../whatsnew/3.11.rst:1465 msgid "Operation" @@ -2501,9 +2547,9 @@ msgstr "``x * x``" #: ../../whatsnew/3.11.rst:1468 msgid "" -"Binary add, multiply and subtract for common types such as :class:`int`, :" -"class:`float` and :class:`str` take custom fast paths for their underlying " -"types." +"Binary add, multiply and subtract for common types such " +"as :class:`int`, :class:`float` and :class:`str` take custom fast paths for " +"their underlying types." msgstr "" "常見型別如 :class:`int`、:class:`float` 與 :class:`str` 的二元加法、乘法與減" "法,為底層型別採取了特製的快速路徑。" @@ -2526,16 +2572,16 @@ msgstr "``a[i]``" #: ../../whatsnew/3.11.rst:1474 msgid "" -"Subscripting container types such as :class:`list`, :class:`tuple` and :" -"class:`dict` directly index the underlying data structures." +"Subscripting container types such as :class:`list`, :class:`tuple` " +"and :class:`dict` directly index the underlying data structures." msgstr "" "下標容器型別如 :class:`list`、:class:`tuple` 和 :class:`dict` 直接索引底層的" "資料結構。" #: ../../whatsnew/3.11.rst:1478 msgid "" -"Subscripting custom :meth:`~object.__getitem__` is also inlined similar to :" -"ref:`inline-calls`." +"Subscripting custom :meth:`~object.__getitem__` is also inlined similar " +"to :ref:`inline-calls`." msgstr "" "下標自定義 :meth:`~object.__getitem__` 也是行內的,類似於 :ref:`inline-" "calls`。" @@ -2578,8 +2624,8 @@ msgstr "``C(arg)``" #: ../../whatsnew/3.11.rst:1484 msgid "" -"Calls to common builtin (C) functions and types such as :func:`len` and :" -"class:`str` directly call their underlying C version. This avoids going " +"Calls to common builtin (C) functions and types such as :func:`len` " +"and :class:`str` directly call their underlying C version. This avoids going " "through the internal calling convention." msgstr "" "常見內建 (C) 函式和型別的呼叫,例如 :func:`len` 和 :class:`str`,會直接呼叫它" @@ -2717,8 +2763,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:1513 msgid "" "A similar optimization already existed since Python 3.10. 3.11 specializes " -"for more forms. Furthermore, all attribute loads should be sped up by :issue:" -"`45947`." +"for more forms. Furthermore, all attribute loads should be sped up " +"by :issue:`45947`." msgstr "" "類似的最佳化自從 Python 3.10 就存在。3.11 特別處理了更多形式。此外,所有屬性" "載入也被 :issue:`45947` 所加速。" @@ -2734,17 +2780,17 @@ msgid "" "Mark Shannon in :issue:`45340` and :issue:`40116`.)" msgstr "" "物件現在因為使用了惰性建立的物件命名空間所以需要更少的記憶體。它們的命名空間" -"字典現在也更自由地共享鍵。(由 Mark Shannon 於 :issue:`45340` 和 :issue:" -"`40116` 貢獻。 )" +"字典現在也更自由地共享鍵。(由 Mark Shannon 於 :issue:`45340` " +"和 :issue:`40116` 貢獻。 )" #: ../../whatsnew/3.11.rst:1527 msgid "" -"\"Zero-cost\" exceptions are implemented, eliminating the cost of :keyword:" -"`try` statements when no exception is raised. (Contributed by Mark Shannon " -"in :issue:`40222`.)" +"\"Zero-cost\" exceptions are implemented, eliminating the cost " +"of :keyword:`try` statements when no exception is raised. (Contributed by " +"Mark Shannon in :issue:`40222`.)" msgstr "" -"實作了「無代價 (Zero-cost)」的例外,消除了在沒有例外被引發時的 :keyword:" -"`try` 陳述式開銷。(由 Mark Shannon 於 :issue:`40222` 貢獻。)" +"實作了「無代價 (Zero-cost)」的例外,消除了在沒有例外被引發時" +"的 :keyword:`try` 陳述式開銷。(由 Mark Shannon 於 :issue:`40222` 貢獻。)" #: ../../whatsnew/3.11.rst:1531 msgid "" @@ -2760,9 +2806,9 @@ msgid "" ":mod:`re`'s regular expression matching engine has been partially " "refactored, and now uses computed gotos (or \"threaded code\") on supported " "platforms. As a result, Python 3.11 executes the `pyperformance regular " -"expression benchmarks <https://pyperformance.readthedocs.io/benchmarks." -"html#regex-dna>`_ up to 10% faster than Python 3.10. (Contributed by Brandt " -"Bucher in :gh:`91404`.)" +"expression benchmarks <https://pyperformance.readthedocs.io/" +"benchmarks.html#regex-dna>`_ up to 10% faster than Python 3.10. (Contributed " +"by Brandt Bucher in :gh:`91404`.)" msgstr "" ":mod:`re` 的正規表示式比對引擎部分被重構,且現在會有支援的平台上使用 " "computed gotos(或者「執行緒程式碼 (threaded code)」),因此 Python 3.11 在執" @@ -2776,7 +2822,7 @@ msgstr "FAQ" #: ../../whatsnew/3.11.rst:1551 msgid "How should I write my code to utilize these speedups?" -msgstr "我該如何在程式碼中獲取這些加速?" +msgstr "我該如何在程式碼中取得這些加速?" #: ../../whatsnew/3.11.rst:1553 msgid "" @@ -2897,9 +2943,9 @@ msgstr ":opcode:`MAKE_CELL` 被用於建立 :ref:`cell-objects`。" #: ../../whatsnew/3.11.rst:1632 msgid "" -":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle the :" -"ref:`new exception groups and except* <whatsnew311-pep654>` added in :pep:" -"`654`." +":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle " +"the :ref:`new exception groups and except* <whatsnew311-pep654>` added " +"in :pep:`654`." msgstr "" ":opcode:`CHECK_EG_MATCH` 和 :opcode:`!PREP_RERAISE_STAR`,處理 :pep:`654` 所" "加入的\\ :ref:`新增例外群組和 except* <whatsnew311-pep654>`。" @@ -3085,7 +3131,7 @@ msgid "" "now an offset from the current instruction rather than an absolute location." msgstr "" "所有跳位操作碼 (jump opcode) 現在都是相對的,包括現有的 :opcode:`!" -"JUMP_IF_TRUE_OR_POP` 和 :opcode:`!JUMP_IF_FALSE_OR_POP`。該引數現在是當前指" +"JUMP_IF_TRUE_OR_POP` 和 :opcode:`!JUMP_IF_FALSE_OR_POP`。該引數現在是目前指" "示 (instruction) 的偏移量而不是絕對位置。" #: ../../whatsnew/3.11.rst:1688 @@ -3140,11 +3186,12 @@ msgstr "語言/內建" #: ../../whatsnew/3.11.rst:1720 msgid "" "Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) is " -"now deprecated. It can no longer be used to wrap other descriptors such as :" -"class:`property`. The core design of this feature was flawed and caused a " -"number of downstream problems. To \"pass-through\" a :class:`classmethod`, " -"consider using the :attr:`!__wrapped__` attribute that was added in Python " -"3.10. (Contributed by Raymond Hettinger in :gh:`89519`.)" +"now deprecated. It can no longer be used to wrap other descriptors such " +"as :class:`property`. The core design of this feature was flawed and caused " +"a number of downstream problems. To \"pass-through\" " +"a :class:`classmethod`, consider using the :attr:`!__wrapped__` attribute " +"that was added in Python 3.10. (Contributed by Raymond Hettinger " +"in :gh:`89519`.)" msgstr "" "鏈接 :class:`classmethod` 描述器(在 :issue:`19072` 中引入)現已棄用。它不能" "再用於包裝其他描述器,例如 :class:`property`。此功能的核心設計存在缺陷,並導" @@ -3156,26 +3203,26 @@ msgstr "" msgid "" "Octal escapes in string and bytes literals with values larger than ``0o377`` " "(255 in decimal) now produce a :exc:`DeprecationWarning`. In a future Python " -"version, they will raise a :exc:`SyntaxWarning` and eventually a :exc:" -"`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" +"version, they will raise a :exc:`SyntaxWarning` and eventually " +"a :exc:`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" msgstr "" "值大於 ``0o377``\\(十進位為 255)的字串和位元組文本值 (bytes literal) 中的八" "進位跳脫 (octal escape) 現在會產生 :exc:`DeprecationWarning`。在未來的 " -"Python 版本中,他們將引發一個 :exc:`SyntaxWarning` 並最終引發一個 :exc:" -"`SyntaxError`。(由 Serhiy Storchaka 在 :gh:`81548` 中貢獻。)" +"Python 版本中,他們將引發一個 :exc:`SyntaxWarning` 並最終引發一" +"個 :exc:`SyntaxError`。(由 Serhiy Storchaka 在 :gh:`81548` 中貢獻。)" #: ../../whatsnew/3.11.rst:1734 msgid "" "The delegation of :func:`int` to :meth:`~object.__trunc__` is now " "deprecated. Calling ``int(a)`` when ``type(a)`` implements :meth:`!" "__trunc__` but not :meth:`~object.__int__` or :meth:`~object.__index__` now " -"raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz in :issue:" -"`44977`.)" +"raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz " +"in :issue:`44977`.)" msgstr "" ":func:`int` 到 :meth:`~object.__trunc__` 的授權 (delegation) 現已棄用。當 " -"``type(a)`` 有實作 :meth:`!__trunc__` 但沒有 :meth:`~object.__int__` 或 :" -"meth:`~object.__index__`,呼叫 ``int(a)`` 現在會引發一個 :exc:" -"`DeprecationWarning`。(由 Zackery Spytz 在 :issue:`44977` 中貢獻。)" +"``type(a)`` 有實作 :meth:`!__trunc__` 但沒有 :meth:`~object.__int__` " +"或 :meth:`~object.__index__`,呼叫 ``int(a)`` 現在會引發一" +"個 :exc:`DeprecationWarning`。(由 Zackery Spytz 在 :issue:`44977` 中貢獻。)" #: ../../whatsnew/3.11.rst:1744 msgid "Modules" @@ -3265,8 +3312,8 @@ msgstr ":mod:`!sunau`" #: ../../whatsnew/3.11.rst:1761 msgid "" -"(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in :gh:" -"`68966`.)" +"(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner " +"in :gh:`68966`.)" msgstr "" "(由 Brett Cannon 和 Victor Stinner 分別於 :issue:`47061` 與 :gh:`68966` 中所" "貢獻。)" @@ -3283,21 +3330,20 @@ msgstr "" "除。(由 Hugo van Kemenade 於 :issue:`47022` 中貢獻。)" #: ../../whatsnew/3.11.rst:1769 -#, fuzzy msgid "" "The :mod:`!lib2to3` package and ``2to3`` tool are now deprecated and may not " "be able to parse Python 3.10 or newer. See :pep:`617`, introducing the new " "PEG parser, for details. (Contributed by Victor Stinner in :issue:`40360`.)" msgstr "" -":mod:`lib2to3` 套件和 :ref:`2to3 <2to3-reference>` 工具現已棄用,可能無法剖" -"析 Python 3.10 或更新版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖" -"析器。(由 Victor Stinner 在 :issue:`40360` 中貢獻。)" +":mod:!lib2to3` 套件和 ``2to3`` 工具現已棄用,可能無法剖析 Python 3.10 或更新" +"版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖析器。(由 Victor " +"Stinner 在 :issue:`40360` 中貢獻。)" #: ../../whatsnew/3.11.rst:1774 msgid "" "Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!" -"sre_parse` are now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`47152`.)" +"sre_parse` are now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`47152`.)" msgstr "" "未被記錄於文件中的 :mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!" "sre_parse` 模組現在已被棄用。(由 Serhiy Storchaka 在 :issue:`47152` 中貢" @@ -3337,15 +3383,16 @@ msgid "" ":class:`!configparser.LegacyInterpolation` has been deprecated in the " "docstring since Python 3.2, and is not listed in the :mod:`configparser` " "documentation. It now emits a :exc:`DeprecationWarning` and will be removed " -"in Python 3.13. Use :class:`configparser.BasicInterpolation` or :class:" -"`configparser.ExtendedInterpolation` instead. (Contributed by Hugo van " -"Kemenade in :issue:`46607`.)" +"in Python 3.13. Use :class:`configparser.BasicInterpolation` " +"or :class:`configparser.ExtendedInterpolation` instead. (Contributed by Hugo " +"van Kemenade in :issue:`46607`.)" msgstr "" ":class:`!configparser.LegacyInterpolation` 自 Python 3.2 起已在文件字串中棄" -"用,並且未在 :mod:`configparser` 文檔中列出。它現在會發出一個 :exc:" -"`DeprecationWarning` 並將在 Python 3.13 中刪除。請改用 :class:`configparser." -"BasicInterpolation` 或 :class:`configparser.ExtendedInterpolation`。(由 " -"Hugo van Kemenade 在 :issue:`46607` 中貢獻。)" +"用,並且未在 :mod:`configparser` 文件中列出。它現在會發出一" +"個 :exc:`DeprecationWarning` 並將在 Python 3.13 中刪除。請改" +"用 :class:`configparser.BasicInterpolation` " +"或 :class:`configparser.ExtendedInterpolation`。(由 Hugo van Kemenade " +"在 :issue:`46607` 中貢獻。)" #: ../../whatsnew/3.11.rst:1801 msgid "" @@ -3389,9 +3436,10 @@ msgstr ":func:`!importlib.resources.path`" #: ../../whatsnew/3.11.rst:1814 msgid "" "The :func:`locale.getdefaultlocale` function is deprecated and will be " -"removed in Python 3.15. Use :func:`locale.setlocale`, :func:`locale." -"getpreferredencoding(False) <locale.getpreferredencoding>` and :func:`locale." -"getlocale` functions instead. (Contributed by Victor Stinner in :gh:`90817`.)" +"removed in Python 3.15. " +"Use :func:`locale.setlocale`, :func:`locale.getpreferredencoding(False) " +"<locale.getpreferredencoding>` and :func:`locale.getlocale` functions " +"instead. (Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" ":func:`locale.getdefaultlocale` 函式已被棄用且將於 Python 3.15 中移除。請改" "用 :func:`locale.setlocale`、:func:`locale.getpreferredencoding(False) " @@ -3399,25 +3447,24 @@ msgstr "" "於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1820 -#, fuzzy msgid "" "The :func:`!locale.resetlocale` function is deprecated and will be removed " "in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " "(Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" -":func:`locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " -"``locale.setlocale(locale.LC_ALL, \"\")``。(由 Victor Stinner 於 :gh:" -"`90817` 中所貢獻。)" +":func:`!locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " +"``locale.setlocale(locale.LC_ALL, \"\")``。(由 Victor Stinner " +"於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1824 msgid "" "Stricter rules will now be applied for numerical group references and group " "names in :ref:`regular expressions <re-syntax>`. Only sequences of ASCII " -"digits will now be accepted as a numerical reference, and the group name in :" -"class:`bytes` patterns and replacement strings can only contain ASCII " +"digits will now be accepted as a numerical reference, and the group name " +"in :class:`bytes` patterns and replacement strings can only contain ASCII " "letters, digits and underscores. For now, a deprecation warning is raised " -"for syntax violating these rules. (Contributed by Serhiy Storchaka in :gh:" -"`91760`.)" +"for syntax violating these rules. (Contributed by Serhiy Storchaka " +"in :gh:`91760`.)" msgstr "" "現在將對\\ :ref:`規則運算式 <re-syntax>`\\ 中的數值群組參照 (numerical group " "references) 和群組名稱套用更嚴格的規則。現在只接受 ASCII 數字序列作為數值參" @@ -3435,22 +3482,21 @@ msgid "" msgstr "" "在 :mod:`re` 模組中,:func:`!re.template` 函式和相應的 :const:`!re.TEMPLATE` " "和 :const:`!re.T` 旗標被棄用,因為它們沒被記錄於文件中並且缺乏明顯的目的。它" -"們將在 Python 3.13 中被刪除。(由 Serhiy Storchaka 和 Miro Hrončok 在 :gh:" -"`92728` 中貢獻。)" +"們將在 Python 3.13 中被刪除。(由 Serhiy Storchaka 和 Miro Hrončok " +"在 :gh:`92728` 中貢獻。)" #: ../../whatsnew/3.11.rst:1838 -#, fuzzy msgid "" ":func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now " -"emits a deprecation warning and will be removed in Python 3.13. Use :func:" -"`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, " -"and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" -"issue:`45837`.)" +"emits a deprecation warning and will be removed in Python 3.13. " +"Use :func:`turtle.tiltangle` instead (it was earlier incorrectly marked as " +"deprecated, and its docstring is now corrected). (Contributed by Hugo van " +"Kemenade in :issue:`45837`.)" msgstr "" -":func:`turtle.settiltangle` 自 Python 3.1 以來已被棄用;它現在會發出棄用警" +":func:`!turtle.settiltangle` 自 Python 3.1 以來已被棄用;它現在會發出棄用警" "告,並將在 Python 3.13 中刪除。請改用 :func:`turtle.tiltangle`\\ (它之前被錯" -"誤地標記為已棄用,其文件字串現在已更正)。(由 Hugo van Kemenade 在 :issue:" -"`45837` 中貢獻。)" +"誤地標記為已棄用,其文件字串現在已更正)。(由 Hugo van Kemenade " +"在 :issue:`45837` 中貢獻。)" #: ../../whatsnew/3.11.rst:1844 msgid "" @@ -3479,18 +3525,18 @@ msgid "" "itself. (Contributed by Donghee Na in :issue:`42255`.)" msgstr "" ":class:`!webbrowser.MacOSX` 已被棄用且將於 Python 3.13 中移除。它並沒有被測試" -"過、沒紀錄於文件、也沒有被 :mod:`webbrowser` 本身使用。(由 Donghee Na 於 :" -"issue:`42255`。)" +"過、沒紀錄於文件、也沒有被 :mod:`webbrowser` 本身使用。(由 Donghee Na " +"於 :issue:`42255`。)" #: ../../whatsnew/3.11.rst:1858 msgid "" -"The behavior of returning a value from a :class:`~unittest.TestCase` and :" -"class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " +"The behavior of returning a value from a :class:`~unittest.TestCase` " +"and :class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " "default ``None`` value) is now deprecated." msgstr "" -"回傳從 :class:`~unittest.TestCase` 和 :class:`~unittest." -"IsolatedAsyncioTestCase` 測試方法(預設的 ``None`` 值除外)給定值的行為現已棄" -"用。" +"回傳從 :class:`~unittest.TestCase` " +"和 :class:`~unittest.IsolatedAsyncioTestCase` 測試方法(預設的 ``None`` 值除" +"外)給定值的行為現已棄用。" #: ../../whatsnew/3.11.rst:1862 msgid "" @@ -3824,15 +3870,16 @@ msgstr "被移除的 C API 被\\ :ref:`獨立列出 <whatsnew311-c-api-removed>` #: ../../whatsnew/3.11.rst:1955 msgid "" "Removed the :func:`!@asyncio.coroutine` :term:`decorator` enabling legacy " -"generator-based coroutines to be compatible with :keyword:`async` / :keyword:" -"`await` code. The function has been deprecated since Python 3.8 and the " -"removal was initially scheduled for Python 3.10. Use :keyword:`async def` " -"instead. (Contributed by Illia Volochii in :issue:`43216`.)" +"generator-based coroutines to be compatible " +"with :keyword:`async` / :keyword:`await` code. The function has been " +"deprecated since Python 3.8 and the removal was initially scheduled for " +"Python 3.10. Use :keyword:`async def` instead. (Contributed by Illia " +"Volochii in :issue:`43216`.)" msgstr "" "刪除了 :func:`!@asyncio.coroutine` :term:`decorator` 使遺留的基於生成器的協" "程 (generator-based coroutine) 與 :keyword:`async` / :keyword:`await` 程式碼" -"相容。該函式自 Python 3.8 起已被棄用,計劃於 Python 3.10 刪除。請改用 :" -"keyword:`async def`。(由 Illia Volochii 在 :issue:`43216` 中貢獻。)" +"相容。該函式自 Python 3.8 起已被棄用,計劃於 Python 3.10 刪除。請改" +"用 :keyword:`async def`。(由 Illia Volochii 在 :issue:`43216` 中貢獻。)" #: ../../whatsnew/3.11.rst:1962 msgid "" @@ -3840,29 +3887,30 @@ msgid "" "generator-based coroutine objects in the debug mode. (Contributed by Illia " "Volochii in :issue:`43216`.)" msgstr "" -"移除除錯模式中用於包裝遺留基於產生器之協程物件的 :class:`!asyncio.coroutines." -"CoroWrapper`。(由 Illia Volochii 於 :issue:`43216` 中貢獻。)" +"移除除錯模式中用於包裝遺留基於產生器之協程物件的 :class:`!" +"asyncio.coroutines.CoroWrapper`。(由 Illia Volochii 於 :issue:`43216` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1966 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is now " -"entirely removed. This is because of the behavior of the socket option " -"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade in :issue:" -"`45129`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is " +"now entirely removed. This is because of the behavior of the socket option " +"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade " +"in :issue:`45129`.)" msgstr "" -"因為有重大的安全性考量,Python 3.9 中停用的 :meth:`asyncio.loop." -"create_datagram_endpoint` 之 *reuse_address* 參數目前已經移除。這是因為 UDP " -"socket 選項 ``SO_REUSEADDR`` 的行為所致。(由 Hugo van Kemenade 於 :issue:" -"`45129` 中貢獻。)" +"因為有重大的安全性考量,Python 3.9 中停用" +"的 :meth:`asyncio.loop.create_datagram_endpoint` 之 *reuse_address* 參數目前" +"已經移除。這是因為 UDP socket 選項 ``SO_REUSEADDR`` 的行為所致。(由 Hugo " +"van Kemenade 於 :issue:`45129` 中貢獻。)" #: ../../whatsnew/3.11.rst:1972 msgid "" "Removed the :mod:`!binhex` module, deprecated in Python 3.9. Also removed " "the related, similarly-deprecated :mod:`binascii` functions:" msgstr "" -"移除 Python 3.9 中棄用的 :mod:`!binhex` 模組,與其相關且相似的 :mod:" -"`binascii` 函式也一併被移除:" +"移除 Python 3.9 中棄用的 :mod:`!binhex` 模組,與其相關且相似" +"的 :mod:`binascii` 函式也一併被移除:" #: ../../whatsnew/3.11.rst:1975 msgid ":func:`!binascii.a2b_hqx`" @@ -3900,32 +3948,34 @@ msgstr "" #: ../../whatsnew/3.11.rst:1988 msgid "" -"Removed the :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput`, deprecated since Python 3.9. (Contributed by Hugo van Kemenade " -"in :issue:`45132`.)" +"Removed the :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput`, deprecated since Python 3.9. (Contributed " +"by Hugo van Kemenade in :issue:`45132`.)" msgstr "" -"將 :class:`xml.dom.pulldom.DOMEventStream`、:class:`wsgiref.util." -"FileWrapper` 和 :class:`fileinput.FileInput` 自 Python 3.9 中棄用的 :meth:" -"`~object.__getitem__` 方法移除。(由 Hugo van Kemenade 在 :issue:`45132` 中貢" -"獻。)" +"將 :class:`xml.dom.pulldom.DOMEventStream`、:class:`wsgiref.util.FileWrapper` " +"和 :class:`fileinput.FileInput` 自 Python 3.9 中棄用" +"的 :meth:`~object.__getitem__` 方法移除。(由 Hugo van Kemenade " +"在 :issue:`45132` 中貢獻。)" #: ../../whatsnew/3.11.rst:1993 msgid "" "Removed the deprecated :mod:`gettext` functions :func:`!lgettext`, :func:`!" -"ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed the :" -"func:`!bind_textdomain_codeset` function, the :meth:`!NullTranslations." -"output_charset` and :meth:`!NullTranslations.set_output_charset` methods, " -"and the *codeset* parameter of :func:`!translation` and :func:`!install`, " -"since they are only used for the :func:`!l*gettext` functions. (Contributed " -"by Donghee Na and Serhiy Storchaka in :issue:`44235`.)" -msgstr "" -"刪除了已棄用的 :mod:`gettext` 函式 :func:`!lgettext`、:func:`!ldgettext`、:" -"func:`!lngettext` 和 :func:`!ldngettext`,也刪除了 :func:`!" -"bind_textdomain_codeset` 函式、:meth:`!NullTranslations.output_charset` 和 :" -"meth:`!NullTranslations.set_output_charset` 方法,以及 :func:`!translation` " -"和 :func:`!install` 的 *codeset* 參數,因為它們僅被用於 :func:`!l*gettext` 函" -"式。(由 Donghee Na 和 Serhiy Storchaka 在 :issue:`44235` 中貢獻。)" +"ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed " +"the :func:`!bind_textdomain_codeset` function, the :meth:`!" +"NullTranslations.output_charset` and :meth:`!" +"NullTranslations.set_output_charset` methods, and the *codeset* parameter " +"of :func:`!translation` and :func:`!install`, since they are only used for " +"the :func:`!l*gettext` functions. (Contributed by Donghee Na and Serhiy " +"Storchaka in :issue:`44235`.)" +msgstr "" +"刪除了已棄用的 :mod:`gettext` 函式 :func:`!lgettext`、:func:`!" +"ldgettext`、:func:`!lngettext` 和 :func:`!ldngettext`,也刪除了 :func:`!" +"bind_textdomain_codeset` 函式、:meth:`!NullTranslations.output_charset` " +"和 :meth:`!NullTranslations.set_output_charset` 方法,以及 :func:`!" +"translation` 和 :func:`!install` 的 *codeset* 參數,因為它們僅被用於 :func:`!" +"l*gettext` 函式。(由 Donghee Na 和 Serhiy Storchaka 在 :issue:`44235` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2003 msgid "Removed from the :mod:`inspect` module:" @@ -3933,30 +3983,31 @@ msgstr "於 :mod:`inspect` 模組中移除:" #: ../../whatsnew/3.11.rst:2005 msgid "" -"The :func:`!getargspec` function, deprecated since Python 3.0; use :func:" -"`inspect.signature` or :func:`inspect.getfullargspec` instead." +"The :func:`!getargspec` function, deprecated since Python 3.0; " +"use :func:`inspect.signature` or :func:`inspect.getfullargspec` instead." msgstr "" -"Python 3.0 中棄用的 :func:`!getargspec`;改用 :func:`inspect.signature` 或 :" -"func:`inspect.getfullargspec`。" +"Python 3.0 中棄用的 :func:`!getargspec`;改用 :func:`inspect.signature` " +"或 :func:`inspect.getfullargspec`。" #: ../../whatsnew/3.11.rst:2008 msgid "" -"The :func:`!formatargspec` function, deprecated since Python 3.5; use the :" -"func:`inspect.signature` function or the :class:`inspect.Signature` object " -"directly." +"The :func:`!formatargspec` function, deprecated since Python 3.5; use " +"the :func:`inspect.signature` function or the :class:`inspect.Signature` " +"object directly." msgstr "" -"Python 3.5 中棄用的 :func:`!formatargspec` 函式;請直接用 :func:`inspect." -"signature` 函式或 :class:`inspect.Signature` 物件。" +"Python 3.5 中棄用的 :func:`!formatargspec` 函式;請直接" +"用 :func:`inspect.signature` 函式或 :class:`inspect.Signature` 物件。" #: ../../whatsnew/3.11.rst:2012 msgid "" -"The undocumented :meth:`!Signature.from_builtin` and :meth:`!Signature." -"from_function` methods, deprecated since Python 3.5; use the :meth:" -"`Signature.from_callable() <inspect.Signature.from_callable>` method instead." +"The undocumented :meth:`!Signature.from_builtin` and :meth:`!" +"Signature.from_function` methods, deprecated since Python 3.5; use " +"the :meth:`Signature.from_callable() <inspect.Signature.from_callable>` " +"method instead." msgstr "" -"Python 3.5 中停用且沒有被紀錄於文件上的 :meth:`!Signature.from_builtin` 和 :" -"meth:`!Signature.from_function` 方法;改用 :meth:`Signature.from_callable() " -"<inspect.Signature.from_callable>` 方法。" +"Python 3.5 中停用且沒有被紀錄於文件上的 :meth:`!Signature.from_builtin` " +"和 :meth:`!Signature.from_function` 方法;改" +"用 :meth:`Signature.from_callable() <inspect.Signature.from_callable>` 方法。" #: ../../whatsnew/3.11.rst:2017 msgid "(Contributed by Hugo van Kemenade in :issue:`45320`.)" @@ -3964,9 +4015,9 @@ msgstr "(由 Hugo van Kemenade 於 :issue:`45320` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2019 msgid "" -"Removed the :meth:`~object.__class_getitem__` method from :class:`pathlib." -"PurePath`, because it was not used and added by mistake in previous " -"versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" +"Removed the :meth:`~object.__class_getitem__` method " +"from :class:`pathlib.PurePath`, because it was not used and added by mistake " +"in previous versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" msgstr "" "自 :class:`pathlib.PurePath` 中移除 :meth:`~object.__class_getitem__` 方法," "因為它是前一版本中誤加且沒被使用。(由 Nikita Sobolev 於 :issue:`46483` 中所" @@ -3983,8 +4034,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:2028 msgid "" -"Removed the deprecated :meth:`!split` method of :class:`!_tkinter." -"TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" +"Removed the deprecated :meth:`!split` method of :class:`!" +"_tkinter.TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" msgstr "" "移除 :class:`!_tkinter.TkappType` 已被棄用的 :meth:`!split` 方法。(由 " "Erlend E. Aasland 於 :issue:`38371` 貢獻。)" @@ -4017,8 +4068,8 @@ msgid "" "corresponding :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` macro) have " "been removed." msgstr "" -"移除 :option:`!--experimental-isolated-subinterpreters` 配置旗標(與對應的 :" -"c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` 巨集)。" +"移除 :option:`!--experimental-isolated-subinterpreters` 配置旗標(與對應" +"的 :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` 巨集)。" #: ../../whatsnew/3.11.rst:2045 msgid "" @@ -4050,31 +4101,31 @@ msgstr "C API 的移植被\\ :ref:`獨立列出 <whatsnew311-c-api-porting>`。" #: ../../whatsnew/3.11.rst:2063 msgid "" -":func:`open`, :func:`io.open`, :func:`codecs.open` and :class:`fileinput." -"FileInput` no longer accept ``'U'`` (\"universal newline\") in the file " -"mode. In Python 3, \"universal newline\" mode is used by default whenever a " -"file is opened in text mode, and the ``'U'`` flag has been deprecated since " -"Python 3.3. The :ref:`newline parameter <open-newline-parameter>` to these " -"functions controls how universal newlines work. (Contributed by Victor " -"Stinner in :issue:`37330`.)" -msgstr "" -":func:`open`、:func:`io.open`、:func:`codecs.open` 和 :class:`fileinput." -"FileInput` 不再接受 ``'U'``\\ (\"universal newline\",通用換行符)文件模式。" -"在 Python 3 中,每當以文本模式 (text mode) 打開檔案時,預設情況下會使用「通用" -"換行符」模式,並且自 Python 3.3 以來就不推薦使用 ``'U'`` 旗標。這些函式的 :" -"ref:`newline 參數 <open-newline-parameter>`\\ 控制了通用換行符的作用方式。" -"(由 Victor Stinner 在 :issue:`37330` 中貢獻。)" +":func:`open`, :func:`io.open`, :func:`codecs.open` " +"and :class:`fileinput.FileInput` no longer accept ``'U'`` (\"universal " +"newline\") in the file mode. In Python 3, \"universal newline\" mode is used " +"by default whenever a file is opened in text mode, and the ``'U'`` flag has " +"been deprecated since Python 3.3. The :ref:`newline parameter <open-newline-" +"parameter>` to these functions controls how universal newlines work. " +"(Contributed by Victor Stinner in :issue:`37330`.)" +msgstr "" +":func:`open`、:func:`io.open`、:func:`codecs.open` " +"和 :class:`fileinput.FileInput` 不再接受 ``'U'``\\ (\"universal newline\"," +"通用換行符)文件模式。在 Python 3 中,每當以文本模式 (text mode) 打開檔案時," +"預設情況下會使用「通用換行符」模式,並且自 Python 3.3 以來就不推薦使用 " +"``'U'`` 旗標。這些函式的 :ref:`newline 參數 <open-newline-parameter>`\\ 控制" +"了通用換行符的作用方式。(由 Victor Stinner 在 :issue:`37330` 中貢獻。)" #: ../../whatsnew/3.11.rst:2072 msgid "" -":class:`ast.AST` node positions are now validated when provided to :func:" -"`compile` and other related functions. If invalid positions are detected, a :" -"exc:`ValueError` will be raised. (Contributed by Pablo Galindo in :gh:" -"`93351`)" +":class:`ast.AST` node positions are now validated when provided " +"to :func:`compile` and other related functions. If invalid positions are " +"detected, a :exc:`ValueError` will be raised. (Contributed by Pablo Galindo " +"in :gh:`93351`)" msgstr "" ":class:`ast.AST` 節點位置現在會在提供給 :func:`compile` 和其他相關函式時被驗" -"證。如果檢測到無效位置,則會引發 :exc:`ValueError`。(由 Pablo Galindo 在 :" -"gh:`93351` 中貢獻)" +"證。如果檢測到無效位置,則會引發 :exc:`ValueError`。(由 Pablo Galindo " +"在 :gh:`93351` 中貢獻)" #: ../../whatsnew/3.11.rst:2076 msgid "" @@ -4082,21 +4133,23 @@ msgid "" "executors to :meth:`asyncio.loop.set_default_executor` following a " "deprecation in Python 3.8. (Contributed by Illia Volochii in :issue:`43234`.)" msgstr "" -"在 Python 3.8 中棄用後,禁止將非 :class:`concurrent.futures." -"ThreadPoolExecutor` 執行器傳遞給 :meth:`asyncio.loop.set_default_executor`。" -"(由 Illia Volochii 在 :issue:`43234` 中貢獻。)" +"在 Python 3.8 中棄用後,禁止將" +"非 :class:`concurrent.futures.ThreadPoolExecutor` 執行器傳遞" +"給 :meth:`asyncio.loop.set_default_executor`。(由 Illia Volochii " +"在 :issue:`43234` 中貢獻。)" #: ../../whatsnew/3.11.rst:2081 msgid "" -":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` and :class:" -"`calendar.LocaleHTMLCalendar` classes now use :func:`locale.getlocale`, " -"instead of using :func:`locale.getdefaultlocale`, if no locale is specified. " +":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` " +"and :class:`calendar.LocaleHTMLCalendar` classes now " +"use :func:`locale.getlocale`, instead of " +"using :func:`locale.getdefaultlocale`, if no locale is specified. " "(Contributed by Victor Stinner in :issue:`46659`.)" msgstr "" -":mod:`calendar`::class:`calendar.LocaleTextCalendar` 和 :class:`calendar." -"LocaleHTMLCalendar` 類別如果沒有指定語言環境,現在會使用 :func:`locale." -"getlocale` 而非 :func:`locale.getdefaultlocale`。(由 Victor Stinner 在 :" -"issue:`46659` 中貢獻。)" +":mod:`calendar`::class:`calendar.LocaleTextCalendar` " +"和 :class:`calendar.LocaleHTMLCalendar` 類別如果沒有指定語言環境,現在會使" +"用 :func:`locale.getlocale` 而非 :func:`locale.getdefaultlocale`。(由 " +"Victor Stinner 在 :issue:`46659` 中貢獻。)" #: ../../whatsnew/3.11.rst:2087 msgid "" @@ -4111,19 +4164,20 @@ msgstr "" msgid "" "The *population* parameter of :func:`random.sample` must be a sequence, and " "automatic conversion of :class:`set`\\s to :class:`list`\\s is no longer " -"supported. Also, if the sample size is larger than the population size, a :" -"exc:`ValueError` is raised. (Contributed by Raymond Hettinger in :issue:" -"`40465`.)" +"supported. Also, if the sample size is larger than the population size, " +"a :exc:`ValueError` is raised. (Contributed by Raymond Hettinger " +"in :issue:`40465`.)" msgstr "" -":func:`random.sample` 的 *population* 參數必須是一個序列,不再支援 :class:" -"`set` 到 :class:`list` 的自動轉換。此外,如果抽樣大小大於總體大小,則會引發 :" -"exc:`ValueError`。(由 Raymond Hettinger 在 :issue:`40465` 中貢獻。)" +":func:`random.sample` 的 *population* 參數必須是一個序列,不再支" +"援 :class:`set` 到 :class:`list` 的自動轉換。此外,如果抽樣大小大於總體大小," +"則會引發 :exc:`ValueError`。(由 Raymond Hettinger 在 :issue:`40465` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2097 msgid "" "The *random* optional parameter of :func:`random.shuffle` was removed. It " -"was previously an arbitrary random function to use for the shuffle; now, :" -"func:`random.random` (its previous default) will always be used." +"was previously an arbitrary random function to use for the shuffle; " +"now, :func:`random.random` (its previous default) will always be used." msgstr "" "刪除了 :func:`random.shuffle` 的 *random* 可選參數。它以前是用於隨機排列 " "(shuffle) 的任意隨機函式;現在都會使用 :func:`random.random`\\ (這是它以前的" @@ -4133,8 +4187,8 @@ msgstr "" msgid "" "In :mod:`re` :ref:`re-syntax`, global inline flags (e.g. ``(?i)``) can now " "only be used at the start of regular expressions. Using them elsewhere has " -"been deprecated since Python 3.6. (Contributed by Serhiy Storchaka in :issue:" -"`47066`.)" +"been deprecated since Python 3.6. (Contributed by Serhiy Storchaka " +"in :issue:`47066`.)" msgstr "" "在 :mod:`re` :ref:`re-syntax` 中,全域行內旗標(例如 ``(?i)``)現在只能在規則" "運算式的開頭使用。自 Python 3.6 以來,在其他地方使用它們已被棄用。(由 " @@ -4166,8 +4220,8 @@ msgid "" "limited subset of POSIX APIs; Python standard libraries features and modules " "related to networking, processes, threading, signals, mmap, and users/groups " "are not available or don't work. (Emscripten contributed by Christian Heimes " -"and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes in :" -"gh:`90473`; platforms promoted in :gh:`95085`)" +"and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes " +"in :gh:`90473`; platforms promoted in :gh:`95085`)" msgstr "" "CPython 現在有 :pep:`11` :pep:`Tier 3 支援 <11#tier-3>` 以用於交叉編譯至 " "`WebAssembly <https://webassembly.org/>`_ 平台 `Emscripten <https://" @@ -4188,8 +4242,8 @@ msgid "" "A `C11 <https://en.cppreference.com/w/c/11>`_ compiler and standard library. " "`Optional C11 features <https://en.wikipedia.org/wiki/" "C11_(C_standard_revision)#Optional_features>`_ are not required. " -"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` and :issue:" -"`46640`.)" +"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` " +"and :issue:`46640`.)" msgstr "" "`C11 <https://en.cppreference.com/w/c/11>`_ 編譯器與標準函式庫。`可選的 C11 " "特性 <https://en.wikipedia.org/wiki/" @@ -4229,16 +4283,16 @@ msgid "" "detected by `pkg-config <https://www.freedesktop.org/wiki/Software/pkg-" "config/>`_ (when available). :mod:`tkinter` now requires a pkg-config " "command to detect development settings for `Tcl/Tk`_ headers and libraries. " -"(Contributed by Christian Heimes and Erlend Egeberg Aasland in :issue:" -"`45847`, :issue:`45747`, and :issue:`45763`.)" +"(Contributed by Christian Heimes and Erlend Egeberg Aasland " +"in :issue:`45847`, :issue:`45747`, and :issue:`45763`.)" msgstr "" "大多數 stdlib 擴充模組的依賴套件、編譯器旗標 (compiler flag) 和鏈接器旗標 " "(linker flags) 現在可以透過 :program:`configure` 檢測出來。(當可用時)\\ " "`pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config/>`_ 會檢測" "出 libffi、libnsl、libsqlite3、zlib、bzip2、liblzma、libcrypt、Tcl/Tk 和 " "uuid 旗標。:mod:`tkinter` 現在需要一個 pkg-config 命令來檢測 `Tcl/Tk`_ 標頭檔" -"和函式庫的開發設定。(由 Christian Heimes 和 Erlend Egeberg Aasland 在 :" -"issue:`45847`、:issue:`45747` 和 :issue:`45763` 中貢獻。)" +"和函式庫的開發設定。(由 Christian Heimes 和 Erlend Egeberg Aasland " +"在 :issue:`45847`、:issue:`45747` 和 :issue:`45763` 中貢獻。)" #: ../../whatsnew/3.11.rst:2162 msgid "" @@ -4251,20 +4305,20 @@ msgstr "" msgid "" "CPython can now be built with the `ThinLTO <https://clang.llvm.org/docs/" "ThinLTO.html>`_ option via passing ``thin`` to :option:`--with-lto`, i.e. " -"``--with-lto=thin``. (Contributed by Donghee Na and Brett Holman in :issue:" -"`44340`.)" +"``--with-lto=thin``. (Contributed by Donghee Na and Brett Holman " +"in :issue:`44340`.)" msgstr "" "CPython 現在可以透過將 ``thin`` 傳遞給 :option:`--with-lto`\\ (也就是 ``--" -"with-lto=thin``\\ )來以 `ThinLTO <https://clang.llvm.org/docs/ThinLTO." -"html>`_ 選項建置。(由 Donghee Na 與 Brett Holman 於 :issue:`44340` 中所貢" -"獻。)" +"with-lto=thin``\\ )來以 `ThinLTO <https://clang.llvm.org/docs/" +"ThinLTO.html>`_ 選項建置。(由 Donghee Na 與 Brett Holman 於 :issue:`44340` " +"中所貢獻。)" #: ../../whatsnew/3.11.rst:2170 msgid "" "Freelists for object structs can now be disabled. A new :program:`configure` " "option :option:`--without-freelists` can be used to disable all freelists " -"except empty tuple singleton. (Contributed by Christian Heimes in :issue:" -"`45522`.)" +"except empty tuple singleton. (Contributed by Christian Heimes " +"in :issue:`45522`.)" msgstr "" #: ../../whatsnew/3.11.rst:2175 @@ -4272,13 +4326,14 @@ msgid "" "``Modules/Setup`` and ``Modules/makesetup`` have been improved and tied up. " "Extension modules can now be built through ``makesetup``. All except some " "test modules can be linked statically into a main binary or library. " -"(Contributed by Brett Cannon and Christian Heimes in :issue:`45548`, :issue:" -"`45570`, :issue:`45571`, and :issue:`43974`.)" +"(Contributed by Brett Cannon and Christian Heimes " +"in :issue:`45548`, :issue:`45570`, :issue:`45571`, and :issue:`43974`.)" msgstr "" "``Modules/Setup`` 和 ``Modules/makesetup`` 已得到改進和綁定。現在可以通過 " "``makesetup`` 建置擴充模組。除了一些測試模組外,所有模組都可以靜態鏈接到主要" -"的二進制文件或函式庫中。(由 Brett Cannon 和 Christian Heimes 在 :issue:" -"`45548`、:issue:`45570`、:issue:`45571` 和 :issue:`43974` 中貢獻。)" +"的二進制文件或函式庫中。(由 Brett Cannon 和 Christian Heimes " +"在 :issue:`45548`、:issue:`45570`、:issue:`45571` 和 :issue:`43974` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2182 msgid "" @@ -4299,20 +4354,20 @@ msgid "" "build Python with RHEL 7's and CentOS 7's Tcl/Tk and OpenSSL." msgstr "" "RHEL 7 和 CentOS 7 上的開發套件並無提供 ``tcl.pc`` 和 ``tk.pc``;要使用 " -"``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``。目錄 ``Misc/rhel7`` 包含 ``." -"pc`` 檔案與如何使用 RHEL 7 和 CentOS 7 的 Tcl/Tk 與 OpenSSL 建置 Python 的指" -"示。" +"``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``。目錄 ``Misc/rhel7`` 包含 " +"``.pc`` 檔案與如何使用 RHEL 7 和 CentOS 7 的 Tcl/Tk 與 OpenSSL 建置 Python 的" +"指示。" #: ../../whatsnew/3.11.rst:2193 msgid "" "CPython will now use 30-bit digits by default for the Python :class:`int` " "implementation. Previously, the default was to use 30-bit digits on " "platforms with ``SIZEOF_VOID_P >= 8``, and 15-bit digits otherwise. It's " -"still possible to explicitly request use of 15-bit digits via either the :" -"option:`--enable-big-digits` option to the configure script or (for Windows) " -"the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but this option " -"may be removed at some point in the future. (Contributed by Mark Dickinson " -"in :issue:`45569`.)" +"still possible to explicitly request use of 15-bit digits via either " +"the :option:`--enable-big-digits` option to the configure script or (for " +"Windows) the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but " +"this option may be removed at some point in the future. (Contributed by Mark " +"Dickinson in :issue:`45569`.)" msgstr "" "CPython 現在預設使用 30-bit 數字來實作 Python :class:`int`。以前,在 " "``SIZEOF_VOID_P >= 8`` 的平台上預設使用 30-bit 數字,否則使用 15-bit 數字,但" @@ -4330,8 +4385,8 @@ msgid "" "Add a new :c:func:`PyType_GetName` function to get type's short name. " "(Contributed by Hai Shi in :issue:`42035`.)" msgstr "" -"新增 :c:func:`PyType_GetName` 函式來取得型別的短名。(由 Hai Shi 於 :issue:" -"`42035` 中所貢獻。)" +"新增 :c:func:`PyType_GetName` 函式來取得型別的短名。(由 Hai Shi " +"於 :issue:`42035` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2216 msgid "" @@ -4343,20 +4398,20 @@ msgstr "" #: ../../whatsnew/3.11.rst:2219 msgid "" -"Add new :c:func:`PyThreadState_EnterTracing` and :c:func:" -"`PyThreadState_LeaveTracing` functions to the limited C API to suspend and " -"resume tracing and profiling. (Contributed by Victor Stinner in :issue:" -"`43760`.)" +"Add new :c:func:`PyThreadState_EnterTracing` " +"and :c:func:`PyThreadState_LeaveTracing` functions to the limited C API to " +"suspend and resume tracing and profiling. (Contributed by Victor Stinner " +"in :issue:`43760`.)" msgstr "" -"在受限 C API (limited C API) 中新增 :c:func:`PyThreadState_EnterTracing` 和 :" -"c:func:`PyThreadState_LeaveTracing` 函式來中止和繼續追蹤 (tracing) 和性能分" -"析 (profiling)。(由 Victor Stinner 於 :issue:`43760` 中貢獻。)" +"在受限 C API (limited C API) 中新增 :c:func:`PyThreadState_EnterTracing` " +"和 :c:func:`PyThreadState_LeaveTracing` 函式來中止和繼續追蹤 (tracing) 和性能" +"分析 (profiling)。(由 Victor Stinner 於 :issue:`43760` 中貢獻。)" #: ../../whatsnew/3.11.rst:2224 msgid "" -"Added the :c:data:`Py_Version` constant which bears the same value as :c:" -"macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta in :issue:" -"`43931`.)" +"Added the :c:data:`Py_Version` constant which bears the same value " +"as :c:macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta " +"in :issue:`43931`.)" msgstr "" "添加了 :c:data:`Py_Version` 常數,其值與 :c:macro:`PY_VERSION_HEX` 相同。" "(由 Gabriele N. Tornetta 在 :issue:`43931` 中貢獻。)" @@ -4417,11 +4472,11 @@ msgstr ":c:func:`PyMemoryView_FromBuffer`" #: ../../whatsnew/3.11.rst:2243 msgid "" -":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." -"bf_releasebuffer` type slots" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"and :c:member:`~PyBufferProcs.bf_releasebuffer` type slots" msgstr "" -":c:member:`~PyBufferProcs.bf_getbuffer` 與 :c:member:`~PyBufferProcs." -"bf_releasebuffer` 型別插槽 (type slot)" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"與 :c:member:`~PyBufferProcs.bf_releasebuffer` 型別插槽 (type slot)" #: ../../whatsnew/3.11.rst:2246 msgid "(Contributed by Christian Heimes in :issue:`45459`.)" @@ -4440,39 +4495,38 @@ msgstr "" #: ../../whatsnew/3.11.rst:2253 msgid "" -"Add new functions to pack and unpack C double (serialize and deserialize): :" -"c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:" -"func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` and :c:func:" -"`PyFloat_Unpack8`. (Contributed by Victor Stinner in :issue:`46906`.)" +"Add new functions to pack and unpack C double (serialize and " +"deserialize): :c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` " +"and :c:func:`PyFloat_Unpack8`. (Contributed by Victor Stinner " +"in :issue:`46906`.)" msgstr "" -"新增函式以打包 (pack) 和取出 (unpack) C double(序列化和反序列化)::c:func:" -"`PyFloat_Pack2`、:c:func:`PyFloat_Pack4`、:c:func:`PyFloat_Pack8`、:c:func:" -"`PyFloat_Unpack2` , :c:func:`PyFloat_Unpack4` 和 :c:func:`PyFloat_Unpack8`。" -"(由 Victor Stinner 在 :issue:`46906` 中貢獻。)" +"新增函式以打包 (pack) 和取出 (unpack) C double(序列化和反序列" +"化)::c:func:`PyFloat_Pack2`、:c:func:`PyFloat_Pack4`、:c:func:`PyFloat_Pack8`、:c:func:`PyFloat_Unpack2` , :c:func:`PyFloat_Unpack4` " +"和 :c:func:`PyFloat_Unpack8`。(由 Victor Stinner 在 :issue:`46906` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2259 msgid "" -"Add new functions to get frame object attributes: :c:func:" -"`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:" -"`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." +"Add new functions to get frame object " +"attributes: :c:func:`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." msgstr "" -"新增取得幀物件屬性的函式::c:func:`PyFrame_GetBuiltins`、:c:func:" -"`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:" -"`PyFrame_GetLasti`。" +"新增取得幀物件屬性的函" +"式::c:func:`PyFrame_GetBuiltins`、:c:func:`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:`PyFrame_GetLasti`。" #: ../../whatsnew/3.11.rst:2263 msgid "" -"Added two new functions to get and set the active exception instance: :c:" -"func:`PyErr_GetHandledException` and :c:func:`PyErr_SetHandledException`. " -"These are alternatives to :c:func:`PyErr_SetExcInfo()` and :c:func:" -"`PyErr_GetExcInfo()` which work with the legacy 3-tuple representation of " -"exceptions. (Contributed by Irit Katriel in :issue:`46343`.)" +"Added two new functions to get and set the active exception " +"instance: :c:func:`PyErr_GetHandledException` " +"and :c:func:`PyErr_SetHandledException`. These are alternatives " +"to :c:func:`PyErr_SetExcInfo()` and :c:func:`PyErr_GetExcInfo()` which work " +"with the legacy 3-tuple representation of exceptions. (Contributed by Irit " +"Katriel in :issue:`46343`.)" msgstr "" -"添加了兩個新函式來獲得和設置仍在作用的例外實例::c:func:" -"`PyErr_GetHandledException` 和 :c:func:`PyErr_SetHandledException`。這些是 :" -"c:func:`PyErr_SetExcInfo()` 和 :c:func:`PyErr_GetExcInfo()` 的替代品,它們與" -"例外的遺留三元組表示法一起作用。(由 Irit Katriel 在 :issue:`46343` 中貢" -"獻。)" +"添加了兩個新函式來獲得和設置仍在作用的例外實" +"例::c:func:`PyErr_GetHandledException` " +"和 :c:func:`PyErr_SetHandledException`。這些是 :c:func:`PyErr_SetExcInfo()` " +"和 :c:func:`PyErr_GetExcInfo()` 的替代品,它們與例外的遺留三元組表示法一起作" +"用。(由 Irit Katriel 在 :issue:`46343` 中貢獻。)" #: ../../whatsnew/3.11.rst:2270 msgid "" @@ -4493,11 +4547,11 @@ msgid "" "expected types. See :pep:`670` for more details. (Contributed by Victor " "Stinner and Erlend E. Aasland in :gh:`89653`.)" msgstr "" -"一些巨集已轉換為行內靜態函式以避免\\ `巨集陷阱 (macro pitfalls) <https://gcc." -"gnu.org/onlinedocs/cpp/Macro-Pitfalls.html>`_。這種變化對用戶來說應該是透明" -"的,因為替換函式會將它們的引數轉換為預期的型別,以避免由於靜態型別檢查而產生" -"的編譯器警告。但是,當受限 C API 設置為 >=3.11 時,這些轉換不會完成,使用者需" -"要將引數轉換為他們期望的型別。有關更多詳細資訊,請參閱 :pep:`670`。(由 " +"一些巨集已轉換為行內靜態函式以避免\\ `巨集陷阱 (macro pitfalls) <https://" +"gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html>`_。這種變化對用戶來說應該是透" +"明的,因為替換函式會將它們的引數轉換為預期的型別,以避免由於靜態型別檢查而產" +"生的編譯器警告。但是,當受限 C API 設置為 >=3.11 時,這些轉換不會完成,使用者" +"需要將引數轉換為他們期望的型別。有關更多詳細資訊,請參閱 :pep:`670`。(由 " "Victor Stinner 和 Erlend E. Aasland 在 :gh:`89653` 中貢獻。)" #: ../../whatsnew/3.11.rst:2292 @@ -4551,24 +4605,24 @@ msgid "" "method." msgstr "" ":c:func:`!PyCode_New` 和 :c:func:`!PyCode_NewWithPosOnlyArgs` 現在採用額外的 " -"``exception_table`` 引數。如果可能的話應該避免使用這些函式。要獲取自定義程式" +"``exception_table`` 引數。如果可能的話應該避免使用這些函式。要取得自定義程式" "碼物件,使用編譯器建立一個程式碼物件,然後使用 ``replace`` 方法來得到修改後的" "版本。" #: ../../whatsnew/3.11.rst:2318 msgid "" ":c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``, " -"``co_cellvars`` and ``co_freevars`` fields. Instead, use :c:func:" -"`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " +"``co_cellvars`` and ``co_freevars`` fields. Instead, " +"use :c:func:`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " "and :c:func:`PyCode_GetFreevars` respectively to access them via the C API. " "(Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154` " "and :gh:`94936`.)" msgstr "" ":c:type:`PyCodeObject` 不再會有 ``co_code``、``co_varnames``、" -"``co_cellvars`` 和 ``co_freevars`` 欄位。分別被改為透過 C API 的 :c:func:" -"`PyCode_GetCode`、:c:func:`PyCode_GetVarnames`、:c:func:`PyCode_GetCellvars` " -"和 :c:func:`PyCode_GetFreevars` 來存取。(由 Brandt Bucher 在 :issue:" -"`46841`、Ken Jin 在 :gh:`92154` 與 :gh:`94936` 中貢獻。)" +"``co_cellvars`` 和 ``co_freevars`` 欄位。分別被改為透過 C API " +"的 :c:func:`PyCode_GetCode`、:c:func:`PyCode_GetVarnames`、:c:func:`PyCode_GetCellvars` " +"和 :c:func:`PyCode_GetFreevars` 來存取。(由 Brandt Bucher " +"在 :issue:`46841`、Ken Jin 在 :gh:`92154` 與 :gh:`94936` 中貢獻。)" #: ../../whatsnew/3.11.rst:2326 msgid "" @@ -4667,24 +4721,25 @@ msgstr "" msgid "" "The :c:func:`PyType_Ready` function now raises an error if a type is defined " "with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function " -"(:c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner in :" -"issue:`44263`.)" +"(:c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner " +"in :issue:`44263`.)" msgstr "" "如果一個型別是以 :c:macro:`Py_TPFLAGS_HAVE_GC` 旗標來定義,但卻沒有遍歷函式 " -"(traverse function) (:c:member:`PyTypeObject.tp_traverse`),那 :c:func:" -"`PyType_Ready` 函式現在會引發一個錯誤。(由 Victor Stinner 於 :issue:`44263` " -"中貢獻。)" +"(traverse function) (:c:member:`PyTypeObject.tp_traverse`)," +"那 :c:func:`PyType_Ready` 函式現在會引發一個錯誤。(由 Victor Stinner " +"於 :issue:`44263` 中貢獻。)" #: ../../whatsnew/3.11.rst:2372 msgid "" "Heap types with the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit " -"the :pep:`590` vectorcall protocol. Previously, this was only possible for :" -"ref:`static types <static-types>`. (Contributed by Erlend E. Aasland in :" -"issue:`43908`)" +"the :pep:`590` vectorcall protocol. Previously, this was only possible " +"for :ref:`static types <static-types>`. (Contributed by Erlend E. Aasland " +"in :issue:`43908`)" msgstr "" -"帶有 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 旗標的堆積型別現在可以繼承 :pep:" -"`590` 向量呼叫協定 (vectorcall protocol)。以前這僅適用於 :ref:`static types " -"<static-types>`。(由 Erlend E. Aasland 在 :issue:`43908` 中貢獻)。" +"帶有 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 旗標的堆積型別現在可以繼" +"承 :pep:`590` 向量呼叫協定 (vectorcall protocol)。以前這僅適用" +"於 :ref:`static types <static-types>`。(由 Erlend E. Aasland " +"在 :issue:`43908` 中貢獻)。" #: ../../whatsnew/3.11.rst:2377 msgid "" @@ -4694,9 +4749,9 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" "由於 :c:func:`Py_TYPE()` 更改為行內靜態函式 (inline static function),因此 " -"``Py_TYPE(obj) = new_type`` 必須替換為 ``Py_SET_TYPE(obj, new_type)``:參見 :" -"c:func:`Py_SET_TYPE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這" -"個巨集:" +"``Py_TYPE(obj) = new_type`` 必須替換為 ``Py_SET_TYPE(obj, new_type)``:參" +"見 :c:func:`Py_SET_TYPE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使" +"用這個巨集:" #: ../../whatsnew/3.11.rst:2383 msgid "" @@ -4724,9 +4779,9 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" "由於 :c:func:`Py_SIZE()` 更改為行內靜態函式,因此 ``Py_SIZE(obj) = " -"new_size`` 必須替換為 ``Py_SET_SIZE(obj, new_size)``:參見 :c:func:" -"`Py_SET_SIZE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這個巨" -"集:" +"new_size`` 必須替換為 ``Py_SET_SIZE(obj, new_size)``:參" +"見 :c:func:`Py_SET_SIZE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使" +"用這個巨集:" #: ../../whatsnew/3.11.rst:2397 msgid "" @@ -4744,9 +4799,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:2405 msgid "" -"``<Python.h>`` no longer includes the header files ``<stdlib.h>``, ``<stdio." -"h>``, ``<errno.h>`` and ``<string.h>`` when the ``Py_LIMITED_API`` macro is " -"set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " +"``<Python.h>`` no longer includes the header files ``<stdlib.h>``, " +"``<stdio.h>``, ``<errno.h>`` and ``<string.h>`` when the ``Py_LIMITED_API`` " +"macro is set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " "explicitly include the header files after ``#include <Python.h>``. " "(Contributed by Victor Stinner in :issue:`45434`.)" msgstr "" @@ -4780,8 +4835,8 @@ msgid "" "Victor Stinner in :issue:`46007`.)" msgstr "" ":c:func:`!PyUnicode_CHECK_INTERNED` 巨集已從受限 C API 中移出,它從來沒辦法被" -"使用,因為它使用了受限 C API 不提供的內部結構。(由 Victor Stinner 於 :issue:" -"`46007` 中所貢獻。)" +"使用,因為它使用了受限 C API 不提供的內部結構。(由 Victor Stinner " +"於 :issue:`46007` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2424 msgid "" @@ -4891,8 +4946,8 @@ msgid "" "it may be faster." msgstr "" "``f_lasti``:使用 :c:func:`PyFrame_GetLasti`。程式碼中 ``f_lasti`` 有與 " -"``PyCode_Addr2Line()`` 同時使用的部分應該改用 :c:func:" -"`PyFrame_GetLineNumber`;它可能會更快。" +"``PyCode_Addr2Line()`` 同時使用的部分應該改" +"用 :c:func:`PyFrame_GetLineNumber`;它可能會更快。" #: ../../whatsnew/3.11.rst:2464 msgid "``f_lineno``: use :c:func:`PyFrame_GetLineNumber`" @@ -4940,25 +4995,25 @@ msgstr "``f_valuestack``:已移除。" #: ../../whatsnew/3.11.rst:2474 msgid "" -"The Python frame object is now created lazily. A side effect is that the :" -"attr:`~frame.f_back` member must not be accessed directly, since its value " -"is now also computed lazily. The :c:func:`PyFrame_GetBack` function must be " -"called instead." +"The Python frame object is now created lazily. A side effect is that " +"the :attr:`~frame.f_back` member must not be accessed directly, since its " +"value is now also computed lazily. The :c:func:`PyFrame_GetBack` function " +"must be called instead." msgstr "" "Python 幀物件的建立現為惰性的 (lazily),一個副作用是 :attr:`~frame.f_back` 成" -"員不能被直接存取,因為其職的計算也是惰性的,要改呼叫 :c:func:" -"`PyFrame_GetBack`。" +"員不能被直接存取,因為其職的計算也是惰性的,要改呼" +"叫 :c:func:`PyFrame_GetBack`。" #: ../../whatsnew/3.11.rst:2480 msgid "" -"Debuggers that accessed the :attr:`~frame.f_locals` directly *must* call :c:" -"func:`PyFrame_GetLocals` instead. They no longer need to call :c:func:`!" -"PyFrame_FastToLocalsWithError` or :c:func:`!PyFrame_LocalsToFast`, in fact " -"they should not call those functions. The necessary updating of the frame is " -"now managed by the virtual machine." +"Debuggers that accessed the :attr:`~frame.f_locals` directly *must* " +"call :c:func:`PyFrame_GetLocals` instead. They no longer need to " +"call :c:func:`!PyFrame_FastToLocalsWithError` or :c:func:`!" +"PyFrame_LocalsToFast`, in fact they should not call those functions. The " +"necessary updating of the frame is now managed by the virtual machine." msgstr "" -"直接存取 :attr:`~frame.f_locals` 的除錯器\\ *必須*\\ 改為呼叫 :c:func:" -"`PyFrame_GetLocals`。他們不再需要呼叫 :c:func:`!" +"直接存取 :attr:`~frame.f_locals` 的除錯器\\ *必須*\\ 改為呼" +"叫 :c:func:`PyFrame_GetLocals`。他們不再需要呼叫 :c:func:`!" "PyFrame_FastToLocalsWithError` 或 :c:func:`!PyFrame_LocalsToFast`,事實上他們" "不應該呼叫這些函式。框架的必要更新現在由虛擬機管理。" @@ -5030,13 +5085,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:2516 msgid "" -"``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` and :c:func:" -"`PyThreadState_LeaveTracing` (functions added to Python 3.11 by :issue:" -"`43760`)." +"``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` " +"and :c:func:`PyThreadState_LeaveTracing` (functions added to Python 3.11 " +"by :issue:`43760`)." msgstr "" -"``tracing``:已變更,改用 :c:func:`PyThreadState_EnterTracing` 和 :c:func:" -"`PyThreadState_LeaveTracing`\\ (:issue:`43760` 於 Python 3.11 中新增的函" -"式)。" +"``tracing``:已變更,改用 :c:func:`PyThreadState_EnterTracing` " +"和 :c:func:`PyThreadState_LeaveTracing`\\ (:issue:`43760` 於 Python 3.11 中" +"新增的函式)。" #: ../../whatsnew/3.11.rst:2519 msgid "" @@ -5135,7 +5190,7 @@ msgid "" "Or use `the pythoncapi-compat project <https://github.com/python/pythoncapi-" "compat>`__ to get these functions on old Python functions." msgstr "" -"或是使用 `pythoncap-compat 計畫 <https://github.com/python/pythoncapi-" +"或是使用 `pythoncap-compat 專案 <https://github.com/python/pythoncapi-" "compat>`__\\ 來在舊版 Python 函式中取得它們。" #: ../../whatsnew/3.11.rst:2563 @@ -5151,22 +5206,23 @@ msgid "" "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" -"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始化 :data:" -"`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須被設為 " -"1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` 的值。" +"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始" +"化 :data:`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須" +"被設為 1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` " +"的值。" #: ../../whatsnew/3.11.rst:2571 msgid "" ":c:func:`PyConfig_Read` no longer calculates the initial search path, and " "will not fill any values into :c:member:`PyConfig.module_search_paths`. To " -"calculate default paths and then modify them, finish initialization and use :" -"c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " +"calculate default paths and then modify them, finish initialization and " +"use :c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " "object and modify it directly." msgstr "" -":c:func:`PyConfig_Read` 不再計算初始搜索路徑,並且不會將任何值填充到 :c:" -"member:`PyConfig.module_search_paths` 中。若要計算預設路徑然後修改它們,完成" -"初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 Python 列" -"表物件並直接修改它。" +":c:func:`PyConfig_Read` 不再計算初始搜尋路徑,並且不會將任何值填充" +"到 :c:member:`PyConfig.module_search_paths` 中。若要計算預設路徑然後修改它" +"們,完成初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 " +"Python 列表物件並直接修改它。" #: ../../whatsnew/3.11.rst:2582 msgid "" @@ -5232,11 +5288,12 @@ msgstr "" #: ../../whatsnew/3.11.rst:2601 msgid "" -"Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:" -"func:`PyObject_Hash` instead. (Contributed by Inada Naoki in :issue:`46864`.)" +"Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. " +"Use :c:func:`PyObject_Hash` instead. (Contributed by Inada Naoki " +"in :issue:`46864`.)" msgstr "" -"棄用 :c:type:`PyBytesObject` 中的 ``ob_shash`` 成員。請改用 :c:func:" -"`PyObject_Hash`。(由 Inada Naoki 於 :issue:`46864` 中所貢獻。)" +"棄用 :c:type:`PyBytesObject` 中的 ``ob_shash`` 成員。請改" +"用 :c:func:`PyObject_Hash`。(由 Inada Naoki 於 :issue:`46864` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2610 msgid "" @@ -5366,8 +5423,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:2659 msgid "" "Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the " -"``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:" -"`45440`.)" +"``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner " +"in :issue:`45440`.)" msgstr "" "移除 ``Py_FORCE_DOUBLE()`` 巨集。它先前被用於 ``Py_IS_INFINITY()`` 巨集。" "(由 Victor Stinner 於 :issue:`45440` 中所貢獻。)" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index b0f93a3c71..fb08a83de7 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,6 +54,10 @@ msgid "" "Filesystem support in :mod:`os` and :mod:`pathlib` has seen a number of " "improvements, and several modules have better performance." msgstr "" +"Python 3.12 是 Python 程式語言的穩定版本,包含了語言和標準函式庫的綜合變更。" +"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的是,:mod:" +"`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` 中的檔案系" +"統支援進行了許多改進,並且有數個模組得到更好的效能。" #: ../../whatsnew/3.12.rst:69 msgid "" @@ -64,6 +68,11 @@ msgid "" "`generic types <generic type>` and :term:`type aliases <type alias>` with " "static type checkers." msgstr "" +"語言變更主要集中在可用性,因為 :term:`f-字串 <f-string>`\\ 已經移除了許多限" +"制,並且持續改進 'Did you mean ...' 建議。新的\\ :ref:`型別參數語法 " +"<whatsnew312-pep695>`\\ 和 :keyword:`type` 陳述式改進了\\ :term:`泛型型別 " +"<generic type>`\\ 和\\ :term:`型別別名 <type alias>`\\ 在與靜態型別檢查器一起" +"使用上的效率。" #: ../../whatsnew/3.12.rst:76 msgid "" @@ -75,6 +84,10 @@ msgid "" "change, refer to the PEP for a particular new feature; but note that PEPs " "usually are not kept up-to-date once a feature has been fully implemented." msgstr "" +"這篇文章並不試圖提供所有新功能的完整規格,而是提供一個方便的概覽。完整詳情應" +"參考文件,如\\ :ref:`標準函式庫參考 <library-index>`\\ 和\\ :ref:`語言參考 " +"<reference-index>`。如果你想了解某個新功能的完整實作和設計理念,請參考該功能" +"的 PEP;但請注意 PEP 通常在功能完全實作後就不再更新。" #: ../../whatsnew/3.12.rst:90 msgid "New syntax features:" @@ -96,6 +109,7 @@ msgid "" ":ref:`PEP 701 <whatsnew312-pep701>`, :term:`f-strings <f-string>` in the " "grammar" msgstr "" +":ref:`PEP 701 <whatsnew312-pep701>`,文法中的 :term:`f-字串 <f-string>`" #: ../../whatsnew/3.12.rst:98 msgid "Interpreter improvements:" @@ -106,10 +120,12 @@ msgid "" ":ref:`PEP 684 <whatsnew312-pep684>`, a unique per-interpreter :term:`GIL " "<global interpreter lock>`" msgstr "" +":ref:`PEP 684 <whatsnew312-pep684>`,直譯器各別持有的 :term:`GIL <global " +"interpreter lock>`" #: ../../whatsnew/3.12.rst:102 msgid ":ref:`PEP 669 <whatsnew312-pep669>`, low impact monitoring" -msgstr "" +msgstr ":ref:`PEP 669 <whatsnew312-pep669>`,低影響監控" #: ../../whatsnew/3.12.rst:103 msgid "" @@ -137,7 +153,7 @@ msgstr ":class:`pathlib.Path` 類別現在支援子類別化" #: ../../whatsnew/3.12.rst:114 msgid "The :mod:`os` module received several improvements for Windows support" -msgstr "" +msgstr ":mod:`os` 模組在 Windows 支援上有了數項改進" #: ../../whatsnew/3.12.rst:115 msgid "" @@ -265,7 +281,7 @@ msgstr "" "`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-aliases_>`_\\ " "已被刪除。" -#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1832 +#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1840 msgid "New Features" msgstr "新增功能" @@ -491,7 +507,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:337 msgid "PEP 684: A Per-Interpreter GIL" -msgstr "" +msgstr "PEP 684:直譯器各別持有的 GIL" #: ../../whatsnew/3.12.rst:339 msgid "" @@ -501,6 +517,10 @@ msgid "" "CPU cores. This is currently only available through the C-API, though a " "Python API is :pep:`anticipated for 3.13 <554>`." msgstr "" +":pep:`684` 引入了直譯器各別持有的 :term:`GIL <global interpreter lock>`,因此" +"子直譯器現在可以使用各個直譯器特有的 GIL 來建立。這使得 Python 程式可以充分利" +"用多個 CPU 核心。目前這僅透過 C-API 使用,不過 Python API :pep:`預計在 3.13 " +"中釋出 <554>`。" #: ../../whatsnew/3.12.rst:345 msgid "" @@ -521,6 +541,16 @@ msgid "" "}\n" "/* The new interpreter is now active in the current thread. */" msgstr "" +"PyInterpreterConfig config = {\n" +" .check_multi_interp_extensions = 1,\n" +" .gil = PyInterpreterConfig_OWN_GIL,\n" +"};\n" +"PyThreadState *tstate = NULL;\n" +"PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);\n" +"if (PyStatus_Exception(status)) {\n" +" return -1;\n" +"}\n" +"/* 新的直譯器現在會在目前執行緒中啟用。 */" #: ../../whatsnew/3.12.rst:361 msgid "" @@ -659,13 +689,14 @@ msgstr "" #: ../../whatsnew/3.12.rst:480 msgid "New Features Related to Type Hints" -msgstr "" +msgstr "型別提示相關的新特性" #: ../../whatsnew/3.12.rst:482 msgid "" "This section covers major changes affecting :pep:`type hints <484>` and the :" "mod:`typing` module." msgstr "" +"本節涵蓋了影響\\ :pep:`型別提示 <484>`\\ 和 :mod:`typing` 模組的主要變更。" #: ../../whatsnew/3.12.rst:488 msgid "PEP 692: Using ``TypedDict`` for more precise ``**kwargs`` typing" @@ -1021,12 +1052,16 @@ msgid "" ":func:`importlib.resources.as_file` now supports resource directories. " "(Contributed by Jason R. Coombs in :gh:`97930`.)" msgstr "" +":func:`importlib.resources.as_file` 現在支援資源目錄。(由 Jason R. Coombs " +"於 :gh:`97930` 中貢獻。)" #: ../../whatsnew/3.12.rst:721 msgid "" "Rename first parameter of :func:`importlib.resources.files` to *anchor*. " "(Contributed by Jason R. Coombs in :gh:`100598`.)" msgstr "" +"將 :func:`importlib.resources.files` 的第一個參數重新命名為 *anchor*。(由 " +"Jason R. Coombs 於 :gh:`100598` 中貢獻。)" #: ../../whatsnew/3.12.rst:725 msgid "inspect" @@ -1038,6 +1073,9 @@ msgid "" "a :term:`coroutine` for use with :func:`inspect.iscoroutinefunction`. " "(Contributed by Carlton Gibson in :gh:`99247`.)" msgstr "" +"新增 :func:`inspect.markcoroutinefunction` 以標記會回傳 :term:`coroutine` 的" +"同步函式,以供 :func:`inspect.iscoroutinefunction` 使用。(由 Carlton Gibson " +"於 :gh:`99247` 中貢獻。)" #: ../../whatsnew/3.12.rst:731 msgid "" @@ -1045,6 +1083,9 @@ msgid "" "for determining the current state of asynchronous generators. (Contributed " "by Thomas Krennwallner in :gh:`79940`.)" msgstr "" +"新增 :func:`inspect.getasyncgenstate` 和 :func:`inspect.getasyncgenlocals` 以" +"確定非同步產生器的目前狀態。(由 Thomas Krennwallner 於 :gh:`79940` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:735 msgid "" @@ -1052,6 +1093,8 @@ msgid "" "improved. Most calls to the function should be at least 2x faster than they " "were in Python 3.11. (Contributed by Alex Waygood in :gh:`103193`.)" msgstr "" +":func:`inspect.getattr_static` 的效能已大幅改善。大多數對該函式的呼叫應該比 " +"Python 3.11 中快至少 2 倍。(由 Alex Waygood 於 :gh:`103193` 中貢獻。)" #: ../../whatsnew/3.12.rst:740 msgid "itertools" @@ -1063,6 +1106,8 @@ msgid "" "the last batch may be shorter than the rest. (Contributed by Raymond " "Hettinger in :gh:`98363`.)" msgstr "" +"新增 :func:`itertools.batched` 以將元素收集到大小均等的元組中,其中最後一批次" +"可能比其他的少。(由 Raymond Hettinger 於 :gh:`98363` 中貢獻。)" #: ../../whatsnew/3.12.rst:747 msgid "math" @@ -1130,12 +1175,16 @@ msgid "" "Add :func:`os.path.isjunction` to check if a given path is a junction. " "(Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" +"新增 :func:`os.path.isjunction` 以檢查給定路徑是否為連結點 (junction)。(由 " +"Charles Machalow 於 :gh:`99547` 中貢獻。)" #: ../../whatsnew/3.12.rst:787 msgid "" "Add :func:`os.path.splitroot` to split a path into a triad ``(drive, root, " "tail)``. (Contributed by Barney Gale in :gh:`101000`.)" msgstr "" +"新增 :func:`os.path.splitroot` 以將路徑分割為三元組 ``(drive, root, tail)``。" +"(由 Barney Gale 於 :gh:`101000` 中貢獻。)" #: ../../whatsnew/3.12.rst:791 msgid "pathlib" @@ -1179,21 +1228,33 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:815 +msgid "platform" +msgstr "platform" + +#: ../../whatsnew/3.12.rst:817 +msgid "" +"Add support for detecting Windows 11 and Windows Server releases past 2012. " +"Previously, lookups on Windows Server platforms newer than Windows Server " +"2012 and on Windows 11 would return ``Windows-10``. (Contributed by Steve " +"Dower in :gh:`89545`.)" +msgstr "" + +#: ../../whatsnew/3.12.rst:823 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.12.rst:817 +#: ../../whatsnew/3.12.rst:825 msgid "" "Add convenience variables to hold values temporarily for debug session and " "provide quick access to values like the current frame or the return value. " "(Contributed by Tian Gao in :gh:`103693`.)" msgstr "" -#: ../../whatsnew/3.12.rst:823 +#: ../../whatsnew/3.12.rst:831 msgid "random" msgstr "random" -#: ../../whatsnew/3.12.rst:825 +#: ../../whatsnew/3.12.rst:833 msgid "" "Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" "`81620`.)" @@ -1201,7 +1262,7 @@ msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" -#: ../../whatsnew/3.12.rst:828 +#: ../../whatsnew/3.12.rst:836 msgid "" "Add a default of ``lambd=1.0`` to :func:`random.expovariate`. (Contributed " "by Raymond Hettinger in :gh:`100234`.)" @@ -1209,11 +1270,11 @@ msgstr "" "將預設值 ``lambd=1.0`` 加入至 :func:`random.expovariate` 中。(由 Raymond " "Hettinger 在 :gh:`100234` 中貢獻。)" -#: ../../whatsnew/3.12.rst:832 +#: ../../whatsnew/3.12.rst:840 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.12.rst:834 +#: ../../whatsnew/3.12.rst:842 msgid "" ":func:`shutil.make_archive` now passes the *root_dir* argument to custom " "archivers which support it. In this case it no longer temporarily changes " @@ -1221,7 +1282,7 @@ msgid "" "archiving. (Contributed by Serhiy Storchaka in :gh:`74696`.)" msgstr "" -#: ../../whatsnew/3.12.rst:840 +#: ../../whatsnew/3.12.rst:848 msgid "" ":func:`shutil.rmtree` now accepts a new argument *onexc* which is an error " "handler like *onerror* but which expects an exception instance rather than a " @@ -1229,14 +1290,14 @@ msgid "" "Katriel in :gh:`102828`.)" msgstr "" -#: ../../whatsnew/3.12.rst:845 +#: ../../whatsnew/3.12.rst:853 msgid "" ":func:`shutil.which` now consults the *PATHEXT* environment variable to find " "matches within *PATH* on Windows even when the given *cmd* includes a " "directory component. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:850 +#: ../../whatsnew/3.12.rst:858 msgid "" ":func:`shutil.which` will call ``NeedCurrentDirectoryForExePathW`` when " "querying for executables on Windows to determine if the current working " @@ -1244,18 +1305,18 @@ msgid "" "Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:855 +#: ../../whatsnew/3.12.rst:863 msgid "" ":func:`shutil.which` will return a path matching the *cmd* with a component " "from ``PATHEXT`` prior to a direct match elsewhere in the search path on " "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1536 +#: ../../whatsnew/3.12.rst:869 ../../whatsnew/3.12.rst:1544 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.12.rst:863 +#: ../../whatsnew/3.12.rst:871 msgid "" "Add a :ref:`command-line interface <sqlite3-cli>`. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" @@ -1263,7 +1324,7 @@ msgstr "" "新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland 於 :gh:" "`77617` 中貢獻。)" -#: ../../whatsnew/3.12.rst:866 +#: ../../whatsnew/3.12.rst:874 msgid "" "Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." "Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " @@ -1271,43 +1332,43 @@ msgid "" "control-autocommit>`. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" -#: ../../whatsnew/3.12.rst:873 +#: ../../whatsnew/3.12.rst:881 msgid "" "Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." "load_extension`, for overriding the SQLite extension entry point. " "(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" -#: ../../whatsnew/3.12.rst:878 +#: ../../whatsnew/3.12.rst:886 msgid "" "Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." "setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " "database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" -#: ../../whatsnew/3.12.rst:884 +#: ../../whatsnew/3.12.rst:892 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.12.rst:886 +#: ../../whatsnew/3.12.rst:894 msgid "" "Extend :func:`statistics.correlation` to include as a ``ranked`` method for " "computing the Spearman correlation of ranked data. (Contributed by Raymond " "Hettinger in :gh:`95861`.)" msgstr "" -#: ../../whatsnew/3.12.rst:891 +#: ../../whatsnew/3.12.rst:899 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.12.rst:893 +#: ../../whatsnew/3.12.rst:901 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " "<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" -#: ../../whatsnew/3.12.rst:897 +#: ../../whatsnew/3.12.rst:905 msgid "" "Add :func:`sys.activate_stack_trampoline` and :func:`sys." "deactivate_stack_trampoline` for activating and deactivating stack profiler " @@ -1317,7 +1378,7 @@ msgid "" "Shannon in :gh:`96123`.)" msgstr "" -#: ../../whatsnew/3.12.rst:906 +#: ../../whatsnew/3.12.rst:914 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " @@ -1326,14 +1387,14 @@ msgid "" "Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1731 +#: ../../whatsnew/3.12.rst:920 ../../whatsnew/3.12.rst:1739 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " "by Irit Katriel in :gh:`103176`.)" msgstr "" -#: ../../whatsnew/3.12.rst:916 +#: ../../whatsnew/3.12.rst:924 msgid "" ":func:`sys.setrecursionlimit` and :func:`sys.getrecursionlimit`. The " "recursion limit now applies only to Python code. Builtin functions do not " @@ -1341,11 +1402,11 @@ msgid "" "prevents recursion from causing a virtual machine crash." msgstr "" -#: ../../whatsnew/3.12.rst:922 +#: ../../whatsnew/3.12.rst:930 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.12.rst:924 +#: ../../whatsnew/3.12.rst:932 msgid "" "The :class:`tempfile.NamedTemporaryFile` function has a new optional " "parameter *delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)" @@ -1353,7 +1414,7 @@ msgstr "" ":class:`tempfile.NamedTemporaryFile` 函式新增了一個選擇性參數 " "*delete_on_close* (由 Evgeny Zorin 於 :gh:`58451` 中貢獻。)" -#: ../../whatsnew/3.12.rst:926 +#: ../../whatsnew/3.12.rst:934 msgid "" ":func:`tempfile.mkdtemp` now always returns an absolute path, even if the " "argument provided to the *dir* parameter is a relative path." @@ -1361,11 +1422,11 @@ msgstr "" ":func:`tempfile.mkdtemp` 現在總是會傳回絕對路徑,即使提供給 *dir* 參數的引數" "是相對路徑。" -#: ../../whatsnew/3.12.rst:930 +#: ../../whatsnew/3.12.rst:938 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.12.rst:932 +#: ../../whatsnew/3.12.rst:940 msgid "" "Add :func:`threading.settrace_all_threads` and :func:`threading." "setprofile_all_threads` that allow to set tracing and profiling functions in " @@ -1373,11 +1434,11 @@ msgid "" "Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:938 +#: ../../whatsnew/3.12.rst:946 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.12.rst:940 +#: ../../whatsnew/3.12.rst:948 msgid "" "``tkinter.Canvas.coords()`` now flattens its arguments. It now accepts not " "only coordinates as separate arguments (``x1, y1, x2, y2, ...``) and a " @@ -1387,11 +1448,11 @@ msgid "" "in :gh:`94473`.)" msgstr "" -#: ../../whatsnew/3.12.rst:949 +#: ../../whatsnew/3.12.rst:957 msgid "tokenize" msgstr "tokenize" -#: ../../whatsnew/3.12.rst:951 +#: ../../whatsnew/3.12.rst:959 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " "(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" @@ -1399,22 +1460,22 @@ msgid "" "to the :mod:`tokenize` module." msgstr "" -#: ../../whatsnew/3.12.rst:957 +#: ../../whatsnew/3.12.rst:965 msgid "types" msgstr "types" -#: ../../whatsnew/3.12.rst:959 +#: ../../whatsnew/3.12.rst:967 msgid "" "Add :func:`types.get_original_bases` to allow for further introspection of :" "ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" "Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" -#: ../../whatsnew/3.12.rst:966 +#: ../../whatsnew/3.12.rst:974 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.12.rst:968 +#: ../../whatsnew/3.12.rst:976 msgid "" ":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." "runtime_checkable>` now use :func:`inspect.getattr_static` rather than :func:" @@ -1427,7 +1488,7 @@ msgid "" "affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" -#: ../../whatsnew/3.12.rst:979 +#: ../../whatsnew/3.12.rst:987 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -1435,7 +1496,7 @@ msgid "" "on :func:`isinstance` checks comparing objects to the protocol. For example::" msgstr "" -#: ../../whatsnew/3.12.rst:984 +#: ../../whatsnew/3.12.rst:992 msgid "" ">>> from typing import Protocol, runtime_checkable\n" ">>> @runtime_checkable\n" @@ -1455,14 +1516,30 @@ msgid "" "attribute\n" "True" msgstr "" +">>> from typing import Protocol, runtime_checkable\n" +">>> @runtime_checkable\n" +"... class HasX(Protocol):\n" +"... x = 1\n" +"...\n" +">>> class Foo: ...\n" +"...\n" +">>> f = Foo()\n" +">>> isinstance(f, HasX)\n" +"False\n" +">>> f.x = 1\n" +">>> isinstance(f, HasX)\n" +"True\n" +">>> HasX.y = 2\n" +">>> isinstance(f, HasX) # 沒有改變,即便 HasX 現在有 \"y\" 屬性\n" +"True" -#: ../../whatsnew/3.12.rst:1001 +#: ../../whatsnew/3.12.rst:1009 msgid "" "This change was made in order to speed up ``isinstance()`` checks against " "runtime-checkable protocols." msgstr "" -#: ../../whatsnew/3.12.rst:1004 +#: ../../whatsnew/3.12.rst:1012 msgid "" "The performance profile of :func:`isinstance` checks against :func:`runtime-" "checkable protocols <typing.runtime_checkable>` has changed significantly. " @@ -1473,14 +1550,14 @@ msgid "" "`74690` and :gh:`103193`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1012 +#: ../../whatsnew/3.12.rst:1020 msgid "" "All :data:`typing.TypedDict` and :data:`typing.NamedTuple` classes now have " "the ``__orig_bases__`` attribute. (Contributed by Adrian Garcia Badaracco " "in :gh:`103699`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1016 +#: ../../whatsnew/3.12.rst:1024 msgid "" "Add ``frozen_default`` parameter to :func:`typing.dataclass_transform`. " "(Contributed by Erik De Bonte in :gh:`99957`.)" @@ -1488,26 +1565,26 @@ msgstr "" "新增 ``frozen_default`` 參數至 :func:`typing.dataclass_transform`。(由 Erik " "De Bonte 於 :gh:`99957` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1020 +#: ../../whatsnew/3.12.rst:1028 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.12.rst:1022 +#: ../../whatsnew/3.12.rst:1030 msgid "" "The Unicode database has been updated to version 15.0.0. (Contributed by " "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1576 +#: ../../whatsnew/3.12.rst:1034 ../../whatsnew/3.12.rst:1584 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.12.rst:1028 +#: ../../whatsnew/3.12.rst:1036 msgid "" "Add a ``--durations`` command line option, showing the N slowest test cases::" msgstr "新增 ``--durations`` 命令列選項,顯示 N 個最慢的測試案例:" -#: ../../whatsnew/3.12.rst:1030 +#: ../../whatsnew/3.12.rst:1038 msgid "" "python3 -m unittest --durations=3 lib.tests.test_threading\n" ".....\n" @@ -1537,15 +1614,15 @@ msgstr "" "\n" "OK (skipped=3)" -#: ../../whatsnew/3.12.rst:1044 +#: ../../whatsnew/3.12.rst:1052 msgid "(Contributed by Giampaolo Rodola in :gh:`48330`)" msgstr "(由 Giampaolo Rodola 於 :gh:`48330` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1047 +#: ../../whatsnew/3.12.rst:1055 msgid "uuid" msgstr "uuid" -#: ../../whatsnew/3.12.rst:1049 +#: ../../whatsnew/3.12.rst:1057 msgid "" "Add a :ref:`command-line interface <uuid-cli>`. (Contributed by Adam Chhina " "in :gh:`88597`.)" @@ -1553,25 +1630,25 @@ msgstr "" "新增一個\\ :ref:`命令列介面 <uuid-cli>`。(由 Adam Chhina 於 :gh:`88597` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1054 +#: ../../whatsnew/3.12.rst:1062 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.12.rst:1056 +#: ../../whatsnew/3.12.rst:1064 msgid "" "Remove ``wstr`` and ``wstr_length`` members from Unicode objects. It reduces " "object size by 8 or 16 bytes on 64bit platform. (:pep:`623`) (Contributed by " "Inada Naoki in :gh:`92536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1060 +#: ../../whatsnew/3.12.rst:1068 msgid "" "Add experimental support for using the BOLT binary optimizer in the build " "process, which improves performance by 1-5%. (Contributed by Kevin " "Modzelewski in :gh:`90536` and tuned by Donghee Na in :gh:`101525`)" msgstr "" -#: ../../whatsnew/3.12.rst:1064 +#: ../../whatsnew/3.12.rst:1072 msgid "" "Speed up the regular expression substitution (functions :func:`re.sub` and :" "func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " @@ -1579,13 +1656,15 @@ msgid "" "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1069 +#: ../../whatsnew/3.12.rst:1077 msgid "" "Speed up :class:`asyncio.Task` creation by deferring expensive string " "formatting. (Contributed by Itamar Oren in :gh:`103793`.)" msgstr "" +"透過延遲運算較繁重的字串格式化來加速 :class:`asyncio.Task` 的建立。(由 " +"Itamar Oren 於 :gh:`103793` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1072 +#: ../../whatsnew/3.12.rst:1080 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " "are up to 64% faster as a side effect of the changes required to cover :pep:" @@ -1593,81 +1672,100 @@ msgid "" "Pablo Galindo in :gh:`102856`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1077 +#: ../../whatsnew/3.12.rst:1085 msgid "" "Speed up :func:`super` method calls and attribute loads via the new :opcode:" "`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " "Matveev in :gh:`103497`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1083 +#: ../../whatsnew/3.12.rst:1091 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.12.rst:1085 +#: ../../whatsnew/3.12.rst:1093 msgid "" "Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" "opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" "`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " "by Ken Jin in :gh:`93429`.)" msgstr "" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" +"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" +"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1090 +#: ../../whatsnew/3.12.rst:1098 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" "JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" "`102859`.)" msgstr "" +"移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" +"(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1093 +#: ../../whatsnew/3.12.rst:1101 msgid "" "Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" "gh:`92925`.)" msgstr "" +"移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1096 +#: ../../whatsnew/3.12.rst:1104 msgid "" "Add the :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions. " "(Contributed by Mark Shannon in :gh:`94163`.)" msgstr "" +"新增 :opcode:`BINARY_SLICE` 和 :opcode:`STORE_SLICE` 指令。(由 Mark Shannon " +"於 :gh:`94163` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1099 +#: ../../whatsnew/3.12.rst:1107 msgid "" "Add the :opcode:`CALL_INTRINSIC_1` instructions. (Contributed by Mark " "Shannon in :gh:`99005`.)" msgstr "" +"新增 :opcode:`CALL_INTRINSIC_1` 指令。(由 Mark Shannon 於 :gh:`99005` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1102 +#: ../../whatsnew/3.12.rst:1110 msgid "" "Add the :opcode:`CALL_INTRINSIC_2` instruction. (Contributed by Irit Katriel " "in :gh:`101799`.)" msgstr "" +"新增 :opcode:`CALL_INTRINSIC_2` 指令。(由 Irit Katriel 於 :gh:`101799` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1105 +#: ../../whatsnew/3.12.rst:1113 msgid "" "Add the :opcode:`CLEANUP_THROW` instruction. (Contributed by Brandt Bucher " "in :gh:`90997`.)" msgstr "" +"新增 :opcode:`CLEANUP_THROW` 指令。(由 Brandt Bucher 於 :gh:`90997` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1108 +#: ../../whatsnew/3.12.rst:1116 msgid "" "Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" +"新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1111 +#: ../../whatsnew/3.12.rst:1119 msgid "" "Add the :opcode:`LOAD_FAST_AND_CLEAR` instruction as part of the " "implementation of :pep:`709`. (Contributed by Carl Meyer in :gh:`101441`.)" msgstr "" +"新增 :opcode:`LOAD_FAST_AND_CLEAR` 指令作為 :pep:`709` 實作的一部分。(由 " +"Carl Meyer 於 :gh:`101441` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1114 +#: ../../whatsnew/3.12.rst:1122 msgid "" "Add the :opcode:`LOAD_FAST_CHECK` instruction. (Contributed by Dennis " "Sweeney in :gh:`93143`.)" msgstr "" +"新增 :opcode:`LOAD_FAST_CHECK` 指令。(由 Dennis Sweeney 於 :gh:`93143` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1117 +#: ../../whatsnew/3.12.rst:1125 msgid "" "Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" "`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " @@ -1675,42 +1773,51 @@ msgid "" "opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" "`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" +"新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " +"和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" +"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1123 +#: ../../whatsnew/3.12.rst:1131 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" +"gh:`103497` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1126 +#: ../../whatsnew/3.12.rst:1134 msgid "" "Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" "gh:`101632`.)" msgstr "" +"新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1129 +#: ../../whatsnew/3.12.rst:1137 msgid "Demos and Tools" msgstr "" -#: ../../whatsnew/3.12.rst:1131 +#: ../../whatsnew/3.12.rst:1139 msgid "" "Remove the ``Tools/demo/`` directory which contained old demo scripts. A " "copy can be found in the `old-demos project <https://github.com/gvanrossum/" "old-demos>`_. (Contributed by Victor Stinner in :gh:`97681`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1136 +#: ../../whatsnew/3.12.rst:1144 msgid "" "Remove outdated example scripts of the ``Tools/scripts/`` directory. A copy " "can be found in the `old-demos project <https://github.com/gvanrossum/old-" "demos>`_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2134 +#: ../../whatsnew/3.12.rst:1151 ../../whatsnew/3.12.rst:2142 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.12.rst:1145 +#: ../../whatsnew/3.12.rst:1153 #: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" @@ -1721,40 +1828,43 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../whatsnew/3.12.rst:1150 +#: ../../whatsnew/3.12.rst:1158 msgid "" ":mod:`ast`: The following :mod:`ast` features have been deprecated in " "documentation since Python 3.8, now cause a :exc:`DeprecationWarning` to be " "emitted at runtime when they are accessed or used, and will be removed in " "Python 3.14:" msgstr "" +":mod:`ast`:以下 :mod:`ast` 功能自 Python 3.8 起已在文件中被棄用,現在在存取" +"或使用時會在 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移" +"除:" -#: ../../whatsnew/3.12.rst:1154 +#: ../../whatsnew/3.12.rst:1162 #: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../whatsnew/3.12.rst:1155 +#: ../../whatsnew/3.12.rst:1163 #: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../whatsnew/3.12.rst:1156 +#: ../../whatsnew/3.12.rst:1164 #: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../whatsnew/3.12.rst:1157 +#: ../../whatsnew/3.12.rst:1165 #: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../whatsnew/3.12.rst:1158 +#: ../../whatsnew/3.12.rst:1166 #: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../whatsnew/3.12.rst:1160 +#: ../../whatsnew/3.12.rst:1168 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" @@ -1762,13 +1872,13 @@ msgid "" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../whatsnew/3.12.rst:1163 +#: ../../whatsnew/3.12.rst:1171 #: ../../deprecations/pending-removal-in-3.14.rst:22 #: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../whatsnew/3.12.rst:1165 +#: ../../whatsnew/3.12.rst:1173 msgid "" "The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" "`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" @@ -1776,7 +1886,7 @@ msgid "" "3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1171 +#: ../../whatsnew/3.12.rst:1179 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" @@ -1789,7 +1899,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../whatsnew/3.12.rst:1177 +#: ../../whatsnew/3.12.rst:1185 #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " @@ -1801,8 +1911,8 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../whatsnew/3.12.rst:1182 -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../whatsnew/3.12.rst:1190 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -1812,7 +1922,7 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../whatsnew/3.12.rst:1186 +#: ../../whatsnew/3.12.rst:1194 msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " @@ -1820,7 +1930,7 @@ msgid "" "abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1191 +#: ../../whatsnew/3.12.rst:1199 msgid "" ":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." "utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " @@ -1830,7 +1940,7 @@ msgid "" "set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1199 +#: ../../whatsnew/3.12.rst:1207 msgid "" ":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -1838,48 +1948,48 @@ msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1202 +#: ../../whatsnew/3.12.rst:1210 msgid "" ":mod:`importlib.abc`: Deprecated the following classes, scheduled for " "removal in Python 3.14:" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" -#: ../../whatsnew/3.12.rst:1205 +#: ../../whatsnew/3.12.rst:1213 #: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../whatsnew/3.12.rst:1206 +#: ../../whatsnew/3.12.rst:1214 #: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1207 +#: ../../whatsnew/3.12.rst:1215 #: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1209 +#: ../../whatsnew/3.12.rst:1217 #: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../whatsnew/3.12.rst:1211 +#: ../../whatsnew/3.12.rst:1219 #: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1212 +#: ../../whatsnew/3.12.rst:1220 #: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1214 +#: ../../whatsnew/3.12.rst:1222 #: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../whatsnew/3.12.rst:1216 +#: ../../whatsnew/3.12.rst:1224 msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " @@ -1888,7 +1998,7 @@ msgid "" "`101588`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1222 +#: ../../whatsnew/3.12.rst:1230 msgid "" ":mod:`multiprocessing`: In Python 3.14, the default :mod:`multiprocessing` " "start method will change to a safer one on Linux, BSDs, and other non-macOS " @@ -1900,7 +2010,7 @@ msgid "" "methods <multiprocessing-start-methods>`." msgstr "" -#: ../../whatsnew/3.12.rst:1232 +#: ../../whatsnew/3.12.rst:1240 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " "are deprecated and will be removed in Python 3.14; use :func:`importlib.util." @@ -1910,7 +2020,7 @@ msgstr "" "被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" "(由 Nikita Sobolev 於 :gh:`97850` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1237 +#: ../../whatsnew/3.12.rst:1245 msgid "" ":mod:`pty`: The module has two undocumented ``master_open()`` and " "``slave_open()`` functions that have been deprecated since Python 2 but only " @@ -1918,11 +2028,11 @@ msgid "" "(Contributed by Soumendra Ganguly and Gregory P. Smith in :gh:`85984`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1242 +#: ../../whatsnew/3.12.rst:1250 msgid ":mod:`os`:" msgstr ":mod:`os`:" -#: ../../whatsnew/3.12.rst:1244 +#: ../../whatsnew/3.12.rst:1252 msgid "" "The ``st_ctime`` fields return by :func:`os.stat` and :func:`os.lstat` on " "Windows are deprecated. In a future release, they will contain the last " @@ -1931,7 +2041,7 @@ msgid "" "``st_birthtime`` field. (Contributed by Steve Dower in :gh:`99726`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1250 +#: ../../whatsnew/3.12.rst:1258 msgid "" "On POSIX platforms, :func:`os.fork` can now raise a :exc:" "`DeprecationWarning` when it can detect being called from a multithreaded " @@ -1945,14 +2055,14 @@ msgid "" "platform compatibility problem to developers." msgstr "" -#: ../../whatsnew/3.12.rst:1260 +#: ../../whatsnew/3.12.rst:1268 msgid "" "When this warning appears due to usage of :mod:`multiprocessing` or :mod:" "`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " "start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" -#: ../../whatsnew/3.12.rst:1264 +#: ../../whatsnew/3.12.rst:1272 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " "deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" @@ -1961,19 +2071,19 @@ msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1267 +#: ../../whatsnew/3.12.rst:1275 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.12.rst:1269 +#: ../../whatsnew/3.12.rst:1277 msgid "" ":ref:`default adapters and converters <sqlite3-default-converters>` are now " "deprecated. Instead, use the :ref:`sqlite3-adapter-converter-recipes` and " "tailor them to your needs. (Contributed by Erlend E. Aasland in :gh:`90016`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1275 +#: ../../whatsnew/3.12.rst:1283 msgid "" "In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted " "when :ref:`named placeholders <sqlite3-placeholders>` are used together with " @@ -1983,7 +2093,7 @@ msgid "" "Erlend E. Aasland in :gh:`101698`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1282 +#: ../../whatsnew/3.12.rst:1290 msgid "" ":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." "last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " @@ -1993,33 +2103,33 @@ msgstr "" "last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " "於 :gh:`102778` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1286 +#: ../../whatsnew/3.12.rst:1294 msgid "" ":mod:`tarfile`: Extracting tar archives without specifying *filter* is " "deprecated until Python 3.14, when ``'data'`` filter will become the " "default. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../whatsnew/3.12.rst:1298 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.12.rst:1292 +#: ../../whatsnew/3.12.rst:1300 msgid "" ":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" "`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " "are deprecated. (:gh:`94309`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1296 +#: ../../whatsnew/3.12.rst:1304 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" "`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " "Waygood in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1300 +#: ../../whatsnew/3.12.rst:1308 msgid "" ":mod:`xml.etree.ElementTree`: The module now emits :exc:`DeprecationWarning` " "when testing the truth value of an :class:`xml.etree.ElementTree.Element`. " @@ -2027,7 +2137,7 @@ msgid "" "implementation emitted nothing. (Contributed by Jacob Walls in :gh:`83122`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1306 +#: ../../whatsnew/3.12.rst:1314 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " "<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and :meth:" @@ -2036,7 +2146,7 @@ msgid "" "instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1312 +#: ../../whatsnew/3.12.rst:1320 msgid "" ":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " "a module differs from :attr:`__spec__.parent <importlib.machinery.ModuleSpec." @@ -2044,7 +2154,7 @@ msgid "" "Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1318 +#: ../../whatsnew/3.12.rst:1326 msgid "" "Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " "module is deprecated, and will cease to be set or taken into consideration " @@ -2052,7 +2162,7 @@ msgid "" "`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1322 +#: ../../whatsnew/3.12.rst:1330 msgid "" "The bitwise inversion operator (``~``) on bool is deprecated. It will throw " "an error in Python 3.16. Use ``not`` for logical negation of bools instead. " @@ -2061,7 +2171,7 @@ msgid "" "Tim Hoffmann in :gh:`103487`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1328 +#: ../../whatsnew/3.12.rst:1336 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " "Python 3.10 via :pep:`626`, but it only got a proper :exc:" @@ -2451,10 +2561,19 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -2467,11 +2586,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -2479,11 +2598,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -2492,11 +2611,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -2507,11 +2638,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -2523,7 +2654,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -2534,7 +2665,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2544,11 +2675,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -2598,7 +2729,7 @@ msgstr "" "gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:10 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" @@ -2682,15 +2813,11 @@ msgid "" "groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -2699,7 +2826,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -2717,7 +2844,7 @@ msgstr "" "`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" "本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -2726,7 +2853,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -2735,7 +2862,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -2744,11 +2871,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; it should only be passed as a " @@ -2758,18 +2885,18 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -2777,7 +2904,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -2785,19 +2912,11 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -2805,19 +2924,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -2825,19 +2944,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -2845,7 +2964,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -2857,12 +2976,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -2870,15 +2989,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -2886,58 +3005,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -2945,11 +3057,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -2957,7 +3069,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -2965,20 +3077,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -2986,58 +3098,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -3047,13 +3159,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -3064,7 +3176,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -3072,32 +3184,33 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.12.rst:1347 ../../whatsnew/3.12.rst:2229 +#: ../../whatsnew/3.12.rst:1355 ../../whatsnew/3.12.rst:2237 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.12.rst:1350 +#: ../../whatsnew/3.12.rst:1358 msgid "asynchat and asyncore" msgstr "asynchat 和 asyncore" -#: ../../whatsnew/3.12.rst:1352 +#: ../../whatsnew/3.12.rst:1360 msgid "" "These two modules have been removed according to the schedule in :pep:`594`, " "having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " "(Contributed by Nikita Sobolev in :gh:`96580`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1359 +#: ../../whatsnew/3.12.rst:1367 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.12.rst:1361 +#: ../../whatsnew/3.12.rst:1369 msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" +"根據 :gh:`89336`,已移除了在 3.2 中被 :mod:`configparser` 棄用的幾個名稱:" -#: ../../whatsnew/3.12.rst:1364 +#: ../../whatsnew/3.12.rst:1372 msgid "" ":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " "argument. Use the ``source`` attribute and argument instead." @@ -3105,23 +3218,27 @@ msgstr "" ":class:`configparser.ParsingError` 不再具有 ``filename`` 屬性或引數。請改用 " "``source`` 屬性和引數。" -#: ../../whatsnew/3.12.rst:1366 +#: ../../whatsnew/3.12.rst:1374 msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" +"`~configparser.ConfigParser` 名稱。" -#: ../../whatsnew/3.12.rst:1368 +#: ../../whatsnew/3.12.rst:1376 msgid "" ":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" "meth:`~configparser.ConfigParser.read_file` instead." msgstr "" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" +"`~configparser.ConfigParser.read_file`。" -#: ../../whatsnew/3.12.rst:1374 +#: ../../whatsnew/3.12.rst:1382 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.12.rst:1376 +#: ../../whatsnew/3.12.rst:1384 msgid "" "Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " "by :pep:`632` \"Deprecate distutils module\". For projects still using " @@ -3130,17 +3247,17 @@ msgid "" "Victor Stinner in :gh:`92584`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1383 +#: ../../whatsnew/3.12.rst:1391 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.12.rst:1385 +#: ../../whatsnew/3.12.rst:1393 msgid "" "Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " "installing setuptools in environments created by :mod:`venv`." msgstr "" -#: ../../whatsnew/3.12.rst:1388 +#: ../../whatsnew/3.12.rst:1396 msgid "" "``pip (>= 22.1)`` does not require setuptools to be installed in the " "environment. ``setuptools``-based (and ``distutils``-based) packages can " @@ -3148,7 +3265,7 @@ msgid "" "the build environment it uses for building a package." msgstr "" -#: ../../whatsnew/3.12.rst:1394 +#: ../../whatsnew/3.12.rst:1402 msgid "" "``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " "longer provided by default in environments created with ``venv`` or " @@ -3158,25 +3275,27 @@ msgid "" "(typically, using pip)." msgstr "" -#: ../../whatsnew/3.12.rst:1401 +#: ../../whatsnew/3.12.rst:1409 msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1404 +#: ../../whatsnew/3.12.rst:1412 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.12.rst:1406 +#: ../../whatsnew/3.12.rst:1414 msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" msgstr "" +"移除 :mod:`enum` 的 ``EnumMeta.__getattr__``,對於列舉屬性的存取不再會需要" +"它。" -#: ../../whatsnew/3.12.rst:1411 +#: ../../whatsnew/3.12.rst:1419 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.12.rst:1413 +#: ../../whatsnew/3.12.rst:1421 msgid "" "Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " "*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" @@ -3184,11 +3303,11 @@ msgstr "" "移除 :mod:`ftplib` 的 ``FTP_TLS.ssl_version`` 類別屬性:請改用 *context* 參" "數。(由 Victor Stinner 於 :gh:`94172` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1418 +#: ../../whatsnew/3.12.rst:1426 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.12.rst:1420 +#: ../../whatsnew/3.12.rst:1428 msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " @@ -3197,11 +3316,11 @@ msgid "" "`94196`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1427 +#: ../../whatsnew/3.12.rst:1435 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.12.rst:1429 +#: ../../whatsnew/3.12.rst:1437 msgid "" "Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." "pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " @@ -3210,17 +3329,17 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1436 ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1444 ../../whatsnew/3.12.rst:1473 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.12.rst:1438 +#: ../../whatsnew/3.12.rst:1446 msgid "" "Many previously deprecated cleanups in :mod:`importlib` have now been " "completed:" msgstr "現已完成清理 :mod:`importlib` 中許多過去已經棄用的東西:" -#: ../../whatsnew/3.12.rst:1441 +#: ../../whatsnew/3.12.rst:1449 msgid "" "References to, and support for :meth:`!module_repr` has been removed. " "(Contributed by Barry Warsaw in :gh:`97850`.)" @@ -3228,134 +3347,136 @@ msgstr "" "對 :meth:`!module_repr` 的參照和支援已刪除。(由 Barry Warsaw 在 :gh:`97850` " "中貢獻。)" -#: ../../whatsnew/3.12.rst:1444 +#: ../../whatsnew/3.12.rst:1452 msgid "" "``importlib.util.set_package``, ``importlib.util.set_loader`` and " "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1448 +#: ../../whatsnew/3.12.rst:1456 msgid "" "Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " "(Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1451 +#: ../../whatsnew/3.12.rst:1459 msgid "" "``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " "have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1457 ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1465 ../../whatsnew/3.12.rst:1473 msgid "imp" msgstr "imp" -#: ../../whatsnew/3.12.rst:1459 +#: ../../whatsnew/3.12.rst:1467 msgid "" "The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" "gh:`98040`.)" -msgstr "" +msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1462 +#: ../../whatsnew/3.12.rst:1470 msgid "To migrate, consult the following correspondence table:" -msgstr "" +msgstr "要遷移的話請參考以下對應表:" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1475 msgid "``imp.NullImporter``" msgstr "``imp.NullImporter``" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1475 msgid "Insert ``None`` into ``sys.path_importer_cache``" msgstr "將 ``None`` 插入 ``sys.path_importer_cache``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1476 msgid "``imp.cache_from_source()``" msgstr "``imp.cache_from_source()``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1476 msgid ":func:`importlib.util.cache_from_source`" msgstr ":func:`importlib.util.cache_from_source`" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1477 msgid "``imp.find_module()``" msgstr "``imp.find_module()``" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1477 msgid ":func:`importlib.util.find_spec`" msgstr ":func:`importlib.util.find_spec`" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1478 msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" -#: ../../whatsnew/3.12.rst:1470 -msgid ":attr:`importlib.util.MAGIC_NUMBER`" -msgstr ":attr:`importlib.util.MAGIC_NUMBER`" +#: ../../whatsnew/3.12.rst:1478 +msgid ":const:`importlib.util.MAGIC_NUMBER`" +msgstr ":const:`importlib.util.MAGIC_NUMBER`" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1479 msgid "``imp.get_suffixes()``" msgstr "``imp.get_suffixes()``" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1479 msgid "" -":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." -"EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery." +"EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" +":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery." +"EXTENSION_SUFFIXES` 和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1480 msgid "``imp.get_tag()``" msgstr "``imp.get_tag()``" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1480 msgid ":attr:`sys.implementation.cache_tag <sys.implementation>`" msgstr ":attr:`sys.implementation.cache_tag <sys.implementation>`" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1481 msgid "``imp.load_module()``" msgstr "``imp.load_module()``" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1481 msgid ":func:`importlib.import_module`" msgstr ":func:`importlib.import_module`" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1482 msgid "``imp.new_module(name)``" msgstr "``imp.new_module(name)``" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1482 msgid "``types.ModuleType(name)``" msgstr "``types.ModuleType(name)``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1483 msgid "``imp.reload()``" msgstr "``imp.reload()``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1483 msgid ":func:`importlib.reload`" msgstr ":func:`importlib.reload`" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1484 msgid "``imp.source_from_cache()``" msgstr "``imp.source_from_cache()``" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1484 msgid ":func:`importlib.util.source_from_cache`" msgstr ":func:`importlib.util.source_from_cache`" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1485 msgid "``imp.load_source()``" msgstr "``imp.load_source()``" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1485 msgid "*See below*" msgstr "*見下文*" -#: ../../whatsnew/3.12.rst:1480 +#: ../../whatsnew/3.12.rst:1488 msgid "Replace ``imp.load_source()`` with::" msgstr "用以下取代 ``imp.load_source()``: ::" -#: ../../whatsnew/3.12.rst:1482 +#: ../../whatsnew/3.12.rst:1490 msgid "" "import importlib.util\n" "import importlib.machinery\n" @@ -3371,38 +3492,51 @@ msgid "" " loader.exec_module(module)\n" " return module" msgstr "" +"import importlib.util\n" +"import importlib.machinery\n" +"\n" +"def load_source(modname, filename):\n" +" loader = importlib.machinery.SourceFileLoader(modname, filename)\n" +" spec = importlib.util.spec_from_file_location(modname, filename, " +"loader=loader)\n" +" module = importlib.util.module_from_spec(spec)\n" +" # 此模組都會被執行且不會被快取於 sys.modules。\n" +" # 要快取模組的話可以把下面一行取消註解\n" +" # sys.modules[module.__name__] = module\n" +" loader.exec_module(module)\n" +" return module" -#: ../../whatsnew/3.12.rst:1495 +#: ../../whatsnew/3.12.rst:1503 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" -#: ../../whatsnew/3.12.rst:1497 +#: ../../whatsnew/3.12.rst:1505 msgid "Undocumented functions:" msgstr "未以文件記錄的函式:" -#: ../../whatsnew/3.12.rst:1499 +#: ../../whatsnew/3.12.rst:1507 msgid "``imp.init_builtin()``" msgstr "``imp.init_builtin()``" -#: ../../whatsnew/3.12.rst:1500 +#: ../../whatsnew/3.12.rst:1508 msgid "``imp.load_compiled()``" msgstr "``imp.load_compiled()``" -#: ../../whatsnew/3.12.rst:1501 +#: ../../whatsnew/3.12.rst:1509 msgid "``imp.load_dynamic()``" msgstr "``imp.load_dynamic()``" -#: ../../whatsnew/3.12.rst:1502 +#: ../../whatsnew/3.12.rst:1510 msgid "``imp.load_package()``" msgstr "``imp.load_package()``" -#: ../../whatsnew/3.12.rst:1504 +#: ../../whatsnew/3.12.rst:1512 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: ../../whatsnew/3.12.rst:1506 +#: ../../whatsnew/3.12.rst:1514 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " @@ -3412,11 +3546,11 @@ msgstr "" "``PY_COMPILED``、``C_EXTENSION``、``PY_RESOURCE``、``PKG_DIRECTORY``、" "``C_BUILTIN``、``PY_FROZEN``、``PY_CODERESOURCE``、``IMP_HOOK``。" -#: ../../whatsnew/3.12.rst:1511 +#: ../../whatsnew/3.12.rst:1519 msgid "io" msgstr "io" -#: ../../whatsnew/3.12.rst:1513 +#: ../../whatsnew/3.12.rst:1521 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " "in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." @@ -3425,50 +3559,55 @@ msgid "" "`94169`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1520 +#: ../../whatsnew/3.12.rst:1528 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.12.rst:1522 +#: ../../whatsnew/3.12.rst:1530 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1527 +#: ../../whatsnew/3.12.rst:1535 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.12.rst:1529 +#: ../../whatsnew/3.12.rst:1537 msgid "" "The ``smtpd`` module has been removed according to the schedule in :pep:" "`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" "`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " "(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" +"根據 :pep:`594` 的時間表移除 ``smtpd`` 模組,它在 Python 3.4.7 和 3.5.4 中已" +"被棄用。請改用 PyPI 上的 :pypi:`aiosmtpd` 模組或任何其他基於 :mod:`asyncio` " +"的伺服器。" -#: ../../whatsnew/3.12.rst:1538 +#: ../../whatsnew/3.12.rst:1546 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" +"以下未以文件記錄的 :mod:`sqlite3` 功能已在 Python 3.10 中被棄用、現在已被移" +"除:" -#: ../../whatsnew/3.12.rst:1541 +#: ../../whatsnew/3.12.rst:1549 msgid "``sqlite3.enable_shared_cache()``" msgstr "``sqlite3.enable_shared_cache()``" -#: ../../whatsnew/3.12.rst:1542 +#: ../../whatsnew/3.12.rst:1550 msgid "``sqlite3.OptimizedUnicode``" msgstr "``sqlite3.OptimizedUnicode``" -#: ../../whatsnew/3.12.rst:1544 +#: ../../whatsnew/3.12.rst:1552 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: ../../whatsnew/3.12.rst:1547 +#: ../../whatsnew/3.12.rst:1555 msgid "" "The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" "`str` since Python 3.3. Code that previously set the text factory to " @@ -3476,22 +3615,22 @@ msgid "" "default value which is also ``str``." msgstr "" -#: ../../whatsnew/3.12.rst:1552 +#: ../../whatsnew/3.12.rst:1560 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "(由 Erlend E. Aasland 於 :gh:`92548` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1555 +#: ../../whatsnew/3.12.rst:1563 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.12.rst:1557 +#: ../../whatsnew/3.12.rst:1565 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1561 +#: ../../whatsnew/3.12.rst:1569 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -3499,7 +3638,7 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1567 +#: ../../whatsnew/3.12.rst:1575 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " "instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." @@ -3510,189 +3649,194 @@ msgid "" "`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1578 +#: ../../whatsnew/3.12.rst:1586 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "移除許多 :mod:`unittest` 中被棄用已久的功能:" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1590 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "許多 :class:`~unittest.TestCase` 方法別名:" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Deprecated in" msgstr "已棄用於" -#: ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1595 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1602 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1588 -#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1590 -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1597 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1599 ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1601 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1596 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1596 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1597 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1597 ../../whatsnew/3.12.rst:1603 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1598 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.12.rst:1590 ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1604 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1599 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1599 ../../whatsnew/3.12.rst:1605 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1600 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.12.rst:1592 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1600 ../../whatsnew/3.12.rst:1606 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1601 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1601 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1602 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.12.rst:1594 ../../whatsnew/3.12.rst:1595 -#: ../../whatsnew/3.12.rst:1596 ../../whatsnew/3.12.rst:1597 -#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1599 -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1602 ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1604 ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1606 ../../whatsnew/3.12.rst:1607 +#: ../../whatsnew/3.12.rst:1608 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1603 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1604 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1605 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1606 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1607 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1607 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1608 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1608 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1612 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" +"你可以使用 https://github.com/isidentical/teyit 來自動現代化你的單元測試。" -#: ../../whatsnew/3.12.rst:1607 +#: ../../whatsnew/3.12.rst:1615 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" +"未以文件記錄且已失效的 :class:`~unittest.TestCase` 方法 " +"``assertDictContainsSubset``\\ (自 Python 3.2 起已棄用)。" -#: ../../whatsnew/3.12.rst:1610 +#: ../../whatsnew/3.12.rst:1618 msgid "" "Undocumented :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader." "loadTestsFromModule>` parameter *use_load_tests* (deprecated and ignored " "since Python 3.5)." msgstr "" -#: ../../whatsnew/3.12.rst:1614 +#: ../../whatsnew/3.12.rst:1622 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." msgstr "" +"對 :class:`~unittest.TextTestResult` 類別的別名:``_TextTestResult``\\ (自 " +"Python 3.2 起已棄用)。" -#: ../../whatsnew/3.12.rst:1617 +#: ../../whatsnew/3.12.rst:1625 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`89325` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1620 +#: ../../whatsnew/3.12.rst:1628 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.12.rst:1622 +#: ../../whatsnew/3.12.rst:1630 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: ../../whatsnew/3.12.rst:1627 +#: ../../whatsnew/3.12.rst:1635 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.12.rst:1629 +#: ../../whatsnew/3.12.rst:1637 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -3701,22 +3845,22 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1636 +#: ../../whatsnew/3.12.rst:1644 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.12.rst:1638 +#: ../../whatsnew/3.12.rst:1646 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " "deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" "`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1644 +#: ../../whatsnew/3.12.rst:1652 msgid "Others" msgstr "其他" -#: ../../whatsnew/3.12.rst:1646 +#: ../../whatsnew/3.12.rst:1654 msgid "" "Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" "file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://github." @@ -3724,7 +3868,7 @@ msgid "" "`98179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1651 +#: ../../whatsnew/3.12.rst:1659 msgid "" "Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" "`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " @@ -3734,7 +3878,7 @@ msgid "" "in :gh:`94172`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1659 +#: ../../whatsnew/3.12.rst:1667 msgid "" "Remove ``Jython`` compatibility hacks from several stdlib modules and tests. " "(Contributed by Nikita Sobolev in :gh:`99482`.)" @@ -3742,7 +3886,7 @@ msgstr "" "移除數個標準函式庫模組與測試中的 ``Jython`` 相容性修補程式。(由 Nikita " "Sobolev 於 :gh:`99482` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1662 +#: ../../whatsnew/3.12.rst:1670 msgid "" "Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" "`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" @@ -3750,21 +3894,21 @@ msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1670 ../../whatsnew/3.12.rst:1994 +#: ../../whatsnew/3.12.rst:1678 ../../whatsnew/3.12.rst:2002 msgid "Porting to Python 3.12" msgstr "移植至 Python 3.12" -#: ../../whatsnew/3.12.rst:1672 +#: ../../whatsnew/3.12.rst:1680 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.12.rst:1676 +#: ../../whatsnew/3.12.rst:1684 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.12.rst:1678 +#: ../../whatsnew/3.12.rst:1686 msgid "" "More strict rules are now applied for numerical group references and group " "names in regular expressions. Only sequence of ASCII digits is now accepted " @@ -3773,7 +3917,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1685 +#: ../../whatsnew/3.12.rst:1693 msgid "" "Remove ``randrange()`` functionality deprecated since Python 3.10. " "Formerly, ``randrange(10.0)`` losslessly converted to ``randrange(10)``. " @@ -3785,7 +3929,7 @@ msgid "" "`86388`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1693 +#: ../../whatsnew/3.12.rst:1701 msgid "" ":class:`argparse.ArgumentParser` changed encoding and error handler for " "reading arguments from file (e.g. ``fromfile_prefix_chars`` option) from " @@ -3795,21 +3939,21 @@ msgid "" "on Windows." msgstr "" -#: ../../whatsnew/3.12.rst:1699 +#: ../../whatsnew/3.12.rst:1707 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " "and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" "`aiosmtpd` PyPI module." msgstr "" -#: ../../whatsnew/3.12.rst:1703 +#: ../../whatsnew/3.12.rst:1711 msgid "" ":func:`shlex.split`: Passing ``None`` for *s* argument now raises an " "exception, rather than reading :data:`sys.stdin`. The feature was deprecated " "in Python 3.9. (Contributed by Victor Stinner in :gh:`94352`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1708 +#: ../../whatsnew/3.12.rst:1716 msgid "" "The :mod:`os` module no longer accepts bytes-like paths, like :class:" "`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " @@ -3817,7 +3961,7 @@ msgid "" "`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1713 +#: ../../whatsnew/3.12.rst:1721 msgid "" ":func:`syslog.openlog` and :func:`syslog.closelog` now fail if used in " "subinterpreters. :func:`syslog.syslog` may still be used in subinterpreters, " @@ -3829,7 +3973,7 @@ msgid "" "(Contributed by Donghee Na in :gh:`99127`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1722 +#: ../../whatsnew/3.12.rst:1730 msgid "" "The undocumented locking behavior of :func:`~functools.cached_property` is " "removed, because it locked across all instances of the class, leading to " @@ -3841,14 +3985,14 @@ msgid "" "property getter function or around multi-threaded access points." msgstr "" -#: ../../whatsnew/3.12.rst:1735 +#: ../../whatsnew/3.12.rst:1743 msgid "" "When extracting tar files using :mod:`tarfile` or :func:`shutil." "unpack_archive`, pass the *filter* argument to limit features that may be " "surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1740 +#: ../../whatsnew/3.12.rst:1748 msgid "" "The output of the :func:`tokenize.tokenize` and :func:`tokenize." "generate_tokens` functions is now changed due to the changes introduced in :" @@ -3860,15 +4004,15 @@ msgid "" "``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" -#: ../../whatsnew/3.12.rst:1749 +#: ../../whatsnew/3.12.rst:1757 msgid "1,0-1,18: STRING 'f\"start {1+1} end\"'" msgstr "1,0-1,18: STRING 'f\"start {1+1} end\"'" -#: ../../whatsnew/3.12.rst:1751 +#: ../../whatsnew/3.12.rst:1759 msgid "while the new version emits::" msgstr "" -#: ../../whatsnew/3.12.rst:1753 +#: ../../whatsnew/3.12.rst:1761 msgid "" "1,0-1,2: FSTRING_START 'f\"'\n" "1,2-1,8: FSTRING_MIDDLE 'start '\n" @@ -3890,54 +4034,54 @@ msgstr "" "1,13-1,17: FSTRING_MIDDLE ' end'\n" "1,17-1,18: FSTRING_END '\"'" -#: ../../whatsnew/3.12.rst:1763 +#: ../../whatsnew/3.12.rst:1771 msgid "" "Additionally, there may be some minor behavioral changes as a consequence of " "the changes required to support :pep:`701`. Some of these changes include:" msgstr "" -#: ../../whatsnew/3.12.rst:1766 +#: ../../whatsnew/3.12.rst:1774 msgid "" "The ``type`` attribute of the tokens emitted when tokenizing some invalid " "Python characters such as ``!`` has changed from ``ERRORTOKEN`` to ``OP``." msgstr "" -#: ../../whatsnew/3.12.rst:1769 +#: ../../whatsnew/3.12.rst:1777 msgid "" "Incomplete single-line strings now also raise :exc:`tokenize.TokenError` as " "incomplete multiline strings do." msgstr "" -#: ../../whatsnew/3.12.rst:1772 +#: ../../whatsnew/3.12.rst:1780 msgid "" "Some incomplete or invalid Python code now raises :exc:`tokenize.TokenError` " "instead of returning arbitrary ``ERRORTOKEN`` tokens when tokenizing it." msgstr "" -#: ../../whatsnew/3.12.rst:1775 +#: ../../whatsnew/3.12.rst:1783 msgid "" "Mixing tabs and spaces as indentation in the same file is not supported " "anymore and will raise a :exc:`TabError`." msgstr "" -#: ../../whatsnew/3.12.rst:1778 +#: ../../whatsnew/3.12.rst:1786 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an ``_is_main_interpreter`` attribute. It is a function with no arguments " "that returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.12.rst:1783 +#: ../../whatsnew/3.12.rst:1791 msgid "" "Any library or application that provides a custom ``_thread`` module should " "provide ``_is_main_interpreter()``. (See :gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1788 +#: ../../whatsnew/3.12.rst:1796 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.12.rst:1790 +#: ../../whatsnew/3.12.rst:1798 msgid "" "Python no longer uses :file:`setup.py` to build shared C extension modules. " "Build parameters like headers and libraries are detected in ``configure`` " @@ -3946,21 +4090,21 @@ msgid "" "in :gh:`93939`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1796 +#: ../../whatsnew/3.12.rst:1804 msgid "" "``va_start()`` with two parameters, like ``va_start(args, format),`` is now " "required to build Python. ``va_start()`` is no longer called with a single " "parameter. (Contributed by Kumar Aditya in :gh:`93207`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1801 +#: ../../whatsnew/3.12.rst:1809 msgid "" "CPython now uses the ThinLTO option as the default link time optimization " "policy if the Clang compiler accepts the flag. (Contributed by Donghee Na " "in :gh:`89536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1805 +#: ../../whatsnew/3.12.rst:1813 msgid "" "Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" "`compileall` options (default: ``-j0``) in ``make install``. Also merged the " @@ -3969,46 +4113,46 @@ msgid "" "`99289`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1811 +#: ../../whatsnew/3.12.rst:1819 msgid "Add platform triplets for 64-bit LoongArch:" msgstr "" -#: ../../whatsnew/3.12.rst:1813 +#: ../../whatsnew/3.12.rst:1821 msgid "loongarch64-linux-gnusf" msgstr "loongarch64-linux-gnusf" -#: ../../whatsnew/3.12.rst:1814 +#: ../../whatsnew/3.12.rst:1822 msgid "loongarch64-linux-gnuf32" msgstr "loongarch64-linux-gnuf32" -#: ../../whatsnew/3.12.rst:1815 +#: ../../whatsnew/3.12.rst:1823 msgid "loongarch64-linux-gnu" msgstr "loongarch64-linux-gnu" -#: ../../whatsnew/3.12.rst:1817 +#: ../../whatsnew/3.12.rst:1825 msgid "(Contributed by Zhang Na in :gh:`90656`.)" msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1819 +#: ../../whatsnew/3.12.rst:1827 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." -msgstr "" +msgstr "``PYTHON_FOR_REGEN`` 現在需要 Python 3.10 或更新的版本。" -#: ../../whatsnew/3.12.rst:1821 +#: ../../whatsnew/3.12.rst:1829 msgid "" "Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:`!" "configure`. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1825 +#: ../../whatsnew/3.12.rst:1833 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" -#: ../../whatsnew/3.12.rst:1829 +#: ../../whatsnew/3.12.rst:1837 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.12.rst:1836 +#: ../../whatsnew/3.12.rst:1844 msgid "" ":pep:`697`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -4016,15 +4160,15 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: ../../whatsnew/3.12.rst:1842 +#: ../../whatsnew/3.12.rst:1850 msgid "Code object constructors:" msgstr "程式碼物件建構函式:" -#: ../../whatsnew/3.12.rst:1844 +#: ../../whatsnew/3.12.rst:1852 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" -#: ../../whatsnew/3.12.rst:1845 +#: ../../whatsnew/3.12.rst:1853 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" @@ -4032,11 +4176,11 @@ msgstr "" "``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " "``PyCode_NewWithPosOnlyArgs`` 重新命名)" -#: ../../whatsnew/3.12.rst:1847 +#: ../../whatsnew/3.12.rst:1855 msgid "Extra storage for code objects (:pep:`523`):" msgstr "程式碼物件的額外儲存 (:pep:`523`):" -#: ../../whatsnew/3.12.rst:1849 +#: ../../whatsnew/3.12.rst:1857 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" @@ -4044,31 +4188,31 @@ msgstr "" "``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " "``_PyEval_RequestCodeExtraIndex`` 重新命名)" -#: ../../whatsnew/3.12.rst:1850 +#: ../../whatsnew/3.12.rst:1858 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1851 +#: ../../whatsnew/3.12.rst:1859 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1853 +#: ../../whatsnew/3.12.rst:1861 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "原始名稱將可繼續使用,直到相應的 API 發生變更。" -#: ../../whatsnew/3.12.rst:1856 +#: ../../whatsnew/3.12.rst:1864 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "(由 Petr Viktorin 於 :gh:`101101` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1858 +#: ../../whatsnew/3.12.rst:1866 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: ../../whatsnew/3.12.rst:1861 +#: ../../whatsnew/3.12.rst:1869 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." @@ -4076,30 +4220,30 @@ msgstr "" ":c:member:`PyType_Spec.basicsize` 可以為零或負數來指定繼承或擴充基底類別大" "小。" -#: ../../whatsnew/3.12.rst:1863 +#: ../../whatsnew/3.12.rst:1871 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: ../../whatsnew/3.12.rst:1865 +#: ../../whatsnew/3.12.rst:1873 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " "to allow safely extending certain variable-sized types, including :c:var:" "`PyType_Type`." msgstr "" -#: ../../whatsnew/3.12.rst:1868 +#: ../../whatsnew/3.12.rst:1876 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "<PyMemberDef>` in terms of a subclass-specific struct." msgstr "" -#: ../../whatsnew/3.12.rst:1871 +#: ../../whatsnew/3.12.rst:1879 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1873 +#: ../../whatsnew/3.12.rst:1881 msgid "" "Add the new :ref:`limited C API <limited-c-api>` function :c:func:" "`PyType_FromMetaclass`, which generalizes the existing :c:func:" @@ -4107,29 +4251,29 @@ msgid "" "(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1878 +#: ../../whatsnew/3.12.rst:1886 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol <vectorcall>` was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1882 +#: ../../whatsnew/3.12.rst:1890 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" -#: ../../whatsnew/3.12.rst:1883 +#: ../../whatsnew/3.12.rst:1891 msgid ":c:func:`PyVectorcall_NARGS`" msgstr ":c:func:`PyVectorcall_NARGS`" -#: ../../whatsnew/3.12.rst:1884 +#: ../../whatsnew/3.12.rst:1892 msgid ":c:func:`PyVectorcall_Call`" msgstr ":c:func:`PyVectorcall_Call`" -#: ../../whatsnew/3.12.rst:1885 +#: ../../whatsnew/3.12.rst:1893 msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../whatsnew/3.12.rst:1887 +#: ../../whatsnew/3.12.rst:1895 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " @@ -4140,7 +4284,7 @@ msgid "" "`93274`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1895 +#: ../../whatsnew/3.12.rst:1903 msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " @@ -4148,32 +4292,32 @@ msgid "" "bookkeeping, using less memory and with faster access." msgstr "" -#: ../../whatsnew/3.12.rst:1900 +#: ../../whatsnew/3.12.rst:1908 msgid "" "API for performing calls using :ref:`the vectorcall protocol <vectorcall>` " "was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1904 +#: ../../whatsnew/3.12.rst:1912 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../whatsnew/3.12.rst:1905 +#: ../../whatsnew/3.12.rst:1913 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../whatsnew/3.12.rst:1906 +#: ../../whatsnew/3.12.rst:1914 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" -#: ../../whatsnew/3.12.rst:1908 +#: ../../whatsnew/3.12.rst:1916 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API <stable>`. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1912 +#: ../../whatsnew/3.12.rst:1920 msgid "" "Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" "func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " @@ -4181,14 +4325,14 @@ msgid "" "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1918 +#: ../../whatsnew/3.12.rst:1926 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1922 +#: ../../whatsnew/3.12.rst:1930 msgid "" "The C API now permits registering callbacks via :c:func:" "`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " @@ -4197,28 +4341,28 @@ msgid "" "`91052`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1928 +#: ../../whatsnew/3.12.rst:1936 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1932 +#: ../../whatsnew/3.12.rst:1940 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1937 +#: ../../whatsnew/3.12.rst:1945 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " "get a frame variable by its name. (Contributed by Victor Stinner in :gh:" "`91248`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1941 +#: ../../whatsnew/3.12.rst:1949 msgid "" "Add :c:func:`PyErr_GetRaisedException` and :c:func:" "`PyErr_SetRaisedException` for saving and restoring the current exception. " @@ -4228,14 +4372,14 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1949 +#: ../../whatsnew/3.12.rst:1957 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1953 +#: ../../whatsnew/3.12.rst:1961 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " "convenience functions for retrieving and modifying the :attr:`~BaseException." @@ -4243,71 +4387,71 @@ msgid "" "in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1958 +#: ../../whatsnew/3.12.rst:1966 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: ../../whatsnew/3.12.rst:1964 +#: ../../whatsnew/3.12.rst:1972 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: ../../whatsnew/3.12.rst:1967 +#: ../../whatsnew/3.12.rst:1975 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "``_Py_IMMORTAL_REFCNT``:定義物件的參照計數" -#: ../../whatsnew/3.12.rst:1968 +#: ../../whatsnew/3.12.rst:1976 msgid "as immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1969 +#: ../../whatsnew/3.12.rst:1977 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: ../../whatsnew/3.12.rst:1970 +#: ../../whatsnew/3.12.rst:1978 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "``PyObject_HEAD_INIT`` 這現在將初始化參照計數" -#: ../../whatsnew/3.12.rst:1971 +#: ../../whatsnew/3.12.rst:1979 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "``_Py_IMMORTAL_REFCNT``\\ (與 ``Py_BUILD_CORE`` 一起使用時)。" -#: ../../whatsnew/3.12.rst:1972 +#: ../../whatsnew/3.12.rst:1980 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: ../../whatsnew/3.12.rst:1973 +#: ../../whatsnew/3.12.rst:1981 msgid "that are immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1974 +#: ../../whatsnew/3.12.rst:1982 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1975 +#: ../../whatsnew/3.12.rst:1983 msgid "objects that are immortal and static" msgstr "" -#: ../../whatsnew/3.12.rst:1976 +#: ../../whatsnew/3.12.rst:1984 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "``sys.getunicodeinternedsize`` 這會回傳 unicode 的總數" -#: ../../whatsnew/3.12.rst:1977 +#: ../../whatsnew/3.12.rst:1985 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: ../../whatsnew/3.12.rst:1980 +#: ../../whatsnew/3.12.rst:1988 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1982 +#: ../../whatsnew/3.12.rst:1990 msgid "" ":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" "c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " @@ -4315,27 +4459,27 @@ msgid "" "(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1988 +#: ../../whatsnew/3.12.rst:1996 msgid "" "In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" "`Py_DECREF` functions are now implemented as opaque function calls to hide " "implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1996 +#: ../../whatsnew/3.12.rst:2004 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: ../../whatsnew/3.12.rst:1999 +#: ../../whatsnew/3.12.rst:2007 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: ../../whatsnew/3.12.rst:2003 +#: ../../whatsnew/3.12.rst:2011 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -4344,7 +4488,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: ../../whatsnew/3.12.rst:2010 +#: ../../whatsnew/3.12.rst:2018 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -4352,13 +4496,13 @@ msgid "" "only field directly." msgstr "" -#: ../../whatsnew/3.12.rst:2015 +#: ../../whatsnew/3.12.rst:2023 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" -#: ../../whatsnew/3.12.rst:2019 +#: ../../whatsnew/3.12.rst:2027 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " @@ -4367,7 +4511,7 @@ msgid "" "`98836`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2025 +#: ../../whatsnew/3.12.rst:2033 msgid "" "An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" "func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " @@ -4376,13 +4520,13 @@ msgid "" "Storchaka in :gh:`95781`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2031 +#: ../../whatsnew/3.12.rst:2039 msgid "" "Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" "`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2035 +#: ../../whatsnew/3.12.rst:2043 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " "reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" @@ -4396,7 +4540,7 @@ msgid "" "func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: ../../whatsnew/3.12.rst:2047 +#: ../../whatsnew/3.12.rst:2055 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -4404,7 +4548,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2052 +#: ../../whatsnew/3.12.rst:2060 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -4412,7 +4556,7 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2057 +#: ../../whatsnew/3.12.rst:2065 msgid "" "The interpreter's error indicator is now always normalized. This means that :" "c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " @@ -4420,7 +4564,7 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2062 +#: ../../whatsnew/3.12.rst:2070 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -4428,25 +4572,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: ../../whatsnew/3.12.rst:2067 +#: ../../whatsnew/3.12.rst:2075 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: ../../whatsnew/3.12.rst:2070 +#: ../../whatsnew/3.12.rst:2078 msgid ":c:func:`PyType_FromSpec`" msgstr ":c:func:`PyType_FromSpec`" -#: ../../whatsnew/3.12.rst:2071 +#: ../../whatsnew/3.12.rst:2079 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr ":c:func:`PyType_FromSpecWithBases`" -#: ../../whatsnew/3.12.rst:2072 +#: ../../whatsnew/3.12.rst:2080 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr ":c:func:`PyType_FromModuleAndSpec`" -#: ../../whatsnew/3.12.rst:2074 +#: ../../whatsnew/3.12.rst:2082 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -4454,14 +4598,14 @@ msgid "" "initialization." msgstr "" -#: ../../whatsnew/3.12.rst:2079 +#: ../../whatsnew/3.12.rst:2087 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " "disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" "`~object.__new__` in Python)." msgstr "" -#: ../../whatsnew/3.12.rst:2083 +#: ../../whatsnew/3.12.rst:2091 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -4470,17 +4614,17 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: ../../whatsnew/3.12.rst:2090 +#: ../../whatsnew/3.12.rst:2098 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: ../../whatsnew/3.12.rst:2092 +#: ../../whatsnew/3.12.rst:2100 msgid "" "If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." "tp_init` instead." msgstr "" -#: ../../whatsnew/3.12.rst:2094 +#: ../../whatsnew/3.12.rst:2102 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " "``tp_new`` to ``NULL`` using the :c:macro:" @@ -4488,20 +4632,20 @@ msgid "" "``PyType_From*`` functions." msgstr "" -#: ../../whatsnew/3.12.rst:2099 +#: ../../whatsnew/3.12.rst:2107 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling <call>` " "the metaclass." msgstr "" -#: ../../whatsnew/3.12.rst:2103 +#: ../../whatsnew/3.12.rst:2111 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: ../../whatsnew/3.12.rst:2106 +#: ../../whatsnew/3.12.rst:2114 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters <sub-interpreter-support>`. This is " @@ -4509,14 +4653,14 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: ../../whatsnew/3.12.rst:2111 +#: ../../whatsnew/3.12.rst:2119 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: ../../whatsnew/3.12.rst:2115 +#: ../../whatsnew/3.12.rst:2123 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " @@ -4527,15 +4671,15 @@ msgid "" "a single machine word:" msgstr "" -#: ../../whatsnew/3.12.rst:2123 +#: ../../whatsnew/3.12.rst:2131 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr ":c:func:`PyUnstable_Long_IsCompact`" -#: ../../whatsnew/3.12.rst:2124 +#: ../../whatsnew/3.12.rst:2132 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr ":c:func:`PyUnstable_Long_CompactValue`" -#: ../../whatsnew/3.12.rst:2126 +#: ../../whatsnew/3.12.rst:2134 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -4544,7 +4688,7 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: ../../whatsnew/3.12.rst:2136 +#: ../../whatsnew/3.12.rst:2144 msgid "" "In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" "`PyDictObject` is deprecated for extension modules. Accessing this field " @@ -4553,76 +4697,76 @@ msgid "" "PEP by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.12.rst:2141 +#: ../../whatsnew/3.12.rst:2149 msgid "Deprecate global configuration variable:" msgstr "棄用全域配置變數:" -#: ../../whatsnew/3.12.rst:2143 +#: ../../whatsnew/3.12.rst:2151 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr ":c:var:`Py_DebugFlag`: 請改用 :c:member:`PyConfig.parser_debug`" -#: ../../whatsnew/3.12.rst:2144 +#: ../../whatsnew/3.12.rst:2152 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr ":c:var:`Py_VerboseFlag`: 請改用 :c:member:`PyConfig.verbose`" -#: ../../whatsnew/3.12.rst:2145 +#: ../../whatsnew/3.12.rst:2153 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr ":c:var:`Py_QuietFlag`: 請改用 :c:member:`PyConfig.quiet`" -#: ../../whatsnew/3.12.rst:2146 +#: ../../whatsnew/3.12.rst:2154 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr ":c:var:`Py_InteractiveFlag`: 請改用 :c:member:`PyConfig.interactive`" -#: ../../whatsnew/3.12.rst:2147 +#: ../../whatsnew/3.12.rst:2155 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr ":c:var:`Py_InspectFlag`: 請改用 :c:member:`PyConfig.inspect`" -#: ../../whatsnew/3.12.rst:2148 +#: ../../whatsnew/3.12.rst:2156 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" ":c:var:`Py_OptimizeFlag`: 請改用 :c:member:`PyConfig.optimization_level`" -#: ../../whatsnew/3.12.rst:2149 +#: ../../whatsnew/3.12.rst:2157 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr ":c:var:`Py_NoSiteFlag`: 請改用 :c:member:`PyConfig.site_import`" -#: ../../whatsnew/3.12.rst:2150 +#: ../../whatsnew/3.12.rst:2158 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" ":c:var:`Py_BytesWarningFlag`: 請改用 :c:member:`PyConfig.bytes_warning`" -#: ../../whatsnew/3.12.rst:2151 +#: ../../whatsnew/3.12.rst:2159 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" ":c:var:`Py_FrozenFlag`: 請改用 :c:member:`PyConfig.pathconfig_warnings`" -#: ../../whatsnew/3.12.rst:2152 +#: ../../whatsnew/3.12.rst:2160 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." "use_environment`" -#: ../../whatsnew/3.12.rst:2153 +#: ../../whatsnew/3.12.rst:2161 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`: 請改用 :c:member:`PyConfig.write_bytecode`" -#: ../../whatsnew/3.12.rst:2154 +#: ../../whatsnew/3.12.rst:2162 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" ":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." "user_site_directory`" -#: ../../whatsnew/3.12.rst:2155 +#: ../../whatsnew/3.12.rst:2163 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" ":c:var:`Py_UnbufferedStdioFlag`: 請改用 :c:member:`PyConfig.buffered_stdio`" -#: ../../whatsnew/3.12.rst:2156 +#: ../../whatsnew/3.12.rst:2164 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" @@ -4630,11 +4774,11 @@ msgstr "" ":c:var:`Py_HashRandomizationFlag`: 請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`" -#: ../../whatsnew/3.12.rst:2158 +#: ../../whatsnew/3.12.rst:2166 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" -#: ../../whatsnew/3.12.rst:2159 +#: ../../whatsnew/3.12.rst:2167 msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" @@ -4642,7 +4786,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" -#: ../../whatsnew/3.12.rst:2160 +#: ../../whatsnew/3.12.rst:2168 msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." "legacy_windows_stdio`" @@ -4650,7 +4794,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." "legacy_windows_stdio`" -#: ../../whatsnew/3.12.rst:2161 +#: ../../whatsnew/3.12.rst:2169 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4658,7 +4802,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2162 +#: ../../whatsnew/3.12.rst:2170 msgid "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4666,7 +4810,7 @@ msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2163 +#: ../../whatsnew/3.12.rst:2171 msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." "filesystem_errors`" @@ -4674,7 +4818,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." "filesystem_errors`" -#: ../../whatsnew/3.12.rst:2164 +#: ../../whatsnew/3.12.rst:2172 msgid "" ":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" "`Py_PreInitialize`)" @@ -4682,7 +4826,7 @@ msgstr "" ":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" "func:`Py_PreInitialize`)" -#: ../../whatsnew/3.12.rst:2166 +#: ../../whatsnew/3.12.rst:2174 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" @@ -4690,25 +4834,25 @@ msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2170 +#: ../../whatsnew/3.12.rst:2178 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: ../../whatsnew/3.12.rst:2173 +#: ../../whatsnew/3.12.rst:2181 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr ":file:`structmember.h` 標頭已棄用,但仍可使用,且還沒有移除它的計畫。" -#: ../../whatsnew/3.12.rst:2176 +#: ../../whatsnew/3.12.rst:2184 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: ../../whatsnew/3.12.rst:2179 +#: ../../whatsnew/3.12.rst:2187 msgid "" ":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" "`PyMember_SetOne`" @@ -4716,13 +4860,13 @@ msgstr "" ":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" "`PyMember_SetOne`" -#: ../../whatsnew/3.12.rst:2181 +#: ../../whatsnew/3.12.rst:2189 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: ../../whatsnew/3.12.rst:2183 +#: ../../whatsnew/3.12.rst:2191 msgid "" "The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" "`Py_AUDIT_READ` (previously all uppercase)" @@ -4730,23 +4874,23 @@ msgstr "" ":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" "`Py_AUDIT_READ`\\ (先前全大寫)旗標" -#: ../../whatsnew/3.12.rst:2186 +#: ../../whatsnew/3.12.rst:2194 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "數個項目不再從 :file:`Python.h` 中公開:" -#: ../../whatsnew/3.12.rst:2188 +#: ../../whatsnew/3.12.rst:2196 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr ":c:macro:`T_OBJECT`\\ (請改用 :c:macro:`Py_T_OBJECT_EX`)" -#: ../../whatsnew/3.12.rst:2189 +#: ../../whatsnew/3.12.rst:2197 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr ":c:macro:`T_NONE`\\ (先前未記錄於文件上,且相當古怪)" -#: ../../whatsnew/3.12.rst:2190 +#: ../../whatsnew/3.12.rst:2198 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" -#: ../../whatsnew/3.12.rst:2191 +#: ../../whatsnew/3.12.rst:2199 msgid "" "The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" "`Py_AUDIT_READ`." @@ -4754,33 +4898,33 @@ msgstr "" "``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" "`Py_AUDIT_READ`。" -#: ../../whatsnew/3.12.rst:2193 +#: ../../whatsnew/3.12.rst:2201 msgid "" "In some configurations, ``<stddef.h>`` is not included from :file:`Python." "h`. It should be included manually when using ``offsetof()``." msgstr "" -#: ../../whatsnew/3.12.rst:2196 +#: ../../whatsnew/3.12.rst:2204 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: ../../whatsnew/3.12.rst:2201 +#: ../../whatsnew/3.12.rst:2209 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: ../../whatsnew/3.12.rst:2204 +#: ../../whatsnew/3.12.rst:2212 msgid "" ":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" "func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " "instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2209 +#: ../../whatsnew/3.12.rst:2217 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." @@ -4788,7 +4932,7 @@ msgstr "" ":c:func:`!PyErr_Display` 已棄用,請改用 :c:func:`PyErr_DisplayException`。" "(由 Irit Katriel 於 :gh:`102755` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2212 +#: ../../whatsnew/3.12.rst:2220 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" @@ -4796,12 +4940,15 @@ msgstr "" "``_PyErr_ChainExceptions`` 已棄用,請改用 ``_PyErr_ChainExceptions1``。(由 " "Irit Katriel 於 :gh:`102192` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2215 +#: ../../whatsnew/3.12.rst:2223 msgid "" "Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" "func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" "c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" +"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" +"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" @@ -5198,57 +5345,69 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.12.rst:2231 +#: ../../whatsnew/3.12.rst:2239 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" +"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C API。:file:" +"`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor Stinner 於 :gh:" +"`92651` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2236 +#: ../../whatsnew/3.12.rst:2244 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: ../../whatsnew/3.12.rst:2238 +#: ../../whatsnew/3.12.rst:2246 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.12.rst:2239 +#: ../../whatsnew/3.12.rst:2247 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.12.rst:2240 +#: ../../whatsnew/3.12.rst:2248 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.12.rst:2241 +#: ../../whatsnew/3.12.rst:2249 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.12.rst:2242 +#: ../../whatsnew/3.12.rst:2250 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.12.rst:2243 +#: ../../whatsnew/3.12.rst:2251 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.12.rst:2244 +#: ../../whatsnew/3.12.rst:2252 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.12.rst:2245 +#: ../../whatsnew/3.12.rst:2253 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.12.rst:2246 +#: ../../whatsnew/3.12.rst:2254 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.12.rst:2248 +#: ../../whatsnew/3.12.rst:2256 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" msgstr "" "移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" "`85858` 中貢獻。)" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" + +#~ msgid "" +#~ ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated " +#~ "and ignored." +#~ msgstr "" +#~ ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 5e82698d42..008d810fdb 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 00:14+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -286,12 +286,13 @@ msgstr "重要的移除:" #: ../../whatsnew/3.13.rst:182 msgid "" -":ref:`PEP 594 <whatsnew313-pep594>`: The remaining 19 \"dead batteries\" " -"(legacy stdlib modules) have been removed from the standard library: :mod:`!" -"aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!" -"crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, :mod:`!" -"nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, :" -"mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." +":ref:`PEP 594 <whatsnew313-pep594>`: The remaining 19 \"dead " +"batteries\" (legacy stdlib modules) have been removed from the standard " +"library: :mod:`!aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!" +"chunk`, :mod:`!crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:" +"`!nis`, :mod:`!nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!" +"sndhdr`, :mod:`!spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:" +"`!xdrlib`." msgstr "" ":ref:`PEP 594 <whatsnew313-pep594>`: 剩下的 19 個 \"dead batteries\" (遺留標" "準函式庫模組)已自標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" @@ -345,7 +346,7 @@ msgid "" "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1970 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:2037 msgid "New Features" msgstr "新增功能" @@ -481,6 +482,7 @@ msgstr "" " ^^^^^^^^\n" "AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" "home/me/numpy.py' if it has the same name as a library you intended to " +"import)" #: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" @@ -513,7 +515,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:308 msgid "" "(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" -msgstr "" +msgstr "(由 Pablo Galindo Salgado 和 Shantanu Jain 於 :gh:`107944` 中貢獻。)" #: ../../whatsnew/3.13.rst:314 msgid "Free-threaded CPython" @@ -548,7 +550,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:336 msgid "" "To check if the current interpreter supports free-threading, :option:`python " -"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"-VV <-V>` and :data:`sys.version` contain \"experimental free-threading " "build\". The new :func:`!sys._is_gil_enabled` function can be used to check " "whether the GIL is actually disabled in the running process." msgstr "" @@ -1163,7 +1165,7 @@ msgid "compileall" msgstr "compileall" #: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 -#: ../../whatsnew/3.13.rst:1017 +#: ../../whatsnew/3.13.rst:1024 msgid "" "The default number of worker threads and processes is now selected using :" "func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " @@ -1174,7 +1176,7 @@ msgstr "" msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1614 +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1673 msgid "configparser" msgstr "configparser" @@ -1356,10 +1358,21 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:893 +msgid "enum" +msgstr "enum" + +#: ../../whatsnew/3.13.rst:895 +msgid "" +":class:`~enum.EnumDict` has been made public to better support subclassing :" +"class:`~enum.EnumType`." +msgstr "" +"公開 :class:`~enum.EnumDict` 以更好地支援 :class:`~enum.EnumType` 的子類別。" + +#: ../../whatsnew/3.13.rst:900 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.13.rst:895 +#: ../../whatsnew/3.13.rst:902 msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language <formatspec>` rules for fill, alignment, sign " @@ -1367,22 +1380,22 @@ msgid "" "`111320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:902 +#: ../../whatsnew/3.13.rst:909 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.13.rst:904 +#: ../../whatsnew/3.13.rst:911 msgid "" "Add :func:`~glob.translate`, a function to convert a path specification with " "shell-style wildcards to a regular expression. (Contributed by Barney Gale " "in :gh:`72904`.)" msgstr "" -#: ../../whatsnew/3.13.rst:910 +#: ../../whatsnew/3.13.rst:917 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.13.rst:912 +#: ../../whatsnew/3.13.rst:919 msgid "" "The following functions in :mod:`importlib.resources` now allow accessing a " "directory (or tree) of resources, using multiple positional arguments (the " @@ -1390,37 +1403,37 @@ msgid "" "keyword-only):" msgstr "" -#: ../../whatsnew/3.13.rst:917 +#: ../../whatsnew/3.13.rst:924 msgid ":func:`~importlib.resources.is_resource`" msgstr ":func:`~importlib.resources.is_resource`" -#: ../../whatsnew/3.13.rst:918 +#: ../../whatsnew/3.13.rst:925 msgid ":func:`~importlib.resources.open_binary`" msgstr ":func:`~importlib.resources.open_binary`" -#: ../../whatsnew/3.13.rst:919 +#: ../../whatsnew/3.13.rst:926 msgid ":func:`~importlib.resources.open_text`" msgstr ":func:`~importlib.resources.open_text`" -#: ../../whatsnew/3.13.rst:920 +#: ../../whatsnew/3.13.rst:927 msgid ":func:`~importlib.resources.path`" msgstr ":func:`~importlib.resources.path`" -#: ../../whatsnew/3.13.rst:921 +#: ../../whatsnew/3.13.rst:928 msgid ":func:`~importlib.resources.read_binary`" msgstr ":func:`~importlib.resources.read_binary`" -#: ../../whatsnew/3.13.rst:922 +#: ../../whatsnew/3.13.rst:929 msgid ":func:`~importlib.resources.read_text`" msgstr ":func:`~importlib.resources.read_text`" -#: ../../whatsnew/3.13.rst:924 +#: ../../whatsnew/3.13.rst:931 msgid "" "These functions are no longer deprecated and are not scheduled for removal. " "(Contributed by Petr Viktorin in :gh:`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:927 +#: ../../whatsnew/3.13.rst:934 msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " @@ -1428,11 +1441,11 @@ msgid "" "`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:934 +#: ../../whatsnew/3.13.rst:941 msgid "io" msgstr "io" -#: ../../whatsnew/3.13.rst:936 +#: ../../whatsnew/3.13.rst:943 msgid "" "The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" "`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " @@ -1441,17 +1454,17 @@ msgid "" "build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:945 +#: ../../whatsnew/3.13.rst:952 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.13.rst:947 +#: ../../whatsnew/3.13.rst:954 msgid "" "Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" "mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" msgstr "" -#: ../../whatsnew/3.13.rst:951 +#: ../../whatsnew/3.13.rst:958 msgid "" "Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." "IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." @@ -1459,22 +1472,22 @@ msgid "" "Stasiak in :gh:`113171`.)" msgstr "" -#: ../../whatsnew/3.13.rst:958 +#: ../../whatsnew/3.13.rst:965 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.13.rst:960 +#: ../../whatsnew/3.13.rst:967 msgid "" ":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" "`ValueError` if the final batch is shorter than the specified batch size. " "(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" -#: ../../whatsnew/3.13.rst:967 +#: ../../whatsnew/3.13.rst:974 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.13.rst:969 +#: ../../whatsnew/3.13.rst:976 msgid "" "Add the *allow_code* parameter in module functions. Passing " "``allow_code=False`` prevents serialization and de-serialization of code " @@ -1482,11 +1495,11 @@ msgid "" "Serhiy Storchaka in :gh:`113626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:976 +#: ../../whatsnew/3.13.rst:983 msgid "math" msgstr "math" -#: ../../whatsnew/3.13.rst:978 +#: ../../whatsnew/3.13.rst:985 msgid "" "The new function :func:`~math.fma` performs fused multiply-add operations. " "This computes ``x * y + z`` with only a single round, and so avoids any " @@ -1496,11 +1509,11 @@ msgid "" "Stinner in :gh:`73468`.)" msgstr "" -#: ../../whatsnew/3.13.rst:988 +#: ../../whatsnew/3.13.rst:995 msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.13.rst:990 +#: ../../whatsnew/3.13.rst:997 msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " @@ -1508,18 +1521,18 @@ msgid "" "`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:997 +#: ../../whatsnew/3.13.rst:1004 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.13.rst:999 +#: ../../whatsnew/3.13.rst:1006 msgid "" ":class:`~mmap.mmap` is now protected from crashing on Windows when the " "mapped memory is inaccessible due to file system errors or access " "violations. (Contributed by Jannis Weigend in :gh:`118209`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1003 +#: ../../whatsnew/3.13.rst:1010 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " "used when a seekable file-like object is required. The :meth:`~mmap.mmap." @@ -1527,7 +1540,7 @@ msgid "" "Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1008 +#: ../../whatsnew/3.13.rst:1015 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " @@ -1535,22 +1548,22 @@ msgid "" "gh:`78502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1015 +#: ../../whatsnew/3.13.rst:1022 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.13.rst:1023 +#: ../../whatsnew/3.13.rst:1030 msgid "os" msgstr "os" -#: ../../whatsnew/3.13.rst:1025 +#: ../../whatsnew/3.13.rst:1032 msgid "" "Add :func:`~os.process_cpu_count` function to get the number of logical CPU " "cores usable by the calling thread of the current process. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1029 +#: ../../whatsnew/3.13.rst:1036 msgid "" ":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " "through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " @@ -1560,7 +1573,7 @@ msgid "" "Na in :gh:`109595`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1037 +#: ../../whatsnew/3.13.rst:1044 msgid "" "Add a :ref:`low level interface <os-timerfd>` to Linux's :manpage:`timer " "file descriptors <timerfd_create(2)>` via :func:`~os.timerfd_create`, :func:" @@ -1571,7 +1584,7 @@ msgid "" "in :gh:`108277`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1046 +#: ../../whatsnew/3.13.rst:1053 msgid "" ":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " "are both now available on Windows. Note that the default value of " @@ -1579,14 +1592,14 @@ msgid "" "by Serhiy Storchaka in :gh:`59616`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1052 +#: ../../whatsnew/3.13.rst:1059 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " "both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" "`113191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1056 +#: ../../whatsnew/3.13.rst:1063 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " @@ -1595,91 +1608,91 @@ msgid "" "Steve Dower in :gh:`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1063 +#: ../../whatsnew/3.13.rst:1070 msgid "" ":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " "makes the newly spawned process use the current process environment. " "(Contributed by Jakub Kulik in :gh:`113119`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1067 +#: ../../whatsnew/3.13.rst:1074 msgid "" -":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " +":func:`~os.posix_spawn` can now use the :const:`~os.POSIX_SPAWN_CLOSEFROM` " "attribute in the *file_actions* parameter on platforms that support :c:func:" "`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by Jakub Kulik in :" "gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1074 +#: ../../whatsnew/3.13.rst:1081 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.13.rst:1076 +#: ../../whatsnew/3.13.rst:1083 msgid "" "Add :func:`~os.path.isreserved` to check if a path is reserved on the " "current system. This function is only available on Windows. (Contributed by " "Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1081 +#: ../../whatsnew/3.13.rst:1088 msgid "" "On Windows, :func:`~os.path.isabs` no longer considers paths starting with " "exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " "Gale and Jon Foster in :gh:`44626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1085 +#: ../../whatsnew/3.13.rst:1092 msgid "" ":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1091 ../../whatsnew/3.13.rst:1654 +#: ../../whatsnew/3.13.rst:1098 ../../whatsnew/3.13.rst:1729 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.13.rst:1093 +#: ../../whatsnew/3.13.rst:1100 msgid "" "Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" "`NotImplementedError` when a path operation isn't supported. (Contributed by " "Barney Gale in :gh:`89812`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1097 +#: ../../whatsnew/3.13.rst:1104 msgid "" "Add a new constructor for creating :class:`~pathlib.Path` objects from " "'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " "Gale in :gh:`107465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1101 +#: ../../whatsnew/3.13.rst:1108 msgid "" "Add :meth:`.PurePath.full_match` for matching paths with shell-style " "wildcards, including the recursive wildcard \"``**``\". (Contributed by " "Barney Gale in :gh:`73435`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1105 +#: ../../whatsnew/3.13.rst:1112 msgid "" "Add the :attr:`.PurePath.parser` class attribute to store the implementation " "of :mod:`os.path` used for low-level path parsing and joining. This will be " "either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -#: ../../whatsnew/3.13.rst:1110 +#: ../../whatsnew/3.13.rst:1117 msgid "" "Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" "`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1114 +#: ../../whatsnew/3.13.rst:1121 msgid "" ":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " "directories when given a pattern that ends with \"``**``\". Previously, only " "directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1119 +#: ../../whatsnew/3.13.rst:1126 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " "<pathlib.Path.is_file>`, :meth:`Path.is_dir <pathlib.Path.is_dir>`, :meth:`." @@ -1687,11 +1700,11 @@ msgid "" "`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1127 +#: ../../whatsnew/3.13.rst:1134 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.13.rst:1129 +#: ../../whatsnew/3.13.rst:1136 msgid "" ":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " "immediately rather than on the next line of code to be executed. This change " @@ -1700,20 +1713,20 @@ msgid "" "Gao in :gh:`118579`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1135 +#: ../../whatsnew/3.13.rst:1142 msgid "" "``sys.path[0]`` is no longer replaced by the directory of the script being " "debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " "and Christian Walther in :gh:`111762`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1139 +#: ../../whatsnew/3.13.rst:1146 msgid "" ":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " "Gao in :gh:`118501`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1142 +#: ../../whatsnew/3.13.rst:1149 msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " @@ -1721,101 +1734,101 @@ msgid "" "`106676`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1147 +#: ../../whatsnew/3.13.rst:1154 msgid "" "Expressions and statements whose prefix is a pdb command are now correctly " "identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1153 +#: ../../whatsnew/3.13.rst:1160 msgid "queue" msgstr "queue" -#: ../../whatsnew/3.13.rst:1155 +#: ../../whatsnew/3.13.rst:1162 msgid "" "Add :meth:`Queue.shutdown <queue.Queue.shutdown>` and :exc:`~queue.ShutDown` " "to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " "in :gh:`104750`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1161 +#: ../../whatsnew/3.13.rst:1168 msgid "random" msgstr "random" -#: ../../whatsnew/3.13.rst:1163 +#: ../../whatsnew/3.13.rst:1170 msgid "" "Add a :ref:`command-line interface <random-cli>`. (Contributed by Hugo van " "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1168 ../../whatsnew/3.13.rst:1662 +#: ../../whatsnew/3.13.rst:1175 ../../whatsnew/3.13.rst:1737 msgid "re" msgstr "re" -#: ../../whatsnew/3.13.rst:1170 +#: ../../whatsnew/3.13.rst:1177 msgid "" "Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" "exc:`!re.error` is kept for backward compatibility." msgstr "" -#: ../../whatsnew/3.13.rst:1175 +#: ../../whatsnew/3.13.rst:1182 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.13.rst:1177 +#: ../../whatsnew/3.13.rst:1184 msgid "" "Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" "`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" -#: ../../whatsnew/3.13.rst:1183 +#: ../../whatsnew/3.13.rst:1190 msgid "site" msgstr "site" -#: ../../whatsnew/3.13.rst:1185 +#: ../../whatsnew/3.13.rst:1192 msgid "" ":file:`.pth` files are now decoded using UTF-8 first, and then with the :" "term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " "in :gh:`117802`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1191 +#: ../../whatsnew/3.13.rst:1198 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.13.rst:1193 +#: ../../whatsnew/3.13.rst:1200 msgid "" "A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " "object is not :meth:`closed <sqlite3.Connection.close>` explicitly. " "(Contributed by Erlend E. Aasland in :gh:`105539`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1197 +#: ../../whatsnew/3.13.rst:1204 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " "filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" "`91602`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1203 +#: ../../whatsnew/3.13.rst:1210 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.13.rst:1205 +#: ../../whatsnew/3.13.rst:1212 msgid "" "The :func:`~ssl.create_default_context` API now includes :data:`~ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " "default flags." msgstr "" -#: ../../whatsnew/3.13.rst:1211 +#: ../../whatsnew/3.13.rst:1218 msgid "" ":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " "certificates that the underlying OpenSSL implementation might otherwise " "accept. Whilst disabling this is not recommended, you can do so using:" msgstr "" -#: ../../whatsnew/3.13.rst:1216 +#: ../../whatsnew/3.13.rst:1223 msgid "" "import ssl\n" "\n" @@ -1827,15 +1840,15 @@ msgstr "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../whatsnew/3.13.rst:1223 +#: ../../whatsnew/3.13.rst:1230 msgid "(Contributed by William Woodruff in :gh:`112389`.)" msgstr "(由 William Woodruff 在 :gh:`112389` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1227 +#: ../../whatsnew/3.13.rst:1234 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.13.rst:1229 +#: ../../whatsnew/3.13.rst:1236 msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " @@ -1843,24 +1856,24 @@ msgid "" "`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1234 +#: ../../whatsnew/3.13.rst:1241 msgid "" "Add :func:`~statistics.kde_random` for sampling from an estimated " "probability density function created by :func:`~statistics.kde`. " "(Contributed by Raymond Hettinger in :gh:`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1242 +#: ../../whatsnew/3.13.rst:1249 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.13.rst:1244 +#: ../../whatsnew/3.13.rst:1251 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations." msgstr "" -#: ../../whatsnew/3.13.rst:1247 +#: ../../whatsnew/3.13.rst:1254 msgid "" "Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " "will be used when the C library provides :c:func:`!" @@ -1869,7 +1882,7 @@ msgid "" "existing Linux :c:func:`!vfork` based code." msgstr "" -#: ../../whatsnew/3.13.rst:1254 +#: ../../whatsnew/3.13.rst:1261 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " "``False`` if you need to force :mod:`subprocess` to never use :func:`~os." @@ -1879,22 +1892,22 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1264 ../../whatsnew/3.13.rst:2717 +#: ../../whatsnew/3.13.rst:1271 ../../whatsnew/3.13.rst:2811 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.13.rst:1266 +#: ../../whatsnew/3.13.rst:1273 msgid "" "Add the :func:`~sys._is_interned` function to test if a string was interned. " "This function is not guaranteed to exist in all implementations of Python. " "(Contributed by Serhiy Storchaka in :gh:`78573`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1272 +#: ../../whatsnew/3.13.rst:1279 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.13.rst:1274 +#: ../../whatsnew/3.13.rst:1281 msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " @@ -1902,11 +1915,11 @@ msgid "" "`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1281 +#: ../../whatsnew/3.13.rst:1288 msgid "time" msgstr "time" -#: ../../whatsnew/3.13.rst:1283 +#: ../../whatsnew/3.13.rst:1290 msgid "" "On Windows, :func:`~time.monotonic` now uses the " "``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " @@ -1914,7 +1927,7 @@ msgid "" "milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1289 +#: ../../whatsnew/3.13.rst:1296 msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " @@ -1923,11 +1936,11 @@ msgid "" "`63207`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1297 +#: ../../whatsnew/3.13.rst:1304 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.13.rst:1299 +#: ../../whatsnew/3.13.rst:1306 msgid "" "Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" "tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" @@ -1935,7 +1948,7 @@ msgid "" "klappnase and Serhiy Storchaka in :gh:`72684`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1305 +#: ../../whatsnew/3.13.rst:1312 msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " @@ -1944,14 +1957,14 @@ msgid "" "wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1312 +#: ../../whatsnew/3.13.rst:1319 msgid "" ":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " "using the new optional keyword-only parameter *return_python_dict*. " "(Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1316 +#: ../../whatsnew/3.13.rst:1323 msgid "" ":meth:`!Text.count` can now return a simple :class:`int` when the new " "optional keyword-only parameter *return_ints* is used. Otherwise, the single " @@ -1959,27 +1972,27 @@ msgid "" "in :gh:`97928`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1321 +#: ../../whatsnew/3.13.rst:1328 msgid "" "Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." "element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " "Storchaka in :gh:`68166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1326 +#: ../../whatsnew/3.13.rst:1333 msgid "" "Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " "Cheryl Sabella in :gh:`77020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1329 +#: ../../whatsnew/3.13.rst:1336 msgid "" "Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " "region from one image to another, possibly with pixel zooming, subsampling, " "or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1334 +#: ../../whatsnew/3.13.rst:1341 msgid "" "Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" "copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " @@ -1987,7 +2000,7 @@ msgid "" "Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1340 +#: ../../whatsnew/3.13.rst:1347 msgid "" "Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " "file and :meth:`!data` to get the image data. Add *background* and " @@ -1995,11 +2008,11 @@ msgid "" "Storchaka in :gh:`118271`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1348 +#: ../../whatsnew/3.13.rst:1355 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.13.rst:1350 +#: ../../whatsnew/3.13.rst:1357 msgid "" "Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" "class:`~traceback.TracebackException`, which holds a string display of the " @@ -2009,7 +2022,7 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1359 +#: ../../whatsnew/3.13.rst:1366 msgid "" "Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." "format_exception_only` to (recursively) format the nested exceptions of a :" @@ -2017,11 +2030,11 @@ msgid "" "`105292`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1366 +#: ../../whatsnew/3.13.rst:1373 msgid "types" msgstr "types" -#: ../../whatsnew/3.13.rst:1368 +#: ../../whatsnew/3.13.rst:1375 msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " @@ -2029,63 +2042,63 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1375 ../../whatsnew/3.13.rst:1687 +#: ../../whatsnew/3.13.rst:1382 ../../whatsnew/3.13.rst:1762 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.13.rst:1377 +#: ../../whatsnew/3.13.rst:1384 msgid "" ":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " "a :class:`~typing.TypedDict` item as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:1380 +#: ../../whatsnew/3.13.rst:1387 msgid "" ":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " "to instruct a type checker how to narrow a type." msgstr "" -#: ../../whatsnew/3.13.rst:1383 +#: ../../whatsnew/3.13.rst:1390 msgid "" "Add :data:`~typing.NoDefault`, a sentinel object used to represent the " "defaults of some parameters in the :mod:`typing` module. (Contributed by " "Jelle Zijlstra in :gh:`116126`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1387 +#: ../../whatsnew/3.13.rst:1394 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " "defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" "`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1391 +#: ../../whatsnew/3.13.rst:1398 msgid "" "Add :func:`~typing.is_protocol` to check whether a class is a :class:" "`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1395 +#: ../../whatsnew/3.13.rst:1402 msgid "" ":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " "vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1401 +#: ../../whatsnew/3.13.rst:1408 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.13.rst:1403 +#: ../../whatsnew/3.13.rst:1410 msgid "" "Update the Unicode database to `version 15.1.0`__. (Contributed by James " "Gerity in :gh:`109559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1410 +#: ../../whatsnew/3.13.rst:1417 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.13.rst:1412 +#: ../../whatsnew/3.13.rst:1419 msgid "" "Add support for creating source control management (SCM) ignore files in a " "virtual environment's directory. By default, Git is supported. This is " @@ -2095,11 +2108,11 @@ msgid "" "Cannon in :gh:`108125`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1423 +#: ../../whatsnew/3.13.rst:1430 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.13.rst:1425 +#: ../../whatsnew/3.13.rst:1432 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " "communicate deprecations to a :term:`static type checker` and to warn on " @@ -2108,62 +2121,62 @@ msgid "" "(Contributed by Jelle Zijlstra in :gh:`104003`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1434 +#: ../../whatsnew/3.13.rst:1441 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.13.rst:1436 +#: ../../whatsnew/3.13.rst:1443 msgid "" "Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " "adding five new methods:" msgstr "" -#: ../../whatsnew/3.13.rst:1439 +#: ../../whatsnew/3.13.rst:1446 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" -#: ../../whatsnew/3.13.rst:1440 +#: ../../whatsnew/3.13.rst:1447 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -#: ../../whatsnew/3.13.rst:1441 +#: ../../whatsnew/3.13.rst:1448 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1442 +#: ../../whatsnew/3.13.rst:1449 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1443 +#: ../../whatsnew/3.13.rst:1450 msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -#: ../../whatsnew/3.13.rst:1445 +#: ../../whatsnew/3.13.rst:1452 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" msgstr "(由 Sebastian Pipping 在 :gh:`115623` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1447 +#: ../../whatsnew/3.13.rst:1454 msgid "" "Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." "ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " "Storchaka in :gh:`69893`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1453 +#: ../../whatsnew/3.13.rst:1460 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.13.rst:1455 +#: ../../whatsnew/3.13.rst:1462 msgid "" "Add support for ZIP64_ format files. Everybody loves huge data, right? " "(Contributed by Tim Hatch in :gh:`94146`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1463 +#: ../../whatsnew/3.13.rst:1470 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.13.rst:1465 +#: ../../whatsnew/3.13.rst:1472 msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " @@ -2174,13 +2187,13 @@ msgid "" "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1476 +#: ../../whatsnew/3.13.rst:1483 msgid "" ":func:`textwrap.indent` is now around 30% faster than before for large " "input. (Contributed by Inada Naoki in :gh:`107369`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1479 +#: ../../whatsnew/3.13.rst:1486 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations, including when *close_fds* is ``True`` (the default) on " @@ -2190,62 +2203,86 @@ msgid "" "Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1489 +#: ../../whatsnew/3.13.rst:1496 msgid "Removed Modules And APIs" -msgstr "" +msgstr "被移除的模組和 API" -#: ../../whatsnew/3.13.rst:1495 +#: ../../whatsnew/3.13.rst:1502 msgid "PEP 594: Remove \"dead batteries\" from the standard library" -msgstr "" +msgstr "PEP 594:從標準函式庫中移除「用完的電池」" -#: ../../whatsnew/3.13.rst:1497 +#: ../../whatsnew/3.13.rst:1504 msgid "" ":pep:`594` proposed removing 19 modules from the standard library, " "colloquially referred to as 'dead batteries' due to their historic, " "obsolete, or insecure status. All of the following modules were deprecated " "in Python 3.11, and are now removed:" msgstr "" +":pep:`594` 提議從標準函式庫中移除因為歷史、過時或不安全狀態而被稱為「用完的電" +"池 (dead batteries)」的 19 個模組。以下所有模組在 Python 3.11 中已被棄用,現" +"在已被移除:" -#: ../../whatsnew/3.13.rst:1503 +#: ../../whatsnew/3.13.rst:1510 msgid ":mod:`!aifc`" msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1504 +#: ../../whatsnew/3.13.rst:1512 +msgid "" +":pypi:`standard-aifc`: Use the redistribution of ``aifc`` library from PyPI." +msgstr ":pypi:`standard-aifc`:PyPI 上的 ``aifc`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1515 msgid ":mod:`!audioop`" msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1505 +#: ../../whatsnew/3.13.rst:1517 +msgid ":pypi:`audioop-lts`: Use ``audioop-lts`` library from PyPI." +msgstr ":pypi:`audioop-lts`:PyPI 上的 ``audioop-lts`` 函式庫。" + +#: ../../whatsnew/3.13.rst:1520 msgid ":mod:`!chunk`" msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1506 +#: ../../whatsnew/3.13.rst:1522 +msgid "" +":pypi:`standard-chunk`: Use the redistribution of ``chunk`` library from " +"PyPI." +msgstr ":pypi:`standard-chunk`:PyPI 上的 ``chunk`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1525 msgid ":mod:`!cgi` and :mod:`!cgitb`" msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1508 +#: ../../whatsnew/3.13.rst:1527 msgid "" ":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." "parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." "message` module or the :pypi:`multipart` library for ``POST`` and ``PUT`` " "requests." msgstr "" +":class:`!cgi.FieldStorage`,在於 ``GET`` 和 ``HEAD`` 請求中通常可以被 :func:" +"`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以被 :mod:" +"`email.message` 模組或 :pypi:`multipart` 函式庫取代。" -#: ../../whatsnew/3.13.rst:1513 +#: ../../whatsnew/3.13.rst:1532 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" "data``, which should be replaced as described below for :func:`!cgi." "parse_multipart`." msgstr "" +":func:`!cgi.parse` 能夠以在所需的查詢字串上直接呼叫 :func:`urllib.parse." +"parse_qs` 來取代,除非輸入為 ``multipart/form-data``,而這種情況則應該如下所" +"述地將 :func:`!cgi.parse_multipart` 給替換掉。" -#: ../../whatsnew/3.13.rst:1518 +#: ../../whatsnew/3.13.rst:1537 msgid "" ":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" "`email` package, which implements the same MIME RFCs. For example, with :" "class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1522 +#: ../../whatsnew/3.13.rst:1541 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2253,136 +2290,230 @@ msgid "" "msg['content-type'] = 'application/json; charset=\"utf8\"'\n" "main, params = msg.get_content_type(), msg['content-type'].params" msgstr "" +"from email.message import EmailMessage\n" +"\n" +"msg = EmailMessage()\n" +"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" +"main, params = msg.get_content_type(), msg['content-type'].params" -#: ../../whatsnew/3.13.rst:1530 +#: ../../whatsnew/3.13.rst:1549 msgid "" ":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" "mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" "`multipart` library. For example, the :class:`email.message.EmailMessage` " "and :class:`email.message.Message` classes." msgstr "" +":func:`!cgi.parse_multipart` 可以被 :mod:`email` 函式庫中實作相同 MIME RFCs " +"的功能取代,或者可以被 :pypi:`multipart` 函式庫取代,例如 :class:`email." +"message.EmailMessage` 和 :class:`email.message.Message` 類別。" -#: ../../whatsnew/3.13.rst:1536 +#: ../../whatsnew/3.13.rst:1555 +msgid "" +":pypi:`standard-cgi`: and :pypi:`standard-cgitb`: Use the redistribution of " +"``cgi`` and ``cgitb`` library from PyPI." +msgstr "" +":pypi:`standard-cgi` 和 :pypi:`standard-cgitb`:PyPI 上的 ``cgi`` 和 " +"``cgitb`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1558 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1541 +#: ../../whatsnew/3.13.rst:1563 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." -msgstr "" +msgstr ":pypi:`bcrypt`:適用於你的軟體與伺服器的現代密碼雜湊演算法。" -#: ../../whatsnew/3.13.rst:1543 +#: ../../whatsnew/3.13.rst:1565 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." -msgstr "" +msgstr ":pypi:`passlib`:支援超過 30 種方案的廣泛密碼雜湊框架。" -#: ../../whatsnew/3.13.rst:1545 +#: ../../whatsnew/3.13.rst:1567 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." -msgstr "" +msgstr ":pypi:`argon2-cffi`:安全的 Argon2 密碼雜湊演算法。" -#: ../../whatsnew/3.13.rst:1547 +#: ../../whatsnew/3.13.rst:1569 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." msgstr "" +":pypi:`legacycrypt`:對 POSIX crypt 函式庫呼叫及相關功能的 :mod:`ctypes` 包" +"裝。" -#: ../../whatsnew/3.13.rst:1550 +#: ../../whatsnew/3.13.rst:1572 msgid "" ":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" "`crypt_r(3)` library call and associated functionality." msgstr "" +":pypi:`crypt_r`:對 :mod:`!crypt` 模組的分支 (fork),對 :manpage:" +"`crypt_r(3)` 函式庫呼叫及相關功能的包裝。" -#: ../../whatsnew/3.13.rst:1555 +#: ../../whatsnew/3.13.rst:1576 +msgid "" +":pypi:`standard-crypt` and :pypi:`deprecated-crypt-alternative`: Use the " +"redistribution of ``crypt`` and reimplementation of ``_crypt`` libraries " +"from PyPI." +msgstr "" +":pypi:`standard-crypt` 和 :pypi:`deprecated-crypt-alternative`:PyPI 上的 " +"``crypt`` 函式庫重新發布版和 ``_crypt`` 函式庫的重新實作。" + +#: ../../whatsnew/3.13.rst:1579 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" "puremagic.what` function can be used to replace the :func:`!imghdr.what` " "function for all file formats that were supported by :mod:`!imghdr`." msgstr "" +":mod:`!imghdr`:請改用 :pypi:`filetype`、:pypi:`puremagic` 或 :pypi:`python-" +"magic` 函式庫。例如 :func:`!puremagic.what` 函式可以取代 :mod:`!imghdr` 過去" +"所支援所有文件格式的 :func:`!imghdr.what` 函式。" + +#: ../../whatsnew/3.13.rst:1586 +msgid "" +":pypi:`standard-imghdr`: Use the redistribution of ``imghdr`` library from " +"PyPI." +msgstr ":pypi:`standard-imghdr`:PyPI 上的 ``imghdr`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1561 +#: ../../whatsnew/3.13.rst:1589 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." -msgstr "" +msgstr ":mod:`!mailcap`:請改用 :mod:`mimetypes` 模組。" -#: ../../whatsnew/3.13.rst:1563 +#: ../../whatsnew/3.13.rst:1592 +msgid "" +":pypi:`standard-mailcap`: Use the redistribution of ``mailcap`` library from " +"PyPI." +msgstr ":pypi:`standard-mailcap`:PyPI 上的 ``mailcap`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1595 msgid ":mod:`!msilib`" msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1564 +#: ../../whatsnew/3.13.rst:1596 msgid ":mod:`!nis`" msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1565 +#: ../../whatsnew/3.13.rst:1597 msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." -msgstr "" +msgstr ":mod:`!nntplib`:請改用 PyPI 上的 :pypi:`pynntp` 函式庫。" -#: ../../whatsnew/3.13.rst:1567 +#: ../../whatsnew/3.13.rst:1600 +msgid "" +":pypi:`standard-nntplib`: Use the redistribution of ``nntplib`` library from " +"PyPI." +msgstr ":pypi:`standard-nntplib`:PyPI 上的 ``nntplib`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1603 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" +":mod:`!ossaudiodev`:音訊播放方面,請改用 PyPI 上的 :pypi:`pygame` 函式庫。" -#: ../../whatsnew/3.13.rst:1569 +#: ../../whatsnew/3.13.rst:1605 msgid "" ":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." "quote` to replace the undocumented ``pipes.quote`` function." msgstr "" +":mod:`!pipes`:請改用 :mod:`subprocess` 模組。使用 :func:`shlex.quote` 來取代" +"未以文件紀錄的 ``pipes.quote`` 函式。" + +#: ../../whatsnew/3.13.rst:1610 +msgid "" +":pypi:`standard-pipes`: Use the redistribution of ``pipes`` library from " +"PyPI." +msgstr ":pypi:`standard-pipes`:PyPI 上的 ``pipes`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1573 +#: ../../whatsnew/3.13.rst:1613 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" +":mod:`!sndhdr`:請改用 :pypi:`filetype`、:pypi:`puremagic` 或 :pypi:`python-" +"magic` 函式庫。" -#: ../../whatsnew/3.13.rst:1576 +#: ../../whatsnew/3.13.rst:1617 +msgid "" +":pypi:`standard-sndhdr`: Use the redistribution of ``sndhdr`` library from " +"PyPI." +msgstr ":pypi:`standard-sndhdr`:PyPI 上的 ``sndhdr`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1620 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." -msgstr "" +msgstr ":mod:`!spwd`:請改用 PyPI 上的 :pypi:`python-pam` 函式庫。" -#: ../../whatsnew/3.13.rst:1578 +#: ../../whatsnew/3.13.rst:1622 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1579 +#: ../../whatsnew/3.13.rst:1624 +msgid "" +":pypi:`standard-sunau`: Use the redistribution of ``sunau`` library from " +"PyPI." +msgstr ":pypi:`standard-sunau`:PyPI 上的 ``sunau`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1627 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" +":mod:`!telnetlib`:請改用 PyPI 上的 :pypi:`telnetlib3` 或 :pypi:`Exscript` 函" +"式庫。" + +#: ../../whatsnew/3.13.rst:1630 +msgid "" +":pypi:`standard-telnetlib`: Use the redistribution of ``telnetlib`` library " +"from PyPI." +msgstr ":pypi:`standard-telnetlib`:PyPI 上的 ``telnetlib`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1581 +#: ../../whatsnew/3.13.rst:1633 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." -msgstr "" +msgstr ":mod:`!uu`:請改用 :mod:`base64` 模組來作為當代的替代方案。" -#: ../../whatsnew/3.13.rst:1583 +#: ../../whatsnew/3.13.rst:1636 +msgid "" +":pypi:`standard-uu`: Use the redistribution of ``uu`` library from PyPI." +msgstr ":pypi:`standard-uu`:PyPI 上的 ``uu`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1639 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1585 +#: ../../whatsnew/3.13.rst:1641 +msgid "" +":pypi:`standard-xdrlib`: Use the redistribution of ``xdrlib`` library from " +"PyPI." +msgstr ":pypi:`standard-xdrlib`:PyPI 上的 ``xdrlib`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1644 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" msgstr "" +"(由 Victor Stinner 和 Zachary Ware 在 :gh:`104773` 和 :gh:`104780` 中貢" +"獻。)" -#: ../../whatsnew/3.13.rst:1589 +#: ../../whatsnew/3.13.rst:1648 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1591 +#: ../../whatsnew/3.13.rst:1650 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1597 +#: ../../whatsnew/3.13.rst:1656 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1599 +#: ../../whatsnew/3.13.rst:1658 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2392,47 +2523,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1608 +#: ../../whatsnew/3.13.rst:1667 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1616 +#: ../../whatsnew/3.13.rst:1675 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1623 +#: ../../whatsnew/3.13.rst:1682 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1625 +#: ../../whatsnew/3.13.rst:1684 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint <entry-points>` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1631 +#: ../../whatsnew/3.13.rst:1690 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1633 +#: ../../whatsnew/3.13.rst:1692 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1639 +#: ../../whatsnew/3.13.rst:1698 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1641 +#: ../../whatsnew/3.13.rst:1700 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2440,7 +2571,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1646 +#: ../../whatsnew/3.13.rst:1705 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2448,43 +2579,60 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1656 +#: ../../whatsnew/3.13.rst:1713 +msgid "optparse" +msgstr "optparse" + +#: ../../whatsnew/3.13.rst:1715 +msgid "" +"This module is no longer considered :term:`soft deprecated`. While :mod:" +"`argparse` remains preferred for new projects that aren't using a third " +"party command line argument processing library, there are aspects of the way " +"``argparse`` works that mean the lower level ``optparse`` module may provide " +"a better foundation for *writing* argument processing libraries, and for " +"implementing command line applications which adhere more strictly than " +"``argparse`` does to various Unix command line processing conventions that " +"originate in the behaviour of the C :c:func:`!getopt` function . " +"(Contributed by Alyssa Coghlan and Serhiy Storchaka in :gh:`126180`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1731 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1664 +#: ../../whatsnew/3.13.rst:1739 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1670 +#: ../../whatsnew/3.13.rst:1745 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1672 +#: ../../whatsnew/3.13.rst:1747 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1678 +#: ../../whatsnew/3.13.rst:1753 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1680 +#: ../../whatsnew/3.13.rst:1755 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1689 +#: ../../whatsnew/3.13.rst:1764 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2492,66 +2640,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1695 +#: ../../whatsnew/3.13.rst:1770 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1701 +#: ../../whatsnew/3.13.rst:1776 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1703 +#: ../../whatsnew/3.13.rst:1778 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" -msgstr "" +msgstr "移除以下在 Python 3.11 中已被棄用的 :mod:`unittest` 函式:" -#: ../../whatsnew/3.13.rst:1705 +#: ../../whatsnew/3.13.rst:1780 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1706 +#: ../../whatsnew/3.13.rst:1781 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1707 +#: ../../whatsnew/3.13.rst:1782 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1709 +#: ../../whatsnew/3.13.rst:1784 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1711 +#: ../../whatsnew/3.13.rst:1786 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1712 +#: ../../whatsnew/3.13.rst:1787 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1713 +#: ../../whatsnew/3.13.rst:1788 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1715 +#: ../../whatsnew/3.13.rst:1790 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "(由 Hugo van Kemenade 在 :gh:`104835` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1717 +#: ../../whatsnew/3.13.rst:1792 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1723 +#: ../../whatsnew/3.13.rst:1798 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1725 +#: ../../whatsnew/3.13.rst:1800 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2562,33 +2710,33 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1736 +#: ../../whatsnew/3.13.rst:1811 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1738 +#: ../../whatsnew/3.13.rst:1813 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1743 +#: ../../whatsnew/3.13.rst:1818 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1750 +#: ../../whatsnew/3.13.rst:1825 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1752 +#: ../../whatsnew/3.13.rst:1827 msgid ":ref:`User-defined functions <user-defined-funcs>`:" msgstr "" -#: ../../whatsnew/3.13.rst:1754 +#: ../../whatsnew/3.13.rst:1829 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2596,12 +2744,12 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1760 +#: ../../whatsnew/3.13.rst:1835 #: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1762 +#: ../../whatsnew/3.13.rst:1837 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " @@ -2610,73 +2758,61 @@ msgid "" "`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1769 +#: ../../whatsnew/3.13.rst:1844 #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1771 +#: ../../whatsnew/3.13.rst:1846 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1775 +#: ../../whatsnew/3.13.rst:1850 msgid "" ":term:`Soft-deprecate <soft deprecated>` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1779 +#: ../../whatsnew/3.13.rst:1854 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1781 +#: ../../whatsnew/3.13.rst:1856 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1786 +#: ../../whatsnew/3.13.rst:1861 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1788 +#: ../../whatsnew/3.13.rst:1863 msgid "" "Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" "`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1792 -msgid ":mod:`getopt` and :mod:`optparse`:" -msgstr ":mod:`getopt` 和 :mod:`optparse`:" - -#: ../../whatsnew/3.13.rst:1794 -msgid "" -"Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " -"for new projects. This is a new soft-deprecation for the :mod:`!getopt` " -"module, whereas the :mod:`!optparse` module was already *de facto* soft " -"deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:1800 +#: ../../whatsnew/3.13.rst:1867 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1802 +#: ../../whatsnew/3.13.rst:1869 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1807 +#: ../../whatsnew/3.13.rst:1874 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1809 +#: ../../whatsnew/3.13.rst:1876 msgid "" "Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" "func:`~glob.glob` and pass a :term:`path-like object` specifying the root " @@ -2684,12 +2820,12 @@ msgid "" "in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1814 +#: ../../whatsnew/3.13.rst:1881 #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1816 +#: ../../whatsnew/3.13.rst:1883 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2698,29 +2834,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1823 +#: ../../whatsnew/3.13.rst:1890 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1828 +#: ../../whatsnew/3.13.rst:1895 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1830 +#: ../../whatsnew/3.13.rst:1897 msgid "" ":term:`Soft-deprecate <soft deprecated>` file path arguments to :func:" "`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " "(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1835 +#: ../../whatsnew/3.13.rst:1902 msgid ":mod:`re`:" msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1837 +#: ../../whatsnew/3.13.rst:1904 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2729,46 +2865,46 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1844 -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../whatsnew/3.13.rst:1911 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1846 +#: ../../whatsnew/3.13.rst:1913 msgid "" "Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " "by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1851 -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../whatsnew/3.13.rst:1918 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1853 +#: ../../whatsnew/3.13.rst:1920 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1859 +#: ../../whatsnew/3.13.rst:1926 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1861 +#: ../../whatsnew/3.13.rst:1928 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1864 +#: ../../whatsnew/3.13.rst:1931 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1866 +#: ../../whatsnew/3.13.rst:1933 msgid "" "Deprecate passing more than one positional argument to the :func:`~sqlite3." "connect` function and the :class:`~sqlite3.Connection` constructor. The " @@ -2776,7 +2912,7 @@ msgid "" "by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1872 +#: ../../whatsnew/3.13.rst:1939 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " "arguments for :meth:`.Connection.create_function` and :meth:`.Connection." @@ -2784,7 +2920,7 @@ msgid "" "3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1878 +#: ../../whatsnew/3.13.rst:1945 msgid "" "Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." "Connection.set_authorizer`, :meth:`~sqlite3.Connection." @@ -2794,46 +2930,46 @@ msgid "" "`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1886 +#: ../../whatsnew/3.13.rst:1953 #: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1888 +#: ../../whatsnew/3.13.rst:1955 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1893 +#: ../../whatsnew/3.13.rst:1960 #: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1895 +#: ../../whatsnew/3.13.rst:1962 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1899 +#: ../../whatsnew/3.13.rst:1966 msgid ":mod:`traceback`:" msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1901 +#: ../../whatsnew/3.13.rst:1968 msgid "" "Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." "TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" "gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1905 -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../whatsnew/3.13.rst:1972 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1907 +#: ../../whatsnew/3.13.rst:1974 msgid "" "Deprecate the undocumented keyword argument syntax for creating :class:" "`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " @@ -2841,7 +2977,7 @@ msgid "" "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1914 +#: ../../whatsnew/3.13.rst:1981 msgid "" "Deprecate omitting the *fields* parameter when creating a :class:`~typing." "NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " @@ -2853,7 +2989,7 @@ msgid "" "Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1924 +#: ../../whatsnew/3.13.rst:1991 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2861,7 +2997,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1930 +#: ../../whatsnew/3.13.rst:1997 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -2870,12 +3006,12 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1938 -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../whatsnew/3.13.rst:2005 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1940 +#: ../../whatsnew/3.13.rst:2007 msgid "" "Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" "`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" @@ -3173,10 +3309,19 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -3189,7 +3334,7 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -3197,7 +3342,7 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -3206,11 +3351,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -3221,11 +3378,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -3237,7 +3394,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -3248,7 +3405,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3258,7 +3415,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3304,7 +3461,7 @@ msgstr "" "gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:10 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" @@ -3380,15 +3537,11 @@ msgid "" "groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -3397,7 +3550,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -3415,7 +3568,7 @@ msgstr "" "`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" "本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -3424,7 +3577,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -3433,7 +3586,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -3442,11 +3595,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; it should only be passed as a " @@ -3456,7 +3609,7 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -3466,18 +3619,18 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -3485,7 +3638,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -3493,19 +3646,11 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -3513,19 +3658,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -3533,19 +3678,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -3553,7 +3698,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -3565,12 +3710,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -3578,15 +3723,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -3594,58 +3739,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -3653,11 +3791,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -3665,7 +3803,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -3673,20 +3811,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -3694,58 +3832,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -3755,13 +3893,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -3772,7 +3910,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -3780,11 +3918,11 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1957 +#: ../../whatsnew/3.13.rst:2024 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1959 +#: ../../whatsnew/3.13.rst:2026 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " @@ -3793,97 +3931,97 @@ msgid "" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1967 +#: ../../whatsnew/3.13.rst:2034 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:1972 +#: ../../whatsnew/3.13.rst:2039 msgid "" "Add the :ref:`PyMonitoring C API <c-api-monitoring>` for generating :pep:" "`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:1975 +#: ../../whatsnew/3.13.rst:2042 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:1976 +#: ../../whatsnew/3.13.rst:2043 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:1977 +#: ../../whatsnew/3.13.rst:2044 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:1978 +#: ../../whatsnew/3.13.rst:2045 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:1979 +#: ../../whatsnew/3.13.rst:2046 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:1980 +#: ../../whatsnew/3.13.rst:2047 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:1981 +#: ../../whatsnew/3.13.rst:2048 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:1982 +#: ../../whatsnew/3.13.rst:2049 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:1983 +#: ../../whatsnew/3.13.rst:2050 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:1984 +#: ../../whatsnew/3.13.rst:2051 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:1985 +#: ../../whatsnew/3.13.rst:2052 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:1986 +#: ../../whatsnew/3.13.rst:2053 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:1987 +#: ../../whatsnew/3.13.rst:2054 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:1988 +#: ../../whatsnew/3.13.rst:2055 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:1989 +#: ../../whatsnew/3.13.rst:2056 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:1990 +#: ../../whatsnew/3.13.rst:2057 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:1991 +#: ../../whatsnew/3.13.rst:2058 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:1992 +#: ../../whatsnew/3.13.rst:2059 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:1993 +#: ../../whatsnew/3.13.rst:2060 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:1995 +#: ../../whatsnew/3.13.rst:2062 msgid "(Contributed by Irit Katriel in :gh:`111997`)." -msgstr "" +msgstr "(由 Irit Katriel 在 :gh:`111997` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1997 +#: ../../whatsnew/3.13.rst:2064 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " "the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" @@ -3891,52 +4029,52 @@ msgid "" "operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2003 +#: ../../whatsnew/3.13.rst:2070 msgid "" "Add the :ref:`PyTime C API <c-api-time>` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:2072 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2006 +#: ../../whatsnew/3.13.rst:2073 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:2074 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2008 +#: ../../whatsnew/3.13.rst:2075 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2009 +#: ../../whatsnew/3.13.rst:2076 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2010 +#: ../../whatsnew/3.13.rst:2077 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2011 +#: ../../whatsnew/3.13.rst:2078 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2012 +#: ../../whatsnew/3.13.rst:2079 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2013 +#: ../../whatsnew/3.13.rst:2080 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2015 +#: ../../whatsnew/3.13.rst:2082 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "(由 Victor Stinner 和 Petr Viktorin 在 :gh:`110850` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2017 +#: ../../whatsnew/3.13.rst:2084 msgid "" "Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" "c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " @@ -3944,7 +4082,7 @@ msgid "" "by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2023 +#: ../../whatsnew/3.13.rst:2090 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " @@ -3954,7 +4092,7 @@ msgid "" "`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2031 +#: ../../whatsnew/3.13.rst:2098 msgid "" "Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" "c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " @@ -3963,7 +4101,7 @@ msgid "" "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2039 +#: ../../whatsnew/3.13.rst:2106 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " @@ -3972,7 +4110,7 @@ msgid "" "Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2046 +#: ../../whatsnew/3.13.rst:2113 msgid "" "Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" "`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" @@ -3983,7 +4121,7 @@ msgid "" "gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2056 +#: ../../whatsnew/3.13.rst:2123 msgid "" "Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" "`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" @@ -3994,37 +4132,37 @@ msgid "" "Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2066 +#: ../../whatsnew/3.13.rst:2133 msgid "" "Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" "`PyErr_WriteUnraisable` that allows customizing the warning message. " "(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2071 +#: ../../whatsnew/3.13.rst:2138 msgid "" "Add new functions that return a :term:`strong reference` instead of a :term:" "`borrowed reference` for frame locals, globals, and builtins, as part of :" "ref:`PEP 667 <whatsnew313-locals-semantics>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2075 +#: ../../whatsnew/3.13.rst:2142 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr ":c:func:`PyEval_GetFrameBuiltins` 取代 :c:func:`PyEval_GetBuiltins`" -#: ../../whatsnew/3.13.rst:2076 +#: ../../whatsnew/3.13.rst:2143 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr ":c:func:`PyEval_GetFrameGlobals` 取代 :c:func:`PyEval_GetGlobals`" -#: ../../whatsnew/3.13.rst:2077 +#: ../../whatsnew/3.13.rst:2144 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr ":c:func:`PyEval_GetFrameLocals` 取代 :c:func:`PyEval_GetLocals`" -#: ../../whatsnew/3.13.rst:2079 +#: ../../whatsnew/3.13.rst:2146 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "(由 Mark Shannon 和 Tian Gao 在 :gh:`74929` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2081 +#: ../../whatsnew/3.13.rst:2148 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong <strong reference>` or :term:`borrowed " @@ -4033,7 +4171,7 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2088 +#: ../../whatsnew/3.13.rst:2155 msgid "" "Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" "func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " @@ -4041,35 +4179,35 @@ msgid "" "`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2093 +#: ../../whatsnew/3.13.rst:2160 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down <interpreter shutdown>`. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2098 +#: ../../whatsnew/3.13.rst:2165 msgid "" "Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" "`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" "`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2103 +#: ../../whatsnew/3.13.rst:2170 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2107 +#: ../../whatsnew/3.13.rst:2174 msgid "" "Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" "`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" "c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2112 +#: ../../whatsnew/3.13.rst:2179 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4077,27 +4215,27 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2118 +#: ../../whatsnew/3.13.rst:2185 msgid "" "Add :c:func:`PyModule_Add` function, which is similar to :c:func:" "`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " "a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2123 +#: ../../whatsnew/3.13.rst:2190 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " "hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" "`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2127 +#: ../../whatsnew/3.13.rst:2194 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2130 +#: ../../whatsnew/3.13.rst:2197 msgid "" "Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" "`PyObject_ClearManagedDict` functions. which must be called by the traverse " @@ -4106,7 +4244,7 @@ msgid "" "with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2138 +#: ../../whatsnew/3.13.rst:2205 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4114,14 +4252,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2144 +#: ../../whatsnew/3.13.rst:2211 msgid "" "Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" "`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2149 +#: ../../whatsnew/3.13.rst:2216 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4129,7 +4267,7 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2155 +#: ../../whatsnew/3.13.rst:2222 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " "fully qualified name. The module name is prepended if :attr:`type." @@ -4137,14 +4275,14 @@ msgid "" "``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2161 +#: ../../whatsnew/3.13.rst:2228 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " "name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2166 +#: ../../whatsnew/3.13.rst:2233 msgid "" "Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" "`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" @@ -4153,7 +4291,7 @@ msgid "" "Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2173 +#: ../../whatsnew/3.13.rst:2240 msgid "" "Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" "`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " @@ -4161,47 +4299,51 @@ msgid "" "`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2179 +#: ../../whatsnew/3.13.rst:2246 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2181 +#: ../../whatsnew/3.13.rst:2248 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." -msgstr "" +msgstr ":c:func:`PyObject_HasAttrWithError` 取代 :c:func:`PyObject_HasAttr`。" -#: ../../whatsnew/3.13.rst:2182 +#: ../../whatsnew/3.13.rst:2249 msgid "" ":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" "`PyObject_HasAttrString`." msgstr "" +":c:func:`PyObject_HasAttrStringWithError` 取代 :c:func:" +"`PyObject_HasAttrString`。" -#: ../../whatsnew/3.13.rst:2184 +#: ../../whatsnew/3.13.rst:2251 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." -msgstr "" +msgstr ":c:func:`PyMapping_HasKeyWithError` 取代 :c:func:`PyMapping_HasKey`。" -#: ../../whatsnew/3.13.rst:2185 +#: ../../whatsnew/3.13.rst:2252 msgid "" ":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" "`PyMapping_HasKeyString`." msgstr "" +":c:func:`PyMapping_HasKeyStringWithError` 取代 :c:func:" +"`PyMapping_HasKeyString`。" -#: ../../whatsnew/3.13.rst:2188 +#: ../../whatsnew/3.13.rst:2255 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2191 +#: ../../whatsnew/3.13.rst:2258 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "(由 Serhiy Storchaka 在 :gh:`108511` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2195 +#: ../../whatsnew/3.13.rst:2262 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2197 +#: ../../whatsnew/3.13.rst:2264 msgid "" "The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" "func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " @@ -4214,20 +4356,20 @@ msgid "" "`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2209 +#: ../../whatsnew/3.13.rst:2276 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2213 +#: ../../whatsnew/3.13.rst:2280 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2217 +#: ../../whatsnew/3.13.rst:2284 msgid "" "The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" "`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" @@ -4238,35 +4380,35 @@ msgid "" "documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2226 +#: ../../whatsnew/3.13.rst:2293 msgid "" "Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" "`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2229 +#: ../../whatsnew/3.13.rst:2296 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2230 +#: ../../whatsnew/3.13.rst:2297 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2231 +#: ../../whatsnew/3.13.rst:2298 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2232 +#: ../../whatsnew/3.13.rst:2299 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2234 +#: ../../whatsnew/3.13.rst:2301 msgid "" "See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" "`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2237 +#: ../../whatsnew/3.13.rst:2304 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " @@ -4275,7 +4417,7 @@ msgid "" "`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2243 +#: ../../whatsnew/3.13.rst:2310 msgid "" "If Python is built in :ref:`debug mode <debug-build>` or :option:`with " "assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" @@ -4283,61 +4425,61 @@ msgid "" "(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2251 +#: ../../whatsnew/3.13.rst:2318 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2253 +#: ../../whatsnew/3.13.rst:2320 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2255 +#: ../../whatsnew/3.13.rst:2322 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2256 +#: ../../whatsnew/3.13.rst:2323 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2257 +#: ../../whatsnew/3.13.rst:2324 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2258 +#: ../../whatsnew/3.13.rst:2325 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2259 +#: ../../whatsnew/3.13.rst:2326 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2260 +#: ../../whatsnew/3.13.rst:2327 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2261 +#: ../../whatsnew/3.13.rst:2328 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2263 +#: ../../whatsnew/3.13.rst:2330 msgid "" "(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" "`116936`.)" msgstr "" "(由 Victor Stinner 貢獻於 :gh:`85283`、:gh:`85283` 和 :gh:`116936`。)" -#: ../../whatsnew/3.13.rst:2265 +#: ../../whatsnew/3.13.rst:2332 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API <limited-c-api>`. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2271 +#: ../../whatsnew/3.13.rst:2338 msgid "Removed C APIs" msgstr "移除的 C API" -#: ../../whatsnew/3.13.rst:2273 +#: ../../whatsnew/3.13.rst:2340 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4347,13 +4489,13 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2281 +#: ../../whatsnew/3.13.rst:2348 msgid "" "Remove old buffer protocols deprecated in Python 3.0. Use :ref:" "`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2284 +#: ../../whatsnew/3.13.rst:2351 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " "test whether the object supports the buffer protocol. Note that :c:func:" @@ -4362,7 +4504,7 @@ msgid "" "example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2292 +#: ../../whatsnew/3.13.rst:2359 msgid "" ":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" "func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" @@ -4370,7 +4512,7 @@ msgstr "" ":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改用 :" "c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2295 +#: ../../whatsnew/3.13.rst:2362 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4381,7 +4523,7 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2305 +#: ../../whatsnew/3.13.rst:2372 msgid "" ":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" "func:`PyBuffer_Release` instead:" @@ -4389,7 +4531,7 @@ msgstr "" ":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` 和 :c:" "func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2308 +#: ../../whatsnew/3.13.rst:2375 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4399,15 +4541,15 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2317 +#: ../../whatsnew/3.13.rst:2384 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "(由 Inada Naoki 貢獻於 :gh:`85275`。)" -#: ../../whatsnew/3.13.rst:2319 +#: ../../whatsnew/3.13.rst:2386 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2321 +#: ../../whatsnew/3.13.rst:2388 msgid "" ":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" "c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." @@ -4415,7 +4557,7 @@ msgstr "" ":c:func:`!PyEval_CallObject`、:c:func:`!PyEval_CallObjectWithKeywords`:請改" "用 :c:func:`PyObject_CallNoArgs` 或 :c:func:`PyObject_Call`。" -#: ../../whatsnew/3.13.rst:2326 +#: ../../whatsnew/3.13.rst:2393 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " @@ -4426,32 +4568,33 @@ msgid "" "`PyTuple_New(0) <PyTuple_New>`." msgstr "" -#: ../../whatsnew/3.13.rst:2336 +#: ../../whatsnew/3.13.rst:2403 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" ":c:func:`!PyEval_CallFunction`:請改用 :c:func:`PyObject_CallFunction`。" -#: ../../whatsnew/3.13.rst:2338 +#: ../../whatsnew/3.13.rst:2405 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr ":c:func:`!PyEval_CallMethod`:請改用 :c:func:`PyObject_CallMethod`。" -#: ../../whatsnew/3.13.rst:2340 +#: ../../whatsnew/3.13.rst:2407 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr ":c:func:`!PyCFunction_Call`:請改用 :c:func:`PyCFunction_Call`。" -#: ../../whatsnew/3.13.rst:2343 +#: ../../whatsnew/3.13.rst:2410 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105107`。)" -#: ../../whatsnew/3.13.rst:2345 +#: ../../whatsnew/3.13.rst:2412 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" +"移除以下設定 Python 初始化的舊函式,這些函式在 Python 3.11 中已被棄用:" -#: ../../whatsnew/3.13.rst:2348 +#: ../../whatsnew/3.13.rst:2415 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." @@ -4459,36 +4602,36 @@ msgstr "" ":c:func:`!PySys_AddWarnOptionUnicode`:請改用 :c:member:`PyConfig." "warnoptions`。" -#: ../../whatsnew/3.13.rst:2350 +#: ../../whatsnew/3.13.rst:2417 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" ":c:func:`!PySys_AddWarnOption`:請改用 :c:member:`PyConfig.warnoptions`。" -#: ../../whatsnew/3.13.rst:2352 +#: ../../whatsnew/3.13.rst:2419 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr ":c:func:`!PySys_AddXOption`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2354 +#: ../../whatsnew/3.13.rst:2421 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" ":c:func:`!PySys_HasWarnOptions`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2356 +#: ../../whatsnew/3.13.rst:2423 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" ":c:func:`!PySys_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2358 +#: ../../whatsnew/3.13.rst:2425 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" ":c:func:`!Py_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2360 +#: ../../whatsnew/3.13.rst:2427 msgid "" ":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." "stdio_encoding` instead, and set also maybe :c:member:`PyConfig." @@ -4498,14 +4641,14 @@ msgstr "" "stdio_encoding` 並設定可能的 :c:member:`PyConfig.legacy_windows_stdio`\\ " "(在 Windows 上)。" -#: ../../whatsnew/3.13.rst:2363 +#: ../../whatsnew/3.13.rst:2430 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" ":c:func:`!_Py_SetProgramFullPath`:請改用 :c:member:`PyConfig.executable`。" -#: ../../whatsnew/3.13.rst:2366 +#: ../../whatsnew/3.13.rst:2433 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration <init-config>` instead (:pep:`587`), added to Python 3.8. " @@ -4515,7 +4658,7 @@ msgstr "" "(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner 於 :gh:" "`105145` 貢獻。)" -#: ../../whatsnew/3.13.rst:2370 +#: ../../whatsnew/3.13.rst:2437 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " @@ -4525,25 +4668,25 @@ msgstr "" "些函式在 Python 3.2 中已被廢棄。它們不會更新目前的執行緒狀態。可以用以下函式" "取代:" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2442 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2376 +#: ../../whatsnew/3.13.rst:2443 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" "低階的 :c:func:`PyEval_AcquireThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2377 +#: ../../whatsnew/3.13.rst:2444 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "或 :c:func:`PyGILState_Ensure` 與 :c:func:`PyGILState_Release`。" -#: ../../whatsnew/3.13.rst:2379 +#: ../../whatsnew/3.13.rst:2446 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105182`。)" -#: ../../whatsnew/3.13.rst:2381 +#: ../../whatsnew/3.13.rst:2448 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4551,8 +4694,12 @@ msgid "" "PyEval_ThreadsInitialized` always returns non-zero. (Contributed by Victor " "Stinner in :gh:`105182`.)" msgstr "" +"移除在 Python 3.9 中已被棄用的 :c:func:`!PyEval_ThreadsInitialized` 函式。自 " +"Python 3.7 起,:c:func:`!Py_Initialize` 總是會建立 GIL:呼叫 :c:func:`!" +"PyEval_InitThreads` 不會有任何作用,而 :c:func:`!PyEval_ThreadsInitialized` " +"總是會回傳非零值。(由 Victor Stinner 於 :gh:`105182` 貢獻。)" -#: ../../whatsnew/3.13.rst:2388 +#: ../../whatsnew/3.13.rst:2455 msgid "" "Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" "`PyInterpreterState_Get()` which was kept for backward compatibility with " @@ -4560,15 +4707,23 @@ msgid "" "`PyInterpreterState_Get()` on Python 3.8 and older. (Contributed by Victor " "Stinner in :gh:`106320`.)" msgstr "" +"移除 :c:func:`!_PyInterpreterState_Get` 這個對 :c:func:" +"`PyInterpreterState_Get()` 的別名,這個別名是為了與 Python 3.8 的向後相容性而" +"保留的。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.8 和更舊的版本中取" +"得 :c:func:`PyInterpreterState_Get()`。(由 Victor Stinner 於 :gh:`106320` 貢" +"獻。)" -#: ../../whatsnew/3.13.rst:2395 +#: ../../whatsnew/3.13.rst:2462 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" +"移除私有的 :c:func:`!_PyObject_FastCall` 函式:請改用自 Python 3.8 起可用的 :" +"c:func:`!PyObject_Vectorcall` 函式(:pep:`590`)。(由 Victor Stinner 於 :gh:" +"`106023` 貢獻。)" -#: ../../whatsnew/3.13.rst:2400 +#: ../../whatsnew/3.13.rst:2467 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" @@ -4576,29 +4731,32 @@ msgstr "" "移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner 於 :gh:" "`106316` 貢獻。)" -#: ../../whatsnew/3.13.rst:2404 +#: ../../whatsnew/3.13.rst:2471 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2407 +#: ../../whatsnew/3.13.rst:2474 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " "``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. (Contributed by Irit Katriel " "in :gh:`105111`.)" msgstr "" +"移除舊的垃圾桶巨集 ``Py_TRASHCAN_SAFE_BEGIN`` 和 ``Py_TRASHCAN_SAFE_END``。請" +"將兩者都替換為新的巨集 ``Py_TRASHCAN_BEGIN`` 和 ``Py_TRASHCAN_END``。(由 " +"Irit Katriel 在 :gh:`105111` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2414 +#: ../../whatsnew/3.13.rst:2481 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2416 +#: ../../whatsnew/3.13.rst:2483 msgid "Deprecate old Python initialization functions:" -msgstr "" +msgstr "棄用舊的 Python 初始化函式:" -#: ../../whatsnew/3.13.rst:2418 +#: ../../whatsnew/3.13.rst:2485 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" @@ -4607,30 +4765,30 @@ msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2420 +#: ../../whatsnew/3.13.rst:2487 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2422 +#: ../../whatsnew/3.13.rst:2489 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2424 +#: ../../whatsnew/3.13.rst:2491 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2426 +#: ../../whatsnew/3.13.rst:2493 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2428 +#: ../../whatsnew/3.13.rst:2495 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2430 +#: ../../whatsnew/3.13.rst:2497 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" ":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" @@ -4639,32 +4797,42 @@ msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" "`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2434 +#: ../../whatsnew/3.13.rst:2501 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "(由 Victor Stinner 在 :gh:`105145` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2436 +#: ../../whatsnew/3.13.rst:2503 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyEval_GetBuiltins`, :" "c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " "return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" +":term:`軟性棄用 <soft deprecated>` :c:func:`PyEval_GetBuiltins`、:c:func:" +"`PyEval_GetGlobals` 和 :c:func:`PyEval_GetLocals` 函式,這些函式會回傳一個" +"\\ :term:`借用參照 <borrowed reference>`。(作為 :pep:`667` 一部分的軟性棄" +"用。)" -#: ../../whatsnew/3.13.rst:2442 +#: ../../whatsnew/3.13.rst:2509 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" +"棄用 :c:func:`PyImport_ImportModuleNoBlock` 函式,這只是自 Python 3.3 起的 :" +"c:func:`PyImport_ImportModule` 的別名。(由 Victor Stinner 在 :gh:`105396` 中" +"貢獻。)" -#: ../../whatsnew/3.13.rst:2446 +#: ../../whatsnew/3.13.rst:2513 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyModule_AddObject` " "function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" "`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" +":term:`軟性棄用 <soft deprecated>` :c:func:`PyModule_AddObject` 函式。應該改" +"用 :c:func:`PyModule_Add` 或 :c:func:`PyModule_AddObjectRef`。(由 Serhiy " +"Storchaka 在 :gh:`86493` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2452 +#: ../../whatsnew/3.13.rst:2519 msgid "" "Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" "macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " @@ -4672,8 +4840,12 @@ msgid "" "aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner in :gh:" "`105156`.)" msgstr "" +"棄用舊的 ``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 型別以及 :c:macro:`!" +"Py_UNICODE_WIDE` 定義。請直接使用 :c:type:`wchar_t` 型別。自 Python 3.3 起," +"``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 只是 :c:type:`!wchar_t` 的別名。(由 " +"Victor Stinner 在 :gh:`105156` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2459 +#: ../../whatsnew/3.13.rst:2526 msgid "" "Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" "`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " @@ -4682,6 +4854,12 @@ msgid "" "get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. (Contributed by " "Victor Stinner in :gh:`105927`.)" msgstr "" +"棄用 :c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT` 函式,這" +"些函式會回傳一個\\ :term:`借用參照 <borrowed reference>`。請改用新的 :c:func:" +"`PyWeakref_GetRef` 函式,這個函式會回傳一個\\ :term:`強參照 <strong " +"reference>`。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.12 和更舊的版本" +"中取得 :c:func:`PyWeakref_GetRef`。(由 Victor Stinner 在 :gh:`105927` 中貢" +"獻。)" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" @@ -5050,56 +5228,56 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2479 +#: ../../whatsnew/3.13.rst:2546 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2481 +#: ../../whatsnew/3.13.rst:2548 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 <whatsnew313-platform-support>` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2486 +#: ../../whatsnew/3.13.rst:2553 msgid "" "``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" "`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-support>` " "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2491 +#: ../../whatsnew/3.13.rst:2558 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2494 +#: ../../whatsnew/3.13.rst:2561 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2497 +#: ../../whatsnew/3.13.rst:2564 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2500 +#: ../../whatsnew/3.13.rst:2567 msgid "" "Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" "`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " "Victor Stinner in :gh:`112090`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2504 +#: ../../whatsnew/3.13.rst:2571 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2508 +#: ../../whatsnew/3.13.rst:2575 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license <mimalloc-license>`. The bundled " @@ -5107,28 +5285,28 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2516 +#: ../../whatsnew/3.13.rst:2583 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2520 +#: ../../whatsnew/3.13.rst:2587 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " "references) is now ABI compatible with the Python release build and :ref:" "`debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2525 +#: ../../whatsnew/3.13.rst:2592 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2529 +#: ../../whatsnew/3.13.rst:2596 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " "``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." @@ -5138,27 +5316,27 @@ msgid "" "`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2538 +#: ../../whatsnew/3.13.rst:2605 msgid "Porting to Python 3.13" msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2540 +#: ../../whatsnew/3.13.rst:2607 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2544 +#: ../../whatsnew/3.13.rst:2611 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2548 +#: ../../whatsnew/3.13.rst:2615 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals <frame.f_locals>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2551 +#: ../../whatsnew/3.13.rst:2618 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5170,7 +5348,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2560 +#: ../../whatsnew/3.13.rst:2627 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5180,7 +5358,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2567 +#: ../../whatsnew/3.13.rst:2634 msgid "" "Accessing :attr:`FrameType.f_locals <frame.f_locals>` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5189,7 +5367,7 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2573 +#: ../../whatsnew/3.13.rst:2640 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " "method. The behavior will change in future Python versions. Wrap it in :func:" @@ -5197,14 +5375,14 @@ msgid "" "Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2579 +#: ../../whatsnew/3.13.rst:2646 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2584 +#: ../../whatsnew/3.13.rst:2651 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5213,13 +5391,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2590 +#: ../../whatsnew/3.13.rst:2657 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2593 +#: ../../whatsnew/3.13.rst:2660 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5227,25 +5405,25 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2598 +#: ../../whatsnew/3.13.rst:2665 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2603 +#: ../../whatsnew/3.13.rst:2670 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2610 +#: ../../whatsnew/3.13.rst:2677 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2612 +#: ../../whatsnew/3.13.rst:2679 msgid "" "``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " @@ -5254,7 +5432,7 @@ msgid "" "`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2618 +#: ../../whatsnew/3.13.rst:2685 msgid "" "``Python.h`` no longer includes these standard header files: ``<time.h>``, " "``<sys/select.h>`` and ``<sys/time.h>``. If needed, they should now be " @@ -5265,7 +5443,7 @@ msgid "" "Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2626 +#: ../../whatsnew/3.13.rst:2693 msgid "" "On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5275,7 +5453,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2633 +#: ../../whatsnew/3.13.rst:2700 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5283,18 +5461,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2638 +#: ../../whatsnew/3.13.rst:2705 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2642 +#: ../../whatsnew/3.13.rst:2709 msgid "A ``tp_dealloc`` function that has the old macros, such as::" msgstr "有舊巨集的 ``tp_dealloc`` 函式,例如: ::" -#: ../../whatsnew/3.13.rst:2644 +#: ../../whatsnew/3.13.rst:2711 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5314,11 +5492,11 @@ msgstr "" " Py_TRASHCAN_SAFE_END\n" "}" -#: ../../whatsnew/3.13.rst:2653 +#: ../../whatsnew/3.13.rst:2720 msgid "should migrate to the new macros as follows::" msgstr "應該改為使用新的巨集,如下所示: ::" -#: ../../whatsnew/3.13.rst:2655 +#: ../../whatsnew/3.13.rst:2722 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5338,7 +5516,7 @@ msgstr "" " Py_TRASHCAN_END\n" "}" -#: ../../whatsnew/3.13.rst:2664 +#: ../../whatsnew/3.13.rst:2731 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5346,13 +5524,13 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2671 +#: ../../whatsnew/3.13.rst:2738 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2674 +#: ../../whatsnew/3.13.rst:2741 msgid "" "The effects of mutating the dictionary returned from :c:func:" "`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " @@ -5366,7 +5544,7 @@ msgid "" "being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2687 +#: ../../whatsnew/3.13.rst:2754 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " @@ -5375,25 +5553,140 @@ msgid "" "`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2694 +#: ../../whatsnew/3.13.rst:2761 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2699 +#: ../../whatsnew/3.13.rst:2766 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes <optimized scope>`." msgstr "" -#: ../../whatsnew/3.13.rst:2704 -msgid "Regression Test Changes" +#: ../../whatsnew/3.13.rst:2770 +msgid "" +"Python 3.13 removed many private functions. Some of them can be replaced " +"using these alternatives:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2773 +msgid "``_PyDict_Pop()``: :c:func:`PyDict_Pop` or :c:func:`PyDict_PopString`;" +msgstr "" +"``_PyDict_Pop()``::c:func:`PyDict_Pop` 或 :c:func:`PyDict_PopString`;" + +#: ../../whatsnew/3.13.rst:2774 +msgid "``_PyDict_GetItemWithError()``: :c:func:`PyDict_GetItemRef`;" +msgstr "``_PyDict_GetItemWithError()``::c:func:`PyDict_GetItemRef`;" + +#: ../../whatsnew/3.13.rst:2775 +msgid "``_PyErr_WriteUnraisableMsg()``: :c:func:`PyErr_FormatUnraisable`;" +msgstr "``_PyErr_WriteUnraisableMsg()``::c:func:`PyErr_FormatUnraisable`;" + +#: ../../whatsnew/3.13.rst:2776 +msgid "" +"``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` or :c:func:" +"`PyEval_SetTraceAllThreads`;" +msgstr "" +"``_PyEval_SetTrace()``::c:func:`PyEval_SetTrace` 或 :c:func:" +"`PyEval_SetTraceAllThreads`;" + +#: ../../whatsnew/3.13.rst:2777 +msgid "``_PyList_Extend()``: :c:func:`PyList_Extend`;" +msgstr "``_PyList_Extend()``::c:func:`PyList_Extend`;" + +#: ../../whatsnew/3.13.rst:2778 +msgid "``_PyLong_AsInt()``: :c:func:`PyLong_AsInt`;" +msgstr "``_PyLong_AsInt()``::c:func:`PyLong_AsInt`;" + +#: ../../whatsnew/3.13.rst:2779 +msgid "``_PyMem_RawStrdup()``: ``strdup()``;" +msgstr "``_PyMem_RawStrdup()``:``strdup()``;" + +#: ../../whatsnew/3.13.rst:2780 +msgid "``_PyMem_Strdup()``: ``strdup()``;" +msgstr "``_PyMem_Strdup()``:``strdup()``;" + +#: ../../whatsnew/3.13.rst:2781 +msgid "``_PyObject_ClearManagedDict()``: :c:func:`PyObject_ClearManagedDict`;" +msgstr "" +"``_PyObject_ClearManagedDict()``::c:func:`PyObject_ClearManagedDict`;" + +#: ../../whatsnew/3.13.rst:2782 +msgid "``_PyObject_VisitManagedDict()``: :c:func:`PyObject_VisitManagedDict`;" msgstr "" +"``_PyObject_VisitManagedDict()``::c:func:`PyObject_VisitManagedDict`;" -#: ../../whatsnew/3.13.rst:2706 +#: ../../whatsnew/3.13.rst:2783 +msgid "" +"``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" +msgstr "" +"``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" + +#: ../../whatsnew/3.13.rst:2784 +msgid "``_PyTime_AsSecondsDouble()``: :c:func:`PyTime_AsSecondsDouble`;" +msgstr "``_PyTime_AsSecondsDouble()``::c:func:`PyTime_AsSecondsDouble`;" + +#: ../../whatsnew/3.13.rst:2785 +msgid "" +"``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` or :c:func:" +"`PyTime_MonotonicRaw`;" +msgstr "" +"``_PyTime_GetMonotonicClock()``::c:func:`PyTime_Monotonic` 或 :c:func:" +"`PyTime_MonotonicRaw`;" + +#: ../../whatsnew/3.13.rst:2786 +msgid "" +"``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` or :c:func:" +"`PyTime_PerfCounterRaw`;" +msgstr "" +"``_PyTime_GetPerfCounter()``::c:func:`PyTime_PerfCounter` 或 :c:func:" +"`PyTime_PerfCounterRaw`;" + +#: ../../whatsnew/3.13.rst:2787 +msgid "" +"``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` or :c:func:" +"`PyTime_TimeRaw`;" +msgstr "" +"``_PyTime_GetSystemClock()``::c:func:`PyTime_Time` 或 :c:func:" +"`PyTime_TimeRaw`;" + +#: ../../whatsnew/3.13.rst:2788 +msgid "``_PyTime_MAX``: :c:var:`PyTime_MAX`;" +msgstr "``_PyTime_MAX``::c:var:`PyTime_MAX`;" + +#: ../../whatsnew/3.13.rst:2789 +msgid "``_PyTime_MIN``: :c:var:`PyTime_MIN`;" +msgstr "``_PyTime_MIN``::c:var:`PyTime_MIN`;" + +#: ../../whatsnew/3.13.rst:2790 +msgid "``_PyTime_t``: :c:type:`PyTime_t`;" +msgstr "``_PyTime_t``::c:type:`PyTime_t`;" + +#: ../../whatsnew/3.13.rst:2791 +msgid "``_Py_HashPointer()``: :c:func:`Py_HashPointer`;" +msgstr "``_Py_HashPointer()``::c:func:`Py_HashPointer`;" + +#: ../../whatsnew/3.13.rst:2792 +msgid "``_Py_IsFinalizing()``: :c:func:`Py_IsFinalizing`." +msgstr "``_Py_IsFinalizing()``::c:func:`Py_IsFinalizing`。" + +#: ../../whatsnew/3.13.rst:2794 +msgid "" +"The `pythoncapi-compat project`_ can be used to get most of these new " +"functions on Python 3.12 and older." +msgstr "" +"可以使用 `pythoncapi-compat 專案`_\\ 來在 Python 3.12 及更舊的版本中取用大部" +"分的這些新函式。" + +#: ../../whatsnew/3.13.rst:2798 +msgid "Regression Test Changes" +msgstr "迴歸測試的變更" + +#: ../../whatsnew/3.13.rst:2800 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " @@ -5401,14 +5694,29 @@ msgid "" "interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " "in :gh:`110769`.)" msgstr "" +"使用 :file:`configure` :option:`--with-pydebug` 建置的 Python 現在支援 :" +"option:`-X presite=package.module <-X>` 命令列選項。如果使用它就會指定一個應" +"該在解譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " +"Łukasz Langa 在 :gh:`110769` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2714 +#: ../../whatsnew/3.13.rst:2808 msgid "Notable changes in 3.13.1" msgstr "Python 3.13.1 中顯著的變更" -#: ../../whatsnew/3.13.rst:2719 +#: ../../whatsnew/3.13.rst:2813 msgid "" "The previously undocumented special function :func:`sys.getobjects`, which " "only exists in specialized builds of Python, may now return objects from " "other interpreters than the one it's called in." msgstr "" +"先前未以文件記錄的特殊函式 :func:`sys.getobjects`,只存在於 Python 的特殊建置" +"中,現在可能會回傳來自於呼叫它的直譯器之外的物件。" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" + +#~ msgid "" +#~ ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated " +#~ "and ignored." +#~ msgstr "" +#~ ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 2ed7e65d36..eef8f7784e 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -90,10 +90,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:95 msgid "" "This module has already had widespread success in the community as a third-" -"party module. Being more fully featured than its predecessor, the :mod:" -"`argparse` module is now the preferred module for command-line processing. " -"The older module is still being kept available because of the substantial " -"amount of legacy code that depends on it." +"party module. Being more fully featured than its predecessor, " +"the :mod:`argparse` module is now the preferred module for command-line " +"processing. The older module is still being kept available because of the " +"substantial amount of legacy code that depends on it." msgstr "" #: ../../whatsnew/3.2.rst:101 @@ -234,8 +234,8 @@ msgstr "由 Steven Bethard 撰寫 PEP。" #: ../../whatsnew/3.2.rst:178 msgid "" -":ref:`upgrading-optparse-code` for details on the differences from :mod:" -"`optparse`." +":ref:`upgrading-optparse-code` for details on the differences " +"from :mod:`optparse`." msgstr "" #: ../../whatsnew/3.2.rst:182 @@ -254,20 +254,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:191 msgid "" -"To support a more flexible style, the module now offers :func:`logging." -"config.dictConfig` for specifying logging configuration with plain Python " -"dictionaries. The configuration options include formatters, handlers, " -"filters, and loggers. Here's a working example of a configuration " -"dictionary::" +"To support a more flexible style, the module now " +"offers :func:`logging.config.dictConfig` for specifying logging " +"configuration with plain Python dictionaries. The configuration options " +"include formatters, handlers, filters, and loggers. Here's a working " +"example of a configuration dictionary::" msgstr "" #: ../../whatsnew/3.2.rst:197 msgid "" "{\"version\": 1,\n" -" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " -"%(message)s\"},\n" -" \"full\": {\"format\": \"%(asctime)s %(name)-15s " -"%(levelname)-8s %(message)s\"}\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" " },\n" " \"handlers\": {\"console\": {\n" " \"class\": \"logging.StreamHandler\",\n" @@ -284,10 +284,10 @@ msgid "" "\"console_priority\"]}}" msgstr "" "{\"version\": 1,\n" -" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " -"%(message)s\"},\n" -" \"full\": {\"format\": \"%(asctime)s %(name)-15s " -"%(levelname)-8s %(message)s\"}\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" " },\n" " \"handlers\": {\"console\": {\n" " \"class\": \"logging.StreamHandler\",\n" @@ -344,12 +344,12 @@ msgstr "" #: ../../whatsnew/3.2.rst:241 msgid "" -"The design for :mod:`concurrent.futures` was inspired by the *java.util." -"concurrent* package. In that model, a running call and its result are " -"represented by a :class:`~concurrent.futures.Future` object that abstracts " -"features common to threads, processes, and remote procedure calls. That " -"object supports status checks (running or done), timeouts, cancellations, " -"adding callbacks, and access to results or exceptions." +"The design for :mod:`concurrent.futures` was inspired by the " +"*java.util.concurrent* package. In that model, a running call and its " +"result are represented by a :class:`~concurrent.futures.Future` object that " +"abstracts features common to threads, processes, and remote procedure " +"calls. That object supports status checks (running or done), timeouts, " +"cancellations, adding callbacks, and access to results or exceptions." msgstr "" #: ../../whatsnew/3.2.rst:248 @@ -372,14 +372,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:260 msgid "" -"Both classes share a common interface with three methods: :meth:`~concurrent." -"futures.Executor.submit` for scheduling a callable and returning a :class:" -"`~concurrent.futures.Future` object; :meth:`~concurrent.futures.Executor." -"map` for scheduling many asynchronous calls at a time, and :meth:" -"`~concurrent.futures.Executor.shutdown` for freeing resources. The class is " -"a :term:`context manager` and can be used in a :keyword:`with` statement to " -"assure that resources are automatically released when currently pending " -"futures are done executing." +"Both classes share a common interface with three " +"methods: :meth:`~concurrent.futures.Executor.submit` for scheduling a " +"callable and returning a :class:`~concurrent.futures.Future` " +"object; :meth:`~concurrent.futures.Executor.map` for scheduling many " +"asynchronous calls at a time, " +"and :meth:`~concurrent.futures.Executor.shutdown` for freeing resources. " +"The class is a :term:`context manager` and can be used in a :keyword:`with` " +"statement to assure that resources are automatically released when currently " +"pending futures are done executing." msgstr "" #: ../../whatsnew/3.2.rst:269 @@ -421,8 +422,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:287 msgid "" ":ref:`Code for computing prime numbers in parallel<processpoolexecutor-" -"example>`, an example demonstrating :class:`~concurrent.futures." -"ProcessPoolExecutor`." +"example>`, an example " +"demonstrating :class:`~concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.2.rst:293 @@ -451,10 +452,11 @@ msgid "" "To solve this problem, Python's import machinery has been extended to use " "distinct filenames for each interpreter. Instead of Python 3.2 and Python " "3.3 and Unladen Swallow each competing for a file called \"mymodule.pyc\", " -"they will now look for \"mymodule.cpython-32.pyc\", \"mymodule.cpython-33." -"pyc\", and \"mymodule.unladen10.pyc\". And to prevent all of these new " -"files from cluttering source directories, the *pyc* files are now collected " -"in a \"__pycache__\" directory stored under the package directory." +"they will now look for \"mymodule.cpython-32.pyc\", " +"\"mymodule.cpython-33.pyc\", and \"mymodule.unladen10.pyc\". And to prevent " +"all of these new files from cluttering source directories, the *pyc* files " +"are now collected in a \"__pycache__\" directory stored under the package " +"directory." msgstr "" #: ../../whatsnew/3.2.rst:312 @@ -539,8 +541,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:373 msgid "" -"In Python itself, the tags are accessible from functions in the :mod:" -"`sysconfig` module::" +"In Python itself, the tags are accessible from functions in " +"the :mod:`sysconfig` module::" msgstr "" #: ../../whatsnew/3.2.rst:376 @@ -660,11 +662,11 @@ msgid "" "There is also a new :meth:`str.format_map` method that extends the " "capabilities of the existing :meth:`str.format` method by accepting " "arbitrary :term:`mapping` objects. This new method makes it possible to use " -"string formatting with any of Python's many dictionary-like objects such as :" -"class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:" -"`~configparser.ConfigParser`, or :mod:`dbm`. It is also useful with custom :" -"class:`dict` subclasses that normalize keys before look-up or that supply a :" -"meth:`__missing__` method for unknown keys::" +"string formatting with any of Python's many dictionary-like objects such " +"as :class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:`~configparser.ConfigParser`, " +"or :mod:`dbm`. It is also useful with custom :class:`dict` subclasses that " +"normalize keys before look-up or that supply a :meth:`__missing__` method " +"for unknown keys::" msgstr "" #: ../../whatsnew/3.2.rst:463 @@ -711,16 +713,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:483 msgid "" -"(Suggested by Raymond Hettinger and implemented by Eric Smith in :issue:" -"`6081`.)" +"(Suggested by Raymond Hettinger and implemented by Eric Smith " +"in :issue:`6081`.)" msgstr "" #: ../../whatsnew/3.2.rst:486 msgid "" "The interpreter can now be started with a quiet option, ``-q``, to prevent " "the copyright and version information from being displayed in the " -"interactive mode. The option can be introspected using the :data:`sys." -"flags` attribute:" +"interactive mode. The option can be introspected using " +"the :data:`sys.flags` attribute:" msgstr "" #: ../../whatsnew/3.2.rst:490 @@ -745,11 +747,11 @@ msgstr "(由 Marcin Wojdyr 在 :issue:`1772833` 中貢獻)。" msgid "" "The :func:`hasattr` function works by calling :func:`getattr` and detecting " "whether an exception is raised. This technique allows it to detect methods " -"created dynamically by :meth:`~object.__getattr__` or :meth:`~object." -"__getattribute__` which would otherwise be absent from the class " -"dictionary. Formerly, *hasattr* would catch any exception, possibly masking " -"genuine errors. Now, *hasattr* has been tightened to only catch :exc:" -"`AttributeError` and let other exceptions pass through::" +"created dynamically by :meth:`~object.__getattr__` " +"or :meth:`~object.__getattribute__` which would otherwise be absent from the " +"class dictionary. Formerly, *hasattr* would catch any exception, possibly " +"masking genuine errors. Now, *hasattr* has been tightened to only " +"catch :exc:`AttributeError` and let other exceptions pass through::" msgstr "" #: ../../whatsnew/3.2.rst:508 @@ -783,10 +785,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:521 msgid "" -"The :func:`str` of a float or complex number is now the same as its :func:" -"`repr`. Previously, the :func:`str` form was shorter but that just caused " -"confusion and is no longer needed now that the shortest possible :func:" -"`repr` is displayed by default:" +"The :func:`str` of a float or complex number is now the same as " +"its :func:`repr`. Previously, the :func:`str` form was shorter but that just " +"caused confusion and is no longer needed now that the shortest " +"possible :func:`repr` is displayed by default:" msgstr "" #: ../../whatsnew/3.2.rst:532 @@ -851,11 +853,11 @@ msgstr "(請見 :issue:`4617`。)" #: ../../whatsnew/3.2.rst:569 msgid "" ":ref:`Struct sequence types <struct-sequence-objects>` are now subclasses of " -"tuple. This means that C structures like those returned by :func:`os.stat`, :" -"func:`time.gmtime`, and :data:`sys.version_info` now work like a :term:" -"`named tuple` and now work with functions and methods that expect a tuple as " -"an argument. This is a big step forward in making the C structures as " -"flexible as their pure Python counterparts:" +"tuple. This means that C structures like those returned " +"by :func:`os.stat`, :func:`time.gmtime`, and :data:`sys.version_info` now " +"work like a :term:`named tuple` and now work with functions and methods that " +"expect a tuple as an argument. This is a big step forward in making the C " +"structures as flexible as their pure Python counterparts:" msgstr "" #: ../../whatsnew/3.2.rst:582 @@ -878,8 +880,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:592 msgid "" -"(Suggested by Barry Warsaw and implemented by Philip Jenvey in :issue:" -"`7301`.)" +"(Suggested by Barry Warsaw and implemented by Philip Jenvey " +"in :issue:`7301`.)" msgstr "" #: ../../whatsnew/3.2.rst:594 @@ -893,10 +895,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:600 msgid "" -"A :exc:`ResourceWarning` is issued at interpreter shutdown if the :data:`gc." -"garbage` list isn't empty, and if :const:`gc.DEBUG_UNCOLLECTABLE` is set, " -"all uncollectable objects are printed. This is meant to make the programmer " -"aware that their code contains object finalization issues." +"A :exc:`ResourceWarning` is issued at interpreter shutdown if " +"the :data:`gc.garbage` list isn't empty, and " +"if :const:`gc.DEBUG_UNCOLLECTABLE` is set, all uncollectable objects are " +"printed. This is meant to make the programmer aware that their code " +"contains object finalization issues." msgstr "" #: ../../whatsnew/3.2.rst:605 @@ -923,19 +926,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:619 msgid "" -"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` and :issue:" -"`477863`.)" +"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` " +"and :issue:`477863`.)" msgstr "" #: ../../whatsnew/3.2.rst:621 msgid "" ":class:`range` objects now support *index* and *count* methods. This is part " -"of an effort to make more objects fully implement the :class:`collections." -"Sequence <collections.abc.Sequence>` :term:`abstract base class`. As a " -"result, the language will have a more uniform API. In addition, :class:" -"`range` objects now support slicing and negative indices, even with values " -"larger than :data:`sys.maxsize`. This makes *range* more interoperable with " -"lists::" +"of an effort to make more objects fully implement " +"the :class:`collections.Sequence <collections.abc.Sequence>` :term:`abstract " +"base class`. As a result, the language will have a more uniform API. In " +"addition, :class:`range` objects now support slicing and negative indices, " +"even with values larger than :data:`sys.maxsize`. This makes *range* more " +"interoperable with lists::" msgstr "" #: ../../whatsnew/3.2.rst:628 @@ -963,8 +966,8 @@ msgid "" "(Contributed by Daniel Stutzbach in :issue:`9213`, by Alexander Belopolsky " "in :issue:`2690`, and by Nick Coghlan in :issue:`10889`.)" msgstr "" -"(由 Daniel Stutzbach 在 :issue:`9213`、Alexander Belopolsky 在 :issue:" -"`2690`、Nick Coghlan 在 :issue:`10889` 中貢獻。)" +"(由 Daniel Stutzbach 在 :issue:`9213`、Alexander Belopolsky " +"在 :issue:`2690`、Nick Coghlan 在 :issue:`10889` 中貢獻。)" #: ../../whatsnew/3.2.rst:640 msgid "" @@ -1000,10 +1003,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:664 msgid "" -"The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" -"`mailbox` module, and :mod:`!nntplib` modules now work correctly with the " -"bytes/text model in Python 3. For the first time, there is correct handling " -"of messages with mixed encodings." +"The biggest news for Python 3.2 is that the :mod:`email` " +"package, :mod:`mailbox` module, and :mod:`!nntplib` modules now work " +"correctly with the bytes/text model in Python 3. For the first time, there " +"is correct handling of messages with mixed encodings." msgstr "" #: ../../whatsnew/3.2.rst:669 @@ -1034,18 +1037,19 @@ msgstr "email" msgid "" "The usability of the :mod:`email` package in Python 3 has been mostly fixed " "by the extensive efforts of R. David Murray. The problem was that emails " -"are typically read and stored in the form of :class:`bytes` rather than :" -"class:`str` text, and they may contain multiple encodings within a single " -"email. So, the email package had to be extended to parse and generate email " -"messages in bytes format." +"are typically read and stored in the form of :class:`bytes` rather " +"than :class:`str` text, and they may contain multiple encodings within a " +"single email. So, the email package had to be extended to parse and " +"generate email messages in bytes format." msgstr "" #: ../../whatsnew/3.2.rst:690 msgid "" -"New functions :func:`~email.message_from_bytes` and :func:`~email." -"message_from_binary_file`, and new classes :class:`~email.parser." -"BytesFeedParser` and :class:`~email.parser.BytesParser` allow binary message " -"data to be parsed into model objects." +"New functions :func:`~email.message_from_bytes` " +"and :func:`~email.message_from_binary_file`, and new " +"classes :class:`~email.parser.BytesFeedParser` " +"and :class:`~email.parser.BytesParser` allow binary message data to be " +"parsed into model objects." msgstr "" #: ../../whatsnew/3.2.rst:695 @@ -1065,31 +1069,31 @@ msgstr "" #: ../../whatsnew/3.2.rst:704 msgid "" -"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ -" -"encoded using the *unknown-8bit* character set." +"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ " +"-encoded using the *unknown-8bit* character set." msgstr "" #: ../../whatsnew/3.2.rst:707 msgid "" "A new class :class:`~email.generator.BytesGenerator` produces bytes as " "output, preserving any unchanged non-ASCII data that was present in the " -"input used to build the model, including message bodies with a :mailheader:" -"`Content-Transfer-Encoding` of *8bit*." +"input used to build the model, including message bodies with " +"a :mailheader:`Content-Transfer-Encoding` of *8bit*." msgstr "" #: ../../whatsnew/3.2.rst:712 msgid "" "The :mod:`smtplib` :class:`~smtplib.SMTP` class now accepts a byte string " "for the *msg* argument to the :meth:`~smtplib.SMTP.sendmail` method, and a " -"new method, :meth:`~smtplib.SMTP.send_message` accepts a :class:`~email." -"message.Message` object and can optionally obtain the *from_addr* and " -"*to_addrs* addresses directly from the object." +"new method, :meth:`~smtplib.SMTP.send_message` accepts " +"a :class:`~email.message.Message` object and can optionally obtain the " +"*from_addr* and *to_addrs* addresses directly from the object." msgstr "" #: ../../whatsnew/3.2.rst:718 msgid "" -"(Proposed and implemented by R. David Murray, :issue:`4661` and :issue:" -"`10321`.)" +"(Proposed and implemented by R. David Murray, :issue:`4661` " +"and :issue:`10321`.)" msgstr "" #: ../../whatsnew/3.2.rst:721 @@ -1098,8 +1102,8 @@ msgstr "elementtree" #: ../../whatsnew/3.2.rst:723 msgid "" -"The :mod:`xml.etree.ElementTree` package and its :mod:`!xml.etree." -"cElementTree` counterpart have been updated to version 1.3." +"The :mod:`xml.etree.ElementTree` package and its :mod:`!" +"xml.etree.cElementTree` counterpart have been updated to version 1.3." msgstr "" #: ../../whatsnew/3.2.rst:726 @@ -1168,9 +1172,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:749 msgid "" -"For details of the update, see `Introducing ElementTree <https://web.archive." -"org/web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm>`_ on " -"Fredrik Lundh's website." +"For details of the update, see `Introducing ElementTree <https://" +"web.archive.org/web/20200703234532/http://effbot.org/zone/elementtree-13-" +"intro.htm>`_ on Fredrik Lundh's website." msgstr "" #: ../../whatsnew/3.2.rst:753 @@ -1209,20 +1213,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:786 msgid "" "(Contributed by Raymond Hettinger and incorporating design ideas from Jim " -"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 <https://code." -"activestate.com/recipes/498245-lru-and-lfu-cache-decorators/>`_\\, `recipe " -"577479 <https://code.activestate.com/recipes/577479-simple-caching-decorator/" -">`_\\, :issue:`10586`, and :issue:`10593`.)" +"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 <https://" +"code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators/>`_\\, " +"`recipe 577479 <https://code.activestate.com/recipes/577479-simple-caching-" +"decorator/>`_\\, :issue:`10586`, and :issue:`10593`.)" msgstr "" #: ../../whatsnew/3.2.rst:792 msgid "" "The :func:`functools.wraps` decorator now adds a :attr:`__wrapped__` " "attribute pointing to the original callable function. This allows wrapped " -"functions to be introspected. It also copies :attr:`~function." -"__annotations__` if defined. And now it also gracefully skips over missing " -"attributes such as :attr:`~function.__doc__` which might not be defined for " -"the wrapped callable." +"functions to be introspected. It also " +"copies :attr:`~function.__annotations__` if defined. And now it also " +"gracefully skips over missing attributes such as :attr:`~function.__doc__` " +"which might not be defined for the wrapped callable." msgstr "" #: ../../whatsnew/3.2.rst:799 @@ -1233,21 +1237,22 @@ msgstr "" #: ../../whatsnew/3.2.rst:804 msgid "" -"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, and :issue:" -"`8814`.)" +"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, " +"and :issue:`8814`.)" msgstr "" #: ../../whatsnew/3.2.rst:807 msgid "" -"To help write classes with rich comparison methods, a new decorator :func:" -"`functools.total_ordering` will use existing equality and inequality methods " -"to fill in the remaining methods." +"To help write classes with rich comparison methods, a new " +"decorator :func:`functools.total_ordering` will use existing equality and " +"inequality methods to fill in the remaining methods." msgstr "" #: ../../whatsnew/3.2.rst:811 msgid "" -"For example, supplying *__eq__* and *__lt__* will enable :func:`~functools." -"total_ordering` to fill-in *__le__*, *__gt__* and *__ge__*::" +"For example, supplying *__eq__* and *__lt__* will " +"enable :func:`~functools.total_ordering` to fill-in *__le__*, *__gt__* and " +"*__ge__*::" msgstr "" #: ../../whatsnew/3.2.rst:814 @@ -1328,18 +1333,19 @@ msgstr "collections" msgid "" "The :class:`collections.Counter` class now has two forms of in-place " "subtraction, the existing *-=* operator for `saturating subtraction <https://" -"en.wikipedia.org/wiki/Saturation_arithmetic>`_ and the new :meth:" -"`~collections.Counter.subtract` method for regular subtraction. The former " -"is suitable for `multisets <https://en.wikipedia.org/wiki/Multiset>`_ which " -"only have positive counts, and the latter is more suitable for use cases " -"that allow negative counts:" +"en.wikipedia.org/wiki/Saturation_arithmetic>`_ and the " +"new :meth:`~collections.Counter.subtract` method for regular subtraction. " +"The former is suitable for `multisets <https://en.wikipedia.org/wiki/" +"Multiset>`_ which only have positive counts, and the latter is more suitable " +"for use cases that allow negative counts:" msgstr "" #: ../../whatsnew/3.2.rst:885 msgid "" -"The :class:`collections.OrderedDict` class has a new method :meth:" -"`~collections.OrderedDict.move_to_end` which takes an existing key and moves " -"it to either the first or last position in the ordered sequence." +"The :class:`collections.OrderedDict` class has a new " +"method :meth:`~collections.OrderedDict.move_to_end` which takes an existing " +"key and moves it to either the first or last position in the ordered " +"sequence." msgstr "" #: ../../whatsnew/3.2.rst:889 @@ -1357,9 +1363,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:906 msgid "" -"The :class:`collections.deque` class grew two new methods :meth:" -"`~collections.deque.count` and :meth:`~collections.deque.reverse` that make " -"them more substitutable for :class:`list` objects:" +"The :class:`collections.deque` class grew two new " +"methods :meth:`~collections.deque.count` " +"and :meth:`~collections.deque.reverse` that make them more substitutable " +"for :class:`list` objects:" msgstr "" #: ../../whatsnew/3.2.rst:921 @@ -1495,8 +1502,8 @@ msgid "" ">>> from datetime import datetime, timezone\n" "\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" "datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" @@ -1504,17 +1511,17 @@ msgstr "" ">>> from datetime import datetime, timezone\n" "\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" "datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" #: ../../whatsnew/3.2.rst:1003 msgid "" -"Also, :class:`~datetime.timedelta` objects can now be multiplied by :class:" -"`float` and divided by :class:`float` and :class:`int` objects. And :class:" -"`~datetime.timedelta` objects can now divide one another." +"Also, :class:`~datetime.timedelta` objects can now be multiplied " +"by :class:`float` and divided by :class:`float` and :class:`int` objects. " +"And :class:`~datetime.timedelta` objects can now divide one another." msgstr "" #: ../../whatsnew/3.2.rst:1007 @@ -1533,9 +1540,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1015 msgid "" -"Starting with Py3.2, use of the century guessing heuristic will emit a :exc:" -"`DeprecationWarning`. Instead, it is recommended that :data:`!time." -"accept2dyear` be set to ``False`` so that large date ranges can be used " +"Starting with Py3.2, use of the century guessing heuristic will emit " +"a :exc:`DeprecationWarning`. Instead, it is recommended that :data:`!" +"time.accept2dyear` be set to ``False`` so that large date ranges can be used " "without guesswork::" msgstr "" @@ -1560,20 +1567,20 @@ msgstr "" msgid "" "Several functions now have significantly expanded date ranges. When :data:`!" "time.accept2dyear` is false, the :func:`time.asctime` function will accept " -"any year that fits in a C int, while the :func:`time.mktime` and :func:`time." -"strftime` functions will accept the full range supported by the " -"corresponding operating system functions." +"any year that fits in a C int, while the :func:`time.mktime` " +"and :func:`time.strftime` functions will accept the full range supported by " +"the corresponding operating system functions." msgstr "" #: ../../whatsnew/3.2.rst:1040 msgid "" -"(Contributed by Alexander Belopolsky and Victor Stinner in :issue:" -"`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :" -"issue:`8013`, and :issue:`10827`.)" +"(Contributed by Alexander Belopolsky and Victor Stinner " +"in :issue:`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :issue:`8013`, " +"and :issue:`10827`.)" msgstr "" -"(由 Alexander Belopolsky 和 Victor Stinner 在 :issue:`1289118`、:issue:" -"`5094`、:issue:`6641`、:issue:`2706`、:issue:`1777412`、:issue:`8013` 和 :" -"issue:`10827` 中貢獻。)" +"(由 Alexander Belopolsky 和 Victor Stinner " +"在 :issue:`1289118`、:issue:`5094`、:issue:`6641`、:issue:`2706`、:issue:`1777412`、:issue:`8013` " +"和 :issue:`10827` 中貢獻。)" #: ../../whatsnew/3.2.rst:1047 msgid "math" @@ -1638,8 +1645,8 @@ msgstr "abc" #: ../../whatsnew/3.2.rst:1100 msgid "" -"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` and :" -"func:`~abc.abstractstaticmethod`." +"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` " +"and :func:`~abc.abstractstaticmethod`." msgstr "" #: ../../whatsnew/3.2.rst:1103 @@ -1739,9 +1746,9 @@ msgstr "reprlib" msgid "" "When writing a :meth:`~object.__repr__` method for a custom container, it is " "easy to forget to handle the case where a member refers back to the " -"container itself. Python's builtin objects such as :class:`list` and :class:" -"`set` handle self-reference by displaying \"...\" in the recursive part of " -"the representation string." +"container itself. Python's builtin objects such as :class:`list` " +"and :class:`set` handle self-reference by displaying \"...\" in the " +"recursive part of the representation string." msgstr "" #: ../../whatsnew/3.2.rst:1157 @@ -1786,8 +1793,8 @@ msgstr "logging" #: ../../whatsnew/3.2.rst:1177 msgid "" -"In addition to dictionary-based configuration described above, the :mod:" -"`logging` package has many other improvements." +"In addition to dictionary-based configuration described above, " +"the :mod:`logging` package has many other improvements." msgstr "" #: ../../whatsnew/3.2.rst:1180 @@ -1802,42 +1809,42 @@ msgstr "" msgid "" "The :func:`logging.basicConfig` set-up function gained a *style* argument to " "support three different types of string formatting. It defaults to \"%\" " -"for traditional %-formatting, can be set to \"{\" for the new :meth:`str." -"format` style, or can be set to \"$\" for the shell-style formatting " -"provided by :class:`string.Template`. The following three configurations " -"are equivalent::" +"for traditional %-formatting, can be set to \"{\" for the " +"new :meth:`str.format` style, or can be set to \"$\" for the shell-style " +"formatting provided by :class:`string.Template`. The following three " +"configurations are equivalent::" msgstr "" #: ../../whatsnew/3.2.rst:1191 msgid "" ">>> from logging import basicConfig\n" -">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " -"%(message)s\")\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" ">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" ">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" msgstr "" ">>> from logging import basicConfig\n" -">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " -"%(message)s\")\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" ">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" ">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" #: ../../whatsnew/3.2.rst:1196 msgid "" "If no configuration is set-up before a logging event occurs, there is now a " -"default configuration using a :class:`~logging.StreamHandler` directed to :" -"data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, an " -"event occurring before a configuration was set-up would either raise an " -"exception or silently drop the event depending on the value of :data:" -"`logging.raiseExceptions`. The new default handler is stored in :data:" -"`logging.lastResort`." +"default configuration using a :class:`~logging.StreamHandler` directed " +"to :data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, " +"an event occurring before a configuration was set-up would either raise an " +"exception or silently drop the event depending on the value " +"of :data:`logging.raiseExceptions`. The new default handler is stored " +"in :data:`logging.lastResort`." msgstr "" #: ../../whatsnew/3.2.rst:1204 msgid "" -"The use of filters has been simplified. Instead of creating a :class:" -"`~logging.Filter` object, the predicate can be any Python callable that " -"returns ``True`` or ``False``." +"The use of filters has been simplified. Instead of creating " +"a :class:`~logging.Filter` object, the predicate can be any Python callable " +"that returns ``True`` or ``False``." msgstr "" #: ../../whatsnew/3.2.rst:1208 @@ -1853,16 +1860,17 @@ msgstr "csv" #: ../../whatsnew/3.2.rst:1215 msgid "" -"The :mod:`csv` module now supports a new dialect, :class:`~csv." -"unix_dialect`, which applies quoting for all fields and a traditional Unix " -"style with ``'\\n'`` as the line terminator. The registered dialect name is " -"``unix``." +"The :mod:`csv` module now supports a new " +"dialect, :class:`~csv.unix_dialect`, which applies quoting for all fields " +"and a traditional Unix style with ``'\\n'`` as the line terminator. The " +"registered dialect name is ``unix``." msgstr "" #: ../../whatsnew/3.2.rst:1219 msgid "" -"The :class:`csv.DictWriter` has a new method, :meth:`~csv.DictWriter." -"writeheader` for writing-out an initial row to document the field names::" +"The :class:`csv.DictWriter` has a new " +"method, :meth:`~csv.DictWriter.writeheader` for writing-out an initial row " +"to document the field names::" msgstr "" #: ../../whatsnew/3.2.rst:1223 @@ -1899,15 +1907,16 @@ msgstr "contextlib" #: ../../whatsnew/3.2.rst:1239 msgid "" -"There is a new and slightly mind-blowing tool :class:`~contextlib." -"ContextDecorator` that is helpful for creating a :term:`context manager` " -"that does double duty as a function decorator." +"There is a new and slightly mind-blowing " +"tool :class:`~contextlib.ContextDecorator` that is helpful for creating " +"a :term:`context manager` that does double duty as a function decorator." msgstr "" #: ../../whatsnew/3.2.rst:1243 msgid "" -"As a convenience, this new functionality is used by :func:`~contextlib." -"contextmanager` so that no extra effort is needed to support both roles." +"As a convenience, this new functionality is used " +"by :func:`~contextlib.contextmanager` so that no extra effort is needed to " +"support both roles." msgstr "" #: ../../whatsnew/3.2.rst:1247 @@ -2016,10 +2025,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:1303 msgid "" -"Some of the hashing details are exposed through a new attribute, :data:`sys." -"hash_info`, which describes the bit width of the hash value, the prime " -"modulus, the hash values for *infinity* and *nan*, and the multiplier used " -"for the imaginary part of a number:" +"Some of the hashing details are exposed through a new " +"attribute, :data:`sys.hash_info`, which describes the bit width of the hash " +"value, the prime modulus, the hash values for *infinity* and *nan*, and the " +"multiplier used for the imaginary part of a number:" msgstr "" #: ../../whatsnew/3.2.rst:1311 @@ -2036,30 +2045,32 @@ msgstr "" #: ../../whatsnew/3.2.rst:1319 msgid "" "The :class:`decimal.Decimal` constructor now accepts :class:`float` objects " -"directly so there in no longer a need to use the :meth:`~decimal.Decimal." -"from_float` method (:issue:`8257`)." +"directly so there in no longer a need to use " +"the :meth:`~decimal.Decimal.from_float` method (:issue:`8257`)." msgstr "" #: ../../whatsnew/3.2.rst:1323 msgid "" -"Mixed type comparisons are now fully supported so that :class:`~decimal." -"Decimal` objects can be directly compared with :class:`float` and :class:" -"`fractions.Fraction` (:issue:`2531` and :issue:`8188`)." +"Mixed type comparisons are now fully supported so " +"that :class:`~decimal.Decimal` objects can be directly compared " +"with :class:`float` and :class:`fractions.Fraction` (:issue:`2531` " +"and :issue:`8188`)." msgstr "" #: ../../whatsnew/3.2.rst:1327 msgid "" -"Similar changes were made to :class:`fractions.Fraction` so that the :meth:" -"`~fractions.Fraction.from_float` and :meth:`~fractions.Fraction." -"from_decimal` methods are no longer needed (:issue:`8294`):" +"Similar changes were made to :class:`fractions.Fraction` so that " +"the :meth:`~fractions.Fraction.from_float` " +"and :meth:`~fractions.Fraction.from_decimal` methods are no longer needed " +"(:issue:`8294`):" msgstr "" #: ../../whatsnew/3.2.rst:1338 msgid "" -"Another useful change for the :mod:`decimal` module is that the :attr:" -"`Context.clamp <decimal.Context.clamp>` attribute is now public. This is " -"useful in creating contexts that correspond to the decimal interchange " -"formats specified in IEEE 754 (see :issue:`8540`)." +"Another useful change for the :mod:`decimal` module is that " +"the :attr:`Context.clamp <decimal.Context.clamp>` attribute is now public. " +"This is useful in creating contexts that correspond to the decimal " +"interchange formats specified in IEEE 754 (see :issue:`8540`)." msgstr "" #: ../../whatsnew/3.2.rst:1343 @@ -2103,8 +2114,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1363 msgid "" -"Other file-like objects such as :class:`mmap.mmap` and :func:`fileinput." -"input` also grew auto-closing context managers::" +"Other file-like objects such as :class:`mmap.mmap` " +"and :func:`fileinput.input` also grew auto-closing context managers::" msgstr "" #: ../../whatsnew/3.2.rst:1366 @@ -2143,14 +2154,14 @@ msgstr "popen" #: ../../whatsnew/3.2.rst:1382 msgid "" -"The :func:`os.popen` and :func:`subprocess.Popen` functions now support :" -"keyword:`with` statements for auto-closing of the file descriptors." +"The :func:`os.popen` and :func:`subprocess.Popen` functions now " +"support :keyword:`with` statements for auto-closing of the file descriptors." msgstr "" #: ../../whatsnew/3.2.rst:1385 msgid "" -"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` and :issue:" -"`10554`.)" +"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` " +"and :issue:`10554`.)" msgstr "" "(由 Antoine Pitrou 和 Brian Curtin 在 :issue:`7461` 和 :issue:`10554` 中貢" "獻。)" @@ -2161,10 +2172,10 @@ msgstr "select" #: ../../whatsnew/3.2.rst:1391 msgid "" -"The :mod:`select` module now exposes a new, constant attribute, :const:" -"`~select.PIPE_BUF`, which gives the minimum number of bytes which are " -"guaranteed not to block when :func:`select.select` says a pipe is ready for " -"writing." +"The :mod:`select` module now exposes a new, constant " +"attribute, :const:`~select.PIPE_BUF`, which gives the minimum number of " +"bytes which are guaranteed not to block when :func:`select.select` says a " +"pipe is ready for writing." msgstr "" #: ../../whatsnew/3.2.rst:1400 @@ -2177,16 +2188,16 @@ msgstr "gzip 和 zipfile" #: ../../whatsnew/3.2.rst:1405 msgid "" -":class:`gzip.GzipFile` now implements the :class:`io.BufferedIOBase` :term:" -"`abstract base class` (except for ``truncate()``). It also has a :meth:" -"`~gzip.GzipFile.peek` method and supports unseekable as well as zero-padded " -"file objects." +":class:`gzip.GzipFile` now implements " +"the :class:`io.BufferedIOBase` :term:`abstract base class` (except for " +"``truncate()``). It also has a :meth:`~gzip.GzipFile.peek` method and " +"supports unseekable as well as zero-padded file objects." msgstr "" #: ../../whatsnew/3.2.rst:1410 msgid "" -"The :mod:`gzip` module also gains the :func:`~gzip.compress` and :func:" -"`~gzip.decompress` functions for easier in-memory compression and " +"The :mod:`gzip` module also gains the :func:`~gzip.compress` " +"and :func:`~gzip.decompress` functions for easier in-memory compression and " "decompression. Keep in mind that text needs to be encoded as :class:`bytes` " "before compressing and decompressing:" msgstr "" @@ -2198,16 +2209,17 @@ msgid "" "and :issue:`2846`.)" msgstr "" "(由 Anand B. Pillai 在 :issue:`3488` 中貢獻;由 Antoine Pitrou、Nir Aides " -"和 Brian Curtin 在 :issue:`9962`、:issue:`1675951`、:issue:`7471` 和 :issue:" -"`2846` 中貢獻。)" +"和 Brian Curtin 在 :issue:`9962`、:issue:`1675951`、:issue:`7471` " +"和 :issue:`2846` 中貢獻。)" #: ../../whatsnew/3.2.rst:1431 msgid "" "Also, the :class:`zipfile.ZipExtFile <zipfile.ZipFile.open>` class was " "reworked internally to represent files stored inside an archive. The new " -"implementation is significantly faster and can be wrapped in an :class:`io." -"BufferedReader` object for more speedups. It also solves an issue where " -"interleaved calls to *read* and *readline* gave the wrong results." +"implementation is significantly faster and can be wrapped in " +"an :class:`io.BufferedReader` object for more speedups. It also solves an " +"issue where interleaved calls to *read* and *readline* gave the wrong " +"results." msgstr "" #: ../../whatsnew/3.2.rst:1437 @@ -2231,9 +2243,9 @@ msgid "" "The new *filter* option replaces the older, less flexible *exclude* " "parameter which is now deprecated. If specified, the optional *filter* " "parameter needs to be a :term:`keyword argument`. The user-supplied filter " -"function accepts a :class:`~tarfile.TarInfo` object and returns an updated :" -"class:`~tarfile.TarInfo` object, or if it wants the file to be excluded, the " -"function can return ``None``::" +"function accepts a :class:`~tarfile.TarInfo` object and returns an " +"updated :class:`~tarfile.TarInfo` object, or if it wants the file to be " +"excluded, the function can return ``None``::" msgstr "" #: ../../whatsnew/3.2.rst:1454 @@ -2309,11 +2321,12 @@ msgstr "ast" #: ../../whatsnew/3.2.rst:1496 msgid "" "The :mod:`ast` module has a wonderful a general-purpose tool for safely " -"evaluating expression strings using the Python literal syntax. The :func:" -"`ast.literal_eval` function serves as a secure alternative to the builtin :" -"func:`eval` function which is easily abused. Python 3.2 adds :class:`bytes` " -"and :class:`set` literals to the list of supported types: strings, bytes, " -"numbers, tuples, lists, dicts, sets, booleans, and ``None``." +"evaluating expression strings using the Python literal syntax. " +"The :func:`ast.literal_eval` function serves as a secure alternative to the " +"builtin :func:`eval` function which is easily abused. Python 3.2 " +"adds :class:`bytes` and :class:`set` literals to the list of supported " +"types: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and " +"``None``." msgstr "" #: ../../whatsnew/3.2.rst:1505 @@ -2353,9 +2366,9 @@ msgstr "os" #: ../../whatsnew/3.2.rst:1522 msgid "" "Different operating systems use various encodings for filenames and " -"environment variables. The :mod:`os` module provides two new functions, :" -"func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and decoding " -"filenames:" +"environment variables. The :mod:`os` module provides two new " +"functions, :func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and " +"decoding filenames:" msgstr "" #: ../../whatsnew/3.2.rst:1532 @@ -2393,8 +2406,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1551 msgid "" -"*copy_function*: is a callable that will be used to copy files. :func:" -"`shutil.copy2` is used by default." +"*copy_function*: is a callable that will be used to copy " +"files. :func:`shutil.copy2` is used by default." msgstr "" #: ../../whatsnew/3.2.rst:1554 ../../whatsnew/3.2.rst:1592 @@ -2412,11 +2425,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:1561 msgid "" -"The principal functions are :func:`~shutil.make_archive` and :func:`~shutil." -"unpack_archive`. By default, both operate on the current directory (which " -"can be set by :func:`os.chdir`) and on any sub-directories. The archive " -"filename needs to be specified with a full pathname. The archiving step is " -"non-destructive (the original files are left unchanged)." +"The principal functions are :func:`~shutil.make_archive` " +"and :func:`~shutil.unpack_archive`. By default, both operate on the current " +"directory (which can be set by :func:`os.chdir`) and on any sub-directories. " +"The archive filename needs to be specified with a full pathname. The " +"archiving step is non-destructive (the original files are left unchanged)." msgstr "" #: ../../whatsnew/3.2.rst:1569 @@ -2463,10 +2476,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:1602 msgid "" -"The :meth:`sqlite3.Connection.enable_load_extension` and :meth:`sqlite3." -"Connection.load_extension` methods allows you to load SQLite extensions from " -"\".so\" files. One well-known extension is the fulltext-search extension " -"distributed with SQLite." +"The :meth:`sqlite3.Connection.enable_load_extension` " +"and :meth:`sqlite3.Connection.load_extension` methods allows you to load " +"SQLite extensions from \".so\" files. One well-known extension is the " +"fulltext-search extension distributed with SQLite." msgstr "" #: ../../whatsnew/3.2.rst:1607 @@ -2479,9 +2492,9 @@ msgstr "html" #: ../../whatsnew/3.2.rst:1612 msgid "" -"A new :mod:`html` module was introduced with only a single function, :func:" -"`~html.escape`, which is used for escaping reserved characters from HTML " -"markup:" +"A new :mod:`html` module was introduced with only a single " +"function, :func:`~html.escape`, which is used for escaping reserved " +"characters from HTML markup:" msgstr "" #: ../../whatsnew/3.2.rst:1621 @@ -2552,8 +2565,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1661 msgid "" -"Various options have been added to the :mod:`ssl` module, such as :data:" -"`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 protocol." +"Various options have been added to the :mod:`ssl` module, such " +"as :data:`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 " +"protocol." msgstr "" #: ../../whatsnew/3.2.rst:1665 @@ -2566,18 +2580,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:1669 msgid "" "The version of OpenSSL being used is now accessible using the module " -"attributes :const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl." -"OPENSSL_VERSION_INFO` (a 5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` " -"(an integer)." +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer)." msgstr "" #: ../../whatsnew/3.2.rst:1674 msgid "" -"(Contributed by Antoine Pitrou in :issue:`8850`, :issue:`1589`, :issue:" -"`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, and :issue:`8321`.)" +"(Contributed by Antoine Pitrou " +"in :issue:`8850`, :issue:`1589`, :issue:`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, " +"and :issue:`8321`.)" msgstr "" -"(由 Antoine Pitrou 在 :issue:`8850`、:issue:`1589`、:issue:`8322`、:issue:" -"`5639`、:issue:`4870`、:issue:`8484` 和 :issue:`8321` 中貢獻。)" +"(由 Antoine Pitrou " +"在 :issue:`8850`、:issue:`1589`、:issue:`8322`、:issue:`5639`、:issue:`4870`、:issue:`8484` " +"和 :issue:`8321` 中貢獻。)" #: ../../whatsnew/3.2.rst:1678 msgid "nntp" @@ -2593,15 +2609,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:1685 msgid "" -"Support for secure connections through both implicit (using :class:`!nntplib." -"NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS has also " -"been added." +"Support for secure connections through both implicit (using :class:`!" +"nntplib.NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS " +"has also been added." msgstr "" #: ../../whatsnew/3.2.rst:1689 msgid "" -"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant in :issue:" -"`1926`.)" +"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant " +"in :issue:`1926`.)" msgstr "" "(由 Antoine Pitrou 在 :issue:`9360` 中和 Andrew Vant 在 :issue:`1926` 中貢" "獻。)" @@ -2649,15 +2665,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:1716 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now have a *source_address* parameter for a (host, " -"port) tuple indicating where the HTTP connection is made from." +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now have a " +"*source_address* parameter for a (host, port) tuple indicating where the " +"HTTP connection is made from." msgstr "" #: ../../whatsnew/3.2.rst:1721 msgid "" -"Support for certificate checking and HTTPS virtual hosts were added to :" -"class:`~http.client.HTTPSConnection`." +"Support for certificate checking and HTTPS virtual hosts were added " +"to :class:`~http.client.HTTPSConnection`." msgstr "" #: ../../whatsnew/3.2.rst:1724 @@ -2672,9 +2689,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1731 msgid "" -"To establish an HTTPS connection through a proxy server, there is a new :" -"meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host and " -"port for HTTP Connect tunneling." +"To establish an HTTPS connection through a proxy server, there is a " +"new :meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host " +"and port for HTTP Connect tunneling." msgstr "" #: ../../whatsnew/3.2.rst:1735 @@ -2682,8 +2699,8 @@ msgid "" "To match the behavior of :mod:`http.server`, the HTTP client library now " "also encodes headers with ISO-8859-1 (Latin-1) encoding. It was already " "doing that for incoming headers, so now the behavior is consistent for both " -"incoming and outgoing traffic. (See work by Armin Ronacher in :issue:" -"`10980`.)" +"incoming and outgoing traffic. (See work by Armin Ronacher " +"in :issue:`10980`.)" msgstr "" #: ../../whatsnew/3.2.rst:1741 @@ -2719,15 +2736,17 @@ msgstr "(由 Michael Foord 貢獻。)" #: ../../whatsnew/3.2.rst:1761 msgid "" -"Experimentation at the interactive prompt is now easier because the :class:" -"`unittest.TestCase` class can now be instantiated without arguments:" +"Experimentation at the interactive prompt is now easier because " +"the :class:`unittest.TestCase` class can now be instantiated without " +"arguments:" msgstr "" #: ../../whatsnew/3.2.rst:1770 msgid "" -"The :mod:`unittest` module has two new methods, :meth:`~unittest.TestCase." -"assertWarns` and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that " -"a given warning type is triggered by the code under test::" +"The :mod:`unittest` module has two new " +"methods, :meth:`~unittest.TestCase.assertWarns` " +"and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that a given " +"warning type is triggered by the code under test::" msgstr "" #: ../../whatsnew/3.2.rst:1775 @@ -2776,12 +2795,13 @@ msgstr "" #: ../../whatsnew/3.2.rst:1799 msgid "" -"For example, :meth:`~unittest.TestCase.assertRegex` is the new name for :" -"meth:`!assertRegexpMatches` which was misnamed because the test uses :func:" -"`re.search`, not :func:`re.match`. Other methods using regular expressions " -"are now named using short form \"Regex\" in preference to \"Regexp\" -- this " -"matches the names used in other unittest implementations, matches Python's " -"old name for the :mod:`re` module, and it has unambiguous camel-casing." +"For example, :meth:`~unittest.TestCase.assertRegex` is the new name " +"for :meth:`!assertRegexpMatches` which was misnamed because the test " +"uses :func:`re.search`, not :func:`re.match`. Other methods using regular " +"expressions are now named using short form \"Regex\" in preference to " +"\"Regexp\" -- this matches the names used in other unittest implementations, " +"matches Python's old name for the :mod:`re` module, and it has unambiguous " +"camel-casing." msgstr "" #: ../../whatsnew/3.2.rst:1807 @@ -2856,8 +2876,8 @@ msgstr "(由 Ezio Melotti 貢獻;:issue:`9424`。)" msgid "" "The :meth:`!assertDictContainsSubset` method was deprecated because it was " "misimplemented with the arguments in the wrong order. This created hard-to-" -"debug optical illusions where tests like ``TestCase()." -"assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." +"debug optical illusions where tests like " +"``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." msgstr "" #: ../../whatsnew/3.2.rst:1835 @@ -2871,9 +2891,9 @@ msgid "" "``int(n*random())`` which had a slight bias whenever *n* was not a power of " "two. Now, multiple selections are made from a range up to the next power of " "two and a selection is kept only when it falls within the range ``0 <= x < " -"n``. The functions and methods affected are :func:`~random.randrange`, :" -"func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` and :" -"func:`~random.sample`." +"n``. The functions and methods affected " +"are :func:`~random.randrange`, :func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` " +"and :func:`~random.sample`." msgstr "" #: ../../whatsnew/3.2.rst:1846 @@ -2919,9 +2939,9 @@ msgstr "tempfile" #: ../../whatsnew/3.2.rst:1873 msgid "" -"The :mod:`tempfile` module has a new context manager, :class:`~tempfile." -"TemporaryDirectory` which provides easy deterministic cleanup of temporary " -"directories::" +"The :mod:`tempfile` module has a new context " +"manager, :class:`~tempfile.TemporaryDirectory` which provides easy " +"deterministic cleanup of temporary directories::" msgstr "" #: ../../whatsnew/3.2.rst:1877 @@ -2942,9 +2962,9 @@ msgstr "inspect" #: ../../whatsnew/3.2.rst:1885 msgid "" -"The :mod:`inspect` module has a new function :func:`~inspect." -"getgeneratorstate` to easily identify the current state of a generator-" -"iterator::" +"The :mod:`inspect` module has a new " +"function :func:`~inspect.getgeneratorstate` to easily identify the current " +"state of a generator-iterator::" msgstr "" #: ../../whatsnew/3.2.rst:1889 @@ -2986,9 +3006,9 @@ msgstr "(由 Rodolfo Eckhardt 和 Nick Coghlan 於 :issue:`10220` 貢獻。) #: ../../whatsnew/3.2.rst:1906 msgid "" "To support lookups without the possibility of activating a dynamic " -"attribute, the :mod:`inspect` module has a new function, :func:`~inspect." -"getattr_static`. Unlike :func:`hasattr`, this is a true read-only search, " -"guaranteed not to change state while it is searching::" +"attribute, the :mod:`inspect` module has a new " +"function, :func:`~inspect.getattr_static`. Unlike :func:`hasattr`, this is a " +"true read-only search, guaranteed not to change state while it is searching::" msgstr "" #: ../../whatsnew/3.2.rst:1911 @@ -3044,10 +3064,11 @@ msgstr "dis" #: ../../whatsnew/3.2.rst:1942 msgid "" -"The :mod:`dis` module gained two new functions for inspecting code, :func:" -"`~dis.code_info` and :func:`~dis.show_code`. Both provide detailed code " -"object information for the supplied function, method, source code string or " -"code object. The former returns a string and the latter prints it::" +"The :mod:`dis` module gained two new functions for inspecting " +"code, :func:`~dis.code_info` and :func:`~dis.show_code`. Both provide " +"detailed code object information for the supplied function, method, source " +"code string or code object. The former returns a string and the latter " +"prints it::" msgstr "" #: ../../whatsnew/3.2.rst:1947 @@ -3392,8 +3413,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2117 msgid "" -":file:`pdb.py` now has a ``-c`` option that executes commands as given in a :" -"file:`.pdbrc` script file." +":file:`pdb.py` now has a ``-c`` option that executes commands as given in " +"a :file:`.pdbrc` script file." msgstr "" #: ../../whatsnew/3.2.rst:2119 @@ -3440,12 +3461,12 @@ msgstr "configparser" #: ../../whatsnew/3.2.rst:2135 msgid "" "The :mod:`configparser` module was modified to improve usability and " -"predictability of the default parser and its supported INI syntax. The old :" -"class:`!ConfigParser` class was removed in favor of :class:`!" -"SafeConfigParser` which has in turn been renamed to :class:`~configparser." -"ConfigParser`. Support for inline comments is now turned off by default and " -"section or option duplicates are not allowed in a single configuration " -"source." +"predictability of the default parser and its supported INI syntax. The " +"old :class:`!ConfigParser` class was removed in favor of :class:`!" +"SafeConfigParser` which has in turn been renamed " +"to :class:`~configparser.ConfigParser`. Support for inline comments is now " +"turned off by default and section or option duplicates are not allowed in a " +"single configuration source." msgstr "" #: ../../whatsnew/3.2.rst:2142 @@ -3610,8 +3631,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2223 msgid "" -"The :func:`~urllib.parse.urlparse` function now supports `IPv6 <https://en." -"wikipedia.org/wiki/IPv6>`_ addresses as described in :rfc:`2732`:" +"The :func:`~urllib.parse.urlparse` function now supports `IPv6 <https://" +"en.wikipedia.org/wiki/IPv6>`_ addresses as described in :rfc:`2732`:" msgstr "" #: ../../whatsnew/3.2.rst:2235 @@ -3642,8 +3663,8 @@ msgstr "" msgid "" "And, the :func:`~urllib.parse.urlencode` function is now much more flexible, " "accepting either a string or bytes type for the *query* argument. If it is " -"a string, then the *safe*, *encoding*, and *error* parameters are sent to :" -"func:`~urllib.parse.quote_plus` for encoding::" +"a string, then the *safe*, *encoding*, and *error* parameters are sent " +"to :func:`~urllib.parse.quote_plus` for encoding::" msgstr "" #: ../../whatsnew/3.2.rst:2250 @@ -3662,17 +3683,17 @@ msgstr "" #: ../../whatsnew/3.2.rst:2256 msgid "" -"As detailed in :ref:`parsing-ascii-encoded-bytes`, all the :mod:`urllib." -"parse` functions now accept ASCII-encoded byte strings as input, so long as " -"they are not mixed with regular strings. If ASCII-encoded byte strings are " -"given as parameters, the return types will also be an ASCII-encoded byte " -"strings:" +"As detailed in :ref:`parsing-ascii-encoded-bytes`, all " +"the :mod:`urllib.parse` functions now accept ASCII-encoded byte strings as " +"input, so long as they are not mixed with regular strings. If ASCII-encoded " +"byte strings are given as parameters, the return types will also be an ASCII-" +"encoded byte strings:" msgstr "" #: ../../whatsnew/3.2.rst:2265 msgid "" -"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in :issue:`2987`, :" -"issue:`5468`, and :issue:`9873`.)" +"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran " +"in :issue:`2987`, :issue:`5468`, and :issue:`9873`.)" msgstr "" #: ../../whatsnew/3.2.rst:2269 @@ -3697,8 +3718,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2280 msgid "" -"As expected, the :meth:`~mailbox.Mailbox.add` method for :class:`mailbox." -"Mailbox` objects now accepts binary input." +"As expected, the :meth:`~mailbox.Mailbox.add` method " +"for :class:`mailbox.Mailbox` objects now accepts binary input." msgstr "" #: ../../whatsnew/3.2.rst:2283 @@ -3710,19 +3731,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:2287 msgid "" -"There is also support for binary output. The :meth:`~mailbox.Mailbox." -"get_file` method now returns a file in the binary mode (where it used to " -"incorrectly set the file to text-mode). There is also a new :meth:`~mailbox." -"Mailbox.get_bytes` method that returns a :class:`bytes` representation of a " -"message corresponding to a given *key*." +"There is also support for binary output. " +"The :meth:`~mailbox.Mailbox.get_file` method now returns a file in the " +"binary mode (where it used to incorrectly set the file to text-mode). There " +"is also a new :meth:`~mailbox.Mailbox.get_bytes` method that returns " +"a :class:`bytes` representation of a message corresponding to a given *key*." msgstr "" #: ../../whatsnew/3.2.rst:2293 msgid "" -"It is still possible to get non-binary output using the old API's :meth:" -"`~mailbox.Mailbox.get_string` method, but that approach is not very useful. " -"Instead, it is best to extract messages from a :class:`~mailbox.Message` " -"object or to load them from binary input." +"It is still possible to get non-binary output using the old " +"API's :meth:`~mailbox.Mailbox.get_string` method, but that approach is not " +"very useful. Instead, it is best to extract messages from " +"a :class:`~mailbox.Message` object or to load them from binary input." msgstr "" #: ../../whatsnew/3.2.rst:2298 @@ -3764,8 +3785,9 @@ msgid "" "intervals and reduced overhead due to lock contention and the number of " "ensuing system calls. The notion of a \"check interval\" to allow thread " "switches has been abandoned and replaced by an absolute duration expressed " -"in seconds. This parameter is tunable through :func:`sys." -"setswitchinterval`. It currently defaults to 5 milliseconds." +"in seconds. This parameter is tunable " +"through :func:`sys.setswitchinterval`. It currently defaults to 5 " +"milliseconds." msgstr "" #: ../../whatsnew/3.2.rst:2327 @@ -3850,13 +3872,13 @@ msgid "" "(Contributed by Alexandre Vassalotti, Antoine Pitrou and the Unladen Swallow " "team in :issue:`9410` and :issue:`3873`.)" msgstr "" -"(由 Alexandre Vassalotti、Antoine Pitrou 和 Unladen Swallow 團隊在 :issue:" -"`9410` 和 :issue:`3873` 中貢獻。)" +"(由 Alexandre Vassalotti、Antoine Pitrou 和 Unladen Swallow 團隊" +"在 :issue:`9410` 和 :issue:`3873` 中貢獻。)" #: ../../whatsnew/3.2.rst:2374 msgid "" -"The `Timsort algorithm <https://en.wikipedia.org/wiki/Timsort>`_ used in :" -"meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " +"The `Timsort algorithm <https://en.wikipedia.org/wiki/Timsort>`_ used " +"in :meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " "when called with a :term:`key function`. Previously, every element of a " "list was wrapped with a temporary object that remembered the key value " "associated with each element. Now, two arrays of keys and values are sorted " @@ -3896,11 +3918,12 @@ msgstr "(由 Antoine Pitrou 貢獻;:issue:`3001`。)" #: ../../whatsnew/3.2.rst:2397 msgid "" -"The fast-search algorithm in stringlib is now used by the :meth:`~str." -"split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` and :meth:`~str." -"replace` methods on :class:`bytes`, :class:`bytearray` and :class:`str` " -"objects. Likewise, the algorithm is also used by :meth:`~str.rfind`, :meth:" -"`~str.rindex`, :meth:`~str.rsplit` and :meth:`~str.rpartition`." +"The fast-search algorithm in stringlib is now used by " +"the :meth:`~str.split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` " +"and :meth:`~str.replace` methods on :class:`bytes`, :class:`bytearray` " +"and :class:`str` objects. Likewise, the algorithm is also used " +"by :meth:`~str.rfind`, :meth:`~str.rindex`, :meth:`~str.rsplit` " +"and :meth:`~str.rpartition`." msgstr "" #: ../../whatsnew/3.2.rst:2403 @@ -3922,12 +3945,12 @@ msgid "" "There were several other minor optimizations. Set differencing now runs " "faster when one operand is much larger than the other (patch by Andress " "Bennetts in :issue:`8685`). The :meth:`!array.repeat` method has a faster " -"implementation (:issue:`1569291` by Alexander Belopolsky). The :class:`~http." -"server.BaseHTTPRequestHandler` has more efficient buffering (:issue:`3709` " -"by Andrew Schaaf). The :func:`operator.attrgetter` function has been sped-" -"up (:issue:`10160` by Christos Georgiou). And :class:`~configparser." -"ConfigParser` loads multi-line arguments a bit faster (:issue:`7113` by " -"Łukasz Langa)." +"implementation (:issue:`1569291` by Alexander Belopolsky). " +"The :class:`~http.server.BaseHTTPRequestHandler` has more efficient " +"buffering (:issue:`3709` by Andrew Schaaf). The :func:`operator.attrgetter` " +"function has been sped-up (:issue:`10160` by Christos Georgiou). " +"And :class:`~configparser.ConfigParser` loads multi-line arguments a bit " +"faster (:issue:`7113` by Łukasz Langa)." msgstr "" #: ../../whatsnew/3.2.rst:2422 @@ -4023,15 +4046,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:2477 msgid "" -"(Contributed by Raymond Hettinger; see `rationale <https://rhettinger." -"wordpress.com/2011/01/28/open-your-source-more/>`_.)" +"(Contributed by Raymond Hettinger; see `rationale <https://" +"rhettinger.wordpress.com/2011/01/28/open-your-source-more/>`_.)" msgstr "" #: ../../whatsnew/3.2.rst:2480 msgid "" "The docs now contain more examples and recipes. In particular, :mod:`re` " -"module has an extensive section, :ref:`re-examples`. Likewise, the :mod:" -"`itertools` module continues to be updated with new :ref:`itertools-recipes`." +"module has an extensive section, :ref:`re-examples`. Likewise, " +"the :mod:`itertools` module continues to be updated with new :ref:`itertools-" +"recipes`." msgstr "" #: ../../whatsnew/3.2.rst:2485 @@ -4086,17 +4110,17 @@ msgstr "" #: ../../whatsnew/3.2.rst:2513 msgid "" -"In addition to the existing Subversion code repository at https://svn.python." -"org there is now a `Mercurial <https://www.mercurial-scm.org/>`_ repository " -"at https://hg.python.org/\\ ." +"In addition to the existing Subversion code repository at https://" +"svn.python.org there is now a `Mercurial <https://www.mercurial-scm.org/>`_ " +"repository at https://hg.python.org/\\ ." msgstr "" #: ../../whatsnew/3.2.rst:2517 msgid "" "After the 3.2 release, there are plans to switch to Mercurial as the primary " "repository. This distributed version control system should make it easier " -"for members of the community to create and share external changesets. See :" -"pep:`385` for details." +"for members of the community to create and share external changesets. " +"See :pep:`385` for details." msgstr "" #: ../../whatsnew/3.2.rst:2522 @@ -4108,11 +4132,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:2528 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.2.rst:2530 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.2.rst:2532 msgid "" @@ -4168,8 +4192,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2562 msgid "" -"(Suggested by Raymond Hettinger and implemented by Benjamin Peterson; :issue:" -"`9778`.)" +"(Suggested by Raymond Hettinger and implemented by Benjamin " +"Peterson; :issue:`9778`.)" msgstr "" "(由 Raymond Hettinger 建議並由 Benjamin Peterson 實作;:issue:`9778`。)" @@ -4210,10 +4234,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:2585 msgid "" -"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is like :c:" -"func:`PyErr_NewException` but allows a docstring to be specified. This lets " -"C exceptions have the same self-documenting capabilities as their pure " -"Python counterparts (:issue:`7033`)." +"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is " +"like :c:func:`PyErr_NewException` but allows a docstring to be specified. " +"This lets C exceptions have the same self-documenting capabilities as their " +"pure Python counterparts (:issue:`7033`)." msgstr "" #: ../../whatsnew/3.2.rst:2590 @@ -4245,8 +4269,8 @@ msgid "" "there is a known problem with the default Tcl/Tk on Mac OS X 10.6. " "Accordingly, we recommend installing an updated alternative such as " "`ActiveState Tcl/Tk 8.5.9 <https://web.archive.org/web/20101208191259/" -"https://www.activestate.com/activetcl/downloads>`_\\. See https://www.python." -"org/download/mac/tcltk/ for additional details." +"https://www.activestate.com/activetcl/downloads>`_\\. See https://" +"www.python.org/download/mac/tcltk/ for additional details." msgstr "" #: ../../whatsnew/3.2.rst:2611 @@ -4269,25 +4293,27 @@ msgstr "" #: ../../whatsnew/3.2.rst:2621 msgid "" -"The interpolation syntax is now validated on :meth:`~configparser." -"ConfigParser.get` and :meth:`~configparser.ConfigParser.set` operations. In " -"the default interpolation scheme, only two tokens with percent signs are " -"valid: ``%(name)s`` and ``%%``, the latter being an escaped percent sign." +"The interpolation syntax is now validated " +"on :meth:`~configparser.ConfigParser.get` " +"and :meth:`~configparser.ConfigParser.set` operations. In the default " +"interpolation scheme, only two tokens with percent signs are valid: ``%" +"(name)s`` and ``%%``, the latter being an escaped percent sign." msgstr "" #: ../../whatsnew/3.2.rst:2627 msgid "" -"The :meth:`~configparser.ConfigParser.set` and :meth:`~configparser." -"ConfigParser.add_section` methods now verify that values are actual " -"strings. Formerly, unsupported types could be introduced unintentionally." +"The :meth:`~configparser.ConfigParser.set` " +"and :meth:`~configparser.ConfigParser.add_section` methods now verify that " +"values are actual strings. Formerly, unsupported types could be introduced " +"unintentionally." msgstr "" #: ../../whatsnew/3.2.rst:2632 msgid "" -"Duplicate sections or options from a single source now raise either :exc:" -"`~configparser.DuplicateSectionError` or :exc:`~configparser." -"DuplicateOptionError`. Formerly, duplicates would silently overwrite a " -"previous entry." +"Duplicate sections or options from a single source now raise " +"either :exc:`~configparser.DuplicateSectionError` " +"or :exc:`~configparser.DuplicateOptionError`. Formerly, duplicates would " +"silently overwrite a previous entry." msgstr "" #: ../../whatsnew/3.2.rst:2637 @@ -4324,9 +4350,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2653 msgid "" "The :meth:`!array.tostring` and :meth:`!array.fromstring` have been renamed " -"to :meth:`array.tobytes() <array.array.tobytes>` and :meth:`array." -"frombytes() <array.array.frombytes>` for clarity. The old names have been " -"deprecated. (See :issue:`8990`.)" +"to :meth:`array.tobytes() <array.array.tobytes>` " +"and :meth:`array.frombytes() <array.array.frombytes>` for clarity. The old " +"names have been deprecated. (See :issue:`8990`.)" msgstr "" #: ../../whatsnew/3.2.rst:2658 @@ -4359,19 +4385,19 @@ msgstr "" msgid "" "The :func:`random.seed` function and method now salt string seeds with an " "sha512 hash function. To access the previous version of *seed* in order to " -"reproduce Python 3.1 sequences, set the *version* argument to *1*, ``random." -"seed(s, version=1)``." +"reproduce Python 3.1 sequences, set the *version* argument to *1*, " +"``random.seed(s, version=1)``." msgstr "" #: ../../whatsnew/3.2.rst:2676 msgid "" "The previously deprecated :func:`!string.maketrans` function has been " -"removed in favor of the static methods :meth:`bytes.maketrans` and :meth:" -"`bytearray.maketrans`. This change solves the confusion around which types " -"were supported by the :mod:`string` module. Now, :class:`str`, :class:" -"`bytes`, and :class:`bytearray` each have their own **maketrans** and " -"**translate** methods with intermediate translation tables of the " -"appropriate type." +"removed in favor of the static methods :meth:`bytes.maketrans` " +"and :meth:`bytearray.maketrans`. This change solves the confusion around " +"which types were supported by the :mod:`string` module. " +"Now, :class:`str`, :class:`bytes`, and :class:`bytearray` each have their " +"own **maketrans** and **translate** methods with intermediate translation " +"tables of the appropriate type." msgstr "" #: ../../whatsnew/3.2.rst:2684 @@ -4430,9 +4456,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2711 msgid "" -"The :class:`xml.etree.ElementTree` class now raises an :exc:`xml.etree." -"ElementTree.ParseError` when a parse fails. Previously it raised an :exc:" -"`xml.parsers.expat.ExpatError`." +"The :class:`xml.etree.ElementTree` class now raises " +"an :exc:`xml.etree.ElementTree.ParseError` when a parse fails. Previously it " +"raised an :exc:`xml.parsers.expat.ExpatError`." msgstr "" #: ../../whatsnew/3.2.rst:2715 @@ -4452,9 +4478,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2725 msgid "" -"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` and :" -"mod:`http.client`. Such support is still present on the server side (in :" -"mod:`http.server`)." +"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` " +"and :mod:`http.client`. Such support is still present on the server side " +"(in :mod:`http.server`)." msgstr "" #: ../../whatsnew/3.2.rst:2729 @@ -4475,8 +4501,8 @@ msgstr "(由 Antoine Pitrou 於 :issue:`10272` 貢獻。)" msgid "" "The misleading functions :c:func:`!PyEval_AcquireLock` and :c:func:`!" "PyEval_ReleaseLock` have been officially deprecated. The thread-state aware " -"APIs (such as :c:func:`PyEval_SaveThread` and :c:func:" -"`PyEval_RestoreThread`) should be used instead." +"APIs (such as :c:func:`PyEval_SaveThread` " +"and :c:func:`PyEval_RestoreThread`) should be used instead." msgstr "" #: ../../whatsnew/3.2.rst:2741 diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index bd3546dee4..88a9f991f4 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-03 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -108,7 +108,7 @@ msgstr "" #: ../../whatsnew/3.3.rst:84 msgid "Significantly Improved Library Modules:" -msgstr "" +msgstr "顯著改進的函式庫模組:" #: ../../whatsnew/3.3.rst:86 msgid "C Accelerator for the :ref:`decimal <new-decimal>` module." @@ -116,8 +116,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:87 msgid "" -"Better unicode handling in the :ref:`email <new-email>` module (:term:" -"`provisional <provisional package>`)." +"Better unicode handling in the :ref:`email <new-email>` module " +"(:term:`provisional <provisional package>`)." msgstr "" #: ../../whatsnew/3.3.rst:90 @@ -171,8 +171,8 @@ msgstr "" msgid "" "Native support for package directories that don't require ``__init__.py`` " "marker files and can automatically span multiple path segments (inspired by " -"various third party approaches to namespace packages, as described in :pep:" -"`420`)" +"various third party approaches to namespace packages, as described " +"in :pep:`420`)" msgstr "" #: ../../whatsnew/3.3.rst:132 @@ -498,18 +498,20 @@ msgstr "" #: ../../whatsnew/3.3.rst:332 msgid "" "You don't have to worry anymore about choosing the appropriate exception " -"type between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:" -"`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` or :exc:`select." -"error`. All these exception types are now only one: :exc:`OSError`. The " -"other names are kept as aliases for compatibility reasons." +"type " +"between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` " +"or :exc:`select.error`. All these exception types are now only " +"one: :exc:`OSError`. The other names are kept as aliases for compatibility " +"reasons." msgstr "" #: ../../whatsnew/3.3.rst:339 msgid "" "Also, it is now easier to catch a specific error condition. Instead of " "inspecting the ``errno`` attribute (or ``args[0]``) for a particular " -"constant from the :mod:`errno` module, you can catch the adequate :exc:" -"`OSError` subclass. The available subclasses are the following:" +"constant from the :mod:`errno` module, you can catch the " +"adequate :exc:`OSError` subclass. The available subclasses are the " +"following:" msgstr "" #: ../../whatsnew/3.3.rst:344 @@ -877,10 +879,10 @@ msgstr "" msgid "" "Functions and class objects have a new :attr:`~definition.__qualname__` " "attribute representing the \"path\" from the module top-level to their " -"definition. For global functions and classes, this is the same as :attr:" -"`~definition.__name__`. For other functions and classes, it provides better " -"information about where they were actually defined, and how they might be " -"accessible from the global scope." +"definition. For global functions and classes, this is the same " +"as :attr:`~definition.__name__`. For other functions and classes, it " +"provides better information about where they were actually defined, and how " +"they might be accessible from the global scope." msgstr "" #: ../../whatsnew/3.3.rst:560 @@ -1021,10 +1023,11 @@ msgstr "PEP 362:函式簽名物件" msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " -"supported: python functions, decorated or not, classes, and :func:`functools." -"partial` objects. New classes :class:`inspect.Signature`, :class:`inspect." -"Parameter` and :class:`inspect.BoundArguments` hold information about the " -"call signatures, such as, annotations, default values, parameters kinds, and " +"supported: python functions, decorated or not, classes, " +"and :func:`functools.partial` objects. New " +"classes :class:`inspect.Signature`, :class:`inspect.Parameter` " +"and :class:`inspect.BoundArguments` hold information about the call " +"signatures, such as, annotations, default values, parameters kinds, and " "bound arguments, which considerably simplifies writing decorators and any " "code that validates or amends calling signatures or arguments." msgstr "" @@ -1080,10 +1083,10 @@ msgstr "SimpleNamespace" msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " -"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, like :" -"class:`object`. However, unlike ``object``, ``SimpleNamespace`` instances " -"are writable. This means that you can add, remove, and modify the namespace " -"through normal attribute access." +"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, " +"like :class:`object`. However, unlike ``object``, ``SimpleNamespace`` " +"instances are writable. This means that you can add, remove, and modify the " +"namespace through normal attribute access." msgstr "" #: ../../whatsnew/3.3.rst:681 @@ -1108,14 +1111,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:694 msgid "" -"The :func:`__import__` function is now powered by :func:`importlib." -"__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " -"There are multiple benefits to this change. First, it has allowed for more " -"of the machinery powering import to be exposed instead of being implicit and " -"hidden within the C code. It also provides a single implementation for all " -"Python VMs supporting Python 3.3 to use, helping to end any VM-specific " -"deviations in import semantics. And finally it eases the maintenance of " -"import, allowing for future growth to occur." +"The :func:`__import__` function is now powered " +"by :func:`importlib.__import__`. This work leads to the completion of " +"\"phase 2\" of :pep:`302`. There are multiple benefits to this change. " +"First, it has allowed for more of the machinery powering import to be " +"exposed instead of being implicit and hidden within the C code. It also " +"provides a single implementation for all Python VMs supporting Python 3.3 to " +"use, helping to end any VM-specific deviations in import semantics. And " +"finally it eases the maintenance of import, allowing for future growth to " +"occur." msgstr "" #: ../../whatsnew/3.3.rst:703 @@ -1141,11 +1145,11 @@ msgstr "" msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders <meta path finder>` " -"and :term:`path entry finders <path entry finder>` by introducing :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.PathEntryFinder`, " -"respectively. The old ABC of :class:`!importlib.abc.Finder` is now only " -"provided for backwards-compatibility and does not enforce any method " -"requirements." +"and :term:`path entry finders <path entry finder>` by " +"introducing :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder`, respectively. The old ABC " +"of :class:`!importlib.abc.Finder` is now only provided for backwards-" +"compatibility and does not enforce any method requirements." msgstr "" #: ../../whatsnew/3.3.rst:722 @@ -1159,10 +1163,11 @@ msgstr "" msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " -"a module's code. The loader for source files (:class:`importlib.machinery." -"SourceFileLoader`), sourceless bytecode files (:class:`importlib.machinery." -"SourcelessFileLoader`), and extension modules (:class:`importlib.machinery." -"ExtensionFileLoader`) are now available for direct use." +"a module's code. The loader for source files " +"(:class:`importlib.machinery.SourceFileLoader`), sourceless bytecode files " +"(:class:`importlib.machinery.SourcelessFileLoader`), and extension modules " +"(:class:`importlib.machinery.ExtensionFileLoader`) are now available for " +"direct use." msgstr "" #: ../../whatsnew/3.3.rst:734 @@ -1193,9 +1198,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " -"visible changes to import. The biggest is that :data:`sys.meta_path` and :" -"data:`sys.path_hooks` now store all of the meta path finders and path entry " -"hooks used by import. Previously the finders were implicit and hidden " +"visible changes to import. The biggest is that :data:`sys.meta_path` " +"and :data:`sys.path_hooks` now store all of the meta path finders and path " +"entry hooks used by import. Previously the finders were implicit and hidden " "within the C code of import instead of being directly exposed. This means " "that one can now easily remove or change the order of the various finders to " "fit one's needs." @@ -1213,9 +1218,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:762 msgid "" -"Loaders are also now expected to set the ``__package__`` attribute from :pep:" -"`366`. Once again, import itself is already setting this on all loaders " -"from :mod:`importlib` and import itself is setting the attribute post-load." +"Loaders are also now expected to set the ``__package__`` attribute " +"from :pep:`366`. Once again, import itself is already setting this on all " +"loaders from :mod:`importlib` and import itself is setting the attribute " +"post-load." msgstr "" #: ../../whatsnew/3.3.rst:766 @@ -1247,9 +1253,9 @@ msgstr "對核心 Python 語言所做的一些較小的更改包括:" #: ../../whatsnew/3.3.rst:783 msgid "" -"Added support for Unicode name aliases and named sequences. Both :func:" -"`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" -"`unicodedata.lookup` resolves named sequences too." +"Added support for Unicode name aliases and named sequences. " +"Both :func:`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, " +"and :func:`unicodedata.lookup` resolves named sequences too." msgstr "" #: ../../whatsnew/3.3.rst:787 @@ -1263,8 +1269,8 @@ msgstr "Unicode 資料庫更新至 UCD 版本 6.1.0" #: ../../whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " -"the equality of the underlying sequences generated by those range objects. (:" -"issue:`13201`)" +"the equality of the underlying sequences generated by those range objects. " +"(:issue:`13201`)" msgstr "" #: ../../whatsnew/3.3.rst:795 @@ -1288,9 +1294,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " -"``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" -"`~collections.abc.MutableSequence` now also defines a :meth:`~collections." -"abc.MutableSequence.clear` method (:issue:`11388`)." +"``copy()`` and ``clear()`` (:issue:`10516`). " +"Consequently, :class:`~collections.abc.MutableSequence` now also defines " +"a :meth:`~collections.abc.MutableSequence.clear` method (:issue:`11388`)." msgstr "" #: ../../whatsnew/3.3.rst:810 @@ -1331,8 +1337,8 @@ msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " "would trigger code execution in a different thread as a side-effect. Clumsy " -"workarounds were sometimes employed, such as the :c:func:" -"`PyImport_ImportModuleNoBlock` C API function." +"workarounds were sometimes employed, such as " +"the :c:func:`PyImport_ImportModuleNoBlock` C API function." msgstr "" #: ../../whatsnew/3.3.rst:834 @@ -1368,8 +1374,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:852 msgid "" -":func:`hash`: hash randomization is enabled by default, see :meth:`object." -"__hash__` and :envvar:`PYTHONHASHSEED`." +":func:`hash`: hash randomization is enabled by default, " +"see :meth:`object.__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" #: ../../whatsnew/3.3.rst:854 @@ -1383,8 +1389,8 @@ msgstr "" msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " -"documentation sections for the individual builtin sequence types (:issue:" -"`4966`)." +"documentation sections for the individual builtin sequence types " +"(:issue:`4966`)." msgstr "" #: ../../whatsnew/3.3.rst:864 @@ -1400,10 +1406,11 @@ msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " "a timeout, or on a user signal. Call :func:`faulthandler.enable` to install " -"fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :" -"const:`SIGBUS`, and :const:`SIGILL` signals. You can also enable them at " -"startup by setting the :envvar:`PYTHONFAULTHANDLER` environment variable or " -"by using :option:`-X` ``faulthandler`` command line option." +"fault handlers for " +"the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, " +"and :const:`SIGILL` signals. You can also enable them at startup by setting " +"the :envvar:`PYTHONFAULTHANDLER` environment variable or by using :option:`-" +"X` ``faulthandler`` command line option." msgstr "" #: ../../whatsnew/3.3.rst:877 @@ -1485,24 +1492,24 @@ msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` 和 :func:`abc." -"abstractmethod`。" +":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 msgid "" -":class:`abc.abstractclassmethod` has been deprecated, use :class:" -"`classmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractclassmethod` has been deprecated, " +"use :class:`classmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` 和 :" -"func:`abc.abstractmethod`。" +":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:926 ../../whatsnew/3.3.rst:2252 msgid "" -":class:`abc.abstractstaticmethod` has been deprecated, use :class:" -"`staticmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractstaticmethod` has been deprecated, " +"use :class:`staticmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` 和 :" -"func:`abc.abstractmethod`。" +":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" @@ -1535,9 +1542,9 @@ msgstr "base64" #: ../../whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " -"the :mod:`base64` modern interface. For example, ``base64." -"b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin Iacob in :" -"issue:`13641`.)" +"the :mod:`base64` modern interface. For example, " +"``base64.b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin " +"Iacob in :issue:`13641`.)" msgstr "" #: ../../whatsnew/3.3.rst:953 @@ -1580,9 +1587,9 @@ msgstr "(由 Nadeem Vawda 在 :issue:`5863` 中貢獻。)" #: ../../whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" -"stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" -"`bz2.BZ2File` can now also be used to create this type of file, using the " -"``'a'`` (append) mode." +"stream inputs (such as those produced by the :program:`pbzip2` " +"tool). :class:`bz2.BZ2File` can now also be used to create this type of " +"file, using the ``'a'`` (append) mode." msgstr "" #: ../../whatsnew/3.3.rst:979 @@ -1602,9 +1609,9 @@ msgstr "codecs" #: ../../whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " -"``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" -"`~encodings.mbcs` codec now supports all error handlers, instead of only " -"``replace`` to encode and ``ignore`` to decode." +"``replace`` and ``ignore`` error handlers on all Windows versions. " +"The :mod:`~encodings.mbcs` codec now supports all error handlers, instead of " +"only ``replace`` to encode and ``ignore`` to decode." msgstr "" #: ../../whatsnew/3.3.rst:993 @@ -1618,9 +1625,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " -"byte of an invalid byte sequence. For example, ``b'\\xff\\n'." -"decode('gb2312', 'replace')`` now returns a ``\\n`` after the replacement " -"character." +"byte of an invalid byte sequence. For example, " +"``b'\\xff\\n'.decode('gb2312', 'replace')`` now returns a ``\\n`` after the " +"replacement character." msgstr "" #: ../../whatsnew/3.3.rst:1002 @@ -1668,16 +1675,16 @@ msgstr "collections" #: ../../whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " -"number of mappings as a single unit. (Written by Raymond Hettinger for :" -"issue:`11089`, made public in :issue:`11297`.)" +"number of mappings as a single unit. (Written by Raymond Hettinger " +"for :issue:`11089`, made public in :issue:`11297`.)" msgstr "" #: ../../whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " -"collections classes. Aliases for ABCs are still present in the :mod:" -"`collections` module to preserve existing imports. (:issue:`11085`)" +"collections classes. Aliases for ABCs are still present in " +"the :mod:`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" #: ../../whatsnew/3.3.rst:1034 @@ -1728,8 +1735,9 @@ msgstr "curses" #: ../../whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " -"functions when Unicode strings or characters are passed (e.g. :c:func:" -"`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." +"functions when Unicode strings or characters are passed " +"(e.g. :c:func:`waddwstr`), and bytes functions otherwise " +"(e.g. :c:func:`waddstr`)." msgstr "" #: ../../whatsnew/3.3.rst:1068 @@ -1768,8 +1776,8 @@ msgstr "datetime" #: ../../whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " -"instances now return :const:`False` instead of raising :exc:`TypeError` (:" -"issue:`15006`)." +"instances now return :const:`False` instead of raising :exc:`TypeError` " +"(:issue:`15006`)." msgstr "" #: ../../whatsnew/3.3.rst:1084 @@ -1894,8 +1902,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:1130 msgid "" "If Python is compiled without threads, the C version automatically disables " -"the expensive thread local context machinery. In this case, the variable :" -"const:`~decimal.HAVE_THREADS` is set to ``False``." +"the expensive thread local context machinery. In this case, the " +"variable :const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" #: ../../whatsnew/3.3.rst:1137 @@ -1942,10 +1950,11 @@ msgstr "``-999999999999999999``" #: ../../whatsnew/3.3.rst:1150 msgid "" -"In the context templates (:class:`~decimal.DefaultContext`, :class:`~decimal." -"BasicContext` and :class:`~decimal.ExtendedContext`) the magnitude of :attr:" -"`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has changed to " -"``999999``." +"In the context templates " +"(:const:`~decimal.DefaultContext`, :const:`~decimal.BasicContext` " +"and :const:`~decimal.ExtendedContext`) the magnitude " +"of :attr:`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has " +"changed to ``999999``." msgstr "" #: ../../whatsnew/3.3.rst:1155 @@ -1953,29 +1962,31 @@ msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " "exactly. Since the C version has internal limits, the following scheme is " -"used: If possible, values are converted exactly, otherwise :exc:`~decimal." -"InvalidOperation` is raised and the result is NaN. In the latter case it is " -"always possible to use :meth:`~decimal.Context.create_decimal` in order to " -"obtain a rounded or inexact value." +"used: If possible, values are converted exactly, " +"otherwise :exc:`~decimal.InvalidOperation` is raised and the result is NaN. " +"In the latter case it is always possible to " +"use :meth:`~decimal.Context.create_decimal` in order to obtain a rounded or " +"inexact value." msgstr "" #: ../../whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " -"version, it is defined in terms of the correctly rounded :meth:`~decimal." -"Decimal.exp` and :meth:`~decimal.Decimal.ln` functions, but the final result " -"is only \"almost always correctly rounded\"." +"version, it is defined in terms of the correctly " +"rounded :meth:`~decimal.Decimal.exp` and :meth:`~decimal.Decimal.ln` " +"functions, but the final result is only \"almost always correctly rounded\"." msgstr "" #: ../../whatsnew/3.3.rst:1170 msgid "" -"In the C version, the context dictionary containing the signals is a :class:" -"`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." -"Context.flags` and :attr:`~decimal.Context.traps` always refer to the same :" -"class:`~collections.abc.MutableMapping` that the context was initialized " -"with. If a new signal dictionary is assigned, :attr:`~decimal.Context.flags` " -"and :attr:`~decimal.Context.traps` are updated with the new values, but they " -"do not reference the RHS dictionary." +"In the C version, the context dictionary containing the signals is " +"a :class:`~collections.abc.MutableMapping`. For speed " +"reasons, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"always refer to the same :class:`~collections.abc.MutableMapping` that the " +"context was initialized with. If a new signal dictionary is " +"assigned, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"are updated with the new values, but they do not reference the RHS " +"dictionary." msgstr "" #: ../../whatsnew/3.3.rst:1180 @@ -2006,18 +2017,18 @@ msgstr "" #: ../../whatsnew/3.3.rst:1200 msgid "" -"The email package now has a :mod:`~email.policy` framework. A :class:" -"`~email.policy.Policy` is an object with several methods and properties that " -"control how the email package behaves. The primary policy for Python 3.3 is " -"the :class:`~email.policy.Compat32` policy, which provides backward " -"compatibility with the email package in Python 3.2. A ``policy`` can be " -"specified when an email message is parsed by a :mod:`~email.parser`, or when " -"a :class:`~email.message.Message` object is created, or when an email is " -"serialized using a :mod:`~email.generator`. Unless overridden, a policy " -"passed to a ``parser`` is inherited by all the ``Message`` object and sub-" -"objects created by the ``parser``. By default a ``generator`` will use the " -"policy of the ``Message`` object it is serializing. The default policy is :" -"data:`~email.policy.compat32`." +"The email package now has a :mod:`~email.policy` framework. " +"A :class:`~email.policy.Policy` is an object with several methods and " +"properties that control how the email package behaves. The primary policy " +"for Python 3.3 is the :class:`~email.policy.Compat32` policy, which provides " +"backward compatibility with the email package in Python 3.2. A ``policy`` " +"can be specified when an email message is parsed by a :mod:`~email.parser`, " +"or when a :class:`~email.message.Message` object is created, or when an " +"email is serialized using a :mod:`~email.generator`. Unless overridden, a " +"policy passed to a ``parser`` is inherited by all the ``Message`` object and " +"sub-objects created by the ``parser``. By default a ``generator`` will use " +"the policy of the ``Message`` object it is serializing. The default policy " +"is :data:`~email.policy.compat32`." msgstr "" #: ../../whatsnew/3.3.rst:1213 @@ -2067,11 +2078,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:1235 msgid "" -"A new policy instance, with new settings, is created using the :meth:`~email." -"policy.Policy.clone` method of policy objects. ``clone`` takes any of the " -"above controls as keyword arguments. Any control not specified in the call " -"retains its default value. Thus you can create a policy that uses " -"``\\r\\n`` linesep characters like this::" +"A new policy instance, with new settings, is created using " +"the :meth:`~email.policy.Policy.clone` method of policy objects. ``clone`` " +"takes any of the above controls as keyword arguments. Any control not " +"specified in the call retains its default value. Thus you can create a " +"policy that uses ``\\r\\n`` linesep characters like this::" msgstr "" #: ../../whatsnew/3.3.rst:1241 @@ -2101,10 +2112,10 @@ msgid "" "for introducing it is to allow the creation of new policies that implement " "new features for the email package in a way that maintains backward " "compatibility for those who do not use the new policies. Because the new " -"policies introduce a new API, we are releasing them in Python 3.3 as a :term:" -"`provisional policy <provisional package>`. Backwards incompatible changes " -"(up to and including removal of the code) may occur if deemed necessary by " -"the core developers." +"policies introduce a new API, we are releasing them in Python 3.3 as " +"a :term:`provisional policy <provisional package>`. Backwards incompatible " +"changes (up to and including removal of the code) may occur if deemed " +"necessary by the core developers." msgstr "" #: ../../whatsnew/3.3.rst:1265 @@ -2162,8 +2173,8 @@ msgid "" "'Éric'\n" ">>> m['Date'] = email.utils.localtime()\n" ">>> m['Date'].datetime\n" -"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." -"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" ">>> m['Date']\n" "'Fri, 25 May 2012 21:44:27 -0400'\n" ">>> print(m)\n" @@ -2182,8 +2193,8 @@ msgstr "" "'Éric'\n" ">>> m['Date'] = email.utils.localtime()\n" ">>> m['Date'].datetime\n" -"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." -"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" ">>> m['Date']\n" "'Fri, 25 May 2012 21:44:27 -0400'\n" ">>> print(m)\n" @@ -2195,8 +2206,8 @@ msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " "accessed directly, you get the unicode version. This eliminates any need to " -"deal with the :mod:`email.header` :meth:`~email.header.decode_header` or :" -"meth:`~email.header.make_header` functions." +"deal with the :mod:`email.header` :meth:`~email.header.decode_header` " +"or :meth:`~email.header.make_header` functions." msgstr "" #: ../../whatsnew/3.3.rst:1318 @@ -2243,8 +2254,8 @@ msgid "" "(Group(display_name='pals', addresses=(Address(display_name='Bob', " "username='bob', domain='example.com'), Address(display_name='Sally', " "username='sally', domain='example.com')), Group(display_name=None, " -"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." -"com'),))" +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" msgstr "" ">>> m2['cc'].addresses\n" "(Address(display_name='Bob', username='bob', domain='example.com'), " @@ -2254,8 +2265,8 @@ msgstr "" "(Group(display_name='pals', addresses=(Address(display_name='Bob', " "username='bob', domain='example.com'), Address(display_name='Sally', " "username='sally', domain='example.com')), Group(display_name=None, " -"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." -"com'),))" +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" #: ../../whatsnew/3.3.rst:1343 msgid "" @@ -2271,9 +2282,9 @@ msgstr "其他 API 變更" #: ../../whatsnew/3.3.rst:1351 msgid "" -"New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." -"parser` module to complement :class:`~email.parser.HeaderParser` and " -"complete the Bytes API." +"New :class:`~email.parser.BytesHeaderParser`, added to " +"the :mod:`~email.parser` module to " +"complement :class:`~email.parser.HeaderParser` and complete the Bytes API." msgstr "" #: ../../whatsnew/3.3.rst:1355 @@ -2296,10 +2307,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:1364 msgid "" ":func:`~email.utils.localtime`: With no argument, returns the current local " -"time as an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`. Given an aware :class:`~datetime.datetime`, converts " -"it into an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`." +"time as an aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`. Given an " +"aware :class:`~datetime.datetime`, converts it into an " +"aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`." msgstr "" #: ../../whatsnew/3.3.rst:1372 @@ -2310,24 +2322,25 @@ msgstr "ftplib" msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " -"when creating the outgoing socket. (Contributed by Giampaolo Rodolà in :" -"issue:`8594`.)" +"when creating the outgoing socket. (Contributed by Giampaolo Rodolà " +"in :issue:`8594`.)" msgstr "" #: ../../whatsnew/3.3.rst:1379 msgid "" -"The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." -"ccc` function to revert control channel back to plaintext. This can be " -"useful to take advantage of firewalls that know how to handle NAT with non-" -"secure FTP without opening fixed ports. (Contributed by Giampaolo Rodolà " -"in :issue:`12139`.)" +"The :class:`~ftplib.FTP_TLS` class now provides a " +"new :func:`~ftplib.FTP_TLS.ccc` function to revert control channel back to " +"plaintext. This can be useful to take advantage of firewalls that know how " +"to handle NAT with non-secure FTP without opening fixed ports. (Contributed " +"by Giampaolo Rodolà in :issue:`12139`.)" msgstr "" #: ../../whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " -"listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." -"dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" +"listing format and deprecates :meth:`ftplib.FTP.nlst` " +"and :meth:`ftplib.FTP.dir`. (Contributed by Giampaolo Rodolà " +"in :issue:`11072`.)" msgstr "" #: ../../whatsnew/3.3.rst:1391 @@ -2370,11 +2383,11 @@ msgstr "http" #: ../../whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " -"writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." -"end_headers` is called. A new method :meth:`~http.server." -"BaseHTTPRequestHandler.flush_headers` can be used to directly manage when " -"the accumulated headers are sent. (Contributed by Andrew Schaaf in :issue:" -"`3709`.)" +"writes them all at once " +"when :meth:`~http.server.BaseHTTPRequestHandler.end_headers` is called. A " +"new method :meth:`~http.server.BaseHTTPRequestHandler.flush_headers` can be " +"used to directly manage when the accumulated headers are sent. (Contributed " +"by Andrew Schaaf in :issue:`3709`.)" msgstr "" #: ../../whatsnew/3.3.rst:1423 @@ -2385,9 +2398,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:1426 msgid "" -":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." -"readinto` method, which means it can be used as an :class:`io.RawIOBase` " -"class. (Contributed by John Kuhn in :issue:`13464`.)" +":class:`http.client.HTTPResponse` now has " +"a :meth:`~http.client.HTTPResponse.readinto` method, which means it can be " +"used as an :class:`io.RawIOBase` class. (Contributed by John Kuhn " +"in :issue:`13464`.)" msgstr "" #: ../../whatsnew/3.3.rst:1433 @@ -2397,14 +2411,12 @@ msgstr "html" #: ../../whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " -"raising errors, therefore the *strict* argument of the constructor and the :" -"exc:`~html.parser.HTMLParseError` exception are now deprecated. The ability " -"to parse broken markup is the result of a number of bug fixes that are also " -"available on the latest bug fix releases of Python 2.7/3.2. (Contributed by " -"Ezio Melotti in :issue:`15114`, and :issue:`14538`, :issue:`13993`, :issue:" -"`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :" -"issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:" -"`12888`, :issue:`7311`.)" +"raising errors, therefore the *strict* argument of the constructor and " +"the :exc:`~html.parser.HTMLParseError` exception are now deprecated. The " +"ability to parse broken markup is the result of a number of bug fixes that " +"are also available on the latest bug fix releases of Python 2.7/3.2. " +"(Contributed by Ezio Melotti in :issue:`15114`, " +"and :issue:`14538`, :issue:`13993`, :issue:`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:`7311`.)" msgstr "" #: ../../whatsnew/3.3.rst:1445 @@ -2476,10 +2488,10 @@ msgstr "(由 David Townshend 於 :issue:`12760` 中貢獻。)" #: ../../whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " -"*write_through* optional argument. If *write_through* is ``True``, calls to :" -"meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any data " -"written on the :class:`~io.TextIOWrapper` object is immediately handled to " -"its underlying binary buffer." +"*write_through* optional argument. If *write_through* is ``True``, calls " +"to :meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any " +"data written on the :class:`~io.TextIOWrapper` object is immediately handled " +"to its underlying binary buffer." msgstr "" #: ../../whatsnew/3.3.rst:1495 @@ -2552,8 +2564,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:1539 msgid "" ":class:`multiprocessing.Connection` objects can now be transferred over " -"multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" -"`4892`.)" +"multiprocessing connections. (Contributed by Richard Oudkerk " +"in :issue:`4892`.)" msgstr "" #: ../../whatsnew/3.3.rst:1543 @@ -2572,11 +2584,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1552 msgid "" -"New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" -"`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " -"equivalents to the existing :meth:`multiprocessing.pool.Pool.map` and :meth:" -"`~multiprocessing.pool.Pool.map_async` functions. (Contributed by Hynek " -"Schlawack in :issue:`12708`.)" +"New methods :meth:`multiprocessing.pool.Pool.starmap` " +"and :meth:`~multiprocessing.pool.Pool.starmap_async` " +"provide :func:`itertools.starmap` equivalents to the " +"existing :meth:`multiprocessing.pool.Pool.map` " +"and :meth:`~multiprocessing.pool.Pool.map_async` functions. (Contributed by " +"Hynek Schlawack in :issue:`12708`.)" msgstr "" #: ../../whatsnew/3.3.rst:1561 @@ -2596,16 +2609,16 @@ msgid "" ">>> with NNTP('news.gmane.org') as n:\n" "... n.group('gmane.comp.python.committers')\n" "...\n" -"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." -"python.committers')\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" ">>>" msgstr "" ">>> from nntplib import NNTP\n" ">>> with NNTP('news.gmane.org') as n:\n" "... n.group('gmane.comp.python.committers')\n" "...\n" -"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." -"python.committers')\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" ">>>" #: ../../whatsnew/3.3.rst:1574 @@ -2619,9 +2632,9 @@ msgstr "os" #: ../../whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " -"possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." -"O_NONBLOCK` flags set atomically. This is especially useful to avoid race " -"conditions in multi-threaded programs." +"possible to create a pipe with :const:`~os.O_CLOEXEC` " +"or :const:`~os.O_NONBLOCK` flags set atomically. This is especially useful " +"to avoid race conditions in multi-threaded programs." msgstr "" #: ../../whatsnew/3.3.rst:1585 @@ -2645,52 +2658,46 @@ msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " "file descriptors instead of file names. Python 3.3 enhances existing " -"functions and introduces new functions to work on file descriptors (:issue:" -"`4761`, :issue:`10755` and :issue:`14626`)." +"functions and introduces new functions to work on file descriptors " +"(:issue:`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" #: ../../whatsnew/3.3.rst:1601 msgid "" -"The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" -"`~os.walk` except that it also yields file descriptors referring to the " -"directories visited. This is especially useful to avoid symlink races." +"The :mod:`os` module has a new :func:`~os.fwalk` function similar " +"to :func:`~os.walk` except that it also yields file descriptors referring to " +"the directories visited. This is especially useful to avoid symlink races." msgstr "" #: ../../whatsnew/3.3.rst:1605 msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors <dir_fd>`) and/or *follow_symlinks* (:ref:`not " -"following symlinks <follow_symlinks>`): :func:`~os.access`, :func:`~os." -"chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os." -"lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os." -"open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:" -"`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :" -"func:`~os.unlink`, :func:`~os.utime`. Platform support for using these " -"parameters can be checked via the sets :data:`os.supports_dir_fd` and :data:" -"`os.supports_follows_symlinks`." +"following symlinks " +"<follow_symlinks>`): :func:`~os.access`, :func:`~os.chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime`. " +"Platform support for using these parameters can be checked via the " +"sets :data:`os.supports_dir_fd` and :data:`os.supports_follows_symlinks`." msgstr "" #: ../../whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " -"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" -"`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path." -"exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. Platform " -"support for this can be checked via the :data:`os.supports_fd` set." +"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path.exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. " +"Platform support for this can be checked via the :data:`os.supports_fd` set." msgstr "" #: ../../whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " -"check. Platform support for this can be checked via the :data:`~os." -"supports_effective_ids` set." +"check. Platform support for this can be checked via " +"the :data:`~os.supports_effective_ids` set." msgstr "" #: ../../whatsnew/3.3.rst:1627 msgid "" -"The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" -"func:`~os.setpriority`. They can be used to get or set process niceness/" +"The :mod:`os` module has two new functions: :func:`~os.getpriority` " +"and :func:`~os.setpriority`. They can be used to get or set process niceness/" "priority in a fashion similar to :func:`os.nice` but extended to all " "processes instead of just the current one." msgstr "" @@ -2709,37 +2716,32 @@ msgstr "" #: ../../whatsnew/3.3.rst:1640 msgid "" -"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" -"`~os.lstat`) now support reading a file's timestamps with nanosecond " -"precision. Symmetrically, :func:`~os.utime` can now write file timestamps " -"with nanosecond precision. (Contributed by Larry Hastings in :issue:" -"`14127`.)" +"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, " +"and :func:`~os.lstat`) now support reading a file's timestamps with " +"nanosecond precision. Symmetrically, :func:`~os.utime` can now write file " +"timestamps with nanosecond precision. (Contributed by Larry Hastings " +"in :issue:`14127`.)" msgstr "" #: ../../whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " -"terminal attached to a file descriptor. See also :func:`shutil." -"get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-Szmek in :issue:" -"`13609`.)" +"terminal attached to a file descriptor. See " +"also :func:`shutil.get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-" +"Szmek in :issue:`13609`.)" msgstr "" #: ../../whatsnew/3.3.rst:1653 msgid "" -"New functions to support Linux extended attributes (:issue:`12720`): :func:" -"`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." -"setxattr`." +"New functions to support Linux extended attributes " +"(:issue:`12720`): :func:`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os.setxattr`." msgstr "" #: ../../whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " -"allocated CPU time by the operating system. New functions: :func:`~os." -"sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os." -"sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os." -"sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os." -"sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os." -"sched_setscheduler`, :func:`~os.sched_yield`," +"allocated CPU time by the operating system. New " +"functions: :func:`~os.sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os.sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os.sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os.sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os.sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" #: ../../whatsnew/3.3.rst:1666 @@ -2827,12 +2829,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1696 msgid "" -"New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." -"RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" -"`~os.RTLD_NOLOAD`, and :const:`~os.RTLD_DEEPBIND` are available on platforms " -"that support them. These are for use with the :func:`sys.setdlopenflags` " -"function, and supersede the similar constants defined in :mod:`ctypes` and :" -"mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" +"New " +"constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os.RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:`~os.RTLD_NOLOAD`, " +"and :const:`~os.RTLD_DEEPBIND` are available on platforms that support " +"them. These are for use with the :func:`sys.setdlopenflags` function, and " +"supersede the similar constants defined in :mod:`ctypes` and :mod:`DLFCN`. " +"(Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" #: ../../whatsnew/3.3.rst:1704 @@ -2862,8 +2864,9 @@ msgstr "pickle" #: ../../whatsnew/3.3.rst:1721 msgid "" -":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." -"dispatch_table` attribute allowing per-pickler reduction functions to be set." +":class:`pickle.Pickler` objects now have an " +"optional :attr:`~pickle.Pickler.dispatch_table` attribute allowing per-" +"pickler reduction functions to be set." msgstr "" #: ../../whatsnew/3.3.rst:1725 @@ -2876,8 +2879,8 @@ msgstr "pydoc" #: ../../whatsnew/3.3.rst:1731 msgid "" -"The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" -"mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " +"The Tk GUI and the :func:`~pydoc.serve` function have been removed from " +"the :mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " "deprecated in Python 3.2." msgstr "" @@ -2910,22 +2913,23 @@ msgstr "" #: ../../whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " -"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" -"`8684`.)" +"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà " +"in :issue:`8684`.)" msgstr "" #: ../../whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " -"constructor are now optional and defaults to :func:`time.time` and :func:" -"`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" +"constructor are now optional and defaults to :func:`time.time` " +"and :func:`time.sleep` respectively. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" #: ../../whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " -"*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" -"`13245`.)" +"*argument* parameter is now optional. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` " "*argument* 參數現在是可選的。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" @@ -2956,9 +2960,9 @@ msgstr "shlex" #: ../../whatsnew/3.3.rst:1782 msgid "" "The previously undocumented helper function ``quote`` from the :mod:`!pipes` " -"modules has been moved to the :mod:`shlex` module and documented. :func:" -"`~shlex.quote` properly escapes all characters in a string that might be " -"otherwise given special meaning by the shell." +"modules has been moved to the :mod:`shlex` module and " +"documented. :func:`~shlex.quote` properly escapes all characters in a " +"string that might be otherwise given special meaning by the shell." msgstr "" #: ../../whatsnew/3.3.rst:1789 @@ -3017,9 +3021,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " -"which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." -"unlink`. (Contributed by Martin von Löwis and Hynek Schlawack in :issue:" -"`4489`.)" +"which support the new ``dir_fd`` parameter in :func:`os.open` " +"and :func:`os.unlink`. (Contributed by Martin von Löwis and Hynek Schlawack " +"in :issue:`4489`.)" msgstr "" #: ../../whatsnew/3.3.rst:1825 @@ -3082,9 +3086,10 @@ msgstr "smtpd" #: ../../whatsnew/3.3.rst:1850 msgid "" -"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" -"`1870` (size extension). Per the standard, these extensions are enabled if " -"and only if the client initiates the session with an ``EHLO`` command." +"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) " +"and :rfc:`1870` (size extension). Per the standard, these extensions are " +"enabled if and only if the client initiates the session with an ``EHLO`` " +"command." msgstr "" #: ../../whatsnew/3.3.rst:1854 @@ -3100,11 +3105,11 @@ msgstr "smtplib" #: ../../whatsnew/3.3.rst:1862 msgid "" -"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." -"LMTP` classes now accept a ``source_address`` keyword argument to specify " -"the ``(host, port)`` to use as the source address in the bind call when " -"creating the outgoing socket. (Contributed by Paulo Scardine in :issue:" -"`11281`.)" +"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, " +"and :class:`~smtplib.LMTP` classes now accept a ``source_address`` keyword " +"argument to specify the ``(host, port)`` to use as the source address in the " +"bind call when creating the outgoing socket. (Contributed by Paulo Scardine " +"in :issue:`11281`.)" msgstr "" #: ../../whatsnew/3.3.rst:1868 @@ -3118,9 +3123,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:1872 msgid "" -"The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." -"starttls` method now accept an SSLContext parameter to control parameters of " -"the secure channel. (Contributed by Kasun Herath in :issue:`8809`.)" +"The :class:`~smtplib.SMTP_SSL` constructor and " +"the :meth:`~smtplib.SMTP.starttls` method now accept an SSLContext parameter " +"to control parameters of the secure channel. (Contributed by Kasun Herath " +"in :issue:`8809`.)" msgstr "" ":class:`~smtplib.SMTP_SSL` 構造函式和 :meth:`~smtplib.SMTP.starttls` 方法現在" "接受 SSLContext 參數來控制安全通道的參數。(由 Kasun Herath 在 :issue:`8809` " @@ -3168,22 +3174,22 @@ msgstr "" #: ../../whatsnew/3.3.rst:1894 msgid "" -"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" -"`10141`.)" +"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves " +"in :issue:`10141`.)" msgstr "" "(在 :issue:`10141` 中由 Matthias Fuchs 貢獻、並由 Tiago Gonçalves 更新。)" #: ../../whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " -"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." -"oracle.com/projects/rds <https://web.archive.org/web/20130115155505/https://" -"oss.oracle.com/projects/rds/>`__)." +"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://" +"oss.oracle.com/projects/rds <https://web.archive.org/web/20130115155505/" +"https://oss.oracle.com/projects/rds/>`__)." msgstr "" -":class:`~socket.socket` 類別現在支援 PF_RDS 協議系列(https://en.wikipedia." -"org/wiki/Reliable_Datagram_Sockets 和 `https://oss.oracle.com/projects/rds " -"<https://web.archive.org/web/20130115155505/https://oss.oracle.com/projects/" -"rds/>`__\\ )。" +":class:`~socket.socket` 類別現在支援 PF_RDS 協議系列(https://" +"en.wikipedia.org/wiki/Reliable_Datagram_Sockets 和 `https://oss.oracle.com/" +"projects/rds <https://web.archive.org/web/20130115155505/https://" +"oss.oracle.com/projects/rds/>`__\\ )。" #: ../../whatsnew/3.3.rst:1900 msgid "" @@ -3206,11 +3212,11 @@ msgstr "socketserver" #: ../../whatsnew/3.3.rst:1911 msgid "" -":class:`~socketserver.BaseServer` now has an overridable method :meth:" -"`~socketserver.BaseServer.service_actions` that is called by the :meth:" -"`~socketserver.BaseServer.serve_forever` method in the service loop. :class:" -"`~socketserver.ForkingMixIn` now uses this to clean up zombie child " -"processes. (Contributed by Justin Warkentin in :issue:`11109`.)" +":class:`~socketserver.BaseServer` now has an overridable " +"method :meth:`~socketserver.BaseServer.service_actions` that is called by " +"the :meth:`~socketserver.BaseServer.serve_forever` method in the service " +"loop. :class:`~socketserver.ForkingMixIn` now uses this to clean up zombie " +"child processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" #: ../../whatsnew/3.3.rst:1919 @@ -3219,9 +3225,10 @@ msgstr "sqlite3" #: ../../whatsnew/3.3.rst:1921 msgid "" -"New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." -"set_trace_callback` can be used to capture a trace of all sql commands " -"processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" +"New :class:`sqlite3.Connection` " +"method :meth:`~sqlite3.Connection.set_trace_callback` can be used to capture " +"a trace of all sql commands processed by sqlite. (Contributed by Torsten " +"Landschoff in :issue:`11688`.)" msgstr "" #: ../../whatsnew/3.3.rst:1928 @@ -3256,16 +3263,16 @@ msgstr "" #: ../../whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " -"be used if the private key is encrypted. (Contributed by Adam Simpkins in :" -"issue:`12803`.)" +"be used if the private key is encrypted. (Contributed by Adam Simpkins " +"in :issue:`12803`.)" msgstr "" #: ../../whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " -"supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." -"SSLContext.set_ecdh_curve` methods. (Contributed by Antoine Pitrou in :issue:" -"`13626` and :issue:`13627`.)" +"supported through the :meth:`~ssl.SSLContext.load_dh_params` " +"and :meth:`~ssl.SSLContext.set_ecdh_curve` methods. (Contributed by Antoine " +"Pitrou in :issue:`13626` and :issue:`13627`.)" msgstr "" #: ../../whatsnew/3.3.rst:1951 @@ -3278,9 +3285,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " -"its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" -"`~ssl.OP_NO_COMPRESSION` can be used to disable compression. (Contributed by " -"Antoine Pitrou in :issue:`13634`.)" +"its new :meth:`~ssl.SSLSocket.compression` method. The new " +"attribute :const:`~ssl.OP_NO_COMPRESSION` can be used to disable " +"compression. (Contributed by Antoine Pitrou in :issue:`13634`.)" msgstr "" #: ../../whatsnew/3.3.rst:1960 @@ -3292,9 +3299,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1964 msgid "" -"SSL errors can now be introspected more easily thanks to :attr:`~ssl." -"SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " -"by Antoine Pitrou in :issue:`14837`.)" +"SSL errors can now be introspected more easily thanks " +"to :attr:`~ssl.SSLError.library` and :attr:`~ssl.SSLError.reason` " +"attributes. (Contributed by Antoine Pitrou in :issue:`14837`.)" msgstr "" #: ../../whatsnew/3.3.rst:1968 @@ -3316,9 +3323,9 @@ msgstr "stat" #: ../../whatsnew/3.3.rst:1979 msgid "" -"The undocumented tarfile.filemode function has been moved to :func:`stat." -"filemode`. It can be used to convert a file's mode to a string of the form '-" -"rwxrwxrwx'." +"The undocumented tarfile.filemode function has been moved " +"to :func:`stat.filemode`. It can be used to convert a file's mode to a " +"string of the form '-rwxrwxrwx'." msgstr "" #: ../../whatsnew/3.3.rst:1983 @@ -3349,8 +3356,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " -"platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" -"`5870`.)" +"platform-independent fashion. (Contributed by Ross Lagerwall " +"in :issue:`5870`.)" msgstr "" #: ../../whatsnew/3.3.rst:2006 @@ -3381,9 +3388,9 @@ msgstr "tempfile" #: ../../whatsnew/3.3.rst:2023 msgid "" -":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." -"SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " -"(Contributed by Ryan Kelly in :issue:`9957`.)" +":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile.SpooledTemporaryFile.truncate` " +"method now accepts a ``size`` parameter. (Contributed by Ryan Kelly " +"in :issue:`9957`.)" msgstr "" #: ../../whatsnew/3.3.rst:2029 @@ -3403,11 +3410,10 @@ msgstr "threading" #: ../../whatsnew/3.3.rst:2039 msgid "" -":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" -"`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" -"`threading.Timer`, all of which used to be factory functions returning a " -"class instance, are now classes and may be subclassed. (Contributed by Éric " -"Araujo in :issue:`10968`.)" +":class:`threading.Condition`, :class:`threading.Semaphore`, :class:`threading.BoundedSemaphore`, :class:`threading.Event`, " +"and :class:`threading.Timer`, all of which used to be factory functions " +"returning a class instance, are now classes and may be subclassed. " +"(Contributed by Éric Araujo in :issue:`10968`.)" msgstr "" #: ../../whatsnew/3.3.rst:2045 @@ -3436,7 +3442,7 @@ msgstr ":pep:`418` 向 :mod:`time` 模組新增了新功能:" #: ../../whatsnew/3.3.rst:2061 msgid ":func:`~time.get_clock_info`: Get information on a clock." -msgstr ":func:`~time.get_clock_info`:獲取時鐘資訊。" +msgstr ":func:`~time.get_clock_info`:取得時鐘資訊。" #: ../../whatsnew/3.3.rst:2062 msgid "" @@ -3455,7 +3461,7 @@ msgstr "" msgid "" ":func:`~time.process_time`: Sum of the system and user CPU time of the " "current process." -msgstr ":func:`~time.process_time`:當前行程的系統和使用者 CPU 時間總和。" +msgstr ":func:`~time.process_time`:目前行程的系統和使用者 CPU 時間總和。" #: ../../whatsnew/3.3.rst:2069 msgid "Other new functions:" @@ -3463,19 +3469,19 @@ msgstr "其他新功能:" #: ../../whatsnew/3.3.rst:2071 msgid "" -":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." -"clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " -"Victor Stinner in :issue:`10278`.)" +":func:`~time.clock_getres`, :func:`~time.clock_gettime` " +"and :func:`~time.clock_settime` functions with :samp:`CLOCK_{xxx}` " +"constants. (Contributed by Victor Stinner in :issue:`10278`.)" msgstr "" -":func:`~time.clock_getres`、:func:`~time.clock_gettime` 和 :func:`~time." -"clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 Victor Stinner 在 :" -"issue:`10278` 中貢獻。)" +":func:`~time.clock_getres`、:func:`~time.clock_gettime` " +"和 :func:`~time.clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 " +"Victor Stinner 在 :issue:`10278` 中貢獻。)" #: ../../whatsnew/3.3.rst:2075 msgid "" -"To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" -"`ValueError` when passed a negative sleep value. Previously this was an " -"error on posix, but produced an infinite sleep on Windows." +"To improve cross platform consistency, :func:`~time.sleep` now raises " +"a :exc:`ValueError` when passed a negative sleep value. Previously this was " +"an error on posix, but produced an infinite sleep on Windows." msgstr "" #: ../../whatsnew/3.3.rst:2081 @@ -3491,8 +3497,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2087 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " -"provide support for :pep:`3115` compliant dynamic type creation. (:issue:" -"`14588`)" +"provide support for :pep:`3115` compliant dynamic type creation. " +"(:issue:`14588`)" msgstr "" #: ../../whatsnew/3.3.rst:2092 @@ -3503,8 +3509,8 @@ msgstr "unittest" msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " -"as context managers. (Contributed by Ezio Melotti and Winston Ewert in :" -"issue:`10775`.)" +"as context managers. (Contributed by Ezio Melotti and Winston Ewert " +"in :issue:`10775`.)" msgstr "" #: ../../whatsnew/3.3.rst:2099 @@ -3540,12 +3546,12 @@ msgstr "webbrowser" #: ../../whatsnew/3.3.rst:2118 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " -"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" -"program:`chromium-browser` depending on the version and operating system), " -"and the generic launchers :program:`xdg-open`, from the FreeDesktop.org " -"project, and :program:`gvfs-open`, which is the default URI handler for " -"GNOME 3. (The former contributed by Arnaud Calmettes in :issue:`13620`, the " -"latter by Matthias Klose in :issue:`14493`.)" +"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` " +"or :program:`chromium-browser` depending on the version and operating " +"system), and the generic launchers :program:`xdg-open`, from the " +"FreeDesktop.org project, and :program:`gvfs-open`, which is the default URI " +"handler for GNOME 3. (The former contributed by Arnaud Calmettes " +"in :issue:`13620`, the latter by Matthias Klose in :issue:`14493`.)" msgstr "" #: ../../whatsnew/3.3.rst:2128 @@ -3555,12 +3561,12 @@ msgstr "xml.etree.ElementTree" #: ../../whatsnew/3.3.rst:2130 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " -"default; there is no longer a need to explicitly import :mod:`xml.etree." -"cElementTree` (this module stays for backwards compatibility, but is now " -"deprecated). In addition, the ``iter`` family of methods of :class:`~xml." -"etree.ElementTree.Element` has been optimized (rewritten in C). The module's " -"documentation has also been greatly improved with added examples and a more " -"detailed reference." +"default; there is no longer a need to explicitly " +"import :mod:`xml.etree.cElementTree` (this module stays for backwards " +"compatibility, but is now deprecated). In addition, the ``iter`` family of " +"methods of :class:`~xml.etree.ElementTree.Element` has been optimized " +"(rewritten in C). The module's documentation has also been greatly improved " +"with added examples and a more detailed reference." msgstr "" #: ../../whatsnew/3.3.rst:2140 @@ -3620,19 +3626,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2167 msgid "" -"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" -"`15026`.)" +"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` " +"and :issue:`15026`.)" msgstr "" "(由 Serhiy Storchaka 於 :issue:`14624`、:issue:`14738` 和 :issue:`15026` 貢" "獻。)" #: ../../whatsnew/3.3.rst:2172 msgid "Build and C API Changes" -msgstr "建置和 C API 更改" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.3.rst:2174 msgid "Changes to Python's build process and to the C API include:" -msgstr "Python 建置程序和 C API 的更改包括:" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.3.rst:2176 msgid "New :pep:`3118` related function:" @@ -3699,27 +3705,18 @@ msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" #: ../../whatsnew/3.3.rst:2198 -msgid "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" -msgstr "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgid ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgstr ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" #: ../../whatsnew/3.3.rst:2200 msgid "" ":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" -"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" -"`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" +"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" #: ../../whatsnew/3.3.rst:2203 -msgid "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" -msgstr "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" +msgid ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" +msgstr ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" #: ../../whatsnew/3.3.rst:2204 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" @@ -3730,8 +3727,8 @@ msgid "" ":c:macro:`PyArg_ParseTuple` now accepts a :class:`bytearray` for the ``c`` " "format (:issue:`12380`)." msgstr "" -":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 (:" -"issue:`12380`)。" +":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 " +"(:issue:`12380`)。" #: ../../whatsnew/3.3.rst:2212 msgid "Deprecated" @@ -3767,26 +3764,26 @@ msgstr "" #: ../../whatsnew/3.3.rst:2230 msgid "" -"The ``unicode_internal`` codec has been deprecated because of the :pep:" -"`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " -"(``utf-32-le`` or ``utf-32-be``)" +"The ``unicode_internal`` codec has been deprecated because of " +"the :pep:`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or " +"UTF-32 (``utf-32-le`` or ``utf-32-be``)" msgstr "" #: ../../whatsnew/3.3.rst:2233 msgid "" -":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." -"mlsd`" +":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: " +"use :meth:`ftplib.FTP.mlsd`" msgstr "" -":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使用 :meth:`ftplib.FTP." -"mlsd`" +":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使" +"用 :meth:`ftplib.FTP.mlsd`" #: ../../whatsnew/3.3.rst:2235 msgid "" ":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." msgstr "" -":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢查 :ref:" -"`subprocess-replacements` 部分 (:issue:`11377`)。" +":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢" +"查 :ref:`subprocess-replacements` 部分 (:issue:`11377`)。" #: ../../whatsnew/3.3.rst:2237 msgid "" @@ -3803,8 +3800,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2242 msgid "" -"The behaviour of :func:`time.clock` depends on the platform: use the new :" -"func:`time.perf_counter` or :func:`time.process_time` function instead, " +"The behaviour of :func:`time.clock` depends on the platform: use the " +"new :func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" @@ -3842,17 +3839,17 @@ msgstr "" #: ../../whatsnew/3.3.rst:2272 msgid "" -"Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" -"`Py_UNICODE*` types:" +"Unicode functions and methods using :c:type:`Py_UNICODE` " +"and :c:expr:`Py_UNICODE*` types:" msgstr "" #: ../../whatsnew/3.3.rst:2275 msgid "" -":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" -"c:func:`PyUnicode_FromKindAndData`" +":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` " +"or :c:func:`PyUnicode_FromKindAndData`" msgstr "" -":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` 或 :" -"c:func:`PyUnicode_FromKindAndData`" +":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` " +"或 :c:func:`PyUnicode_FromKindAndData`" #: ../../whatsnew/3.3.rst:2277 msgid "" @@ -3864,19 +3861,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2279 msgid "" -":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" -"`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" +":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` " +"with :c:macro:`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" msgstr "" -":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` 與 :c:macro:" -"`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" +":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` " +"與 :c:macro:`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" #: ../../whatsnew/3.3.rst:2281 msgid "" -":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" -"`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" +":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: " +"use :c:macro:`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" msgstr "" -":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使用 :c:macro:" -"`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" +":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使" +"用 :c:macro:`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" #: ../../whatsnew/3.3.rst:2283 msgid "" @@ -3888,11 +3885,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:2286 msgid "" -":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" -"func:`PyUnicode_AsWideCharString`" +":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` " +"or :c:func:`PyUnicode_AsWideCharString`" msgstr "" -":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` 或 :" -"c:func:`PyUnicode_AsWideCharString`" +":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` " +"或 :c:func:`PyUnicode_AsWideCharString`" #: ../../whatsnew/3.3.rst:2288 msgid ":c:func:`!PyUnicode_GetMax`" @@ -3904,29 +3901,29 @@ msgstr "操作 Py_UNICODE* 字串的函式和巨集:" #: ../../whatsnew/3.3.rst:2293 msgid "" -":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" -"macro:`PyUnicode_GET_LENGTH`" +":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` " +"or :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" -":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` 或 :c:" -"macro:`PyUnicode_GET_LENGTH`" +":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` " +"或 :c:macro:`PyUnicode_GET_LENGTH`" #: ../../whatsnew/3.3.rst:2295 msgid "" -":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" -"c:func:`PyUnicode_FromFormat`" +":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` " +"or :c:func:`PyUnicode_FromFormat`" msgstr "" -":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :" -"c:func:`PyUnicode_FromFormat`" +":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` " +"或 :c:func:`PyUnicode_FromFormat`" #: ../../whatsnew/3.3.rst:2297 msgid "" -":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" -"`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" -"`PyUnicode_Substring`" +":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!" +"Py_UNICODE_strncpy()`, :c:macro:`!Py_UNICODE_COPY()`: " +"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -":c:macro:`!Py_UNICODE_strcpy()`、:c:macro:`!Py_UNICODE_strncpy()`、:c:macro:" -"`!Py_UNICODE_COPY()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" -"`PyUnicode_Substring`" +":c:macro:`!Py_UNICODE_strcpy()`、:c:macro:`!" +"Py_UNICODE_strncpy()`、:c:macro:`!Py_UNICODE_COPY()`:使" +"用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" #: ../../whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" @@ -3938,11 +3935,11 @@ msgstr ":c:macro:`!Py_UNICODE_strncmp()`: 使用 :c:func:`PyUnicode_Tailmatch`" #: ../../whatsnew/3.3.rst:2302 msgid "" -":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" -"func:`PyUnicode_FindChar`" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: " +"use :c:func:`PyUnicode_FindChar`" msgstr "" -":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使用 :c:" -"func:`PyUnicode_FindChar`" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使" +"用 :c:func:`PyUnicode_FindChar`" #: ../../whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" @@ -3966,11 +3963,11 @@ msgstr ":c:func:`!PyUnicode_EncodeUTF7`" #: ../../whatsnew/3.3.rst:2311 msgid "" -":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" -"`PyUnicode_AsUTF8String`" +":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` " +"or :c:func:`PyUnicode_AsUTF8String`" msgstr "" -":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` 或 :c:func:" -"`PyUnicode_AsUTF8String`" +":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` " +"或 :c:func:`PyUnicode_AsUTF8String`" #: ../../whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF32`" @@ -3982,19 +3979,19 @@ msgstr ":c:func:`!PyUnicode_EncodeUTF16`" #: ../../whatsnew/3.3.rst:2315 msgid "" -":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" -"`PyUnicode_AsUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeUnicodeEscape` " +"use :c:func:`PyUnicode_AsUnicodeEscapeString`" msgstr "" -":c:func:`!PyUnicode_EncodeUnicodeEscape` 使用 :c:func:" -"`PyUnicode_AsUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeUnicodeEscape` 使" +"用 :c:func:`PyUnicode_AsUnicodeEscapeString`" #: ../../whatsnew/3.3.rst:2317 msgid "" -":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" -"`PyUnicode_AsRawUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeRawUnicodeEscape` " +"use :c:func:`PyUnicode_AsRawUnicodeEscapeString`" msgstr "" -":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使用 :c:func:" -"`PyUnicode_AsRawUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使" +"用 :c:func:`PyUnicode_AsRawUnicodeEscapeString`" #: ../../whatsnew/3.3.rst:2319 msgid "" @@ -4017,11 +4014,11 @@ msgstr ":c:func:`!PyUnicode_TranslateCharmap`" #: ../../whatsnew/3.3.rst:2323 msgid "" -":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" -"func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" +":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` " +"or :c:func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" msgstr "" -":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` 或 :c:" -"func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" +":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` " +"或 :c:func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" #: ../../whatsnew/3.3.rst:2325 msgid "" @@ -4058,8 +4055,8 @@ msgstr "移植 Python 程式碼" #: ../../whatsnew/3.3.rst:2347 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " -"environment variable to ``0`` to disable hash randomization. See also the :" -"meth:`object.__hash__` method." +"environment variable to ``0`` to disable hash randomization. See also " +"the :meth:`object.__hash__` method." msgstr "" #: ../../whatsnew/3.3.rst:2351 @@ -4073,19 +4070,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2357 msgid "" -":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" -"`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " -"out of range. :exc:`OSError` is now raised if C functions :c:func:`gmtime` " -"or :c:func:`localtime` failed." +":issue:`13847`, :issue:`14180`: :mod:`time` " +"and :mod:`datetime`: :exc:`OverflowError` is now raised instead " +"of :exc:`ValueError` if a timestamp is out of range. :exc:`OSError` is now " +"raised if C functions :c:func:`gmtime` or :c:func:`localtime` failed." msgstr "" #: ../../whatsnew/3.3.rst:2362 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " -"sourceless bytecode file, make sure to call :func:`importlib." -"invalidate_caches` to clear out the cache for the finders to notice the new " -"file." +"sourceless bytecode file, make sure to " +"call :func:`importlib.invalidate_caches` to clear out the cache for the " +"finders to notice the new file." msgstr "" #: ../../whatsnew/3.3.rst:2367 @@ -4103,8 +4100,9 @@ msgid "" "was implemented that the default value remained -1. If you need to continue " "to perform a relative import followed by an absolute import, then perform " "the relative import using an index of 1, followed by another import using an " -"index of 0. It is preferred, though, that you use :func:`importlib." -"import_module` rather than call :func:`__import__` directly." +"index of 0. It is preferred, though, that you " +"use :func:`importlib.import_module` rather than call :func:`__import__` " +"directly." msgstr "" #: ../../whatsnew/3.3.rst:2380 @@ -4124,10 +4122,10 @@ msgstr "" msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " -"finder, you will need to remove keys paired with values of ``None`` **and** :" -"class:`!imp.NullImporter` to be backwards-compatible. This will lead to " -"extra overhead on older versions of Python that re-insert ``None`` into :" -"data:`sys.path_importer_cache` where it represents the use of implicit " +"finder, you will need to remove keys paired with values of ``None`` " +"**and** :class:`!imp.NullImporter` to be backwards-compatible. This will " +"lead to extra overhead on older versions of Python that re-insert ``None`` " +"into :data:`sys.path_importer_cache` where it represents the use of implicit " "finders, but semantically it should not change anything." msgstr "" @@ -4145,16 +4143,16 @@ msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " "emulation failed to match the behaviour of the real import system. The " -"import emulation itself is still present, but is now deprecated. The :func:" -"`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` functions special " -"case the standard import hooks so they are still supported even though they " -"do not provide the non-standard ``iter_modules()`` method." +"import emulation itself is still present, but is now deprecated. " +"The :func:`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` " +"functions special case the standard import hooks so they are still supported " +"even though they do not provide the non-standard ``iter_modules()`` method." msgstr "" #: ../../whatsnew/3.3.rst:2409 msgid "" -"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" -"func:`email.header.decode_header` has been fixed. Code that uses the " +"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done " +"by :func:`email.header.decode_header` has been fixed. Code that uses the " "standard idiom to convert encoded headers into unicode " "(``str(make_header(decode_header(h))``) will see no change, but code that " "looks at the individual tuples returned by decode_header will see that " @@ -4176,9 +4174,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:2425 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " -"``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." -"error_proto` errors may need to be changed if errors on ``quit`` are " -"encountered by a particular application (:issue:`11291`)." +"``poplib`` methods. Code that assumes ``quit`` does not " +"raise :exc:`poplib.error_proto` errors may need to be changed if errors on " +"``quit`` are encountered by a particular application (:issue:`11291`)." msgstr "" #: ../../whatsnew/3.3.rst:2430 @@ -4201,9 +4199,9 @@ msgstr "已棄用的變數 ``time.accept2dyear`` 已被刪除。" #: ../../whatsnew/3.3.rst:2438 msgid "" -"The deprecated ``Context._clamp`` attribute has been removed from the :mod:" -"`decimal` module. It was previously replaced by the public attribute :attr:" -"`~decimal.Context.clamp`. (See :issue:`8540`.)" +"The deprecated ``Context._clamp`` attribute has been removed from " +"the :mod:`decimal` module. It was previously replaced by the public " +"attribute :attr:`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" #: ../../whatsnew/3.3.rst:2442 @@ -4264,16 +4262,16 @@ msgid "" "functions using this type are deprecated (but will stay available for at " "least five years). If you were using low-level Unicode APIs to construct " "and access unicode objects and you want to benefit of the memory footprint " -"reduction provided by :pep:`393`, you have to convert your code to the new :" -"doc:`Unicode API <../c-api/unicode>`." +"reduction provided by :pep:`393`, you have to convert your code to the " +"new :doc:`Unicode API <../c-api/unicode>`." msgstr "" #: ../../whatsnew/3.3.rst:2481 msgid "" -"However, if you only have been using high-level functions such as :c:func:" -"`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" -"`PyUnicode_FromFormat()`, your code will automatically take advantage of the " -"new unicode representations." +"However, if you only have been using high-level functions such " +"as :c:func:`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` " +"or :c:func:`PyUnicode_FromFormat()`, your code will automatically take " +"advantage of the new unicode representations." msgstr "" #: ../../whatsnew/3.3.rst:2486 @@ -4284,8 +4282,8 @@ msgstr ":c:func:`PyImport_GetMagicNumber` 現在在失敗時回傳 ``-1``。" msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " -"This also means that the value of *level* used by :c:func:" -"`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." +"This also means that the value of *level* used " +"by :c:func:`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" #: ../../whatsnew/3.3.rst:2495 diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index d928fca84e..7c5cc676f0 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-26 00:14+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,11 +53,11 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.4.rst:82 msgid "No new syntax features were added in Python 3.4." -msgstr "" +msgstr "Python 3.4 沒有新增任何新的語法特性。" #: ../../whatsnew/3.4.rst:84 msgid "Other new features:" -msgstr "" +msgstr "其他新特性:" #: ../../whatsnew/3.4.rst:86 msgid ":ref:`pip should always be available <whatsnew-pep-453>` (:pep:`453`)." @@ -71,8 +71,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:89 msgid "" -"command line option for :ref:`isolated mode <whatsnew-isolated-mode>` (:" -"issue:`16499`)." +"command line option for :ref:`isolated mode <whatsnew-isolated-mode>` " +"(:issue:`16499`)." msgstr "" #: ../../whatsnew/3.4.rst:91 @@ -83,8 +83,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:93 msgid "" -":ref:`A ModuleSpec Type <whatsnew-pep-451>` for the Import System (:pep:" -"`451`). (Affects importer authors.)" +":ref:`A ModuleSpec Type <whatsnew-pep-451>` for the Import System " +"(:pep:`451`). (Affects importer authors.)" msgstr "" #: ../../whatsnew/3.4.rst:95 @@ -95,37 +95,42 @@ msgstr "" #: ../../whatsnew/3.4.rst:98 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.4.rst:100 msgid "" ":mod:`asyncio`: :ref:`New provisional API for asynchronous IO <whatsnew-" "asyncio>` (:pep:`3156`)." msgstr "" +":mod:`asyncio`: :ref:`新的用於非同步 IO 的臨時 API <whatsnew-asyncio>` " +"(:pep:`3156`)。" #: ../../whatsnew/3.4.rst:102 msgid "" ":mod:`ensurepip`: :ref:`Bootstrapping the pip installer <whatsnew-" "ensurepip>` (:pep:`453`)." msgstr "" +":mod:`ensurepip`: :ref:`初始建置 pip 安裝程式 <whatsnew-ensurepip>` " +"(:pep:`453`)。" #: ../../whatsnew/3.4.rst:104 msgid "" -":mod:`enum`: :ref:`Support for enumeration types <whatsnew-enum>` (:pep:" -"`435`)." -msgstr "" +":mod:`enum`: :ref:`Support for enumeration types <whatsnew-enum>` " +"(:pep:`435`)." +msgstr ":mod:`enum`: :ref:`支援列舉型別 <whatsnew-enum>` (:pep:`435`)。" #: ../../whatsnew/3.4.rst:106 msgid "" -":mod:`pathlib`: :ref:`Object-oriented filesystem paths <whatsnew-pathlib>` (:" -"pep:`428`)." +":mod:`pathlib`: :ref:`Object-oriented filesystem paths <whatsnew-pathlib>` " +"(:pep:`428`)." msgstr "" +":mod:`pathlib`: :ref:`物件導向檔案系統路徑 <whatsnew-pathlib>` (:pep:`428`)。" #: ../../whatsnew/3.4.rst:108 msgid "" ":mod:`selectors`: :ref:`High-level and efficient I/O multiplexing <whatsnew-" -"selectors>`, built upon the :mod:`select` module primitives (part of :pep:" -"`3156`)." +"selectors>`, built upon the :mod:`select` module primitives (part " +"of :pep:`3156`)." msgstr "" #: ../../whatsnew/3.4.rst:111 @@ -139,34 +144,38 @@ msgid "" ":mod:`tracemalloc`: :ref:`Trace Python memory allocations <whatsnew-" "tracemalloc>` (:pep:`454`)." msgstr "" +":mod:`tracemalloc`: :ref:`追蹤 Python 記憶體配置 <whatsnew-tracemalloc>` " +"(:pep:`454`)。" #: ../../whatsnew/3.4.rst:116 msgid "Significantly improved library modules:" -msgstr "" +msgstr "顯著改進的函式庫模組:" #: ../../whatsnew/3.4.rst:118 msgid "" -":ref:`Single-dispatch generic functions <whatsnew-singledispatch>` in :mod:" -"`functools` (:pep:`443`)." +":ref:`Single-dispatch generic functions <whatsnew-singledispatch>` " +"in :mod:`functools` (:pep:`443`)." msgstr "" #: ../../whatsnew/3.4.rst:120 msgid "" "New :mod:`pickle` :ref:`protocol 4 <whatsnew-protocol-4>` (:pep:`3154`)." -msgstr "" +msgstr "新的 :mod:`pickle` :ref:`協定 4 <whatsnew-protocol-4>` (:pep:`3154`)。" #: ../../whatsnew/3.4.rst:121 msgid "" ":mod:`multiprocessing` now has :ref:`an option to avoid using os.fork on " "Unix <whatsnew-multiprocessing-no-fork>` (:issue:`8713`)." msgstr "" +":mod:`multiprocessing` 現在有\\ :ref:`一個選項可以避免在 Unix 上使用 os.fork " +"<whatsnew-multiprocessing-no-fork>` (:issue:`8713`)。" #: ../../whatsnew/3.4.rst:123 msgid "" -":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a new :" -"mod:`~email.message.Message` subclass (:class:`~email.contentmanager." -"EmailMessage`) that :ref:`simplify MIME handling " -"<whatsnew_email_contentmanager>` (:issue:`18891`)." +":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a " +"new :mod:`~email.message.Message` subclass " +"(:class:`~email.contentmanager.EmailMessage`) that :ref:`simplify MIME " +"handling <whatsnew_email_contentmanager>` (:issue:`18891`)." msgstr "" #: ../../whatsnew/3.4.rst:127 @@ -178,7 +187,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:130 msgid "The :mod:`ipaddress` module API has been declared stable" -msgstr "" +msgstr ":mod:`ipaddress` 模組 API 已宣告為穩定版本" #: ../../whatsnew/3.4.rst:132 msgid "Security improvements:" @@ -186,8 +195,8 @@ msgstr "安全性改進:" #: ../../whatsnew/3.4.rst:134 msgid "" -":ref:`Secure and interchangeable hash algorithm <whatsnew-pep-456>` (:pep:" -"`456`)." +":ref:`Secure and interchangeable hash algorithm <whatsnew-pep-456>` " +"(:pep:`456`)." msgstr "" #: ../../whatsnew/3.4.rst:136 @@ -198,9 +207,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:138 msgid "" -"New command line option for :ref:`isolated mode <whatsnew-isolated-mode>`, (:" -"issue:`16499`)." +"New command line option for :ref:`isolated mode <whatsnew-isolated-mode>`, " +"(:issue:`16499`)." msgstr "" +"用於\\ :ref:`隔離模式 <whatsnew-isolated-mode>`\\ 的新命令列選項 " +"(:issue:`16499`)。" #: ../../whatsnew/3.4.rst:140 msgid "" @@ -220,10 +231,12 @@ msgid "" "A new :func:`hashlib.pbkdf2_hmac` function provides the `PKCS#5 password-" "based key derivation function 2 <https://en.wikipedia.org/wiki/PBKDF2>`_." msgstr "" +"新的 :func:`hashlib.pbkdf2_hmac` 函式提供了\\ `基於密碼的 PKCS#5 密鑰生成函" +"式 2 <https://en.wikipedia.org/wiki/PBKDF2>`_。" #: ../../whatsnew/3.4.rst:148 msgid ":ref:`TLSv1.1 and TLSv1.2 support <whatsnew-tls-11-12>` for :mod:`ssl`." -msgstr "" +msgstr ":mod:`ssl` :ref:`對 TLSv1.1 和 TLSv1.2 的支援 <whatsnew-tls-11-12>`。" #: ../../whatsnew/3.4.rst:149 msgid "" @@ -246,14 +259,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:155 msgid "" "All modules in the standard library that support SSL now support server " -"certificate verification, including hostname matching (:func:`ssl." -"match_hostname`) and CRLs (Certificate Revocation lists, see :func:`ssl." -"SSLContext.load_verify_locations`)." +"certificate verification, including hostname matching " +"(:func:`ssl.match_hostname`) and CRLs (Certificate Revocation lists, " +"see :func:`ssl.SSLContext.load_verify_locations`)." msgstr "" #: ../../whatsnew/3.4.rst:160 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.4.rst:162 msgid ":ref:`Safe object finalization <whatsnew-pep-442>` (:pep:`442`)." @@ -363,7 +376,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:237 msgid "Documentation Changes" -msgstr "" +msgstr "文件更動" #: ../../whatsnew/3.4.rst:239 msgid "" @@ -378,8 +391,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:247 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" #: ../../whatsnew/3.4.rst:253 @@ -413,21 +426,19 @@ msgstr "" #: ../../whatsnew/3.4.rst:272 msgid ":func:`os.get_inheritable`, :func:`os.set_inheritable`" -msgstr ":func:`os.get_inheritable`, :func:`os.set_inheritable`" +msgstr ":func:`os.get_inheritable`、:func:`os.set_inheritable`" #: ../../whatsnew/3.4.rst:273 msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" -msgstr ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" +msgstr ":func:`os.get_handle_inheritable`、:func:`os.set_handle_inheritable`" #: ../../whatsnew/3.4.rst:274 -msgid "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" -msgstr "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgid ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgstr ":meth:`socket.socket.get_inheritable`、:meth:`socket.socket.set_inheritable`" #: ../../whatsnew/3.4.rst:278 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" -msgstr "" +msgstr ":pep:`446` - 使新建立的檔案描述器不可繼承" #: ../../whatsnew/3.4.rst:279 ../../whatsnew/3.4.rst:1811 msgid "PEP written and implemented by Victor Stinner." @@ -435,7 +446,7 @@ msgstr "由 Victor Stinner 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:285 msgid "Improvements to Codec Handling" -msgstr "" +msgstr "編解碼器處理的改進" #: ../../whatsnew/3.4.rst:287 msgid "" @@ -448,19 +459,20 @@ msgstr "" #: ../../whatsnew/3.4.rst:294 msgid "" -"As a key step in clarifying the situation, the :meth:`codecs.encode` and :" -"meth:`codecs.decode` convenience functions are now properly documented in " -"Python 2.7, 3.3 and 3.4. These functions have existed in the :mod:`codecs` " -"module (and have been covered by the regression test suite) since Python " -"2.4, but were previously only discoverable through runtime introspection." +"As a key step in clarifying the situation, the :meth:`codecs.encode` " +"and :meth:`codecs.decode` convenience functions are now properly documented " +"in Python 2.7, 3.3 and 3.4. These functions have existed in " +"the :mod:`codecs` module (and have been covered by the regression test " +"suite) since Python 2.4, but were previously only discoverable through " +"runtime introspection." msgstr "" #: ../../whatsnew/3.4.rst:300 msgid "" -"Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" -"`bytearray`, the :mod:`codecs` convenience functions support arbitrary " -"codecs in both Python 2 and Python 3, rather than being limited to Unicode " -"text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " +"Unlike the convenience methods on :class:`str`, :class:`bytes` " +"and :class:`bytearray`, the :mod:`codecs` convenience functions support " +"arbitrary codecs in both Python 2 and Python 3, rather than being limited to " +"Unicode text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " "conversions (in Python 2)." msgstr "" @@ -568,6 +580,11 @@ msgid "" ">>> decode(b\"68656c6c6f\", \"hex\")\n" "b'hello'" msgstr "" +">>> from codecs import encode, decode\n" +">>> encode(b\"hello\", \"hex\")\n" +"b'68656c6c6f'\n" +">>> decode(b\"68656c6c6f\", \"hex\")\n" +"b'hello'" #: ../../whatsnew/3.4.rst:370 msgid "" @@ -577,15 +594,15 @@ msgstr "" #: ../../whatsnew/3.4.rst:373 msgid "" -"(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" -"`17828` and :issue:`19619`.)" +"(Contributed by Nick Coghlan " +"in :issue:`7475`, :issue:`17827`, :issue:`17828` and :issue:`19619`.)" msgstr "" -"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` 和 :issue:" -"`19619` 中貢獻。)" +"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` " +"和 :issue:`19619` 中貢獻。)" #: ../../whatsnew/3.4.rst:380 msgid "PEP 451: A ModuleSpec Type for the Import System" -msgstr "" +msgstr "PEP 451:用於引入系統的 ModuleSpec 型別" #: ../../whatsnew/3.4.rst:382 msgid "" @@ -602,9 +619,9 @@ msgid "" "Furthermore, they should be transparent to everyone but importer authors. " "Key finder and loader methods have been deprecated, but they will continue " "working. New importers should use the new methods described in the PEP. " -"Existing importers should be updated to implement the new methods. See the :" -"ref:`deprecated-3.4` section for a list of methods that should be replaced " -"and their replacements." +"Existing importers should be updated to implement the new methods. See " +"the :ref:`deprecated-3.4` section for a list of methods that should be " +"replaced and their replacements." msgstr "" #: ../../whatsnew/3.4.rst:400 @@ -623,8 +640,8 @@ msgstr "" msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " -"evaluating has no elements. (Contributed by Julian Berman in :issue:" -"`18111`.)" +"evaluating has no elements. (Contributed by Julian Berman " +"in :issue:`18111`.)" msgstr "" #: ../../whatsnew/3.4.rst:411 @@ -634,9 +651,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:413 msgid "" "Module ``__file__`` attributes (and related values) should now always " -"contain absolute paths by default, with the sole exception of ``__main__." -"__file__`` when a script has been executed directly using a relative path. " -"(Contributed by Brett Cannon in :issue:`18416`.)" +"contain absolute paths by default, with the sole exception of " +"``__main__.__file__`` when a script has been executed directly using a " +"relative path. (Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" #: ../../whatsnew/3.4.rst:418 @@ -664,8 +681,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:431 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " -"buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" -"`15958`.)" +"buffer objects as arguments. (Contributed by Antoine Pitrou " +"in :issue:`15958`.)" msgstr "" #: ../../whatsnew/3.4.rst:435 @@ -684,9 +701,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:443 msgid "" -":class:`memoryview` is now registered as a :class:`Sequence <collections." -"abc>`, and supports the :func:`reversed` builtin. (Contributed by Nick " -"Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" +":class:`memoryview` is now registered as a :class:`Sequence " +"<collections.abc>`, and supports the :func:`reversed` builtin. (Contributed " +"by Nick Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" #: ../../whatsnew/3.4.rst:447 @@ -699,8 +716,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:451 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " -"specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" -"`16148`.)" +"specification (see :pep:`424`). (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:457 @@ -737,11 +754,11 @@ msgstr "ensurepip" #: ../../whatsnew/3.4.rst:483 msgid "" -"The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" -"`453` implementation. In the normal course of events end users will not " -"need to interact with this module, but it can be used to manually bootstrap " -"``pip`` if the automated bootstrapping into an installation or virtual " -"environment was declined." +"The new :mod:`ensurepip` module is the primary infrastructure for " +"the :pep:`453` implementation. In the normal course of events end users " +"will not need to interact with this module, but it can be used to manually " +"bootstrap ``pip`` if the automated bootstrapping into an installation or " +"virtual environment was declined." msgstr "" #: ../../whatsnew/3.4.rst:489 @@ -771,10 +788,10 @@ msgstr "enum" #: ../../whatsnew/3.4.rst:509 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " -"implementation of enumeration types, allowing other modules (such as :mod:" -"`socket`) to provide more informative error messages and better debugging " -"support by replacing opaque integer constants with backwards compatible " -"enumeration values." +"implementation of enumeration types, allowing other modules (such " +"as :mod:`socket`) to provide more informative error messages and better " +"debugging support by replacing opaque integer constants with backwards " +"compatible enumeration values." msgstr "" #: ../../whatsnew/3.4.rst:517 @@ -814,9 +831,9 @@ msgstr "selectors" #: ../../whatsnew/3.4.rst:546 msgid "" -"The new :mod:`selectors` module (created as part of implementing :pep:" -"`3156`) allows high-level and efficient I/O multiplexing, built upon the :" -"mod:`select` module primitives." +"The new :mod:`selectors` module (created as part of " +"implementing :pep:`3156`) allows high-level and efficient I/O multiplexing, " +"built upon the :mod:`select` module primitives." msgstr "" #: ../../whatsnew/3.4.rst:554 @@ -916,9 +933,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:615 ../../whatsnew/3.4.rst:1542 msgid "" -"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" -"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" -"`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept " +"any :term:`bytes-like object`. (Contributed by Serhiy Storchaka " +"in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:621 @@ -961,21 +978,22 @@ msgstr "base64" #: ../../whatsnew/3.4.rst:646 msgid "" -"The encoding and decoding functions in :mod:`base64` now accept any :term:" -"`bytes-like object` in cases where it previously required a :class:`bytes` " -"or :class:`bytearray` instance. (Contributed by Nick Coghlan in :issue:" -"`17839`.)" +"The encoding and decoding functions in :mod:`base64` now accept " +"any :term:`bytes-like object` in cases where it previously required " +"a :class:`bytes` or :class:`bytearray` instance. (Contributed by Nick " +"Coghlan in :issue:`17839`.)" msgstr "" #: ../../whatsnew/3.4.rst:651 msgid "" -"New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" -"`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " -"encode and decode binary data from and to ``Ascii85`` and the git/mercurial " -"``Base85`` formats, respectively. The ``a85`` functions have options that " -"can be used to make them compatible with the variants of the ``Ascii85`` " -"encoding, including the Adobe variant. (Contributed by Martin Morrison, the " -"Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" +"New " +"functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:`~base64.b85encode`, " +"and :func:`~base64.b85decode` provide the ability to encode and decode " +"binary data from and to ``Ascii85`` and the git/mercurial ``Base85`` " +"formats, respectively. The ``a85`` functions have options that can be used " +"to make them compatible with the variants of the ``Ascii85`` encoding, " +"including the Adobe variant. (Contributed by Martin Morrison, the Mercurial " +"project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" #: ../../whatsnew/3.4.rst:661 @@ -1017,21 +1035,21 @@ msgstr "" #: ../../whatsnew/3.4.rst:686 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " -"for utility scripts to handle inflexible APIs that write their output to :" -"data:`sys.stdout` and don't provide any options to redirect it. Using the " -"context manager, the :data:`sys.stdout` output can be redirected to any " +"for utility scripts to handle inflexible APIs that write their output " +"to :data:`sys.stdout` and don't provide any options to redirect it. Using " +"the context manager, the :data:`sys.stdout` output can be redirected to any " "other stream or, in conjunction with :class:`io.StringIO`, to a string. The " "latter can be especially useful, for example, to capture output from a " "function that was written to implement a command line interface. It is " -"recommended only for utility scripts because it affects the global state of :" -"data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" +"recommended only for utility scripts because it affects the global state " +"of :data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" #: ../../whatsnew/3.4.rst:697 msgid "" -"The :mod:`contextlib` documentation has also been updated to include a :ref:" -"`discussion <single-use-reusable-and-reentrant-cms>` of the differences " -"between single use, reusable and reentrant context managers." +"The :mod:`contextlib` documentation has also been updated to include " +"a :ref:`discussion <single-use-reusable-and-reentrant-cms>` of the " +"differences between single use, reusable and reentrant context managers." msgstr "" #: ../../whatsnew/3.4.rst:703 @@ -1052,8 +1070,8 @@ msgstr "dis" #: ../../whatsnew/3.4.rst:714 msgid "" -"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" -"func:`~dis.disassemble` now accept a keyword-only *file* argument that " +"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, " +"and :func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" @@ -1101,12 +1119,13 @@ msgstr "" msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" -"readable form and for iterating over instructions. The :class:`~dis." -"Bytecode` constructor takes the same arguments that :func:`~dis." -"get_instruction` does (plus an optional *current_offset*), and the resulting " -"object can be iterated to produce :class:`~dis.Instruction` objects. But it " -"also has a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis." -"dis` on the constructor argument, but returned as a multi-line string::" +"readable form and for iterating over instructions. " +"The :class:`~dis.Bytecode` constructor takes the same arguments " +"that :func:`~dis.get_instruction` does (plus an optional *current_offset*), " +"and the resulting object can be iterated to " +"produce :class:`~dis.Instruction` objects. But it also has " +"a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis.dis` on " +"the constructor argument, but returned as a multi-line string::" msgstr "" #: ../../whatsnew/3.4.rst:748 @@ -1118,25 +1137,37 @@ msgid "" "LOAD_CONST (100)\n" "BINARY_ADD (23)\n" "RETURN_VALUE (83)\n" -">>> bytecode.dis().splitlines() \n" +">>> bytecode.dis().splitlines()\n" "[' 1 0 LOAD_FAST 0 (x)',\n" " ' --> 3 LOAD_CONST 1 (1)',\n" " ' 6 BINARY_ADD',\n" " ' 7 RETURN_VALUE']" msgstr "" +">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" +">>> for instr in bytecode:\n" +"... print('{} ({})'.format(instr.opname, instr.opcode))\n" +"LOAD_FAST (124)\n" +"LOAD_CONST (100)\n" +"BINARY_ADD (23)\n" +"RETURN_VALUE (83)\n" +">>> bytecode.dis().splitlines()\n" +"[' 1 0 LOAD_FAST 0 (x)',\n" +" ' --> 3 LOAD_CONST 1 (1)',\n" +" ' 6 BINARY_ADD',\n" +" ' 7 RETURN_VALUE']" #: ../../whatsnew/3.4.rst:761 msgid "" -":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." -"from_traceback`, that provides the ability to manipulate a traceback (that " -"is, ``print(Bytecode.from_traceback(tb).dis())`` is equivalent to " -"``distb(tb)``)." +":class:`~dis.Bytecode` also has a class " +"method, :meth:`~dis.Bytecode.from_traceback`, that provides the ability to " +"manipulate a traceback (that is, " +"``print(Bytecode.from_traceback(tb).dis())`` is equivalent to ``distb(tb)``)." msgstr "" #: ../../whatsnew/3.4.rst:766 msgid "" -"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" -"`11816` and Claudiu Popa in :issue:`17916`.)" +"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver " +"in :issue:`11816` and Claudiu Popa in :issue:`17916`.)" msgstr "" "(由 Nick Coghlan、Ryan Kelly 和 Thomas Kluyver 在 :issue:`11816` 中以及 " "Claudiu Popa 在 :issue:`17916` 中貢獻。)" @@ -1165,8 +1196,8 @@ msgid "" "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " "<doctest-options>` to be specified on the command line, and ``-f`` is a " "shorthand for ``-o FAIL_FAST`` (to parallel the similar option supported by " -"the :mod:`unittest` CLI). (Contributed by R. David Murray in :issue:" -"`11390`.)" +"the :mod:`unittest` CLI). (Contributed by R. David Murray " +"in :issue:`11390`.)" msgstr "" #: ../../whatsnew/3.4.rst:787 @@ -1194,10 +1225,10 @@ msgid "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " "produces a string representation. It does not accept the *maxheaderlen* " -"argument, but does accept the *unixfrom* and *policy* arguments. The :class:" -"`~email.message.Message` :meth:`~email.message.Message.__bytes__` method " -"calls it, meaning that ``bytes(mymsg)`` will now produce the intuitive " -"result: a bytes object containing the fully formatted message. " +"argument, but does accept the *unixfrom* and *policy* arguments. " +"The :class:`~email.message.Message` :meth:`~email.message.Message.__bytes__` " +"method calls it, meaning that ``bytes(mymsg)`` will now produce the " +"intuitive result: a bytes object containing the fully formatted message. " "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" @@ -1206,8 +1237,8 @@ msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " "changing its location in the list of headers. For backward compatibility, " -"the default is ``False``. (Contributed by R. David Murray in :issue:" -"`18891`.)" +"the default is ``False``. (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:818 @@ -1219,12 +1250,13 @@ msgid "" "documentation is currently in the new module, which is being added as part " "of email's new :term:`provisional API`. These classes provide a number of " "new methods that make extracting content from and inserting content into " -"email messages much easier. For details, see the :mod:`~email." -"contentmanager` documentation and the :ref:`email-examples`. These API " -"additions complete the bulk of the work that was planned as part of the " -"email6 project. The currently provisional API is scheduled to become final " -"in Python 3.5 (possibly with a few minor additions in the area of error " -"handling). (Contributed by R. David Murray in :issue:`18891`.)" +"email messages much easier. For details, see " +"the :mod:`~email.contentmanager` documentation and the :ref:`email-" +"examples`. These API additions complete the bulk of the work that was " +"planned as part of the email6 project. The currently provisional API is " +"scheduled to become final in Python 3.5 (possibly with a few minor additions " +"in the area of error handling). (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:834 @@ -1245,8 +1277,8 @@ msgstr "" msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " -"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky in :" -"issue:`15442`.)" +"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky " +"in :issue:`15442`.)" msgstr "" #: ../../whatsnew/3.4.rst:850 @@ -1283,9 +1315,9 @@ msgstr "由 Łukasz Langa 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:873 msgid "" -":func:`~functools.total_ordering` now supports a return value of :data:" -"`NotImplemented` from the underlying comparison function. (Contributed by " -"Katie Miller in :issue:`10042`.)" +":func:`~functools.total_ordering` now supports a return value " +"of :data:`NotImplemented` from the underlying comparison function. " +"(Contributed by Katie Miller in :issue:`10042`.)" msgstr "" #: ../../whatsnew/3.4.rst:877 @@ -1329,15 +1361,18 @@ msgid "" "based key derivation function 2 <https://en.wikipedia.org/wiki/PBKDF2>`_. " "(Contributed by Christian Heimes in :issue:`18582`.)" msgstr "" +"新的 :func:`hashlib.pbkdf2_hmac` 函式提供了\\ `基於密碼的 PKCS#5 密鑰生成函" +"式 2 <https://en.wikipedia.org/wiki/PBKDF2>`_。(由 Christian Heimes " +"在 :issue:`18582` 中貢獻。)" #: ../../whatsnew/3.4.rst:907 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " -"now a formally supported interface. It has always existed in CPython's :mod:" -"`hashlib` (although it did not return lower case names for all supported " -"hashes), but it was not a public interface and so some other Python " -"implementations have not previously supported it. (Contributed by Jason R. " -"Coombs in :issue:`18532`.)" +"now a formally supported interface. It has always existed in " +"CPython's :mod:`hashlib` (although it did not return lower case names for " +"all supported hashes), but it was not a public interface and so some other " +"Python implementations have not previously supported it. (Contributed by " +"Jason R. Coombs in :issue:`18532`.)" msgstr "" #: ../../whatsnew/3.4.rst:916 @@ -1364,10 +1399,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:930 msgid "" -"With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." -"name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." -"digest_size` attribute), the :mod:`hmac` module now conforms fully to the :" -"pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" +"With the addition of :attr:`~hmac.HMAC.block_size` " +"and :attr:`~hmac.HMAC.name` attributes (and the formal documentation of " +"the :attr:`~hmac.HMAC.digest_size` attribute), the :mod:`hmac` module now " +"conforms fully to the :pep:`247` API. (Contributed by Christian Heimes " +"in :issue:`18775`.)" msgstr "" #: ../../whatsnew/3.4.rst:937 @@ -1406,9 +1442,9 @@ msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " "extended error description, overriding the hardcoded default if there is " -"one. This extended error description will be formatted using the :attr:" -"`~http.server.HTTP.error_message_format` attribute and sent as the body of " -"the error response. (Contributed by Karl Cow in :issue:`12921`.)" +"one. This extended error description will be formatted using " +"the :attr:`~http.server.HTTP.error_message_format` attribute and sent as the " +"body of the error response. (Contributed by Karl Cow in :issue:`12921`.)" msgstr "" #: ../../whatsnew/3.4.rst:964 @@ -1425,10 +1461,10 @@ msgstr "idlelib 與 IDLE" #: ../../whatsnew/3.4.rst:972 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :file:" -"`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.3.0, as well " -"as changes made in future 3.4.x releases. This file is also available from " -"the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.3.0, as well as changes made in future 3.4.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.4.rst:980 @@ -1437,11 +1473,12 @@ msgstr "importlib" #: ../../whatsnew/3.4.rst:982 msgid "" -"The :class:`~importlib.abc.InspectLoader` ABC defines a new method, :meth:" -"`~importlib.abc.InspectLoader.source_to_code` that accepts source data and a " -"path and returns a code object. The default implementation is equivalent to " -"``compile(data, path, 'exec', dont_inherit=True)``. (Contributed by Eric " -"Snow and Brett Cannon in :issue:`15627`.)" +"The :class:`~importlib.abc.InspectLoader` ABC defines a new " +"method, :meth:`~importlib.abc.InspectLoader.source_to_code` that accepts " +"source data and a path and returns a code object. The default " +"implementation is equivalent to ``compile(data, path, 'exec', " +"dont_inherit=True)``. (Contributed by Eric Snow and Brett Cannon " +"in :issue:`15627`.)" msgstr "" #: ../../whatsnew/3.4.rst:988 @@ -1454,14 +1491,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:993 msgid "" -"The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :" -"mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed " -"by Berker Peksag in :issue:`18193`.)" +"The :func:`~importlib.reload` function has been moved from :mod:`!imp` " +"to :mod:`importlib` as part of the :mod:`!imp` module deprecation. " +"(Contributed by Berker Peksag in :issue:`18193`.)" msgstr "" #: ../../whatsnew/3.4.rst:997 msgid "" -":mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` " +":mod:`importlib.util` now has a :const:`~importlib.util.MAGIC_NUMBER` " "attribute providing access to the bytecode version number. This replaces " "the :func:`!get_magic` function in the deprecated :mod:`!imp` module. " "(Contributed by Brett Cannon in :issue:`18192`.)" @@ -1469,34 +1506,35 @@ msgstr "" #: ../../whatsnew/3.4.rst:1002 msgid "" -"New :mod:`importlib.util` functions :func:`~importlib.util." -"cache_from_source` and :func:`~importlib.util.source_from_cache` replace the " -"same-named functions in the deprecated :mod:`!imp` module. (Contributed by " -"Brett Cannon in :issue:`18194`.)" +"New :mod:`importlib.util` " +"functions :func:`~importlib.util.cache_from_source` " +"and :func:`~importlib.util.source_from_cache` replace the same-named " +"functions in the deprecated :mod:`!imp` module. (Contributed by Brett " +"Cannon in :issue:`18194`.)" msgstr "" #: ../../whatsnew/3.4.rst:1007 msgid "" "The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to " -"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python -" -"m`` can now be used with namespace packages. (Contributed by Brett Cannon " +"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python " +"-m`` can now be used with namespace packages. (Contributed by Brett Cannon " "in :issue:`18058`.)" msgstr "" #: ../../whatsnew/3.4.rst:1012 msgid "" -":mod:`importlib.util` has a new function :func:`~importlib.util." -"decode_source` that decodes source from bytes using universal newline " -"processing. This is useful for implementing :meth:`.InspectLoader." -"get_source` methods." +":mod:`importlib.util` has a new " +"function :func:`~importlib.util.decode_source` that decodes source from " +"bytes using universal newline processing. This is useful for " +"implementing :meth:`.InspectLoader.get_source` methods." msgstr "" #: ../../whatsnew/3.4.rst:1016 msgid "" -":class:`importlib.machinery.ExtensionFileLoader` now has a :meth:`~importlib." -"machinery.ExtensionFileLoader.get_filename` method. This was inadvertently " -"omitted in the original implementation. (Contributed by Eric Snow in :issue:" -"`19152`.)" +":class:`importlib.machinery.ExtensionFileLoader` now has " +"a :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` method. " +"This was inadvertently omitted in the original implementation. (Contributed " +"by Eric Snow in :issue:`19152`.)" msgstr "" #: ../../whatsnew/3.4.rst:1023 @@ -1521,21 +1559,23 @@ msgstr "" #: ../../whatsnew/3.4.rst:1035 msgid "" -"As part of the implementation of the new :mod:`enum` module, the :mod:" -"`inspect` module now has substantially better support for custom ``__dir__`` " -"methods and dynamic class attributes provided through metaclasses. " -"(Contributed by Ethan Furman in :issue:`18929` and :issue:`19030`.)" +"As part of the implementation of the new :mod:`enum` module, " +"the :mod:`inspect` module now has substantially better support for custom " +"``__dir__`` methods and dynamic class attributes provided through " +"metaclasses. (Contributed by Ethan Furman in :issue:`18929` " +"and :issue:`19030`.)" msgstr "" #: ../../whatsnew/3.4.rst:1041 msgid "" -":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" -"func:`~inspect.signature` API. This allows them to support a much broader " -"range of callables, including those with ``__signature__`` attributes, those " -"with metadata provided by argument clinic, :func:`functools.partial` objects " -"and more. Note that, unlike :func:`~inspect.signature`, these functions " -"still ignore ``__wrapped__`` attributes, and report the already bound first " -"argument for bound methods, so it is still necessary to update your code to " +":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use " +"the :func:`~inspect.signature` API. This allows them to support a much " +"broader range of callables, including those with ``__signature__`` " +"attributes, those with metadata provided by argument " +"clinic, :func:`functools.partial` objects and more. Note that, " +"unlike :func:`~inspect.signature`, these functions still ignore " +"``__wrapped__`` attributes, and report the already bound first argument for " +"bound methods, so it is still necessary to update your code to " "use :func:`~inspect.signature` directly if those features are desired. " "(Contributed by Yury Selivanov in :issue:`17481`.)" msgstr "" @@ -1553,17 +1593,18 @@ msgstr "ipaddress" #: ../../whatsnew/3.4.rst:1060 msgid "" -":mod:`ipaddress` was added to the standard library in Python 3.3 as a :term:" -"`provisional API`. With the release of Python 3.4, this qualification has " -"been removed: :mod:`ipaddress` is now considered a stable API, covered by " -"the normal standard library requirements to maintain backwards compatibility." +":mod:`ipaddress` was added to the standard library in Python 3.3 as " +"a :term:`provisional API`. With the release of Python 3.4, this " +"qualification has been removed: :mod:`ipaddress` is now considered a stable " +"API, covered by the normal standard library requirements to maintain " +"backwards compatibility." msgstr "" #: ../../whatsnew/3.4.rst:1066 msgid "" "A new :attr:`~ipaddress.IPv4Address.is_global` property is ``True`` if an " -"address is globally routeable. (Contributed by Peter Moody in :issue:" -"`17400`.)" +"address is globally routeable. (Contributed by Peter Moody " +"in :issue:`17400`.)" msgstr "" #: ../../whatsnew/3.4.rst:1072 @@ -1579,27 +1620,29 @@ msgstr "" #: ../../whatsnew/3.4.rst:1078 msgid "" -":class:`~logging.handlers.SocketHandler` and :class:`~logging.handlers." -"DatagramHandler` now support Unix domain sockets (by setting *port* to " -"``None``). (Contributed by Vinay Sajip in commit ce46195b56a9.)" +":class:`~logging.handlers.SocketHandler` " +"and :class:`~logging.handlers.DatagramHandler` now support Unix domain " +"sockets (by setting *port* to ``None``). (Contributed by Vinay Sajip in " +"commit ce46195b56a9.)" msgstr "" #: ../../whatsnew/3.4.rst:1083 msgid "" -":func:`~logging.config.fileConfig` now accepts a :class:`configparser." -"RawConfigParser` subclass instance for the *fname* parameter. This " -"facilitates using a configuration file when logging configuration is just a " -"part of the overall application configuration, or where the application " -"modifies the configuration before passing it to :func:`~logging.config." -"fileConfig`. (Contributed by Vinay Sajip in :issue:`16110`.)" +":func:`~logging.config.fileConfig` now accepts " +"a :class:`configparser.RawConfigParser` subclass instance for the *fname* " +"parameter. This facilitates using a configuration file when logging " +"configuration is just a part of the overall application configuration, or " +"where the application modifies the configuration before passing it " +"to :func:`~logging.config.fileConfig`. (Contributed by Vinay Sajip " +"in :issue:`16110`.)" msgstr "" #: ../../whatsnew/3.4.rst:1091 msgid "" -"Logging configuration data received from a socket via the :func:`logging." -"config.listen` function can now be validated before being processed by " -"supplying a verification function as the argument to the new *verify* " -"keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" +"Logging configuration data received from a socket via " +"the :func:`logging.config.listen` function can now be validated before being " +"processed by supplying a verification function as the argument to the new " +"*verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" msgstr "" #: ../../whatsnew/3.4.rst:1100 @@ -1612,11 +1655,11 @@ msgid "" "implementing the new version restores the Python2 behavior of recording only " "one copy of interned strings and preserving the interning on " "deserialization, and extends this \"one copy\" ability to any object type " -"(including handling recursive references). This reduces both the size of ``." -"pyc`` files and the amount of memory a module occupies in memory when it is " -"loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján Valur " -"Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou in :" -"issue:`19219`.)" +"(including handling recursive references). This reduces both the size of " +"``.pyc`` files and the amount of memory a module occupies in memory when it " +"is loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján " +"Valur Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou " +"in :issue:`19219`.)" msgstr "" #: ../../whatsnew/3.4.rst:1113 @@ -1636,12 +1679,13 @@ msgstr "multiprocessing" #: ../../whatsnew/3.4.rst:1124 msgid "" "On Unix two new :ref:`start methods <multiprocessing-start-methods>`, " -"``spawn`` and ``forkserver``, have been added for starting processes using :" -"mod:`multiprocessing`. These make the mixing of processes with threads more " -"robust, and the ``spawn`` method matches the semantics that multiprocessing " -"has always used on Windows. New function :func:`~multiprocessing." -"get_all_start_methods` reports all start methods available on the platform, :" -"func:`~multiprocessing.get_start_method` reports the current start method, " +"``spawn`` and ``forkserver``, have been added for starting processes " +"using :mod:`multiprocessing`. These make the mixing of processes with " +"threads more robust, and the ``spawn`` method matches the semantics that " +"multiprocessing has always used on Windows. New " +"function :func:`~multiprocessing.get_all_start_methods` reports all start " +"methods available on the platform, :func:`~multiprocessing.get_start_method` " +"reports the current start method, " "and :func:`~multiprocessing.set_start_method` sets the start method. " "(Contributed by Richard Oudkerk in :issue:`8713`.)" msgstr "" @@ -1649,21 +1693,22 @@ msgstr "" #: ../../whatsnew/3.4.rst:1134 msgid "" ":mod:`multiprocessing` also now has the concept of a ``context``, which " -"determines how child processes are created. New function :func:" -"`~multiprocessing.get_context` returns a context that uses a specified start " -"method. It has the same API as the :mod:`multiprocessing` module itself, so " -"you can use it to create :class:`~multiprocessing.pool.Pool`\\ s and other " -"objects that will operate within that context. This allows a framework and " -"an application or different parts of the same application to use " -"multiprocessing without interfering with each other. (Contributed by " -"Richard Oudkerk in :issue:`18999`.)" +"determines how child processes are created. New " +"function :func:`~multiprocessing.get_context` returns a context that uses a " +"specified start method. It has the same API as the :mod:`multiprocessing` " +"module itself, so you can use it to " +"create :class:`~multiprocessing.pool.Pool`\\ s and other objects that will " +"operate within that context. This allows a framework and an application or " +"different parts of the same application to use multiprocessing without " +"interfering with each other. (Contributed by Richard Oudkerk " +"in :issue:`18999`.)" msgstr "" #: ../../whatsnew/3.4.rst:1144 msgid "" "Except when using the old *fork* start method, child processes no longer " -"inherit unneeded handles/file descriptors from their parents (part of :issue:" -"`8713`)." +"inherit unneeded handles/file descriptors from their parents (part " +"of :issue:`8713`)." msgstr "" #: ../../whatsnew/3.4.rst:1148 @@ -1702,9 +1747,9 @@ msgstr "os" #: ../../whatsnew/3.4.rst:1172 msgid "" "There are new functions to get and set the :ref:`inheritable flag " -"<fd_inheritance>` of a file descriptor (:func:`os.get_inheritable`, :func:" -"`os.set_inheritable`) or a Windows handle (:func:`os." -"get_handle_inheritable`, :func:`os.set_handle_inheritable`)." +"<fd_inheritance>` of a file descriptor " +"(:func:`os.get_inheritable`, :func:`os.set_inheritable`) or a Windows handle " +"(:func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`)." msgstr "" #: ../../whatsnew/3.4.rst:1177 @@ -1713,14 +1758,14 @@ msgid "" "the platform on which Python is running (or ``None`` if the count can't be " "determined). The :func:`multiprocessing.cpu_count` function is now " "implemented in terms of this function). (Contributed by Trent Nelson, " -"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali in :issue:" -"`17914`.)" +"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali " +"in :issue:`17914`.)" msgstr "" #: ../../whatsnew/3.4.rst:1183 msgid "" -":func:`os.path.samestat` is now available on the Windows platform (and the :" -"func:`os.path.samefile` implementation is now shared between Unix and " +":func:`os.path.samestat` is now available on the Windows platform (and " +"the :func:`os.path.samefile` implementation is now shared between Unix and " "Windows). (Contributed by Brian Curtin in :issue:`11939`.)" msgstr "" @@ -1732,12 +1777,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:1190 msgid "" -":func:`os.open` supports two new flags on platforms that provide them, :" -"const:`~os.O_PATH` (un-opened file descriptor), and :const:`~os.O_TMPFILE` " -"(unnamed temporary file; as of 3.4.0 release available only on Linux systems " -"with a kernel version of 3.11 or newer that have uapi headers). " -"(Contributed by Christian Heimes in :issue:`18673` and Benjamin Peterson, " -"respectively.)" +":func:`os.open` supports two new flags on platforms that provide " +"them, :const:`~os.O_PATH` (un-opened file descriptor), " +"and :const:`~os.O_TMPFILE` (unnamed temporary file; as of 3.4.0 release " +"available only on Linux systems with a kernel version of 3.11 or newer that " +"have uapi headers). (Contributed by Christian Heimes in :issue:`18673` and " +"Benjamin Peterson, respectively.)" msgstr "" #: ../../whatsnew/3.4.rst:1198 @@ -1774,14 +1819,14 @@ msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " "were present in previous protocols, such as the serialization of nested " -"classes, very large strings and containers, and classes whose :meth:" -"`__new__` method takes keyword-only arguments. It also provides some " -"efficiency improvements." +"classes, very large strings and containers, and classes " +"whose :meth:`__new__` method takes keyword-only arguments. It also provides " +"some efficiency improvements." msgstr "" #: ../../whatsnew/3.4.rst:1229 msgid ":pep:`3154` -- Pickle protocol 4" -msgstr "" +msgstr ":pep:`3154` -- Pickle 協定 4" #: ../../whatsnew/3.4.rst:1230 msgid "PEP written by Antoine Pitrou and implemented by Alexandre Vassalotti." @@ -1794,12 +1839,13 @@ msgstr "plistlib" #: ../../whatsnew/3.4.rst:1236 msgid "" ":mod:`plistlib` now has an API that is similar to the standard pattern for " -"stdlib serialization protocols, with new :func:`~plistlib.load`, :func:" -"`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps` " -"functions. (The older API is now deprecated.) In addition to the already " -"supported XML plist format (:const:`~plistlib.FMT_XML`), it also now " -"supports the binary plist format (:const:`~plistlib.FMT_BINARY`). " -"(Contributed by Ronald Oussoren and others in :issue:`14455`.)" +"stdlib serialization protocols, with " +"new :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps` functions. (The older API is now deprecated.) " +"In addition to the already supported XML plist format " +"(:const:`~plistlib.FMT_XML`), it also now supports the binary plist format " +"(:const:`~plistlib.FMT_BINARY`). (Contributed by Ronald Oussoren and others " +"in :issue:`14455`.)" msgstr "" #: ../../whatsnew/3.4.rst:1246 @@ -1809,9 +1855,9 @@ msgstr "poplib" #: ../../whatsnew/3.4.rst:1248 msgid "" "Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, " -"which returns the list of capabilities advertised by the POP server, and :" -"meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into an " -"encrypted POP3 session if the POP server supports it. (Contributed by " +"which returns the list of capabilities advertised by the POP server, " +"and :meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into " +"an encrypted POP3 session if the POP server supports it. (Contributed by " "Lorenzo Catucci in :issue:`4473`.)" msgstr "" @@ -1821,8 +1867,8 @@ msgstr "pprint" #: ../../whatsnew/3.4.rst:1258 msgid "" -"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its :" -"func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " +"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and " +"its :func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " "option, *compact*, that controls how the output is formatted. Currently " "setting *compact* to ``True`` means that sequences will be printed with as " "many sequence elements as will fit within *width* on each (indented) line. " @@ -1851,27 +1897,28 @@ msgstr "pydoc" #: ../../whatsnew/3.4.rst:1279 msgid "" -"The :mod:`pydoc` module is now based directly on the :func:`inspect." -"signature` introspection API, allowing it to provide signature information " -"for a wider variety of callable objects. This change also means that " -"``__wrapped__`` attributes are now taken into account when displaying help " -"information. (Contributed by Larry Hastings in :issue:`19674`.)" +"The :mod:`pydoc` module is now based directly on " +"the :func:`inspect.signature` introspection API, allowing it to provide " +"signature information for a wider variety of callable objects. This change " +"also means that ``__wrapped__`` attributes are now taken into account when " +"displaying help information. (Contributed by Larry Hastings " +"in :issue:`19674`.)" msgstr "" #: ../../whatsnew/3.4.rst:1285 msgid "" "The :mod:`pydoc` module no longer displays the ``self`` parameter for " "already bound methods. Instead, it aims to always display the exact current " -"signature of the supplied callable. (Contributed by Larry Hastings in :" -"issue:`20710`.)" +"signature of the supplied callable. (Contributed by Larry Hastings " +"in :issue:`20710`.)" msgstr "" #: ../../whatsnew/3.4.rst:1290 msgid "" "In addition to the changes that have been made to :mod:`pydoc` directly, its " "handling of custom ``__dir__`` methods and various descriptor behaviours has " -"also been improved substantially by the underlying changes in the :mod:" -"`inspect` module." +"also been improved substantially by the underlying changes in " +"the :mod:`inspect` module." msgstr "" #: ../../whatsnew/3.4.rst:1295 @@ -1917,17 +1964,18 @@ msgstr "" #: ../../whatsnew/3.4.rst:1324 msgid "" "On Linux kernel version 2.6.36 or later, there are also some new Linux " -"specific constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource." -"RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource." -"RLIMIT_RTTIME`, and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by " -"Christian Heimes in :issue:`19324`.)" +"specific " +"constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource.RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource.RLIMIT_RTTIME`, " +"and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by Christian Heimes " +"in :issue:`19324`.)" msgstr "" #: ../../whatsnew/3.4.rst:1330 msgid "" -"On FreeBSD version 9 and later, there some new FreeBSD specific constants: :" -"const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and :const:" -"`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa in :issue:`19343`.)" +"On FreeBSD version 9 and later, there some new FreeBSD specific " +"constants: :const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, " +"and :const:`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa " +"in :issue:`19343`.)" msgstr "" #: ../../whatsnew/3.4.rst:1337 @@ -1945,8 +1993,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1344 msgid "" ":class:`~select.devpoll` objects now have :meth:`~select.devpoll.fileno` " -"and :meth:`~select.devpoll.close` methods, as well as a new attribute :attr:" -"`~select.devpoll.closed`. (Contributed by Victor Stinner in :issue:`18794`.)" +"and :meth:`~select.devpoll.close` methods, as well as a new " +"attribute :attr:`~select.devpoll.closed`. (Contributed by Victor Stinner " +"in :issue:`18794`.)" msgstr "" #: ../../whatsnew/3.4.rst:1351 @@ -1969,8 +2018,8 @@ msgid "" ":func:`~shutil.copyfile` now raises a specific :exc:`~shutil.Error` " "subclass, :exc:`~shutil.SameFileError`, when the source and destination are " "the same file, which allows an application to take appropriate action on " -"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack in :" -"issue:`1492704`.)" +"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack " +"in :issue:`1492704`.)" msgstr "" #: ../../whatsnew/3.4.rst:1369 @@ -1982,8 +2031,8 @@ msgid "" "The :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*map* keyword argument which, if specified, is passed in to :class:`!" "asynchat.async_chat` as its *map* argument. This allows an application to " -"avoid affecting the global socket map. (Contributed by Vinay Sajip in :" -"issue:`11959`.)" +"avoid affecting the global socket map. (Contributed by Vinay Sajip " +"in :issue:`11959`.)" msgstr "" #: ../../whatsnew/3.4.rst:1379 @@ -2011,8 +2060,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:1393 msgid "" "Socket objects have new methods to get or set their :ref:`inheritable flag " -"<fd_inheritance>`, :meth:`~socket.socket.get_inheritable` and :meth:`~socket." -"socket.set_inheritable`." +"<fd_inheritance>`, :meth:`~socket.socket.get_inheritable` " +"and :meth:`~socket.socket.set_inheritable`." msgstr "" #: ../../whatsnew/3.4.rst:1397 @@ -2064,37 +2113,40 @@ msgid "" "more stringent than the defaults provided by the :class:`~ssl.SSLContext` " "constructor, and may be adjusted in the future, without prior deprecation, " "if best-practice security requirements change. The new recommended best " -"practice for using stdlib libraries that support SSL is to use :func:`~ssl." -"create_default_context` to obtain an :class:`~ssl.SSLContext` object, modify " -"it if needed, and then pass it as the *context* argument of the appropriate " -"stdlib API. (Contributed by Christian Heimes in :issue:`19689`.)" +"practice for using stdlib libraries that support SSL is to " +"use :func:`~ssl.create_default_context` to obtain " +"an :class:`~ssl.SSLContext` object, modify it if needed, and then pass it as " +"the *context* argument of the appropriate stdlib API. (Contributed by " +"Christian Heimes in :issue:`19689`.)" msgstr "" #: ../../whatsnew/3.4.rst:1440 msgid "" -":class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_verify_locations` accepts a new optional argument *cadata*, which can " -"be used to provide PEM or DER encoded certificates directly via strings or " -"bytes, respectively. (Contributed by Christian Heimes in :issue:`18138`.)" +":class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_verify_locations` accepts a new optional " +"argument *cadata*, which can be used to provide PEM or DER encoded " +"certificates directly via strings or bytes, respectively. (Contributed by " +"Christian Heimes in :issue:`18138`.)" msgstr "" #: ../../whatsnew/3.4.rst:1445 msgid "" "New function :func:`~ssl.get_default_verify_paths` returns a named tuple of " -"the paths and environment variables that the :meth:`~ssl.SSLContext." -"set_default_verify_paths` method uses to set OpenSSL's default ``cafile`` " -"and ``capath``. This can be an aid in debugging default verification " -"issues. (Contributed by Christian Heimes in :issue:`18143`.)" +"the paths and environment variables that " +"the :meth:`~ssl.SSLContext.set_default_verify_paths` method uses to set " +"OpenSSL's default ``cafile`` and ``capath``. This can be an aid in " +"debugging default verification issues. (Contributed by Christian Heimes " +"in :issue:`18143`.)" msgstr "" #: ../../whatsnew/3.4.rst:1452 msgid "" -":class:`~ssl.SSLContext` has a new method, :meth:`~ssl.SSLContext." -"cert_store_stats`, that reports the number of loaded ``X.509`` certs, " -"``X.509 CA`` certs, and certificate revocation lists (``crl``\\ s), as well " -"as a :meth:`~ssl.SSLContext.get_ca_certs` method that returns a list of the " -"loaded ``CA`` certificates. (Contributed by Christian Heimes in :issue:" -"`18147`.)" +":class:`~ssl.SSLContext` has a new " +"method, :meth:`~ssl.SSLContext.cert_store_stats`, that reports the number of " +"loaded ``X.509`` certs, ``X.509 CA`` certs, and certificate revocation lists " +"(``crl``\\ s), as well as a :meth:`~ssl.SSLContext.get_ca_certs` method that " +"returns a list of the loaded ``CA`` certificates. (Contributed by Christian " +"Heimes in :issue:`18147`.)" msgstr "" #: ../../whatsnew/3.4.rst:1459 @@ -2102,45 +2154,46 @@ msgid "" "If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new " "attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control " "the certificate verification process by setting it to some combination of " -"the new constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl." -"VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, or :const:" -"`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL verification by " -"default. (Contributed by Christien Heimes in :issue:`8813`.)" +"the new " +"constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl.VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, " +"or :const:`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL " +"verification by default. (Contributed by Christien Heimes in :issue:`8813`.)" msgstr "" #: ../../whatsnew/3.4.rst:1467 msgid "" -"New :class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_default_certs` loads a set of default \"certificate authority\" (CA) " -"certificates from default locations, which vary according to the platform. " -"It can be used to load both TLS web server authentication certificates " -"(``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) for a client to use to verify " -"a server, and certificates for a server to use in verifying client " -"certificates (``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed " -"by Christian Heimes in :issue:`19292`.)" +"New :class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_default_certs` loads a set of default " +"\"certificate authority\" (CA) certificates from default locations, which " +"vary according to the platform. It can be used to load both TLS web server " +"authentication certificates (``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) " +"for a client to use to verify a server, and certificates for a server to use " +"in verifying client certificates " +"(``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed by Christian " +"Heimes in :issue:`19292`.)" msgstr "" #: ../../whatsnew/3.4.rst:1478 msgid "" -"Two new windows-only functions, :func:`~ssl.enum_certificates` and :func:" -"`~ssl.enum_crls` provide the ability to retrieve certificates, certificate " -"information, and CRLs from the Windows cert store. (Contributed by " -"Christian Heimes in :issue:`17134`.)" +"Two new windows-only functions, :func:`~ssl.enum_certificates` " +"and :func:`~ssl.enum_crls` provide the ability to retrieve certificates, " +"certificate information, and CRLs from the Windows cert store. (Contributed " +"by Christian Heimes in :issue:`17134`.)" msgstr "" #: ../../whatsnew/3.4.rst:1485 msgid "" -"Support for server-side SNI (Server Name Indication) using the new :meth:" -"`ssl.SSLContext.set_servername_callback` method. (Contributed by Daniel " -"Black in :issue:`8109`.)" +"Support for server-side SNI (Server Name Indication) using the " +"new :meth:`ssl.SSLContext.set_servername_callback` method. (Contributed by " +"Daniel Black in :issue:`8109`.)" msgstr "" #: ../../whatsnew/3.4.rst:1489 msgid "" "The dictionary returned by :meth:`.SSLSocket.getpeercert` contains " "additional ``X509v3`` extension items: ``crlDistributionPoints``, " -"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes in :" -"issue:`18379`.)" +"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes " +"in :issue:`18379`.)" msgstr "" #: ../../whatsnew/3.4.rst:1495 @@ -2156,9 +2209,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:1501 msgid "" -"The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`, :" -"const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`. (Contributed by " -"Christian Hiemes in :issue:`11016`.)" +"The module supports new :mod:`~stat.ST_MODE` " +"flags, :mod:`~stat.S_IFDOOR`, :const:`~stat.S_IFPORT`, " +"and :const:`~stat.S_IFWHT`. (Contributed by Christian Hiemes " +"in :issue:`11016`.)" msgstr "" #: ../../whatsnew/3.4.rst:1507 @@ -2167,10 +2221,10 @@ msgstr "struct" #: ../../whatsnew/3.4.rst:1509 msgid "" -"New function :mod:`~struct.iter_unpack` and a new :meth:`struct.Struct." -"iter_unpack` method on compiled formats provide streamed unpacking of a " -"buffer containing repeated instances of a given format of data. (Contributed " -"by Antoine Pitrou in :issue:`17804`.)" +"New function :mod:`~struct.iter_unpack` and a " +"new :meth:`struct.Struct.iter_unpack` method on compiled formats provide " +"streamed unpacking of a buffer containing repeated instances of a given " +"format of data. (Contributed by Antoine Pitrou in :issue:`17804`.)" msgstr "" #: ../../whatsnew/3.4.rst:1516 @@ -2224,10 +2278,10 @@ msgstr "sys" msgid "" "New function :func:`sys.getallocatedblocks` returns the current number of " "blocks allocated by the interpreter. (In CPython with the default ``--with-" -"pymalloc`` setting, this is allocations made through the :c:func:" -"`PyObject_Malloc` API.) This can be useful for tracking memory leaks, " -"especially if automated via a test suite. (Contributed by Antoine Pitrou " -"in :issue:`13390`.)" +"pymalloc`` setting, this is allocations made through " +"the :c:func:`PyObject_Malloc` API.) This can be useful for tracking memory " +"leaks, especially if automated via a test suite. (Contributed by Antoine " +"Pitrou in :issue:`13390`.)" msgstr "" #: ../../whatsnew/3.4.rst:1557 @@ -2240,10 +2294,10 @@ msgid "" "The :mod:`site` module :ref:`sets it <rlcompleter-config>` to a function " "that enables tab completion and history saving (in :file:`~/.python-" "history`) if the platform supports :mod:`readline`. If you do not want this " -"(new) behavior, you can override it in :envvar:`PYTHONSTARTUP`, :mod:" -"`sitecustomize`, or :mod:`usercustomize` by deleting this attribute from :" -"mod:`sys` (or setting it to some other callable). (Contributed by Éric " -"Araujo and Antoine Pitrou in :issue:`5845`.)" +"(new) behavior, you can override it " +"in :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize`, or :mod:`usercustomize` by " +"deleting this attribute from :mod:`sys` (or setting it to some other " +"callable). (Contributed by Éric Araujo and Antoine Pitrou in :issue:`5845`.)" msgstr "" #: ../../whatsnew/3.4.rst:1572 @@ -2254,8 +2308,8 @@ msgstr "tarfile" msgid "" "The :mod:`tarfile` module now supports a simple :ref:`tarfile-commandline` " "when called as a script directly or via ``-m``. This can be used to create " -"and extract tarfile archives. (Contributed by Berker Peksag in :issue:" -"`13477`.)" +"and extract tarfile archives. (Contributed by Berker Peksag " +"in :issue:`13477`.)" msgstr "" #: ../../whatsnew/3.4.rst:1580 @@ -2272,8 +2326,8 @@ msgid "" "convenience function :func:`~textwrap.shorten` collapses all of the " "whitespace in the input to single spaces and produces a single line of a " "given *width* that ends with the *placeholder* (by default, ``[...]``). " -"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and :" -"issue:`18725`.)" +"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` " +"and :issue:`18725`.)" msgstr "" #: ../../whatsnew/3.4.rst:1594 @@ -2296,8 +2350,8 @@ msgstr "traceback" msgid "" "A new :func:`traceback.clear_frames` function takes a traceback object and " "clears the local variables in all of the frames it references, reducing the " -"amount of memory consumed. (Contributed by Andrew Kuchling in :issue:" -"`1565525`.)" +"amount of memory consumed. (Contributed by Andrew Kuchling " +"in :issue:`1565525`.)" msgstr "" #: ../../whatsnew/3.4.rst:1612 @@ -2320,40 +2374,41 @@ msgstr "urllib" #: ../../whatsnew/3.4.rst:1625 msgid "" -":mod:`urllib.request` now supports ``data:`` URLs via the :class:`~urllib." -"request.DataHandler` class. (Contributed by Mathias Panzenböck in :issue:" -"`16423`.)" +":mod:`urllib.request` now supports ``data:`` URLs via " +"the :class:`~urllib.request.DataHandler` class. (Contributed by Mathias " +"Panzenböck in :issue:`16423`.)" msgstr "" #: ../../whatsnew/3.4.rst:1629 msgid "" "The http method that will be used by a :class:`~urllib.request.Request` " -"class can now be specified by setting a :class:`~urllib.request.Request." -"method` class attribute on the subclass. (Contributed by Jason R Coombs in :" -"issue:`18978`.)" +"class can now be specified by setting " +"a :class:`~urllib.request.Request.method` class attribute on the subclass. " +"(Contributed by Jason R Coombs in :issue:`18978`.)" msgstr "" #: ../../whatsnew/3.4.rst:1634 msgid "" -":class:`~urllib.request.Request` objects are now reusable: if the :attr:" -"`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` " -"attributes are modified, all relevant internal properties are updated. This " -"means, for example, that it is now possible to use the same :class:`~urllib." -"request.Request` object in more than one :meth:`.OpenerDirector.open` call " -"with different *data* arguments, or to modify a :class:`~urllib.request." -"Request`\\ 's ``url`` rather than recomputing it from scratch. There is " -"also a new :meth:`~urllib.request.Request.remove_header` method that can be " -"used to remove headers from a :class:`~urllib.request.Request`. " -"(Contributed by Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:" -"`17485`, and Damien Brecht and Senthil Kumaran in :issue:`17272`.)" +":class:`~urllib.request.Request` objects are now reusable: if " +"the :attr:`~urllib.request.Request.full_url` " +"or :attr:`~urllib.request.Request.data` attributes are modified, all " +"relevant internal properties are updated. This means, for example, that it " +"is now possible to use the same :class:`~urllib.request.Request` object in " +"more than one :meth:`.OpenerDirector.open` call with different *data* " +"arguments, or to modify a :class:`~urllib.request.Request`\\ 's ``url`` " +"rather than recomputing it from scratch. There is also a " +"new :meth:`~urllib.request.Request.remove_header` method that can be used to " +"remove headers from a :class:`~urllib.request.Request`. (Contributed by " +"Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:`17485`, and " +"Damien Brecht and Senthil Kumaran in :issue:`17272`.)" msgstr "" #: ../../whatsnew/3.4.rst:1647 msgid "" -":class:`~urllib.error.HTTPError` objects now have a :attr:`~urllib.error." -"HTTPError.headers` attribute that provides access to the HTTP response " -"headers associated with the error. (Contributed by Berker Peksag in :issue:" -"`15701`.)" +":class:`~urllib.error.HTTPError` objects now have " +"a :attr:`~urllib.error.HTTPError.headers` attribute that provides access to " +"the HTTP response headers associated with the error. (Contributed by Berker " +"Peksag in :issue:`15701`.)" msgstr "" #: ../../whatsnew/3.4.rst:1654 @@ -2362,13 +2417,13 @@ msgstr "unittest" #: ../../whatsnew/3.4.rst:1656 msgid "" -"The :class:`~unittest.TestCase` class has a new method, :meth:`~unittest." -"TestCase.subTest`, that produces a context manager whose :keyword:`with` " -"block becomes a \"sub-test\". This context manager allows a test method to " -"dynamically generate subtests by, say, calling the ``subTest`` context " -"manager inside a loop. A single test method can thereby produce an " -"indefinite number of separately identified and separately counted tests, all " -"of which will run even if one or more of them fail. For example::" +"The :class:`~unittest.TestCase` class has a new " +"method, :meth:`~unittest.TestCase.subTest`, that produces a context manager " +"whose :keyword:`with` block becomes a \"sub-test\". This context manager " +"allows a test method to dynamically generate subtests by, say, calling the " +"``subTest`` context manager inside a loop. A single test method can thereby " +"produce an indefinite number of separately identified and separately counted " +"tests, all of which will run even if one or more of them fail. For example::" msgstr "" #: ../../whatsnew/3.4.rst:1664 @@ -2428,9 +2483,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1695 msgid "" "A new test assertion context-manager, :meth:`~unittest.TestCase.assertLogs`, " -"will ensure that a given block of code emits a log message using the :mod:" -"`logging` module. By default the message can come from any logger and have " -"a priority of ``INFO`` or higher, but both the logger name and an " +"will ensure that a given block of code emits a log message using " +"the :mod:`logging` module. By default the message can come from any logger " +"and have a priority of ``INFO`` or higher, but both the logger name and an " "alternative minimum logging level may be specified. The object returned by " "the context manager can be queried for the :class:`~logging.LogRecord`\\ s " "and/or formatted messages that were logged. (Contributed by Antoine Pitrou " @@ -2472,8 +2527,8 @@ msgid "" ":class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function " "take a new keyword argument *with_pip*, which defaults to ``False``, that " "controls whether or not :class:`~venv.EnvBuilder` ensures that ``pip`` is " -"installed in the virtual environment. (Contributed by Nick Coghlan in :" -"issue:`19552` as part of the :pep:`453` implementation.)" +"installed in the virtual environment. (Contributed by Nick Coghlan " +"in :issue:`19552` as part of the :pep:`453` implementation.)" msgstr "" #: ../../whatsnew/3.4.rst:1730 @@ -2501,9 +2556,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1742 msgid "" -"The :meth:`~wave.Wave_write.writeframesraw` and :meth:`~wave.Wave_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" +"The :meth:`~wave.Wave_write.writeframesraw` " +"and :meth:`~wave.Wave_write.writeframes` methods now accept any :term:`bytes-" +"like object`. (Contributed by Serhiy Storchaka in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:1748 @@ -2538,21 +2593,21 @@ msgstr "xml.etree" #: ../../whatsnew/3.4.rst:1766 msgid "" "A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a non-" -"blocking applications to parse XML documents. An example can be seen at :" -"ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou in :issue:" -"`17741`.)" +"blocking applications to parse XML documents. An example can be seen " +"at :ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou " +"in :issue:`17741`.)" msgstr "" #: ../../whatsnew/3.4.rst:1771 msgid "" "The :mod:`xml.etree.ElementTree` :func:`~xml.etree.ElementTree.tostring` " -"and :func:`~xml.etree.ElementTree.tostringlist` functions, and the :class:" -"`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree." -"ElementTree.write` method, now have a *short_empty_elements* :ref:`keyword-" -"only parameter <keyword-only_parameter>` providing control over whether " -"elements with no content are written in abbreviated (``<tag />``) or " -"expanded (``<tag></tag>``) form. (Contributed by Ariel Poliak and Serhiy " -"Storchaka in :issue:`14377`.)" +"and :func:`~xml.etree.ElementTree.tostringlist` functions, and " +"the :class:`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree.ElementTree.write` " +"method, now have a *short_empty_elements* :ref:`keyword-only parameter " +"<keyword-only_parameter>` providing control over whether elements with no " +"content are written in abbreviated (``<tag />``) or expanded (``<tag></" +"tag>``) form. (Contributed by Ariel Poliak and Serhiy Storchaka " +"in :issue:`14377`.)" msgstr "" #: ../../whatsnew/3.4.rst:1782 @@ -2561,18 +2616,18 @@ msgstr "zipfile" #: ../../whatsnew/3.4.rst:1784 msgid "" -"The :meth:`~zipfile.PyZipFile.writepy` method of the :class:`~zipfile." -"PyZipFile` class has a new *filterfunc* option that can be used to control " -"which directories and files are added to the archive. For example, this " -"could be used to exclude test files from the archive. (Contributed by " -"Christian Tismer in :issue:`19274`.)" +"The :meth:`~zipfile.PyZipFile.writepy` method of " +"the :class:`~zipfile.PyZipFile` class has a new *filterfunc* option that can " +"be used to control which directories and files are added to the archive. " +"For example, this could be used to exclude test files from the archive. " +"(Contributed by Christian Tismer in :issue:`19274`.)" msgstr "" #: ../../whatsnew/3.4.rst:1790 msgid "" -"The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." -"PyZipfile` is now ``True`` by default. (Contributed by William Mallard in :" -"issue:`17201`.)" +"The *allowZip64* parameter to :class:`~zipfile.ZipFile` " +"and :class:`~zipfile.PyZipfile` is now ``True`` by default. (Contributed by " +"William Mallard in :issue:`17201`.)" msgstr "" #: ../../whatsnew/3.4.rst:1797 @@ -2607,16 +2662,17 @@ msgstr "" #: ../../whatsnew/3.4.rst:1824 msgid "" -"As part of this change, module globals are no longer forcibly set to :const:" -"`None` during interpreter shutdown in most cases, instead relying on the " -"normal operation of the cyclic garbage collector. This avoids a whole class " -"of interpreter-shutdown-time errors, usually involving ``__del__`` methods, " -"that have plagued Python since the cyclic GC was first introduced." +"As part of this change, module globals are no longer forcibly set " +"to :const:`None` during interpreter shutdown in most cases, instead relying " +"on the normal operation of the cyclic garbage collector. This avoids a " +"whole class of interpreter-shutdown-time errors, usually involving " +"``__del__`` methods, that have plagued Python since the cyclic GC was first " +"introduced." msgstr "" #: ../../whatsnew/3.4.rst:1833 msgid ":pep:`442` -- Safe object finalization" -msgstr "" +msgstr ":pep:`442` -- 安全的物件最終化" #: ../../whatsnew/3.4.rst:1840 msgid "PEP 456: Secure and Interchangeable Hash Algorithm" @@ -2685,7 +2741,7 @@ msgstr "由 Larry Hastings 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:1887 msgid "Other Build and C API Changes" -msgstr "" +msgstr "其他建置和 C API 變更" #: ../../whatsnew/3.4.rst:1889 msgid "" @@ -2724,36 +2780,38 @@ msgstr "" #: ../../whatsnew/3.4.rst:1909 msgid "" -"New function :c:func:`PyStructSequence_InitType2` supplements the existing :" -"c:func:`PyStructSequence_InitType` function. The difference is that it " -"returns ``0`` on success and ``-1`` on failure." +"New function :c:func:`PyStructSequence_InitType2` supplements the " +"existing :c:func:`PyStructSequence_InitType` function. The difference is " +"that it returns ``0`` on success and ``-1`` on failure." msgstr "" #: ../../whatsnew/3.4.rst:1913 msgid "" "The CPython source can now be compiled using the address sanity checking " "features of recent versions of GCC and clang: the false alarms in the small " -"object allocator have been silenced. (Contributed by Dhiru Kholia in :issue:" -"`18596`.)" +"object allocator have been silenced. (Contributed by Dhiru Kholia " +"in :issue:`18596`.)" msgstr "" #: ../../whatsnew/3.4.rst:1918 msgid "" -"The Windows build now uses `Address Space Layout Randomization <https://en." -"wikipedia.org/wiki/Address_space_layout_randomization>`_ and `Data Execution " -"Prevention <https://en.wikipedia.org/wiki/Data_Execution_Prevention>`_. " -"(Contributed by Christian Heimes in :issue:`16632`.)" +"The Windows build now uses `Address Space Layout Randomization <https://" +"en.wikipedia.org/wiki/Address_space_layout_randomization>`_ and `Data " +"Execution Prevention <https://en.wikipedia.org/wiki/" +"Data_Execution_Prevention>`_. (Contributed by Christian Heimes " +"in :issue:`16632`.)" msgstr "" #: ../../whatsnew/3.4.rst:1923 msgid "" -"New function :c:func:`PyObject_LengthHint` is the C API equivalent of :func:" -"`operator.length_hint`. (Contributed by Armin Ronacher in :issue:`16148`.)" +"New function :c:func:`PyObject_LengthHint` is the C API equivalent " +"of :func:`operator.length_hint`. (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:1931 msgid "Other Improvements" -msgstr "" +msgstr "其他改進" #: ../../whatsnew/3.4.rst:1935 msgid "" @@ -2789,8 +2847,8 @@ msgstr "" msgid "" "The CPython Windows installer now adds ``.py`` to the :envvar:`PATHEXT` " "variable when extensions are registered, allowing users to run a python " -"script at the windows command prompt by just typing its name without the ``." -"py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" +"script at the windows command prompt by just typing its name without the " +"``.py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" msgstr "" #: ../../whatsnew/3.4.rst:1961 @@ -2804,13 +2862,17 @@ msgstr "" #: ../../whatsnew/3.4.rst:1967 msgid "" "The ``-R`` option to the :ref:`python regression test suite <regrtest>` now " -"also checks for memory allocation leaks, using :func:`sys." -"getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" +"also checks for memory allocation leaks, " +"using :func:`sys.getallocatedblocks`. (Contributed by Antoine Pitrou " +"in :issue:`13390`.)" msgstr "" +":ref:`python 迴歸測試套裝 <regrtest>` 的 ``-R`` 選項現在也可以透過使" +"用 :func:`sys.getallocatedblocks` 來檢查記憶體配置洩漏。(由 Antoine Pitrou " +"在 :issue:`13390` 貢獻。)" #: ../../whatsnew/3.4.rst:1972 msgid "``python -m`` now works with namespace packages." -msgstr "" +msgstr "``python -m`` 現在可以使用於命名空間套件。" #: ../../whatsnew/3.4.rst:1974 msgid "" @@ -2830,15 +2892,15 @@ msgstr "" msgid "" "A new opcode, :opcode:`!LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " -"uses of :ref:`__prepare__ <prepare>`. (Contributed by Benjamin Peterson in :" -"issue:`17853`.)" +"uses of :ref:`__prepare__ <prepare>`. (Contributed by Benjamin Peterson " +"in :issue:`17853`.)" msgstr "" #: ../../whatsnew/3.4.rst:1987 msgid "" "A number of MemoryError-related crashes were identified and fixed by Victor " -"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool (:issue:`18408`, :" -"issue:`18520`)." +"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool " +"(:issue:`18408`, :issue:`18520`)." msgstr "" #: ../../whatsnew/3.4.rst:1991 @@ -2858,10 +2920,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2000 msgid "" -"The encoding name is now optional in the value set for the :envvar:" -"`PYTHONIOENCODING` environment variable. This makes it possible to set just " -"the error handler, without changing the default encoding. (Contributed by " -"Serhiy Storchaka in :issue:`18818`.)" +"The encoding name is now optional in the value set for " +"the :envvar:`PYTHONIOENCODING` environment variable. This makes it possible " +"to set just the error handler, without changing the default encoding. " +"(Contributed by Serhiy Storchaka in :issue:`18818`.)" msgstr "" #: ../../whatsnew/3.4.rst:2005 @@ -2897,12 +2959,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2027 msgid "" "The interpreter starts about 30% faster. A couple of measures lead to the " -"speedup. The interpreter loads fewer modules on startup, e.g. the :mod:" -"`re`, :mod:`collections` and :mod:`locale` modules and their dependencies " -"are no longer imported by default. The marshal module has been improved to " -"load compiled Python code faster. (Contributed by Antoine Pitrou, Christian " -"Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:" -"`19209`, :issue:`19205` and :issue:`9548`.)" +"speedup. The interpreter loads fewer modules on startup, e.g. " +"the :mod:`re`, :mod:`collections` and :mod:`locale` modules and their " +"dependencies are no longer imported by default. The marshal module has been " +"improved to load compiled Python code faster. (Contributed by Antoine " +"Pitrou, Christian Heimes and Victor Stinner " +"in :issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:`19205` " +"and :issue:`9548`.)" msgstr "" #: ../../whatsnew/3.4.rst:2035 @@ -2935,8 +2998,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2051 msgid "" -":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in :" -"issue:`18020`.)" +":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant " +"in :issue:`18020`.)" msgstr "" #: ../../whatsnew/3.4.rst:2054 @@ -2961,36 +3024,38 @@ msgstr "已棄用" msgid "" "This section covers various APIs and other features that have been " "deprecated in Python 3.4, and will be removed in Python 3.5 or later. In " -"most (but not all) cases, using the deprecated APIs will produce a :exc:" -"`DeprecationWarning` when the interpreter is run with deprecation warnings " -"enabled (for example, by using ``-Wd``)." +"most (but not all) cases, using the deprecated APIs will produce " +"a :exc:`DeprecationWarning` when the interpreter is run with deprecation " +"warnings enabled (for example, by using ``-Wd``)." msgstr "" #: ../../whatsnew/3.4.rst:2076 msgid "Deprecations in the Python API" -msgstr "" +msgstr "已棄用的 Python API" #: ../../whatsnew/3.4.rst:2078 msgid "" "As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importlib` " "methods and functions are deprecated: :meth:`!importlib.find_loader` is " -"replaced by :func:`importlib.util.find_spec`; :meth:`!importlib.machinery." -"PathFinder.find_module` is replaced by :meth:`importlib.machinery.PathFinder." -"find_spec`; :meth:`!importlib.abc.MetaPathFinder.find_module` is replaced " -"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!importlib.abc." -"PathEntryFinder.find_loader` and :meth:`!find_module` are replaced by :meth:" -"`importlib.abc.PathEntryFinder.find_spec`; all of the :samp:`{xxx}Loader` " -"ABC ``load_module`` methods (:meth:`!importlib.abc.Loader.load_module`, :" -"meth:`!importlib.abc.InspectLoader.load_module`, :meth:`!importlib.abc." -"FileLoader.load_module`, :meth:`!importlib.abc.SourceLoader.load_module`) " -"should no longer be implemented, instead loaders should implement an " -"``exec_module`` method (:meth:`importlib.abc.Loader.exec_module`, :meth:" -"`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader." -"exec_module`) and let the import system take care of the rest; and :meth:`!" -"importlib.abc.Loader.module_repr`, :meth:`!importlib.util." -"module_for_loader`, :meth:`!importlib.util.set_loader`, and :meth:`!" -"importlib.util.set_package` are no longer needed because their functions are " -"now handled automatically by the import system." +"replaced by :func:`importlib.util.find_spec`; :meth:`!" +"importlib.machinery.PathFinder.find_module` is replaced " +"by :meth:`importlib.machinery.PathFinder.find_spec`; :meth:`!" +"importlib.abc.MetaPathFinder.find_module` is replaced " +"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` and :meth:`!find_module` are " +"replaced by :meth:`importlib.abc.PathEntryFinder.find_spec`; all of " +"the :samp:`{xxx}Loader` ABC ``load_module`` methods (:meth:`!" +"importlib.abc.Loader.load_module`, :meth:`!" +"importlib.abc.InspectLoader.load_module`, :meth:`!" +"importlib.abc.FileLoader.load_module`, :meth:`!" +"importlib.abc.SourceLoader.load_module`) should no longer be implemented, " +"instead loaders should implement an ``exec_module`` method " +"(:meth:`importlib.abc.Loader.exec_module`, :meth:`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader.exec_module`) " +"and let the import system take care of the rest; and :meth:`!" +"importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.util.module_for_loader`, :meth:`!importlib.util.set_loader`, " +"and :meth:`!importlib.util.set_package` are no longer needed because their " +"functions are now handled automatically by the import system." msgstr "" #: ../../whatsnew/3.4.rst:2103 @@ -3015,8 +3080,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2113 msgid "" "The internal ``Netrc`` class in the :mod:`ftplib` module has been documented " -"as deprecated in its docstring for quite some time. It now emits a :exc:" -"`DeprecationWarning` and will be removed completely in Python 3.5." +"as deprecated in its docstring for quite some time. It now emits " +"a :exc:`DeprecationWarning` and will be removed completely in Python 3.5." msgstr "" #: ../../whatsnew/3.4.rst:2117 @@ -3033,12 +3098,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2123 msgid "" -"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib." -"writePlist`, :func:`~plistlib.readPlistFromBytes`, and :func:`~plistlib." -"writePlistToBytes` functions are deprecated in favor of the corresponding " -"new functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:" -"`~plistlib.loads`, and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is " -"deprecated in favor of just using the :class:`bytes` constructor." +"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib.writePlist`, :func:`~plistlib.readPlistFromBytes`, " +"and :func:`~plistlib.writePlistToBytes` functions are deprecated in favor of " +"the corresponding new " +"functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is deprecated in favor " +"of just using the :class:`bytes` constructor." msgstr "" #: ../../whatsnew/3.4.rst:2130 @@ -3058,9 +3123,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2138 msgid "" "The *parser* argument of :func:`xml.etree.ElementTree.iterparse` has been " -"deprecated, as has the *html* argument of :func:`~xml.etree.ElementTree." -"XMLParser`. To prepare for the removal of the latter, all arguments to " -"``XMLParser`` should be passed by keyword." +"deprecated, as has the *html* argument " +"of :func:`~xml.etree.ElementTree.XMLParser`. To prepare for the removal of " +"the latter, all arguments to ``XMLParser`` should be passed by keyword." msgstr "" #: ../../whatsnew/3.4.rst:2145 @@ -3085,7 +3150,7 @@ msgstr "已移除" #: ../../whatsnew/3.4.rst:2160 msgid "Operating Systems No Longer Supported" -msgstr "" +msgstr "不再支援的作業系統" #: ../../whatsnew/3.4.rst:2162 msgid "" @@ -3136,8 +3201,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2184 msgid "" "The ``PyThreadState.tick_counter`` field has been removed; its value has " -"been meaningless since Python 3.2, when the \"new GIL\" was introduced (:" -"issue:`19199`)." +"been meaningless since Python 3.2, when the \"new GIL\" was introduced " +"(:issue:`19199`)." msgstr "" #: ../../whatsnew/3.4.rst:2188 @@ -3148,9 +3213,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2191 msgid "" -"The *strict* argument to :class:`~http.client.HTTPConnection` and :class:" -"`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style \"Simple " -"Responses\" are no longer supported." +"The *strict* argument to :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style " +"\"Simple Responses\" are no longer supported." msgstr "" #: ../../whatsnew/3.4.rst:2195 @@ -3163,8 +3228,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2200 msgid "" -"Support for loading the deprecated ``TYPE_INT64`` has been removed from :mod:" -"`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" +"Support for loading the deprecated ``TYPE_INT64`` has been removed " +"from :mod:`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" msgstr "" #: ../../whatsnew/3.4.rst:2203 @@ -3181,16 +3246,16 @@ msgid "" "situation where previously working (but incorrect) code would start failing " "if an object gained a __format__ method, which means that your code may now " "raise a :exc:`TypeError` if you are using an ``'s'`` format code with " -"objects that do not have a __format__ method that handles it. See :issue:" -"`7994` for background." +"objects that do not have a __format__ method that handles it. " +"See :issue:`7994` for background." msgstr "" #: ../../whatsnew/3.4.rst:2215 msgid "" -":meth:`difflib.SequenceMatcher.isbjunk` and :meth:`difflib.SequenceMatcher." -"isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." -"bjunk`` and ``x in sm.bpopular``, where *sm* is a :class:`~difflib." -"SequenceMatcher` object (:issue:`13248`)." +":meth:`difflib.SequenceMatcher.isbjunk` " +"and :meth:`difflib.SequenceMatcher.isbpopular` were deprecated in 3.2, and " +"have now been removed: use ``x in sm.bjunk`` and ``x in sm.bpopular``, where " +"*sm* is a :class:`~difflib.SequenceMatcher` object (:issue:`13248`)." msgstr "" #: ../../whatsnew/3.4.rst:2223 @@ -3234,12 +3299,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2248 msgid "" "In a posix shell, setting the :envvar:`PATH` environment variable to an " -"empty value is equivalent to not setting it at all. However, setting :" -"envvar:`PYTHONPATH` to an empty value was *not* equivalent to not setting it " -"at all: setting :envvar:`PYTHONPATH` to an empty value was equivalent to " -"setting it to ``.``, which leads to confusion when reasoning by analogy to " -"how :envvar:`PATH` works. The behavior now conforms to the posix convention " -"for :envvar:`PATH`." +"empty value is equivalent to not setting it at all. However, " +"setting :envvar:`PYTHONPATH` to an empty value was *not* equivalent to not " +"setting it at all: setting :envvar:`PYTHONPATH` to an empty value was " +"equivalent to setting it to ``.``, which leads to confusion when reasoning " +"by analogy to how :envvar:`PATH` works. The behavior now conforms to the " +"posix convention for :envvar:`PATH`." msgstr "" #: ../../whatsnew/3.4.rst:2256 @@ -3263,18 +3328,20 @@ msgstr "Python API 的變更" #: ../../whatsnew/3.4.rst:2268 msgid "" "The ABCs defined in :mod:`importlib.abc` now either raise the appropriate " -"exception or return a default value instead of raising :exc:" -"`NotImplementedError` blindly. This will only affect code calling :func:" -"`super` and falling through all the way to the ABCs. For compatibility, " -"catch both :exc:`NotImplementedError` or the appropriate exception as needed." +"exception or return a default value instead of " +"raising :exc:`NotImplementedError` blindly. This will only affect code " +"calling :func:`super` and falling through all the way to the ABCs. For " +"compatibility, catch both :exc:`NotImplementedError` or the appropriate " +"exception as needed." msgstr "" #: ../../whatsnew/3.4.rst:2274 msgid "" -"The module type now initializes the :attr:`~module.__package__` and :attr:" -"`~module.__loader__` attributes to ``None`` by default. To determine if " -"these attributes were set in a backwards-compatible fashion, use e.g. " -"``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" +"The module type now initializes the :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes to ``None`` by default. To " +"determine if these attributes were set in a backwards-compatible fashion, " +"use e.g. ``getattr(module, '__loader__', None) is not None``. " +"(:issue:`17115`.)" msgstr "" #: ../../whatsnew/3.4.rst:2280 @@ -3309,9 +3376,9 @@ msgid "" "incorrect for frozen modules to set the attribute as they are not loaded " "from any explicit location. If you must know that a module comes from frozen " "code then you can see if the module's ``__spec__.location`` is set to " -"``'frozen'``, check if the loader is a subclass of :class:`importlib." -"machinery.FrozenImporter`, or if Python 2 compatibility is necessary you can " -"use :func:`!imp.is_frozen`." +"``'frozen'``, check if the loader is a subclass " +"of :class:`importlib.machinery.FrozenImporter`, or if Python 2 compatibility " +"is necessary you can use :func:`!imp.is_frozen`." msgstr "" #: ../../whatsnew/3.4.rst:2305 @@ -3324,14 +3391,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:2310 msgid "" -":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" -"`ImportError` when the source code being loaded triggers a :exc:" -"`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is meant " -"to be raised only when source code cannot be found but it should, it was " -"felt to be over-reaching/overloading of that meaning when the source code is " -"found but improperly structured. If you were catching ImportError before and " -"wish to continue to ignore syntax or decoding issues, catch all three " -"exceptions now." +":meth:`importlib.abc.SourceLoader.get_source` no longer " +"raises :exc:`ImportError` when the source code being loaded triggers " +"a :exc:`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is " +"meant to be raised only when source code cannot be found but it should, it " +"was felt to be over-reaching/overloading of that meaning when the source " +"code is found but improperly structured. If you were catching ImportError " +"before and wish to continue to ignore syntax or decoding issues, catch all " +"three exceptions now." msgstr "" #: ../../whatsnew/3.4.rst:2319 @@ -3348,12 +3415,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2329 msgid "" -":func:`inspect.getfullargspec` has been reimplemented on top of :func:" -"`inspect.signature` and hence handles a much wider variety of callable " -"objects than it did in the past. It is expected that additional builtin and " -"extension module callables will gain signature metadata over the course of " -"the Python 3.4 series. Code that assumes that :func:`inspect.getfullargspec` " -"will fail on non-Python callables may need to be adjusted accordingly." +":func:`inspect.getfullargspec` has been reimplemented on top " +"of :func:`inspect.signature` and hence handles a much wider variety of " +"callable objects than it did in the past. It is expected that additional " +"builtin and extension module callables will gain signature metadata over the " +"course of the Python 3.4 series. Code that assumes " +"that :func:`inspect.getfullargspec` will fail on non-Python callables may " +"need to be adjusted accordingly." msgstr "" #: ../../whatsnew/3.4.rst:2337 @@ -3366,8 +3434,8 @@ msgid "" "working directory will also now have an absolute path, including when using " "``-m`` with the interpreter (except for ``__main__.__file__`` when a script " "has been executed directly using a relative path) (Contributed by Brett " -"Cannon in :issue:`18416`). is specified on the command-line) (:issue:" -"`18416`)." +"Cannon in :issue:`18416`). is specified on the command-line) " +"(:issue:`18416`)." msgstr "" #: ../../whatsnew/3.4.rst:2348 @@ -3384,66 +3452,69 @@ msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " "interstitial string would sometimes be ignored. This brings CPython into " -"compliance with the language spec; Jython and PyPy already were. (:issue:" -"`17434`)." +"compliance with the language spec; Jython and PyPy already were. " +"(:issue:`17434`)." msgstr "" #: ../../whatsnew/3.4.rst:2360 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " -"connected, instead of the previous behavior of raising an :exc:" -"`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` will " -"raise a :exc:`ValueError` if the handshake has not yet been done." +"connected, instead of the previous behavior of raising " +"an :exc:`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` " +"will raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" #: ../../whatsnew/3.4.rst:2366 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " -"This particular :exc:`TypeError` was missed when the other :exc:" -"`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka in :issue:" -"`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." +"This particular :exc:`TypeError` was missed when the " +"other :exc:`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka " +"in :issue:`18011`.) Note: this change was also inadvertently applied in " +"Python 3.3.3." msgstr "" #: ../../whatsnew/3.4.rst:2373 msgid "" -"The :attr:`!file` attribute is now automatically closed when the creating :" -"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " -"the file object out separately from the :class:`!cgi.FieldStorage` instance " -"and not keeping the instance alive, then you should either store the entire :" -"class:`!cgi.FieldStorage` instance or read the contents of the file before " -"the :class:`!cgi.FieldStorage` instance is garbage collected." +"The :attr:`!file` attribute is now automatically closed when the " +"creating :class:`!cgi.FieldStorage` instance is garbage collected. If you " +"were pulling the file object out separately from the :class:`!" +"cgi.FieldStorage` instance and not keeping the instance alive, then you " +"should either store the entire :class:`!cgi.FieldStorage` instance or read " +"the contents of the file before the :class:`!cgi.FieldStorage` instance is " +"garbage collected." msgstr "" #: ../../whatsnew/3.4.rst:2380 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " -"informative :exc:`ValueError` rather than the previous more mysterious :exc:" -"`AttributeError` (:issue:`9177`)." +"informative :exc:`ValueError` rather than the previous more " +"mysterious :exc:`AttributeError` (:issue:`9177`)." msgstr "" #: ../../whatsnew/3.4.rst:2384 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " -"values. As a consequence of this fix, :meth:`slice.indices` now raises a :" -"exc:`ValueError` if given a negative length; previously it returned nonsense " -"values (:issue:`14794`)." +"values. As a consequence of this fix, :meth:`slice.indices` now raises " +"a :exc:`ValueError` if given a negative length; previously it returned " +"nonsense values (:issue:`14794`)." msgstr "" #: ../../whatsnew/3.4.rst:2389 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " -"special method returned one. This now raises a :exc:`TypeError`. (:issue:" -"`16290`.)" +"special method returned one. This now raises a :exc:`TypeError`. " +"(:issue:`16290`.)" msgstr "" #: ../../whatsnew/3.4.rst:2394 msgid "" -"The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" -"`float` values for the *base* parameter. It is unlikely anyone was doing " -"this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." +"The :class:`int` constructor in 3.2 and 3.3 erroneously " +"accepts :class:`float` values for the *base* parameter. It is unlikely " +"anyone was doing this, but if so, it will now raise a :exc:`TypeError` " +"(:issue:`16772`)." msgstr "" #: ../../whatsnew/3.4.rst:2398 @@ -3484,8 +3555,8 @@ msgid "" "isolation that :mod:`unittest` is designed to provide. However, if the lack " "of isolation is considered acceptable, the old behavior can be restored by " "creating a :mod:`~unittest.TestSuite` subclass that defines a " -"``_removeTestAtIndex`` method that does nothing (see :meth:`.TestSuite." -"__iter__`) (:issue:`11798`)." +"``_removeTestAtIndex`` method that does nothing " +"(see :meth:`.TestSuite.__iter__`) (:issue:`11798`)." msgstr "" #: ../../whatsnew/3.4.rst:2425 @@ -3518,8 +3589,8 @@ msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " "eventually be changed to default to ``True``. It is recommended that you " -"add this keyword, with the appropriate value, to any :class:`~html.parser." -"HTMLParser` calls in your code (:issue:`13633`)." +"add this keyword, with the appropriate value, to " +"any :class:`~html.parser.HTMLParser` calls in your code (:issue:`13633`)." msgstr "" #: ../../whatsnew/3.4.rst:2446 @@ -3543,8 +3614,8 @@ msgid "" "is ineffective in Python3 and will eventually raise an error if used. " "Depending on the function, the equivalent of its old Python2 behavior can be " "achieved using either a *newline* argument, or if necessary by wrapping the " -"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument (:issue:" -"`15204`)." +"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument " +"(:issue:`15204`)." msgstr "" #: ../../whatsnew/3.4.rst:2462 @@ -3574,10 +3645,10 @@ msgstr "" msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " -"the case that importing :mod:`collections` automatically imports :mod:" -"`collections.abc`. If your program depended on the (undocumented) implicit " -"import, you will need to add an explicit ``import collections.abc`` (:issue:" -"`20784`)." +"the case that importing :mod:`collections` automatically " +"imports :mod:`collections.abc`. If your program depended on the " +"(undocumented) implicit import, you will need to add an explicit ``import " +"collections.abc`` (:issue:`20784`)." msgstr "" #: ../../whatsnew/3.4.rst:2486 @@ -3586,16 +3657,16 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.4.rst:2488 msgid "" -":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" -"`PyObject_Str`, along with some other internal C APIs, now include a " -"debugging assertion that ensures they are not used in situations where they " -"may silently discard a currently active exception. In cases where discarding " -"the active exception is expected and desired (for example, because it has " -"already been saved locally with :c:func:`PyErr_Fetch` or is being " -"deliberately replaced with a different exception), an explicit :c:func:" -"`PyErr_Clear` call will be needed to avoid triggering the assertion when " -"invoking these operations (directly or indirectly) and running against a " -"version of Python that is compiled with assertions enabled." +":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, " +"and :c:func:`PyObject_Str`, along with some other internal C APIs, now " +"include a debugging assertion that ensures they are not used in situations " +"where they may silently discard a currently active exception. In cases where " +"discarding the active exception is expected and desired (for example, " +"because it has already been saved locally with :c:func:`PyErr_Fetch` or is " +"being deliberately replaced with a different exception), an " +"explicit :c:func:`PyErr_Clear` call will be needed to avoid triggering the " +"assertion when invoking these operations (directly or indirectly) and " +"running against a version of Python that is compiled with assertions enabled." msgstr "" #: ../../whatsnew/3.4.rst:2500 @@ -3608,10 +3679,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2504 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " -"be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" -"`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of a string " -"allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` (:issue:" -"`16742`)" +"be a string allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of " +"a string allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` " +"(:issue:`16742`)" msgstr "" #: ../../whatsnew/3.4.rst:2510 diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 9de8d2caae..539167e103 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -71,11 +71,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:67 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.5.rst:69 msgid ":mod:`typing`: :ref:`PEP 484 -- Type Hints <whatsnew-pep-484>`." -msgstr "" +msgstr ":mod:`typing`::ref:`PEP 484 -- 型別提示 <whatsnew-pep-484>`。" #: ../../whatsnew/3.5.rst:70 msgid "" @@ -124,10 +124,10 @@ msgstr "CPython 實作改進:" #: ../../whatsnew/3.5.rst:96 msgid "" -"When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), :py:data:" -"`sys.stdin` and :py:data:`sys.stdout` now use the ``surrogateescape`` error " -"handler, instead of the ``strict`` error handler. (Contributed by Victor " -"Stinner in :issue:`19977`.)" +"When the ``LC_TYPE`` locale is the POSIX locale (``C`` " +"locale), :py:data:`sys.stdin` and :py:data:`sys.stdout` now use the " +"``surrogateescape`` error handler, instead of the ``strict`` error handler. " +"(Contributed by Victor Stinner in :issue:`19977`.)" msgstr "" #: ../../whatsnew/3.5.rst:101 @@ -191,8 +191,9 @@ msgstr "安全性改進:" #: ../../whatsnew/3.5.rst:138 msgid "" "SSLv3 is now disabled throughout the standard library. It can still be " -"enabled by instantiating a :class:`ssl.SSLContext` manually. (See :issue:" -"`22638` for more details; this change was backported to CPython 3.4 and 2.7.)" +"enabled by instantiating a :class:`ssl.SSLContext` manually. " +"(See :issue:`22638` for more details; this change was backported to CPython " +"3.4 and 2.7.)" msgstr "" #: ../../whatsnew/3.5.rst:143 @@ -374,9 +375,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:253 msgid "" -"Starting with CPython 3.5.2, ``__aiter__`` can directly return :term:" -"`asynchronous iterators <asynchronous iterator>`. Returning an :term:" -"`awaitable` object will result in a :exc:`PendingDeprecationWarning`." +"Starting with CPython 3.5.2, ``__aiter__`` can directly " +"return :term:`asynchronous iterators <asynchronous iterator>`. Returning " +"an :term:`awaitable` object will result in " +"a :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.5.rst:259 @@ -399,8 +401,8 @@ msgstr "" msgid "" ":pep:`465` adds the ``@`` infix operator for matrix multiplication. " "Currently, no builtin Python types implement the new operator, however, it " -"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, and :" -"meth:`__imatmul__` for regular, reflected, and in-place matrix " +"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, " +"and :meth:`__imatmul__` for regular, reflected, and in-place matrix " "multiplication. The semantics of these methods is similar to that of " "methods defining other infix arithmetic operators." msgstr "" @@ -629,12 +631,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:405 msgid "PEP 484 - Type Hints" -msgstr "" +msgstr "PEP 484 - 型別提示" #: ../../whatsnew/3.5.rst:407 msgid "" -"Function annotation syntax has been a Python feature since version 3.0 (:pep:" -"`3107`), however the semantics of annotations has been left undefined." +"Function annotation syntax has been a Python feature since version 3.0 " +"(:pep:`3107`), however the semantics of annotations has been left undefined." msgstr "" #: ../../whatsnew/3.5.rst:410 @@ -668,18 +670,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:425 msgid "" -"While these annotations are available at runtime through the usual :attr:" -"`~object.__annotations__` attribute, *no automatic type checking happens at " -"runtime*. Instead, it is assumed that a separate off-line type checker (e." -"g. `mypy <https://mypy-lang.org>`_) will be used for on-demand source code " -"analysis." +"While these annotations are available at runtime through the " +"usual :attr:`~object.__annotations__` attribute, *no automatic type checking " +"happens at runtime*. Instead, it is assumed that a separate off-line type " +"checker (e.g. `mypy <https://mypy-lang.org>`_) will be used for on-demand " +"source code analysis." msgstr "" #: ../../whatsnew/3.5.rst:431 msgid "" -"The type system supports unions, generic types, and a special type named :" -"class:`~typing.Any` which is consistent with (i.e. assignable to and from) " -"all types." +"The type system supports unions, generic types, and a special type " +"named :class:`~typing.Any` which is consistent with (i.e. assignable to and " +"from) all types." msgstr "" #: ../../whatsnew/3.5.rst:437 @@ -688,7 +690,7 @@ msgstr ":mod:`typing` 模組文件" #: ../../whatsnew/3.5.rst:438 msgid ":pep:`484` -- Type Hints" -msgstr "" +msgstr ":pep:`484` -- 型別提示" #: ../../whatsnew/3.5.rst:439 msgid "" @@ -698,7 +700,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:441 msgid ":pep:`483` -- The Theory of Type Hints" -msgstr "" +msgstr ":pep:`483` -- 型別提示理論" #: ../../whatsnew/3.5.rst:442 msgid "PEP written by Guido van Rossum" @@ -832,37 +834,32 @@ msgstr ":mod:`faulthandler` 模組的函式;" #: ../../whatsnew/3.5.rst:519 msgid "" -":mod:`os` functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os." -"fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :" -"func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os." -"mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os." -"posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :" -"func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os." -"wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:" -"`~os.write`, :func:`~os.writev`;" +":mod:`os` " +"functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os.fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os.posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os.wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:`~os.write`, :func:`~os.writev`;" msgstr "" #: ../../whatsnew/3.5.rst:529 msgid "" -"special cases: :func:`os.close` and :func:`os.dup2` now ignore :py:const:" -"`~errno.EINTR` errors; the syscall is not retried (see the PEP for the " -"rationale);" +"special cases: :func:`os.close` and :func:`os.dup2` now " +"ignore :py:const:`~errno.EINTR` errors; the syscall is not retried (see the " +"PEP for the rationale);" msgstr "" #: ../../whatsnew/3.5.rst:533 msgid "" -":mod:`select` functions: :func:`devpoll.poll() <select.devpoll.poll>`, :func:" -"`epoll.poll() <select.epoll.poll>`, :func:`kqueue.control() <select.kqueue." -"control>`, :func:`poll.poll() <select.poll.poll>`, :func:`~select.select`;" +":mod:`select` functions: :func:`devpoll.poll() " +"<select.devpoll.poll>`, :func:`epoll.poll() " +"<select.epoll.poll>`, :func:`kqueue.control() " +"<select.kqueue.control>`, :func:`poll.poll() " +"<select.poll.poll>`, :func:`~select.select`;" msgstr "" #: ../../whatsnew/3.5.rst:538 msgid "" -"methods of the :class:`~socket.socket` class: :meth:`~socket.socket." -"accept`, :meth:`~socket.socket.connect` (except for non-blocking sockets), :" -"meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket." -"socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket." -"sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" +"methods of the :class:`~socket.socket` " +"class: :meth:`~socket.socket.accept`, :meth:`~socket.socket.connect` (except " +"for non-blocking " +"sockets), :meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" msgstr "" #: ../../whatsnew/3.5.rst:545 @@ -899,18 +896,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:567 msgid "" ":pep:`479` changes the behavior of generators: when a ``StopIteration`` " -"exception is raised inside a generator, it is replaced with a :exc:" -"`RuntimeError` before it exits the generator frame. The main goal of this " -"change is to ease debugging in the situation where an unguarded :func:`next` " -"call raises ``StopIteration`` and causes the iteration controlled by the " -"generator to terminate silently. This is particularly pernicious in " -"combination with the ``yield from`` construct." +"exception is raised inside a generator, it is replaced with " +"a :exc:`RuntimeError` before it exits the generator frame. The main goal of " +"this change is to ease debugging in the situation where an " +"unguarded :func:`next` call raises ``StopIteration`` and causes the " +"iteration controlled by the generator to terminate silently. This is " +"particularly pernicious in combination with the ``yield from`` construct." msgstr "" #: ../../whatsnew/3.5.rst:575 msgid "" -"This is a backwards incompatible change, so to enable the new behavior, a :" -"term:`__future__` import is necessary::" +"This is a backwards incompatible change, so to enable the new behavior, " +"a :term:`__future__` import is necessary::" msgstr "" #: ../../whatsnew/3.5.rst:578 @@ -1057,15 +1054,15 @@ msgstr "" #: ../../whatsnew/3.5.rst:664 msgid "" -":pep:`488` does away with the concept of ``.pyo`` files. This means that ``." -"pyc`` files represent both unoptimized and optimized bytecode. To prevent " +":pep:`488` does away with the concept of ``.pyo`` files. This means that " +"``.pyc`` files represent both unoptimized and optimized bytecode. To prevent " "the need to constantly regenerate bytecode files, ``.pyc`` files now have an " "optional ``opt-`` tag in their name when the bytecode is optimized. This has " "the side-effect of no more bytecode file name clashes when running under " "either :option:`-O` or :option:`-OO`. Consequently, bytecode files generated " -"from :option:`-O`, and :option:`-OO` may now exist simultaneously. :func:" -"`importlib.util.cache_from_source` has an updated API to help with this " -"change." +"from :option:`-O`, and :option:`-OO` may now exist " +"simultaneously. :func:`importlib.util.cache_from_source` has an updated API " +"to help with this change." msgstr "" #: ../../whatsnew/3.5.rst:676 @@ -1121,22 +1118,22 @@ msgstr "" #: ../../whatsnew/3.5.rst:709 msgid "" -"The :option:`-b` option now affects comparisons of :class:`bytes` with :" -"class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" +"The :option:`-b` option now affects comparisons of :class:`bytes` " +"with :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" msgstr "" #: ../../whatsnew/3.5.rst:712 msgid "" "New Kazakh ``kz1048`` and Tajik ``koi8_t`` :ref:`codecs <standard-" -"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` and :issue:" -"`22681`.)" +"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` " +"and :issue:`22681`.)" msgstr "" #: ../../whatsnew/3.5.rst:715 msgid "" -"Property docstrings are now writable. This is especially useful for :func:" -"`collections.namedtuple` docstrings. (Contributed by Berker Peksag in :issue:" -"`24064`.)" +"Property docstrings are now writable. This is especially useful " +"for :func:`collections.namedtuple` docstrings. (Contributed by Berker Peksag " +"in :issue:`24064`.)" msgstr "" #: ../../whatsnew/3.5.rst:719 @@ -1189,8 +1186,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:752 msgid "" -"The module implementation has been contributed by Paul Moore in :issue:" -"`23491`." +"The module implementation has been contributed by Paul Moore " +"in :issue:`23491`." msgstr "" #: ../../whatsnew/3.5.rst:757 @@ -1207,10 +1204,10 @@ msgstr "argparse" #: ../../whatsnew/3.5.rst:766 msgid "" -"The :class:`~argparse.ArgumentParser` class now allows disabling :ref:" -"`abbreviated usage <prefix-matching>` of long options by setting :ref:" -"`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, Steven " -"Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" +"The :class:`~argparse.ArgumentParser` class now allows " +"disabling :ref:`abbreviated usage <prefix-matching>` of long options by " +"setting :ref:`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, " +"Steven Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" msgstr "" #: ../../whatsnew/3.5.rst:773 @@ -1220,8 +1217,8 @@ msgstr "asyncio" #: ../../whatsnew/3.5.rst:775 msgid "" "Since the :mod:`asyncio` module is :term:`provisional <provisional API>`, " -"all changes introduced in Python 3.5 have also been backported to Python 3.4." -"x." +"all changes introduced in Python 3.5 have also been backported to Python " +"3.4.x." msgstr "" #: ../../whatsnew/3.5.rst:778 @@ -1230,9 +1227,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:780 msgid "" -"New debugging APIs: :meth:`loop.set_debug() <asyncio.loop.set_debug>` and :" -"meth:`loop.get_debug() <asyncio.loop.get_debug>` methods. (Contributed by " -"Victor Stinner.)" +"New debugging APIs: :meth:`loop.set_debug() <asyncio.loop.set_debug>` " +"and :meth:`loop.get_debug() <asyncio.loop.get_debug>` methods. (Contributed " +"by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:784 @@ -1258,23 +1255,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:798 msgid "" -"A new :meth:`transport.get_write_buffer_limits() <asyncio.WriteTransport." -"get_write_buffer_limits>` method to inquire for *high-* and *low-* water " -"limits of the flow control. (Contributed by Victor Stinner.)" +"A new :meth:`transport.get_write_buffer_limits() " +"<asyncio.WriteTransport.get_write_buffer_limits>` method to inquire for " +"*high-* and *low-* water limits of the flow control. (Contributed by Victor " +"Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:803 msgid "" -"The :func:`~asyncio.async` function is deprecated in favor of :func:" -"`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" +"The :func:`~asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:807 msgid "" -"New :meth:`loop.set_task_factory() <asyncio.loop.set_task_factory>` and :" -"meth:`loop.get_task_factory() <asyncio.loop.get_task_factory>` methods to " -"customize the task factory that :meth:`loop.create_task() <asyncio.loop." -"create_task>` method uses. (Contributed by Yury Selivanov.)" +"New :meth:`loop.set_task_factory() <asyncio.loop.set_task_factory>` " +"and :meth:`loop.get_task_factory() <asyncio.loop.get_task_factory>` methods " +"to customize the task factory that :meth:`loop.create_task() " +"<asyncio.loop.create_task>` method uses. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:814 @@ -1285,8 +1283,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:818 msgid "" -"The ``JoinableQueue`` class was removed, in favor of the :class:`asyncio." -"Queue` class. (Contributed by Victor Stinner.)" +"The ``JoinableQueue`` class was removed, in favor of " +"the :class:`asyncio.Queue` class. (Contributed by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:822 @@ -1335,9 +1333,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() <asyncio.loop." -"get_exception_handler>` method to get the current exception handler. " -"(Contributed by Yury Selivanov.)" +"New :meth:`loop.get_exception_handler() " +"<asyncio.loop.get_exception_handler>` method to get the current exception " +"handler. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:854 @@ -1349,8 +1347,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:859 msgid "" -"The :meth:`loop.create_connection() <asyncio.loop.create_connection>` and :" -"meth:`loop.create_server() <asyncio.loop.create_server>` methods are " +"The :meth:`loop.create_connection() <asyncio.loop.create_connection>` " +"and :meth:`loop.create_server() <asyncio.loop.create_server>` methods are " "optimized to avoid calling the system ``getaddrinfo`` function if the " "address is already resolved. (Contributed by A. Jesse Jiryu Davis.)" msgstr "" @@ -1399,10 +1397,10 @@ msgstr "code" #: ../../whatsnew/3.5.rst:895 msgid "" -"The :func:`InteractiveInterpreter.showtraceback() <code." -"InteractiveInterpreter.showtraceback>` method now prints the full chained " -"traceback, just like the interactive interpreter. (Contributed by Claudiu " -"Popa in :issue:`17442`.)" +"The :func:`InteractiveInterpreter.showtraceback() " +"<code.InteractiveInterpreter.showtraceback>` method now prints the full " +"chained traceback, just like the interactive interpreter. (Contributed by " +"Claudiu Popa in :issue:`17442`.)" msgstr "" #: ../../whatsnew/3.5.rst:901 @@ -1412,26 +1410,28 @@ msgstr "collections" #: ../../whatsnew/3.5.rst:905 msgid "" "The :class:`~collections.OrderedDict` class is now implemented in C, which " -"makes it 4 to 100 times faster. (Contributed by Eric Snow in :issue:" -"`16991`.)" +"makes it 4 to 100 times faster. (Contributed by Eric Snow " +"in :issue:`16991`.)" msgstr "" #: ../../whatsnew/3.5.rst:908 msgid "" -":meth:`OrderedDict.items() <collections.OrderedDict.items>`, :meth:" -"`OrderedDict.keys() <collections.OrderedDict.keys>`, :meth:`OrderedDict." -"values() <collections.OrderedDict.values>` views now support :func:" -"`reversed` iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" +":meth:`OrderedDict.items() " +"<collections.OrderedDict.items>`, :meth:`OrderedDict.keys() " +"<collections.OrderedDict.keys>`, :meth:`OrderedDict.values() " +"<collections.OrderedDict.values>` views now support :func:`reversed` " +"iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" msgstr "" #: ../../whatsnew/3.5.rst:914 msgid "" -"The :class:`~collections.deque` class now defines :meth:`~collections.deque." -"index`, :meth:`~collections.deque.insert`, and :meth:`~collections.deque." -"copy`, and supports the ``+`` and ``*`` operators. This allows deques to be " -"recognized as a :class:`~collections.abc.MutableSequence` and improves their " -"substitutability for lists. (Contributed by Raymond Hettinger in :issue:" -"`23704`.)" +"The :class:`~collections.deque` class now " +"defines :meth:`~collections.deque.index`, :meth:`~collections.deque.insert`, " +"and :meth:`~collections.deque.copy`, and supports the ``+`` and ``*`` " +"operators. This allows deques to be recognized as " +"a :class:`~collections.abc.MutableSequence` and improves their " +"substitutability for lists. (Contributed by Raymond Hettinger " +"in :issue:`23704`.)" msgstr "" #: ../../whatsnew/3.5.rst:921 @@ -1457,11 +1457,10 @@ msgstr "(由 Berker Peksag 在 :issue:`24064` 中貢獻。)" #: ../../whatsnew/3.5.rst:930 msgid "" -"The :class:`~collections.UserString` class now implements the :meth:" -"`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str." -"format_map`, :meth:`~str.isprintable`, and :meth:`~str.maketrans` methods to " -"match the corresponding methods of :class:`str`. (Contributed by Joe Jevnik " -"in :issue:`22189`.)" +"The :class:`~collections.UserString` class now implements " +"the :meth:`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str.format_map`, :meth:`~str.isprintable`, " +"and :meth:`~str.maketrans` methods to match the corresponding methods " +"of :class:`str`. (Contributed by Joe Jevnik in :issue:`22189`.)" msgstr "" #: ../../whatsnew/3.5.rst:938 @@ -1471,9 +1470,9 @@ msgstr "collections.abc" #: ../../whatsnew/3.5.rst:940 msgid "" "The :meth:`Sequence.index() <collections.abc.Sequence.index>` method now " -"accepts *start* and *stop* arguments to match the corresponding methods of :" -"class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre in :" -"issue:`23086`.)" +"accepts *start* and *stop* arguments to match the corresponding methods " +"of :class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre " +"in :issue:`23086`.)" msgstr "" #: ../../whatsnew/3.5.rst:945 @@ -1484,10 +1483,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:948 msgid "" -"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc." -"Coroutine`, :class:`~collections.abc.AsyncIterator`, and :class:" -"`~collections.abc.AsyncIterable` abstract base classes. (Contributed by Yury " -"Selivanov in :issue:`24184`.)" +"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc.Coroutine`, :class:`~collections.abc.AsyncIterator`, " +"and :class:`~collections.abc.AsyncIterable` abstract base classes. " +"(Contributed by Yury Selivanov in :issue:`24184`.)" msgstr "" #: ../../whatsnew/3.5.rst:953 @@ -1503,8 +1501,8 @@ msgstr "compileall" #: ../../whatsnew/3.5.rst:960 msgid "" "A new :mod:`compileall` option, :samp:`-j {N}`, allows running *N* workers " -"simultaneously to perform parallel bytecode compilation. The :func:" -"`~compileall.compile_dir` function has a corresponding ``workers`` " +"simultaneously to perform parallel bytecode compilation. " +"The :func:`~compileall.compile_dir` function has a corresponding ``workers`` " "parameter. (Contributed by Claudiu Popa in :issue:`16104`.)" msgstr "" @@ -1518,10 +1516,11 @@ msgstr "" msgid "" "The ``-q`` command line option can now be specified more than once, in which " "case all output, including errors, will be suppressed. The corresponding " -"``quiet`` parameter in :func:`~compileall.compile_dir`, :func:`~compileall." -"compile_file`, and :func:`~compileall.compile_path` can now accept an " -"integer value indicating the level of output suppression. (Contributed by " -"Thomas Kluyver in :issue:`21338`.)" +"``quiet`` parameter " +"in :func:`~compileall.compile_dir`, :func:`~compileall.compile_file`, " +"and :func:`~compileall.compile_path` can now accept an integer value " +"indicating the level of output suppression. (Contributed by Thomas Kluyver " +"in :issue:`21338`.)" msgstr "" #: ../../whatsnew/3.5.rst:977 @@ -1550,10 +1549,10 @@ msgstr "configparser" #: ../../whatsnew/3.5.rst:992 msgid "" ":mod:`configparser` now provides a way to customize the conversion of values " -"by specifying a dictionary of converters in the :class:`~configparser." -"ConfigParser` constructor, or by defining them as methods in " -"``ConfigParser`` subclasses. Converters defined in a parser instance are " -"inherited by its section proxies." +"by specifying a dictionary of converters in " +"the :class:`~configparser.ConfigParser` constructor, or by defining them as " +"methods in ``ConfigParser`` subclasses. Converters defined in a parser " +"instance are inherited by its section proxies." msgstr "" #: ../../whatsnew/3.5.rst:998 @@ -1660,8 +1659,8 @@ msgstr "dbm" #: ../../whatsnew/3.5.rst:1056 msgid "" ":func:`dumb.open <dbm.dumb.open>` always creates a new database when the " -"flag has the value ``\"n\"``. (Contributed by Claudiu Popa in :issue:" -"`18039`.)" +"flag has the value ``\"n\"``. (Contributed by Claudiu Popa " +"in :issue:`18039`.)" msgstr "" #: ../../whatsnew/3.5.rst:1061 @@ -1673,8 +1672,8 @@ msgid "" "The charset of HTML documents generated by :meth:`HtmlDiff.make_file() " "<difflib.HtmlDiff.make_file>` can now be customized by using a new *charset* " "keyword-only argument. The default charset of HTML document changed from " -"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag in :issue:" -"`2052`.)" +"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag " +"in :issue:`2052`.)" msgstr "" #: ../../whatsnew/3.5.rst:1070 @@ -1708,9 +1707,10 @@ msgstr "doctest" #: ../../whatsnew/3.5.rst:1090 msgid "" -"The :func:`~doctest.DocTestSuite` function returns an empty :class:`unittest." -"TestSuite` if *module* contains no docstrings, instead of raising :exc:" -"`ValueError`. (Contributed by Glenn Jones in :issue:`15916`.)" +"The :func:`~doctest.DocTestSuite` function returns an " +"empty :class:`unittest.TestSuite` if *module* contains no docstrings, " +"instead of raising :exc:`ValueError`. (Contributed by Glenn Jones " +"in :issue:`15916`.)" msgstr "" #: ../../whatsnew/3.5.rst:1096 @@ -1719,19 +1719,20 @@ msgstr "email" #: ../../whatsnew/3.5.rst:1098 msgid "" -"A new policy option :attr:`Policy.mangle_from_ <email.policy.Policy." -"mangle_from_>` controls whether or not lines that start with ``\"From \"`` " -"in email bodies are prefixed with a ``\">\"`` character by generators. The " -"default is ``True`` for :attr:`~email.policy.compat32` and ``False`` for all " -"other policies. (Contributed by Milan Oberkirch in :issue:`20098`.)" +"A new policy option :attr:`Policy.mangle_from_ " +"<email.policy.Policy.mangle_from_>` controls whether or not lines that start " +"with ``\"From \"`` in email bodies are prefixed with a ``\">\"`` character " +"by generators. The default is ``True`` for :attr:`~email.policy.compat32` " +"and ``False`` for all other policies. (Contributed by Milan Oberkirch " +"in :issue:`20098`.)" msgstr "" #: ../../whatsnew/3.5.rst:1104 msgid "" -"A new :meth:`Message.get_content_disposition() <email.message.Message." -"get_content_disposition>` method provides easy access to a canonical value " -"for the :mailheader:`Content-Disposition` header. (Contributed by Abhilash " -"Raj in :issue:`21083`.)" +"A new :meth:`Message.get_content_disposition() " +"<email.message.Message.get_content_disposition>` method provides easy access " +"to a canonical value for the :mailheader:`Content-Disposition` header. " +"(Contributed by Abhilash Raj in :issue:`21083`.)" msgstr "" #: ../../whatsnew/3.5.rst:1110 @@ -1739,9 +1740,9 @@ msgid "" "A new policy option :attr:`EmailPolicy.utf8 <email.policy.EmailPolicy.utf8>` " "can be set to ``True`` to encode email headers using the UTF-8 charset " "instead of using encoded words. This allows ``Messages`` to be formatted " -"according to :rfc:`6532` and used with an SMTP server that supports the :rfc:" -"`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:" -"`24211`.)" +"according to :rfc:`6532` and used with an SMTP server that supports " +"the :rfc:`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray " +"in :issue:`24211`.)" msgstr "" #: ../../whatsnew/3.5.rst:1117 @@ -1785,10 +1786,10 @@ msgstr "faulthandler" #: ../../whatsnew/3.5.rst:1140 msgid "" -"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:" -"`~faulthandler.dump_traceback` and :func:`~faulthandler." -"dump_traceback_later` functions now accept file descriptors in addition to " -"file-like objects. (Contributed by Wei Wu in :issue:`23566`.)" +"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:`~faulthandler.dump_traceback` " +"and :func:`~faulthandler.dump_traceback_later` functions now accept file " +"descriptors in addition to file-like objects. (Contributed by Wei Wu " +"in :issue:`23566`.)" msgstr "" #: ../../whatsnew/3.5.rst:1148 @@ -1820,8 +1821,8 @@ msgstr "gzip" #: ../../whatsnew/3.5.rst:1168 msgid "" "The *mode* argument of the :class:`~gzip.GzipFile` constructor now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney in :" -"issue:`19222`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney " +"in :issue:`19222`.)" msgstr "" #: ../../whatsnew/3.5.rst:1174 @@ -1875,10 +1876,11 @@ msgstr "http.client" #: ../../whatsnew/3.5.rst:1203 msgid "" -":meth:`HTTPConnection.getresponse() <http.client.HTTPConnection." -"getresponse>` now raises a :exc:`~http.client.RemoteDisconnected` exception " -"when a remote server connection is closed unexpectedly. Additionally, if a :" -"exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " +":meth:`HTTPConnection.getresponse() " +"<http.client.HTTPConnection.getresponse>` now raises " +"a :exc:`~http.client.RemoteDisconnected` exception when a remote server " +"connection is closed unexpectedly. Additionally, if " +"a :exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " "raised, the client socket is now closed automatically, and will reconnect on " "the next request::" msgstr "" @@ -1914,10 +1916,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1225 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :" -"file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0, as " -"well as changes made in future 3.5.x releases. This file is also available " -"from the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.4.0, as well as changes made in future 3.5.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.5.rst:1233 @@ -1934,12 +1936,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:1240 msgid "" -"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) and :" -"rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() <imaplib.IMAP4." -"enable>` method. A new :attr:`IMAP4.utf8_enabled <imaplib.IMAP4." -"utf8_enabled>` attribute tracks whether or not :rfc:`6855` support is " -"enabled. (Contributed by Milan Oberkirch, R. David Murray, and Maciej Szulik " -"in :issue:`21800`.)" +"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) " +"and :rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() " +"<imaplib.IMAP4.enable>` method. A new :attr:`IMAP4.utf8_enabled " +"<imaplib.IMAP4.utf8_enabled>` attribute tracks whether or not :rfc:`6855` " +"support is enabled. (Contributed by Milan Oberkirch, R. David Murray, and " +"Maciej Szulik in :issue:`21800`.)" msgstr "" #: ../../whatsnew/3.5.rst:1247 @@ -1955,10 +1957,10 @@ msgstr "imghdr" #: ../../whatsnew/3.5.rst:1255 msgid "" -"The :func:`!what` function now recognizes the `OpenEXR <https://www.openexr." -"com>`_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" -"`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format " -"(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" +"The :func:`!what` function now recognizes the `OpenEXR <https://" +"www.openexr.com>`_ format (contributed by Martin Vignali and Claudiu Popa " +"in :issue:`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ " +"format (contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" #: ../../whatsnew/3.5.rst:1263 @@ -1974,11 +1976,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:1269 msgid "" -"The :func:`abc.InspectLoader.source_to_code() <importlib.abc.InspectLoader." -"source_to_code>` method is now a static method. This makes it easier to " -"initialize a module object with code compiled from a string by running " -"``exec(code, module.__dict__)``. (Contributed by Brett Cannon in :issue:" -"`21156`.)" +"The :func:`abc.InspectLoader.source_to_code() " +"<importlib.abc.InspectLoader.source_to_code>` method is now a static " +"method. This makes it easier to initialize a module object with code " +"compiled from a string by running ``exec(code, module.__dict__)``. " +"(Contributed by Brett Cannon in :issue:`21156`.)" msgstr "" #: ../../whatsnew/3.5.rst:1275 @@ -1997,15 +1999,15 @@ msgstr "inspect" #: ../../whatsnew/3.5.rst:1285 msgid "" "Both the :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes " -"are now picklable and hashable. (Contributed by Yury Selivanov in :issue:" -"`20726` and :issue:`20334`.)" +"are now picklable and hashable. (Contributed by Yury Selivanov " +"in :issue:`20726` and :issue:`20334`.)" msgstr "" #: ../../whatsnew/3.5.rst:1289 msgid "" -"A new :meth:`BoundArguments.apply_defaults() <inspect.BoundArguments." -"apply_defaults>` method provides a way to set default values for missing " -"arguments::" +"A new :meth:`BoundArguments.apply_defaults() " +"<inspect.BoundArguments.apply_defaults>` method provides a way to set " +"default values for missing arguments::" msgstr "" #: ../../whatsnew/3.5.rst:1293 @@ -2028,34 +2030,34 @@ msgstr "(由 Yury Selivanov 在 :issue:`24190` 中貢獻。)" #: ../../whatsnew/3.5.rst:1301 msgid "" -"A new class method :meth:`Signature.from_callable() <inspect.Signature." -"from_callable>` makes subclassing of :class:`~inspect.Signature` easier. " -"(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" +"A new class method :meth:`Signature.from_callable() " +"<inspect.Signature.from_callable>` makes subclassing " +"of :class:`~inspect.Signature` easier. (Contributed by Yury Selivanov and " +"Eric Snow in :issue:`17373`.)" msgstr "" #: ../../whatsnew/3.5.rst:1306 msgid "" "The :func:`~inspect.signature` function now accepts a *follow_wrapped* " "optional keyword argument, which, when set to ``False``, disables automatic " -"following of ``__wrapped__`` links. (Contributed by Yury Selivanov in :issue:" -"`20691`.)" +"following of ``__wrapped__`` links. (Contributed by Yury Selivanov " +"in :issue:`20691`.)" msgstr "" #: ../../whatsnew/3.5.rst:1311 msgid "" "A set of new functions to inspect :term:`coroutine functions <coroutine " -"function>` and :term:`coroutine objects <coroutine>` has been added: :func:" -"`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:" -"`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, and :func:" -"`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov in :issue:" -"`24017` and :issue:`24400`.)" +"function>` and :term:`coroutine objects <coroutine>` has been " +"added: :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, " +"and :func:`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov " +"in :issue:`24017` and :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1319 msgid "" -"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect." -"getouterframes`, and :func:`~inspect.getinnerframes` functions now return a " -"list of named tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" +"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect.getouterframes`, " +"and :func:`~inspect.getinnerframes` functions now return a list of named " +"tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" msgstr "" #: ../../whatsnew/3.5.rst:1326 @@ -2065,10 +2067,10 @@ msgstr "io" #: ../../whatsnew/3.5.rst:1328 msgid "" "A new :meth:`BufferedIOBase.readinto1() <io.BufferedIOBase.readinto1>` " -"method, that uses at most one call to the underlying raw stream's :meth:" -"`RawIOBase.read() <io.RawIOBase.read>` or :meth:`RawIOBase.readinto() <io." -"RawIOBase.readinto>` methods. (Contributed by Nikolaus Rath in :issue:" -"`20578`.)" +"method, that uses at most one call to the underlying raw " +"stream's :meth:`RawIOBase.read() <io.RawIOBase.read>` " +"or :meth:`RawIOBase.readinto() <io.RawIOBase.readinto>` methods. " +"(Contributed by Nikolaus Rath in :issue:`20578`.)" msgstr "" #: ../../whatsnew/3.5.rst:1336 @@ -2102,9 +2104,9 @@ msgstr "(由 Peter Moody 和 Antoine Pitrou 在 :issue:`16531` 中貢獻。) #: ../../whatsnew/3.5.rst:1350 msgid "" -"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for the :" -"class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` classes " -"returns the name of the reverse DNS PTR record::" +"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for " +"the :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` " +"classes returns the name of the reverse DNS PTR record::" msgstr "" #: ../../whatsnew/3.5.rst:1354 @@ -2137,14 +2139,14 @@ msgstr "json" msgid "" "The :mod:`json.tool` command line interface now preserves the order of keys " "in JSON objects passed in input. The new ``--sort-keys`` option can be used " -"to sort the keys alphabetically. (Contributed by Berker Peksag in :issue:" -"`21650`.)" +"to sort the keys alphabetically. (Contributed by Berker Peksag " +"in :issue:`21650`.)" msgstr "" #: ../../whatsnew/3.5.rst:1373 msgid "" -"JSON decoder now raises :exc:`~json.JSONDecodeError` instead of :exc:" -"`ValueError` to provide better context information about the error. " +"JSON decoder now raises :exc:`~json.JSONDecodeError` instead " +"of :exc:`ValueError` to provide better context information about the error. " "(Contributed by Serhiy Storchaka in :issue:`19361`.)" msgstr "" @@ -2204,10 +2206,10 @@ msgstr "logging" #: ../../whatsnew/3.5.rst:1410 msgid "" -"All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, :" -"meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:" -"`~logging.Logger.debug`, etc.), now accept exception instances as an " -"*exc_info* argument, in addition to boolean values and exception tuples::" +"All logging methods " +"(:class:`~logging.Logger` :meth:`~logging.Logger.log`, :meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:`~logging.Logger.debug`, " +"etc.), now accept exception instances as an *exc_info* argument, in addition " +"to boolean values and exception tuples::" msgstr "" #: ../../whatsnew/3.5.rst:1416 @@ -2234,8 +2236,8 @@ msgstr "(由 Yury Selivanov 在 :issue:`20537` 中貢獻。)" msgid "" "The :class:`handlers.HTTPHandler <logging.handlers.HTTPHandler>` class now " "accepts an optional :class:`ssl.SSLContext` instance to configure SSL " -"settings used in an HTTP connection. (Contributed by Alex Gaynor in :issue:" -"`22788`.)" +"settings used in an HTTP connection. (Contributed by Alex Gaynor " +"in :issue:`22788`.)" msgstr "" #: ../../whatsnew/3.5.rst:1430 @@ -2263,9 +2265,9 @@ msgstr "math" #: ../../whatsnew/3.5.rst:1448 msgid "" -"Two new constants have been added to the :mod:`math` module: :data:`~math." -"inf` and :data:`~math.nan`. (Contributed by Mark Dickinson in :issue:" -"`23185`.)" +"Two new constants have been added to the :mod:`math` " +"module: :data:`~math.inf` and :data:`~math.nan`. (Contributed by Mark " +"Dickinson in :issue:`23185`.)" msgstr "" #: ../../whatsnew/3.5.rst:1451 @@ -2287,9 +2289,10 @@ msgstr "multiprocessing" #: ../../whatsnew/3.5.rst:1462 msgid "" -":func:`sharedctypes.synchronized() <multiprocessing.sharedctypes." -"synchronized>` objects now support the :term:`context manager` protocol. " -"(Contributed by Charles-François Natali in :issue:`21565`.)" +":func:`sharedctypes.synchronized() " +"<multiprocessing.sharedctypes.synchronized>` objects now support " +"the :term:`context manager` protocol. (Contributed by Charles-François " +"Natali in :issue:`21565`.)" msgstr "" #: ../../whatsnew/3.5.rst:1468 @@ -2298,16 +2301,16 @@ msgstr "operator" #: ../../whatsnew/3.5.rst:1470 msgid "" -":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and :func:" -"`~operator.methodcaller` objects now support pickling. (Contributed by Josh " -"Rosenberg and Serhiy Storchaka in :issue:`22955`.)" +":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, " +"and :func:`~operator.methodcaller` objects now support pickling. " +"(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)" msgstr "" #: ../../whatsnew/3.5.rst:1474 msgid "" "New :func:`~operator.matmul` and :func:`~operator.imatmul` functions to " -"perform matrix multiplication. (Contributed by Benjamin Peterson in :issue:" -"`21176`.)" +"perform matrix multiplication. (Contributed by Benjamin Peterson " +"in :issue:`21176`.)" msgstr "" #: ../../whatsnew/3.5.rst:1480 @@ -2316,21 +2319,22 @@ msgstr "os" #: ../../whatsnew/3.5.rst:1482 msgid "" -"The new :func:`~os.scandir` function returning an iterator of :class:`~os." -"DirEntry` objects has been added. If possible, :func:`~os.scandir` extracts " -"file attributes while scanning a directory, removing the need to perform " -"subsequent system calls to determine file type or attributes, which may " -"significantly improve performance. (Contributed by Ben Hoyt with the help " -"of Victor Stinner in :issue:`22524`.)" +"The new :func:`~os.scandir` function returning an iterator " +"of :class:`~os.DirEntry` objects has been added. If " +"possible, :func:`~os.scandir` extracts file attributes while scanning a " +"directory, removing the need to perform subsequent system calls to determine " +"file type or attributes, which may significantly improve performance. " +"(Contributed by Ben Hoyt with the help of Victor Stinner in :issue:`22524`.)" msgstr "" #: ../../whatsnew/3.5.rst:1489 msgid "" -"On Windows, a new :attr:`stat_result.st_file_attributes <os.stat_result." -"st_file_attributes>` attribute is now available. It corresponds to the " -"``dwFileAttributes`` member of the ``BY_HANDLE_FILE_INFORMATION`` structure " -"returned by ``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :" -"issue:`21719`.)" +"On Windows, a new :attr:`stat_result.st_file_attributes " +"<os.stat_result.st_file_attributes>` attribute is now available. It " +"corresponds to the ``dwFileAttributes`` member of the " +"``BY_HANDLE_FILE_INFORMATION`` structure returned by " +"``GetFileInformationByHandle()``. (Contributed by Ben Hoyt " +"in :issue:`21719`.)" msgstr "" #: ../../whatsnew/3.5.rst:1495 @@ -2344,8 +2348,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1500 msgid "" "New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow " -"getting and setting a file descriptor's blocking mode (:const:`~os." -"O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" +"getting and setting a file descriptor's blocking mode " +"(:const:`~os.O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" msgstr "" #: ../../whatsnew/3.5.rst:1504 @@ -2357,8 +2361,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1507 msgid "" "There is a new :func:`os.path.commonpath` function returning the longest " -"common sub-path of each passed pathname. Unlike the :func:`os.path." -"commonprefix` function, it always returns a valid path::" +"common sub-path of each passed pathname. Unlike " +"the :func:`os.path.commonprefix` function, it always returns a valid path::" msgstr "" #: ../../whatsnew/3.5.rst:1512 @@ -2426,16 +2430,18 @@ msgstr "" msgid "" "A new :meth:`Path.home() <pathlib.Path.home>` class method can be used to " "get a :class:`~pathlib.Path` instance representing the user’s home " -"directory. (Contributed by Victor Salgado and Mayank Tripathi in :issue:" -"`19777`.)" +"directory. (Contributed by Victor Salgado and Mayank Tripathi " +"in :issue:`19777`.)" msgstr "" #: ../../whatsnew/3.5.rst:1549 msgid "" -"New :meth:`Path.write_text() <pathlib.Path.write_text>`, :meth:`Path." -"read_text() <pathlib.Path.read_text>`, :meth:`Path.write_bytes() <pathlib." -"Path.write_bytes>`, :meth:`Path.read_bytes() <pathlib.Path.read_bytes>` " -"methods to simplify read/write operations on files." +"New :meth:`Path.write_text() " +"<pathlib.Path.write_text>`, :meth:`Path.read_text() " +"<pathlib.Path.read_text>`, :meth:`Path.write_bytes() " +"<pathlib.Path.write_bytes>`, :meth:`Path.read_bytes() " +"<pathlib.Path.read_bytes>` methods to simplify read/write operations on " +"files." msgstr "" #: ../../whatsnew/3.5.rst:1555 @@ -2528,10 +2534,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1605 msgid "" -"The :class:`re.error` exceptions have new attributes, :attr:`~re.error." -"msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error." -"lineno`, and :attr:`~re.error.colno`, that provide better context " -"information about the error::" +"The :class:`re.error` exceptions have new " +"attributes, :attr:`~re.error.msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error.lineno`, " +"and :attr:`~re.error.colno`, that provide better context information about " +"the error::" msgstr "" #: ../../whatsnew/3.5.rst:1611 @@ -2631,9 +2637,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1677 msgid "" -"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension (:" -"rfc:`6152`) if *decode_data* has been set ``True``. If the client specifies " -"``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" +"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension " +"(:rfc:`6152`) if *decode_data* has been set ``True``. If the client " +"specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" "SMTPServer.process_message` via the *mail_options* keyword. (Contributed by " "Milan Oberkirch and R. David Murray in :issue:`21795`.)" msgstr "" @@ -2670,16 +2676,16 @@ msgstr "" msgid "" "The :meth:`SMTP.set_debuglevel() <smtplib.SMTP.set_debuglevel>` method now " "accepts an additional debuglevel (2), which enables timestamps in debug " -"messages. (Contributed by Gavin Chappell and Maciej Szulik in :issue:" -"`16914`.)" +"messages. (Contributed by Gavin Chappell and Maciej Szulik " +"in :issue:`16914`.)" msgstr "" #: ../../whatsnew/3.5.rst:1708 msgid "" -"Both the :meth:`SMTP.sendmail() <smtplib.SMTP.sendmail>` and :meth:`SMTP." -"send_message() <smtplib.SMTP.send_message>` methods now support :rfc:`6531` " -"(SMTPUTF8). (Contributed by Milan Oberkirch and R. David Murray in :issue:" -"`22027`.)" +"Both the :meth:`SMTP.sendmail() <smtplib.SMTP.sendmail>` " +"and :meth:`SMTP.send_message() <smtplib.SMTP.send_message>` methods now " +"support :rfc:`6531` (SMTPUTF8). (Contributed by Milan Oberkirch and R. David " +"Murray in :issue:`22027`.)" msgstr "" #: ../../whatsnew/3.5.rst:1715 @@ -2688,8 +2694,9 @@ msgstr "sndhdr" #: ../../whatsnew/3.5.rst:1717 msgid "" -"The :func:`!what` and :func:`!whathdr` functions now return a :func:" -"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return " +"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa " +"in :issue:`18615`.)" msgstr "" #: ../../whatsnew/3.5.rst:1723 @@ -2705,10 +2712,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1728 msgid "" "A new :meth:`socket.sendfile() <socket.socket.sendfile>` method allows " -"sending a file over a socket by using the high-performance :func:`os." -"sendfile` function on UNIX, resulting in uploads being from 2 to 3 times " -"faster than when using plain :meth:`socket.send() <socket.socket.send>`. " -"(Contributed by Giampaolo Rodola' in :issue:`17552`.)" +"sending a file over a socket by using the high-" +"performance :func:`os.sendfile` function on UNIX, resulting in uploads being " +"from 2 to 3 times faster than when using plain :meth:`socket.send() " +"<socket.socket.send>`. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1734 @@ -2722,9 +2729,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1739 msgid "" "The *backlog* argument of the :meth:`socket.listen() <socket.socket.listen>` " -"method is now optional. By default it is set to :data:`SOMAXCONN <socket." -"SOMAXCONN>` or to ``128``, whichever is less. (Contributed by Charles-" -"François Natali in :issue:`21455`.)" +"method is now optional. By default it is set to :data:`SOMAXCONN " +"<socket.SOMAXCONN>` or to ``128``, whichever is less. (Contributed by " +"Charles-François Natali in :issue:`21455`.)" msgstr "" #: ../../whatsnew/3.5.rst:1746 @@ -2742,11 +2749,12 @@ msgstr "(由 Geert Jansen 在 :issue:`21965` 中貢獻。)" #: ../../whatsnew/3.5.rst:1755 msgid "" "The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol " -"support for cases when the network I/O capabilities of :class:`~ssl." -"SSLSocket` are not necessary or are suboptimal. ``SSLObject`` represents an " -"SSL protocol instance, but does not implement any network I/O methods, and " -"instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO` " -"class can be used to pass data between Python and an SSL protocol instance." +"support for cases when the network I/O capabilities " +"of :class:`~ssl.SSLSocket` are not necessary or are suboptimal. " +"``SSLObject`` represents an SSL protocol instance, but does not implement " +"any network I/O methods, and instead provides a memory buffer interface. " +"The new :class:`~ssl.MemoryBIO` class can be used to pass data between " +"Python and an SSL protocol instance." msgstr "" #: ../../whatsnew/3.5.rst:1762 @@ -2773,23 +2781,23 @@ msgstr "(由 Benjamin Peterson 在 :issue:`20188` 中貢獻。)" #: ../../whatsnew/3.5.rst:1775 msgid "" "Where OpenSSL support is present, the :mod:`ssl` module now implements the " -"*Application-Layer Protocol Negotiation* TLS extension as described in :rfc:" -"`7301`." +"*Application-Layer Protocol Negotiation* TLS extension as described " +"in :rfc:`7301`." msgstr "" #: ../../whatsnew/3.5.rst:1779 msgid "" -"The new :meth:`SSLContext.set_alpn_protocols() <ssl.SSLContext." -"set_alpn_protocols>` can be used to specify which protocols a socket should " -"advertise during the TLS handshake." +"The new :meth:`SSLContext.set_alpn_protocols() " +"<ssl.SSLContext.set_alpn_protocols>` can be used to specify which protocols " +"a socket should advertise during the TLS handshake." msgstr "" #: ../../whatsnew/3.5.rst:1783 msgid "" -"The new :meth:`SSLSocket.selected_alpn_protocol() <ssl.SSLSocket." -"selected_alpn_protocol>` returns the protocol that was selected during the " -"TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates whether ALPN " -"support is present." +"The new :meth:`SSLSocket.selected_alpn_protocol() " +"<ssl.SSLSocket.selected_alpn_protocol>` returns the protocol that was " +"selected during the TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates " +"whether ALPN support is present." msgstr "" #: ../../whatsnew/3.5.rst:1790 @@ -2799,15 +2807,15 @@ msgstr "" #: ../../whatsnew/3.5.rst:1792 msgid "" "There is a new :meth:`SSLSocket.version() <ssl.SSLSocket.version>` method to " -"query the actual protocol version in use. (Contributed by Antoine Pitrou in :" -"issue:`20421`.)" +"query the actual protocol version in use. (Contributed by Antoine Pitrou " +"in :issue:`20421`.)" msgstr "" #: ../../whatsnew/3.5.rst:1796 msgid "" -"The :class:`~ssl.SSLSocket` class now implements a :meth:`SSLSocket." -"sendfile() <ssl.SSLSocket.sendfile>` method. (Contributed by Giampaolo " -"Rodola' in :issue:`17552`.)" +"The :class:`~ssl.SSLSocket` class now implements " +"a :meth:`SSLSocket.sendfile() <ssl.SSLSocket.sendfile>` method. (Contributed " +"by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1800 @@ -2827,21 +2835,22 @@ msgstr "" #: ../../whatsnew/3.5.rst:1809 msgid "" -"New :meth:`SSLObject.shared_ciphers() <ssl.SSLObject.shared_ciphers>` and :" -"meth:`SSLSocket.shared_ciphers() <ssl.SSLSocket.shared_ciphers>` methods " -"return the list of ciphers sent by the client during the handshake. " +"New :meth:`SSLObject.shared_ciphers() <ssl.SSLObject.shared_ciphers>` " +"and :meth:`SSLSocket.shared_ciphers() <ssl.SSLSocket.shared_ciphers>` " +"methods return the list of ciphers sent by the client during the handshake. " "(Contributed by Benjamin Peterson in :issue:`23186`.)" msgstr "" #: ../../whatsnew/3.5.rst:1814 msgid "" -"The :meth:`SSLSocket.do_handshake() <ssl.SSLSocket.do_handshake>`, :meth:" -"`SSLSocket.read() <ssl.SSLSocket.read>`, :meth:`SSLSocket.shutdown() <ssl." -"SSLSocket.shutdown>`, and :meth:`SSLSocket.write() <ssl.SSLSocket.write>` " -"methods of the :class:`~ssl.SSLSocket` class no longer reset the socket " -"timeout every time bytes are received or sent. The socket timeout is now the " -"maximum total duration of the method. (Contributed by Victor Stinner in :" -"issue:`23853`.)" +"The :meth:`SSLSocket.do_handshake() " +"<ssl.SSLSocket.do_handshake>`, :meth:`SSLSocket.read() " +"<ssl.SSLSocket.read>`, :meth:`SSLSocket.shutdown() " +"<ssl.SSLSocket.shutdown>`, and :meth:`SSLSocket.write() " +"<ssl.SSLSocket.write>` methods of the :class:`~ssl.SSLSocket` class no " +"longer reset the socket timeout every time bytes are received or sent. The " +"socket timeout is now the maximum total duration of the method. (Contributed " +"by Victor Stinner in :issue:`23853`.)" msgstr "" #: ../../whatsnew/3.5.rst:1822 @@ -2912,10 +2921,11 @@ msgstr "sys" msgid "" "A new :func:`~sys.set_coroutine_wrapper` function allows setting a global " "hook that will be called whenever a :term:`coroutine object <coroutine>` is " -"created by an :keyword:`async def` function. A corresponding :func:`~sys." -"get_coroutine_wrapper` can be used to obtain a currently set wrapper. Both " -"functions are :term:`provisional <provisional API>`, and are intended for " -"debugging purposes only. (Contributed by Yury Selivanov in :issue:`24017`.)" +"created by an :keyword:`async def` function. A " +"corresponding :func:`~sys.get_coroutine_wrapper` can be used to obtain a " +"currently set wrapper. Both functions are :term:`provisional <provisional " +"API>`, and are intended for debugging purposes only. (Contributed by Yury " +"Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1874 @@ -2932,8 +2942,8 @@ msgstr "sysconfig" #: ../../whatsnew/3.5.rst:1882 msgid "" "The name of the user scripts directory on Windows now includes the first two " -"components of the Python version. (Contributed by Paul Moore in :issue:" -"`23437`.)" +"components of the Python version. (Contributed by Paul Moore " +"in :issue:`23437`.)" msgstr "" #: ../../whatsnew/3.5.rst:1888 @@ -2943,16 +2953,16 @@ msgstr "tarfile" #: ../../whatsnew/3.5.rst:1890 msgid "" "The *mode* argument of the :func:`~tarfile.open` function now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag in :" -"issue:`21717`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag " +"in :issue:`21717`.)" msgstr "" #: ../../whatsnew/3.5.rst:1893 msgid "" -"The :meth:`TarFile.extractall() <tarfile.TarFile.extractall>` and :meth:" -"`TarFile.extract() <tarfile.TarFile.extract>` methods now take a keyword " -"argument *numeric_owner*. If set to ``True``, the extracted files and " -"directories will be owned by the numeric ``uid`` and ``gid`` from the " +"The :meth:`TarFile.extractall() <tarfile.TarFile.extractall>` " +"and :meth:`TarFile.extract() <tarfile.TarFile.extract>` methods now take a " +"keyword argument *numeric_owner*. If set to ``True``, the extracted files " +"and directories will be owned by the numeric ``uid`` and ``gid`` from the " "tarfile. If set to ``False`` (the default, and the behavior in versions " "prior to 3.5), they will be owned by the named user and group in the " "tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" @@ -2972,9 +2982,10 @@ msgstr "threading" #: ../../whatsnew/3.5.rst:1910 msgid "" -"Both the :meth:`Lock.acquire() <threading.Lock.acquire>` and :meth:`RLock." -"acquire() <threading.RLock.acquire>` methods now use a monotonic clock for " -"timeout management. (Contributed by Victor Stinner in :issue:`22043`.)" +"Both the :meth:`Lock.acquire() <threading.Lock.acquire>` " +"and :meth:`RLock.acquire() <threading.RLock.acquire>` methods now use a " +"monotonic clock for timeout management. (Contributed by Victor Stinner " +"in :issue:`22043`.)" msgstr "" #: ../../whatsnew/3.5.rst:1917 @@ -3030,9 +3041,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1954 msgid "" -"New lightweight classes: :class:`~traceback.TracebackException`, :class:" -"`~traceback.StackSummary`, and :class:`~traceback.FrameSummary`. " -"(Contributed by Robert Collins in :issue:`17911`.)" +"New lightweight " +"classes: :class:`~traceback.TracebackException`, :class:`~traceback.StackSummary`, " +"and :class:`~traceback.FrameSummary`. (Contributed by Robert Collins " +"in :issue:`17911`.)" msgstr "" #: ../../whatsnew/3.5.rst:1958 @@ -3049,16 +3061,16 @@ msgstr "types" #: ../../whatsnew/3.5.rst:1966 msgid "" "A new :func:`~types.coroutine` function to transform :term:`generator " -"<generator iterator>` and :class:`generator-like <collections.abc." -"Generator>` objects into :term:`awaitables <awaitable>`. (Contributed by " -"Yury Selivanov in :issue:`24017`.)" +"<generator iterator>` and :class:`generator-like " +"<collections.abc.Generator>` objects into :term:`awaitables <awaitable>`. " +"(Contributed by Yury Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1972 msgid "" -"A new type called :class:`~types.CoroutineType`, which is used for :term:" -"`coroutine` objects created by :keyword:`async def` functions. (Contributed " -"by Yury Selivanov in :issue:`24400`.)" +"A new type called :class:`~types.CoroutineType`, which is used " +"for :term:`coroutine` objects created by :keyword:`async def` functions. " +"(Contributed by Yury Selivanov in :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1978 @@ -3077,13 +3089,13 @@ msgstr "unittest" #: ../../whatsnew/3.5.rst:1987 msgid "" -"The :meth:`TestLoader.loadTestsFromModule() <unittest.TestLoader." -"loadTestsFromModule>` method now accepts a keyword-only argument *pattern* " -"which is passed to ``load_tests`` as the third argument. Found packages are " -"now checked for ``load_tests`` regardless of whether their path matches " -"*pattern*, because it is impossible for a package name to match the default " -"pattern. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The :meth:`TestLoader.loadTestsFromModule() " +"<unittest.TestLoader.loadTestsFromModule>` method now accepts a keyword-only " +"argument *pattern* which is passed to ``load_tests`` as the third argument. " +"Found packages are now checked for ``load_tests`` regardless of whether " +"their path matches *pattern*, because it is impossible for a package name to " +"match the default pattern. (Contributed by Robert Collins and Barry A. " +"Warsaw in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:1994 @@ -3116,24 +3128,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:2013 msgid "" -"A new :meth:`Mock.assert_not_called() <unittest.mock.Mock." -"assert_not_called>` method to check if the mock object was called. " -"(Contributed by Kushal Das in :issue:`21262`.)" +"A new :meth:`Mock.assert_not_called() " +"<unittest.mock.Mock.assert_not_called>` method to check if the mock object " +"was called. (Contributed by Kushal Das in :issue:`21262`.)" msgstr "" #: ../../whatsnew/3.5.rst:2017 msgid "" -"The :class:`~unittest.mock.MagicMock` class now supports :meth:" -"`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` operators. " -"(Contributed by Johannes Baiter in :issue:`20968`, and Håkan Lövdahl in :" -"issue:`23581` and :issue:`23568`.)" +"The :class:`~unittest.mock.MagicMock` class now " +"supports :meth:`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` " +"operators. (Contributed by Johannes Baiter in :issue:`20968`, and Håkan " +"Lövdahl in :issue:`23581` and :issue:`23568`.)" msgstr "" #: ../../whatsnew/3.5.rst:2022 msgid "" -"It is no longer necessary to explicitly pass ``create=True`` to the :func:" -"`~unittest.mock.patch` function when patching builtin names. (Contributed by " -"Kushal Das in :issue:`17660`.)" +"It is no longer necessary to explicitly pass ``create=True`` to " +"the :func:`~unittest.mock.patch` function when patching builtin names. " +"(Contributed by Kushal Das in :issue:`17660`.)" msgstr "" #: ../../whatsnew/3.5.rst:2028 @@ -3142,35 +3154,38 @@ msgstr "urllib" #: ../../whatsnew/3.5.rst:2030 msgid "" -"A new :class:`request.HTTPPasswordMgrWithPriorAuth <urllib.request." -"HTTPPasswordMgrWithPriorAuth>` class allows HTTP Basic Authentication " -"credentials to be managed so as to eliminate unnecessary ``401`` response " -"handling, or to unconditionally send credentials on the first request in " -"order to communicate with servers that return a ``404`` response instead of " -"a ``401`` if the ``Authorization`` header is not sent. (Contributed by Matej " -"Cepl in :issue:`19494` and Akshit Khurana in :issue:`7159`.)" +"A new :class:`request.HTTPPasswordMgrWithPriorAuth " +"<urllib.request.HTTPPasswordMgrWithPriorAuth>` class allows HTTP Basic " +"Authentication credentials to be managed so as to eliminate unnecessary " +"``401`` response handling, or to unconditionally send credentials on the " +"first request in order to communicate with servers that return a ``404`` " +"response instead of a ``401`` if the ``Authorization`` header is not sent. " +"(Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana " +"in :issue:`7159`.)" msgstr "" #: ../../whatsnew/3.5.rst:2039 msgid "" -"A new *quote_via* argument for the :func:`parse.urlencode() <urllib.parse." -"urlencode>` function provides a way to control the encoding of query parts " -"if needed. (Contributed by Samwyse and Arnon Yaari in :issue:`13866`.)" +"A new *quote_via* argument for the :func:`parse.urlencode() " +"<urllib.parse.urlencode>` function provides a way to control the encoding of " +"query parts if needed. (Contributed by Samwyse and Arnon Yaari " +"in :issue:`13866`.)" msgstr "" #: ../../whatsnew/3.5.rst:2044 msgid "" -"The :func:`request.urlopen() <urllib.request.urlopen>` function accepts an :" -"class:`ssl.SSLContext` object as a *context* argument, which will be used " -"for the HTTPS connection. (Contributed by Alex Gaynor in :issue:`22366`.)" +"The :func:`request.urlopen() <urllib.request.urlopen>` function accepts " +"an :class:`ssl.SSLContext` object as a *context* argument, which will be " +"used for the HTTPS connection. (Contributed by Alex Gaynor " +"in :issue:`22366`.)" msgstr "" #: ../../whatsnew/3.5.rst:2048 msgid "" -"The :func:`parse.urljoin() <urllib.parse.urljoin>` was updated to use the :" -"rfc:`3986` semantics for the resolution of relative URLs, rather than :rfc:" -"`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil Kumaran " -"in :issue:`22118`.)" +"The :func:`parse.urljoin() <urllib.parse.urljoin>` was updated to use " +"the :rfc:`3986` semantics for the resolution of relative URLs, rather " +"than :rfc:`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil " +"Kumaran in :issue:`22118`.)" msgstr "" #: ../../whatsnew/3.5.rst:2055 @@ -3179,9 +3194,9 @@ msgstr "wsgiref" #: ../../whatsnew/3.5.rst:2057 msgid "" -"The *headers* argument of the :class:`headers.Headers <wsgiref.headers." -"Headers>` class constructor is now optional. (Contributed by Pablo Torres " -"Navarrete and SilentGhost in :issue:`5800`.)" +"The *headers* argument of the :class:`headers.Headers " +"<wsgiref.headers.Headers>` class constructor is now optional. (Contributed " +"by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)" msgstr "" #: ../../whatsnew/3.5.rst:2063 @@ -3208,9 +3223,9 @@ msgstr "xml.sax" #: ../../whatsnew/3.5.rst:2077 msgid "" -"SAX parsers now support a character stream of the :class:`xmlreader." -"InputSource <xml.sax.xmlreader.InputSource>` object. (Contributed by Serhiy " -"Storchaka in :issue:`2175`.)" +"SAX parsers now support a character stream of " +"the :class:`xmlreader.InputSource <xml.sax.xmlreader.InputSource>` object. " +"(Contributed by Serhiy Storchaka in :issue:`2175`.)" msgstr "" #: ../../whatsnew/3.5.rst:2081 @@ -3242,10 +3257,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" -"`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " -"objects <bytes-like object>`. (Contributed by Serhiy Storchaka in :issue:" -"`23001`.)" +"Many functions in the :mod:`mmap`, :mod:`!" +"ossaudiodev`, :mod:`socket`, :mod:`ssl`, and :mod:`codecs` modules now " +"accept writable :term:`bytes-like objects <bytes-like object>`. (Contributed " +"by Serhiy Storchaka in :issue:`23001`.)" msgstr "" #: ../../whatsnew/3.5.rst:2106 @@ -3255,9 +3270,9 @@ msgstr "最佳化" #: ../../whatsnew/3.5.rst:2108 msgid "" "The :func:`os.walk` function has been sped up by 3 to 5 times on POSIX " -"systems, and by 7 to 20 times on Windows. This was done using the new :func:" -"`os.scandir` function, which exposes file information from the underlying " -"``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " +"systems, and by 7 to 20 times on Windows. This was done using the " +"new :func:`os.scandir` function, which exposes file information from the " +"underlying ``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " "(Contributed by Ben Hoyt with help from Victor Stinner in :issue:`23605`.)" msgstr "" @@ -3265,19 +3280,18 @@ msgstr "" msgid "" "Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses " "less memory for large objects. ``calloc()`` is used instead of ``malloc()`` " -"to allocate memory for these objects. (Contributed by Victor Stinner in :" -"issue:`21233`.)" +"to allocate memory for these objects. (Contributed by Victor Stinner " +"in :issue:`21233`.)" msgstr "" #: ../../whatsnew/3.5.rst:2119 msgid "" -"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and :" -"class:`~ipaddress.IPv6Network` have been massively sped up, such as :meth:" -"`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :" -"func:`~ipaddress.summarize_address_range`, :func:`~ipaddress." -"collapse_addresses`. The speed up can range from 3 to 15 times. (Contributed " -"by Antoine Pitrou, Michel Albert, and Markus in :issue:`21486`, :issue:" -"`21487`, :issue:`20826`, :issue:`23266`.)" +"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` " +"and :class:`~ipaddress.IPv6Network` have been massively sped up, such " +"as :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. " +"The speed up can range from 3 to 15 times. (Contributed by Antoine Pitrou, " +"Michel Albert, and Markus " +"in :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)" msgstr "" #: ../../whatsnew/3.5.rst:2127 @@ -3289,16 +3303,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2130 msgid "" "Many operations on :class:`io.BytesIO` are now 50% to 100% faster. " -"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in :" -"issue:`22003`.)" +"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson " +"in :issue:`22003`.)" msgstr "" #: ../../whatsnew/3.5.rst:2134 msgid "" "The :func:`marshal.dumps` function is now faster: 65--85% with versions 3 " "and 4, 20--25% with versions 0 to 2 on typical data, and up to 5 times in " -"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:" -"`23344`.)" +"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` " +"and :issue:`23344`.)" msgstr "" #: ../../whatsnew/3.5.rst:2139 @@ -3323,16 +3337,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2149 msgid "" "The :c:func:`PyObject_IsInstance` and :c:func:`PyObject_IsSubclass` " -"functions have been sped up in the common case that the second argument has :" -"class:`type` as its metaclass. (Contributed Georg Brandl by in :issue:" -"`22540`.)" +"functions have been sped up in the common case that the second argument " +"has :class:`type` as its metaclass. (Contributed Georg Brandl by " +"in :issue:`22540`.)" msgstr "" #: ../../whatsnew/3.5.rst:2154 msgid "" "Method caching was slightly improved, yielding up to 5% performance " -"improvement in some benchmarks. (Contributed by Antoine Pitrou in :issue:" -"`22847`.)" +"improvement in some benchmarks. (Contributed by Antoine Pitrou " +"in :issue:`22847`.)" msgstr "" #: ../../whatsnew/3.5.rst:2158 @@ -3355,15 +3369,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2167 msgid "" -"String methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :" -"meth:`~str.partition` and the :keyword:`in` string operator are now " -"significantly faster for searching 1-character substrings. (Contributed by " -"Serhiy Storchaka in :issue:`23573`.)" +"String " +"methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :meth:`~str.partition` " +"and the :keyword:`in` string operator are now significantly faster for " +"searching 1-character substrings. (Contributed by Serhiy Storchaka " +"in :issue:`23573`.)" msgstr "" #: ../../whatsnew/3.5.rst:2174 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.5.rst:2176 msgid "New ``calloc`` functions were added:" @@ -3391,11 +3406,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2186 msgid ":c:func:`Py_DecodeLocale` (replaced ``_Py_char2wchar()``)," -msgstr "" +msgstr ":c:func:`Py_DecodeLocale`\\ (取代 ``_Py_char2wchar()``)," #: ../../whatsnew/3.5.rst:2187 msgid ":c:func:`Py_EncodeLocale` (replaced ``_Py_wchar2char()``)." -msgstr "" +msgstr ":c:func:`Py_EncodeLocale`\\ (取代 ``_Py_wchar2char()``)。" #: ../../whatsnew/3.5.rst:2189 msgid "(Contributed by Victor Stinner in :issue:`18395`.)" @@ -3404,15 +3419,15 @@ msgstr "(由 Victor Stinner 在 :issue:`18395` 中貢獻。)" #: ../../whatsnew/3.5.rst:2191 msgid "" "A new :c:func:`PyCodec_NameReplaceErrors` function to replace the unicode " -"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka in :" -"issue:`19676`.)" +"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka " +"in :issue:`19676`.)" msgstr "" #: ../../whatsnew/3.5.rst:2195 msgid "" "A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`, " -"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou in :" -"issue:`18711`.)" +"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou " +"in :issue:`18711`.)" msgstr "" #: ../../whatsnew/3.5.rst:2199 @@ -3425,16 +3440,16 @@ msgstr "" msgid "" "New :c:func:`PyModule_FromDefAndSpec`, :c:func:`PyModule_FromDefAndSpec2`, " "and :c:func:`PyModule_ExecDef` functions introduced by :pep:`489` -- multi-" -"phase extension module initialization. (Contributed by Petr Viktorin in :" -"issue:`24268`.)" +"phase extension module initialization. (Contributed by Petr Viktorin " +"in :issue:`24268`.)" msgstr "" #: ../../whatsnew/3.5.rst:2207 msgid "" -"New :c:func:`PyNumber_MatrixMultiply` and :c:func:" -"`PyNumber_InPlaceMatrixMultiply` functions to perform matrix multiplication. " -"(Contributed by Benjamin Peterson in :issue:`21176`. See also :pep:`465` " -"for details.)" +"New :c:func:`PyNumber_MatrixMultiply` " +"and :c:func:`PyNumber_InPlaceMatrixMultiply` functions to perform matrix " +"multiplication. (Contributed by Benjamin Peterson in :issue:`21176`. See " +"also :pep:`465` for details.)" msgstr "" #: ../../whatsnew/3.5.rst:2213 @@ -3542,8 +3557,8 @@ msgstr "" msgid "" "Raising the :exc:`StopIteration` exception inside a generator will now " "generate a silent :exc:`PendingDeprecationWarning`, which will become a non-" -"silent deprecation warning in Python 3.6 and will trigger a :exc:" -"`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " +"silent deprecation warning in Python 3.6 and will trigger " +"a :exc:`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " "handling inside generators <whatsnew-pep-479>` for details." msgstr "" @@ -3569,8 +3584,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2296 msgid "" -"The :func:`asyncio.async` function is deprecated in favor of :func:`~asyncio." -"ensure_future`." +"The :func:`asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`." msgstr "" #: ../../whatsnew/3.5.rst:2299 @@ -3584,19 +3599,20 @@ msgstr "" #: ../../whatsnew/3.5.rst:2305 msgid "" -"Directly assigning values to the :attr:`~http.cookies.Morsel.key`, :attr:" -"`~http.cookies.Morsel.value` and :attr:`~http.cookies.Morsel.coded_value` " -"of :class:`http.cookies.Morsel` objects is deprecated. Use the :meth:`~http." -"cookies.Morsel.set` method instead. In addition, the undocumented " -"*LegalChars* parameter of :meth:`~http.cookies.Morsel.set` is deprecated, " -"and is now ignored." +"Directly assigning values to " +"the :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of :class:`http.cookies.Morsel` " +"objects is deprecated. Use the :meth:`~http.cookies.Morsel.set` method " +"instead. In addition, the undocumented *LegalChars* parameter " +"of :meth:`~http.cookies.Morsel.set` is deprecated, and is now ignored." msgstr "" #: ../../whatsnew/3.5.rst:2312 msgid "" -"Passing a format string as keyword argument *format_string* to the :meth:" -"`~string.Formatter.format` method of the :class:`string.Formatter` class has " -"been deprecated. (Contributed by Serhiy Storchaka in :issue:`23671`.)" +"Passing a format string as keyword argument *format_string* to " +"the :meth:`~string.Formatter.format` method of the :class:`string.Formatter` " +"class has been deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`23671`.)" msgstr "" #: ../../whatsnew/3.5.rst:2317 @@ -3610,9 +3626,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2322 msgid "" "The previously undocumented ``from_function`` and ``from_builtin`` methods " -"of :class:`inspect.Signature` are deprecated. Use the new :meth:`Signature." -"from_callable() <inspect.Signature.from_callable>` method instead. " -"(Contributed by Yury Selivanov in :issue:`24248`.)" +"of :class:`inspect.Signature` are deprecated. Use the " +"new :meth:`Signature.from_callable() <inspect.Signature.from_callable>` " +"method instead. (Contributed by Yury Selivanov in :issue:`24248`.)" msgstr "" #: ../../whatsnew/3.5.rst:2327 @@ -3623,9 +3639,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2330 msgid "" -"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect." -"getcallargs`, and :func:`~inspect.formatargspec` functions are deprecated in " -"favor of the :func:`inspect.signature` API. (Contributed by Yury Selivanov " +"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect.getcallargs`, " +"and :func:`~inspect.formatargspec` functions are deprecated in favor of " +"the :func:`inspect.signature` API. (Contributed by Yury Selivanov " "in :issue:`20438`.)" msgstr "" @@ -3651,10 +3667,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2346 msgid "" -"The undocumented and unofficial *use_load_tests* default argument of the :" -"meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated and " -"ignored. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The undocumented and unofficial *use_load_tests* default argument of " +"the :meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated " +"and ignored. (Contributed by Robert Collins and Barry A. Warsaw " +"in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:2353 @@ -3663,7 +3679,7 @@ msgstr "已移除" #: ../../whatsnew/3.5.rst:2356 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.5.rst:2358 msgid "" @@ -3707,7 +3723,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2384 msgid "Changes in Python behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.5.rst:2386 msgid "" @@ -3731,7 +3747,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2397 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.5.rst:2399 msgid "" @@ -3744,16 +3760,16 @@ msgstr "" msgid "" "Before Python 3.5, a :class:`datetime.time` object was considered to be " "false if it represented midnight in UTC. This behavior was considered " -"obscure and error-prone and has been removed in Python 3.5. See :issue:" -"`13936` for full details." +"obscure and error-prone and has been removed in Python 3.5. " +"See :issue:`13936` for full details." msgstr "" #: ../../whatsnew/3.5.rst:2408 msgid "" -"The :meth:`ssl.SSLSocket.send` method now raises either :exc:`ssl." -"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-blocking socket " -"if the operation would block. Previously, it would return ``0``. " -"(Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`ssl.SSLSocket.send` method now raises " +"either :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-" +"blocking socket if the operation would block. Previously, it would return " +"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:2413 @@ -3767,12 +3783,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2420 msgid "" -"The deprecated \"strict\" mode and argument of :class:`~html.parser." -"HTMLParser`, :meth:`!HTMLParser.error`, and the :exc:`!HTMLParserError` " -"exception have been removed. (Contributed by Ezio Melotti in :issue:" -"`15114`.) The *convert_charrefs* argument of :class:`~html.parser." -"HTMLParser` is now ``True`` by default. (Contributed by Berker Peksag in :" -"issue:`21047`.)" +"The deprecated \"strict\" mode and argument " +"of :class:`~html.parser.HTMLParser`, :meth:`!HTMLParser.error`, and " +"the :exc:`!HTMLParserError` exception have been removed. (Contributed by " +"Ezio Melotti in :issue:`15114`.) The *convert_charrefs* argument " +"of :class:`~html.parser.HTMLParser` is now ``True`` by default. " +"(Contributed by Berker Peksag in :issue:`21047`.)" msgstr "" #: ../../whatsnew/3.5.rst:2426 @@ -3786,11 +3802,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2432 msgid "" -"If the current directory is set to a directory that no longer exists then :" -"exc:`FileNotFoundError` will no longer be raised and instead :meth:" -"`~importlib.machinery.FileFinder.find_spec` will return ``None`` **without** " -"caching ``None`` in :data:`sys.path_importer_cache`, which is different than " -"the typical case (:issue:`22834`)." +"If the current directory is set to a directory that no longer exists " +"then :exc:`FileNotFoundError` will no longer be raised and " +"instead :meth:`~importlib.machinery.FileFinder.find_spec` will return " +"``None`` **without** caching ``None`` in :data:`sys.path_importer_cache`, " +"which is different than the typical case (:issue:`22834`)." msgstr "" #: ../../whatsnew/3.5.rst:2438 @@ -3804,12 +3820,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2443 msgid "" "When an import loader defines :meth:`importlib.machinery.Loader.exec_module` " -"it is now expected to also define :meth:`~importlib.machinery.Loader." -"create_module` (raises a :exc:`DeprecationWarning` now, will be an error in " -"Python 3.6). If the loader inherits from :class:`importlib.abc.Loader` then " -"there is nothing to do, else simply define :meth:`~importlib.machinery." -"Loader.create_module` to return ``None``. (Contributed by Brett Cannon in :" -"issue:`23014`.)" +"it is now expected to also " +"define :meth:`~importlib.machinery.Loader.create_module` (raises " +"a :exc:`DeprecationWarning` now, will be an error in Python 3.6). If the " +"loader inherits from :class:`importlib.abc.Loader` then there is nothing to " +"do, else simply define :meth:`~importlib.machinery.Loader.create_module` to " +"return ``None``. (Contributed by Brett Cannon in :issue:`23014`.)" msgstr "" #: ../../whatsnew/3.5.rst:2451 @@ -3826,28 +3842,29 @@ msgstr "" #: ../../whatsnew/3.5.rst:2459 msgid "" "The :class:`http.cookies.Morsel` dict-like interface has been made self " -"consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel." -"key` and :attr:`~http.cookies.Morsel.value` into account, :meth:`~http." -"cookies.Morsel.copy` now results in a :class:`~http.cookies.Morsel` instance " -"rather than a :class:`dict`, and :meth:`~http.cookies.Morsel.update` will " -"now raise an exception if any of the keys in the update dictionary are " -"invalid. In addition, the undocumented *LegalChars* parameter of :func:" -"`~http.cookies.Morsel.set` is deprecated and is now ignored. (Contributed " -"by Demian Brecht in :issue:`2211`.)" +"consistent: morsel comparison now takes " +"the :attr:`~http.cookies.Morsel.key` and :attr:`~http.cookies.Morsel.value` " +"into account, :meth:`~http.cookies.Morsel.copy` now results in " +"a :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, " +"and :meth:`~http.cookies.Morsel.update` will now raise an exception if any " +"of the keys in the update dictionary are invalid. In addition, the " +"undocumented *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is " +"deprecated and is now ignored. (Contributed by Demian Brecht " +"in :issue:`2211`.)" msgstr "" #: ../../whatsnew/3.5.rst:2469 msgid "" ":pep:`488` has removed ``.pyo`` files from Python and introduced the " -"optional ``opt-`` tag in ``.pyc`` file names. The :func:`importlib.util." -"cache_from_source` has gained an *optimization* parameter to help control " -"the ``opt-`` tag. Because of this, the *debug_override* parameter of the " -"function is now deprecated. ``.pyo`` files are also no longer supported as a " -"file argument to the Python interpreter and thus serve no purpose when " -"distributed on their own (i.e. sourceless code distribution). Due to the " -"fact that the magic number for bytecode has changed in Python 3.5, all old " -"``.pyo`` files from previous versions of Python are invalid regardless of " -"this PEP." +"optional ``opt-`` tag in ``.pyc`` file names. " +"The :func:`importlib.util.cache_from_source` has gained an *optimization* " +"parameter to help control the ``opt-`` tag. Because of this, the " +"*debug_override* parameter of the function is now deprecated. ``.pyo`` files " +"are also no longer supported as a file argument to the Python interpreter " +"and thus serve no purpose when distributed on their own (i.e. sourceless " +"code distribution). Due to the fact that the magic number for bytecode has " +"changed in Python 3.5, all old ``.pyo`` files from previous versions of " +"Python are invalid regardless of this PEP." msgstr "" #: ../../whatsnew/3.5.rst:2480 @@ -3891,16 +3908,17 @@ msgid "" "duplicated if the inherited documentation is appropriate. To suppress an " "inherited string, an empty string must be specified (or the documentation " "may be filled in). This change affects the output of the :mod:`pydoc` " -"module and the :func:`help` function. (Contributed by Serhiy Storchaka in :" -"issue:`15582`.)" +"module and the :func:`help` function. (Contributed by Serhiy Storchaka " +"in :issue:`15582`.)" msgstr "" #: ../../whatsnew/3.5.rst:2507 msgid "" "Nested :func:`functools.partial` calls are now flattened. If you were " -"relying on the previous behavior, you can now either add an attribute to a :" -"func:`functools.partial` object or you can create a subclass of :func:" -"`functools.partial`. (Contributed by Alexander Belopolsky in :issue:`7830`.)" +"relying on the previous behavior, you can now either add an attribute to " +"a :func:`functools.partial` object or you can create a subclass " +"of :func:`functools.partial`. (Contributed by Alexander Belopolsky " +"in :issue:`7830`.)" msgstr "" #: ../../whatsnew/3.5.rst:2514 @@ -3909,15 +3927,16 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.5.rst:2516 msgid "" -"The undocumented :c:member:`!format` member of the (non-public) :c:type:" -"`PyMemoryViewObject` structure has been removed. All extensions relying on " -"the relevant parts in ``memoryobject.h`` must be rebuilt." +"The undocumented :c:member:`!format` member of the (non-" +"public) :c:type:`PyMemoryViewObject` structure has been removed. All " +"extensions relying on the relevant parts in ``memoryobject.h`` must be " +"rebuilt." msgstr "" #: ../../whatsnew/3.5.rst:2521 msgid "" -"The :c:type:`PyMemAllocator` structure was renamed to :c:type:" -"`PyMemAllocatorEx` and a new ``calloc`` field was added." +"The :c:type:`PyMemAllocator` structure was renamed " +"to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" #: ../../whatsnew/3.5.rst:2524 @@ -3932,17 +3951,17 @@ msgstr "" msgid "" "Because the lack of the :attr:`~type.__module__` attribute breaks pickling " "and introspection, a deprecation warning is now raised for builtin types " -"without the :attr:`~type.__module__` attribute. This will be an :exc:" -"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" -"`20204`.)" +"without the :attr:`~type.__module__` attribute. This will be " +"an :exc:`AttributeError` in the future. (Contributed by Serhiy Storchaka " +"in :issue:`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 msgid "" -"As part of the :pep:`492` implementation, the ``tp_reserved`` slot of :c:" -"type:`PyTypeObject` was replaced with a :c:member:`~PyTypeObject." -"tp_as_async` slot. Refer to :ref:`coro-objects` for new types, structures " -"and functions." +"As part of the :pep:`492` implementation, the ``tp_reserved`` slot " +"of :c:type:`PyTypeObject` was replaced with " +"a :c:member:`~PyTypeObject.tp_as_async` slot. Refer to :ref:`coro-objects` " +"for new types, structures and functions." msgstr "" #: ../../whatsnew/3.5.rst:2542 @@ -3970,8 +3989,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2556 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.5.rst:2559 ../../whatsnew/3.5.rst:2572 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index b63071a79e..1597fc5373 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -70,7 +70,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:73 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.6.rst:75 msgid "" @@ -80,16 +80,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:78 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.6.rst:80 msgid "" -"The :ref:`dict <typesmapping>` type has been reimplemented to use a :ref:" -"`more compact representation <whatsnew36-compactdict>` based on `a proposal " -"by Raymond Hettinger <https://mail.python.org/pipermail/python-dev/2012-" -"December/123028.html>`_ and similar to the `PyPy dict implementation`_. " -"This resulted in dictionaries using 20% to 25% less memory when compared to " -"Python 3.5." +"The :ref:`dict <typesmapping>` type has been reimplemented to use " +"a :ref:`more compact representation <whatsnew36-compactdict>` based on `a " +"proposal by Raymond Hettinger <https://mail.python.org/pipermail/python-dev/" +"2012-December/123028.html>`_ and similar to the `PyPy dict " +"implementation`_. This resulted in dictionaries using 20% to 25% less " +"memory when compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:87 @@ -217,8 +217,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:159 msgid "" "``python.exe`` and ``pythonw.exe`` have been marked as long-path aware, " -"which means that the 260 character path limit may no longer apply. See :ref:" -"`removing the MAX_PATH limitation <max-path>` for details." +"which means that the 260 character path limit may no longer apply. " +"See :ref:`removing the MAX_PATH limitation <max-path>` for details." msgstr "" #: ../../whatsnew/3.6.rst:163 @@ -230,9 +230,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:167 msgid "" -"A ``python36.zip`` file now works as a landmark to infer :envvar:" -"`PYTHONHOME`. See :ref:`the documentation <windows_finding_modules>` for " -"more information." +"A ``python36.zip`` file now works as a landmark to " +"infer :envvar:`PYTHONHOME`. See :ref:`the documentation " +"<windows_finding_modules>` for more information." msgstr "" #: ../../whatsnew/3.6.rst:176 @@ -245,8 +245,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:183 msgid "" -":pep:`498` introduces a new kind of string literals: *f-strings*, or :ref:" -"`formatted string literals <f-strings>`." +":pep:`498` introduces a new kind of string literals: *f-strings*, " +"or :ref:`formatted string literals <f-strings>`." msgstr "" #: ../../whatsnew/3.6.rst:186 @@ -494,9 +494,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:348 msgid "" -"In order to allow zero-argument :func:`super` calls to work correctly from :" -"meth:`~object.__init_subclass__` implementations, custom metaclasses must " -"ensure that the new ``__classcell__`` namespace entry is propagated to " +"In order to allow zero-argument :func:`super` calls to work correctly " +"from :meth:`~object.__init_subclass__` implementations, custom metaclasses " +"must ensure that the new ``__classcell__`` namespace entry is propagated to " "``type.__new__`` (as described in :ref:`class-object-creation`)." msgstr "" @@ -518,13 +518,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:366 msgid "" -":pep:`487` extends the descriptor protocol to include the new optional :meth:" -"`~object.__set_name__` method. Whenever a new class is defined, the new " -"method will be called on all descriptors included in the definition, " -"providing them with a reference to the class being defined and the name " -"given to the descriptor within the class namespace. In other words, " -"instances of descriptors can now know the attribute name of the descriptor " -"in the owner class::" +":pep:`487` extends the descriptor protocol to include the new " +"optional :meth:`~object.__set_name__` method. Whenever a new class is " +"defined, the new method will be called on all descriptors included in the " +"definition, providing them with a reference to the class being defined and " +"the name given to the descriptor within the class namespace. In other " +"words, instances of descriptors can now know the attribute name of the " +"descriptor in the owner class::" msgstr "" #: ../../whatsnew/3.6.rst:374 @@ -556,13 +556,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:404 msgid "" -"File system paths have historically been represented as :class:`str` or :" -"class:`bytes` objects. This has led to people who write code which operate " -"on file system paths to assume that such objects are only one of those two " -"types (an :class:`int` representing a file descriptor does not count as that " -"is not a file path). Unfortunately that assumption prevents alternative " -"object representations of file system paths like :mod:`pathlib` from working " -"with pre-existing code, including Python's standard library." +"File system paths have historically been represented as :class:`str` " +"or :class:`bytes` objects. This has led to people who write code which " +"operate on file system paths to assume that such objects are only one of " +"those two types (an :class:`int` representing a file descriptor does not " +"count as that is not a file path). Unfortunately that assumption prevents " +"alternative object representations of file system paths like :mod:`pathlib` " +"from working with pre-existing code, including Python's standard library." msgstr "" #: ../../whatsnew/3.6.rst:413 @@ -572,8 +572,8 @@ msgid "" "method, an object signals that it represents a path. An object can then " "provide a low-level representation of a file system path as a :class:`str` " "or :class:`bytes` object. This means an object is considered :term:`path-" -"like <path-like object>` if it implements :class:`os.PathLike` or is a :" -"class:`str` or :class:`bytes` object which represents a file system path. " +"like <path-like object>` if it implements :class:`os.PathLike` or is " +"a :class:`str` or :class:`bytes` object which represents a file system path. " "Code can use :func:`os.fspath`, :func:`os.fsdecode`, or :func:`os.fsencode` " "to explicitly get a :class:`str` and/or :class:`bytes` representation of a " "path-like object." @@ -581,26 +581,28 @@ msgstr "" #: ../../whatsnew/3.6.rst:426 msgid "" -"The built-in :func:`open` function has been updated to accept :class:`os." -"PathLike` objects, as have all relevant functions in the :mod:`os` and :mod:" -"`os.path` modules, and most other functions and classes in the standard " -"library. The :class:`os.DirEntry` class and relevant classes in :mod:" -"`pathlib` have also been updated to implement :class:`os.PathLike`." +"The built-in :func:`open` function has been updated to " +"accept :class:`os.PathLike` objects, as have all relevant functions in " +"the :mod:`os` and :mod:`os.path` modules, and most other functions and " +"classes in the standard library. The :class:`os.DirEntry` class and " +"relevant classes in :mod:`pathlib` have also been updated to " +"implement :class:`os.PathLike`." msgstr "" #: ../../whatsnew/3.6.rst:433 msgid "" "The hope is that updating the fundamental functions for operating on file " -"system paths will lead to third-party code to implicitly support all :term:" -"`path-like objects <path-like object>` without any code changes, or at least " -"very minimal ones (e.g. calling :func:`os.fspath` at the beginning of code " -"before operating on a path-like object)." +"system paths will lead to third-party code to implicitly support " +"all :term:`path-like objects <path-like object>` without any code changes, " +"or at least very minimal ones (e.g. calling :func:`os.fspath` at the " +"beginning of code before operating on a path-like object)." msgstr "" #: ../../whatsnew/3.6.rst:440 msgid "" -"Here are some examples of how the new interface allows for :class:`pathlib." -"Path` to be used more easily and transparently with pre-existing code::" +"Here are some examples of how the new interface allows " +"for :class:`pathlib.Path` to be used more easily and transparently with pre-" +"existing code::" msgstr "" #: ../../whatsnew/3.6.rst:444 @@ -660,9 +662,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:476 msgid "" -":pep:`495` adds the new *fold* attribute to instances of :class:`datetime." -"datetime` and :class:`datetime.time` classes to differentiate between two " -"moments in time for which local times are the same::" +":pep:`495` adds the new *fold* attribute to instances " +"of :class:`datetime.datetime` and :class:`datetime.time` classes to " +"differentiate between two moments in time for which local times are the " +"same::" msgstr "" #: ../../whatsnew/3.6.rst:480 @@ -721,17 +724,17 @@ msgstr "" msgid "" "Prior to Python 3.6, data loss could result when using bytes paths on " "Windows. With this change, using bytes to represent paths is now supported " -"on Windows, provided those bytes are encoded with the encoding returned by :" -"func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." +"on Windows, provided those bytes are encoded with the encoding returned " +"by :func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." msgstr "" #: ../../whatsnew/3.6.rst:516 msgid "" -"Applications that do not use str to represent paths should use :func:`os." -"fsencode` and :func:`os.fsdecode` to ensure their bytes are correctly " -"encoded. To revert to the previous behaviour, set :envvar:" -"`PYTHONLEGACYWINDOWSFSENCODING` or call :func:`sys." -"_enablelegacywindowsfsencoding`." +"Applications that do not use str to represent paths should " +"use :func:`os.fsencode` and :func:`os.fsdecode` to ensure their bytes are " +"correctly encoded. To revert to the previous behaviour, " +"set :envvar:`PYTHONLEGACYWINDOWSFSENCODING` or " +"call :func:`sys._enablelegacywindowsfsencoding`." msgstr "" #: ../../whatsnew/3.6.rst:522 @@ -747,8 +750,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:531 msgid "" "The default console on Windows will now accept all Unicode characters and " -"provide correctly read str objects to Python code. ``sys.stdin``, ``sys." -"stdout`` and ``sys.stderr`` now default to utf-8 encoding." +"provide correctly read str objects to Python code. ``sys.stdin``, " +"``sys.stdout`` and ``sys.stderr`` now default to utf-8 encoding." msgstr "" #: ../../whatsnew/3.6.rst:535 @@ -779,8 +782,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:554 msgid "" -"Also, the effective default class *execution* namespace (returned from :ref:" -"`type.__prepare__() <prepare>`) is now an insertion-order-preserving mapping." +"Also, the effective default class *execution* namespace (returned " +"from :ref:`type.__prepare__() <prepare>`) is now an insertion-order-" +"preserving mapping." msgstr "" #: ../../whatsnew/3.6.rst:560 @@ -814,9 +818,9 @@ msgid "" "The :ref:`dict <typesmapping>` type now uses a \"compact\" representation " "based on `a proposal by Raymond Hettinger <https://mail.python.org/pipermail/" "python-dev/2012-December/123028.html>`_ which was `first implemented by PyPy " -"<https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more." -"html>`_. The memory usage of the new :func:`dict` is between 20% and 25% " -"smaller compared to Python 3.5." +"<https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-" +"more.html>`_. The memory usage of the new :func:`dict` is between 20% and " +"25% smaller compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:591 @@ -827,8 +831,8 @@ msgid "" "language for a few releases before changing the language spec to mandate " "order-preserving semantics for all current and future Python " "implementations; this also helps preserve backwards-compatibility with older " -"versions of the language where random iteration order is still in effect, e." -"g. Python 3.5)." +"versions of the language where random iteration order is still in effect, " +"e.g. Python 3.5)." msgstr "" #: ../../whatsnew/3.6.rst:600 @@ -903,8 +907,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:647 msgid "" -"Detect violations of the Python memory allocator API. For example, :c:func:" -"`PyObject_Free` called on a memory block allocated by :c:func:`PyMem_Malloc`." +"Detect violations of the Python memory allocator API. For " +"example, :c:func:`PyObject_Free` called on a memory block allocated " +"by :c:func:`PyMem_Malloc`." msgstr "" #: ../../whatsnew/3.6.rst:650 @@ -943,8 +948,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:666 msgid "" -"On error, the debug hooks on Python memory allocators now use the :mod:" -"`tracemalloc` module to get the traceback where a memory block was allocated." +"On error, the debug hooks on Python memory allocators now use " +"the :mod:`tracemalloc` module to get the traceback where a memory block was " +"allocated." msgstr "" #: ../../whatsnew/3.6.rst:670 @@ -1085,8 +1091,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:742 msgid "" "A ``global`` or ``nonlocal`` statement must now textually appear before the " -"first use of the affected name in the same scope. Previously this was a :exc:" -"`SyntaxWarning`." +"first use of the affected name in the same scope. Previously this was " +"a :exc:`SyntaxWarning`." msgstr "" #: ../../whatsnew/3.6.rst:746 @@ -1106,10 +1112,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:757 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that currently checks " -"for ImportError (in try-except) will still work. (Contributed by Eric Snow " -"in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that currently " +"checks for ImportError (in try-except) will still work. (Contributed by Eric " +"Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:762 @@ -1138,8 +1144,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:781 msgid "" "Note that the pseudo-random generators in the :mod:`random` module should " -"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ and :" -"func:`os.urandom` on Python 3.5 and earlier." +"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ " +"and :func:`os.urandom` on Python 3.5 and earlier." msgstr "" #: ../../whatsnew/3.6.rst:787 @@ -1167,7 +1173,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:801 msgid "Contributed by Serhiy Storchaka in :issue:`26492`." -msgstr "" +msgstr "由 Serhiy Storchaka 於 :issue:`26492` 中貢獻。" #: ../../whatsnew/3.6.rst:804 msgid "ast" @@ -1181,7 +1187,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:809 msgid "Contributed by Victor Stinner in :issue:`26146`." -msgstr "" +msgstr "由 Victor Stinner 於 :issue:`26146` 中貢獻。" #: ../../whatsnew/3.6.rst:813 msgid "asyncio" @@ -1244,9 +1250,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() <asyncio.loop." -"get_exception_handler>` method to get the current exception handler. " -"(Contributed by Yury Selivanov in :issue:`27040`.)" +"New :meth:`loop.get_exception_handler() " +"<asyncio.loop.get_exception_handler>` method to get the current exception " +"handler. (Contributed by Yury Selivanov in :issue:`27040`.)" msgstr "" #: ../../whatsnew/3.6.rst:854 @@ -1258,9 +1264,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:859 msgid "" -"The performance of :meth:`StreamReader.readexactly() <asyncio.StreamReader." -"readexactly>` has been improved. (Contributed by Mark Korenberg in :issue:" -"`28370`.)" +"The performance of :meth:`StreamReader.readexactly() " +"<asyncio.StreamReader.readexactly>` has been improved. (Contributed by Mark " +"Korenberg in :issue:`28370`.)" msgstr "" #: ../../whatsnew/3.6.rst:863 @@ -1287,9 +1293,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:879 msgid "" -"New :meth:`loop.connect_accepted_socket() <asyncio.loop." -"connect_accepted_socket>` method to be used by servers that accept " -"connections outside of asyncio, but that use asyncio to handle them. " +"New :meth:`loop.connect_accepted_socket() " +"<asyncio.loop.connect_accepted_socket>` method to be used by servers that " +"accept connections outside of asyncio, but that use asyncio to handle them. " "(Contributed by Jim Fulton in :issue:`27392`.)" msgstr "" @@ -1337,10 +1343,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:914 msgid "" -"New constants: :const:`cmath.inf` and :const:`cmath.nan` to match :const:" -"`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` and :const:" -"`cmath.nanj` to match the format used by complex repr. (Contributed by Mark " -"Dickinson in :issue:`23229`.)" +"New constants: :const:`cmath.inf` and :const:`cmath.nan` to " +"match :const:`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` " +"and :const:`cmath.nanj` to match the format used by complex repr. " +"(Contributed by Mark Dickinson in :issue:`23229`.)" msgstr "" #: ../../whatsnew/3.6.rst:921 @@ -1364,16 +1370,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:931 msgid "" "The new :class:`~collections.abc.AsyncGenerator` abstract base class " -"represents asynchronous generators. (Contributed by Yury Selivanov in :issue:" -"`28720`.)" +"represents asynchronous generators. (Contributed by Yury Selivanov " +"in :issue:`28720`.)" msgstr "" #: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the :attr:`~type." -"__module__` attribute of the returned named tuple class. (Contributed by " -"Raymond Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for " +"the :attr:`~type.__module__` attribute of the returned named tuple class. " +"(Contributed by Raymond Hettinger in :issue:`17941`.)" msgstr "" #: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2295 @@ -1409,9 +1415,9 @@ msgid "" "The :class:`contextlib.AbstractContextManager` class has been added to " "provide an abstract base class for context managers. It provides a sensible " "default implementation for ``__enter__()`` which returns ``self`` and leaves " -"``__exit__()`` an abstract method. A matching class has been added to the :" -"mod:`typing` module as :class:`typing.ContextManager`. (Contributed by Brett " -"Cannon in :issue:`25609`.)" +"``__exit__()`` an abstract method. A matching class has been added to " +"the :mod:`typing` module as :class:`typing.ContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:971 @@ -1430,10 +1436,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:981 msgid "" -"The :meth:`datetime.strftime() <datetime.datetime.strftime>` and :meth:`date." -"strftime() <datetime.date.strftime>` methods now support ISO 8601 date " -"directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley Anderson in :" -"issue:`12006`.)" +"The :meth:`datetime.strftime() <datetime.datetime.strftime>` " +"and :meth:`date.strftime() <datetime.date.strftime>` methods now support ISO " +"8601 date directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley " +"Anderson in :issue:`12006`.)" msgstr "" #: ../../whatsnew/3.6.rst:986 @@ -1447,8 +1453,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:991 msgid "" "The :meth:`datetime.combine() <datetime.datetime.combine>` now accepts an " -"optional *tzinfo* argument. (Contributed by Alexander Belopolsky in :issue:" -"`27661`.)" +"optional *tzinfo* argument. (Contributed by Alexander Belopolsky " +"in :issue:`27661`.)" msgstr "" #: ../../whatsnew/3.6.rst:997 @@ -1458,9 +1464,9 @@ msgstr "decimal" #: ../../whatsnew/3.6.rst:999 msgid "" "New :meth:`Decimal.as_integer_ratio() <decimal.Decimal.as_integer_ratio>` " -"method that returns a pair ``(n, d)`` of integers that represent the given :" -"class:`~decimal.Decimal` instance as a fraction, in lowest terms and with a " -"positive denominator::" +"method that returns a pair ``(n, d)`` of integers that represent the " +"given :class:`~decimal.Decimal` instance as a fraction, in lowest terms and " +"with a positive denominator::" msgstr "" #: ../../whatsnew/3.6.rst:1004 @@ -1481,9 +1487,9 @@ msgstr "distutils" #: ../../whatsnew/3.6.rst:1014 msgid "" -"The ``default_format`` attribute has been removed from ``distutils.command." -"sdist.sdist`` and the ``formats`` attribute defaults to ``['gztar']``. " -"Although not anticipated, any code relying on the presence of " +"The ``default_format`` attribute has been removed from " +"``distutils.command.sdist.sdist`` and the ``formats`` attribute defaults to " +"``['gztar']``. Although not anticipated, any code relying on the presence of " "``default_format`` may need to be adapted. See :issue:`27819` for more " "details." msgstr "" @@ -1497,8 +1503,8 @@ msgid "" "The new email API, enabled via the *policy* keyword to various constructors, " "is no longer provisional. The :mod:`email` documentation has been " "reorganized and rewritten to focus on the new API, while retaining the old " -"documentation for the legacy API. (Contributed by R. David Murray in :issue:" -"`24277`.)" +"documentation for the legacy API. (Contributed by R. David Murray " +"in :issue:`24277`.)" msgstr "" #: ../../whatsnew/3.6.rst:1029 @@ -1515,12 +1521,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:1035 msgid "" -"There is a new :mod:`~email.policy` attribute, :attr:`~email.policy.Policy." -"message_factory`, that controls what class is used by default when the " -"parser creates new message objects. For the :attr:`email.policy.compat32` " -"policy this is :class:`~email.message.Message`, for the new policies it is :" -"class:`~email.message.EmailMessage`. (Contributed by R. David Murray in :" -"issue:`20476`.)" +"There is a new :mod:`~email.policy` " +"attribute, :attr:`~email.policy.Policy.message_factory`, that controls what " +"class is used by default when the parser creates new message objects. For " +"the :attr:`email.policy.compat32` policy this " +"is :class:`~email.message.Message`, for the new policies it " +"is :class:`~email.message.EmailMessage`. (Contributed by R. David Murray " +"in :issue:`20476`.)" msgstr "" #: ../../whatsnew/3.6.rst:1044 @@ -1540,16 +1547,16 @@ msgstr "enum" #: ../../whatsnew/3.6.rst:1054 msgid "" -"Two new enumeration base classes have been added to the :mod:`enum` module: :" -"class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to define " -"constants that can be combined using the bitwise operators. (Contributed by " -"Ethan Furman in :issue:`23591`.)" +"Two new enumeration base classes have been added to the :mod:`enum` " +"module: :class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to " +"define constants that can be combined using the bitwise operators. " +"(Contributed by Ethan Furman in :issue:`23591`.)" msgstr "" #: ../../whatsnew/3.6.rst:1059 msgid "" -"Many standard library modules have been updated to use the :class:`~enum." -"IntFlags` class for their constants." +"Many standard library modules have been updated to use " +"the :class:`~enum.IntFlags` class for their constants." msgstr "" #: ../../whatsnew/3.6.rst:1062 @@ -1620,19 +1627,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1102 msgid "" -"The SHA-3 hash functions :func:`~hashlib.sha3_224`, :func:`~hashlib." -"sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, and SHAKE " -"hash functions :func:`~hashlib.shake_128` and :func:`~hashlib.shake_256` " -"were added. (Contributed by Christian Heimes in :issue:`16113`. Keccak Code " -"Package by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, " -"and Ronny Van Keer.)" +"The SHA-3 hash " +"functions :func:`~hashlib.sha3_224`, :func:`~hashlib.sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, " +"and SHAKE hash functions :func:`~hashlib.shake_128` " +"and :func:`~hashlib.shake_256` were added. (Contributed by Christian Heimes " +"in :issue:`16113`. Keccak Code Package by Guido Bertoni, Joan Daemen, " +"Michaël Peeters, Gilles Van Assche, and Ronny Van Keer.)" msgstr "" #: ../../whatsnew/3.6.rst:1109 msgid "" "The password-based key derivation function :func:`~hashlib.scrypt` is now " -"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes in :" -"issue:`27928`.)" +"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes " +"in :issue:`27928`.)" msgstr "" #: ../../whatsnew/3.6.rst:1114 @@ -1641,10 +1648,10 @@ msgstr "http.client" #: ../../whatsnew/3.6.rst:1116 msgid "" -":meth:`HTTPConnection.request() <http.client.HTTPConnection.request>` and :" -"meth:`~http.client.HTTPConnection.endheaders` both now support chunked " -"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl in :" -"issue:`12319`.)" +":meth:`HTTPConnection.request() <http.client.HTTPConnection.request>` " +"and :meth:`~http.client.HTTPConnection.endheaders` both now support chunked " +"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1123 @@ -1667,10 +1674,10 @@ msgid "" "renaming of files with partial uppercase names is similar to the renaming " "of, for instance, Tkinter and TkFont to tkinter and tkinter.font in 3.0. As " "a result, imports of idlelib files that worked in 3.5 will usually not work " -"in 3.6. At least a module name change will be needed (see idlelib/README." -"txt), sometimes more. (Name changes contributed by Al Swiegart and Terry " -"Reedy in :issue:`24225`. Most idlelib patches since have been and will be " -"part of the process.)" +"in 3.6. At least a module name change will be needed (see idlelib/" +"README.txt), sometimes more. (Name changes contributed by Al Swiegart and " +"Terry Reedy in :issue:`24225`. Most idlelib patches since have been and " +"will be part of the process.)" msgstr "" #: ../../whatsnew/3.6.rst:1141 @@ -1686,8 +1693,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1147 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" #: ../../whatsnew/3.6.rst:1149 @@ -1738,8 +1745,8 @@ msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" #: ../../whatsnew/3.6.rst:1182 @@ -1771,26 +1778,26 @@ msgstr "importlib" #: ../../whatsnew/3.6.rst:1201 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that current checks " -"for ``ImportError`` (in try-except) will still work. (Contributed by Eric " -"Snow in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that current " +"checks for ``ImportError`` (in try-except) will still work. (Contributed by " +"Eric Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:1206 msgid "" -":class:`importlib.util.LazyLoader` now calls :meth:`~importlib.abc.Loader." -"create_module` on the wrapped loader, removing the restriction that :class:" -"`importlib.machinery.BuiltinImporter` and :class:`importlib.machinery." -"ExtensionFileLoader` couldn't be used with :class:`importlib.util." -"LazyLoader`." +":class:`importlib.util.LazyLoader` now " +"calls :meth:`~importlib.abc.Loader.create_module` on the wrapped loader, " +"removing the restriction that :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader` couldn't be used " +"with :class:`importlib.util.LazyLoader`." msgstr "" #: ../../whatsnew/3.6.rst:1212 msgid "" -":func:`importlib.util.cache_from_source`, :func:`importlib.util." -"source_from_cache`, and :func:`importlib.util.spec_from_file_location` now " -"accept a :term:`path-like object`." +":func:`importlib.util.cache_from_source`, :func:`importlib.util.source_from_cache`, " +"and :func:`importlib.util.spec_from_file_location` now accept a :term:`path-" +"like object`." msgstr "" #: ../../whatsnew/3.6.rst:1219 @@ -1807,12 +1814,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1226 msgid "" -"To reduce code churn when upgrading from Python 2.7 and the legacy :func:" -"`inspect.getargspec` API, the previously documented deprecation of :func:" -"`inspect.getfullargspec` has been reversed. While this function is " -"convenient for single/source Python 2/3 code bases, the richer :func:" -"`inspect.signature` interface remains the recommended approach for new code. " -"(Contributed by Nick Coghlan in :issue:`27172`)" +"To reduce code churn when upgrading from Python 2.7 and the " +"legacy :func:`inspect.getargspec` API, the previously documented deprecation " +"of :func:`inspect.getfullargspec` has been reversed. While this function is " +"convenient for single/source Python 2/3 code bases, the " +"richer :func:`inspect.signature` interface remains the recommended approach " +"for new code. (Contributed by Nick Coghlan in :issue:`27172`)" msgstr "" #: ../../whatsnew/3.6.rst:1235 @@ -1832,10 +1839,10 @@ msgstr "logging" #: ../../whatsnew/3.6.rst:1245 msgid "" -"The new :meth:`WatchedFileHandler.reopenIfNeeded() <logging.handlers." -"WatchedFileHandler.reopenIfNeeded>` method has been added to add the ability " -"to check if the log file needs to be reopened. (Contributed by Marian Horban " -"in :issue:`24884`.)" +"The new :meth:`WatchedFileHandler.reopenIfNeeded() " +"<logging.handlers.WatchedFileHandler.reopenIfNeeded>` method has been added " +"to add the ability to check if the log file needs to be reopened. " +"(Contributed by Marian Horban in :issue:`24884`.)" msgstr "" #: ../../whatsnew/3.6.rst:1252 @@ -1855,9 +1862,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.6.rst:1262 msgid "" -":ref:`Proxy Objects <multiprocessing-proxy_objects>` returned by :func:" -"`multiprocessing.Manager` can now be nested. (Contributed by Davin Potts in :" -"issue:`6766`.)" +":ref:`Proxy Objects <multiprocessing-proxy_objects>` returned " +"by :func:`multiprocessing.Manager` can now be nested. (Contributed by Davin " +"Potts in :issue:`6766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1268 ../../whatsnew/3.6.rst:2021 @@ -1877,11 +1884,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1276 msgid "" -"A new :meth:`~os.scandir.close` method allows explicitly closing a :func:" -"`~os.scandir` iterator. The :func:`~os.scandir` iterator now supports the :" -"term:`context manager` protocol. If a :func:`scandir` iterator is neither " -"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " -"its destructor. (Contributed by Serhiy Storchaka in :issue:`25994`.)" +"A new :meth:`~os.scandir.close` method allows explicitly closing " +"a :func:`~os.scandir` iterator. The :func:`~os.scandir` iterator now " +"supports the :term:`context manager` protocol. If a :func:`scandir` " +"iterator is neither exhausted nor explicitly closed a :exc:`ResourceWarning` " +"will be emitted in its destructor. (Contributed by Serhiy Storchaka " +"in :issue:`25994`.)" msgstr "" #: ../../whatsnew/3.6.rst:1286 @@ -1971,24 +1979,24 @@ msgstr "re" #: ../../whatsnew/3.6.rst:1347 msgid "" -"Added support of modifier spans in regular expressions. Examples: ``'(?i:" -"p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; ``'(?" -"i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " +"Added support of modifier spans in regular expressions. Examples: ``'(?" +"i:p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; " +"``'(?i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " "(Contributed by Serhiy Storchaka in :issue:`433028`.)" msgstr "" #: ../../whatsnew/3.6.rst:1352 msgid "" "Match object groups can be accessed by ``__getitem__``, which is equivalent " -"to ``group()``. So ``mo['name']`` is now equivalent to ``mo." -"group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" +"to ``group()``. So ``mo['name']`` is now equivalent to " +"``mo.group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" msgstr "" #: ../../whatsnew/3.6.rst:1356 msgid "" -":class:`~re.Match` objects now support :meth:`index-like objects <object." -"__index__>` as group indices. (Contributed by Jeroen Demeyer and Xiang Zhang " -"in :issue:`27177`.)" +":class:`~re.Match` objects now support :meth:`index-like objects " +"<object.__index__>` as group indices. (Contributed by Jeroen Demeyer and " +"Xiang Zhang in :issue:`27177`.)" msgstr "" #: ../../whatsnew/3.6.rst:1363 @@ -1998,8 +2006,8 @@ msgstr "readline" #: ../../whatsnew/3.6.rst:1365 msgid "" "Added :func:`~readline.set_auto_history` to enable or disable automatic " -"addition of input to the history list. (Contributed by Tyler Crompton in :" -"issue:`26870`.)" +"addition of input to the history list. (Contributed by Tyler Crompton " +"in :issue:`26870`.)" msgstr "" #: ../../whatsnew/3.6.rst:1371 @@ -2010,8 +2018,8 @@ msgstr "rlcompleter" msgid "" "Private and special attribute names now are omitted unless the prefix starts " "with underscores. A space or a colon is added after some completed " -"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` and :issue:" -"`25209`.)" +"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` " +"and :issue:`25209`.)" msgstr "" #: ../../whatsnew/3.6.rst:1379 @@ -2053,9 +2061,9 @@ msgstr "socket" #: ../../whatsnew/3.6.rst:1406 msgid "" -"The :func:`~socket.socket.ioctl` function now supports the :const:`~socket." -"SIO_LOOPBACK_FAST_PATH` control code. (Contributed by Daniel Stokes in :" -"issue:`26536`.)" +"The :func:`~socket.socket.ioctl` function now supports " +"the :const:`~socket.SIO_LOOPBACK_FAST_PATH` control code. (Contributed by " +"Daniel Stokes in :issue:`26536`.)" msgstr "" #: ../../whatsnew/3.6.rst:1410 @@ -2068,16 +2076,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:1414 msgid "" "The :meth:`~socket.socket.setsockopt` now supports the ``setsockopt(level, " -"optname, None, optlen: int)`` form. (Contributed by Christian Heimes in :" -"issue:`27744`.)" +"optname, None, optlen: int)`` form. (Contributed by Christian Heimes " +"in :issue:`27744`.)" msgstr "" #: ../../whatsnew/3.6.rst:1418 msgid "" "The socket module now supports the address family :const:`~socket.AF_ALG` to " -"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` and :meth:" -"`~socket.socket.sendmsg_afalg` were added. (Contributed by Christian Heimes " -"in :issue:`27744` with support from Victor Stinner.)" +"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` " +"and :meth:`~socket.socket.sendmsg_afalg` were added. (Contributed by " +"Christian Heimes in :issue:`27744` with support from Victor Stinner.)" msgstr "" #: ../../whatsnew/3.6.rst:1424 @@ -2092,19 +2100,19 @@ msgstr "socketserver" #: ../../whatsnew/3.6.rst:1431 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now support the :term:`context manager` protocol. (Contributed by Aviv " -"Palivoda in :issue:`26404`.)" +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now support the :term:`context manager` " +"protocol. (Contributed by Aviv Palivoda in :issue:`26404`.)" msgstr "" #: ../../whatsnew/3.6.rst:1437 msgid "" -"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute of :class:" -"`~socketserver.StreamRequestHandler` classes now implements the :class:`io." -"BufferedIOBase` writable interface. In particular, calling :meth:`~io." -"BufferedIOBase.write` is now guaranteed to send the data in full. " -"(Contributed by Martin Panter in :issue:`26721`.)" +"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute " +"of :class:`~socketserver.StreamRequestHandler` classes now implements " +"the :class:`io.BufferedIOBase` writable interface. In particular, " +"calling :meth:`~io.BufferedIOBase.write` is now guaranteed to send the data " +"in full. (Contributed by Martin Panter in :issue:`26721`.)" msgstr "" #: ../../whatsnew/3.6.rst:1445 ../../whatsnew/3.6.rst:2037 @@ -2120,8 +2128,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1450 msgid "" "3DES has been removed from the default cipher suites and ChaCha20 Poly1305 " -"cipher suites have been added. (Contributed by Christian Heimes in :issue:" -"`27850` and :issue:`27766`.)" +"cipher suites have been added. (Contributed by Christian Heimes " +"in :issue:`27850` and :issue:`27766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1454 @@ -2146,8 +2154,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1467 msgid "" -"All constants and flags have been converted to :class:`~enum.IntEnum` and :" -"class:`~enum.IntFlags`. (Contributed by Christian Heimes in :issue:`28025`.)" +"All constants and flags have been converted to :class:`~enum.IntEnum` " +"and :class:`~enum.IntFlags`. (Contributed by Christian Heimes " +"in :issue:`28025`.)" msgstr "" #: ../../whatsnew/3.6.rst:1471 @@ -2158,9 +2167,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:1475 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" #: ../../whatsnew/3.6.rst:1481 @@ -2180,8 +2190,8 @@ msgstr "struct" #: ../../whatsnew/3.6.rst:1490 msgid "" ":mod:`struct` now supports IEEE 754 half-precision floats via the ``'e'`` " -"format specifier. (Contributed by Eli Stevens, Mark Dickinson in :issue:" -"`11734`.)" +"format specifier. (Contributed by Eli Stevens, Mark Dickinson " +"in :issue:`11734`.)" msgstr "" #: ../../whatsnew/3.6.rst:1496 @@ -2192,9 +2202,9 @@ msgstr "subprocess" msgid "" ":class:`subprocess.Popen` destructor now emits a :exc:`ResourceWarning` " "warning if the child process is still running. Use the context manager " -"protocol (``with proc: ...``) or explicitly call the :meth:`~subprocess." -"Popen.wait` method to read the exit status of the child process. " -"(Contributed by Victor Stinner in :issue:`26741`.)" +"protocol (``with proc: ...``) or explicitly call " +"the :meth:`~subprocess.Popen.wait` method to read the exit status of the " +"child process. (Contributed by Victor Stinner in :issue:`26741`.)" msgstr "" #: ../../whatsnew/3.6.rst:1504 @@ -2241,8 +2251,8 @@ msgstr "time" #: ../../whatsnew/3.6.rst:1534 msgid "" -"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` and :attr:" -"`tm_zone` are now available on all platforms." +"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` " +"and :attr:`tm_zone` are now available on all platforms." msgstr "" #: ../../whatsnew/3.6.rst:1539 @@ -2269,13 +2279,14 @@ msgstr "tkinter" #: ../../whatsnew/3.6.rst:1554 msgid "" -"Added methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable." -"trace_remove` and :meth:`~tkinter.Variable.trace_info` in the :class:" -"`tkinter.Variable` class. They replace old methods :meth:`~tkinter.Variable." -"trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable." -"trace_vdelete` and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete " -"Tcl commands and might not work in future versions of Tcl. (Contributed by " -"Serhiy Storchaka in :issue:`22115`)." +"Added " +"methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable.trace_remove` " +"and :meth:`~tkinter.Variable.trace_info` in the :class:`tkinter.Variable` " +"class. They replace old " +"methods :meth:`~tkinter.Variable.trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable.trace_vdelete` " +"and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete Tcl commands and " +"might not work in future versions of Tcl. (Contributed by Serhiy Storchaka " +"in :issue:`22115`)." msgstr "" #: ../../whatsnew/3.6.rst:1567 @@ -2351,22 +2362,22 @@ msgstr "" msgid "" "The :mod:`typing` module has a much improved support for generic type " "aliases. For example ``Dict[str, Tuple[S, T]]`` is now a valid type " -"annotation. (Contributed by Guido van Rossum in `Github #195 <https://github." -"com/python/typing/pull/195>`_.)" +"annotation. (Contributed by Guido van Rossum in `Github #195 <https://" +"github.com/python/typing/pull/195>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1614 msgid "" -"The :class:`typing.ContextManager` class has been added for representing :" -"class:`contextlib.AbstractContextManager`. (Contributed by Brett Cannon in :" -"issue:`25609`.)" +"The :class:`typing.ContextManager` class has been added for " +"representing :class:`contextlib.AbstractContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:1618 msgid "" -"The :class:`typing.Collection` class has been added for representing :class:" -"`collections.abc.Collection`. (Contributed by Ivan Levkivskyi in :issue:" -"`27598`.)" +"The :class:`typing.Collection` class has been added for " +"representing :class:`collections.abc.Collection`. (Contributed by Ivan " +"Levkivskyi in :issue:`27598`.)" msgstr "" #: ../../whatsnew/3.6.rst:1622 @@ -2375,16 +2386,16 @@ msgid "" "variables. As introduced in :pep:`526`, a variable annotation wrapped in " "ClassVar indicates that a given attribute is intended to be used as a class " "variable and should not be set on instances of that class. (Contributed by " -"Ivan Levkivskyi in `Github #280 <https://github.com/python/typing/" -"pull/280>`_.)" +"Ivan Levkivskyi in `Github #280 <https://github.com/python/typing/pull/" +"280>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1629 msgid "" "A new :const:`~typing.TYPE_CHECKING` constant that is assumed to be ``True`` " "by the static type checkers, but is ``False`` at runtime. (Contributed by " -"Guido van Rossum in `Github #230 <https://github.com/python/typing/" -"issues/230>`_.)" +"Guido van Rossum in `Github #230 <https://github.com/python/typing/issues/" +"230>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1634 @@ -2432,10 +2443,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:1660 msgid "" -"Two new methods, :meth:`Mock.assert_called() <unittest.mock.Mock." -"assert_called>` and :meth:`Mock.assert_called_once() <unittest.mock.Mock." -"assert_called_once>` to check if the mock object was called. (Contributed by " -"Amit Saha in :issue:`26323`.)" +"Two new methods, :meth:`Mock.assert_called() " +"<unittest.mock.Mock.assert_called>` and :meth:`Mock.assert_called_once() " +"<unittest.mock.Mock.assert_called_once>` to check if the mock object was " +"called. (Contributed by Amit Saha in :issue:`26323`.)" msgstr "" #: ../../whatsnew/3.6.rst:1666 @@ -2452,9 +2463,10 @@ msgstr "urllib.request" #: ../../whatsnew/3.6.rst:1675 msgid "" "If a HTTP request has a file or iterable body (other than a bytes object) " -"but no ``Content-Length`` header, rather than throwing an error, :class:" -"`~urllib.request.AbstractHTTPHandler` now falls back to use chunked transfer " -"encoding. (Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)" +"but no ``Content-Length`` header, rather than throwing an " +"error, :class:`~urllib.request.AbstractHTTPHandler` now falls back to use " +"chunked transfer encoding. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1683 @@ -2485,11 +2497,11 @@ msgstr "warnings" #: ../../whatsnew/3.6.rst:1701 msgid "" -"A new optional *source* parameter has been added to the :func:`warnings." -"warn_explicit` function: the destroyed object which emitted a :exc:" -"`ResourceWarning`. A *source* attribute has also been added to :class:" -"`warnings.WarningMessage` (contributed by Victor Stinner in :issue:`26568` " -"and :issue:`26567`)." +"A new optional *source* parameter has been added to " +"the :func:`warnings.warn_explicit` function: the destroyed object which " +"emitted a :exc:`ResourceWarning`. A *source* attribute has also been added " +"to :class:`warnings.WarningMessage` (contributed by Victor Stinner " +"in :issue:`26568` and :issue:`26567`)." msgstr "" #: ../../whatsnew/3.6.rst:1707 @@ -2547,9 +2559,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1730 msgid "" -"The \"Object allocated at\" traceback is new and is only displayed if :mod:" -"`tracemalloc` is tracing Python memory allocations and if the :mod:" -"`warnings` module was already imported." +"The \"Object allocated at\" traceback is new and is only displayed " +"if :mod:`tracemalloc` is tracing Python memory allocations and if " +"the :mod:`warnings` module was already imported." msgstr "" #: ../../whatsnew/3.6.rst:1736 @@ -2568,9 +2580,9 @@ msgstr "winsound" #: ../../whatsnew/3.6.rst:1745 msgid "" -"Allowed keyword arguments to be passed to :func:`Beep <winsound.Beep>`, :" -"func:`MessageBeep <winsound.MessageBeep>`, and :func:`PlaySound <winsound." -"PlaySound>` (:issue:`27982`)." +"Allowed keyword arguments to be passed to :func:`Beep " +"<winsound.Beep>`, :func:`MessageBeep <winsound.MessageBeep>`, " +"and :func:`PlaySound <winsound.PlaySound>` (:issue:`27982`)." msgstr "" #: ../../whatsnew/3.6.rst:1751 @@ -2623,8 +2635,8 @@ msgstr "最佳化" msgid "" "The Python interpreter now uses a 16-bit wordcode instead of bytecode which " "made a number of opcode optimizations possible. (Contributed by Demur Rumed " -"with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:" -"`26647` and :issue:`28050`.)" +"with input and reviews from Serhiy Storchaka and Victor Stinner " +"in :issue:`26647` and :issue:`28050`.)" msgstr "" #: ../../whatsnew/3.6.rst:1790 @@ -2656,8 +2668,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1804 msgid "" "The ASCII and the Latin1 encoders are now up to 3 times as fast for the " -"error handler ``surrogateescape`` (Contributed by Victor Stinner in :issue:" -"`25227`)." +"error handler ``surrogateescape`` (Contributed by Victor Stinner " +"in :issue:`25227`)." msgstr "" #: ../../whatsnew/3.6.rst:1808 @@ -2689,8 +2701,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1822 msgid "" "Optimize :meth:`bytes.fromhex` and :meth:`bytearray.fromhex`: they are now " -"between 2x and 3.5x faster. (Contributed by Victor Stinner in :issue:" -"`25401`)." +"between 2x and 3.5x faster. (Contributed by Victor Stinner " +"in :issue:`25401`)." msgstr "" #: ../../whatsnew/3.6.rst:1825 @@ -2701,19 +2713,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1828 msgid "" -"Allocator functions of the :c:func:`PyMem_Malloc` domain (:c:macro:" -"`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator <pymalloc>` " -"instead of :c:func:`malloc` function of the C library. The pymalloc " -"allocator is optimized for objects smaller or equal to 512 bytes with a " -"short lifetime, and use :c:func:`malloc` for larger memory blocks. " +"Allocator functions of the :c:func:`PyMem_Malloc` domain " +"(:c:macro:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator " +"<pymalloc>` instead of :c:func:`malloc` function of the C library. The " +"pymalloc allocator is optimized for objects smaller or equal to 512 bytes " +"with a short lifetime, and use :c:func:`malloc` for larger memory blocks. " "(Contributed by Victor Stinner in :issue:`26249`)." msgstr "" #: ../../whatsnew/3.6.rst:1835 msgid "" ":func:`pickle.load` and :func:`pickle.loads` are now up to 10% faster when " -"deserializing many small objects (Contributed by Victor Stinner in :issue:" -"`27056`)." +"deserializing many small objects (Contributed by Victor Stinner " +"in :issue:`27056`)." msgstr "" #: ../../whatsnew/3.6.rst:1839 @@ -2727,42 +2739,42 @@ msgstr "" #: ../../whatsnew/3.6.rst:1845 msgid "" -"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in the :mod:" -"`glob` module; they are now about 3--6 times faster. (Contributed by Serhiy " -"Storchaka in :issue:`25596`)." +"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in " +"the :mod:`glob` module; they are now about 3--6 times faster. (Contributed " +"by Serhiy Storchaka in :issue:`25596`)." msgstr "" #: ../../whatsnew/3.6.rst:1849 msgid "" "Optimized globbing in :mod:`pathlib` by using :func:`os.scandir`; it is now " -"about 1.5--4 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`26032`)." +"about 1.5--4 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`26032`)." msgstr "" #: ../../whatsnew/3.6.rst:1853 msgid "" ":class:`xml.etree.ElementTree` parsing, iteration and deepcopy performance " -"has been significantly improved. (Contributed by Serhiy Storchaka in :issue:" -"`25638`, :issue:`25873`, and :issue:`25869`.)" +"has been significantly improved. (Contributed by Serhiy Storchaka " +"in :issue:`25638`, :issue:`25873`, and :issue:`25869`.)" msgstr "" #: ../../whatsnew/3.6.rst:1858 msgid "" "Creation of :class:`fractions.Fraction` instances from floats and decimals " -"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`25971`.)" +"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`25971`.)" msgstr "" #: ../../whatsnew/3.6.rst:1864 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.6.rst:1866 msgid "" "Python now requires some C99 support in the toolchain to build. Most " "notably, Python now uses standard integer types and macros in place of " -"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` and :" -"issue:`17884`." +"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` " +"and :issue:`17884`." msgstr "" #: ../../whatsnew/3.6.rst:1871 @@ -2770,8 +2782,8 @@ msgid "" "Cross-compiling CPython with the Android NDK and the Android API level set " "to 21 (Android 5.0 Lollipop) or greater runs successfully. While Android is " "not yet a supported platform, the Python test suite runs on the Android " -"emulator with only about 16 tests failures. See the Android meta-issue :" -"issue:`26865`." +"emulator with only about 16 tests failures. See the Android meta-" +"issue :issue:`26865`." msgstr "" #: ../../whatsnew/3.6.rst:1876 @@ -2818,8 +2830,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1901 msgid "" -"The new :c:func:`PyErr_ResourceWarning` function can be used to generate a :" -"exc:`ResourceWarning` providing the source of the resource allocation. " +"The new :c:func:`PyErr_ResourceWarning` function can be used to generate " +"a :exc:`ResourceWarning` providing the source of the resource allocation. " "(Contributed by Victor Stinner in :issue:`26567`.)" msgstr "" @@ -2838,7 +2850,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:1914 msgid "Other Improvements" -msgstr "" +msgstr "其他改進" #: ../../whatsnew/3.6.rst:1916 msgid "" @@ -2888,16 +2900,16 @@ msgid "" "The :meth:`__aiter__` method is now expected to return an asynchronous " "iterator directly instead of returning an awaitable as previously. Doing the " "former will trigger a :exc:`DeprecationWarning`. Backward compatibility " -"will be removed in Python 3.7. (Contributed by Yury Selivanov in :issue:" -"`27243`.)" +"will be removed in Python 3.7. (Contributed by Yury Selivanov " +"in :issue:`27243`.)" msgstr "" #: ../../whatsnew/3.6.rst:1951 msgid "" "A backslash-character pair that is not a valid escape sequence now generates " -"a :exc:`DeprecationWarning`. Although this will eventually become a :exc:" -"`SyntaxError`, that will not be for several Python releases. (Contributed by " -"Emanuel Barry in :issue:`27364`.)" +"a :exc:`DeprecationWarning`. Although this will eventually become " +"a :exc:`SyntaxError`, that will not be for several Python releases. " +"(Contributed by Emanuel Barry in :issue:`27364`.)" msgstr "" #: ../../whatsnew/3.6.rst:1956 @@ -2948,8 +2960,8 @@ msgstr "" msgid "" "The undocumented ``extra_path`` argument to the ``distutils.Distribution`` " "constructor is now considered deprecated and will raise a warning if set. " -"Support for this parameter will be removed in a future Python release. See :" -"issue:`27919` for details." +"Support for this parameter will be removed in a future Python release. " +"See :issue:`27919` for details." msgstr "" #: ../../whatsnew/3.6.rst:1999 @@ -2964,12 +2976,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:2009 msgid "" -"The :meth:`importlib.machinery.SourceFileLoader.load_module` and :meth:" -"`importlib.machinery.SourcelessFileLoader.load_module` methods are now " -"deprecated. They were the only remaining implementations of :meth:`importlib." -"abc.Loader.load_module` in :mod:`importlib` that had not been deprecated in " -"previous versions of Python in favour of :meth:`importlib.abc.Loader." -"exec_module`." +"The :meth:`importlib.machinery.SourceFileLoader.load_module` " +"and :meth:`importlib.machinery.SourcelessFileLoader.load_module` methods are " +"now deprecated. They were the only remaining implementations " +"of :meth:`importlib.abc.Loader.load_module` in :mod:`importlib` that had not " +"been deprecated in previous versions of Python in favour " +"of :meth:`importlib.abc.Loader.exec_module`." msgstr "" #: ../../whatsnew/3.6.rst:2016 @@ -2983,8 +2995,8 @@ msgstr "" msgid "" "Undocumented support of general :term:`bytes-like objects <bytes-like " "object>` as paths in :mod:`os` functions, :func:`compile` and similar " -"functions is now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`25791` and :issue:`26754`.)" +"functions is now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`25791` and :issue:`26754`.)" msgstr "" #: ../../whatsnew/3.6.rst:2031 @@ -3005,9 +3017,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2043 msgid "" "SSL-related arguments like ``certfile``, ``keyfile`` and ``check_hostname`` " -"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, and :" -"mod:`smtplib` have been deprecated in favor of ``context``. (Contributed by " -"Christian Heimes in :issue:`28022`.)" +"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, " +"and :mod:`smtplib` have been deprecated in favor of ``context``. " +"(Contributed by Christian Heimes in :issue:`28022`.)" msgstr "" #: ../../whatsnew/3.6.rst:2048 @@ -3038,9 +3050,10 @@ msgstr "xml" #: ../../whatsnew/3.6.rst:2073 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" #: ../../whatsnew/3.6.rst:2080 @@ -3050,9 +3063,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2082 msgid "" "Undocumented functions :c:func:`!PyUnicode_AsEncodedObject`, :c:func:`!" -"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` and :c:" -"func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use the :ref:`generic " -"codec based API <codec-registry>` instead." +"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` " +"and :c:func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use " +"the :ref:`generic codec based API <codec-registry>` instead." msgstr "" #: ../../whatsnew/3.6.rst:2089 @@ -3074,46 +3087,46 @@ msgstr "已移除" #: ../../whatsnew/3.6.rst:2102 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.6.rst:2104 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter in regular " -"expressions will now cause an error. In replacement templates for :func:`re." -"sub` they are still allowed, but deprecated. The :const:`re.LOCALE` flag can " -"now only be used with binary patterns." +"expressions will now cause an error. In replacement templates " +"for :func:`re.sub` they are still allowed, but deprecated. " +"The :const:`re.LOCALE` flag can now only be used with binary patterns." msgstr "" #: ../../whatsnew/3.6.rst:2109 msgid "" -"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :" -"func:`inspect.getmodulename` should be used for obtaining the module name " -"for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" +"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython " +"3.3). :func:`inspect.getmodulename` should be used for obtaining the module " +"name for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" msgstr "" #: ../../whatsnew/3.6.rst:2114 msgid "" "``traceback.Ignore`` class and ``traceback.usage``, ``traceback.modname``, " -"``traceback.fullmodname``, ``traceback.find_lines_from_code``, ``traceback." -"find_lines``, ``traceback.find_strings``, ``traceback." -"find_executable_lines`` methods were removed from the :mod:`traceback` " -"module. They were undocumented methods deprecated since Python 3.2 and " -"equivalent functionality is available from private methods." +"``traceback.fullmodname``, ``traceback.find_lines_from_code``, " +"``traceback.find_lines``, ``traceback.find_strings``, " +"``traceback.find_executable_lines`` methods were removed from " +"the :mod:`traceback` module. They were undocumented methods deprecated since " +"Python 3.2 and equivalent functionality is available from private methods." msgstr "" #: ../../whatsnew/3.6.rst:2121 msgid "" -"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods in :mod:" -"`tkinter` widget classes were removed (corresponding Tk commands were " -"obsolete since Tk 4.0)." +"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods " +"in :mod:`tkinter` widget classes were removed (corresponding Tk commands " +"were obsolete since Tk 4.0)." msgstr "" #: ../../whatsnew/3.6.rst:2125 msgid "" "The :meth:`~zipfile.ZipFile.open` method of the :class:`zipfile.ZipFile` " "class no longer supports the ``'U'`` mode (was deprecated since Python 3.4). " -"Use :class:`io.TextIOWrapper` for reading compressed text files in :term:" -"`universal newlines` mode." +"Use :class:`io.TextIOWrapper` for reading compressed text files " +"in :term:`universal newlines` mode." msgstr "" #: ../../whatsnew/3.6.rst:2130 @@ -3150,19 +3163,19 @@ msgid "" "The output of a special Python build with defined ``COUNT_ALLOCS``, " "``SHOW_ALLOC_COUNT`` or ``SHOW_TRACK_COUNT`` macros is now off by default. " "It can be re-enabled using the ``-X showalloccount`` option. It now outputs " -"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka in :" -"issue:`23034`.)" +"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka " +"in :issue:`23034`.)" msgstr "" #: ../../whatsnew/3.6.rst:2158 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.6.rst:2160 msgid "" ":func:`open() <open>` will no longer allow combining the ``'U'`` mode flag " -"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor in :issue:" -"`2091`.)" +"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor " +"in :issue:`2091`.)" msgstr "" #: ../../whatsnew/3.6.rst:2164 @@ -3179,8 +3192,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2170 msgid "" -"When :meth:`importlib.abc.Loader.exec_module` is defined, :meth:`importlib." -"abc.Loader.create_module` must also be defined." +"When :meth:`importlib.abc.Loader.exec_module` is " +"defined, :meth:`importlib.abc.Loader.create_module` must also be defined." msgstr "" #: ../../whatsnew/3.6.rst:2173 @@ -3193,13 +3206,14 @@ msgstr "" msgid "" "The format of the :attr:`~codeobject.co_lnotab` attribute of code objects " "changed to support a negative line number delta. By default, Python does not " -"emit bytecode with a negative line number delta. Functions using :attr:" -"`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or ``PyCode_Addr2Line()`` are " -"not affected. Functions directly decoding :attr:`!co_lnotab` should be " -"updated to use a signed 8-bit integer type for the line number delta, but " -"this is only required to support applications using a negative line number " -"delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!co_lnotab` format " -"and how to decode it, and see the :pep:`511` for the rationale." +"emit bytecode with a negative line number delta. Functions " +"using :attr:`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or " +"``PyCode_Addr2Line()`` are not affected. Functions directly decoding :attr:`!" +"co_lnotab` should be updated to use a signed 8-bit integer type for the line " +"number delta, but this is only required to support applications using a " +"negative line number delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!" +"co_lnotab` format and how to decode it, and see the :pep:`511` for the " +"rationale." msgstr "" #: ../../whatsnew/3.6.rst:2187 @@ -3212,28 +3226,26 @@ msgstr "" #: ../../whatsnew/3.6.rst:2192 msgid "" -"Reading the :attr:`~urllib.parse.SplitResult.port` attribute of :func:" -"`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results now " -"raises :exc:`ValueError` for out-of-range values, rather than returning :" -"const:`None`. See :issue:`20059`." +"Reading the :attr:`~urllib.parse.SplitResult.port` attribute " +"of :func:`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results " +"now raises :exc:`ValueError` for out-of-range values, rather than " +"returning :const:`None`. See :issue:`20059`." msgstr "" #: ../../whatsnew/3.6.rst:2197 msgid "" -"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`." +"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead " +"of :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.6.rst:2200 msgid "" "The following modules have had missing APIs added to their :attr:`__all__` " -"attributes to match the documented APIs: :mod:`calendar`, :mod:`!cgi`, :mod:" -"`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:" -"`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:" -"`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:`subprocess`, :mod:" -"`tarfile`, :mod:`threading` and :mod:`wave`. This means they will export " -"new symbols when ``import *`` is used. (Contributed by Joel Taddei and Jacek " -"Kołodziej in :issue:`23883`.)" +"attributes to match the documented APIs: :mod:`calendar`, :mod:`!" +"cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`!" +"smtpd`, :mod:`subprocess`, :mod:`tarfile`, :mod:`threading` " +"and :mod:`wave`. This means they will export new symbols when ``import *`` " +"is used. (Contributed by Joel Taddei and Jacek Kołodziej in :issue:`23883`.)" msgstr "" #: ../../whatsnew/3.6.rst:2211 @@ -3245,26 +3257,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2215 msgid "" -"When a relative import is performed and no parent package is known, then :" -"exc:`ImportError` will be raised. Previously, :exc:`SystemError` could be " -"raised. (Contributed by Brett Cannon in :issue:`18018`.)" +"When a relative import is performed and no parent package is known, " +"then :exc:`ImportError` will be raised. Previously, :exc:`SystemError` could " +"be raised. (Contributed by Brett Cannon in :issue:`18018`.)" msgstr "" #: ../../whatsnew/3.6.rst:2219 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now only catch exceptions derived from :exc:`Exception`. Therefore if a " -"request handler raises an exception like :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` is no " -"longer called, and the exception will stop a single-threaded server. " +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now only catch exceptions derived " +"from :exc:`Exception`. Therefore if a request handler raises an exception " +"like :exc:`SystemExit` " +"or :exc:`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` " +"is no longer called, and the exception will stop a single-threaded server. " "(Contributed by Martin Panter in :issue:`23430`.)" msgstr "" #: ../../whatsnew/3.6.rst:2228 msgid "" -":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" -"`KeyError` if the user doesn't have privileges." +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead " +"of :exc:`KeyError` if the user doesn't have privileges." msgstr "" #: ../../whatsnew/3.6.rst:2231 @@ -3286,11 +3299,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:2243 msgid "" -"All optional arguments of the :func:`~json.dump`, :func:`~json.dumps`, :func:" -"`~json.load` and :func:`~json.loads` functions and :class:`~json." -"JSONEncoder` and :class:`~json.JSONDecoder` class constructors in the :mod:" -"`json` module are now :ref:`keyword-only <keyword-only_parameter>`. " -"(Contributed by Serhiy Storchaka in :issue:`18726`.)" +"All optional arguments of " +"the :func:`~json.dump`, :func:`~json.dumps`, :func:`~json.load` " +"and :func:`~json.loads` functions and :class:`~json.JSONEncoder` " +"and :class:`~json.JSONDecoder` class constructors in the :mod:`json` module " +"are now :ref:`keyword-only <keyword-only_parameter>`. (Contributed by Serhiy " +"Storchaka in :issue:`18726`.)" msgstr "" #: ../../whatsnew/3.6.rst:2250 @@ -3301,14 +3315,15 @@ msgstr "" #: ../../whatsnew/3.6.rst:2253 msgid "" -"As part of :pep:`487`, the handling of keyword arguments passed to :class:" -"`type` (other than the metaclass hint, ``metaclass``) is now consistently " -"delegated to :meth:`object.__init_subclass__`. This means that :meth:`type." -"__new__` and :meth:`type.__init__` both now accept arbitrary keyword " -"arguments, but :meth:`object.__init_subclass__` (which is called from :meth:" -"`type.__new__`) will reject them by default. Custom metaclasses accepting " -"additional keyword arguments will need to adjust their calls to :meth:`type." -"__new__` (whether direct or via :class:`super`) accordingly." +"As part of :pep:`487`, the handling of keyword arguments passed " +"to :class:`type` (other than the metaclass hint, ``metaclass``) is now " +"consistently delegated to :meth:`object.__init_subclass__`. This means " +"that :meth:`type.__new__` and :meth:`type.__init__` both now accept " +"arbitrary keyword arguments, but :meth:`object.__init_subclass__` (which is " +"called from :meth:`type.__new__`) will reject them by default. Custom " +"metaclasses accepting additional keyword arguments will need to adjust their " +"calls to :meth:`type.__new__` (whether direct or via :class:`super`) " +"accordingly." msgstr "" #: ../../whatsnew/3.6.rst:2262 @@ -3337,26 +3352,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2278 msgid "" -"In the :mod:`urllib.request` module and the :meth:`http.client." -"HTTPConnection.request` method, if no Content-Length header field has been " -"specified and the request body is a file object, it is now sent with HTTP " -"1.1 chunked encoding. If a file object has to be sent to a HTTP 1.0 server, " -"the Content-Length value now has to be specified by the caller. (Contributed " -"by Demian Brecht and Rolf Krahl with tweaks from Martin Panter in :issue:" -"`12319`.)" +"In the :mod:`urllib.request` module and " +"the :meth:`http.client.HTTPConnection.request` method, if no Content-Length " +"header field has been specified and the request body is a file object, it is " +"now sent with HTTP 1.1 chunked encoding. If a file object has to be sent to " +"a HTTP 1.0 server, the Content-Length value now has to be specified by the " +"caller. (Contributed by Demian Brecht and Rolf Krahl with tweaks from Martin " +"Panter in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:2287 msgid "" -"The :class:`~csv.DictReader` now returns rows of type :class:`~collections." -"OrderedDict`. (Contributed by Steve Holden in :issue:`27842`.)" +"The :class:`~csv.DictReader` now returns rows of " +"type :class:`~collections.OrderedDict`. (Contributed by Steve Holden " +"in :issue:`27842`.)" msgstr "" #: ../../whatsnew/3.6.rst:2291 msgid "" -"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." -"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" -"issue:`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to " +"``crypt.methods`` if unsupported by the platform. (Contributed by Victor " +"Stinner in :issue:`25287`.)" msgstr "" #: ../../whatsnew/3.6.rst:2299 @@ -3375,8 +3391,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2308 msgid "" "The :func:`mmap.write() <mmap.write>` function now returns the number of " -"bytes written like other write methods. (Contributed by Jakub Stasiak in :" -"issue:`26335`.)" +"bytes written like other write methods. (Contributed by Jakub Stasiak " +"in :issue:`26335`.)" msgstr "" #: ../../whatsnew/3.6.rst:2312 @@ -3401,8 +3417,8 @@ msgid "" "unrecognized compression values. Previously a plain :exc:`RuntimeError` was " "raised. Additionally, calling :class:`~zipfile.ZipFile` methods on a closed " "ZipFile or calling the :meth:`~zipfile.ZipFile.write` method on a ZipFile " -"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, a :exc:" -"`RuntimeError` was raised in those scenarios." +"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, " +"a :exc:`RuntimeError` was raised in those scenarios." msgstr "" #: ../../whatsnew/3.6.rst:2329 @@ -3419,13 +3435,14 @@ msgstr "" msgid "" "With the introduction of :exc:`ModuleNotFoundError`, import system consumers " "may start expecting import system replacements to raise that more specific " -"exception when appropriate, rather than the less-specific :exc:" -"`ImportError`. To provide future compatibility with such consumers, " -"implementers of alternative import systems that completely replace :func:" -"`__import__` will need to update their implementations to raise the new " -"subclass when a module can't be found at all. Implementers of compliant " -"plugins to the default import system shouldn't need to make any changes, as " -"the default import system will raise the new subclass when appropriate." +"exception when appropriate, rather than the less-" +"specific :exc:`ImportError`. To provide future compatibility with such " +"consumers, implementers of alternative import systems that completely " +"replace :func:`__import__` will need to update their implementations to " +"raise the new subclass when a module can't be found at all. Implementers of " +"compliant plugins to the default import system shouldn't need to make any " +"changes, as the default import system will raise the new subclass when " +"appropriate." msgstr "" #: ../../whatsnew/3.6.rst:2348 @@ -3467,15 +3484,15 @@ msgstr "" msgid "" "The new :opcode:`!FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part " "of the :ref:`formatted string literal <whatsnew36-pep498>` implementation. " -"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka in :issue:" -"`27078`.)" +"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka " +"in :issue:`27078`.)" msgstr "" #: ../../whatsnew/3.6.rst:2374 msgid "" "The new :opcode:`BUILD_CONST_KEY_MAP` opcode to optimize the creation of " -"dictionaries with constant keys. (Contributed by Serhiy Storchaka in :issue:" -"`27140`.)" +"dictionaries with constant keys. (Contributed by Serhiy Storchaka " +"in :issue:`27140`.)" msgstr "" #: ../../whatsnew/3.6.rst:2378 @@ -3483,11 +3500,11 @@ msgid "" "The function call opcodes have been heavily reworked for better performance " "and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:`!" "CALL_FUNCTION`, :opcode:`!CALL_FUNCTION_KW` and :opcode:`!" -"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" -"`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` have been " -"added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " -"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed in :" -"issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" +"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the " +"new :opcode:`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` " +"have been added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " +"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed " +"in :issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" msgstr "" #: ../../whatsnew/3.6.rst:2389 @@ -3522,8 +3539,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2409 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.6.rst:2412 ../../whatsnew/3.6.rst:2425 @@ -3553,8 +3570,8 @@ msgstr "Python 3.6.4 中顯著的變更" msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. (Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`.)" +"during finalization of the interpreter. (Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`.)" msgstr "" #: ../../whatsnew/3.6.rst:2440 @@ -3592,12 +3609,12 @@ msgstr "Python 3.6.10 中顯著的變更" #: ../../whatsnew/3.6.rst:2461 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.6.rst:2469 @@ -3607,13 +3624,14 @@ msgstr "Python 3.6.13 中顯著的變更" #: ../../whatsnew/3.6.rst:2471 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.6.rst:2482 @@ -3635,6 +3653,6 @@ msgid "" "forms of attacks. Following the WHATWG specification that updates RFC 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"removal characters are controlled by a new module level variable " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 6e6f30678a..25a4bd766c 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -29,8 +29,8 @@ msgstr "Elvis Pranskevichus <elvis@magic.io>" #: ../../whatsnew/3.7.rst:47 msgid "" "This article explains the new features in Python 3.7, compared to 3.6. " -"Python 3.7 was released on June 27, 2018. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.7 was released on June 27, 2018. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.7 與 3.6 相比多了哪些新功能。Python 3.7 已於 2018 年 6 " "月 27 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -58,7 +58,7 @@ msgstr ":keyword:`async` 和 :keyword:`await` 現為保留關鍵字。" #: ../../whatsnew/3.7.rst:66 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.7.rst:68 msgid "" @@ -111,8 +111,9 @@ msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.7.rst:92 msgid "" -"The :mod:`asyncio` module has received new features, significant :ref:" -"`usability and performance improvements <whatsnew37_asyncio>`." +"The :mod:`asyncio` module has received new features, " +"significant :ref:`usability and performance improvements " +"<whatsnew37_asyncio>`." msgstr "" #: ../../whatsnew/3.7.rst:95 @@ -123,7 +124,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:98 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.7.rst:100 msgid "Avoiding the use of ASCII as a default text encoding:" @@ -170,14 +171,14 @@ msgstr "" #: ../../whatsnew/3.7.rst:116 msgid "" "New documentation translations: `Japanese <https://docs.python.org/ja/>`_, " -"`French <https://docs.python.org/fr/>`_, and `Korean <https://docs.python." -"org/ko/>`_." +"`French <https://docs.python.org/fr/>`_, and `Korean <https://" +"docs.python.org/ko/>`_." msgstr "" #: ../../whatsnew/3.7.rst:120 msgid "" -"This release features notable performance improvements in many areas. The :" -"ref:`whatsnew37-perf` section lists them in detail." +"This release features notable performance improvements in many areas. " +"The :ref:`whatsnew37-perf` section lists them in detail." msgstr "" #: ../../whatsnew/3.7.rst:123 @@ -192,7 +193,7 @@ msgstr "新增功能" #: ../../whatsnew/3.7.rst:133 msgid "PEP 563: Postponed Evaluation of Annotations" -msgstr "" +msgstr "PEP 563:延後評估註釋" #: ../../whatsnew/3.7.rst:135 msgid "" @@ -295,9 +296,9 @@ msgid "" "automatically coerce that locale to an available UTF-8 based locale as " "described in the documentation of the new :envvar:`PYTHONCOERCECLOCALE` " "environment variable. Automatically setting ``LC_CTYPE`` this way means that " -"both the core interpreter and locale-aware C extensions (such as :mod:" -"`readline`) will assume the use of UTF-8 as the default text encoding, " -"rather than ASCII." +"both the core interpreter and locale-aware C extensions (such " +"as :mod:`readline`) will assume the use of UTF-8 as the default text " +"encoding, rather than ASCII." msgstr "" #: ../../whatsnew/3.7.rst:200 @@ -310,16 +311,17 @@ msgstr "" msgid "" "As part of this change, the default error handler for :data:`~sys.stdin` " "and :data:`~sys.stdout` is now ``surrogateescape`` (rather than ``strict``) " -"when using any of the defined coercion target locales (currently ``C." -"UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler for :data:" -"`~sys.stderr` continues to be ``backslashreplace``, regardless of locale." +"when using any of the defined coercion target locales (currently " +"``C.UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler " +"for :data:`~sys.stderr` continues to be ``backslashreplace``, regardless of " +"locale." msgstr "" #: ../../whatsnew/3.7.rst:209 msgid "" "Locale coercion is silent by default, but to assist in debugging potentially " -"locale related integration problems, explicit warnings (emitted directly on :" -"data:`~sys.stderr`) can be requested by setting " +"locale related integration problems, explicit warnings (emitted directly " +"on :data:`~sys.stderr`) can be requested by setting " "``PYTHONCOERCECLOCALE=warn``. This setting will also cause the Python " "runtime to emit a warning if the legacy C locale remains active when the " "core interpreter is initialized." @@ -358,8 +360,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:238 msgid "" "When in UTF-8 mode, CPython ignores the locale settings, and uses the UTF-8 " -"encoding by default. The error handlers for :data:`sys.stdin` and :data:" -"`sys.stdout` streams are set to ``surrogateescape``." +"encoding by default. The error handlers for :data:`sys.stdin` " +"and :data:`sys.stdout` streams are set to ``surrogateescape``." msgstr "" #: ../../whatsnew/3.7.rst:242 @@ -410,9 +412,10 @@ msgid "" "Built-in ``breakpoint()`` calls :func:`sys.breakpointhook`. By default, the " "latter imports :mod:`pdb` and then calls ``pdb.set_trace()``, but by binding " "``sys.breakpointhook()`` to the function of your choosing, ``breakpoint()`` " -"can enter any debugger. Additionally, the environment variable :envvar:" -"`PYTHONBREAKPOINT` can be set to the callable of your debugger of choice. " -"Set ``PYTHONBREAKPOINT=0`` to completely disable built-in ``breakpoint()``." +"can enter any debugger. Additionally, the environment " +"variable :envvar:`PYTHONBREAKPOINT` can be set to the callable of your " +"debugger of choice. Set ``PYTHONBREAKPOINT=0`` to completely disable built-" +"in ``breakpoint()``." msgstr "" #: ../../whatsnew/3.7.rst:282 @@ -441,11 +444,11 @@ msgid "" ":pep:`539` changes this by providing a new :ref:`Thread Specific Storage " "(TSS) API <thread-specific-storage-api>` to CPython which supersedes use of " "the existing TLS API within the CPython interpreter, while deprecating the " -"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead of :c:" -"expr:`int` to represent TSS keys--an opaque type the definition of which may " -"depend on the underlying TLS implementation. Therefore, this will allow to " -"build CPython on platforms where the native TLS key is defined in a way that " -"cannot be safely cast to :c:expr:`int`." +"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead " +"of :c:expr:`int` to represent TSS keys--an opaque type the definition of " +"which may depend on the underlying TLS implementation. Therefore, this will " +"allow to build CPython on platforms where the native TLS key is defined in a " +"way that cannot be safely cast to :c:expr:`int`." msgstr "" #: ../../whatsnew/3.7.rst:306 @@ -472,8 +475,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:323 msgid "" "Python 3.7 allows defining :meth:`__getattr__` on modules and will call it " -"whenever a module attribute is otherwise not found. Defining :meth:" -"`__dir__` on modules is now also allowed." +"whenever a module attribute is otherwise not found. " +"Defining :meth:`__dir__` on modules is now also allowed." msgstr "" #: ../../whatsnew/3.7.rst:327 @@ -587,10 +590,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:393 msgid "" -"Previously both :exc:`DeprecationWarning` and :exc:" -"`PendingDeprecationWarning` were only visible when running tests, which " -"meant that developers primarily writing single file scripts or using Python " -"interactively could be surprised by breaking changes in the APIs they used." +"Previously both :exc:`DeprecationWarning` " +"and :exc:`PendingDeprecationWarning` were only visible when running tests, " +"which meant that developers primarily writing single file scripts or using " +"Python interactively could be surprised by breaking changes in the APIs they " +"used." msgstr "" #: ../../whatsnew/3.7.rst:400 @@ -608,14 +612,14 @@ msgstr "" #: ../../whatsnew/3.7.rst:409 msgid "" "Initially :pep:`484` was designed in such way that it would not introduce " -"*any* changes to the core CPython interpreter. Now type hints and the :mod:" -"`typing` module are extensively used by the community, so this restriction " -"is removed. The PEP introduces two special methods :meth:`__class_getitem__` " -"and ``__mro_entries__``, these methods are now used by most classes and " -"special constructs in :mod:`typing`. As a result, the speed of various " -"operations with types increased up to 7 times, the generic types can be used " -"without metaclass conflicts, and several long standing bugs in :mod:`typing` " -"module are fixed." +"*any* changes to the core CPython interpreter. Now type hints and " +"the :mod:`typing` module are extensively used by the community, so this " +"restriction is removed. The PEP introduces two special " +"methods :meth:`__class_getitem__` and ``__mro_entries__``, these methods are " +"now used by most classes and special constructs in :mod:`typing`. As a " +"result, the speed of various operations with types increased up to 7 times, " +"the generic types can be used without metaclass conflicts, and several long " +"standing bugs in :mod:`typing` module are fixed." msgstr "" #: ../../whatsnew/3.7.rst:421 @@ -644,8 +648,8 @@ msgid "" "used for invalidation instead of the source timestamp. Such ``.pyc`` files " "are called \"hash-based\". By default, Python still uses timestamp-based " "invalidation and does not generate hash-based ``.pyc`` files at runtime. " -"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` or :mod:" -"`compileall`." +"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` " +"or :mod:`compileall`." msgstr "" #: ../../whatsnew/3.7.rst:445 @@ -712,12 +716,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:486 msgid "" -"The new :option:`-X` ``dev`` command line option or the new :envvar:" -"`PYTHONDEVMODE` environment variable can be used to enable :ref:`Python " -"Development Mode <devmode>`. When in development mode, Python performs " -"additional runtime checks that are too expensive to be enabled by default. " -"See :ref:`Python Development Mode <devmode>` documentation for the full " -"description." +"The new :option:`-X` ``dev`` command line option or the " +"new :envvar:`PYTHONDEVMODE` environment variable can be used to " +"enable :ref:`Python Development Mode <devmode>`. When in development mode, " +"Python performs additional runtime checks that are too expensive to be " +"enabled by default. See :ref:`Python Development Mode <devmode>` " +"documentation for the full description." msgstr "" #: ../../whatsnew/3.7.rst:495 @@ -726,17 +730,17 @@ msgstr "其他語言更動" #: ../../whatsnew/3.7.rst:497 msgid "" -"An :keyword:`await` expression and comprehensions containing an :keyword:" -"`async for` clause were illegal in the expressions in :ref:`formatted string " -"literals <f-strings>` due to a problem with the implementation. In Python " -"3.7 this restriction was lifted." +"An :keyword:`await` expression and comprehensions containing " +"an :keyword:`async for` clause were illegal in the expressions " +"in :ref:`formatted string literals <f-strings>` due to a problem with the " +"implementation. In Python 3.7 this restriction was lifted." msgstr "" #: ../../whatsnew/3.7.rst:502 msgid "" "More than 255 arguments can now be passed to a function, and a function can " -"now have more than 255 parameters. (Contributed by Serhiy Storchaka in :" -"issue:`12844` and :issue:`18896`.)" +"now have more than 255 parameters. (Contributed by Serhiy Storchaka " +"in :issue:`12844` and :issue:`18896`.)" msgstr "" #: ../../whatsnew/3.7.rst:506 @@ -756,8 +760,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:514 msgid "" ":exc:`ImportError` now displays module name and module ``__file__`` path " -"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier in :" -"issue:`29546`.)" +"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier " +"in :issue:`29546`.)" msgstr "" #: ../../whatsnew/3.7.rst:518 @@ -769,16 +773,17 @@ msgstr "" #: ../../whatsnew/3.7.rst:522 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " -"``format(str(self), '')``. (Contributed by Serhiy Storchaka in :issue:" -"`28974`.)" +"``format(str(self), '')``. (Contributed by Serhiy Storchaka " +"in :issue:`28974`.)" msgstr "" #: ../../whatsnew/3.7.rst:526 msgid "" -"In order to better support dynamic creation of stack traces, :class:`types." -"TracebackType` can now be instantiated from Python code, and the :attr:" -"`~traceback.tb_next` attribute on :ref:`tracebacks <traceback-objects>` is " -"now writable. (Contributed by Nathaniel J. Smith in :issue:`30579`.)" +"In order to better support dynamic creation of stack " +"traces, :class:`types.TracebackType` can now be instantiated from Python " +"code, and the :attr:`~traceback.tb_next` attribute on :ref:`tracebacks " +"<traceback-objects>` is now writable. (Contributed by Nathaniel J. Smith " +"in :issue:`30579`.)" msgstr "" #: ../../whatsnew/3.7.rst:532 @@ -791,9 +796,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:538 msgid "" -"The new :option:`-X` ``importtime`` option or the :envvar:" -"`PYTHONPROFILEIMPORTTIME` environment variable can be used to show the " -"timing of each module import. (Contributed by Inada Naoki in :issue:`31415`.)" +"The new :option:`-X` ``importtime`` option or " +"the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable can be used to " +"show the timing of each module import. (Contributed by Inada Naoki " +"in :issue:`31415`.)" msgstr "" #: ../../whatsnew/3.7.rst:545 @@ -836,9 +842,9 @@ msgstr "dataclasses" msgid "" "The new :func:`~dataclasses.dataclass` decorator provides a way to declare " "*data classes*. A data class describes its attributes using class variable " -"annotations. Its constructor and other magic methods, such as :meth:" -"`~object.__repr__`, :meth:`~object.__eq__`, and :meth:`~object.__hash__` are " -"generated automatically." +"annotations. Its constructor and other magic methods, such " +"as :meth:`~object.__repr__`, :meth:`~object.__eq__`, " +"and :meth:`~object.__hash__` are generated automatically." msgstr "" #: ../../whatsnew/3.7.rst:580 @@ -874,15 +880,15 @@ msgid "" "The new :mod:`importlib.resources` module provides several new APIs and one " "new ABC for access to, opening, and reading *resources* inside packages. " "Resources are roughly similar to files inside packages, but they needn't be " -"actual files on the physical file system. Module loaders can provide a :" -"meth:`get_resource_reader` function which returns a :class:`importlib.abc." -"ResourceReader` instance to support this new API. Built-in file path " -"loaders and zip file loaders both support this." +"actual files on the physical file system. Module loaders can provide " +"a :meth:`get_resource_reader` function which returns " +"a :class:`importlib.abc.ResourceReader` instance to support this new API. " +"Built-in file path loaders and zip file loaders both support this." msgstr "" #: ../../whatsnew/3.7.rst:610 msgid "Contributed by Barry Warsaw and Brett Cannon in :issue:`32248`." -msgstr "" +msgstr "由 Barry Warsaw 與 Brett Cannon 在 :issue:`32248` 中貢獻。" #: ../../whatsnew/3.7.rst:614 msgid "" @@ -900,9 +906,9 @@ msgstr "argparse" #: ../../whatsnew/3.7.rst:625 msgid "" -"The new :meth:`ArgumentParser.parse_intermixed_args() <argparse." -"ArgumentParser.parse_intermixed_args>` method allows intermixing options and " -"positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" +"The new :meth:`ArgumentParser.parse_intermixed_args() " +"<argparse.ArgumentParser.parse_intermixed_args>` method allows intermixing " +"options and positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" msgstr "" #: ../../whatsnew/3.7.rst:634 ../../whatsnew/3.7.rst:1964 @@ -911,29 +917,29 @@ msgstr "asyncio" #: ../../whatsnew/3.7.rst:636 msgid "" -"The :mod:`asyncio` module has received many new features, usability and :ref:" -"`performance improvements <whatsnew37-asyncio-perf>`. Notable changes " -"include:" +"The :mod:`asyncio` module has received many new features, usability " +"and :ref:`performance improvements <whatsnew37-asyncio-perf>`. Notable " +"changes include:" msgstr "" #: ../../whatsnew/3.7.rst:640 msgid "" "The new :term:`provisional <provisional API>` :func:`asyncio.run` function " "can be used to run a coroutine from synchronous code by automatically " -"creating and destroying the event loop. (Contributed by Yury Selivanov in :" -"issue:`32314`.)" +"creating and destroying the event loop. (Contributed by Yury Selivanov " +"in :issue:`32314`.)" msgstr "" #: ../../whatsnew/3.7.rst:645 msgid "" "asyncio gained support for :mod:`contextvars`. :meth:`loop.call_soon() " -"<asyncio.loop.call_soon>`, :meth:`loop.call_soon_threadsafe() <asyncio.loop." -"call_soon_threadsafe>`, :meth:`loop.call_later() <asyncio.loop." -"call_later>`, :meth:`loop.call_at() <asyncio.loop.call_at>`, and :meth:" -"`Future.add_done_callback() <asyncio.Future.add_done_callback>` have a new " -"optional keyword-only *context* parameter. :class:`Tasks <asyncio.Task>` now " -"track their context automatically. See :pep:`567` for more details. " -"(Contributed by Yury Selivanov in :issue:`32436`.)" +"<asyncio.loop.call_soon>`, :meth:`loop.call_soon_threadsafe() " +"<asyncio.loop.call_soon_threadsafe>`, :meth:`loop.call_later() " +"<asyncio.loop.call_later>`, :meth:`loop.call_at() <asyncio.loop.call_at>`, " +"and :meth:`Future.add_done_callback() <asyncio.Future.add_done_callback>` " +"have a new optional keyword-only *context* parameter. :class:`Tasks " +"<asyncio.Task>` now track their context automatically. See :pep:`567` for " +"more details. (Contributed by Yury Selivanov in :issue:`32436`.)" msgstr "" #: ../../whatsnew/3.7.rst:656 @@ -946,25 +952,26 @@ msgstr "" #: ../../whatsnew/3.7.rst:660 msgid "" "The new :meth:`loop.start_tls() <asyncio.loop.start_tls>` method can be used " -"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov in :" -"issue:`23749`.)" +"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov " +"in :issue:`23749`.)" msgstr "" #: ../../whatsnew/3.7.rst:664 msgid "" "The new :meth:`loop.sock_recv_into() <asyncio.loop.sock_recv_into>` method " "allows reading data from a socket directly into a provided buffer making it " -"possible to reduce data copies. (Contributed by Antoine Pitrou in :issue:" -"`31819`.)" +"possible to reduce data copies. (Contributed by Antoine Pitrou " +"in :issue:`31819`.)" msgstr "" #: ../../whatsnew/3.7.rst:669 msgid "" -"The new :func:`asyncio.current_task` function returns the currently running :" -"class:`~asyncio.Task` instance, and the new :func:`asyncio.all_tasks` " -"function returns a set of all existing ``Task`` instances in a given loop. " -"The :meth:`!Task.current_task` and :meth:`!Task.all_tasks` methods have been " -"deprecated. (Contributed by Andrew Svetlov in :issue:`32250`.)" +"The new :func:`asyncio.current_task` function returns the currently " +"running :class:`~asyncio.Task` instance, and the " +"new :func:`asyncio.all_tasks` function returns a set of all existing " +"``Task`` instances in a given loop. The :meth:`!Task.current_task` " +"and :meth:`!Task.all_tasks` methods have been deprecated. (Contributed by " +"Andrew Svetlov in :issue:`32250`.)" msgstr "" #: ../../whatsnew/3.7.rst:676 @@ -979,17 +986,17 @@ msgid "" "The new :func:`asyncio.get_running_loop` function returns the currently " "running loop, and raises a :exc:`RuntimeError` if no loop is running. This " "is in contrast with :func:`asyncio.get_event_loop`, which will *create* a " -"new event loop if none is running. (Contributed by Yury Selivanov in :issue:" -"`32269`.)" +"new event loop if none is running. (Contributed by Yury Selivanov " +"in :issue:`32269`.)" msgstr "" #: ../../whatsnew/3.7.rst:686 msgid "" -"The new :meth:`StreamWriter.wait_closed() <asyncio.StreamWriter." -"wait_closed>` coroutine method allows waiting until the stream writer is " -"closed. The new :meth:`StreamWriter.is_closing() <asyncio.StreamWriter." -"is_closing>` method can be used to determine if the writer is closing. " -"(Contributed by Andrew Svetlov in :issue:`32391`.)" +"The new :meth:`StreamWriter.wait_closed() " +"<asyncio.StreamWriter.wait_closed>` coroutine method allows waiting until " +"the stream writer is closed. The new :meth:`StreamWriter.is_closing() " +"<asyncio.StreamWriter.is_closing>` method can be used to determine if the " +"writer is closing. (Contributed by Andrew Svetlov in :issue:`32391`.)" msgstr "" #: ../../whatsnew/3.7.rst:692 @@ -1001,27 +1008,27 @@ msgstr "" #: ../../whatsnew/3.7.rst:696 msgid "" -"The new :meth:`Future.get_loop() <asyncio.Future.get_loop>` and ``Task." -"get_loop()`` methods return the instance of the loop on which a task or a " -"future were created. :meth:`Server.get_loop() <asyncio.Server.get_loop>` " -"allows doing the same for :class:`asyncio.Server` objects. (Contributed by " -"Yury Selivanov in :issue:`32415` and Srinivas Reddy Thatiparthy in :issue:" -"`32418`.)" +"The new :meth:`Future.get_loop() <asyncio.Future.get_loop>` and " +"``Task.get_loop()`` methods return the instance of the loop on which a task " +"or a future were created. :meth:`Server.get_loop() " +"<asyncio.Server.get_loop>` allows doing the same for :class:`asyncio.Server` " +"objects. (Contributed by Yury Selivanov in :issue:`32415` and Srinivas Reddy " +"Thatiparthy in :issue:`32418`.)" msgstr "" #: ../../whatsnew/3.7.rst:704 msgid "" "It is now possible to control how instances of :class:`asyncio.Server` begin " "serving. Previously, the server would start serving immediately when " -"created. The new *start_serving* keyword argument to :meth:`loop." -"create_server() <asyncio.loop.create_server>` and :meth:`loop." -"create_unix_server() <asyncio.loop.create_unix_server>`, as well as :meth:" -"`Server.start_serving() <asyncio.Server.start_serving>`, and :meth:`Server." -"serve_forever() <asyncio.Server.serve_forever>` can be used to decouple " -"server instantiation and serving. The new :meth:`Server.is_serving() " -"<asyncio.Server.is_serving>` method returns ``True`` if the server is " -"serving. :class:`~asyncio.Server` objects are now asynchronous context " -"managers::" +"created. The new *start_serving* keyword argument " +"to :meth:`loop.create_server() <asyncio.loop.create_server>` " +"and :meth:`loop.create_unix_server() <asyncio.loop.create_unix_server>`, as " +"well as :meth:`Server.start_serving() <asyncio.Server.start_serving>`, " +"and :meth:`Server.serve_forever() <asyncio.Server.serve_forever>` can be " +"used to decouple server instantiation and serving. The " +"new :meth:`Server.is_serving() <asyncio.Server.is_serving>` method returns " +"``True`` if the server is serving. :class:`~asyncio.Server` objects are now " +"asynchronous context managers::" msgstr "" #: ../../whatsnew/3.7.rst:716 @@ -1040,27 +1047,27 @@ msgstr "(由 Yury Selivanov 在 :issue:`32662` 中貢獻。)" #: ../../whatsnew/3.7.rst:725 msgid "" -"Callback objects returned by :func:`loop.call_later() <asyncio.loop." -"call_later>` gained the new :meth:`when() <asyncio.TimerHandle.when>` method " -"which returns an absolute scheduled callback timestamp. (Contributed by " -"Andrew Svetlov in :issue:`32741`.)" +"Callback objects returned by :func:`loop.call_later() " +"<asyncio.loop.call_later>` gained the new :meth:`when() " +"<asyncio.TimerHandle.when>` method which returns an absolute scheduled " +"callback timestamp. (Contributed by Andrew Svetlov in :issue:`32741`.)" msgstr "" #: ../../whatsnew/3.7.rst:731 msgid "" -"The :meth:`loop.create_datagram_endpoint() \\ <asyncio.loop." -"create_datagram_endpoint>` method gained support for Unix sockets. " -"(Contributed by Quentin Dawans in :issue:`31245`.)" +"The :meth:`loop.create_datagram_endpoint() \\ " +"<asyncio.loop.create_datagram_endpoint>` method gained support for Unix " +"sockets. (Contributed by Quentin Dawans in :issue:`31245`.)" msgstr "" #: ../../whatsnew/3.7.rst:736 msgid "" "The :func:`asyncio.open_connection`, :func:`asyncio.start_server` " -"functions, :meth:`loop.create_connection() <asyncio.loop." -"create_connection>`, :meth:`loop.create_server() <asyncio.loop." -"create_server>`, :meth:`loop.create_accepted_socket() <asyncio.loop." -"connect_accepted_socket>` methods and their corresponding UNIX socket " -"variants now accept the *ssl_handshake_timeout* keyword argument. " +"functions, :meth:`loop.create_connection() " +"<asyncio.loop.create_connection>`, :meth:`loop.create_server() " +"<asyncio.loop.create_server>`, :meth:`loop.create_accepted_socket() " +"<asyncio.loop.connect_accepted_socket>` methods and their corresponding UNIX " +"socket variants now accept the *ssl_handshake_timeout* keyword argument. " "(Contributed by Neil Aspinall in :issue:`29970`.)" msgstr "" @@ -1073,32 +1080,35 @@ msgstr "" #: ../../whatsnew/3.7.rst:748 msgid "" -"The asyncio source has been converted to use the :keyword:`async`/:keyword:" -"`await` syntax. (Contributed by Andrew Svetlov in :issue:`32193`.)" +"The asyncio source has been converted to use " +"the :keyword:`async`/:keyword:`await` syntax. (Contributed by Andrew Svetlov " +"in :issue:`32193`.)" msgstr "" #: ../../whatsnew/3.7.rst:752 msgid "" -"The new :meth:`ReadTransport.is_reading() <asyncio.ReadTransport." -"is_reading>` method can be used to determine the reading state of the " -"transport. Additionally, calls to :meth:`ReadTransport.resume_reading() " -"<asyncio.ReadTransport.resume_reading>` and :meth:`ReadTransport." -"pause_reading() <asyncio.ReadTransport.pause_reading>` are now idempotent. " -"(Contributed by Yury Selivanov in :issue:`32356`.)" +"The new :meth:`ReadTransport.is_reading() " +"<asyncio.ReadTransport.is_reading>` method can be used to determine the " +"reading state of the transport. Additionally, calls " +"to :meth:`ReadTransport.resume_reading() " +"<asyncio.ReadTransport.resume_reading>` " +"and :meth:`ReadTransport.pause_reading() " +"<asyncio.ReadTransport.pause_reading>` are now idempotent. (Contributed by " +"Yury Selivanov in :issue:`32356`.)" msgstr "" #: ../../whatsnew/3.7.rst:760 msgid "" "Loop methods which accept socket paths now support passing :term:`path-like " -"objects <path-like object>`. (Contributed by Yury Selivanov in :issue:" -"`32066`.)" +"objects <path-like object>`. (Contributed by Yury Selivanov " +"in :issue:`32066`.)" msgstr "" #: ../../whatsnew/3.7.rst:764 msgid "" "In :mod:`asyncio` TCP sockets on Linux are now created with ``TCP_NODELAY`` " -"flag set by default. (Contributed by Yury Selivanov and Victor Stinner in :" -"issue:`27456`.)" +"flag set by default. (Contributed by Yury Selivanov and Victor Stinner " +"in :issue:`27456`.)" msgstr "" #: ../../whatsnew/3.7.rst:768 @@ -1171,8 +1181,8 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.7.rst:816 msgid "" -":class:`ProcessPoolExecutor <concurrent.futures.ProcessPoolExecutor>` and :" -"class:`ThreadPoolExecutor <concurrent.futures.ThreadPoolExecutor>` now " +":class:`ProcessPoolExecutor <concurrent.futures.ProcessPoolExecutor>` " +"and :class:`ThreadPoolExecutor <concurrent.futures.ThreadPoolExecutor>` now " "support the new *initializer* and *initargs* constructor arguments. " "(Contributed by Antoine Pitrou in :issue:`21423`.)" msgstr "" @@ -1197,11 +1207,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:833 msgid "" -"The new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib." -"AbstractAsyncContextManager`, and :class:`~contextlib.AsyncExitStack` have " -"been added to complement their synchronous counterparts. (Contributed by " -"Jelle Zijlstra in :issue:`29679` and :issue:`30241`, and by Alexander Mohr " -"and Ilya Kulakov in :issue:`29302`.)" +"The " +"new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib.AbstractAsyncContextManager`, " +"and :class:`~contextlib.AsyncExitStack` have been added to complement their " +"synchronous counterparts. (Contributed by Jelle Zijlstra in :issue:`29679` " +"and :issue:`30241`, and by Alexander Mohr and Ilya Kulakov " +"in :issue:`29302`.)" msgstr "" #: ../../whatsnew/3.7.rst:842 @@ -1211,8 +1222,8 @@ msgstr "cProfile" #: ../../whatsnew/3.7.rst:844 msgid "" "The :mod:`cProfile` command line now accepts ``-m module_name`` as an " -"alternative to script path. (Contributed by Sanyam Khurana in :issue:" -"`21862`.)" +"alternative to script path. (Contributed by Sanyam Khurana " +"in :issue:`21862`.)" msgstr "" #: ../../whatsnew/3.7.rst:849 @@ -1239,8 +1250,9 @@ msgstr "datetime" msgid "" "The new :meth:`datetime.fromisoformat() <datetime.datetime.fromisoformat>` " "method constructs a :class:`~datetime.datetime` object from a string in one " -"of the formats output by :meth:`datetime.isoformat() <datetime.datetime." -"isoformat>`. (Contributed by Paul Ganssle in :issue:`15873`.)" +"of the formats output by :meth:`datetime.isoformat() " +"<datetime.datetime.isoformat>`. (Contributed by Paul Ganssle " +"in :issue:`15873`.)" msgstr "" #: ../../whatsnew/3.7.rst:867 @@ -1266,8 +1278,8 @@ msgstr "decimal" #: ../../whatsnew/3.7.rst:881 msgid "" "The :mod:`decimal` module now uses :ref:`context variables <whatsnew37-" -"pep567>` to store the decimal context. (Contributed by Yury Selivanov in :" -"issue:`32630`.)" +"pep567>` to store the decimal context. (Contributed by Yury Selivanov " +"in :issue:`32630`.)" msgstr "" #: ../../whatsnew/3.7.rst:887 @@ -1336,8 +1348,8 @@ msgid "" "be used before a POSIX ``fork()`` call to make the GC copy-on-write friendly " "or to speed up collection. The new :func:`gc.unfreeze` functions reverses " "this operation. Additionally, :func:`gc.get_freeze_count` can be used to " -"obtain the number of frozen objects. (Contributed by Li Zekun in :issue:" -"`31558`.)" +"obtain the number of frozen objects. (Contributed by Li Zekun " +"in :issue:`31558`.)" msgstr "" #: ../../whatsnew/3.7.rst:942 @@ -1357,9 +1369,10 @@ msgstr "http.client" #: ../../whatsnew/3.7.rst:952 msgid "" -":class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` now support the new *blocksize* argument for improved " -"upload throughput. (Contributed by Nir Soffer in :issue:`31945`.)" +":class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` now support the new *blocksize* " +"argument for improved upload throughput. (Contributed by Nir Soffer " +"in :issue:`31945`.)" msgstr "" #: ../../whatsnew/3.7.rst:958 @@ -1397,8 +1410,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:980 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" #: ../../whatsnew/3.7.rst:982 @@ -1437,8 +1450,8 @@ msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" #: ../../whatsnew/3.7.rst:1009 @@ -1490,8 +1503,8 @@ msgid "" "Add optional line numbers for IDLE editor windows. Windows open without line " "numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" #: ../../whatsnew/3.7.rst:1044 ../../whatsnew/3.7.rst:2017 @@ -1501,9 +1514,9 @@ msgstr "importlib" #: ../../whatsnew/3.7.rst:1046 msgid "" "The :class:`importlib.abc.ResourceReader` ABC was introduced to support the " -"loading of resources from packages. See also :ref:" -"`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, Brett Cannon " -"in :issue:`32248`.)" +"loading of resources from packages. See " +"also :ref:`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, " +"Brett Cannon in :issue:`32248`.)" msgstr "" #: ../../whatsnew/3.7.rst:1051 @@ -1515,9 +1528,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1055 msgid "" ":func:`importlib.find_spec` now raises :exc:`ModuleNotFoundError` instead " -"of :exc:`AttributeError` if the specified parent module is not a package (i." -"e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch in :" -"issue:`30436`.)" +"of :exc:`AttributeError` if the specified parent module is not a package " +"(i.e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch " +"in :issue:`30436`.)" msgstr "" #: ../../whatsnew/3.7.rst:1060 @@ -1535,8 +1548,8 @@ msgstr "io" msgid "" "The new :meth:`TextIOWrapper.reconfigure() <io.TextIOWrapper.reconfigure>` " "method can be used to reconfigure the text stream with the new settings. " -"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki in :issue:" -"`15216`.)" +"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki " +"in :issue:`15216`.)" msgstr "" #: ../../whatsnew/3.7.rst:1075 @@ -1545,10 +1558,10 @@ msgstr "ipaddress" #: ../../whatsnew/3.7.rst:1077 msgid "" -"The new ``subnet_of()`` and ``supernet_of()`` methods of :class:`ipaddress." -"IPv6Network` and :class:`ipaddress.IPv4Network` can be used for network " -"containment tests. (Contributed by Michel Albert and Cheryl Sabella in :" -"issue:`20825`.)" +"The new ``subnet_of()`` and ``supernet_of()`` methods " +"of :class:`ipaddress.IPv6Network` and :class:`ipaddress.IPv4Network` can be " +"used for network containment tests. (Contributed by Michel Albert and Cheryl " +"Sabella in :issue:`20825`.)" msgstr "" #: ../../whatsnew/3.7.rst:1084 @@ -1557,9 +1570,9 @@ msgstr "itertools" #: ../../whatsnew/3.7.rst:1086 msgid "" -":func:`itertools.islice` now accepts :meth:`integer-like objects <object." -"__index__>` as start, stop, and slice arguments. (Contributed by Will " -"Roberts in :issue:`30537`.)" +":func:`itertools.islice` now accepts :meth:`integer-like objects " +"<object.__index__>` as start, stop, and slice arguments. (Contributed by " +"Will Roberts in :issue:`30537`.)" msgstr "" #: ../../whatsnew/3.7.rst:1093 ../../whatsnew/3.7.rst:2035 @@ -1678,16 +1691,16 @@ msgstr "" #: ../../whatsnew/3.7.rst:1168 msgid "" "The new :func:`~os.register_at_fork` function allows registering Python " -"callbacks to be executed at process fork. (Contributed by Antoine Pitrou in :" -"issue:`16500`.)" +"callbacks to be executed at process fork. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:1172 msgid "" -"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` and :" -"func:`os.pread`) and :func:`os.pwritev` functions (combine the functionality " -"of :func:`os.writev` and :func:`os.pwrite`). (Contributed by Pablo Galindo " -"in :issue:`31368`.)" +"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` " +"and :func:`os.pread`) and :func:`os.pwritev` functions (combine the " +"functionality of :func:`os.writev` and :func:`os.pwrite`). (Contributed by " +"Pablo Galindo in :issue:`31368`.)" msgstr "" #: ../../whatsnew/3.7.rst:1177 @@ -1705,9 +1718,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1185 msgid "" -"The structure returned by :func:`os.stat` now contains the :attr:`~os." -"stat_result.st_fstype` attribute on Solaris and its derivatives. " -"(Contributed by Jesús Cea Avión in :issue:`32659`.)" +"The structure returned by :func:`os.stat` now contains " +"the :attr:`~os.stat_result.st_fstype` attribute on Solaris and its " +"derivatives. (Contributed by Jesús Cea Avión in :issue:`32659`.)" msgstr "" #: ../../whatsnew/3.7.rst:1191 @@ -1747,9 +1760,9 @@ msgid "" ":func:`py_compile.compile` -- and by extension, :mod:`compileall` -- now " "respects the :envvar:`SOURCE_DATE_EPOCH` environment variable by " "unconditionally creating ``.pyc`` files for hash-based validation. This " -"allows for guaranteeing `reproducible builds <https://reproducible-builds." -"org/>`_ of ``.pyc`` files when they are created eagerly. (Contributed by " -"Bernhard M. Wiedemann in :issue:`29708`.)" +"allows for guaranteeing `reproducible builds <https://reproducible-" +"builds.org/>`_ of ``.pyc`` files when they are created eagerly. (Contributed " +"by Bernhard M. Wiedemann in :issue:`29708`.)" msgstr "" #: ../../whatsnew/3.7.rst:1222 @@ -1759,8 +1772,8 @@ msgstr "pydoc" #: ../../whatsnew/3.7.rst:1224 msgid "" "The pydoc server can now bind to an arbitrary hostname specified by the new " -"``-n`` command-line argument. (Contributed by Feanil Patel in :issue:" -"`31128`.)" +"``-n`` command-line argument. (Contributed by Feanil Patel " +"in :issue:`31128`.)" msgstr "" #: ../../whatsnew/3.7.rst:1230 @@ -1780,8 +1793,8 @@ msgstr "re" #: ../../whatsnew/3.7.rst:1239 msgid "" "The flags :const:`re.ASCII`, :const:`re.LOCALE` and :const:`re.UNICODE` can " -"be set within the scope of a group. (Contributed by Serhiy Storchaka in :" -"issue:`31690`.)" +"be set within the scope of a group. (Contributed by Serhiy Storchaka " +"in :issue:`31690`.)" msgstr "" #: ../../whatsnew/3.7.rst:1243 @@ -1803,15 +1816,15 @@ msgstr "" msgid "" ":exc:`FutureWarning` is now emitted if a regular expression contains " "character set constructs that will change semantically in the future, such " -"as nested sets and set operations. (Contributed by Serhiy Storchaka in :" -"issue:`30349`.)" +"as nested sets and set operations. (Contributed by Serhiy Storchaka " +"in :issue:`30349`.)" msgstr "" #: ../../whatsnew/3.7.rst:1257 msgid "" -"Compiled regular expression and match objects can now be copied using :func:" -"`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy Storchaka in :" -"issue:`10076`.)" +"Compiled regular expression and match objects can now be copied " +"using :func:`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy " +"Storchaka in :issue:`10076`.)" msgstr "" #: ../../whatsnew/3.7.rst:1263 @@ -1841,16 +1854,16 @@ msgstr "" msgid "" "The new :func:`socket.close` function closes the passed socket file " "descriptor. This function should be used instead of :func:`os.close` for " -"better compatibility across platforms. (Contributed by Christian Heimes in :" -"issue:`32454`.)" +"better compatibility across platforms. (Contributed by Christian Heimes " +"in :issue:`32454`.)" msgstr "" #: ../../whatsnew/3.7.rst:1283 msgid "" "The :mod:`socket` module now exposes the :const:`socket.TCP_CONGESTION` " -"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), and :const:" -"`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed by Omar " -"Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" +"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), " +"and :const:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed " +"by Omar Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" msgstr "" #: ../../whatsnew/3.7.rst:1289 @@ -1880,9 +1893,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1305 msgid "" "Add a new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute " -"to :class:`socketserver.ForkingMixIn` and :class:`socketserver." -"ThreadingMixIn` classes. Set the class attribute to ``False`` to get the " -"pre-3.7 behaviour." +"to :class:`socketserver.ForkingMixIn` " +"and :class:`socketserver.ThreadingMixIn` classes. Set the class attribute to " +"``False`` to get the pre-3.7 behaviour." msgstr "" #: ../../whatsnew/3.7.rst:1311 @@ -1891,16 +1904,17 @@ msgstr "sqlite3" #: ../../whatsnew/3.7.rst:1313 msgid "" -":class:`sqlite3.Connection` now exposes the :meth:`~sqlite3.Connection." -"backup` method when the underlying SQLite library is at version 3.6.11 or " -"higher. (Contributed by Lele Gaifax in :issue:`27645`.)" +":class:`sqlite3.Connection` now exposes " +"the :meth:`~sqlite3.Connection.backup` method when the underlying SQLite " +"library is at version 3.6.11 or higher. (Contributed by Lele Gaifax " +"in :issue:`27645`.)" msgstr "" #: ../../whatsnew/3.7.rst:1317 msgid "" -"The *database* argument of :func:`sqlite3.connect` now accepts any :term:" -"`path-like object`, instead of just a string. (Contributed by Anders " -"Lorentsen in :issue:`31843`.)" +"The *database* argument of :func:`sqlite3.connect` now accepts " +"any :term:`path-like object`, instead of just a string. (Contributed by " +"Anders Lorentsen in :issue:`31843`.)" msgstr "" #: ../../whatsnew/3.7.rst:1323 ../../whatsnew/3.7.rst:2067 @@ -1909,15 +1923,16 @@ msgstr "ssl" #: ../../whatsnew/3.7.rst:1325 msgid "" -"The :mod:`ssl` module now uses OpenSSL's builtin API instead of :func:`~ssl." -"match_hostname` to check a host name or an IP address. Values are validated " -"during TLS handshake. Any certificate validation error including failing " -"the host name check now raises :exc:`~ssl.SSLCertVerificationError` and " -"aborts the handshake with a proper TLS Alert message. The new exception " -"contains additional information. Host name validation can be customized " -"with :attr:`SSLContext.hostname_checks_common_name <ssl.SSLContext." -"hostname_checks_common_name>`. (Contributed by Christian Heimes in :issue:" -"`31399`.)" +"The :mod:`ssl` module now uses OpenSSL's builtin API instead " +"of :func:`~ssl.match_hostname` to check a host name or an IP address. " +"Values are validated during TLS handshake. Any certificate validation error " +"including failing the host name check now " +"raises :exc:`~ssl.SSLCertVerificationError` and aborts the handshake with a " +"proper TLS Alert message. The new exception contains additional " +"information. Host name validation can be customized " +"with :attr:`SSLContext.hostname_checks_common_name " +"<ssl.SSLContext.hostname_checks_common_name>`. (Contributed by Christian " +"Heimes in :issue:`31399`.)" msgstr "" #: ../../whatsnew/3.7.rst:1336 @@ -1936,9 +1951,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1344 msgid "" -":func:`~ssl.match_hostname` no longer supports partial wildcards like ``www*." -"example.org``. (Contributed by Mandeep Singh in :issue:`23033` and Christian " -"Heimes in :issue:`31399`.)" +":func:`~ssl.match_hostname` no longer supports partial wildcards like " +"``www*.example.org``. (Contributed by Mandeep Singh in :issue:`23033` and " +"Christian Heimes in :issue:`31399`.)" msgstr "" #: ../../whatsnew/3.7.rst:1349 @@ -1953,11 +1968,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1355 msgid "" "Validation of server certificates containing internationalized domain names " -"(IDNs) is now supported. As part of this change, the :attr:`SSLSocket." -"server_hostname <ssl.SSLSocket.server_hostname>` attribute now stores the " -"expected hostname in A-label form (``\"xn--pythn-mua.org\"``), rather than " -"the U-label form (``\"pythön.org\"``). (Contributed by Nathaniel J. Smith " -"and Christian Heimes in :issue:`28414`.)" +"(IDNs) is now supported. As part of this change, " +"the :attr:`SSLSocket.server_hostname <ssl.SSLSocket.server_hostname>` " +"attribute now stores the expected hostname in A-label form (``\"xn--pythn-" +"mua.org\"``), rather than the U-label form (``\"pythön.org\"``). " +"(Contributed by Nathaniel J. Smith and Christian Heimes in :issue:`28414`.)" msgstr "" #: ../../whatsnew/3.7.rst:1362 @@ -1966,34 +1981,37 @@ msgid "" "OpenSSL 1.1.1. At the time of Python 3.7.0 release, OpenSSL 1.1.1 is still " "under development and TLS 1.3 hasn't been finalized yet. The TLS 1.3 " "handshake and protocol behaves slightly differently than TLS 1.2 and " -"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes in :issue:" -"`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` and :issue:`33618`)" +"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes " +"in :issue:`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` " +"and :issue:`33618`)" msgstr "" #: ../../whatsnew/3.7.rst:1370 msgid "" ":class:`~ssl.SSLSocket` and :class:`~ssl.SSLObject` no longer have a public " "constructor. Direct instantiation was never a documented and supported " -"feature. Instances must be created with :class:`~ssl.SSLContext` methods :" -"meth:`~ssl.SSLContext.wrap_socket` and :meth:`~ssl.SSLContext.wrap_bio`. " -"(Contributed by Christian Heimes in :issue:`32951`)" +"feature. Instances must be created with :class:`~ssl.SSLContext` " +"methods :meth:`~ssl.SSLContext.wrap_socket` " +"and :meth:`~ssl.SSLContext.wrap_bio`. (Contributed by Christian Heimes " +"in :issue:`32951`)" msgstr "" #: ../../whatsnew/3.7.rst:1376 msgid "" "OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol version " -"are available as :attr:`SSLContext.minimum_version <ssl.SSLContext." -"minimum_version>` and :attr:`SSLContext.maximum_version <ssl.SSLContext." -"maximum_version>`. Supported protocols are indicated by several new flags, " -"such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by Christian Heimes in :issue:" -"`32609`.)" +"are available as :attr:`SSLContext.minimum_version " +"<ssl.SSLContext.minimum_version>` and :attr:`SSLContext.maximum_version " +"<ssl.SSLContext.maximum_version>`. Supported protocols are indicated by " +"several new flags, such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by " +"Christian Heimes in :issue:`32609`.)" msgstr "" #: ../../whatsnew/3.7.rst:1383 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" #: ../../whatsnew/3.7.rst:1389 @@ -2030,19 +2048,21 @@ msgstr "" msgid "" "On Windows the default for *close_fds* was changed from ``False`` to " "``True`` when redirecting the standard handles. It's now possible to set " -"*close_fds* to true when redirecting the standard handles. See :class:" -"`subprocess.Popen`. This means that *close_fds* now defaults to ``True`` on " -"all supported platforms. (Contributed by Segev Finer in :issue:`19764`.)" +"*close_fds* to true when redirecting the standard handles. " +"See :class:`subprocess.Popen`. This means that *close_fds* now defaults to " +"``True`` on all supported platforms. (Contributed by Segev Finer " +"in :issue:`19764`.)" msgstr "" #: ../../whatsnew/3.7.rst:1417 msgid "" -"The subprocess module is now more graceful when handling :exc:" -"`KeyboardInterrupt` during :func:`subprocess.call`, :func:`subprocess.run`, " -"or in a :class:`~subprocess.Popen` context manager. It now waits a short " -"amount of time for the child to exit, before continuing the handling of the " -"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith in :issue:" -"`25942`.)" +"The subprocess module is now more graceful when " +"handling :exc:`KeyboardInterrupt` " +"during :func:`subprocess.call`, :func:`subprocess.run`, or in " +"a :class:`~subprocess.Popen` context manager. It now waits a short amount " +"of time for the child to exit, before continuing the handling of the " +"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith " +"in :issue:`25942`.)" msgstr "" #: ../../whatsnew/3.7.rst:1427 ../../whatsnew/3.7.rst:2083 @@ -2051,8 +2071,8 @@ msgstr "sys" #: ../../whatsnew/3.7.rst:1429 msgid "" -"The new :func:`sys.breakpointhook` hook function is called by the built-in :" -"func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" +"The new :func:`sys.breakpointhook` hook function is called by the built-" +"in :func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" msgstr "" #: ../../whatsnew/3.7.rst:1433 @@ -2064,11 +2084,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1437 msgid "" "The new :func:`sys.get_coroutine_origin_tracking_depth` function returns the " -"current coroutine origin tracking depth, as set by the new :func:`sys." -"set_coroutine_origin_tracking_depth`. :mod:`asyncio` has been converted to " -"use this new API instead of the deprecated :func:`sys." -"set_coroutine_wrapper`. (Contributed by Nathaniel J. Smith in :issue:" -"`32591`.)" +"current coroutine origin tracking depth, as set by the " +"new :func:`sys.set_coroutine_origin_tracking_depth`. :mod:`asyncio` has " +"been converted to use this new API instead of the " +"deprecated :func:`sys.set_coroutine_wrapper`. (Contributed by Nathaniel J. " +"Smith in :issue:`32591`.)" msgstr "" #: ../../whatsnew/3.7.rst:1446 @@ -2077,8 +2097,8 @@ msgstr "time" #: ../../whatsnew/3.7.rst:1448 msgid "" -":pep:`564` adds six new functions with nanosecond resolution to the :mod:" -"`time` module:" +":pep:`564` adds six new functions with nanosecond resolution to " +"the :mod:`time` module:" msgstr "" #: ../../whatsnew/3.7.rst:1458 @@ -2087,9 +2107,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1460 msgid "" -":const:`time.CLOCK_BOOTTIME` (Linux): Identical to :const:`time." -"CLOCK_MONOTONIC`, except it also includes any time that the system is " -"suspended." +":const:`time.CLOCK_BOOTTIME` (Linux): Identical " +"to :const:`time.CLOCK_MONOTONIC`, except it also includes any time that the " +"system is suspended." msgstr "" #: ../../whatsnew/3.7.rst:1463 @@ -2148,18 +2168,18 @@ msgstr "types" #: ../../whatsnew/3.7.rst:1499 msgid "" -"The new :class:`~types.WrapperDescriptorType`, :class:`~types." -"MethodWrapperType`, :class:`~types.MethodDescriptorType`, and :class:`~types." -"ClassMethodDescriptorType` classes are now available. (Contributed by Manuel " -"Krebber and Guido van Rossum in :issue:`29377`, and Serhiy Storchaka in :" -"issue:`32265`.)" +"The " +"new :class:`~types.WrapperDescriptorType`, :class:`~types.MethodWrapperType`, :class:`~types.MethodDescriptorType`, " +"and :class:`~types.ClassMethodDescriptorType` classes are now available. " +"(Contributed by Manuel Krebber and Guido van Rossum in :issue:`29377`, and " +"Serhiy Storchaka in :issue:`32265`.)" msgstr "" #: ../../whatsnew/3.7.rst:1505 msgid "" "The new :func:`types.resolve_bases` function resolves MRO entries " -"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi in :" -"issue:`32717`.)" +"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi " +"in :issue:`32717`.)" msgstr "" #: ../../whatsnew/3.7.rst:1511 @@ -2181,9 +2201,10 @@ msgstr "unittest" msgid "" "The new ``-k`` command-line option allows filtering tests by a name " "substring or a Unix shell-like pattern. For example, ``python -m unittest -k " -"foo`` runs ``foo_tests.SomeTest.test_something``, ``bar_tests.SomeTest." -"test_foo``, but not ``bar_tests.FooTest.test_something``. (Contributed by " -"Jonas Haag in :issue:`32071`.)" +"foo`` runs ``foo_tests.SomeTest.test_something``, " +"``bar_tests.SomeTest.test_foo``, but not " +"``bar_tests.FooTest.test_something``. (Contributed by Jonas Haag " +"in :issue:`32071`.)" msgstr "" #: ../../whatsnew/3.7.rst:1530 @@ -2199,10 +2220,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1536 msgid "" -"The new :func:`~unittest.mock.seal` function allows sealing :class:" -"`~unittest.mock.Mock` instances, which will disallow further creation of " -"attribute mocks. The seal is applied recursively to all attributes that are " -"themselves mocks. (Contributed by Mario Corchero in :issue:`30541`.)" +"The new :func:`~unittest.mock.seal` function allows " +"sealing :class:`~unittest.mock.Mock` instances, which will disallow further " +"creation of attribute mocks. The seal is applied recursively to all " +"attributes that are themselves mocks. (Contributed by Mario Corchero " +"in :issue:`30541`.)" msgstr "" #: ../../whatsnew/3.7.rst:1544 @@ -2235,8 +2257,8 @@ msgstr "uuid" msgid "" "The new :attr:`UUID.is_safe <uuid.UUID.is_safe>` attribute relays " "information from the platform about whether generated UUIDs are generated " -"with a multiprocessing-safe method. (Contributed by Barry Warsaw in :issue:" -"`22807`.)" +"with a multiprocessing-safe method. (Contributed by Barry Warsaw " +"in :issue:`22807`.)" msgstr "" #: ../../whatsnew/3.7.rst:1567 @@ -2301,11 +2323,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1598 msgid "" -"(Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`, :issue:" -"`32043`, and :issue:`32230`.)" +"(Contributed by Nick Coghlan and Victor Stinner " +"in :issue:`20361`, :issue:`32043`, and :issue:`32230`.)" msgstr "" -"(由 Nick Coghlan 和 Victor Stinner 在 :issue:`20361`、:issue:`32043` 和 :" -"issue:`32230` 中貢獻。)" +"(由 Nick Coghlan 和 Victor Stinner 在 :issue:`20361`、:issue:`32043` " +"和 :issue:`32230` 中貢獻。)" #: ../../whatsnew/3.7.rst:1601 msgid "" @@ -2320,9 +2342,10 @@ msgstr "xml" #: ../../whatsnew/3.7.rst:1609 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" #: ../../whatsnew/3.7.rst:1616 @@ -2343,9 +2366,9 @@ msgstr "xmlrpc.server" #: ../../whatsnew/3.7.rst:1627 msgid "" -":meth:`SimpleXMLRPCDispatcher.register_function <xmlrpc.server." -"SimpleXMLRPCDispatcher>` can now be used as a decorator. (Contributed by " -"Xiang Zhang in :issue:`7769`.)" +":meth:`SimpleXMLRPCDispatcher.register_function " +"<xmlrpc.server.SimpleXMLRPCDispatcher>` can now be used as a decorator. " +"(Contributed by Xiang Zhang in :issue:`7769`.)" msgstr "" #: ../../whatsnew/3.7.rst:1633 @@ -2389,10 +2412,10 @@ msgstr "C API 變更" #: ../../whatsnew/3.7.rst:1660 msgid "" -"A new API for thread-local storage has been implemented. See :ref:" -"`whatsnew37-pep539` for an overview and :ref:`thread-specific-storage-api` " -"for a complete reference. (Contributed by Masayuki Yamamoto in :issue:" -"`25658`.)" +"A new API for thread-local storage has been implemented. " +"See :ref:`whatsnew37-pep539` for an overview and :ref:`thread-specific-" +"storage-api` for a complete reference. (Contributed by Masayuki Yamamoto " +"in :issue:`25658`.)" msgstr "" #: ../../whatsnew/3.7.rst:1665 @@ -2404,8 +2427,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1668 msgid "" "The new :c:func:`PyImport_GetModule` function returns the previously " -"imported module with the given name. (Contributed by Eric Snow in :issue:" -"`28411`.)" +"imported module with the given name. (Contributed by Eric Snow " +"in :issue:`28411`.)" msgstr "" #: ../../whatsnew/3.7.rst:1672 @@ -2422,76 +2445,79 @@ msgstr "" #: ../../whatsnew/3.7.rst:1680 msgid "" -"The :mod:`tracemalloc` now exposes a C API through the new :c:func:" -"`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` functions. " -"(Contributed by Victor Stinner in :issue:`30054`.)" +"The :mod:`tracemalloc` now exposes a C API through the " +"new :c:func:`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` " +"functions. (Contributed by Victor Stinner in :issue:`30054`.)" msgstr "" #: ../../whatsnew/3.7.rst:1685 msgid "" -"The new :c:func:`import__find__load__start` and :c:func:" -"`import__find__load__done` static markers can be used to trace module " -"imports. (Contributed by Christian Heimes in :issue:`31574`.)" +"The new :c:func:`import__find__load__start` " +"and :c:func:`import__find__load__done` static markers can be used to trace " +"module imports. (Contributed by Christian Heimes in :issue:`31574`.)" msgstr "" #: ../../whatsnew/3.7.rst:1690 msgid "" -"The fields :c:member:`!name` and :c:member:`!doc` of structures :c:type:" -"`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:" -"type:`PyStructSequence_Desc`, and :c:struct:`wrapperbase` are now of type " -"``const char *`` rather of ``char *``. (Contributed by Serhiy Storchaka in :" -"issue:`28761`.)" +"The fields :c:member:`!name` and :c:member:`!doc` of " +"structures :c:type:`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:type:`PyStructSequence_Desc`, " +"and :c:struct:`wrapperbase` are now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28761`.)" msgstr "" #: ../../whatsnew/3.7.rst:1696 msgid "" -"The result of :c:func:`PyUnicode_AsUTF8AndSize` and :c:func:" -"`PyUnicode_AsUTF8` is now of type ``const char *`` rather of ``char *``. " -"(Contributed by Serhiy Storchaka in :issue:`28769`.)" +"The result of :c:func:`PyUnicode_AsUTF8AndSize` " +"and :c:func:`PyUnicode_AsUTF8` is now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28769`.)" msgstr "" #: ../../whatsnew/3.7.rst:1700 msgid "" -"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` and :c:" -"func:`PyMapping_Items` is now always a list, rather than a list or a tuple. " -"(Contributed by Oren Milman in :issue:`28280`.)" +"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` " +"and :c:func:`PyMapping_Items` is now always a list, rather than a list or a " +"tuple. (Contributed by Oren Milman in :issue:`28280`.)" msgstr "" #: ../../whatsnew/3.7.rst:1704 msgid "" -"Added functions :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka in :issue:`27867`.)" +"Added functions :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:1707 msgid "" -":c:func:`PyOS_AfterFork` is deprecated in favour of the new functions :c:" -"func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` and :c:func:" -"`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou in :issue:`16500`.)" +":c:func:`PyOS_AfterFork` is deprecated in favour of the new " +"functions :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:1712 msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`." +"during finalization of the interpreter. Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`." msgstr "" #: ../../whatsnew/3.7.rst:1717 msgid "" -"Added C API support for timezones with timezone constructors :c:func:" -"`PyTimeZone_FromOffset` and :c:func:`PyTimeZone_FromOffsetAndName`, and " -"access to the UTC singleton with :c:data:`PyDateTime_TimeZone_UTC`. " -"Contributed by Paul Ganssle in :issue:`10381`." +"Added C API support for timezones with timezone " +"constructors :c:func:`PyTimeZone_FromOffset` " +"and :c:func:`PyTimeZone_FromOffsetAndName`, and access to the UTC singleton " +"with :c:data:`PyDateTime_TimeZone_UTC`. Contributed by Paul Ganssle " +"in :issue:`10381`." msgstr "" #: ../../whatsnew/3.7.rst:1722 msgid "" -"The type of results of :c:func:`PyThread_start_new_thread` and :c:func:" -"`PyThread_get_thread_ident`, and the *id* parameter of :c:func:" -"`PyThreadState_SetAsyncExc` changed from :c:expr:`long` to :c:expr:`unsigned " -"long`. (Contributed by Serhiy Storchaka in :issue:`6532`.)" +"The type of results of :c:func:`PyThread_start_new_thread` " +"and :c:func:`PyThread_get_thread_ident`, and the *id* parameter " +"of :c:func:`PyThreadState_SetAsyncExc` changed from :c:expr:`long` " +"to :c:expr:`unsigned long`. (Contributed by Serhiy Storchaka " +"in :issue:`6532`.)" msgstr "" #: ../../whatsnew/3.7.rst:1728 @@ -2504,12 +2530,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:1732 msgid "" "Changes to the startup sequence and the management of dynamic memory " -"allocators mean that the long documented requirement to call :c:func:" -"`Py_Initialize` before calling most C API functions is now relied on more " -"heavily, and failing to abide by it may lead to segfaults in embedding " -"applications. See the :ref:`porting-to-python-37` section in this document " -"and the :ref:`pre-init-safe` section in the C API documentation for more " -"details." +"allocators mean that the long documented requirement to " +"call :c:func:`Py_Initialize` before calling most C API functions is now " +"relied on more heavily, and failing to abide by it may lead to segfaults in " +"embedding applications. See the :ref:`porting-to-python-37` section in this " +"document and the :ref:`pre-init-safe` section in the C API documentation for " +"more details." msgstr "" #: ../../whatsnew/3.7.rst:1740 @@ -2535,8 +2561,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1752 msgid "" "The *start* and *end* parameters of :c:func:`PyUnicode_FindChar` are now " -"adjusted to behave like string slices. (Contributed by Xiang Zhang in :issue:" -"`28822`.)" +"adjusted to behave like string slices. (Contributed by Xiang Zhang " +"in :issue:`28822`.)" msgstr "" #: ../../whatsnew/3.7.rst:1758 @@ -2545,16 +2571,16 @@ msgstr "建置變更" #: ../../whatsnew/3.7.rst:1760 msgid "" -"Support for building ``--without-threads`` has been removed. The :mod:" -"`threading` module is now always available. (Contributed by Antoine Pitrou " -"in :issue:`31370`.)." +"Support for building ``--without-threads`` has been removed. " +"The :mod:`threading` module is now always available. (Contributed by Antoine " +"Pitrou in :issue:`31370`.)." msgstr "" #: ../../whatsnew/3.7.rst:1764 msgid "" -"A full copy of libffi is no longer bundled for use when building the :mod:" -"`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed copy of " -"libffi is now required when building ``_ctypes`` on such platforms. " +"A full copy of libffi is no longer bundled for use when building " +"the :mod:`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed " +"copy of libffi is now required when building ``_ctypes`` on such platforms. " "(Contributed by Zachary Ware in :issue:`27979`.)" msgstr "" @@ -2583,15 +2609,15 @@ msgstr "最佳化" msgid "" "The overhead of calling many methods of various standard library classes " "implemented in C has been significantly reduced by porting more code to use " -"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner in :issue:" -"`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" +"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner " +"in :issue:`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" msgstr "" #: ../../whatsnew/3.7.rst:1792 msgid "" "Various optimizations have reduced Python startup time by 10% on Linux and " -"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki in :issue:" -"`29585`, and Ivan Levkivskyi in :issue:`31333`.)" +"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki " +"in :issue:`29585`, and Ivan Levkivskyi in :issue:`31333`.)" msgstr "" #: ../../whatsnew/3.7.rst:1797 @@ -2610,8 +2636,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1806 msgid "" "The :func:`asyncio.get_event_loop` function has been reimplemented in C to " -"make it up to 15 times faster. (Contributed by Yury Selivanov in :issue:" -"`32296`.)" +"make it up to 15 times faster. (Contributed by Yury Selivanov " +"in :issue:`32296`.)" msgstr "" #: ../../whatsnew/3.7.rst:1810 @@ -2640,16 +2666,17 @@ msgstr "" #: ../../whatsnew/3.7.rst:1823 msgid "" -"As a result of :ref:`PEP 560 work <whatsnew37-pep560>`, the import time of :" -"mod:`typing` has been reduced by a factor of 7, and many typing operations " -"are now faster. (Contributed by Ivan Levkivskyi in :issue:`32226`.)" +"As a result of :ref:`PEP 560 work <whatsnew37-pep560>`, the import time " +"of :mod:`typing` has been reduced by a factor of 7, and many typing " +"operations are now faster. (Contributed by Ivan Levkivskyi " +"in :issue:`32226`.)" msgstr "" #: ../../whatsnew/3.7.rst:1828 msgid "" ":func:`sorted` and :meth:`list.sort` have been optimized for common cases to " -"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky in :issue:" -"`28685`.)" +"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky " +"in :issue:`28685`.)" msgstr "" #: ../../whatsnew/3.7.rst:1832 @@ -2661,8 +2688,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1835 msgid "" ":func:`hasattr` and :func:`getattr` are now about 4 times faster when *name* " -"is not found and *obj* does not override :meth:`object.__getattr__` or :meth:" -"`object.__getattribute__`. (Contributed by INADA Naoki in :issue:`32544`.)" +"is not found and *obj* does not override :meth:`object.__getattr__` " +"or :meth:`object.__getattribute__`. (Contributed by INADA Naoki " +"in :issue:`32544`.)" msgstr "" #: ../../whatsnew/3.7.rst:1840 @@ -2711,39 +2739,39 @@ msgstr "" msgid "" ":func:`re.compile` now converts ``flags`` parameter to int object if it is " "``RegexFlag``. It is now as fast as Python 3.5, and faster than Python 3.6 " -"by about 10% depending on the pattern. (Contributed by INADA Naoki in :issue:" -"`31671`.)" +"by about 10% depending on the pattern. (Contributed by INADA Naoki " +"in :issue:`31671`.)" msgstr "" #: ../../whatsnew/3.7.rst:1871 msgid "" -"The :meth:`~selectors.BaseSelector.modify` methods of classes :class:" -"`selectors.EpollSelector`, :class:`selectors.PollSelector` and :class:" -"`selectors.DevpollSelector` may be around 10% faster under heavy loads. " -"(Contributed by Giampaolo Rodola' in :issue:`30014`)" +"The :meth:`~selectors.BaseSelector.modify` methods of " +"classes :class:`selectors.EpollSelector`, :class:`selectors.PollSelector` " +"and :class:`selectors.DevpollSelector` may be around 10% faster under heavy " +"loads. (Contributed by Giampaolo Rodola' in :issue:`30014`)" msgstr "" #: ../../whatsnew/3.7.rst:1876 msgid "" "Constant folding has been moved from the peephole optimizer to the new AST " "optimizer, which is able perform optimizations more consistently. " -"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` and :issue:" -"`11549`.)" +"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` " +"and :issue:`11549`.)" msgstr "" #: ../../whatsnew/3.7.rst:1881 msgid "" "Most functions and methods in :mod:`abc` have been rewritten in C. This " -"makes creation of abstract base classes, and calling :func:`isinstance` and :" -"func:`issubclass` on them 1.5x faster. This also reduces Python start-up " -"time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki in :issue:" -"`31333`)" +"makes creation of abstract base classes, and calling :func:`isinstance` " +"and :func:`issubclass` on them 1.5x faster. This also reduces Python start-" +"up time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki " +"in :issue:`31333`)" msgstr "" #: ../../whatsnew/3.7.rst:1887 msgid "" -"Significant speed improvements to alternate constructors for :class:" -"`datetime.date` and :class:`datetime.datetime` by using fast-path " +"Significant speed improvements to alternate constructors " +"for :class:`datetime.date` and :class:`datetime.datetime` by using fast-path " "constructors when not constructing subclasses. (Contributed by Paul Ganssle " "in :issue:`32403`)" msgstr "" @@ -2770,9 +2798,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:1905 msgid "" "Trace hooks may now opt out of receiving the ``line`` and opt into receiving " -"the ``opcode`` events from the interpreter by setting the corresponding new :" -"attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` attributes on " -"the frame being traced. (Contributed by Nick Coghlan in :issue:`31344`.)" +"the ``opcode`` events from the interpreter by setting the corresponding " +"new :attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` " +"attributes on the frame being traced. (Contributed by Nick Coghlan " +"in :issue:`31344`.)" msgstr "" #: ../../whatsnew/3.7.rst:1910 @@ -2782,8 +2811,8 @@ msgid "" "(previously unset), and their ``__spec__.origin`` is also set to ``None`` " "(previously the string ``\"namespace\"``). See :issue:`32305`. Also, the " "namespace module object's ``__spec__.loader`` is set to the same value as " -"``__loader__`` (previously, the former was set to ``None``). See :issue:" -"`32303`." +"``__loader__`` (previously, the former was set to ``None``). " +"See :issue:`32303`." msgstr "" #: ../../whatsnew/3.7.rst:1918 @@ -2797,8 +2826,8 @@ msgstr "" msgid "" "The ``distutils`` ``upload`` command no longer tries to change CR end-of-" "line characters to CRLF. This fixes a corruption issue with sdists that " -"ended with a byte equivalent to CR. (Contributed by Bo Bayles in :issue:" -"`32304`.)" +"ended with a byte equivalent to CR. (Contributed by Bo Bayles " +"in :issue:`32304`.)" msgstr "" #: ../../whatsnew/3.7.rst:1929 @@ -2823,8 +2852,9 @@ msgstr "" msgid "" "Returning a subclass of :class:`complex` from :meth:`object.__complex__` is " "deprecated and will be an error in future Python versions. This makes " -"``__complex__()`` consistent with :meth:`object.__int__` and :meth:`object." -"__float__`. (Contributed by Serhiy Storchaka in :issue:`28894`.)" +"``__complex__()`` consistent with :meth:`object.__int__` " +"and :meth:`object.__float__`. (Contributed by Serhiy Storchaka " +"in :issue:`28894`.)" msgstr "" #: ../../whatsnew/3.7.rst:1951 @@ -2838,8 +2868,8 @@ msgstr "aifc" #: ../../whatsnew/3.7.rst:1956 msgid "" ":func:`!aifc.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:1966 @@ -2847,15 +2877,15 @@ msgid "" "Support for directly ``await``-ing instances of :class:`asyncio.Lock` and " "other asyncio synchronization primitives has been deprecated. An " "asynchronous context manager must be used in order to acquire and release " -"the synchronization resource. (Contributed by Andrew Svetlov in :issue:" -"`32253`.)" +"the synchronization resource. (Contributed by Andrew Svetlov " +"in :issue:`32253`.)" msgstr "" #: ../../whatsnew/3.7.rst:1972 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"methods have been deprecated. (Contributed by Andrew Svetlov in :issue:" -"`32250`.)" +"methods have been deprecated. (Contributed by Andrew Svetlov " +"in :issue:`32250`.)" msgstr "" #: ../../whatsnew/3.7.rst:1980 @@ -2881,8 +2911,8 @@ msgid "" "classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); similarly, " "attempting to check for non-Flag objects in a :class:`Flag` member will " "raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both operations " -"return :const:`False` instead. (Contributed by Ethan Furman in :issue:" -"`33217`.)" +"return :const:`False` instead. (Contributed by Ethan Furman " +"in :issue:`33217`.)" msgstr "" #: ../../whatsnew/3.7.rst:2009 @@ -2892,18 +2922,19 @@ msgstr "gettext" #: ../../whatsnew/3.7.rst:2011 msgid "" "Using non-integer value for selecting a plural form in :mod:`gettext` is now " -"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka in :" -"issue:`28692`.)" +"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka " +"in :issue:`28692`.)" msgstr "" #: ../../whatsnew/3.7.rst:2019 msgid "" -"Methods :meth:`!MetaPathFinder.find_module` (replaced by :meth:" -"`MetaPathFinder.find_spec() <importlib.abc.MetaPathFinder.find_spec>`) and :" -"meth:`!PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder." -"find_spec() <importlib.abc.PathEntryFinder.find_spec>`) both deprecated in " -"Python 3.4 now emit :exc:`DeprecationWarning`. (Contributed by Matthias " -"Bussonnier in :issue:`29576`.)" +"Methods :meth:`!MetaPathFinder.find_module` (replaced " +"by :meth:`MetaPathFinder.find_spec() " +"<importlib.abc.MetaPathFinder.find_spec>`) and :meth:`!" +"PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder.find_spec() " +"<importlib.abc.PathEntryFinder.find_spec>`) both deprecated in Python 3.4 " +"now emit :exc:`DeprecationWarning`. (Contributed by Matthias Bussonnier " +"in :issue:`29576`.)" msgstr "" #: ../../whatsnew/3.7.rst:2030 @@ -2935,22 +2966,24 @@ msgstr "threading" #: ../../whatsnew/3.7.rst:2051 msgid "" ":mod:`!dummy_threading` and :mod:`!_dummy_thread` have been deprecated. It " -"is no longer possible to build Python with threading disabled. Use :mod:" -"`threading` instead. (Contributed by Antoine Pitrou in :issue:`31370`.)" +"is no longer possible to build Python with threading disabled. " +"Use :mod:`threading` instead. (Contributed by Antoine Pitrou " +"in :issue:`31370`.)" msgstr "" #: ../../whatsnew/3.7.rst:2060 msgid "" -"The silent argument value truncation in :func:`socket.htons` and :func:" -"`socket.ntohs` has been deprecated. In future versions of Python, if the " -"passed argument is larger than 16 bits, an exception will be raised. " +"The silent argument value truncation in :func:`socket.htons` " +"and :func:`socket.ntohs` has been deprecated. In future versions of Python, " +"if the passed argument is larger than 16 bits, an exception will be raised. " "(Contributed by Oren Milman in :issue:`28332`.)" msgstr "" #: ../../whatsnew/3.7.rst:2069 msgid "" -":func:`ssl.wrap_socket` is deprecated. Use :meth:`ssl.SSLContext." -"wrap_socket` instead. (Contributed by Christian Heimes in :issue:`28124`.)" +":func:`ssl.wrap_socket` is deprecated. " +"Use :meth:`ssl.SSLContext.wrap_socket` instead. (Contributed by Christian " +"Heimes in :issue:`28124`.)" msgstr "" #: ../../whatsnew/3.7.rst:2075 @@ -2960,21 +2993,21 @@ msgstr "sunau" #: ../../whatsnew/3.7.rst:2077 msgid "" ":func:`!sunau.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:2085 msgid "" -"Deprecated :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper`." +"Deprecated :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper`." msgstr "" #: ../../whatsnew/3.7.rst:2088 msgid "" "The undocumented ``sys.callstats()`` function has been deprecated and will " -"be removed in a future Python version. (Contributed by Victor Stinner in :" -"issue:`28799`.)" +"be removed in a future Python version. (Contributed by Victor Stinner " +"in :issue:`28799`.)" msgstr "" #: ../../whatsnew/3.7.rst:2094 @@ -2984,8 +3017,8 @@ msgstr "wave" #: ../../whatsnew/3.7.rst:2096 msgid "" ":func:`wave.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`wave.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`wave.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:2102 @@ -2997,16 +3030,16 @@ msgid "" "Function :c:func:`PySlice_GetIndicesEx` is deprecated and replaced with a " "macro if ``Py_LIMITED_API`` is not set or set to a value in the range " "between ``0x03050400`` and ``0x03060000`` (not inclusive), or is " -"``0x03060100`` or higher. (Contributed by Serhiy Storchaka in :issue:" -"`27867`.)" +"``0x03060100`` or higher. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:2109 msgid "" -":c:func:`PyOS_AfterFork` has been deprecated. Use :c:func:" -"`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` or :c:func:" -"`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou in :issue:" -"`16500`.)" +":c:func:`PyOS_AfterFork` has been deprecated. " +"Use :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"or :c:func:`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:2117 @@ -3051,15 +3084,15 @@ msgstr "" #: ../../whatsnew/3.7.rst:2136 msgid "" "CPython's own `CI configuration file <https://github.com/python/cpython/blob/" -"v3.7.13/.travis.yml>`_ provides an example of using the SSL :source:" -"`compatibility testing infrastructure <Tools/ssl/multissltests.py>` in " -"CPython's test suite to build and link against OpenSSL 1.1.0 rather than an " -"outdated system provided OpenSSL." +"v3.7.13/.travis.yml>`_ provides an example of using the " +"SSL :source:`compatibility testing infrastructure <Tools/ssl/" +"multissltests.py>` in CPython's test suite to build and link against OpenSSL " +"1.1.0 rather than an outdated system provided OpenSSL." msgstr "" #: ../../whatsnew/3.7.rst:2145 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.7.rst:2147 msgid "The following features and APIs have been removed from Python 3.7:" @@ -3111,9 +3144,9 @@ msgstr "" msgid "" "Removed previously deprecated in Python 2.4 classes ``Plist``, ``Dict`` and " "``_InternalDict`` in the :mod:`plistlib` module. Dict values in the result " -"of functions :func:`~plistlib.readPlist` and :func:`~plistlib." -"readPlistFromBytes` are now normal dicts. You no longer can use attribute " -"access to access items of these dictionaries." +"of functions :func:`~plistlib.readPlist` " +"and :func:`~plistlib.readPlistFromBytes` are now normal dicts. You no " +"longer can use attribute access to access items of these dictionaries." msgstr "" #: ../../whatsnew/3.7.rst:2180 @@ -3135,9 +3168,9 @@ msgstr "" msgid "" "Direct instantiation of :class:`ssl.SSLSocket` and :class:`ssl.SSLObject` " "objects is now prohibited. The constructors were never documented, tested, " -"or designed as public constructors. Users were supposed to use :func:`ssl." -"wrap_socket` or :class:`ssl.SSLContext`. (Contributed by Christian Heimes " -"in :issue:`32951`.)" +"or designed as public constructors. Users were supposed to " +"use :func:`ssl.wrap_socket` or :class:`ssl.SSLContext`. (Contributed by " +"Christian Heimes in :issue:`32951`.)" msgstr "" #: ../../whatsnew/3.7.rst:2197 @@ -3193,7 +3226,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2237 msgid "Changes in Python Behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.7.rst:2239 msgid "" @@ -3204,10 +3237,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:2243 msgid "" -":pep:`479` is enabled for all code in Python 3.7, meaning that :exc:" -"`StopIteration` exceptions raised directly or indirectly in coroutines and " -"generators are transformed into :exc:`RuntimeError` exceptions. (Contributed " -"by Yury Selivanov in :issue:`32670`.)" +":pep:`479` is enabled for all code in Python 3.7, meaning " +"that :exc:`StopIteration` exceptions raised directly or indirectly in " +"coroutines and generators are transformed into :exc:`RuntimeError` " +"exceptions. (Contributed by Yury Selivanov in :issue:`32670`.)" msgstr "" #: ../../whatsnew/3.7.rst:2249 @@ -3239,8 +3272,8 @@ msgid "" "Python 3.7 now correctly raises a :exc:`SyntaxError`, as a generator " "expression always needs to be directly inside a set of parentheses and " "cannot have a comma on either side, and the duplication of the parentheses " -"can be omitted only on calls. (Contributed by Serhiy Storchaka in :issue:" -"`32012` and :issue:`32023`.)" +"can be omitted only on calls. (Contributed by Serhiy Storchaka " +"in :issue:`32012` and :issue:`32023`.)" msgstr "" #: ../../whatsnew/3.7.rst:2266 @@ -3257,22 +3290,24 @@ msgstr "" #: ../../whatsnew/3.7.rst:2276 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.7.rst:2278 msgid "" ":meth:`socketserver.ThreadingMixIn.server_close` now waits until all non-" -"daemon threads complete. Set the new :attr:`socketserver.ThreadingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31233` and :issue:`33540`.)" +"daemon threads complete. Set the " +"new :attr:`socketserver.ThreadingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31233` and :issue:`33540`.)" msgstr "" #: ../../whatsnew/3.7.rst:2284 msgid "" ":meth:`socketserver.ForkingMixIn.server_close` now waits until all child " -"processes complete. Set the new :attr:`socketserver.ForkingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31151` and :issue:`33540`.)" +"processes complete. Set the " +"new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31151` and :issue:`33540`.)" msgstr "" #: ../../whatsnew/3.7.rst:2290 @@ -3291,19 +3326,19 @@ msgstr "" #: ../../whatsnew/3.7.rst:2298 msgid "" -"A format string argument for :meth:`string.Formatter.format` is now :ref:" -"`positional-only <positional-only_parameter>`. Passing it as a keyword " -"argument was deprecated in Python 3.5. (Contributed by Serhiy Storchaka in :" -"issue:`29193`.)" +"A format string argument for :meth:`string.Formatter.format` is " +"now :ref:`positional-only <positional-only_parameter>`. Passing it as a " +"keyword argument was deprecated in Python 3.5. (Contributed by Serhiy " +"Storchaka in :issue:`29193`.)" msgstr "" #: ../../whatsnew/3.7.rst:2303 msgid "" -"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel." -"value` and :attr:`~http.cookies.Morsel.coded_value` of class :class:`http." -"cookies.Morsel` are now read-only. Assigning to them was deprecated in " -"Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method for setting " -"them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" +"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of " +"class :class:`http.cookies.Morsel` are now read-only. Assigning to them was " +"deprecated in Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method " +"for setting them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" msgstr "" #: ../../whatsnew/3.7.rst:2311 @@ -3316,8 +3351,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:2317 msgid "" -"The :attr:`struct.Struct.format` type is now :class:`str` instead of :class:" -"`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" +"The :attr:`struct.Struct.format` type is now :class:`str` instead " +"of :class:`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" msgstr "" #: ../../whatsnew/3.7.rst:2320 @@ -3350,10 +3385,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:2337 msgid "" -"Because :func:`shutil.rmtree` is now implemented using the :func:`os." -"scandir` function, the user specified handler *onerror* is now called with " -"the first argument ``os.scandir`` instead of ``os.listdir`` when listing the " -"directory is failed." +"Because :func:`shutil.rmtree` is now implemented using " +"the :func:`os.scandir` function, the user specified handler *onerror* is now " +"called with the first argument ``os.scandir`` instead of ``os.listdir`` when " +"listing the directory is failed." msgstr "" #: ../../whatsnew/3.7.rst:2342 @@ -3416,40 +3451,43 @@ msgstr "" #: ../../whatsnew/3.7.rst:2385 msgid "" -"On OSes that support :const:`socket.SOCK_NONBLOCK` or :const:`socket." -"SOCK_CLOEXEC` bit flags, the :attr:`socket.type <socket.socket.type>` no " -"longer has them applied. Therefore, checks like ``if sock.type == socket." -"SOCK_STREAM`` work as expected on all platforms. (Contributed by Yury " -"Selivanov in :issue:`32331`.)" +"On OSes that support :const:`socket.SOCK_NONBLOCK` " +"or :const:`socket.SOCK_CLOEXEC` bit flags, the :attr:`socket.type " +"<socket.socket.type>` no longer has them applied. Therefore, checks like " +"``if sock.type == socket.SOCK_STREAM`` work as expected on all platforms. " +"(Contributed by Yury Selivanov in :issue:`32331`.)" msgstr "" #: ../../whatsnew/3.7.rst:2392 msgid "" -"On Windows the default for the *close_fds* argument of :class:`subprocess." -"Popen` was changed from :const:`False` to :const:`True` when redirecting the " -"standard handles. If you previously depended on handles being inherited when " -"using :class:`subprocess.Popen` with standard io redirection, you will have " -"to pass ``close_fds=False`` to preserve the previous behaviour, or use :attr:" -"`STARTUPINFO.lpAttributeList <subprocess.STARTUPINFO.lpAttributeList>`." +"On Windows the default for the *close_fds* argument " +"of :class:`subprocess.Popen` was changed from :const:`False` " +"to :const:`True` when redirecting the standard handles. If you previously " +"depended on handles being inherited when using :class:`subprocess.Popen` " +"with standard io redirection, you will have to pass ``close_fds=False`` to " +"preserve the previous behaviour, or use :attr:`STARTUPINFO.lpAttributeList " +"<subprocess.STARTUPINFO.lpAttributeList>`." msgstr "" #: ../../whatsnew/3.7.rst:2400 msgid "" ":meth:`importlib.machinery.PathFinder.invalidate_caches` -- which implicitly " -"affects :func:`importlib.invalidate_caches` -- now deletes entries in :data:" -"`sys.path_importer_cache` which are set to ``None``. (Contributed by Brett " -"Cannon in :issue:`33169`.)" +"affects :func:`importlib.invalidate_caches` -- now deletes entries " +"in :data:`sys.path_importer_cache` which are set to ``None``. (Contributed " +"by Brett Cannon in :issue:`33169`.)" msgstr "" #: ../../whatsnew/3.7.rst:2405 msgid "" -"In :mod:`asyncio`, :meth:`loop.sock_recv() <asyncio.loop.sock_recv>`, :meth:" -"`loop.sock_sendall() <asyncio.loop.sock_sendall>`, :meth:`loop.sock_accept() " -"<asyncio.loop.sock_accept>`, :meth:`loop.getaddrinfo() <asyncio.loop." -"getaddrinfo>`, :meth:`loop.getnameinfo() <asyncio.loop.getnameinfo>` have " -"been changed to be proper coroutine methods to match their documentation. " -"Previously, these methods returned :class:`asyncio.Future` instances. " -"(Contributed by Yury Selivanov in :issue:`32327`.)" +"In :mod:`asyncio`, :meth:`loop.sock_recv() " +"<asyncio.loop.sock_recv>`, :meth:`loop.sock_sendall() " +"<asyncio.loop.sock_sendall>`, :meth:`loop.sock_accept() " +"<asyncio.loop.sock_accept>`, :meth:`loop.getaddrinfo() " +"<asyncio.loop.getaddrinfo>`, :meth:`loop.getnameinfo() " +"<asyncio.loop.getnameinfo>` have been changed to be proper coroutine methods " +"to match their documentation. Previously, these methods " +"returned :class:`asyncio.Future` instances. (Contributed by Yury Selivanov " +"in :issue:`32327`.)" msgstr "" #: ../../whatsnew/3.7.rst:2416 @@ -3462,16 +3500,16 @@ msgstr "" #: ../../whatsnew/3.7.rst:2420 msgid "" ":attr:`Struct.format <struct.Struct.format>` is now a :class:`str` instance " -"instead of a :class:`bytes` instance. (Contributed by Victor Stinner in :" -"issue:`21071`.)" +"instead of a :class:`bytes` instance. (Contributed by Victor Stinner " +"in :issue:`21071`.)" msgstr "" #: ../../whatsnew/3.7.rst:2424 msgid "" ":mod:`argparse` subparsers can now be made mandatory by passing " -"``required=True`` to :meth:`ArgumentParser.add_subparsers() <argparse." -"ArgumentParser.add_subparsers>`. (Contributed by Anthony Sottile in :issue:" -"`26510`.)" +"``required=True`` to :meth:`ArgumentParser.add_subparsers() " +"<argparse.ArgumentParser.add_subparsers>`. (Contributed by Anthony Sottile " +"in :issue:`26510`.)" msgstr "" #: ../../whatsnew/3.7.rst:2428 @@ -3489,8 +3527,9 @@ msgid "" "cannot tolerate such exceptions, the new :meth:`Calendar.itermonthdays3 " "<calendar.Calendar.itermonthdays3>` and :meth:`Calendar.itermonthdays4 " "<calendar.Calendar.itermonthdays4>` can be used. The new methods return " -"tuples and are not restricted by the range supported by :class:`datetime." -"date`. (Contributed by Alexander Belopolsky in :issue:`28292`.)" +"tuples and are not restricted by the range supported " +"by :class:`datetime.date`. (Contributed by Alexander Belopolsky " +"in :issue:`28292`.)" msgstr "" #: ../../whatsnew/3.7.rst:2442 @@ -3502,9 +3541,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2445 msgid "" "The ``submit()`` method of :class:`concurrent.futures.ThreadPoolExecutor` " -"and :class:`concurrent.futures.ProcessPoolExecutor` now raises a :exc:" -"`RuntimeError` if called during interpreter shutdown. (Contributed by Mark " -"Nemec in :issue:`33097`.)" +"and :class:`concurrent.futures.ProcessPoolExecutor` now raises " +"a :exc:`RuntimeError` if called during interpreter shutdown. (Contributed by " +"Mark Nemec in :issue:`33097`.)" msgstr "" #: ../../whatsnew/3.7.rst:2450 @@ -3518,9 +3557,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2456 msgid "" -"Several undocumented internal imports were removed. One example is that ``os." -"errno`` is no longer available; use ``import errno`` directly instead. Note " -"that such undocumented internal imports may be removed any time without " +"Several undocumented internal imports were removed. One example is that " +"``os.errno`` is no longer available; use ``import errno`` directly instead. " +"Note that such undocumented internal imports may be removed any time without " "notice, even in micro version releases." msgstr "" @@ -3531,13 +3570,13 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.7.rst:2466 msgid "" "The function :c:func:`PySlice_GetIndicesEx` is considered unsafe for " -"resizable sequences. If the slice indices are not instances of :class:" -"`int`, but objects that implement the :meth:`!__index__` method, the " -"sequence can be resized after passing its length to :c:func:`!" +"resizable sequences. If the slice indices are not instances " +"of :class:`int`, but objects that implement the :meth:`!__index__` method, " +"the sequence can be resized after passing its length to :c:func:`!" "PySlice_GetIndicesEx`. This can lead to returning indices out of the length " -"of the sequence. For avoiding possible problems use new functions :c:func:" -"`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy " -"Storchaka in :issue:`27867`.)" +"of the sequence. For avoiding possible problems use new " +"functions :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. " +"(Contributed by Serhiy Storchaka in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:2477 @@ -3559,9 +3598,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2489 msgid "" "The file used to override :data:`sys.path` is now called ``<python-" -"executable>._pth`` instead of ``'sys.path'``. See :ref:" -"`windows_finding_modules` for more information. (Contributed by Steve Dower " -"in :issue:`28137`.)" +"executable>._pth`` instead of ``'sys.path'``. " +"See :ref:`windows_finding_modules` for more information. (Contributed by " +"Steve Dower in :issue:`28137`.)" msgstr "" #: ../../whatsnew/3.7.rst:2496 @@ -3603,8 +3642,8 @@ msgid "" "setting :c:data:`Py_BytesWarningFlag` to a value greater than one is no " "longer sufficient to both emit :exc:`BytesWarning` messages and have them " "converted to exceptions. Instead, the flag must be set (to cause the " -"warnings to be emitted in the first place), and an explicit ``error::" -"BytesWarning`` warnings filter added to convert them to exceptions." +"warnings to be emitted in the first place), and an explicit " +"``error::BytesWarning`` warnings filter added to convert them to exceptions." msgstr "" #: ../../whatsnew/3.7.rst:2526 @@ -3633,8 +3672,9 @@ msgid "" "respects all of the same environment settings as :c:func:`Py_Main` (in " "earlier Python versions, it respected an ill-defined subset of those " "environment variables, while in Python 3.7.0 it didn't read any of them due " -"to :issue:`34247`). If this behavior is unwanted, set :c:data:" -"`Py_IgnoreEnvironmentFlag` to 1 before calling :c:func:`Py_Initialize`." +"to :issue:`34247`). If this behavior is unwanted, " +"set :c:data:`Py_IgnoreEnvironmentFlag` to 1 before " +"calling :c:func:`Py_Initialize`." msgstr "" #: ../../whatsnew/3.7.rst:2546 @@ -3672,12 +3712,12 @@ msgstr "Python 3.7.6 中顯著的變更" #: ../../whatsnew/3.7.rst:2568 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.7.rst:2576 @@ -3687,13 +3727,14 @@ msgstr "Python 3.7.10 中顯著的變更" #: ../../whatsnew/3.7.rst:2578 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.7.rst:2589 @@ -3715,8 +3756,8 @@ msgid "" "forms of attacks. Following the WHATWG specification that updates RFC 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"removal characters are controlled by a new module level variable " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.7.rst:2606 diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index a537637276..d736d9a29a 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -32,8 +32,8 @@ msgstr "Raymond Hettinger" #: ../../whatsnew/3.8.rst:47 msgid "" "This article explains the new features in Python 3.8, compared to 3.7. " -"Python 3.8 was released on October 14, 2019. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.8 was released on October 14, 2019. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.8 與 3.7 相比多了哪些新功能。Python 3.8 已於 2019 年 10 " "月 14 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -54,8 +54,9 @@ msgstr "" msgid "" "There is new syntax ``:=`` that assigns values to variables as part of a " "larger expression. It is affectionately known as \"the walrus operator\" due " -"to its resemblance to `the eyes and tusks of a walrus <https://en.wikipedia." -"org/wiki/Walrus#/media/File:Pacific_Walrus_-_Bull_(8247646168).jpg>`_." +"to its resemblance to `the eyes and tusks of a walrus <https://" +"en.wikipedia.org/wiki/Walrus#/media/File:Pacific_Walrus_-" +"_Bull_(8247646168).jpg>`_." msgstr "" #: ../../whatsnew/3.8.rst:82 @@ -138,8 +139,8 @@ msgid "" "There is a new function parameter syntax ``/`` to indicate that some " "function parameters must be specified positionally and cannot be used as " "keyword arguments. This is the same notation shown by ``help()`` for C " -"functions annotated with Larry Hastings' `Argument Clinic <https://devguide." -"python.org/development-tools/clinic/>`__ tool." +"functions annotated with Larry Hastings' `Argument Clinic <https://" +"devguide.python.org/development-tools/clinic/>`__ tool." msgstr "" #: ../../whatsnew/3.8.rst:128 @@ -272,8 +273,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:201 msgid "" -"The location of the cache is reported in :data:`sys.pycache_prefix` (:const:" -"`None` indicates the default location in ``__pycache__`` subdirectories)." +"The location of the cache is reported in :data:`sys.pycache_prefix` " +"(:const:`None` indicates the default location in ``__pycache__`` " +"subdirectories)." msgstr "" #: ../../whatsnew/3.8.rst:205 @@ -296,10 +298,10 @@ msgid "" "Release builds and :ref:`debug builds <debug-build>` are now ABI compatible: " "defining the ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` " "macro, which introduces the only ABI incompatibility. The ``Py_TRACE_REFS`` " -"macro, which adds the :func:`sys.getobjects` function and the :envvar:" -"`PYTHONDUMPREFS` environment variable, can be set using the new :option:`./" -"configure --with-trace-refs <--with-trace-refs>` build option. (Contributed " -"by Victor Stinner in :issue:`36465`.)" +"macro, which adds the :func:`sys.getobjects` function and " +"the :envvar:`PYTHONDUMPREFS` environment variable, can be set using the " +"new :option:`./configure --with-trace-refs <--with-trace-refs>` build " +"option. (Contributed by Victor Stinner in :issue:`36465`.)" msgstr "" #: ../../whatsnew/3.8.rst:223 @@ -341,8 +343,8 @@ msgid "" "On the other hand, ``pkg-config python3.8 --libs`` no longer contains ``-" "lpython3.8``. C extensions must not be linked to libpython (except on " "Android and Cygwin, whose cases are handled by the script); this change is " -"backward incompatible on purpose. (Contributed by Victor Stinner in :issue:" -"`36721`.)" +"backward incompatible on purpose. (Contributed by Victor Stinner " +"in :issue:`36721`.)" msgstr "" #: ../../whatsnew/3.8.rst:256 @@ -576,8 +578,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:354 msgid "" ":ref:`vectorcall` is added to the Python/C API. It is meant to formalize " -"existing optimizations which were already done for various classes. Any :ref:" -"`static type <static-types>` implementing a callable can use this protocol." +"existing optimizations which were already done for various classes. " +"Any :ref:`static type <static-types>` implementing a callable can use this " +"protocol." msgstr "" #: ../../whatsnew/3.8.rst:360 @@ -592,8 +595,8 @@ msgstr "完整敘述請見 :pep:`590`。" #: ../../whatsnew/3.8.rst:365 msgid "" -"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in :issue:" -"`36974`.)" +"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin " +"in :issue:`36974`.)" msgstr "" "(由 Jeroen Demeyer、Mark Shannon 和 Petr Viktorin 在 :issue:`36974` 中貢" "獻。)" @@ -639,19 +642,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:393 msgid "" "The :class:`bool`, :class:`int`, and :class:`fractions.Fraction` types now " -"have an :meth:`~int.as_integer_ratio` method like that found in :class:" -"`float` and :class:`decimal.Decimal`. This minor API extension makes it " -"possible to write ``numerator, denominator = x.as_integer_ratio()`` and have " -"it work across multiple numeric types. (Contributed by Lisa Roach in :issue:" -"`33073` and Raymond Hettinger in :issue:`37819`.)" +"have an :meth:`~int.as_integer_ratio` method like that found " +"in :class:`float` and :class:`decimal.Decimal`. This minor API extension " +"makes it possible to write ``numerator, denominator = x.as_integer_ratio()`` " +"and have it work across multiple numeric types. (Contributed by Lisa Roach " +"in :issue:`33073` and Raymond Hettinger in :issue:`37819`.)" msgstr "" #: ../../whatsnew/3.8.rst:401 msgid "" "Constructors of :class:`int`, :class:`float` and :class:`complex` will now " "use the :meth:`~object.__index__` special method, if available and the " -"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` or :" -"meth:`~object.__complex__` is not available. (Contributed by Serhiy " +"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` is not available. (Contributed by Serhiy " "Storchaka in :issue:`20092`.)" msgstr "" @@ -680,8 +683,8 @@ msgstr "(由 Jonathan Eunice 和 Serhiy Storchaka 在 :issue:`30688` 中貢獻 #: ../../whatsnew/3.8.rst:416 msgid "" -"Dict and dictviews are now iterable in reversed insertion order using :func:" -"`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" +"Dict and dictviews are now iterable in reversed insertion order " +"using :func:`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" msgstr "" #: ../../whatsnew/3.8.rst:419 @@ -689,8 +692,8 @@ msgid "" "The syntax allowed for keyword names in function calls was further " "restricted. In particular, ``f((keyword)=arg)`` is no longer allowed. It was " "never intended to permit more than a bare name on the left-hand side of a " -"keyword argument assignment term. (Contributed by Benjamin Peterson in :" -"issue:`34641`.)" +"keyword argument assignment term. (Contributed by Benjamin Peterson " +"in :issue:`34641`.)" msgstr "" #: ../../whatsnew/3.8.rst:425 @@ -730,12 +733,13 @@ msgstr "" #: ../../whatsnew/3.8.rst:445 msgid "" -"Arithmetic operations between subclasses of :class:`datetime.date` or :class:" -"`datetime.datetime` and :class:`datetime.timedelta` objects now return an " -"instance of the subclass, rather than the base class. This also affects the " -"return type of operations whose implementation (directly or indirectly) " -"uses :class:`datetime.timedelta` arithmetic, such as :meth:`~datetime." -"datetime.astimezone`. (Contributed by Paul Ganssle in :issue:`32417`.)" +"Arithmetic operations between subclasses of :class:`datetime.date` " +"or :class:`datetime.datetime` and :class:`datetime.timedelta` objects now " +"return an instance of the subclass, rather than the base class. This also " +"affects the return type of operations whose implementation (directly or " +"indirectly) uses :class:`datetime.timedelta` arithmetic, such " +"as :meth:`~datetime.datetime.astimezone`. (Contributed by Paul Ganssle " +"in :issue:`32417`.)" msgstr "" #: ../../whatsnew/3.8.rst:453 @@ -750,12 +754,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:460 msgid "" -"Some advanced styles of programming require updating the :class:`types." -"CodeType` object for an existing function. Since code objects are " -"immutable, a new code object needs to be created, one that is modeled on the " -"existing code object. With 19 parameters, this was somewhat tedious. Now, " -"the new ``replace()`` method makes it possible to create a clone with a few " -"altered parameters." +"Some advanced styles of programming require updating " +"the :class:`types.CodeType` object for an existing function. Since code " +"objects are immutable, a new code object needs to be created, one that is " +"modeled on the existing code object. With 19 parameters, this was somewhat " +"tedious. Now, the new ``replace()`` method makes it possible to create a " +"clone with a few altered parameters." msgstr "" #: ../../whatsnew/3.8.rst:467 @@ -877,9 +881,9 @@ msgid "" "elements long. Formerly, five was the limit. The new, optional sixth " "element is a callable with a ``(obj, state)`` signature. This allows the " "direct control over the state-updating behavior of a specific object. If " -"not *None*, this callable will have priority over the object's :meth:" -"`~__setstate__` method. (Contributed by Pierre Glaser and Olivier Grisel in :" -"issue:`35900`.)" +"not *None*, this callable will have priority over the " +"object's :meth:`~__setstate__` method. (Contributed by Pierre Glaser and " +"Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:543 @@ -946,8 +950,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:584 msgid "" -"``type_comments=True`` causes it to return the text of :pep:`484` and :pep:" -"`526` type comments associated with certain AST nodes;" +"``type_comments=True`` causes it to return the text of :pep:`484` " +"and :pep:`526` type comments associated with certain AST nodes;" msgstr "" #: ../../whatsnew/3.8.rst:587 @@ -959,8 +963,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:590 msgid "" "``feature_version=(3, N)`` allows specifying an earlier Python 3 version. " -"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` and :" -"keyword:`await` as non-reserved words." +"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` " +"and :keyword:`await` as non-reserved words." msgstr "" #: ../../whatsnew/3.8.rst:594 @@ -1032,8 +1036,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:629 msgid "" -"The actual implementation is significantly more complex. Thus, :func:" -"`asyncio.run` should be the preferred way of running asyncio programs." +"The actual implementation is significantly more complex. " +"Thus, :func:`asyncio.run` should be the preferred way of running asyncio " +"programs." msgstr "" #: ../../whatsnew/3.8.rst:632 @@ -1074,16 +1079,17 @@ msgstr "(由 Yury Selivanov 在 :issue:`37028` 中貢獻。)" #: ../../whatsnew/3.8.rst:651 ../../whatsnew/3.8.rst:1970 msgid "" -"The exception :class:`asyncio.CancelledError` now inherits from :class:" -"`BaseException` rather than :class:`Exception` and no longer inherits from :" -"class:`concurrent.futures.CancelledError`. (Contributed by Yury Selivanov " -"in :issue:`32528`.)" +"The exception :class:`asyncio.CancelledError` now inherits " +"from :class:`BaseException` rather than :class:`Exception` and no longer " +"inherits from :class:`concurrent.futures.CancelledError`. (Contributed by " +"Yury Selivanov in :issue:`32528`.)" msgstr "" #: ../../whatsnew/3.8.rst:656 msgid "" -"On Windows, the default event loop is now :class:`~asyncio." -"ProactorEventLoop`. (Contributed by Victor Stinner in :issue:`34687`.)" +"On Windows, the default event loop is " +"now :class:`~asyncio.ProactorEventLoop`. (Contributed by Victor Stinner " +"in :issue:`34687`.)" msgstr "" #: ../../whatsnew/3.8.rst:659 @@ -1094,9 +1100,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:662 msgid "" -":class:`~asyncio.ProactorEventLoop` can now be interrupted by :exc:" -"`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev in :issue:" -"`23057`.)" +":class:`~asyncio.ProactorEventLoop` can now be interrupted " +"by :exc:`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev " +"in :issue:`23057`.)" msgstr "" #: ../../whatsnew/3.8.rst:666 @@ -1108,12 +1114,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:670 msgid "" "Asyncio tasks can now be named, either by passing the ``name`` keyword " -"argument to :func:`asyncio.create_task` or the :meth:`~asyncio.loop." -"create_task` event loop method, or by calling the :meth:`~asyncio.Task." -"set_name` method on the task object. The task name is visible in the " -"``repr()`` output of :class:`asyncio.Task` and can also be retrieved using " -"the :meth:`~asyncio.Task.get_name` method. (Contributed by Alex Grönholm in :" -"issue:`34270`.)" +"argument to :func:`asyncio.create_task` or " +"the :meth:`~asyncio.loop.create_task` event loop method, or by calling " +"the :meth:`~asyncio.Task.set_name` method on the task object. The task name " +"is visible in the ``repr()`` output of :class:`asyncio.Task` and can also be " +"retrieved using the :meth:`~asyncio.Task.get_name` method. (Contributed by " +"Alex Grönholm in :issue:`34270`.)" msgstr "" #: ../../whatsnew/3.8.rst:678 @@ -1132,12 +1138,12 @@ msgstr "builtins(內建)" #: ../../whatsnew/3.8.rst:690 msgid "" -"The :func:`compile` built-in has been improved to accept the ``ast." -"PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag passed, :func:" -"`compile` will allow top-level ``await``, ``async for`` and ``async with`` " -"constructs that are usually considered invalid syntax. Asynchronous code " -"object marked with the ``CO_COROUTINE`` flag may then be returned. " -"(Contributed by Matthias Bussonnier in :issue:`34616`)" +"The :func:`compile` built-in has been improved to accept the " +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag " +"passed, :func:`compile` will allow top-level ``await``, ``async for`` and " +"``async with`` constructs that are usually considered invalid syntax. " +"Asynchronous code object marked with the ``CO_COROUTINE`` flag may then be " +"returned. (Contributed by Matthias Bussonnier in :issue:`34616`)" msgstr "" #: ../../whatsnew/3.8.rst:699 @@ -1146,13 +1152,13 @@ msgstr "collections" #: ../../whatsnew/3.8.rst:701 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns a :class:`dict` instead of a :class:" -"`collections.OrderedDict`. This works because regular dicts have guaranteed " -"ordering since Python 3.7. If the extra features of :class:`OrderedDict` are " -"required, the suggested remediation is to cast the result to the desired " -"type: ``OrderedDict(nt._asdict())``. (Contributed by Raymond Hettinger in :" -"issue:`35864`.)" +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns a :class:`dict` instead of " +"a :class:`collections.OrderedDict`. This works because regular dicts have " +"guaranteed ordering since Python 3.7. If the extra features " +"of :class:`OrderedDict` are required, the suggested remediation is to cast " +"the result to the desired type: ``OrderedDict(nt._asdict())``. (Contributed " +"by Raymond Hettinger in :issue:`35864`.)" msgstr "" #: ../../whatsnew/3.8.rst:711 @@ -1211,8 +1217,9 @@ msgid "" "parameter to specify flags for the underlying ``LoadLibraryEx`` call. The " "default flags are set to only load DLL dependencies from trusted locations, " "including the path where the DLL is stored (if a full or partial path is " -"used to load the initial DLL) and paths added by :func:`~os." -"add_dll_directory`. (Contributed by Steve Dower in :issue:`36085`.)" +"used to load the initial DLL) and paths added " +"by :func:`~os.add_dll_directory`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:754 @@ -1221,11 +1228,12 @@ msgstr "datetime" #: ../../whatsnew/3.8.rst:756 msgid "" -"Added new alternate constructors :meth:`datetime.date.fromisocalendar` and :" -"meth:`datetime.datetime.fromisocalendar`, which construct :class:`~datetime." -"date` and :class:`~datetime.datetime` objects respectively from ISO year, " -"week number, and weekday; these are the inverse of each class's " -"``isocalendar`` method. (Contributed by Paul Ganssle in :issue:`36004`.)" +"Added new alternate constructors :meth:`datetime.date.fromisocalendar` " +"and :meth:`datetime.datetime.fromisocalendar`, which " +"construct :class:`~datetime.date` and :class:`~datetime.datetime` objects " +"respectively from ISO year, week number, and weekday; these are the inverse " +"of each class's ``isocalendar`` method. (Contributed by Paul Ganssle " +"in :issue:`36004`.)" msgstr "" #: ../../whatsnew/3.8.rst:764 @@ -1298,8 +1306,8 @@ msgstr "(由 Carl Meyer 在 :issue:`21145` 中貢獻)" #: ../../whatsnew/3.8.rst:796 msgid "" "Added a new :func:`functools.singledispatchmethod` decorator that converts " -"methods into :term:`generic functions <generic function>` using :term:" -"`single dispatch`::" +"methods into :term:`generic functions <generic function>` " +"using :term:`single dispatch`::" msgstr "" #: ../../whatsnew/3.8.rst:800 @@ -1410,8 +1418,8 @@ msgid "" "Added optional line numbers for IDLE editor windows. Windows open without " "line numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" #: ../../whatsnew/3.8.rst:869 @@ -1430,8 +1438,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:878 msgid "" -"Add option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Add option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.8.rst:881 @@ -1590,8 +1598,8 @@ msgstr "(由 Pablo Galindo 在 :issue:`35606` 中貢獻。)" #: ../../whatsnew/3.8.rst:975 msgid "" -"Added two new combinatoric functions :func:`math.perm` and :func:`math." -"comb`::" +"Added two new combinatoric functions :func:`math.perm` " +"and :func:`math.comb`::" msgstr "" #: ../../whatsnew/3.8.rst:977 @@ -1607,8 +1615,8 @@ msgid "" "(Contributed by Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, and Raymond " "Hettinger in :issue:`37128`, :issue:`37178`, and :issue:`35431`.)" msgstr "" -"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger 在 :" -"issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" +"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger " +"在 :issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" #: ../../whatsnew/3.8.rst:985 msgid "" @@ -1627,6 +1635,12 @@ msgid "" ">>> floor(sqrt(s - 1)) # incorrect\n" "650320427" msgstr "" +">>> r = 650320427\n" +">>> s = r ** 2\n" +">>> isqrt(s - 1) # 正確\n" +"650320426\n" +">>> floor(sqrt(s - 1)) # 錯誤\n" +"650320427" #: ../../whatsnew/3.8.rst:997 msgid "(Contributed by Mark Dickinson in :issue:`36887`.)" @@ -1645,8 +1659,8 @@ msgstr "mmap" #: ../../whatsnew/3.8.rst:1006 msgid "" "The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.madvise` method to " -"access the ``madvise()`` system call. (Contributed by Zackery Spytz in :" -"issue:`32941`.)" +"access the ``madvise()`` system call. (Contributed by Zackery Spytz " +"in :issue:`32941`.)" msgstr "" #: ../../whatsnew/3.8.rst:1012 @@ -1673,8 +1687,8 @@ msgstr "os" msgid "" "Added new function :func:`~os.add_dll_directory` on Windows for providing " "additional search paths for native dependencies when importing extension " -"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower in :" -"issue:`36085`.)" +"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:1029 @@ -1690,11 +1704,11 @@ msgid "" "symlinks and directory junctions) has been delegated to the operating " "system. Specifically, :func:`os.stat` will now traverse anything supported " "by the operating system, while :func:`os.lstat` will only open reparse " -"points that identify as \"name surrogates\" while others are opened as for :" -"func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only have " -"``S_IFLNK`` set for symbolic links and not other kinds of reparse points. To " -"identify other kinds of reparse point, check the new :attr:`stat_result." -"st_reparse_tag` attribute." +"points that identify as \"name surrogates\" while others are opened as " +"for :func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only " +"have ``S_IFLNK`` set for symbolic links and not other kinds of reparse " +"points. To identify other kinds of reparse point, check the " +"new :attr:`stat_result.st_reparse_tag` attribute." msgstr "" #: ../../whatsnew/3.8.rst:1042 @@ -1702,8 +1716,8 @@ msgid "" "On Windows, :func:`os.readlink` is now able to read directory junctions. " "Note that :func:`~os.path.islink` will return ``False`` for directory " "junctions, and so code that checks ``islink`` first will continue to treat " -"junctions as directories, while code that handles errors from :func:`os." -"readlink` may now treat junctions as links." +"junctions as directories, while code that handles errors " +"from :func:`os.readlink` may now treat junctions as links." msgstr "" #: ../../whatsnew/3.8.rst:1048 ../../whatsnew/3.8.rst:1073 @@ -1716,21 +1730,21 @@ msgstr "os.path" #: ../../whatsnew/3.8.rst:1054 msgid "" -":mod:`os.path` functions that return a boolean result like :func:`~os.path." -"exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path." -"isfile`, :func:`~os.path.islink`, and :func:`~os.path.ismount` now return " -"``False`` instead of raising :exc:`ValueError` or its subclasses :exc:" -"`UnicodeEncodeError` and :exc:`UnicodeDecodeError` for paths that contain " -"characters or bytes unrepresentable at the OS level. (Contributed by Serhiy " -"Storchaka in :issue:`33721`.)" +":mod:`os.path` functions that return a boolean result " +"like :func:`~os.path.exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path.isfile`, :func:`~os.path.islink`, " +"and :func:`~os.path.ismount` now return ``False`` instead of " +"raising :exc:`ValueError` or its subclasses :exc:`UnicodeEncodeError` " +"and :exc:`UnicodeDecodeError` for paths that contain characters or bytes " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1062 ../../whatsnew/3.8.rst:1965 msgid "" ":func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE` " "environment variable and does not use :envvar:`HOME`, which is not normally " -"set for regular user accounts. (Contributed by Anthony Sottile in :issue:" -"`36264`.)" +"set for regular user accounts. (Contributed by Anthony Sottile " +"in :issue:`36264`.)" msgstr "" #: ../../whatsnew/3.8.rst:1067 @@ -1751,14 +1765,12 @@ msgstr "pathlib" #: ../../whatsnew/3.8.rst:1079 msgid "" -":mod:`pathlib.Path` methods that return a boolean result like :meth:" -"`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path." -"is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :" -"meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :" -"meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` now return " -"``False`` instead of raising :exc:`ValueError` or its subclass :exc:" -"`UnicodeEncodeError` for paths that contain characters unrepresentable at " -"the OS level. (Contributed by Serhiy Storchaka in :issue:`33721`.)" +":mod:`pathlib.Path` methods that return a boolean result " +"like :meth:`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path.is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` " +"now return ``False`` instead of raising :exc:`ValueError` or its " +"subclass :exc:`UnicodeEncodeError` for paths that contain characters " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1089 @@ -1776,10 +1788,11 @@ msgstr "pickle" #: ../../whatsnew/3.8.rst:1100 msgid "" -":mod:`pickle` extensions subclassing the C-optimized :class:`~pickle." -"Pickler` can now override the pickling logic of functions and classes by " -"defining the special :meth:`~pickle.Pickler.reducer_override` method. " -"(Contributed by Pierre Glaser and Olivier Grisel in :issue:`35900`.)" +":mod:`pickle` extensions subclassing the C-" +"optimized :class:`~pickle.Pickler` can now override the pickling logic of " +"functions and classes by defining the " +"special :meth:`~pickle.Pickler.reducer_override` method. (Contributed by " +"Pierre Glaser and Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:1107 @@ -1789,8 +1802,8 @@ msgstr "plistlib" #: ../../whatsnew/3.8.rst:1109 msgid "" "Added new :class:`plistlib.UID` and enabled support for reading and writing " -"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen in :issue:" -"`26707`.)" +"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen " +"in :issue:`26707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1115 @@ -1815,8 +1828,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1126 msgid "" ">>> from pprint import pprint, pp\n" -">>> d = dict(source='input.txt', operation='filter', destination='output." -"txt')\n" +">>> d = dict(source='input.txt', operation='filter', " +"destination='output.txt')\n" ">>> pp(d, width=40) # Original order\n" "{'source': 'input.txt',\n" " 'operation': 'filter',\n" @@ -1847,8 +1860,8 @@ msgstr "shlex" #: ../../whatsnew/3.8.rst:1150 msgid "" -"The new :func:`shlex.join` function acts as the inverse of :func:`shlex." -"split`. (Contributed by Bo Bayles in :issue:`32102`.)" +"The new :func:`shlex.join` function acts as the inverse " +"of :func:`shlex.split`. (Contributed by Bo Bayles in :issue:`32102`.)" msgstr "" #: ../../whatsnew/3.8.rst:1155 @@ -1872,8 +1885,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1165 msgid "" ":func:`shutil.rmtree` on Windows now removes directory junctions without " -"recursively removing their contents first. (Contributed by Steve Dower in :" -"issue:`37834`.)" +"recursively removing their contents first. (Contributed by Steve Dower " +"in :issue:`37834`.)" msgstr "" #: ../../whatsnew/3.8.rst:1171 @@ -1890,9 +1903,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1178 msgid "" -"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, and :func:" -"`socket.if_indextoname` functions have been implemented on Windows. " -"(Contributed by Zackery Spytz in :issue:`37007`.)" +"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, " +"and :func:`socket.if_indextoname` functions have been implemented on " +"Windows. (Contributed by Zackery Spytz in :issue:`37007`.)" msgstr "" #: ../../whatsnew/3.8.rst:1184 @@ -1901,9 +1914,10 @@ msgstr "ssl" #: ../../whatsnew/3.8.rst:1186 msgid "" -"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable and :meth:`~ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :issue:`34670`.)" +"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`~ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :issue:`34670`.)" msgstr "" #: ../../whatsnew/3.8.rst:1193 @@ -1912,9 +1926,9 @@ msgstr "statistics" #: ../../whatsnew/3.8.rst:1195 msgid "" -"Added :func:`statistics.fmean` as a faster, floating-point variant of :func:" -"`statistics.mean`. (Contributed by Raymond Hettinger and Steven D'Aprano " -"in :issue:`35904`.)" +"Added :func:`statistics.fmean` as a faster, floating-point variant " +"of :func:`statistics.mean`. (Contributed by Raymond Hettinger and Steven " +"D'Aprano in :issue:`35904`.)" msgstr "" #: ../../whatsnew/3.8.rst:1199 @@ -1922,8 +1936,8 @@ msgid "" "Added :func:`statistics.geometric_mean` (Contributed by Raymond Hettinger " "in :issue:`27181`.)" msgstr "" -"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger 在 :issue:" -"`27181` 中貢獻。)" +"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger " +"在 :issue:`27181` 中貢獻。)" #: ../../whatsnew/3.8.rst:1202 msgid "" @@ -2002,20 +2016,21 @@ msgstr "threading" #: ../../whatsnew/3.8.rst:1262 msgid "" -"Add a new :func:`threading.excepthook` function which handles uncaught :meth:" -"`threading.Thread.run` exception. It can be overridden to control how " -"uncaught :meth:`threading.Thread.run` exceptions are handled. (Contributed " -"by Victor Stinner in :issue:`1230540`.)" +"Add a new :func:`threading.excepthook` function which handles " +"uncaught :meth:`threading.Thread.run` exception. It can be overridden to " +"control how uncaught :meth:`threading.Thread.run` exceptions are handled. " +"(Contributed by Victor Stinner in :issue:`1230540`.)" msgstr "" #: ../../whatsnew/3.8.rst:1267 msgid "" -"Add a new :func:`threading.get_native_id` function and a :data:`~threading." -"Thread.native_id` attribute to the :class:`threading.Thread` class. These " -"return the native integral Thread ID of the current thread assigned by the " -"kernel. This feature is only available on certain platforms, see :func:" -"`get_native_id <threading.get_native_id>` for more information. (Contributed " -"by Jake Tesler in :issue:`36084`.)" +"Add a new :func:`threading.get_native_id` function and " +"a :data:`~threading.Thread.native_id` attribute to " +"the :class:`threading.Thread` class. These return the native integral Thread " +"ID of the current thread assigned by the kernel. This feature is only " +"available on certain platforms, see :func:`get_native_id " +"<threading.get_native_id>` for more information. (Contributed by Jake Tesler " +"in :issue:`36084`.)" msgstr "" #: ../../whatsnew/3.8.rst:1277 @@ -2036,10 +2051,10 @@ msgstr "tkinter" #: ../../whatsnew/3.8.rst:1288 msgid "" -"Added methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter." -"Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` and :" -"meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` class. " -"(Contributed by Juliette Monsel in :issue:`34829`.)" +"Added " +"methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter.Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` " +"and :meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` " +"class. (Contributed by Juliette Monsel in :issue:`34829`.)" msgstr "" #: ../../whatsnew/3.8.rst:1295 @@ -2050,9 +2065,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1299 msgid "" -"The :class:`tkinter.PhotoImage` class now has :meth:`~tkinter.PhotoImage." -"transparency_get` and :meth:`~tkinter.PhotoImage.transparency_set` methods. " -"(Contributed by Zackery Spytz in :issue:`25451`.)" +"The :class:`tkinter.PhotoImage` class now " +"has :meth:`~tkinter.PhotoImage.transparency_get` " +"and :meth:`~tkinter.PhotoImage.transparency_set` methods. (Contributed by " +"Zackery Spytz in :issue:`25451`.)" msgstr "" #: ../../whatsnew/3.8.rst:1306 @@ -2075,10 +2091,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1317 msgid "" -"A dictionary type with per-key types. See :pep:`589` and :class:`typing." -"TypedDict`. TypedDict uses only string keys. By default, every key is " -"required to be present. Specify \"total=False\" to allow keys to be " -"optional::" +"A dictionary type with per-key types. See :pep:`589` " +"and :class:`typing.TypedDict`. TypedDict uses only string keys. By default, " +"every key is required to be present. Specify \"total=False\" to allow keys " +"to be optional::" msgstr "" #: ../../whatsnew/3.8.rst:1322 @@ -2110,9 +2126,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1334 msgid "" -"\"Final\" variables, functions, methods and classes. See :pep:`591`, :class:" -"`typing.Final` and :func:`typing.final`. The final qualifier instructs a " -"static type checker to restrict subclassing, overriding, or reassignment::" +"\"Final\" variables, functions, methods and classes. " +"See :pep:`591`, :class:`typing.Final` and :func:`typing.final`. The final " +"qualifier instructs a static type checker to restrict subclassing, " +"overriding, or reassignment::" msgstr "" #: ../../whatsnew/3.8.rst:1339 @@ -2121,9 +2138,9 @@ msgstr "pi: Final[float] = 3.1415926536" #: ../../whatsnew/3.8.rst:1341 msgid "" -"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` and :func:" -"`typing.runtime_checkable`. Simple ABCs like :class:`typing.SupportsInt` " -"are now ``Protocol`` subclasses." +"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` " +"and :func:`typing.runtime_checkable`. Simple ABCs " +"like :class:`typing.SupportsInt` are now ``Protocol`` subclasses." msgstr "" #: ../../whatsnew/3.8.rst:1345 @@ -2160,16 +2177,17 @@ msgstr "unittest" msgid "" "Added :class:`~unittest.mock.AsyncMock` to support an asynchronous version " "of :class:`~unittest.mock.Mock`. Appropriate new assert functions for " -"testing have been added as well. (Contributed by Lisa Roach in :issue:" -"`26467`)." +"testing have been added as well. (Contributed by Lisa Roach " +"in :issue:`26467`)." msgstr "" #: ../../whatsnew/3.8.rst:1370 msgid "" -"Added :func:`~unittest.addModuleCleanup` and :meth:`~unittest.TestCase." -"addClassCleanup` to unittest to support cleanups for :func:`~unittest." -"setUpModule` and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa " -"Roach in :issue:`24412`.)" +"Added :func:`~unittest.addModuleCleanup` " +"and :meth:`~unittest.TestCase.addClassCleanup` to unittest to support " +"cleanups for :func:`~unittest.setUpModule` " +"and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa Roach " +"in :issue:`24412`.)" msgstr "" #: ../../whatsnew/3.8.rst:1376 @@ -2257,9 +2275,10 @@ msgstr "xml" #: ../../whatsnew/3.8.rst:1424 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :issue:`17239`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :issue:`17239`.)" msgstr "" #: ../../whatsnew/3.8.rst:1429 @@ -2272,19 +2291,20 @@ msgstr "" #: ../../whatsnew/3.8.rst:1434 msgid "" -"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–xml." -"etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed by " -"Stefan Behnel in :issue:`13611`.)" +"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–" +"xml.etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed " +"by Stefan Behnel in :issue:`13611`.)" msgstr "" #: ../../whatsnew/3.8.rst:1438 msgid "" "The target object of :class:`xml.etree.ElementTree.XMLParser` can receive " "namespace declaration events through the new callback methods ``start_ns()`` " -"and ``end_ns()``. Additionally, the :class:`xml.etree.ElementTree." -"TreeBuilder` target can be configured to process events about comments and " -"processing instructions to include them in the generated tree. (Contributed " -"by Stefan Behnel in :issue:`36676` and :issue:`36673`.)" +"and ``end_ns()``. Additionally, " +"the :class:`xml.etree.ElementTree.TreeBuilder` target can be configured to " +"process events about comments and processing instructions to include them in " +"the generated tree. (Contributed by Stefan Behnel in :issue:`36676` " +"and :issue:`36673`.)" msgstr "" #: ../../whatsnew/3.8.rst:1448 @@ -2331,15 +2351,15 @@ msgstr "(由 Joannah Nanjekye 和 Victor Stinner 在 :issue:`35537` 中貢獻 #: ../../whatsnew/3.8.rst:1471 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls on Linux and macOS in order to copy the file more " -"efficiently. \"fast-copy\" means that the copying operation occurs within " -"the kernel, avoiding the use of userspace buffers in Python as in \"``outfd." -"write(infd.read())``\". On Windows :func:`shutil.copyfile` uses a bigger " -"default buffer size (1 MiB instead of 16 KiB) and a :func:`memoryview`-based " -"variant of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 " -"MiB file within the same partition is about +26% on Linux, +50% on macOS and " +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls on " +"Linux and macOS in order to copy the file more efficiently. \"fast-copy\" " +"means that the copying operation occurs within the kernel, avoiding the use " +"of userspace buffers in Python as in \"``outfd.write(infd.read())``\". On " +"Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " +"instead of 16 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 MiB " +"file within the same partition is about +26% on Linux, +50% on macOS and " "+40% on Windows. Also, much less CPU cycles are consumed. See :ref:`shutil-" "platform-dependent-efficient-copy-operations` section. (Contributed by " "Giampaolo Rodolà in :issue:`33671`.)" @@ -2411,27 +2431,27 @@ msgstr "" msgid "" "Reduced an overhead of converting arguments passed to many builtin functions " "and methods. This sped up calling some simple builtin functions and methods " -"up to 20--50%. (Contributed by Serhiy Storchaka in :issue:`23867`, :issue:" -"`35582` and :issue:`36127`.)" +"up to 20--50%. (Contributed by Serhiy Storchaka " +"in :issue:`23867`, :issue:`35582` and :issue:`36127`.)" msgstr "" #: ../../whatsnew/3.8.rst:1531 msgid "" "``LOAD_GLOBAL`` instruction now uses new \"per opcode cache\" mechanism. It " -"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki in :" -"issue:`26219`.)" +"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki " +"in :issue:`26219`.)" msgstr "" #: ../../whatsnew/3.8.rst:1537 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.8.rst:1539 msgid "" "Default :data:`sys.abiflags` became an empty string: the ``m`` flag for " "pymalloc became useless (builds with and without pymalloc are ABI " -"compatible) and so has been removed. (Contributed by Victor Stinner in :" -"issue:`36707`.)" +"compatible) and so has been removed. (Contributed by Victor Stinner " +"in :issue:`36707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1543 @@ -2531,8 +2551,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1587 msgid "" "The result of :c:func:`PyExceptionClass_Name` is now of type ``const char " -"*`` rather of ``char *``. (Contributed by Serhiy Storchaka in :issue:" -"`33818`.)" +"*`` rather of ``char *``. (Contributed by Serhiy Storchaka " +"in :issue:`33818`.)" msgstr "" #: ../../whatsnew/3.8.rst:1591 @@ -2560,27 +2580,28 @@ msgstr "(由 Antoine Pitrou 在 :issue:`32430` 中貢獻。)" #: ../../whatsnew/3.8.rst:1606 msgid "" -"Functions that convert Python number to C integer like :c:func:" -"`PyLong_AsLong` and argument parsing functions like :c:func:" -"`PyArg_ParseTuple` with integer converting format units like ``'i'`` will " -"now use the :meth:`~object.__index__` special method instead of :meth:" -"`~object.__int__`, if available. The deprecation warning will be emitted " -"for objects with the ``__int__()`` method but without the ``__index__()`` " -"method (like :class:`~decimal.Decimal` and :class:`~fractions.Fraction`). :" -"c:func:`PyNumber_Check` will now return ``1`` for objects implementing " -"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` and :c:" -"func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " -"available. (Contributed by Serhiy Storchaka in :issue:`36048` and :issue:" -"`20092`.)" +"Functions that convert Python number to C integer " +"like :c:func:`PyLong_AsLong` and argument parsing functions " +"like :c:func:`PyArg_ParseTuple` with integer converting format units like " +"``'i'`` will now use the :meth:`~object.__index__` special method instead " +"of :meth:`~object.__int__`, if available. The deprecation warning will be " +"emitted for objects with the ``__int__()`` method but without the " +"``__index__()`` method (like :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`). :c:func:`PyNumber_Check` will now return " +"``1`` for objects implementing " +"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` " +"and :c:func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " +"available. (Contributed by Serhiy Storchaka in :issue:`36048` " +"and :issue:`20092`.)" msgstr "" #: ../../whatsnew/3.8.rst:1620 msgid "" -"Heap-allocated type objects will now increase their reference count in :c:" -"func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) instead of " -"in :c:func:`PyType_GenericAlloc`. Types that modify instance allocation or " -"deallocation may need to be adjusted. (Contributed by Eddie Elizondo in :" -"issue:`35810`.)" +"Heap-allocated type objects will now increase their reference count " +"in :c:func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) " +"instead of in :c:func:`PyType_GenericAlloc`. Types that modify instance " +"allocation or deallocation may need to be adjusted. (Contributed by Eddie " +"Elizondo in :issue:`35810`.)" msgstr "" #: ../../whatsnew/3.8.rst:1626 @@ -2594,8 +2615,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1631 msgid "" ":c:func:`!Py_SetPath` now sets :data:`sys.executable` to the program full " -"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name (:c:" -"func:`Py_GetProgramName`). (Contributed by Victor Stinner in :issue:`38234`.)" +"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name " +"(:c:func:`Py_GetProgramName`). (Contributed by Victor Stinner " +"in :issue:`38234`.)" msgstr "" #: ../../whatsnew/3.8.rst:1638 @@ -2605,38 +2627,40 @@ msgstr "已棄用" #: ../../whatsnew/3.8.rst:1640 msgid "" "The distutils ``bdist_wininst`` command is now deprecated, use " -"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner in :" -"issue:`37481`.)" +"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner " +"in :issue:`37481`.)" msgstr "" #: ../../whatsnew/3.8.rst:1644 msgid "" -"Deprecated methods ``getchildren()`` and ``getiterator()`` in the :mod:`~xml." -"etree.ElementTree` module now emit a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`. They will be removed in Python 3.9. " -"(Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Deprecated methods ``getchildren()`` and ``getiterator()`` in " +"the :mod:`~xml.etree.ElementTree` module now emit " +"a :exc:`DeprecationWarning` instead of :exc:`PendingDeprecationWarning`. " +"They will be removed in Python 3.9. (Contributed by Serhiy Storchaka " +"in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1650 msgid "" -"Passing an object that is not an instance of :class:`concurrent.futures." -"ThreadPoolExecutor` to :meth:`loop.set_default_executor() <asyncio.loop." -"set_default_executor>` is deprecated and will be prohibited in Python 3.9. " -"(Contributed by Elvis Pranskevichus in :issue:`34075`.)" +"Passing an object that is not an instance " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"to :meth:`loop.set_default_executor() <asyncio.loop.set_default_executor>` " +"is deprecated and will be prohibited in Python 3.9. (Contributed by Elvis " +"Pranskevichus in :issue:`34075`.)" msgstr "" #: ../../whatsnew/3.8.rst:1656 msgid "" -"The :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput` have been deprecated." +"The :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput` have been deprecated." msgstr "" #: ../../whatsnew/3.8.rst:1660 msgid "" "Implementations of these methods have been ignoring their *index* parameter, " -"and returning the next item instead. (Contributed by Berker Peksag in :issue:" -"`9372`.)" +"and returning the next item instead. (Contributed by Berker Peksag " +"in :issue:`9372`.)" msgstr "" #: ../../whatsnew/3.8.rst:1664 @@ -2658,28 +2682,25 @@ msgstr "" msgid "" ":class:`ast.NodeVisitor` methods ``visit_Num()``, ``visit_Str()``, " "``visit_Bytes()``, ``visit_NameConstant()`` and ``visit_Ellipsis()`` are " -"deprecated now and will not be called in future Python versions. Add the :" -"meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant nodes. " -"(Contributed by Serhiy Storchaka in :issue:`36917`.)" +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant " +"nodes. (Contributed by Serhiy Storchaka in :issue:`36917`.)" msgstr "" #: ../../whatsnew/3.8.rst:1680 msgid "" "The :func:`asyncio.coroutine` :term:`decorator` is deprecated and will be " -"removed in version 3.10. Instead of ``@asyncio.coroutine``, use :keyword:" -"`async def` instead. (Contributed by Andrew Svetlov in :issue:`36921`.)" +"removed in version 3.10. Instead of ``@asyncio.coroutine``, " +"use :keyword:`async def` instead. (Contributed by Andrew Svetlov " +"in :issue:`36921`.)" msgstr "" #: ../../whatsnew/3.8.rst:1685 msgid "" "In :mod:`asyncio`, the explicit passing of a *loop* argument has been " -"deprecated and will be removed in version 3.10 for the following: :func:" -"`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:" -"`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :" -"class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:" -"`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio." -"BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio." -"create_subprocess_exec`, and :func:`asyncio.create_subprocess_shell`." +"deprecated and will be removed in version 3.10 for the " +"following: :func:`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio.BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio.create_subprocess_exec`, " +"and :func:`asyncio.create_subprocess_shell`." msgstr "" #: ../../whatsnew/3.8.rst:1695 @@ -2692,22 +2713,23 @@ msgstr "" #: ../../whatsnew/3.8.rst:1699 msgid "" "The following functions and methods are deprecated in the :mod:`gettext` " -"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:" -"`~gettext.lngettext` and :func:`~gettext.ldngettext`. They return encoded " -"bytes, and it's possible that you will get unexpected Unicode-related " -"exceptions if there are encoding problems with the translated strings. It's " -"much better to use alternatives which return Unicode strings in Python 3. " -"These functions have been broken for a long time." +"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:`~gettext.lngettext` " +"and :func:`~gettext.ldngettext`. They return encoded bytes, and it's " +"possible that you will get unexpected Unicode-related exceptions if there " +"are encoding problems with the translated strings. It's much better to use " +"alternatives which return Unicode strings in Python 3. These functions have " +"been broken for a long time." msgstr "" #: ../../whatsnew/3.8.rst:1707 msgid "" -"Function :func:`~gettext.bind_textdomain_codeset`, methods :meth:`~gettext." -"NullTranslations.output_charset` and :meth:`~gettext.NullTranslations." -"set_output_charset`, and the *codeset* parameter of functions :func:" -"`~gettext.translation` and :func:`~gettext.install` are also deprecated, " -"since they are only used for the ``l*gettext()`` functions. (Contributed by " -"Serhiy Storchaka in :issue:`33710`.)" +"Function :func:`~gettext.bind_textdomain_codeset`, " +"methods :meth:`~gettext.NullTranslations.output_charset` " +"and :meth:`~gettext.NullTranslations.set_output_charset`, and the *codeset* " +"parameter of functions :func:`~gettext.translation` " +"and :func:`~gettext.install` are also deprecated, since they are only used " +"for the ``l*gettext()`` functions. (Contributed by Serhiy Storchaka " +"in :issue:`33710`.)" msgstr "" #: ../../whatsnew/3.8.rst:1715 @@ -2719,11 +2741,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1719 msgid "" "Many builtin and extension functions that take integer arguments will now " -"emit a deprecation warning for :class:`~decimal.Decimal`\\ s, :class:" -"`~fractions.Fraction`\\ s and any other objects that can be converted to " -"integers only with a loss (e.g. that have the :meth:`~object.__int__` method " -"but do not have the :meth:`~object.__index__` method). In future version " -"they will be errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" +"emit a deprecation warning for :class:`~decimal.Decimal`\\ " +"s, :class:`~fractions.Fraction`\\ s and any other objects that can be " +"converted to integers only with a loss (e.g. that have " +"the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). In future version they will be " +"errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" msgstr "" #: ../../whatsnew/3.8.rst:1727 @@ -2732,9 +2755,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1729 msgid "" -"*func* in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:" -"`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb." -"runcall`, :meth:`trace.Trace.runfunc` and :func:`curses.wrapper`." +"*func* " +"in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb.runcall`, :meth:`trace.Trace.runfunc` " +"and :func:`curses.wrapper`." msgstr "" #: ../../whatsnew/3.8.rst:1733 @@ -2743,23 +2766,23 @@ msgstr "" #: ../../whatsnew/3.8.rst:1734 msgid "" -"*fn* in the :meth:`~concurrent.futures.Executor.submit` method of :class:" -"`concurrent.futures.ThreadPoolExecutor` and :class:`concurrent.futures." -"ProcessPoolExecutor`." +"*fn* in the :meth:`~concurrent.futures.Executor.submit` method " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"and :class:`concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.8.rst:1737 msgid "" -"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib." -"AsyncExitStack.callback` and :meth:`contextlib.AsyncExitStack." -"push_async_callback`." +"*callback* " +"in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib.AsyncExitStack.callback` " +"and :meth:`contextlib.AsyncExitStack.push_async_callback`." msgstr "" #: ../../whatsnew/3.8.rst:1740 msgid "" "*c* and *typeid* in the :meth:`~multiprocessing.managers.Server.create` " -"method of :class:`multiprocessing.managers.Server` and :class:" -"`multiprocessing.managers.SharedMemoryServer`." +"method of :class:`multiprocessing.managers.Server` " +"and :class:`multiprocessing.managers.SharedMemoryServer`." msgstr "" #: ../../whatsnew/3.8.rst:1743 @@ -2774,7 +2797,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1751 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.8.rst:1753 msgid "The following features and APIs have been removed from Python 3.8:" @@ -2804,9 +2827,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1767 msgid "" "The function :func:`time.clock` has been removed, after having been " -"deprecated since Python 3.3: use :func:`time.perf_counter` or :func:`time." -"process_time` instead, depending on your requirements, to have well-defined " -"behavior. (Contributed by Matthias Bussonnier in :issue:`36895`.)" +"deprecated since Python 3.3: use :func:`time.perf_counter` " +"or :func:`time.process_time` instead, depending on your requirements, to " +"have well-defined behavior. (Contributed by Matthias Bussonnier " +"in :issue:`36895`.)" msgstr "" #: ../../whatsnew/3.8.rst:1773 @@ -2839,14 +2863,15 @@ msgstr "" #: ../../whatsnew/3.8.rst:1789 msgid "" -"Removed the ``doctype()`` method of :class:`~xml.etree.ElementTree." -"XMLParser`. (Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Removed the ``doctype()`` method " +"of :class:`~xml.etree.ElementTree.XMLParser`. (Contributed by Serhiy " +"Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1792 msgid "" -"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki in :issue:" -"`36297`.)" +"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki " +"in :issue:`36297`.)" msgstr "" #: ../../whatsnew/3.8.rst:1795 @@ -2857,16 +2882,17 @@ msgstr "" #: ../../whatsnew/3.8.rst:1799 msgid "" -"The ``bufsize`` keyword argument of :func:`fileinput.input` and :func:" -"`fileinput.FileInput` which was ignored and deprecated since Python 3.6 has " -"been removed. :issue:`36952` (Contributed by Matthias Bussonnier.)" +"The ``bufsize`` keyword argument of :func:`fileinput.input` " +"and :func:`fileinput.FileInput` which was ignored and deprecated since " +"Python 3.6 has been removed. :issue:`36952` (Contributed by Matthias " +"Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1803 msgid "" -"The functions :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper` deprecated in Python 3.7 have been removed; :issue:" -"`36933` (Contributed by Matthias Bussonnier.)" +"The functions :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper` deprecated in Python 3.7 have been " +"removed; :issue:`36933` (Contributed by Matthias Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1809 @@ -2881,7 +2907,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1816 msgid "Changes in Python behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.8.rst:1818 msgid "" @@ -2897,8 +2923,8 @@ msgid "" "(``is`` and ``is not``) are used with certain types of literals (e.g. " "strings, numbers). These can often work by accident in CPython, but are not " "guaranteed by the language spec. The warning advises users to use equality " -"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka in :" -"issue:`34850`.)" +"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka " +"in :issue:`34850`.)" msgstr "" #: ../../whatsnew/3.8.rst:1830 @@ -2911,12 +2937,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1835 msgid "" -"Removed ``__str__`` implementations from builtin types :class:`bool`, :class:" -"`int`, :class:`float`, :class:`complex` and few classes from the standard " -"library. They now inherit ``__str__()`` from :class:`object`. As result, " -"defining the ``__repr__()`` method in the subclass of these classes will " -"affect their string representation. (Contributed by Serhiy Storchaka in :" -"issue:`36793`.)" +"Removed ``__str__`` implementations from builtin " +"types :class:`bool`, :class:`int`, :class:`float`, :class:`complex` and few " +"classes from the standard library. They now inherit ``__str__()`` " +"from :class:`object`. As result, defining the ``__repr__()`` method in the " +"subclass of these classes will affect their string representation. " +"(Contributed by Serhiy Storchaka in :issue:`36793`.)" msgstr "" #: ../../whatsnew/3.8.rst:1842 @@ -2924,23 +2950,24 @@ msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``. Since older " "Python versions include the version number, so it is recommended to always " -"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt in :issue:" -"`36588`.)" +"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt " +"in :issue:`36588`.)" msgstr "" #: ../../whatsnew/3.8.rst:1848 msgid "" ":c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_AcquireThread` now " "terminate the current thread if called while the interpreter is finalizing, " -"making them consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`. If this behavior is " -"not desired, guard the call by checking :c:func:`!_Py_IsFinalizing` or :func:" -"`sys.is_finalizing`. (Contributed by Joannah Nanjekye in :issue:`36475`.)" +"making them consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`. If this behavior is not desired, guard the " +"call by checking :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing`. " +"(Contributed by Joannah Nanjekye in :issue:`36475`.)" msgstr "" #: ../../whatsnew/3.8.rst:1858 ../../whatsnew/3.8.rst:2321 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.8.rst:1860 msgid "" @@ -2964,8 +2991,8 @@ msgstr "" msgid "" "The *preexec_fn* argument of * :class:`subprocess.Popen` is no longer " "compatible with subinterpreters. The use of the parameter in a " -"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow in :" -"issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" +"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow " +"in :issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" msgstr "" #: ../../whatsnew/3.8.rst:1878 @@ -2983,44 +3010,45 @@ msgstr "" #: ../../whatsnew/3.8.rst:1891 msgid "" -"The :meth:`~tkinter.ttk.Treeview.selection` method of the :class:`tkinter." -"ttk.Treeview` class no longer takes arguments. Using it with arguments for " -"changing the selection was deprecated in Python 3.6. Use specialized " -"methods like :meth:`~tkinter.ttk.Treeview.selection_set` for changing the " -"selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" +"The :meth:`~tkinter.ttk.Treeview.selection` method of " +"the :class:`tkinter.ttk.Treeview` class no longer takes arguments. Using it " +"with arguments for changing the selection was deprecated in Python 3.6. Use " +"specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for " +"changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" msgstr "" #: ../../whatsnew/3.8.rst:1897 msgid "" -"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods of :mod:" -"`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, now " -"preserve the attribute order specified by the user. (Contributed by Diego " -"Rojas and Raymond Hettinger in :issue:`34160`.)" +"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods " +"of :mod:`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, " +"now preserve the attribute order specified by the user. (Contributed by " +"Diego Rojas and Raymond Hettinger in :issue:`34160`.)" msgstr "" #: ../../whatsnew/3.8.rst:1902 msgid "" -"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only. :func:" -"`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates a database " -"if it does not exist. (Contributed by Serhiy Storchaka in :issue:`32749`.)" +"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-" +"only. :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates " +"a database if it does not exist. (Contributed by Serhiy Storchaka " +"in :issue:`32749`.)" msgstr "" #: ../../whatsnew/3.8.rst:1907 msgid "" -"The ``doctype()`` method defined in a subclass of :class:`~xml.etree." -"ElementTree.XMLParser` will no longer be called and will emit a :exc:" -"`RuntimeWarning` instead of a :exc:`DeprecationWarning`. Define the :meth:" -"`doctype() <xml.etree.ElementTree.TreeBuilder.doctype>` method on a target " -"for handling an XML doctype declaration. (Contributed by Serhiy Storchaka " -"in :issue:`29209`.)" +"The ``doctype()`` method defined in a subclass " +"of :class:`~xml.etree.ElementTree.XMLParser` will no longer be called and " +"will emit a :exc:`RuntimeWarning` instead of a :exc:`DeprecationWarning`. " +"Define the :meth:`doctype() <xml.etree.ElementTree.TreeBuilder.doctype>` " +"method on a target for handling an XML doctype declaration. (Contributed by " +"Serhiy Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1914 msgid "" "A :exc:`RuntimeError` is now raised when the custom metaclass doesn't " -"provide the ``__classcell__`` entry in the namespace passed to ``type." -"__new__``. A :exc:`DeprecationWarning` was emitted in Python 3.6--3.7. " -"(Contributed by Serhiy Storchaka in :issue:`23722`.)" +"provide the ``__classcell__`` entry in the namespace passed to " +"``type.__new__``. A :exc:`DeprecationWarning` was emitted in Python " +"3.6--3.7. (Contributed by Serhiy Storchaka in :issue:`23722`.)" msgstr "" #: ../../whatsnew/3.8.rst:1919 @@ -3031,10 +3059,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1922 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls (see :ref:`shutil-platform-dependent-efficient-copy-" -"operations` section)." +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls " +"(see :ref:`shutil-platform-dependent-efficient-copy-operations` section)." msgstr "" #: ../../whatsnew/3.8.rst:1927 @@ -3079,18 +3106,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:1954 msgid "" -"Deleting a key from a read-only :mod:`dbm` database (:mod:`dbm.dumb`, :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` (:exc:`dbm.dumb.error`, :" -"exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`. " -"(Contributed by Xiang Zhang in :issue:`33106`.)" +"Deleting a key from a read-only :mod:`dbm` database " +"(:mod:`dbm.dumb`, :mod:`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` " +"(:exc:`dbm.dumb.error`, :exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) " +"instead of :exc:`KeyError`. (Contributed by Xiang Zhang in :issue:`33106`.)" msgstr "" #: ../../whatsnew/3.8.rst:1959 msgid "" -"Simplified AST for literals. All constants will be represented as :class:" -"`ast.Constant` instances. Instantiating old classes ``Num``, ``Str``, " -"``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an instance of " -"``Constant``. (Contributed by Serhiy Storchaka in :issue:`32892`.)" +"Simplified AST for literals. All constants will be represented " +"as :class:`ast.Constant` instances. Instantiating old classes ``Num``, " +"``Str``, ``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an " +"instance of ``Constant``. (Contributed by Serhiy Storchaka " +"in :issue:`32892`.)" msgstr "" #: ../../whatsnew/3.8.rst:1975 @@ -3116,15 +3144,16 @@ msgstr "" msgid "" "DLL dependencies for extension modules and DLLs loaded with :mod:`ctypes` on " "Windows are now resolved more securely. Only the system paths, the directory " -"containing the DLL or PYD file, and directories added with :func:`~os." -"add_dll_directory` are searched for load-time dependencies. Specifically, :" -"envvar:`PATH` and the current working directory are no longer used, and " -"modifications to these will no longer have any effect on normal DLL " -"resolution. If your application relies on these mechanisms, you should check " -"for :func:`~os.add_dll_directory` and if it exists, use it to add your DLLs " -"directory while loading your library. Note that Windows 7 users will need to " -"ensure that Windows Update KB2533623 has been installed (this is also " -"verified by the installer). (Contributed by Steve Dower in :issue:`36085`.)" +"containing the DLL or PYD file, and directories added " +"with :func:`~os.add_dll_directory` are searched for load-time dependencies. " +"Specifically, :envvar:`PATH` and the current working directory are no longer " +"used, and modifications to these will no longer have any effect on normal " +"DLL resolution. If your application relies on these mechanisms, you should " +"check for :func:`~os.add_dll_directory` and if it exists, use it to add your " +"DLLs directory while loading your library. Note that Windows 7 users will " +"need to ensure that Windows Update KB2533623 has been installed (this is " +"also verified by the installer). (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:2001 @@ -3182,21 +3211,22 @@ msgstr "" #: ../../whatsnew/3.8.rst:2037 msgid "" -"Use of ``#`` variants of formats in parsing or building value (e.g. :c:func:" -"`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:" -"`PyObject_CallFunction`, etc.) without ``PY_SSIZE_T_CLEAN`` defined raises " -"``DeprecationWarning`` now. It will be removed in 3.10 or 4.0. Read :ref:" -"`arg-parsing` for detail. (Contributed by Inada Naoki in :issue:`36381`.)" +"Use of ``#`` variants of formats in parsing or building value " +"(e.g. :c:func:`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:`PyObject_CallFunction`, " +"etc.) without ``PY_SSIZE_T_CLEAN`` defined raises ``DeprecationWarning`` " +"now. It will be removed in 3.10 or 4.0. Read :ref:`arg-parsing` for detail. " +"(Contributed by Inada Naoki in :issue:`36381`.)" msgstr "" #: ../../whatsnew/3.8.rst:2043 msgid "" -"Instances of heap-allocated types (such as those created with :c:func:" -"`PyType_FromSpec`) hold a reference to their type object. Increasing the " -"reference count of these type objects has been moved from :c:func:" -"`PyType_GenericAlloc` to the more low-level functions, :c:func:" -"`PyObject_Init` and :c:func:`PyObject_INIT`. This makes types created " -"through :c:func:`PyType_FromSpec` behave like other classes in managed code." +"Instances of heap-allocated types (such as those created " +"with :c:func:`PyType_FromSpec`) hold a reference to their type object. " +"Increasing the reference count of these type objects has been moved " +"from :c:func:`PyType_GenericAlloc` to the more low-level " +"functions, :c:func:`PyObject_Init` and :c:func:`PyObject_INIT`. This makes " +"types created through :c:func:`PyType_FromSpec` behave like other classes in " +"managed code." msgstr "" #: ../../whatsnew/3.8.rst:2051 @@ -3220,10 +3250,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2062 msgid "" "Remove :c:macro:`Py_INCREF` on the type object after allocating an instance " -"- if any. This may happen after calling :c:macro:`PyObject_New`, :c:macro:" -"`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " -"or any other custom allocator that uses :c:func:`PyObject_Init` or :c:func:" -"`PyObject_INIT`." +"- if any. This may happen after " +"calling :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " +"or any other custom allocator that uses :c:func:`PyObject_Init` " +"or :c:func:`PyObject_INIT`." msgstr "" #: ../../whatsnew/3.8.rst:2069 ../../whatsnew/3.8.rst:2088 @@ -3288,9 +3318,10 @@ msgid "" "The interpreter does not pretend to support binary compatibility of " "extension types across feature releases, anymore. A :c:type:`PyTypeObject` " "exported by a third-party extension module is supposed to have all the slots " -"expected in the current Python version, including :c:member:`~PyTypeObject." -"tp_finalize` (:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore " -"before reading :c:member:`~PyTypeObject.tp_finalize`)." +"expected in the current Python version, " +"including :c:member:`~PyTypeObject.tp_finalize` " +"(:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore before " +"reading :c:member:`~PyTypeObject.tp_finalize`)." msgstr "" #: ../../whatsnew/3.8.rst:2122 @@ -3324,10 +3355,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2137 msgid "" "The location of an installed :file:`pythonXY.dll` will depend on the " -"installation options and the version and language of Windows. See :ref:" -"`using-on-windows` for more information. The resulting library should be " -"placed in the same directory as :file:`pythonXY.lib`, which is generally " -"the :file:`libs` directory under your Python installation." +"installation options and the version and language of Windows. " +"See :ref:`using-on-windows` for more information. The resulting library " +"should be placed in the same directory as :file:`pythonXY.lib`, which is " +"generally the :file:`libs` directory under your Python installation." msgstr "" #: ../../whatsnew/3.8.rst:2143 @@ -3357,8 +3388,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:2161 msgid "" -"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka in :issue:" -"`17611`.)" +"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka " +"in :issue:`17611`.)" msgstr "" "(由 Mark Shannon、Antoine Pitrou 和 Serhiy Storchaka 在 :issue:`17611` 中貢" "獻。)" @@ -3556,12 +3587,12 @@ msgstr "Python 3.8.1 中顯著的變更" #: ../../whatsnew/3.8.rst:2239 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.8.rst:2247 @@ -3594,13 +3625,14 @@ msgstr "Python 3.8.8 中顯著的變更" #: ../../whatsnew/3.8.rst:2264 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.8.rst:2275 @@ -3639,9 +3671,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:2299 msgid "" -"(Originally contributed by Ronald Oussoren and Lawrence D'Anna in :gh:" -"`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to 3.8 by " -"Maxime Bélanger and Ned Deily)" +"(Originally contributed by Ronald Oussoren and Lawrence D'Anna " +"in :gh:`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to " +"3.8 by Maxime Bélanger and Ned Deily)" msgstr "" #: ../../whatsnew/3.8.rst:2307 @@ -3651,11 +3683,12 @@ msgstr "urllib.parse" #: ../../whatsnew/3.8.rst:2309 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :issue:`43882`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :issue:`43882`)" msgstr "" #: ../../whatsnew/3.8.rst:2318 diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 4c88343623..0d12d8d64e 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -32,8 +32,8 @@ msgstr "Łukasz Langa" #: ../../whatsnew/3.9.rst:45 msgid "" "This article explains the new features in Python 3.9, compared to 3.8. " -"Python 3.9 was released on October 5, 2020. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.9 was released on October 5, 2020. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.9 與 3.8 相比多了哪些新功能。Python 3.9 已於 2020 年 10 " "月 5 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -109,24 +109,24 @@ msgstr "" #: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" -"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" -"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" -"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " -"as defined by PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!" +"_bz2`, :mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!" +"_functools`, :mod:`!_json`, :mod:`!" +"_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:`time`, :mod:`!" +"_weakref`) now use multiphase initialization as defined by PEP 489;" msgstr "" #: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" -"`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" -"`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " -"using the stable ABI defined by PEP 384." +"a number of standard library modules (:mod:`!" +"audioop`, :mod:`ast`, :mod:`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!" +"_posixsubprocess`, :mod:`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) " +"are now using the stable ABI defined by PEP 384." msgstr "" #: ../../whatsnew/3.9.rst:94 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.9.rst:96 msgid "" @@ -182,9 +182,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:126 msgid "" "Aliases to :ref:`Abstract Base Classes <collections-abstract-base-classes>` " -"in the :mod:`collections` module, like ``collections.Mapping`` alias to :" -"class:`collections.abc.Mapping`, are kept for one last release for backward " -"compatibility. They will be removed from Python 3.10." +"in the :mod:`collections` module, like ``collections.Mapping`` alias " +"to :class:`collections.abc.Mapping`, are kept for one last release for " +"backward compatibility. They will be removed from Python 3.10." msgstr "" #: ../../whatsnew/3.9.rst:131 @@ -210,8 +210,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:145 msgid "" -"Merge (``|``) and update (``|=``) operators have been added to the built-in :" -"class:`dict` class. Those complement the existing ``dict.update`` and " +"Merge (``|``) and update (``|=``) operators have been added to the built-" +"in :class:`dict` class. Those complement the existing ``dict.update`` and " "``{**d1, **d2}`` methods of merging dictionaries." msgstr "" @@ -237,8 +237,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:158 msgid "" -"See :pep:`584` for a full description. (Contributed by Brandt Bucher in :" -"issue:`36144`.)" +"See :pep:`584` for a full description. (Contributed by Brandt Bucher " +"in :issue:`36144`.)" msgstr "" #: ../../whatsnew/3.9.rst:162 @@ -247,12 +247,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:164 msgid "" -":meth:`str.removeprefix(prefix)<str.removeprefix>` and :meth:`str." -"removesuffix(suffix)<str.removesuffix>` have been added to easily remove an " -"unneeded prefix or a suffix from a string. Corresponding ``bytes``, " -"``bytearray``, and ``collections.UserString`` methods have also been added. " -"See :pep:`616` for a full description. (Contributed by Dennis Sweeney in :" -"issue:`39939`.)" +":meth:`str.removeprefix(prefix)<str.removeprefix>` " +"and :meth:`str.removesuffix(suffix)<str.removesuffix>` have been added to " +"easily remove an unneeded prefix or a suffix from a string. Corresponding " +"``bytes``, ``bytearray``, and ``collections.UserString`` methods have also " +"been added. See :pep:`616` for a full description. (Contributed by Dennis " +"Sweeney in :issue:`39939`.)" msgstr "" #: ../../whatsnew/3.9.rst:172 @@ -329,28 +329,28 @@ msgstr "其他語言更動" #: ../../whatsnew/3.9.rst:218 msgid "" -":func:`__import__` now raises :exc:`ImportError` instead of :exc:" -"`ValueError`, which used to occur when a relative import went past its top-" -"level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" +":func:`__import__` now raises :exc:`ImportError` instead " +"of :exc:`ValueError`, which used to occur when a relative import went past " +"its top-level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:223 msgid "" "Python now gets the absolute path of the script filename specified on the " -"command line (ex: ``python3 script.py``): the ``__file__`` attribute of the :" -"mod:`__main__` module became an absolute path, rather than a relative path. " -"These paths now remain valid after the current directory is changed by :func:" -"`os.chdir`. As a side effect, the traceback also displays the absolute path " -"for :mod:`__main__` module frames in this case. (Contributed by Victor " -"Stinner in :issue:`20443`.)" +"command line (ex: ``python3 script.py``): the ``__file__`` attribute of " +"the :mod:`__main__` module became an absolute path, rather than a relative " +"path. These paths now remain valid after the current directory is changed " +"by :func:`os.chdir`. As a side effect, the traceback also displays the " +"absolute path for :mod:`__main__` module frames in this case. (Contributed " +"by Victor Stinner in :issue:`20443`.)" msgstr "" #: ../../whatsnew/3.9.rst:231 msgid "" "In the :ref:`Python Development Mode <devmode>` and in :ref:`debug build " "<debug-build>`, the *encoding* and *errors* arguments are now checked for " -"string encoding and decoding operations. Examples: :func:`open`, :meth:`str." -"encode` and :meth:`bytes.decode`." +"string encoding and decoding operations. " +"Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../whatsnew/3.9.rst:236 @@ -386,25 +386,26 @@ msgstr "" #: ../../whatsnew/3.9.rst:256 msgid "" -"Parallel running of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:" -"`~agen.athrow` is now prohibited, and ``ag_running`` now reflects the actual " -"running status of the async generator. (Contributed by Yury Selivanov in :" -"issue:`30773`.)" +"Parallel running " +"of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:`~agen.athrow` is now " +"prohibited, and ``ag_running`` now reflects the actual running status of the " +"async generator. (Contributed by Yury Selivanov in :issue:`30773`.)" msgstr "" #: ../../whatsnew/3.9.rst:261 msgid "" "Unexpected errors in calling the ``__iter__`` method are no longer masked by " -"``TypeError`` in the :keyword:`in` operator and functions :func:`~operator." -"contains`, :func:`~operator.indexOf` and :func:`~operator.countOf` of the :" -"mod:`operator` module. (Contributed by Serhiy Storchaka in :issue:`40824`.)" +"``TypeError`` in the :keyword:`in` operator and " +"functions :func:`~operator.contains`, :func:`~operator.indexOf` " +"and :func:`~operator.countOf` of the :mod:`operator` module. (Contributed by " +"Serhiy Storchaka in :issue:`40824`.)" msgstr "" #: ../../whatsnew/3.9.rst:267 msgid "" "Unparenthesized lambda expressions can no longer be the expression part in " -"an ``if`` clause in comprehensions and generator expressions. See :issue:" -"`41848` and :issue:`43755` for details." +"an ``if`` clause in comprehensions and generator expressions. " +"See :issue:`41848` and :issue:`43755` for details." msgstr "" #: ../../whatsnew/3.9.rst:273 @@ -418,8 +419,9 @@ msgstr "zoneinfo" #: ../../whatsnew/3.9.rst:278 msgid "" "The :mod:`zoneinfo` module brings support for the IANA time zone database to " -"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a concrete :class:" -"`datetime.tzinfo` implementation backed by the system's time zone data." +"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a " +"concrete :class:`datetime.tzinfo` implementation backed by the system's time " +"zone data." msgstr "" #: ../../whatsnew/3.9.rst:284 @@ -465,10 +467,10 @@ msgstr "graphlib" #: ../../whatsnew/3.9.rst:315 msgid "" -"A new module, :mod:`graphlib`, was added that contains the :class:`graphlib." -"TopologicalSorter` class to offer functionality to perform topological " -"sorting of graphs. (Contributed by Pablo Galindo, Tim Peters and Larry " -"Hastings in :issue:`17005`.)" +"A new module, :mod:`graphlib`, was added that contains " +"the :class:`graphlib.TopologicalSorter` class to offer functionality to " +"perform topological sorting of graphs. (Contributed by Pablo Galindo, Tim " +"Peters and Larry Hastings in :issue:`17005`.)" msgstr "" #: ../../whatsnew/3.9.rst:322 @@ -482,8 +484,8 @@ msgstr "ast" #: ../../whatsnew/3.9.rst:327 msgid "" "Added the *indent* option to :func:`~ast.dump` which allows it to produce a " -"multiline indented output. (Contributed by Serhiy Storchaka in :issue:" -"`37995`.)" +"multiline indented output. (Contributed by Serhiy Storchaka " +"in :issue:`37995`.)" msgstr "" #: ../../whatsnew/3.9.rst:331 @@ -506,21 +508,22 @@ msgstr "asyncio" #: ../../whatsnew/3.9.rst:342 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.9.rst:349 msgid "" -"Added a new :term:`coroutine` :meth:`~asyncio.loop." -"shutdown_default_executor` that schedules a shutdown for the default " -"executor that waits on the :class:`~concurrent.futures.ThreadPoolExecutor` " -"to finish closing. Also, :func:`asyncio.run` has been updated to use the " -"new :term:`coroutine`. (Contributed by Kyle Stanley in :issue:`34037`.)" +"Added a " +"new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor` that " +"schedules a shutdown for the default executor that waits on " +"the :class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. " +"Also, :func:`asyncio.run` has been updated to use the new :term:`coroutine`. " +"(Contributed by Kyle Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:355 @@ -533,9 +536,10 @@ msgstr "" msgid "" "Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used " "for running IO-bound functions in a separate thread to avoid blocking the " -"event loop, and essentially works as a high-level version of :meth:`~asyncio." -"loop.run_in_executor` that can directly take keyword arguments. (Contributed " -"by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" +"event loop, and essentially works as a high-level version " +"of :meth:`~asyncio.loop.run_in_executor` that can directly take keyword " +"arguments. (Contributed by Kyle Stanley and Yury Selivanov " +"in :issue:`32309`.)" msgstr "" #: ../../whatsnew/3.9.rst:364 @@ -549,8 +553,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:369 msgid "" ":mod:`asyncio` now raises :exc:`TypeError` when calling incompatible methods " -"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael in :issue:" -"`37404`.)" +"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael " +"in :issue:`37404`.)" msgstr "" #: ../../whatsnew/3.9.rst:374 @@ -569,8 +573,8 @@ msgid "" "Added new options for path manipulation in resulting ``.pyc`` files: " "*stripdir*, *prependdir*, *limit_sl_dest* parameters and -s, -p, -e command " "line options. Added the possibility to specify the option for an " -"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar in :" -"issue:`38112`.)" +"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar " +"in :issue:`38112`.)" msgstr "" #: ../../whatsnew/3.9.rst:384 @@ -579,10 +583,11 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.9.rst:386 msgid "" -"Added a new *cancel_futures* parameter to :meth:`concurrent.futures.Executor." -"shutdown` that cancels all pending futures which have not started running, " -"instead of waiting for them to complete before shutting down the executor. " -"(Contributed by Kyle Stanley in :issue:`39349`.)" +"Added a new *cancel_futures* parameter " +"to :meth:`concurrent.futures.Executor.shutdown` that cancels all pending " +"futures which have not started running, instead of waiting for them to " +"complete before shutting down the executor. (Contributed by Kyle Stanley " +"in :issue:`39349`.)" msgstr "" #: ../../whatsnew/3.9.rst:392 @@ -607,9 +612,9 @@ msgstr "curses" #: ../../whatsnew/3.9.rst:405 msgid "" -"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:" -"`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed " -"by Anthony Sottile in :issue:`38312`.)" +"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, " +"and :func:`curses.set_tabsize` functions. (Contributed by Anthony Sottile " +"in :issue:`38312`.)" msgstr "" #: ../../whatsnew/3.9.rst:410 @@ -618,10 +623,10 @@ msgstr "datetime" #: ../../whatsnew/3.9.rst:411 msgid "" -"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` and :meth:" -"`~datetime.datetime.isocalendar` of :class:`datetime.datetime` methods now " -"returns a :func:`~collections.namedtuple` instead of a :class:`tuple`. " -"(Contributed by Donghee Na in :issue:`24416`.)" +"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` " +"and :meth:`~datetime.datetime.isocalendar` of :class:`datetime.datetime` " +"methods now returns a :func:`~collections.namedtuple` instead of " +"a :class:`tuple`. (Contributed by Donghee Na in :issue:`24416`.)" msgstr "" #: ../../whatsnew/3.9.rst:417 @@ -642,8 +647,8 @@ msgstr "fcntl" #: ../../whatsnew/3.9.rst:426 msgid "" "Added constants :const:`~fcntl.F_OFD_GETLK`, :const:`~fcntl.F_OFD_SETLK` " -"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" -"`38602`.)" +"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na " +"in :issue:`38602`.)" msgstr "" #: ../../whatsnew/3.9.rst:431 @@ -652,10 +657,10 @@ msgstr "ftplib" #: ../../whatsnew/3.9.rst:433 msgid "" -":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:438 @@ -667,15 +672,15 @@ msgid "" "When the garbage collector makes a collection in which some objects " "resurrect (they are reachable from outside the isolated cycles after the " "finalizers have been executed), do not block the collection of all objects " -"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters in :" -"issue:`38379`.)" +"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters " +"in :issue:`38379`.)" msgstr "" #: ../../whatsnew/3.9.rst:445 msgid "" "Added a new function :func:`gc.is_finalized` to check if an object has been " -"finalized by the garbage collector. (Contributed by Pablo Galindo in :issue:" -"`39322`.)" +"finalized by the garbage collector. (Contributed by Pablo Galindo " +"in :issue:`39322`.)" msgstr "" #: ../../whatsnew/3.9.rst:450 @@ -713,8 +718,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:472 msgid "" -"Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Added option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.9.rst:475 @@ -736,8 +741,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:483 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" -"`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton " +"in :issue:`43008`.)" msgstr "" #: ../../whatsnew/3.9.rst:487 @@ -749,10 +754,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " +"in :issue:`33962`.)" msgstr "" #: ../../whatsnew/3.9.rst:497 @@ -768,11 +773,11 @@ msgstr "imaplib" #: ../../whatsnew/3.9.rst:503 msgid "" ":class:`~imaplib.IMAP4` and :class:`~imaplib.IMAP4_SSL` now have an optional " -"*timeout* parameter for their constructors. Also, the :meth:`~imaplib.IMAP4." -"open` method now has an optional *timeout* parameter with this change. The " -"overridden methods of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib." -"IMAP4_stream` were applied to this change. (Contributed by Donghee Na in :" -"issue:`38615`.)" +"*timeout* parameter for their constructors. Also, " +"the :meth:`~imaplib.IMAP4.open` method now has an optional *timeout* " +"parameter with this change. The overridden methods " +"of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib.IMAP4_stream` were " +"applied to this change. (Contributed by Donghee Na in :issue:`38615`.)" msgstr "" #: ../../whatsnew/3.9.rst:510 @@ -791,10 +796,10 @@ msgstr "importlib" #: ../../whatsnew/3.9.rst:520 msgid "" -"To improve consistency with import statements, :func:`importlib.util." -"resolve_name` now raises :exc:`ImportError` instead of :exc:`ValueError` for " -"invalid relative import attempts. (Contributed by Ngalim Siregar in :issue:" -"`37444`.)" +"To improve consistency with import " +"statements, :func:`importlib.util.resolve_name` now " +"raises :exc:`ImportError` instead of :exc:`ValueError` for invalid relative " +"import attempts. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:525 @@ -823,8 +828,8 @@ msgstr "inspect" #: ../../whatsnew/3.9.rst:539 msgid "" ":attr:`inspect.BoundArguments.arguments` is changed from ``OrderedDict`` to " -"regular dict. (Contributed by Inada Naoki in :issue:`36350` and :issue:" -"`39775`.)" +"regular dict. (Contributed by Inada Naoki in :issue:`36350` " +"and :issue:`39775`.)" msgstr "" #: ../../whatsnew/3.9.rst:543 @@ -840,16 +845,16 @@ msgstr "" #: ../../whatsnew/3.9.rst:547 msgid "" "Scoped IPv6 addresses can be parsed using :class:`ipaddress.IPv6Address`. If " -"present, scope zone ID is available through the :attr:`~ipaddress." -"IPv6Address.scope_id` attribute. (Contributed by Oleksandr Pavliuk in :issue:" -"`34788`.)" +"present, scope zone ID is available through " +"the :attr:`~ipaddress.IPv6Address.scope_id` attribute. (Contributed by " +"Oleksandr Pavliuk in :issue:`34788`.)" msgstr "" #: ../../whatsnew/3.9.rst:551 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " -"leading zeros in IPv4 address strings. (Contributed by Christian Heimes in :" -"issue:`36384`)." +"leading zeros in IPv4 address strings. (Contributed by Christian Heimes " +"in :issue:`36384`)." msgstr "" #: ../../whatsnew/3.9.rst:556 @@ -888,9 +893,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.9.rst:577 msgid "" -"The :class:`multiprocessing.SimpleQueue` class has a new :meth:" -"`~multiprocessing.SimpleQueue.close` method to explicitly close the queue. " -"(Contributed by Victor Stinner in :issue:`30966`.)" +"The :class:`multiprocessing.SimpleQueue` class has a " +"new :meth:`~multiprocessing.SimpleQueue.close` method to explicitly close " +"the queue. (Contributed by Victor Stinner in :issue:`30966`.)" msgstr "" #: ../../whatsnew/3.9.rst:583 @@ -916,8 +921,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:595 msgid "" -"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and :const:" -"`os.P_PIDFD` (:issue:`38713`) for process management with file descriptors." +"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) " +"and :const:`os.P_PIDFD` (:issue:`38713`) for process management with file " +"descriptors." msgstr "" #: ../../whatsnew/3.9.rst:599 @@ -944,8 +950,8 @@ msgstr "pathlib" #: ../../whatsnew/3.9.rst:613 msgid "" -"Added :meth:`pathlib.Path.readlink` which acts similarly to :func:`os." -"readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" +"Added :meth:`pathlib.Path.readlink` which acts similarly " +"to :func:`os.readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" msgstr "" #: ../../whatsnew/3.9.rst:618 @@ -964,10 +970,10 @@ msgstr "poplib" #: ../../whatsnew/3.9.rst:626 msgid "" -":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:631 @@ -1008,8 +1014,8 @@ msgstr "signal" #: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " -"signals to a process using a file descriptor instead of a pid. (:issue:" -"`38712`)" +"signals to a process using a file descriptor instead of a pid. " +"(:issue:`38712`)" msgstr "" #: ../../whatsnew/3.9.rst:657 @@ -1018,10 +1024,10 @@ msgstr "smtplib" #: ../../whatsnew/3.9.rst:659 msgid "" -":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:663 @@ -1036,9 +1042,9 @@ msgstr "socket" #: ../../whatsnew/3.9.rst:669 msgid "" -"The :mod:`socket` module now exports the :const:`~socket." -"CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " -"Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" +"The :mod:`socket` module now exports " +"the :const:`~socket.CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. " +"(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" #: ../../whatsnew/3.9.rst:673 @@ -1049,9 +1055,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:676 msgid "" -"The socket module now has the :func:`socket.send_fds` and :func:`socket." -"recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " -"Victor Stinner in :issue:`28724`.)" +"The socket module now has the :func:`socket.send_fds` " +"and :func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, " +"Shinya Okano and Victor Stinner in :issue:`28724`.)" msgstr "" #: ../../whatsnew/3.9.rst:682 @@ -1139,10 +1145,11 @@ msgstr "xml" #: ../../whatsnew/3.9.rst:735 msgid "" -"White space characters within attributes are now preserved when serializing :" -"mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " -"\"\\n\". This is the result of discussion about how to interpret section " -"2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" +"White space characters within attributes are now preserved when " +"serializing :mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer " +"normalized to \"\\n\". This is the result of discussion about how to " +"interpret section 2.11 of XML spec. (Contributed by Mefistotelis " +"in :issue:`39011`.)" msgstr "" #: ../../whatsnew/3.9.rst:743 @@ -1182,8 +1189,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " -"until the main thread handles signals. (Contributed by Victor Stinner in :" -"issue:`40010`.)" +"until the main thread handles signals. (Contributed by Victor Stinner " +"in :issue:`40010`.)" msgstr "" #: ../../whatsnew/3.9.rst:766 @@ -1201,10 +1208,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:774 msgid "" -"A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" -"class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" -"pep:`590` vectorcall protocol. (Contributed by Donghee Na, Mark Shannon, " -"Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" +"A number of Python builtins " +"(:class:`range`, :class:`tuple`, :class:`set`, :class:`frozenset`, :class:`list`, :class:`dict`) " +"are now sped up by using :pep:`590` vectorcall protocol. (Contributed by " +"Donghee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin " +"in :issue:`37207`.)" msgstr "" #: ../../whatsnew/3.9.rst:779 @@ -1395,10 +1403,10 @@ msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " "timings in nanoseconds. The benchmarks were measured on an `Intel® Core™ " -"i7-4960HQ processor <https://ark.intel.com/content/www/us/en/ark/" -"products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz." -"html>`_ running the macOS 64-bit builds found at `python.org <https://www." -"python.org/downloads/macos/>`_." +"i7-4960HQ processor <https://ark.intel.com/content/www/us/en/ark/products/" +"76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html>`_ running " +"the macOS 64-bit builds found at `python.org <https://www.python.org/" +"downloads/macos/>`_." msgstr "" #: ../../whatsnew/3.9.rst:853 @@ -1408,8 +1416,8 @@ msgstr "已棄用" #: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " -"(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" -"`39586`.)" +"(wheel packages) instead. (Contributed by Hugo van Kemenade " +"in :issue:`39586`.)" msgstr "" #: ../../whatsnew/3.9.rst:859 @@ -1431,8 +1439,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:870 msgid "" -"The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" -"func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" +"The Public C API functions :c:func:`!" +"PyParser_SimpleParseStringFlags`, :c:func:`!" +"PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" "PyParser_SimpleParseFileFlags` and :c:func:`!PyNode_Compile` are deprecated " "and will be removed in Python 3.10 together with the old parser." msgstr "" @@ -1450,8 +1459,9 @@ msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " "deterministic hash value. After Python 3.9, the module will restrict its " -"seeds to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:" -"`bytes`, and :class:`bytearray`." +"seeds " +"to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, " +"and :class:`bytearray`." msgstr "" #: ../../whatsnew/3.9.rst:887 @@ -1459,8 +1469,8 @@ msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " "opened for reading by default. Specify the *mode* argument for opening it " -"for writing and silencing a warning. (Contributed by Serhiy Storchaka in :" -"issue:`28286`.)" +"for writing and silencing a warning. (Contributed by Serhiy Storchaka " +"in :issue:`28286`.)" msgstr "" #: ../../whatsnew/3.9.rst:893 @@ -1509,17 +1519,17 @@ msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " "were not generated by the parser and not accepted by the code generator in " -"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` and :issue:" -"`39969` and Serhiy Storchaka in :issue:`39988`.)" +"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` " +"and :issue:`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" #: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " -"functions are now deprecated and will be removed in Python 3.11. Calling :c:" -"func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is initialized " -"by :c:func:`Py_Initialize` since Python 3.7. (Contributed by Victor Stinner " -"in :issue:`39877`.)" +"functions are now deprecated and will be removed in Python 3.11. " +"Calling :c:func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is " +"initialized by :c:func:`Py_Initialize` since Python 3.7. (Contributed by " +"Victor Stinner in :issue:`39877`.)" msgstr "" #: ../../whatsnew/3.9.rst:929 @@ -1531,8 +1541,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " -"external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" -"`35800`.)" +"external module, ``mailman``. (Contributed by Samuel Colvin " +"in :issue:`35800`.)" msgstr "" #: ../../whatsnew/3.9.rst:935 @@ -1566,8 +1576,8 @@ msgid "" "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " "For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" -"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" -"`39366`.)" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na " +"in :issue:`39366`.)" msgstr "" #: ../../whatsnew/3.9.rst:963 @@ -1588,9 +1598,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " -"been removed. They were deprecated since Python 3.2. Use :func:`sys." -"getswitchinterval` and :func:`sys.setswitchinterval` instead. (Contributed " -"by Victor Stinner in :issue:`37392`.)" +"been removed. They were deprecated since Python 3.2. " +"Use :func:`sys.getswitchinterval` and :func:`sys.setswitchinterval` instead. " +"(Contributed by Victor Stinner in :issue:`37392`.)" msgstr "" #: ../../whatsnew/3.9.rst:978 @@ -1624,21 +1634,23 @@ msgstr "" #: ../../whatsnew/3.9.rst:996 msgid "" -"Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." -"etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " -"in the :mod:`~xml.etree.ElementTree` module have been removed. They were " -"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of ``x." -"getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of ``x." -"getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" +"Methods ``getchildren()`` and ``getiterator()`` of " +"classes :class:`~xml.etree.ElementTree.ElementTree` " +"and :class:`~xml.etree.ElementTree.Element` in " +"the :mod:`~xml.etree.ElementTree` module have been removed. They were " +"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of " +"``x.getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of " +"``x.getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" #: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " -"3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" -"`~plistlib.dump`, and :func:`~plistlib.dumps` functions. Additionally, the " -"*use_builtin_types* parameter was removed, standard :class:`bytes` objects " -"are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" +"3.4. Use " +"the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:`~plistlib.dump`, " +"and :func:`~plistlib.dumps` functions. Additionally, the *use_builtin_types* " +"parameter was removed, standard :class:`bytes` objects are always used " +"instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" #: ../../whatsnew/3.9.rst:1010 @@ -1652,9 +1664,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " -"since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" -"func:`base64.decodebytes` instead. (Contributed by Victor Stinner in :issue:" -"`39351`.)" +"since Python 3.1, have been removed: use :func:`base64.encodebytes` " +"and :func:`base64.decodebytes` instead. (Contributed by Victor Stinner " +"in :issue:`39351`.)" msgstr "" #: ../../whatsnew/3.9.rst:1020 @@ -1675,9 +1687,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " -"Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" -"`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki in :issue:" -"`39377`)" +"Python 3.1, it was deprecated and ignored; using it has emitted " +"a :exc:`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki " +"in :issue:`39377`)" msgstr "" #: ../../whatsnew/3.9.rst:1034 @@ -1691,18 +1703,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " -"option and the ``show_alloc_count`` field of the C structure :c:type:" -"`PyConfig` have been removed. They required a special Python build by " -"defining ``COUNT_ALLOCS`` macro. (Contributed by Victor Stinner in :issue:" -"`39489`.)" +"option and the ``show_alloc_count`` field of the C " +"structure :c:type:`PyConfig` have been removed. They required a special " +"Python build by defining ``COUNT_ALLOCS`` macro. (Contributed by Victor " +"Stinner in :issue:`39489`.)" msgstr "" #: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " -"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka in :" -"issue:`40182`.)" +"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka " +"in :issue:`40182`.)" msgstr "" #: ../../whatsnew/3.9.rst:1050 @@ -1715,8 +1727,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"have been removed. They were deprecated since Python 3.7 and you can use :" -"func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " +"have been removed. They were deprecated since Python 3.7 and you can " +"use :func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" @@ -1740,14 +1752,15 @@ msgstr "" #: ../../whatsnew/3.9.rst:1073 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.9.rst:1075 msgid "" -":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" -"`ImportError` where it previously raised :exc:`ValueError`. Callers catching " -"the specific exception type and supporting both Python 3.9 and earlier " -"versions will need to catch both using ``except (ImportError, ValueError):``." +":func:`__import__` and :func:`importlib.util.resolve_name` now " +"raise :exc:`ImportError` where it previously raised :exc:`ValueError`. " +"Callers catching the specific exception type and supporting both Python 3.9 " +"and earlier versions will need to catch both using ``except (ImportError, " +"ValueError):``." msgstr "" #: ../../whatsnew/3.9.rst:1080 @@ -1758,8 +1771,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1083 msgid "" -"The :meth:`select.epoll.unregister` method no longer ignores the :const:" -"`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" +"The :meth:`select.epoll.unregister` method no longer ignores " +"the :const:`~errno.EBADF` error. (Contributed by Victor Stinner " +"in :issue:`39239`.)" msgstr "" #: ../../whatsnew/3.9.rst:1087 @@ -1793,10 +1807,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1105 msgid "" -":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" -"`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " -"from it should have this method defined. (Contributed by Kyle Stanley in :" -"issue:`34037`.)" +":meth:`asyncio.loop.shutdown_default_executor` has been added " +"to :class:`~asyncio.AbstractEventLoop`, meaning alternative event loops that " +"inherit from it should have this method defined. (Contributed by Kyle " +"Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:1110 @@ -1820,18 +1834,19 @@ msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " "``'root'``. This could affect cases where user code explicitly wants a non-" -"root logger named ``'root'``, or instantiates a logger using ``logging." -"getLogger(__name__)`` in some top-level module called ``'root.py'``. " -"(Contributed by Vinay Sajip in :issue:`37742`.)" +"root logger named ``'root'``, or instantiates a logger using " +"``logging.getLogger(__name__)`` in some top-level module called " +"``'root.py'``. (Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" #: ../../whatsnew/3.9.rst:1127 msgid "" -"Division handling of :class:`~pathlib.PurePath` now returns :data:" -"`NotImplemented` instead of raising a :exc:`TypeError` when passed something " -"other than an instance of ``str`` or :class:`~pathlib.PurePath`. This " -"allows creating compatible classes that don't inherit from those mentioned " -"types. (Contributed by Roger Aiudi in :issue:`34775`)." +"Division handling of :class:`~pathlib.PurePath` now " +"returns :data:`NotImplemented` instead of raising a :exc:`TypeError` when " +"passed something other than an instance of ``str`` " +"or :class:`~pathlib.PurePath`. This allows creating compatible classes that " +"don't inherit from those mentioned types. (Contributed by Roger Aiudi " +"in :issue:`34775`)." msgstr "" #: ../../whatsnew/3.9.rst:1133 @@ -1846,11 +1861,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:1141 msgid "" -":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" -"`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " -"converts the name to lower case. For example, ``\"latex+latin1\"`` encoding " -"name is now normalized to ``\"latex_latin1\"``. (Contributed by Jordon Xu " -"in :issue:`37751`.)" +":func:`codecs.lookup` now normalizes the encoding name the same way " +"as :func:`encodings.normalize_encoding`, except that :func:`codecs.lookup` " +"also converts the name to lower case. For example, ``\"latex+latin1\"`` " +"encoding name is now normalized to ``\"latex_latin1\"``. (Contributed by " +"Jordon Xu in :issue:`37751`.)" msgstr "" #: ../../whatsnew/3.9.rst:1149 @@ -1863,9 +1878,10 @@ msgid "" "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " "type object since Python 3.8. As indicated in the \"Changes in the C API\" " "of Python 3.8, for the vast majority of cases, there should be no side " -"effect but for types that have a custom :c:member:`~PyTypeObject." -"tp_traverse` function, ensure that all custom ``tp_traverse`` functions of " -"heap-allocated types visit the object's type." +"effect but for types that have a " +"custom :c:member:`~PyTypeObject.tp_traverse` function, ensure that all " +"custom ``tp_traverse`` functions of heap-allocated types visit the object's " +"type." msgstr "" #: ../../whatsnew/3.9.rst:1161 @@ -1920,8 +1936,8 @@ msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " -"Use :c:func:`PyObject_Call` and its variants instead. (See more details in :" -"issue:`29548`.)" +"Use :c:func:`PyObject_Call` and its variants instead. (See more details " +"in :issue:`29548`.)" msgstr "" #: ../../whatsnew/3.9.rst:1204 @@ -1930,9 +1946,9 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.9.rst:1206 msgid "" -"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" -"keyword:`assert` statement. Previously, the assert statement would not work " -"correctly if the :exc:`AssertionError` exception was being shadowed. " +"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling " +"the :keyword:`assert` statement. Previously, the assert statement would not " +"work correctly if the :exc:`AssertionError` exception was being shadowed. " "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" @@ -1969,10 +1985,10 @@ msgstr "建置變更" #: ../../whatsnew/3.9.rst:1225 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " -"platform-specific library directory, stored in the new :data:`sys." -"platlibdir` attribute. See :data:`sys.platlibdir` attribute for more " -"information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis " -"and Victor Stinner in :issue:`1294959`.)" +"platform-specific library directory, stored in the " +"new :data:`sys.platlibdir` attribute. See :data:`sys.platlibdir` attribute " +"for more information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos " +"Stratakis and Victor Stinner in :issue:`1294959`.)" msgstr "" #: ../../whatsnew/3.9.rst:1231 @@ -2035,16 +2051,16 @@ msgstr "C API 變更" msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " -"to retrieve the module and its state; and :c:type:`PyCMethod` and :c:macro:" -"`METH_METHOD` to allow a method to access the class it was defined in. " -"(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" +"to retrieve the module and its state; and :c:type:`PyCMethod` " +"and :c:macro:`METH_METHOD` to allow a method to access the class it was " +"defined in. (Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" #: ../../whatsnew/3.9.rst:1280 msgid "" -"Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" -"`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " -"Victor Stinner in :issue:`40421`.)" +"Added :c:func:`PyFrame_GetCode` function: get a frame code. " +"Added :c:func:`PyFrame_GetBack` function: get the frame next outer frame. " +"(Contributed by Victor Stinner in :issue:`40421`.)" msgstr "" #: ../../whatsnew/3.9.rst:1284 @@ -2055,12 +2071,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:1287 msgid "" -"Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" -"`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" -"`PyThreadState_GetFrame` function to get the current frame of a Python " -"thread state. Added :c:func:`PyThreadState_GetID` function: get the unique " -"identifier of a Python thread state. (Contributed by Victor Stinner in :" -"issue:`39947`.)" +"Added :c:func:`PyThreadState_GetInterpreter` " +"and :c:func:`PyInterpreterState_Get` functions to get the interpreter. " +"Added :c:func:`PyThreadState_GetFrame` function to get the current frame of " +"a Python thread state. Added :c:func:`PyThreadState_GetID` function: get the " +"unique identifier of a Python thread state. (Contributed by Victor Stinner " +"in :issue:`39947`.)" msgstr "" #: ../../whatsnew/3.9.rst:1295 @@ -2102,18 +2118,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1317 msgid "" -"Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" -"`PyObject_GC_IsFinalized` to the public API to allow to query if Python " -"objects are being currently tracked or have been already finalized by the " -"garbage collector respectively. (Contributed by Pablo Galindo Salgado in :" -"issue:`40241`.)" +"Added the functions :c:func:`PyObject_GC_IsTracked` " +"and :c:func:`PyObject_GC_IsFinalized` to the public API to allow to query if " +"Python objects are being currently tracked or have been already finalized by " +"the garbage collector respectively. (Contributed by Pablo Galindo Salgado " +"in :issue:`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1323 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " -"representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" -"`37645`.)" +"representation of a function-like object. (Patch by Jeroen Demeyer " +"in :issue:`37645`.)" msgstr "" #: ../../whatsnew/3.9.rst:1327 @@ -2125,20 +2141,21 @@ msgstr "" #: ../../whatsnew/3.9.rst:1335 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " -"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" -"issue:`38500`.)" +"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner " +"in :issue:`38500`.)" msgstr "" #: ../../whatsnew/3.9.rst:1339 msgid "" -"Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" -"`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" -"type:`PyModuleDef` are no longer called if the module state was requested " -"but is not allocated yet. This is the case immediately after the module is " -"created and before the module is executed (:c:data:`Py_mod_exec` function). " -"More precisely, these functions are not called if :c:member:`~PyModuleDef." -"m_size` is greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"Extension " +"modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:`~PyModuleDef.m_clear` " +"and :c:member:`~PyModuleDef.m_free` functions of :c:type:`PyModuleDef` are " +"no longer called if the module state was requested but is not allocated yet. " +"This is the case immediately after the module is created and before the " +"module is executed (:c:data:`Py_mod_exec` function). More precisely, these " +"functions are not called if :c:member:`~PyModuleDef.m_size` is greater than " +"0 and the module state (as returned by :c:func:`PyModule_GetState`) is " +"``NULL``." msgstr "" #: ../../whatsnew/3.9.rst:1348 @@ -2172,25 +2189,26 @@ msgstr "" #: ../../whatsnew/3.9.rst:1365 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " -"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" -"`40241`.)" +"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner " +"in :issue:`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1369 msgid "" -"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" -"func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " -"``_PyUnicode_AsUnicode``, and :c:func:`!PyUnicode_AsUnicodeAndSize` are " -"marked as deprecated in C. They have been deprecated by :pep:`393` since " -"Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" +"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, " +"``PyUnicode_WSTR_LENGTH``, :c:func:`!PyUnicode_FromUnicode`, :c:func:`!" +"PyUnicode_AsUnicode`, ``_PyUnicode_AsUnicode``, and :c:func:`!" +"PyUnicode_AsUnicodeAndSize` are marked as deprecated in C. They have been " +"deprecated by :pep:`393` since Python 3.3. (Contributed by Inada Naoki " +"in :issue:`36346`.)" msgstr "" #: ../../whatsnew/3.9.rst:1376 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " -"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner in :" -"issue:`39882`.)" +"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner " +"in :issue:`39882`.)" msgstr "" #: ../../whatsnew/3.9.rst:1381 @@ -2210,10 +2228,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1388 msgid "" -"The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" -"`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " -"alias to the :c:macro:`PyObject_NewVar` macro. They no longer access " -"directly the :c:member:`PyTypeObject.tp_basicsize` member." +"The :c:func:`!PyObject_NEW` macro becomes an alias to " +"the :c:macro:`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro " +"becomes an alias to the :c:macro:`PyObject_NewVar` macro. They no longer " +"access directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" #: ../../whatsnew/3.9.rst:1393 @@ -2243,8 +2261,8 @@ msgstr "(更多資訊請見 :issue:`40170`。)" #: ../../whatsnew/3.9.rst:1409 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " -"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" -"`38835`.)" +"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner " +"in :issue:`38835`.)" msgstr "" #: ../../whatsnew/3.9.rst:1413 @@ -2261,8 +2279,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1422 msgid "" -"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" -"`37878`.)" +"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye " +"in :issue:`37878`.)" msgstr "" #: ../../whatsnew/3.9.rst:1424 @@ -2419,8 +2437,8 @@ msgid "" "``_Py_InitializeFromWideArgs``, ``_PyFloat_Repr``, ``_PyFloat_Digits``, " "``_PyFloat_DigitsInit``, ``PyFrame_ExtendStack``, ``_PyAIterWrapper_Type``, " "``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, " -"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado in :issue:" -"`39372`.)" +"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado " +"in :issue:`39372`.)" msgstr "" #: ../../whatsnew/3.9.rst:1490 @@ -2429,8 +2447,9 @@ msgstr "Python 3.9.1 中顯著的變更" #: ../../whatsnew/3.9.rst:1495 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform with :pep:" -"`586` and to match the behavior of static type checkers specified in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform " +"with :pep:`586` and to match the behavior of static type checkers specified " +"in the PEP." msgstr "" #: ../../whatsnew/3.9.rst:1498 @@ -2513,13 +2532,14 @@ msgid "" "``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of " "``(int, str, str)``; previously this was ``([int, str], str)``. To allow " "this change, :class:`types.GenericAlias` can now be subclassed, and a " -"subclass will be returned when subscripting the :class:`collections.abc." -"Callable` type. Code which accesses the arguments via :func:`typing." -"get_args` or ``__args__`` need to account for this change. A :exc:" -"`DeprecationWarning` may be emitted for invalid forms of parameterizing :" -"class:`collections.abc.Callable` which may have passed silently in Python " -"3.9.1. This :exc:`DeprecationWarning` will become a :exc:`TypeError` in " -"Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" +"subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Code which accesses the " +"arguments via :func:`typing.get_args` or ``__args__`` need to account for " +"this change. A :exc:`DeprecationWarning` may be emitted for invalid forms " +"of parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9.1. This :exc:`DeprecationWarning` will become " +"a :exc:`TypeError` in Python 3.10. (Contributed by Ken Jin " +"in :issue:`42195`.)" msgstr "" #: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 @@ -2529,13 +2549,14 @@ msgstr "urllib.parse" #: ../../whatsnew/3.9.rst:1554 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.9.rst:1565 @@ -2558,11 +2579,12 @@ msgstr "Python 3.9.5 中顯著的變更" #: ../../whatsnew/3.9.rst:1579 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.9.rst:1587 diff --git a/whatsnew/changelog.po b/whatsnew/changelog.po index 62347d8849..bbbdb4ce13 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2025-02-03 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:21+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,6 +20,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../whatsnew/changelog.rst:5 +#: ../../whatsnew/changelog.rst:7 msgid "Changelog" msgstr "Changelog(更動日誌)"